<?php
// $Id: viewyear.php,v 1.7 2007/08/24 18:25:15 koczan Exp $	

include("/s/www/html/includes/dept.head.html");
print "<title>" . $_GET['year'] . " Tech Reports</title>\n";
include("/s/www/html/includes/dept.headfinish.html");
include("/s/www/html/includes/dept.sidebar.html");
?>

<h2>Tech Reports for <?php print $_GET['year']; ?></h2>

<?php
if (!$_GET['year']) {
  print "<p>No year selected.\n";

} else {
  $given_year = $_GET['year'];
  $file = fopen("/s/www/html-data/reports", 'r');
  $found = 0;

  while (!feof($file)) {
    $id = chop(fgets($file));
    $author = chop(fgets($file));
    $title = chop(fgets($file));
    $year = chop(fgets($file));
    $abstract = chop(fgets($file));
    $filename = chop(fgets($file));

    if ($year == $given_year) {
      print "<p><li>Tech Report ID: TR$id
<br>$title
<br>$author
<br><a href=viewreport.php?report=$id>View report information</a> || <a href=$filename>Download this report (PDF)</a>\n";
      $found = 1;
    }
  }

  if ($found == 0) {
    print "<p>No tech reports found for $given_year.\n";
  }

  fclose($file);
}
?>

<hr>
<p><a href=index.php>Return to tech report index</a>

<?php
include("/s/www/html/includes/dept.end.html");
?>
