Newer
Older
Digital_Repository / Repositories / statistics / includes / inc.html.cumulative_usage.es.php
nstanger on 27 Nov 2005 1 KB - Added intelligent navigation bars.
  1. <?php
  2. require("inc.html.navbar_global.es.php");
  3. ?>
  4.  
  5. <h3>Abstract views and document downloads by year/month</h3>
  6.  
  7. <?php
  8. $max_count = $GLOBALS["db_values"][0]["abstracts"];
  9. for ($rs=0;$rs<count($GLOBALS["db_values"]);$rs++)
  10. {
  11. if($max_count < $GLOBALS["db_values"][$rs]["abstracts"])
  12. $max_count = $GLOBALS["db_values"][$rs]["abstracts"];
  13. }
  14. $max_width = '500'; // Max pixel width of barchart.
  15. print '<span style="font-size:small;">Click on a month to see document downloads for that month.</span>';
  16. print "<table>\n";
  17. print '<tr><th style="background-color:#cccccc;">Period</th>
  18. <th style="background-color:#66ddee;">Abstracts</th>
  19. <th style="background-color:#4477dd;color:#ffffff;">Downloads</th>
  20. <th style="background-color:#cccccc;">&nbsp;</th></tr>';
  21. for ($rs=0;$rs<count($GLOBALS["db_values"]);$rs++)
  22. {
  23. $monthnum = (int) strpos('JanFebMarAprMayJunJulAugSepOctNovDec', $GLOBALS["db_values"][$rs]["month"])/3 + 1;
  24. print '<tr><td style="font-size:small;"><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;">'.
  37. $GLOBALS["db_values"][$rs]["downloads"].
  38. '</td>';
  39. $cur_count = $GLOBALS["db_values"][$rs]["abstracts"];
  40. $col_width = (int) ($cur_count/$max_count * $max_width);
  41. $col_width = max($col_width, 1);
  42. $col_width .= "px";
  43. print '<td align="left"><img src="bars/hh.png" alt="abstracts" height="9" width="'.
  44. $col_width .
  45. '"><br />';
  46. $cur_count = $GLOBALS["db_values"][$rs]["downloads"];
  47. $col_width = (int) ($cur_count/$max_count * $max_width);
  48. $col_width = max($col_width, 1);
  49. $col_width .= "px";
  50. print '<img src="bars/hp.png" alt="downloads" height="9" width="'.
  51. $col_width .
  52. '"></td></tr>';
  53. }
  54. print "</table>\n";
  55. ?>
  56.