Newer
Older
Digital_Repository / Repositories / statistics / includes / inc.html.navbar_eprint.es.php
  1. <?php
  2. $current_year = date("Y");
  3. $last_year = date("Y")-1;
  4. /*
  5. Lists of possible links for a navigation bar, listed in order of
  6. appearance. If "match" is TRUE, then this entry corresponds to
  7. the current page, and we only output "text" (i.e., no link). If
  8. "match" is FALSE, then this entry does not correspond to the
  9. current page, so we need to output "href" as well (i.e.,
  10. generate a link).
  11.  
  12. Specify the match conditions in descending order of
  13. discrimination as much as possible, as PHP will drop out of the
  14. expression at the first failed test. Outputting links happens
  15. more often than not, so we want the decision to be made as
  16. quickly as possible.
  17. */
  18. $eprint_links = array(
  19. "4w" => array(
  20. "match" => (isset($_REQUEST["action"]) &&
  21. ($_REQUEST["action"] == "show_detail_eprint") &&
  22. isset($_REQUEST["range"]) &&
  23. ($_REQUEST["range"] == "4w")),
  24. "text" => "Past four weeks",
  25. "href" => $_SERVER['PHP_SELF']
  26. . "?action=show_detail_eprint;id="
  27. . $_REQUEST["id"]
  28. . ";range=4w",
  29. ),
  30. "current_year" => array(
  31. "match" => (isset($_REQUEST["action"]) &&
  32. ($_REQUEST["action"] == "show_detail_eprint") &&
  33. isset($_REQUEST["year"]) &&
  34. ($_REQUEST["year"] == $current_year) &&
  35. isset($_REQUEST["month"]) &&
  36. ($_REQUEST["month"] == 0)),
  37. "text" => "This year",
  38. "href" => $_SERVER['PHP_SELF']
  39. . "?action=show_detail_eprint;id="
  40. . $_REQUEST["id"]
  41. . ";year=$current_year",
  42. ),
  43. "last_year" => array(
  44. "match" => (isset($_REQUEST["action"]) &&
  45. ($_REQUEST["action"] == "show_detail_eprint") &&
  46. isset($_REQUEST["year"]) &&
  47. ($_REQUEST["year"] == $last_year) &&
  48. isset($_REQUEST["month"]) &&
  49. ($_REQUEST["month"] == 0)),
  50. "text" => "Last year",
  51. "href" => $_SERVER['PHP_SELF']
  52. . "?action=show_detail_eprint;id="
  53. . $_REQUEST["id"]
  54. . ";year=$last_year",
  55. ),
  56. "all_years" => array(
  57. "match" => (isset($_REQUEST["action"]) &&
  58. ($_REQUEST["action"] == "show_detail_eprint") &&
  59. isset($_REQUEST["year"]) &&
  60. ($_REQUEST["year"] == 0) &&
  61. isset($_REQUEST["month"]) &&
  62. ($_REQUEST["month"] == 0) &&
  63. isset($_REQUEST["range"]) &&
  64. ($_REQUEST["range"] == "")),
  65. "text" => "All years",
  66. "href" => $_SERVER['PHP_SELF']
  67. . "?action=show_detail_eprint;id="
  68. . $_REQUEST["id"],
  69. ),
  70. );
  71. print "<p>For this eprint: ";
  72. outputNavBar($eprint_links);
  73. print "</p>";
  74. ?>