Changeset 24 for trunk/index.php
- Timestamp:
- Sep 6, 2019, 10:58:26 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/index.php
r23 r24 49 49 function YearList($Path, $SelectedYear) 50 50 { 51 $Output = ' <div class="year-list">Year: ';51 $Output = 'Year: '; 52 52 $DbResult = $this->Database->query('SELECT DISTINCT(Year) AS Year FROM `Runner` ORDER BY Year ASC'); 53 53 while ($DbRow = $DbResult->fetch_assoc()) … … 58 58 $Output .= $Item.' '; 59 59 } 60 $Output .= '</div>';61 60 return $Output; 62 61 } … … 306 305 $Output = ''; 307 306 $Output .= '<div class="page-title">Families</div>'; 308 309 $Year = 0; 310 if ((count($this->PathItems) > 0) and ($this->PathItems[count($this->PathItems) - 1] != '')) 311 $Year = $this->PathItems[count($this->PathItems) - 1] * 1; 312 if ($Year == 0) $Year = $this->GetLatestYear(); 313 314 $Output .= $this->YearList('/families/', $Year); 307 $Year = $this->GetYear(); 308 309 $Output .= '<div class="section-title">'.$this->YearList('/families/', $Year).' Name: '.$this->ShowSearch().'</div>'; 315 310 $Where = '(IsFamily=1) AND (Year='.$Year.')'; 311 if (array_key_exists('query', $_GET) and ($_GET['query'] != '')) 312 { 313 $Where .= ' AND (Name LIKE "%'.addslashes($_GET['query']).'%")'; 314 } 316 315 317 316 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `Team` WHERE '.$Where); … … 426 425 $Output = ''; 427 426 $Output .= '<div class="page-title">Teams</div>'; 428 429 $Year = 0; 430 if ((count($this->PathItems) > 0) and ($this->PathItems[count($this->PathItems) - 1] != '')) 431 $Year = $this->PathItems[count($this->PathItems) - 1] * 1; 432 if ($Year == 0) $Year = $this->GetLatestYear(); 433 434 $Output .= $this->YearList('/teams/', $Year); 427 $Year = $this->GetYear(); 435 428 436 429 $Where = '(IsFamily=0) AND (Year='.$Year.')'; 430 if (array_key_exists('query', $_GET) and ($_GET['query'] != '')) 431 { 432 $Where .= ' AND (Name LIKE "%'.addslashes($_GET['query']).'%")'; 433 } 434 $Output .= '<div class="section-title">'.$this->YearList('/teams/', $Year).' Name: '.$this->ShowSearch().'</div>'; 437 435 438 436 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `Team` WHERE '.$Where); … … 554 552 $PrefixMultiplier = new PrefixMultiplier(); 555 553 556 $Output = '<div class="section-title"> Detailed</div>';554 $Output = '<div class="section-title">Lap progress</div>'; 557 555 $Where = $Table.'Stat.'.$Table.'='.$Id; 558 556 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `'.$Table.'Stat` WHERE '.$Where); … … 611 609 $PageList = GetPageList($DbRow[0]); 612 610 613 $Output = '<div class="section-title">Daily </div>';611 $Output = '<div class="section-title">Daily progress</div>'; 614 612 $Output .= '<div id="list_content">'; 615 613 $Output .= $PageList['Output']; … … 652 650 } 653 651 652 function ShowSearch() 653 { 654 if (array_key_exists('query', $_GET)) $Query = $_GET['query']; 655 else $Query = ''; 656 $Output = '<form action="?" method="get" style="display: inline;">'; 657 $Output .= '<input type="text" size="10" name="query" value="'.$Query.'"/> '. 658 '<input type="submit" value="Search"/>'; 659 $Output .= '</form>'; 660 return $Output; 661 } 662 654 663 function ShowRunners() 655 664 { 656 665 $Output = '<div class="page-title">Runners</div>'; 657 658 $Year = 0; 659 if ((count($this->PathItems) > 0) and ($this->PathItems[count($this->PathItems) - 1] != ''))660 $Year = $this->PathItems[count($this->PathItems) - 1] * 1;661 if ( $Year == 0) $Year = $this->GetLatestYear();662 663 $Output .= $this->YearList('/runners/', $Year);664 665 $Where = 'Year='.$Year; 666 $Year = $this->GetYear(); 667 668 $Output .= '<div class="section-title">'.$this->YearList('/runners/', $Year).' Name: '.$this->ShowSearch().'</div>'; 669 $Where = '(Year='.$Year.')'; 670 if (array_key_exists('query', $_GET) and ($_GET['query'] != '')) 671 { 672 $Where .= ' AND (Name LIKE "%'.addslashes($_GET['query']).'%")'; 673 } 674 666 675 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `Runner` WHERE '.$Where); 667 676 $DbRow = $DbResult->fetch_row(); … … 736 745 } 737 746 747 function GetYear() 748 { 749 $Year = 0; 750 if (count($this->PathItems) > 0) 751 { 752 $Param = $this->PathItems[count($this->PathItems) - 1]; 753 if (is_numeric($this->PathItems[count($this->PathItems) - 1])) 754 $Year = $this->PathItems[count($this->PathItems) - 1] * 1; 755 } 756 if ($Year == 0) $Year = $this->GetLatestYear(); 757 return $Year; 758 } 759 738 760 function ShowMain() 739 761 { … … 741 763 $Output .= '<p>This website collects data from offical <a href="'.$this->LeaderboardURL.'">leaderboard</a> site and tracks and presents progress of runners.</p>'; 742 764 $Output .= '<div class="page-title">Summary</div>'; 743 744 $Year = 0; 745 if ((count($this->PathItems) > 0) and ($this->PathItems[count($this->PathItems) - 1] != '')) 746 $Year = $this->PathItems[count($this->PathItems) - 1] * 1; 747 if ($Year == 0) $Year = $this->GetLatestYear(); 748 749 $Output .= $this->YearList('/', $Year); 765 $Year = $this->GetYear(); 766 767 $Output .= '<div class="section-title">'.$this->YearList('/', $Year).'</div>'; 750 768 751 769 $Runners = $this->GetTotals('(Year='.$Year.')');
Note:
See TracChangeset
for help on using the changeset viewer.