Changeset 29 for trunk/index.php
- Timestamp:
- Sep 17, 2019, 10:58:51 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/index.php
r28 r29 47 47 } 48 48 49 function YearList($Path, $SelectedYear )49 function YearList($Path, $SelectedYear, $Table = 'Runner', $Where = '1') 50 50 { 51 51 $Output = 'Year: '; 52 $DbResult = $this->Database->query('SELECT DISTINCT(Year) AS Year FROM ` Runner`ORDER BY Year ASC');52 $DbResult = $this->Database->query('SELECT DISTINCT(Year) AS Year FROM `'.$Table.'` WHERE '.$Where.' ORDER BY Year ASC'); 53 53 while ($DbRow = $DbResult->fetch_assoc()) 54 54 { … … 56 56 $Item = '<a href="'.$this->Link($Path.$Year.'/').'">'.$Year.'</a>'; 57 57 if ($SelectedYear == $Year) $Item = '<strong>'.$Item.'</strong>'; 58 $Output .= $Item.' '; 59 } 60 return $Output; 61 } 62 63 function ItemsYearList($Path, $SelectedId, $Table = 'Runner', $Where = '1') 64 { 65 $Output = 'Year: '; 66 $DbResult = $this->Database->query('SELECT T1.Id AS Id, T2.Year AS Year FROM (SELECT DISTINCT(Id) AS Id FROM `'.$Table.'` WHERE '.$Where.' ORDER BY Year ASC) AS T1 '. 67 'LEFT JOIN '.$Table.' AS T2 ON T1.Id=T2.Id'); 68 while ($DbRow = $DbResult->fetch_assoc()) 69 { 70 $Item = '<a href="'.$this->Link($Path.$DbRow['Id'].'/').'">'.$DbRow['Year'].'</a>'; 71 if ($SelectedId == $DbRow['Id']) $Item = '<strong>'.$Item.'</strong>'; 58 72 $Output .= $Item.' '; 59 73 } … … 435 449 $Where .= ' AND (Name LIKE "%'.addslashes($_GET['query']).'%")'; 436 450 } 437 $Output .= '<div class="section-title">'.$this->YearList('/teams/', $Year ).' Name: '.$this->ShowSearch().'</div>';451 $Output .= '<div class="section-title">'.$this->YearList('/teams/', $Year, 'Team').' Name: '.$this->ShowSearch().'</div>'; 438 452 439 453 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `Team` WHERE '.$Where); … … 509 523 $DbRow = $DbResult->fetch_assoc(); 510 524 $Output .= '<div class="page-title">Team '.$DbRow['Name'].'</div>'; 525 $Output .= '<div class="section-title">'.$this->ItemsYearList('/team/', $TeamId, 'Team', 'Name="'.$DbRow['Name'].'"').'</div>'; 511 526 $Output .= '<div class="section-title">Runners: '.$DbRow['RunnerCount'].', Distance: '.$DbRow['Distance'].' km, Money: '.$DbRow['Money'].' Kč, Rank: '.$DbRow['Rank'].'</div>'; 512 527 … … 677 692 $Year = $this->GetYear(); 678 693 679 $Output .= '<div class="section-title">'.$this->YearList('/runners/', $Year ).' Name: '.$this->ShowSearch().'</div>';694 $Output .= '<div class="section-title">'.$this->YearList('/runners/', $Year, 'Runner').' Name: '.$this->ShowSearch().'</div>'; 680 695 $Where = '(Year='.$Year.')'; 681 696 if (array_key_exists('query', $_GET) and ($_GET['query'] != '')) … … 741 756 if ($DbRow['TeamName'] != '') 742 757 $Output .= '<div class="section-title"><a href="'.$this->Link('/team/'.$DbRow['TeamId']).'">'.$DbRow['TeamName'].'</a></div>'; 758 $Output .= '<div class="section-title">'.$this->ItemsYearList('/runner/', $RunnerId, 'Runner', 'Name="'.$DbRow['Name'].'"').'</div>'; 743 759 744 760 $Output .= $this->ShowDetailed('Runner', $RunnerId);
Note:
See TracChangeset
for help on using the changeset viewer.