<?php $current_year = date("Y"); $last_year = date("Y")-1; ?> <h3>Abstract views and document downloads by month/year</h3> <p>Most viewed eprints: [<a href="<?php print $_SERVER['PHP_SELF']; ?>?action=show_detail_date;range=4w">Past four weeks</a>] [<a href="<?php print $_SERVER['PHP_SELF']; ?>?action=show_detail_date;year=<?php print $current_year; ?>">This year</a>] [<a href="<?php print $_SERVER['PHP_SELF']; ?>?action=show_detail_date;year=<?php print $last_year; ?>">Last year</a>] [<a href="<?php print $_SERVER['PHP_SELF']; ?>?action=show_detail_date">All years</a>] <br />Repository-wide statistics: [<a href="<?php print $_SERVER['PHP_SELF']; ?>?action=cumulative_usage;range=all">by Year/month</a>] [<a href="<?php print $_SERVER['PHP_SELF']; ?>?action=cumulative_usage_country">by Country</a>] </p> <?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;"> </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"; ?>