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