Newer
Older
Digital_Repository / Repositories / statistics / includes / inc.html.cumulative_usage.es.php
nstanger on 27 Nov 2005 1 KB - Added intelligent navigation bars.
<?php
	require("inc.html.navbar_global.es.php");
?>

<h3>Abstract views and document downloads by year/month</h3>      

<?php
	$max_count = $GLOBALS["db_values"][0]["abstracts"];
	for ($rs=0;$rs<count($GLOBALS["db_values"]);$rs++)
	{
		if($max_count < $GLOBALS["db_values"][$rs]["abstracts"])
			$max_count = $GLOBALS["db_values"][$rs]["abstracts"];
	}
	$max_width = '500'; // Max pixel width of barchart.
	
	print '<span style="font-size:small;">Click on a month to see document downloads for that month.</span>';
	print "<table>\n";
	print '<tr><th style="background-color:#cccccc;">Period</th>
		<th style="background-color:#66ddee;">Abstracts</th>
		<th style="background-color:#4477dd;color:#ffffff;">Downloads</th>
		<th style="background-color:#cccccc;">&nbsp;</th></tr>';
	for ($rs=0;$rs<count($GLOBALS["db_values"]);$rs++)
	{
		$monthnum = (int) strpos('JanFebMarAprMayJunJulAugSepOctNovDec', $GLOBALS["db_values"][$rs]["month"])/3 + 1;
		print '<tr><td style="font-size:small;"><a href="'.
			$_SERVER['PHP_SELF'].
			'?action=show_detail_date;year='.
			$GLOBALS["db_values"][$rs]["year"].
			';month=' .
			$monthnum .
			'">' .
			$GLOBALS["db_values"][$rs]["year"].
			' '.
			$GLOBALS["db_values"][$rs]["month"].
			'</a></td><td align="right" style="font-size:small;">'.
			$GLOBALS["db_values"][$rs]["abstracts"].
			'</td><td align="right" style="font-size:small;">'.
			$GLOBALS["db_values"][$rs]["downloads"].
			'</td>';
		$cur_count = $GLOBALS["db_values"][$rs]["abstracts"];
		$col_width = (int) ($cur_count/$max_count * $max_width);
		$col_width = max($col_width, 1);
		$col_width .= "px";
		print '<td align="left"><img src="bars/hh.png" alt="abstracts" height="9" width="'. 
			$col_width . 
			'"><br />';
		$cur_count = $GLOBALS["db_values"][$rs]["downloads"];
		$col_width = (int) ($cur_count/$max_count * $max_width);
		$col_width = max($col_width, 1);
		$col_width .= "px";
print '<img src="bars/hp.png" alt="downloads" height="9" width="'. 
			$col_width . 
			'"></td></tr>';
	}
	print "</table>\n";
?>