function showResults() { #---------------------------------------------------------------------- global $chosenEventId, $chosenRegionId, $chosenYears, $chosenShow, $chosenSingle, $chosenAverage; #--- Try the cache tryCache('event', $chosenEventId, preg_replace('/ /', '', $chosenRegionId), $chosenYears, preg_replace('/ /', '', $chosenShow), $chosenSingle, $chosenAverage); #------------------------------ # Prepare stuff for the query. #------------------------------ $eventCondition = eventCondition(); $yearCondition = yearCondition(); $regionCondition = regionCondition('result'); $limitCondition = ''; if (preg_match('/^10+/', $chosenShow, $matches)) { $limitNumber = $matches[0]; $limitCondition = 'LIMIT ' . 2 * $limitNumber; } $valueSource = $chosenAverage ? 'average' : 'best'; $valueName = $chosenAverage ? 'Average' : 'Single'; #------------------------------ # Get results from database. #------------------------------ if ($chosenShow == 'By Region') { require 'includes/events_regions.php'; return; } if ($chosenShow == '100 Results' || $chosenShow == '1000 Results') { require 'includes/events_results.php'; } else { require 'includes/events_persons.php'; } #------------------------------ # Show the table. #------------------------------ startTimer(); $event = getEvent($chosenEventId); tableBegin('results', 6); tableCaption(true, spaced(array($event['name'], chosenRegionName(), $chosenYears, $chosenShow))); $headerSources = $chosenAverage ? 'Result Details' : ''; tableHeader(explode('|', "Rank|Person|Result|Citizen of|Competition|{$headerSources}"), array(0 => "class='r'", 2 => "class='R2'", 5 => 'class="f"')); $ctr = 0; foreach ($results as $result) { extract($result); $ctr++; $no = isset($previousValue) && $value == $previousValue ? ' ' : $ctr; if ($limitCondition && $no > $limitNumber) { break; } tableRow(array($no, personLink($personId, $personName), formatValue($value, $event['format']), htmlEntities($countryName), competitionLink($competitionId, $competitionName), formatAverageSources($chosenAverage, $result, $event['format']))); $previousValue = $value; } tableEnd(); stopTimer("printing the table"); }
function showRecords() { #---------------------------------------------------------------------- global $chosenRegionId, $chosenEventId, $chosenYears; global $chosenMixed, $chosenSlim, $chosenSeparate, $chosenHistory, $chosenMixHist; #--- Try the cache tryCache('region', preg_replace('/ /', '', $chosenRegionId), $chosenEventId, $chosenYears, $chosenMixed, $chosenSlim, $chosenSeparate, $chosenHistory, $chosenMixHist); if ($chosenMixed) { require 'includes/regions_mixed.php'; } if ($chosenSlim) { require 'includes/regions_slim.php'; } if ($chosenSeparate) { require 'includes/regions_separate.php'; } if ($chosenHistory || $chosenMixHist) { require 'includes/regions_history.php'; } }
<?php #---------------------------------------------------------------------- # Initialization and page contents. #---------------------------------------------------------------------- $currentSection = 'misc'; require '../../includes/_header.php'; $onlyProvideFunctions = true; require '../../includes/statistics/sum_of_ranks.php'; analyzeChoices(); tryCache('sum_of_ranks', preg_replace('/ /', '', $chosenRegionId), $chosenSingle, $chosenAverage); echo "<h1>Sum of Ranks</h1>\n\n"; echo "<p style='padding-left:20px;padding-right:20px;font-weight:bold'>Top 300 by sum of ranks for each region. Top-10 ranks are marked green, if someone doesn't have a rank it's the number of people with a rank, plus 1 (and marked red)</p>"; offerChoices(); echo "<p style='padding-left:20px;padding-right:20px;color:gray;font-size:10px'>Generated on " . wcaDate() . ".</p>"; showResults(); require '../../includes/_footer.php'; #---------------------------------------------------------------------- function analyzeChoices() { #---------------------------------------------------------------------- global $chosenRegionId; global $chosenSingle, $chosenAverage; $chosenRegionId = getNormalParam('regionId'); $chosenSingle = getBooleanParam('single'); $chosenAverage = getBooleanParam('average'); if (!$chosenAverage) { $chosenSingle = true; } } #----------------------------------------------------------------------