Newer
Older
Digital_Repository / Repositories / statistics / includes / inc.html.cumulative_usage_country.es.php
nstanger on 7 Feb 2007 2 KB - Refactored table generation.
<h3>Abstract views and full text downloads by source</h3>

<p><strong>Note:</strong> The country of origin is determined by looking up the source IP address in the <a href="http://www.maxmind.com/app/geoip_country">GeoLite Country</a> database provided by MaxMind LLC. Due to the ever-changing nature of the Internet, this database can never be 100% complete or accurate, so it is possible that a small number of downloads may be reported as being from the wrong country. Hits from automated indexers and crawlers for Internet search engines are listed separately at the <a href="#bots">bottom of the page</a>.</p>

<table cellspacing='0' cellpadding='4'>

<?php
/* NJS 2001-01-31
   Refactored code to calculate longest bar and generate table contents
   into separate functions in inc.fns.cumulative_usage_country. This makes
   it easier to separate off hits from search engine bots and crawlers.
*/

$max_width=400;

if (! isset($GLOBALS["db_values"]["0"]["country_downloads"])) {
	print '<tr><td align="left" width="200"><strong style="color:#ff0000;">No statistics available.</strong></td></tr>';
} else {
	// Output table for "real" countries.
	// Compute the longest bar.
	// NJS 2006-06-14: You never know, there may be no downloads or
	// abstracts yet, so make sure it's at least 1 to avoid div/0 errors.
	$max_count = max( getMaxCount( 'country' ), 1 );
	
	print "<tr><td colspan='5'><h4 style='margin-top: 0px;'>Downloads by country (derived from IP address of query)</h4></td></tr>\n";
	print '<tr><td colspan="5"><span style="font-size:small;">Click on a country name or flag to view details of the eprints that have been downloaded from that country.</span></td></tr>';
	print '<tr><th colspan="2" style="background-color:#cccccc;">Country</th>
	<th style="background-color:#66ddee;">Abstracts</th>
	<th style="background-color:#4477dd;color:#ffffff;">Full text</th>
	<th style="background-color:#cccccc;">&nbsp;</th></tr>';
	
	generateCountryTable( 'country', $max_count, $max_width );

	// Output table for search engine bots/crawlers.
	print '<tr><td colspan="5"><a name="bots"></a>';
	print "<h4>Downloads by automated indexers and crawlers</h4></td></tr>\n";

	$max_count = max( getMaxCount( 'bot' ), 1 );
	
	print '<tr><td colspan="5"><span style="font-size:small;">Click on a search engine name or icon to view details of the eprints that have been indexed by that engine.</span></td></tr>';
	print '<tr><th colspan="2" style="background-color:#cccccc;">Search engine</th>
	<th style="background-color:#66ddee;">Abstracts</th>
	<th style="background-color:#4477dd;color:#ffffff;">Full text</th>
	<th style="background-color:#cccccc;">&nbsp;</th></tr>';
	
	generateCountryTable( 'bot', $max_count, $max_width );

} // of else

?>

</table>