Changeset 14
- Timestamp:
- Aug 29, 2019, 9:13:06 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/index.php
r13 r14 39 39 '<a href="'.$this->Link('/runners').'">Runners</a> '. 40 40 '<a href="'.$this->Link('/teams').'">Teams</a> '. 41 '<a href="'.$this->Link('/families').'">Families</a> '.41 '<a href="'.$this->Link('/families').'">Families</a> '. 42 42 '</div>'; 43 43 return($Output); … … 199 199 'Money' => $Item['Money'], 200 200 )); 201 } else 202 { 203 echo('Unsupported type '.$Item['Type'].'. '); 201 204 } 202 205 } … … 280 283 $PageList = GetPageList($DbRow[0]); 281 284 282 $Gender = array('', 'Ma le', 'Female', 'Child');285 $Gender = array('', 'Man', 'Woman', 'Kid'); 283 286 $Output .= '<div id="list_content">'; 284 287 $Output .= $PageList['Output']; 285 288 $TableColumns = array( 286 289 array('Name' => 'Name', 'Title' => 'Name'), 287 array('Name' => 'Gender', 'Title' => ' Gender'),290 array('Name' => 'Gender', 'Title' => 'Category'), 288 291 array('Name' => 'Distance', 'Title' => 'Distance'), 289 292 array('Name' => 'Money', 'Title' => 'Money'), … … 393 396 $PageList = GetPageList($DbRow[0]); 394 397 395 $Gender = array('', 'M ale', 'Female', 'Child');398 $Gender = array('', 'Men', 'Woman', 'Kid'); 396 399 $Output .= '<div id="list_content">'; 397 400 $Output .= $PageList['Output']; 398 401 $TableColumns = array( 399 402 array('Name' => 'Name', 'Title' => 'Name'), 400 array('Name' => 'Gender', 'Title' => ' Gender'),403 array('Name' => 'Gender', 'Title' => 'Category'), 401 404 array('Name' => 'Distance', 'Title' => 'Distance'), 402 405 array('Name' => 'Money', 'Title' => 'Money'), … … 441 444 $PageList = GetPageList($DbRow[0]); 442 445 443 $Gender = array('', 'Ma le', 'Female', 'Child');446 $Gender = array('', 'Man', 'Woman', 'Kid'); 444 447 $Output .= '<div id="list_content">'; 445 448 $Output .= $PageList['Output']; 446 449 $TableColumns = array( 447 450 array('Name' => 'Name', 'Title' => 'Name'), 448 array('Name' => 'Gender', 'Title' => ' Gender'),451 array('Name' => 'Gender', 'Title' => 'Category'), 449 452 array('Name' => 'Distance', 'Title' => 'Distance'), 450 453 array('Name' => 'Money', 'Title' => 'Money'), … … 591 594 } 592 595 596 function GetTotals($Where = '1', $Table = 'Runner') 597 { 598 $DbResult = $this->Database->query('SELECT (SELECT COUNT(*) FROM '.$Table.' WHERE '.$Where.') AS TotalCount, '. 599 '(SELECT SUM(Distance) FROM '.$Table.'Stat LEFT JOIN '.$Table.' ON '.$Table.'.Id='.$Table.'Stat.'.$Table.' WHERE '.$Where.') AS TotalDistance, '. 600 '(SELECT SUM(Money) FROM '.$Table.'Stat LEFT JOIN '.$Table.' ON '.$Table.'.Id='.$Table.'Stat.'.$Table.' WHERE '.$Where.') AS TotalMoney'); 601 $DbRow = $DbResult->fetch_assoc(); 602 return $DbRow; 603 } 604 593 605 function ShowMain() 594 606 { 595 607 $Output = ''; 596 $DbResult = $this->Database->select('Runner', 'COUNT(*) AS Total'); 597 $DbRow = $DbResult->fetch_assoc(); 598 $RunnersCount = $DbRow['Total']; 599 600 $Output = ''; 601 $DbResult = $this->Database->select('Runner', 'COUNT(*) AS Total', 'Gender=1'); 602 $DbRow = $DbResult->fetch_assoc(); 603 $MenCount = $DbRow['Total']; 604 605 $Output = ''; 606 $DbResult = $this->Database->select('Runner', 'COUNT(*) AS Total', 'Gender=2'); 607 $DbRow = $DbResult->fetch_assoc(); 608 $WomenCount = $DbRow['Total']; 609 610 $Output = ''; 611 $DbResult = $this->Database->select('Runner', 'COUNT(*) AS Total', 'Gender=3'); 612 $DbRow = $DbResult->fetch_assoc(); 613 $KidsCount = $DbRow['Total']; 614 615 $DbResult = $this->Database->select('Team', 'COUNT(*) AS Total', 'IsFamily=0'); 616 $DbRow = $DbResult->fetch_assoc(); 617 $TeamsCount = $DbRow['Total']; 618 619 $DbResult = $this->Database->select('Team', 'COUNT(*) AS Total', 'IsFamily=1'); 620 $DbRow = $DbResult->fetch_assoc(); 621 $FamiliesCount = $DbRow['Total']; 608 $Runners = $this->GetTotals(); 609 $Men = $this->GetTotals('Runner.Gender=1', 'Runner'); 610 $Women = $this->GetTotals('Runner.Gender=2', 'Runner'); 611 $Kids = $this->GetTotals('Runner.Gender=3', 'Runner'); 612 $Teams = $this->GetTotals('Team.IsFamily=0', 'Team'); 613 $Families = $this->GetTotals('Team.IsFamily=1', 'Team'); 622 614 615 $Output .= '<p>This website collects data from offical <a href="http://leaderboard.teribear.cz/">leaderboard</a> site and track and present progress of runners.</p>'; 623 616 $Output .= '<div class="page-title">Summary</div>'; 624 617 $Output .= '<table class="WideTable">'; 625 $Output .= '<tr><th>Category</th><th> Total count</th></tr>';626 $Output .= '<tr><td> Runners</td><td>'.$RunnersCount.'</td></tr>';627 $Output .= '<tr><td>Men</td><td>'.$Men Count.'</td></tr>';628 $Output .= '<tr><td>Women</td><td>'.$Women Count.'</td></tr>';629 $Output .= '<tr><td>Kids</td><td>'.$Kids Count.'</td></tr>';630 $Output .= '<tr><td>Teams</td><td>'.$Teams Count.'</td></tr>';631 $Output .= '<tr><td>Families</td><td>'.$Families Count.'</td></tr>';618 $Output .= '<tr><th>Category</th><th>Count</th><th>Distance [km]</th><th>Money [Kč]</th></tr>'; 619 $Output .= '<tr><td>Everyone</td><td>'.$Runners['TotalCount'].'</td><td>'.$Runners['TotalDistance'].'</td><td>'.$Runners['TotalMoney'].'</td></tr>'; 620 $Output .= '<tr><td>Men</td><td>'.$Men['TotalCount'].'</td><td>'.$Men['TotalDistance'].'</td><td>'.$Men['TotalMoney'].'</td></tr>'; 621 $Output .= '<tr><td>Women</td><td>'.$Women['TotalCount'].'</td><td>'.$Women['TotalDistance'].'</td><td>'.$Women['TotalMoney'].'</td></tr>'; 622 $Output .= '<tr><td>Kids</td><td>'.$Kids['TotalCount'].'</td><td>'.$Kids['TotalDistance'].'</td><td>'.$Kids['TotalMoney'].'</td></tr>'; 623 $Output .= '<tr><td>Teams</td><td>'.$Teams['TotalCount'].'</td><td>'.$Teams['TotalDistance'].'</td><td>'.$Teams['TotalMoney'].'</td></tr>'; 624 $Output .= '<tr><td>Families</td><td>'.$Families['TotalCount'].'</td><td>'.$Families['TotalDistance'].'</td><td>'.$Families['TotalMoney'].'</td></tr>'; 632 625 $Output .= '</table>'; 633 626
Note:
See TracChangeset
for help on using the changeset viewer.