Newer
Older
Digital_Repository / Repositories / statistics / includes / inc.html.cumulative_usage.es.php
nstanger on 19 Jan 2006 2 KB - Fixed HTML bugs in various pages.
  1. <h3>Abstract views and document downloads by year/month</h3>
  2.  
  3. <?php
  4. $max_count = $GLOBALS["db_values"][0]["abstracts"];
  5. for ($rs=0;$rs<count($GLOBALS["db_values"]);$rs++)
  6. {
  7. if($max_count < $GLOBALS["db_values"][$rs]["abstracts"])
  8. $max_count = $GLOBALS["db_values"][$rs]["abstracts"];
  9. }
  10. $max_width = '500'; // Max pixel width of barchart.
  11. print "<table cellspacing='0' cellpadding='4'>\n";
  12. print '<tr><td colspan="6"><span style="font-size:small;">Click on a month to see document downloads for that month.<br />
  13. The numbers in (parentheses) are the number of distinct countries that views/downloads originated from.</span></td></tr>';
  14. print '<tr><th style="background-color:#cccccc;">Period</th>
  15. <th colspan="2" style="background-color:#66ddee;">Abstracts</th>
  16. <th colspan="2" style="background-color:#4477dd;color:#ffffff;">Downloads</th>
  17. <th style="background-color:#cccccc;">&nbsp;</th></tr>';
  18. for ($rs=0;$rs<count($GLOBALS["db_values"]);$rs++)
  19. {
  20. $monthnum = (int) strpos('JanFebMarAprMayJunJulAugSepOctNovDec', $GLOBALS["db_values"][$rs]["month"])/3 + 1;
  21. // NJS 2005-12-15: subtly highlight every alternate row
  22. print '<tr';
  23. if ($rs % 2) print ' style="background-color:#EDF3FE;"';
  24. print '><td style="font-size:small;border-right:1px solid #dddddd;"><a href="'.
  25. $_SERVER['PHP_SELF'].
  26. '?action=show_detail_date;year='.
  27. $GLOBALS["db_values"][$rs]["year"].
  28. ';month=' .
  29. $monthnum .
  30. '">' .
  31. $GLOBALS["db_values"][$rs]["year"].
  32. ' '.
  33. $GLOBALS["db_values"][$rs]["month"].
  34. '</a></td><td align="right" style="font-size:small;">'.
  35. $GLOBALS["db_values"][$rs]["abstracts"].
  36. '</td><td align="right" style="font-size:small;border-right:1px solid #dddddd;">('.
  37. $GLOBALS["db_values"][$rs]["acountries"].
  38. ')</td><td align="right" style="font-size:small;">'.
  39. $GLOBALS["db_values"][$rs]["downloads"].
  40. '</td><td align="right" style="font-size:small;border-right:1px solid #dddddd;">('.
  41. $GLOBALS["db_values"][$rs]["dcountries"].
  42. ')</td>';
  43. $cur_count = $GLOBALS["db_values"][$rs]["abstracts"];
  44. $col_width = (int) ($cur_count/$max_count * $max_width);
  45. $col_width = max($col_width, 1);
  46. $col_width .= "px";
  47. print '<td align="left"><img src="bars/hh.png" alt="abstracts" height="9" width="'.
  48. $col_width .
  49. '"><br />';
  50. $cur_count = $GLOBALS["db_values"][$rs]["downloads"];
  51. $col_width = (int) ($cur_count/$max_count * $max_width);
  52. $col_width = max($col_width, 1);
  53. $col_width .= "px";
  54. print '<img src="bars/hp.png" alt="downloads" height="9" width="'.
  55. $col_width .
  56. '"></td></tr>';
  57. }
  58. print "</table>\n";
  59. ?>
  60.