4) { echo "country value not right, sorry"; exit; } // not currently used global $output; $output = $_GET['output']; if ($output == "") { $output = "html"; } // use i18n library, if we have set to use this above... if ($use_i18n) { // Dreamhost wiki tells us to use PEAR like this... ini_set( 'include_path', ini_get( 'include_path' ) . PATH_SEPARATOR . "/home/ckeene/pear/php" ); require_once 'I18N/Country.php'; // now look up the current selected country name global $currentCountryName; $currentCountryName = getCountryName($country); } // archive object used for most funcionality require_once("class.archive.php"); } //############################################ // check_args - checks the args from processed args, // but has to be run after a mysql connection is made function check_args () { //echo "check ags countryr\`n"; $country = mysql_real_escape_string ($country); $output = mysql_real_escape_string ($output); } // ########################################### // some sql statements // list of IRs for a country with current/highest // record count. function sql_irlist1 ($ircount_table, $country) { global $sql_irlist1; $sql_irlist1 = " SELECT i.identifier, r.title, max( i.records ) as highrecords FROM $ircount_table i, repositories r WHERE DATE_SUB(CURDATE(),INTERVAL 2 WEEK) <= i.collected_date AND r.location_country = \"$country\" AND i.identifier = r.eprintid GROUP BY i.identifier ORDER BY r.title"; return $sql_irlist1; } // ############################################# // function to try and record processing time function getmicrotime() { list($usec, $sec) = explode(" ",microtime()); return ((float)$usec + (float)$sec); } // ############################################ // print processing time so far function printprocessingtime($msg="") { global $scriptStartTime, $debug; if ($debug) { echo "
$msg Time elapsed: ",getmicrotime() - $scriptStartTime, " seconds
"; } } //############################ // print countries // a list of links of each country function printCountries ($ircount_table, $use_i18n) { $sql_country = "SELECT location_country FROM repositories GROUP BY location_country;"; $result = mysql_query($sql_country); //or die("Query failed : " . mysql_error()); // only try and print if we have result if ($result) { echo "\n| Date | \n"; foreach ($repositories as $idnum => $repository) { $irname = $repository->getName(); $table_out .= "$irname | \n"; } echo "
|---|---|
| $oneWeek | "; // print out record cound for this week for each repository for ($i = 1; $i <= $numOfRepositories; $i++) { $recordcount = $dateRecordLists[$i][$oneWeek]; $table_out .= "" . number_format($recordcount) . " | "; } $table_out .= "
| show | \n"; foreach ($repositories as $idnum => $repository) { $table_out .= "getIdentifier(); $table_out .= '">all data | '; } $table_out .= "
Note: Weeks with no records are not included.
data starts: $RepoChartData
"; } $RepoChartData .= "|"; // get some facts, which includes the highest count for this IR $thisRepositoryFacts = $repository->returnIRFacts(); // if this is higher than the overall highestcount, set a new highest count if ($thisRepositoryFacts['highestNumRecords'] > $highestRecordCount) { $highestRecordCount = $thisRepositoryFacts['highestNumRecords']; } // if the last (more recent) collected date for this IR is later than our current // last date, use this as the new last collected date if ($thisRepositoryFacts['lastCollectedDate'] > $lastCollectedDate) { $lastCollectedDate = $thisRepositoryFacts['lastCollectedDate']; } // same as above but for first collected date if ($thisRepositoryFacts['firstCollectedDate'] < $firstCollectedDate) { $firstCollectedDate = $thisRepositoryFacts['firstCollectedDate']; } // add this IRs name to the list of names $nameList .= $repository->getName() . "|"; } // end of loop for each repository // a hack... remove the pipe for the last repository $RepoChartData = rtrim($RepoChartData, "|"); $nameList = rtrim($nameList, "|"); // build the google chart url............ // chs=250x100 is the chart's size in pixels. // chd=t:60,40 is the chart's data. // cht=p3 is the chart's type. // chl=Hello|World is the chart's label // chds data scaling . // chart labels... // chxt=x,y // chxl= // 0:|Jan|July|Jan|July|Jan| // 1:|0|50|100| $url = $urlStart . "&chs=" . $size . "&chd=t:" . $RepoChartData . "&chds=1,$highestRecordCount" . "&chco=ff0000,00ff00,0000ff,00ffff,cc9900,990066,ffff33,006600" . "&chdl=" . $nameList . "&chxt=x,y" . "&chxr=1,0," . $highestRecordCount . "&chxl=0:|" . $firstCollectedDate . "|" . $lastCollectedDate; return $url; } // ################################################# // function IS_ODD // can be used to check odd/even for table blue/white function IS_ODD($number) { return($number & 1); } // ################################################ // print page header function printhtmlhead($title2, $extrahead=" ") { // extra head just sounds sooo wrong echo '