Newer
Older
Digital_Repository / Repositories / statistics / includes / inc.html.navbar_global.es.php
nstanger on 4 May 2006 3 KB - Tweaked colour of stats notice.
<?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.
	*/
	$most_viewed_links = array(
		"4w" => array(
			"match" => (isset($_REQUEST["action"]) &&
						($_REQUEST["action"] == "show_detail_date") &&
						isset($_REQUEST["range"]) &&
						($_REQUEST["range"] == "4w")),
			"text" => "Past four weeks",
			"href" => $_SERVER['PHP_SELF'] . "?action=show_detail_date;range=4w",
		),
		"current_year" => array(
			"match" => (isset($_REQUEST["action"]) &&
						($_REQUEST["action"] == "show_detail_date") &&
						isset($_REQUEST["year"]) &&
						($_REQUEST["year"] == $current_year) &&
						isset($_REQUEST["month"]) &&
						($_REQUEST["month"] == 0)),
			"text" => "This year",
			"href" => $_SERVER['PHP_SELF'] . "?action=show_detail_date;year=" . $current_year,
		),
		"last_year" => array(
			"match" => (isset($_REQUEST["action"]) &&
						($_REQUEST["action"] == "show_detail_date") &&
						isset($_REQUEST["year"]) &&
						($_REQUEST["year"] == $last_year) &&
						isset($_REQUEST["month"]) &&
						($_REQUEST["month"] == 0)),
			"text" => "Last year",
			"href" => $_SERVER['PHP_SELF'] . "?action=show_detail_date;year=" . $last_year,
		),
		"all_years" => array(
			"match" => (isset($_REQUEST["action"]) &&
						($_REQUEST["action"] == "show_detail_date") &&
						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_date",
		),
	);

	$repository_wide_links = array(
		"cumulative_usage" => array(
			"match" => (isset($_REQUEST["action"]) &&
						($_REQUEST["action"] == "cumulative_usage") &&
						isset($_REQUEST["range"]) &&
						($_REQUEST["range"] == "all")),
			"text" => "by Year/month",
			"href" => $_SERVER['PHP_SELF'] . "?action=cumulative_usage;range=all",
		),
		"cumulative_usage_country" => array(
			"match" => (isset($_REQUEST["action"]) &&
						($_REQUEST["action"] == "cumulative_usage_country")),
			"text" => "by Country",
			"href" => $_SERVER['PHP_SELF'] . "?action=cumulative_usage_country",
		),
	);
	
	print "<p>Most viewed eprints: ";
	outputNavBar($most_viewed_links);
	
	print "<br />";
	
	print "Repository-wide statistics: ";
	outputNavBar($repository_wide_links);
	
	print "</p>";
?>

<p style="background-color:#FFDD88;padding:10px;">
<strong style="color:red;">2 May 2006:</strong> You may notice that the figures given in the usage statistics have changed dramatically since your last visit. This is not an error. We recently discovered a bug in the statistics generating software that under certain operating conditions caused repository accesses to be counted multiple times. This bug has now been fixed and the statistics regenerated to reflect the correct values.
</p>