Newer
Older
Digital_Repository / Repositories / statistics / includes / inc.html.show_detail_eprint.es.php
  1. <?php
  2. // NJS 2005-12-08: Grab document title on the fly if necessary.
  3. if ($title == '')
  4. {
  5. // NJS 2006-06-14: Added archive name as argument.
  6. $title = $sql->getEPrintTitle($GLOBALS["config_vars"]["archivename"],$_REQUEST["id"]);
  7. if ($title == '')
  8. $title = 'Eprint #' . sprintf("%08d", $_REQUEST["id"]) . ' (title is not available)';
  9. }
  10. // Create link to eprint.
  11. // NJS 2006-06-14: Added archive name as index.
  12. $title_link = '<a href="'.
  13. $GLOBALS["config_vars"]["general"]["eprints_location"][$GLOBALS["config_vars"]["archivename"]] .
  14. '/';
  15. // NJS 2007-07-24: Long URLs no longer appear to work in EPrints 3,
  16. // so we need to check the version.
  17. if ( $GLOBALS["config_vars"]["general"]["eprints_version"] > 2 )
  18. {
  19. $title_link .= $_REQUEST["id"];
  20. }
  21. else
  22. {
  23. $title_link .= 'archive/' .
  24. sprintf("%08d", $_REQUEST["id"]);
  25. }
  26. $title_link .= '/" target="_blank">' .
  27. $title .
  28. '</a>';
  29. ?>
  30.  
  31. <h3><?php print $title_link; ?></h3>
  32.  
  33. <?php
  34. /*
  35. NJS 2005-11-27: Note that we load the eprint-specific navigation
  36. bar manually rather than through the actions/includes array in
  37. inc.vars.es.php. This is (currently) the only place that it's
  38. used, and adding it to the array would require us to break this
  39. file into two parts.
  40. */
  41. require("inc.html.navbar_eprint.es.php");
  42.  
  43. $max_width = '400'; // Max pixel width of barcharts
  44. ?>
  45.  
  46. <table cellspacing='0' cellpadding='4'>
  47. <tr>
  48. <td colspan="7"><h4 style="margin-top: 0px;">Abstract views and full text downloads for <?php print $show_date; ?></h4></td>
  49. </tr>
  50. <?php
  51. $count0 = 0;
  52. $count1 = 0;
  53.  
  54. // NJS 2006-01-18: Calculate number of distinct countries for views/downloads.
  55. $count0c = 0;
  56. $count1c = 0;
  57.  
  58. if (isset($type_count["0"]["count"])) {
  59. if ($type_count["0"]["view_type"] != "download") {
  60. $count0 = $type_count["0"]["count"];
  61. $count0c = $type_count["0"]["countries"];
  62. } else {
  63. $count1 = $type_count["0"]["count"];
  64. $count1c = $type_count["0"]["countries"];
  65. }
  66. }
  67. if (isset($type_count["1"]["count"])) {
  68. if ($type_count["1"]["view_type"] != "download") {
  69. $count0 = $type_count["1"]["count"];
  70. $count0c = $type_count["1"]["countries"];
  71. } else {
  72. $count1 = $type_count["1"]["count"];
  73. $count1c = $type_count["1"]["countries"];
  74. }
  75. }
  76. $max_count = max($count0, $count1, 1);
  77. if ($count0 + $count1 > 0)
  78. {
  79. print '<tr><td colspan="7"><span style="font-size:small;">The numbers in (parentheses) are the number of distinct countries that abstract views and full text downloads originated from.</span></td></tr>';
  80. print '<tr><th colspan="2" align="left" width="150" style="background-color:#cccccc;">&nbsp;</th>
  81. <th colspan="2" style="background-color:#66ddee;">Abstracts</th>
  82. <th colspan="2" style="background-color:#4477dd;color:#ffffff;">Full text</th>
  83. <th style="background-color:#cccccc;">&nbsp;</th></tr>';
  84. print '<tr><td colspan="2" align="left" style="background-color:#2ea495;color:#ffffff;font-size:small;"><b>Views</b></td><td align="right" style="font-size:small;">'.
  85. $count0.
  86. '</td><td align="right" style="font-size:small;border-right:1px solid #dddddd;">(' .
  87. $count0c.
  88. ')</td><td align="right" style="font-size:small;">' .
  89. $count1 .
  90. '</td><td align="right" style="font-size:small;border-right:1px solid #dddddd;">(' .
  91. $count1c.
  92. ')</td>';
  93. $cur_count = $count0;
  94. $col_width = (int) ($cur_count/$max_count * $max_width);
  95. if ( $cur_count > 0 ) $col_width = max($col_width,1);
  96. print '<td align="left"><img src="bars/hh.png" alt="abstracts" height="9" width="'. $col_width . '" /><br />';
  97. $cur_count = $count1;
  98. $col_width = (int) ($cur_count/$max_count * $max_width);
  99. if ( $cur_count > 0 ) $col_width = max($col_width,1);
  100. print '<img src="bars/hp.png" alt="downloads" height="9" width="'. $col_width . '" /></td></tr>';
  101. } else {
  102. print '<tr><td colspan="7" align="left" width="200"><strong style="color:#ff0000;">This document has not been viewed in this period.</strong></td></tr>';
  103. }
  104. ?>
  105.  
  106. <tr>
  107. <td colspan="7"><h4>Downloads by country (derived from IP address of query) for <?php print $show_date; ?></h4></td>
  108. </tr>
  109. <?php
  110. // NJS 2007-02-07: Rewritten to match similar code in
  111. // inc.html.cumulative_usage_country.php.
  112. if (!isset($GLOBALS["db_values"]["0"]["country_downloads"])) {
  113. print '<tr><td colspan="7" align="left" width="200" style="color:#ff0000;"><b>No statistics available.</b></td></tr>';
  114. }
  115. else {
  116. $max_count = max( getMaxCount( 'country' ), 1 );
  117. print '<tr><td colspan="7"><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>
  118. <tr><th colspan="2" style="background-color:#cccccc;" width="150">Country</th>
  119. <th colspan="2" style="background-color:#66ddee;">Abstracts</th>
  120. <th colspan="2" style="background-color:#4477dd;color:#ffffff;">Full text</th>
  121. <th style="background-color:#cccccc;">&nbsp;</th></tr>';
  122. generateCountryTable( 'country', $max_count, $max_width );
  123. }
  124. ?>
  125.  
  126. <tr>
  127. <td colspan="7"><h4>Downloads by automated indexers and crawlers for <?php print $show_date; ?></h4></td>
  128. </tr>
  129. <?php
  130. if (!isset($GLOBALS["db_values"]["0"]["country_downloads"])) {
  131. print '<tr><td colspan="7" align="left" width="200" style="color:#ff0000;"><b>No statistics available.</b></td></tr>';
  132. }
  133. else {
  134. $max_count = max( getMaxCount( 'bot' ), 1 );
  135. print '<tr><td colspan="7"><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>
  136. <tr><th colspan="2" style="background-color:#cccccc;" width="150">Country</th>
  137. <th colspan="2" style="background-color:#66ddee;">Abstracts</th>
  138. <th colspan="2" style="background-color:#4477dd;color:#ffffff;">Full text</th>
  139. <th style="background-color:#cccccc;">&nbsp;</th></tr>';
  140. generateCountryTable( 'bot', $max_count, $max_width );
  141. }
  142. ?>
  143.  
  144. <tr>
  145. <td colspan="7"><h4>History of views for this eprint</h4></td>
  146. </tr>
  147.  
  148. <?php
  149. if (count($month_tally) > 0)
  150. {
  151. $max_count = 1;
  152. for ($rs=0;$rs<count($month_tally);$rs++) {
  153. if($max_count < $month_tally[$rs]["abstracts"])
  154. $max_count = $month_tally[$rs]["abstracts"];
  155. if($max_count < $month_tally[$rs]["downloads"])
  156. $max_count = $month_tally[$rs]["downloads"];
  157. }
  158. print '<tr><td colspan="7"><span style="font-size:small;">Click on a month to see document downloads for that month.<br />
  159. The numbers in (parentheses) are the number of distinct countries or search engines that abstract views and full text downloads originated from.</span></td></tr>';
  160. print '<tr><th colspan="2" style="background-color:#cccccc;" width="150">Period</th><th colspan="2" style="background-color:#66ddee;">Abstracts</th><th colspan="2" style="background-color:#4477dd;color:#ffffff;">Full text</th><th style="background-color:#cccccc;">&nbsp;</th></tr>';
  161. for ($rs=0;$rs<count($month_tally);$rs++)
  162. {
  163.  
  164. $str_posn = strpos('JanFebMarAprMayJunJulAugSepOctNovDec',$month_tally[$rs]["month"]);
  165. if ($str_posn === false) $str_posn = 0;
  166. $month_number = (int) ($str_posn / 3) + 1;
  167.  
  168. // NJS 2005-12-15: subtly highlight every alternate row
  169. print '<tr';
  170. if ($rs % 2) print ' style="background-color:#EDF3FE;"';
  171. // NJS 2006-06-14: Only generate a link if there are actually
  172. // some downloads.
  173. print '><td colspan="2" style="font-size:small;border-right:1px solid #dddddd;">';
  174. if ( $month_tally[$rs]["downloads"] > 0 )
  175. print '<a href="'.
  176. $_SERVER['PHP_SELF'].
  177. '?action=show_detail_eprint;id=' .
  178. $_REQUEST["id"] .
  179. ';year=' .
  180. (int) $month_tally[$rs]["year"] .
  181. ';month='.
  182. $month_number .
  183. '">';
  184. print (int) $month_tally[$rs]["year"] .
  185. ' '.
  186. $month_tally[$rs]["month"];
  187. if ( $month_tally[$rs]["downloads"] > 0 )
  188. print '</a>';
  189. print '</td>';
  190. print '<td align="right" style="font-size:small;">'.
  191. $month_tally[$rs]["abstracts"].
  192. '</td><td align="right" style="font-size:small;border-right:1px solid #dddddd;">('.
  193. $month_tally[$rs]["acountries"].
  194. ')</td>';
  195. print '<td align="right" style="font-size:small;">'.
  196. $month_tally[$rs]["downloads"].
  197. '</td><td align="right" style="font-size:small;border-right:1px solid #dddddd;">('.
  198. $month_tally[$rs]["dcountries"].
  199. ')</td>';
  200. // abstract views bar
  201. $cur_count = $month_tally[$rs]["abstracts"];
  202. $col_width = (int) ($cur_count/$max_count * $max_width);
  203. if ( $cur_count > 0 ) $col_width = max($col_width,1);
  204. print '<td align="left"><img src="bars/hh.png" alt="views" height="9" width="'.
  205. $col_width .
  206. '" /><br />';
  207. // download views bar
  208. $cur_count = $month_tally[$rs]["downloads"];
  209. $col_width = (int) ($cur_count/$max_count * $max_width);
  210. if ( $cur_count > 0 ) $col_width = max($col_width,1);
  211. print '<img src="bars/hp.png" alt="views" height="9" width="'.
  212. $col_width .
  213. '" /></td></tr>';
  214. }
  215. } else {
  216. print '<tr><td colspan="7" align="left" width="200" style="color:#ff0000;"><b>No statistics available.</b></td></tr>';
  217. }
  218. ?>
  219.  
  220. </table>