Changeset 12 for trunk/index.php


Ignore:
Timestamp:
Aug 29, 2019, 12:14:23 AM (5 years ago)
Author:
chronos
Message:
  • Added: Summary page with total numbers of items in all categories.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/index.php

    r11 r12  
    3636  {
    3737    $Output = '<div>'.
     38      '<a href="'.$this->Link('/').'">Summary</a> '.
    3839      '<a href="'.$this->Link('/runners').'">Runners</a> '.
    3940      '<a href="'.$this->Link('/teams').'">Teams</a> '.
     
    592593  function ShowMain()
    593594  {
    594     return "";
     595    $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'];
     622   
     623    $Output .= '<div class="page-title">Summary</div>';
     624    $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>'.$MenCount.'</td></tr>';
     628    $Output .= '<tr><td>Women</td><td>'.$WomenCount.'</td></tr>';
     629    $Output .= '<tr><td>Kids</td><td>'.$KidsCount.'</td></tr>';
     630    $Output .= '<tr><td>Teams</td><td>'.$TeamsCount.'</td></tr>';
     631    $Output .= '<tr><td>Families</td><td>'.$FamiliesCount.'</td></tr>';
     632    $Output .= '</table>';
     633
     634    return $Output;
    595635  }
    596636
     
    632672    {
    633673      if($this->PathItems[0] == 'sync') $Output .= $this->ShowSync();
    634       else if($this->PathItems[0] == 'empty') $Output .= $this->ShowEmpty();
     674      //else if($this->PathItems[0] == 'empty') $Output .= $this->ShowEmpty();
    635675      else if($this->PathItems[0] == 'runner') $Output .= $this->ShowRunner();
    636676      else if($this->PathItems[0] == 'runners') $Output .= $this->ShowRunners();
Note: See TracChangeset for help on using the changeset viewer.