function showCompetitionResultsByPerson($resultsTable = 'Results') { #---------------------------------------------------------------------- global $chosenByPerson, $chosenAllResults, $chosenTop3, $chosenWinners; global $chosenCompetitionId; #--- Get the results. $competitionResults = getCompetitionResults($resultsTable); startTimer(); tableBegin('results', 8); foreach ($competitionResults as $result) { extract($result); $isNewPerson = !isset($previousPersonId) || $personId != $previousPersonId; $isNewEvent = !isset($previousEventId) || $eventId != $previousEventId || $isNewPerson; #--- Welcome new persons. if ($isNewPerson) { if (isset($previousPersonId)) { tableRowBlank(); } $bo3_as_mo3 = $formatId == '3' && ($eventId == '333bf' || $eventId == '333fm' || $eventId == '333ft'); $headerAverage = $formatId == 'a' || $formatId == 'm' || $bo3_as_mo3 ? 'Average' : ''; $headerAllResults = $formatId != '1' ? 'Result Details' : ''; tableCaptionNew(false, $personId, spaced(array(personLink($personId, $personName), $countryName))); tableHeader(explode('|', "Event|Round|Place|Best||{$headerAverage}||{$headerAllResults}"), array(2 => 'class="r"', 3 => 'class="R"', 5 => 'class="R"', 7 => 'class="f"')); } #--- One result row. tableRowStyled($isNewEvent ? '' : 'color:#AAA', array($isNewEvent ? eventLink($eventId, $eventCellName) : '', $roundCellName, $isNewEvent ? "<b>{$pos}</b>" : $pos, formatValue($best, $valueFormat), $regionalSingleRecord, formatValue($average, $valueFormat), $regionalAverageRecord, formatAverageSources($formatId != '1', $result, $valueFormat))); $previousPersonId = $personId; $previousEventId = $eventId; } tableEnd(); stopTimer("printing the huge table"); }
function showRegionalRecordsSlim() { #---------------------------------------------------------------------- global $chosenYears; require 'regions_get_current_records.php'; tableBegin('results', 6); $caption = spaced(array(chosenRegionName(), $chosenYears)); if ($caption) { tableCaption(true, $caption); } else { tableRowBlank(); } tableHeader(explode('|', 'Person|Single|Event|Average|Person|Result Details'), array(1 => "class='R2'", 2 => "class='c'", 3 => "class='R2'", 5 => 'class="f"')); #--- Process events. foreach (structureBy($results, 'eventId') as $eventResults) { $structure = structureBy($eventResults, 'type'); $singles = $structure[0]; $averages = isset($structure[1]) ? $structure[1] : array(); $wasShownSinglePerson = $wasShownAveragePerson = array(); #--- Process records for this event. $first = true; while ($singles || $averages) { #--- Get next single. $s = array_shift($singles); if (isset($wasShownSinglePerson[$s['personId']])) { $s = false; } $wasShownSinglePerson[$s['personId']] = true; #--- Get next average. $a = array_shift($averages); if (isset($wasShownAveragePerson[$a['personId']])) { $a = false; } $wasShownAveragePerson[$a['personId']] = true; if ($s || $a) { tableRow(array($s ? personLink($s['personId'], $s['personName']) : '', $first ? formatValue($s['value'], $s['format']) : '', $first ? eventLink($s['eventId'], $s['eventCellName']) : '', $first ? formatValue($a['value'], $a['format']) : '', $a ? personLink($a['personId'], $a['personName']) : '', $a ? formatAverageSources(true, $a, $a['format']) : '')); } $first = false; } } tableEnd(); }
function tableCaptionNew($separate, $ids, $value) { #---------------------------------------------------------------------- global $tableOddRow, $tableColumns; $anchor = ' '; foreach (explode(' ', $ids) as $id) { if ($id) { $anchor .= "<a name='{$id}'> </a>"; } } $tableOddRow = false; tableRowFull($anchor); if (!$value) { $value = ' '; } echo "<tr>"; echo "<td class='caption' colspan='{$tableColumns}'>{$value}</td>"; echo "</tr>\n\n"; if ($separate) { tableRowBlank(); } }