diff --git a/Repositories/statistics/includes/inc.fns.show_detail_eprint.es.php b/Repositories/statistics/includes/inc.fns.show_detail_eprint.es.php index dbc2426..6a4b7a9 100755 --- a/Repositories/statistics/includes/inc.fns.show_detail_eprint.es.php +++ b/Repositories/statistics/includes/inc.fns.show_detail_eprint.es.php @@ -48,5 +48,197 @@ $month_downloads = $sql->getCumulativeUsageType($GLOBALS["config_vars"]["archivename"],$_REQUEST["id"],'download'); $month_abstracts = $sql->getCumulativeUsageType($GLOBALS["config_vars"]["archivename"],$_REQUEST["id"],'abstract'); $month_tally = merge_dates($month_abstracts,$month_downloads); + + + /* NJS 2007-01-31 + Calculate the length of the largest bar for the country + downloads histogram. + + This was refactored from inc.html.show_detail_eprint.php. + + Arguments: $mode either 'country' (count only real countries) + or 'bot' (count only bots/crawlers) + + Returns: integer + */ + function getMaxCount ( $mode ) + { + $max = 0; + + for ( $rs = 0; $rs < count( $GLOBALS["db_values"] ); $rs++ ) + { + /* If we're in country mode, skip all bot entries (country + code starts with 'X@'). If we're in bot mode, skip + all country entries (country code *doesn't* start with + 'X@'). + */ + $cc = substr( $GLOBALS["db_values"][$rs]["country_code"], 0, 2 ); + if ( ( $mode == 'country' ) && ( $cc == 'X@' ) ) continue; + if ( ( $mode == 'bot' ) && ( $cc != 'X@' ) ) continue; + + // Check abstracts... + $abs = $GLOBALS["db_values"][$rs]["country_abstracts"]; + if ( $abs > $max ) + { + $max = $abs; + } + + // ...then downloads. + $dl = $GLOBALS["db_values"][$rs]["country_downloads"]; + if ( $dl > $max ) + { + $max = $dl; + } + } + return $max; + } + + + /* NJS 2007-02-02 + Output a "country" downloads histogram. This function only + generates rows (
'; + + // select a flag + // NJS 2005-12-15 make flags and country names links to detail page + $ccode = strtolower($ccode); + $c_flag = 'flags18x14/' . $ccode . '.png'; + // NJS 2006-06-14: Only generate a link if there are actually + // some downloads. + if ( $dl > 0 ) + print ''; + if (file_exists($c_flag)) { + print ''; + } else { + print ''; + }; + if ( $dl > 0 ) + print ''; + + print ' | '; + // NJS 2006-06-14: Only generate a link if there are actually + // some downloads. + if ( $dl > 0 ) + print ''; + print $GLOBALS["db_values"][$rs]["country_name"]; + if ( $dl > 0 ) + print ''; + print ' | '. + ( ( $abs > 0 ) ? $abs : '' ). + ' | ' . + ( ( $dl > 0 ) ? $dl : '' ). + ' | '; + + $cur_count = $abs; + $col_width = (int) ($cur_count/$max_count * $max_width); + if ( $abs > 0 ) $col_width = max($col_width,1); + print ''; + + $cur_count = $dl; + $col_width = (int) ($cur_count/$max_count * $max_width); + if ($dl > 0) $col_width = max($col_width,1); + print ' | ||
Grand Totals: | +'. + $total_abstracts. + ' | +abstract'; + if ( $mode == 'country' ) + { + print ' views originating from '. + count($abstract_countries). + ' distinct countries | ||||
---|---|---|---|---|---|---|
+ | '. + $total_downloads. + ' | full text '; + if ($mode == 'country' ) + { + print 'downloads originating from '. + count($download_countries). + ' distinct countries |