<?php /* Usage by dates, countries, totals. */ // If no id default to front page. if(!isset($_REQUEST["id"])) { return "pub_default"; } // Get detail given year/month $show_date = 'all years'; if(isset($_REQUEST["year"]) and $_REQUEST["year"]>2002) { if(isset($_REQUEST["month"]) and $_REQUEST["month"]>=1 and $_REQUEST["month"]<=12) { $dt = strtotime($_REQUEST["month"]."/1/".$_REQUEST["year"]); $show_date = date("F Y",$dt); } else { $show_date = $_REQUEST["year"]; $_REQUEST["month"] = 0; } } else { $_REQUEST["year"] = 0; $_REQUEST["month"] = 0; } if(isset($_REQUEST["range"])) { // Work out current date if($_REQUEST["range"]=='4w') { $show_date = 'past 4 weeks'; } } else { $_REQUEST["range"] = ''; } // by country // NJS 2006-06-14: Added archive name as argument. $country_abstracts = $sql->getCountryEprintType($GLOBALS["config_vars"]["archivename"],$_REQUEST["year"], $_REQUEST["month"], $_REQUEST["range"], 'abstract', $_REQUEST["id"]); $country_downloads = $sql->getCountryEprintType($GLOBALS["config_vars"]["archivename"],$_REQUEST["year"], $_REQUEST["month"], $_REQUEST["range"], 'download', $_REQUEST["id"]); // NJS 2006-01-18: Calculate total number of countries. $total_download_countries = count($country_downloads); $total_abstract_countries = count($country_abstracts); $GLOBALS["db_values"] = merge_countries($country_abstracts, $country_downloads); // title // NJS 2006-06-14: Added archive name as argument. $title = $sql->getTitle($GLOBALS["config_vars"]["archivename"],$_REQUEST["id"]); // by type $type_count = $sql->getAbstractDownload($GLOBALS["config_vars"]["archivename"],$_REQUEST["year"], $_REQUEST["month"], $_REQUEST["range"], 'download', $_REQUEST["id"]); // by date // NJS 2006-06-14: Added archive name as argument. $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); ?>