- <?php
- $current_year = date("Y");
- $last_year = date("Y")-1;
-
- /*
- Lists of possible links for a navigation bar, listed in order of
- appearance. If "match" is TRUE, then this entry corresponds to
- the current page, and we only output "text" (i.e., no link). If
- "match" is FALSE, then this entry does not correspond to the
- current page, so we need to output "href" as well (i.e.,
- generate a link).
-
- Specify the match conditions in descending order of
- discrimination as much as possible, as PHP will drop out of the
- expression at the first failed test. Outputting links happens
- more often than not, so we want the decision to be made as
- quickly as possible.
- */
- $eprint_links = array(
- "4w" => array(
- "match" => (isset($_REQUEST["action"]) &&
- ($_REQUEST["action"] == "show_detail_eprint") &&
- isset($_REQUEST["range"]) &&
- ($_REQUEST["range"] == "4w")),
- "text" => "Past four weeks",
- "href" => $_SERVER['PHP_SELF']
- . "?action=show_detail_eprint;id="
- . $_REQUEST["id"]
- . ";range=4w",
- ),
- "current_year" => array(
- "match" => (isset($_REQUEST["action"]) &&
- ($_REQUEST["action"] == "show_detail_eprint") &&
- isset($_REQUEST["year"]) &&
- ($_REQUEST["year"] == $current_year) &&
- isset($_REQUEST["month"]) &&
- ($_REQUEST["month"] == 0)),
- "text" => "This year",
- "href" => $_SERVER['PHP_SELF']
- . "?action=show_detail_eprint;id="
- . $_REQUEST["id"]
- . ";year=$current_year",
- ),
- "last_year" => array(
- "match" => (isset($_REQUEST["action"]) &&
- ($_REQUEST["action"] == "show_detail_eprint") &&
- isset($_REQUEST["year"]) &&
- ($_REQUEST["year"] == $last_year) &&
- isset($_REQUEST["month"]) &&
- ($_REQUEST["month"] == 0)),
- "text" => "Last year",
- "href" => $_SERVER['PHP_SELF']
- . "?action=show_detail_eprint;id="
- . $_REQUEST["id"]
- . ";year=$last_year",
- ),
- "all_years" => array(
- "match" => (isset($_REQUEST["action"]) &&
- ($_REQUEST["action"] == "show_detail_eprint") &&
- isset($_REQUEST["year"]) &&
- ($_REQUEST["year"] == 0) &&
- isset($_REQUEST["month"]) &&
- ($_REQUEST["month"] == 0) &&
- isset($_REQUEST["range"]) &&
- ($_REQUEST["range"] == "")),
- "text" => "All years",
- "href" => $_SERVER['PHP_SELF']
- . "?action=show_detail_eprint;id="
- . $_REQUEST["id"],
- ),
- );
-
- print "<p>For this eprint: ";
- outputNavBar($eprint_links);
- print "</p>";
- ?>