<?php require("inc.html.navbar_global.es.php"); ?> <h3>Abstract views and document downloads by country (derived from IP address of query)</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 Free 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 a small number of downloads may be reported as being from the wrong country.</p> <?php $max_width=500; if (! isset($GLOBALS["db_values"]["0"]["country_downloads"])) { print "<table>\n"; print '<tr><td align="left" width="200" style="color:#ff0000;"><b>No statistics available.</b></td></tr>'; print "\n"; } else { // Compute the longest bar $max_count = $GLOBALS["db_values"]["0"]["country_downloads"]; for ($rs=0; $rs<count($GLOBALS["db_values"]); $rs++) { if ($GLOBALS["db_values"][$rs]["country_abstracts"] > $max_count) { $max_count = $GLOBALS["db_values"][$rs]["country_abstracts"]; } } print "<table>\n"; print '<tr><th colspan="2" align="left" style="background-color:#cccccc;">Country</th> <th style="background-color:#66ddee;">Abstracts</th> <th style="background-color:#4477dd;color:#ffffff;">Downloads</th> <th style="background-color:#cccccc;"> </th></tr>'; for ($rs=0;$rs<count($GLOBALS["db_values"]);$rs++) { if ($GLOBALS["db_values"][$rs]["country_name"]=='') { $GLOBALS["db_values"][$rs]["country_name"]='unknown'; } if ($GLOBALS["db_values"][$rs]["country_name"]=='N/A') { $GLOBALS["db_values"][$rs]["country_name"]='unknown'; } print '<tr><td>'; // select a flag $ccode = strtolower($GLOBALS["db_values"][$rs]["country_code"]); $c_flag = 'flags18x14/' . $ccode . '.png'; if (file_exists($c_flag)) { print '<img src="'. $c_flag . '" width="18" height="14" alt="'. $ccode . '">'; } else { print '<img src="flags18x14/unknown.png" width="18" height="14" alt="' . $ccode . '">'; }; print '</td><td style="font-size:small;">' . $GLOBALS["db_values"][$rs]["country_name"]. '</td><td align="right" style="font-size:small;">'. $GLOBALS["db_values"][$rs]["country_abstracts"]. '</td><td align="right" style="font-size:small;">' . $GLOBALS["db_values"][$rs]["country_downloads"]. '</td>'; $cur_count = $GLOBALS["db_values"][$rs]["country_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="views" height="9" width="'. $col_width . '"><br />'; $cur_count = $GLOBALS["db_values"][$rs]["country_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="views" height="9" width="'. $col_width . '"></td></tr>'; } } // of else print "</table>\n"; ?>