- Timestamp:
- Sep 12, 2018, 1:43:54 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/index.php
r4 r5 5 5 include_once('Global.php'); 6 6 include_once('Run.php'); 7 include_once('PrefixMultiplier.php'); 7 8 8 9 session_start(); … … 56 57 } 57 58 58 function QueryRunners($Category, $Page, $TeamId, $Query = '', $StartNumber = '') 59 { 60 $URL = 'http://leaderboard.teribear.cz/Home/GetRunners?category='.$Category.'&page='.$Page.'&teamId='.$TeamId.'&query='.$Query; 61 if ($Category != '') $URL .= '&startNumber='.$StartNumber; 59 // Query: text from name 60 // Page: index of page, one page is 30 items 61 // Category: '', all, men, woman, kids, families, teams 62 // TeamId: id of team 63 // Count: number of items per page, default 30 64 function QueryRunners($Category, $Page, $TeamId, $Query = null, $StartNumber = null, $Count = null) 65 { 66 $URL = 'http://leaderboard.teribear.cz/Home/GetRunners?category='.$Category.'&page='.$Page.'&teamId='.$TeamId; 67 if ($Count != null) $URL .= '&count='.$Count; 68 if ($Query != null) $URL .= '&query='.$Query; 69 if ($Category != null) $URL .= '&startNumber='.$StartNumber; 62 70 $Content = file_get_contents($URL); 63 71 $JSON = json_decode($Content, true); … … 175 183 function ShowRunner() 176 184 { 185 $PrefixMultiplier = new PrefixMultiplier(); 177 186 $Output = ''; 178 187 … … 197 206 $TableColumns = array( 198 207 array('Name' => 'Time', 'Title' => 'Time'), 199 array('Name' => 'Distance', 'Title' => 'Distance '),200 array('Name' => 'Money', 'Title' => 'Money '),208 array('Name' => 'Distance', 'Title' => 'Distance [km]'), 209 array('Name' => 'Money', 'Title' => 'Money [Kč]'), 201 210 array('Name' => 'Rank', 'Title' => 'Rank'), 211 array('Name' => 'Duration', 'Title' => 'Duration'), 212 array('Name' => 'Length', 'Title' => 'Length [km]'), 213 array('Name' => 'Speed', 'Title' => 'Speed [km/hour]'), 202 214 ); 203 215 $Order = GetOrderTableHeader($TableColumns, 'Time', 1); 204 216 $Output .= '<table class="WideTable">'; 205 217 $Output .= $Order['Output']; 206 $DbResult = $this->Database->select('RunnerStat', '*', 207 $Where.$Order['SQL'].$PageList['SQLLimit']); 218 $DbResult = $this->Database->query('SELECT *'. 219 ', (SELECT RunnerStat.Time - B.Time FROM RunnerStat AS B WHERE (B.Time < RunnerStat.Time) AND (B.Runner = RunnerStat.Runner) ORDER BY B.Time DESC LIMIT 1) AS Duration'. 220 ', (SELECT RunnerStat.Distance - B.Distance FROM RunnerStat AS B WHERE (B.Time < RunnerStat.Time) AND (B.Runner = RunnerStat.Runner) ORDER BY B.Time DESC LIMIT 1) AS Length'. 221 ', NULL AS Speed'. 222 ' FROM RunnerStat'. 223 ' WHERE '.$Where.$Order['SQL'].$PageList['SQLLimit']); 208 224 while($MeetItem = $DbResult->fetch_assoc()) 209 225 { … … 212 228 '<td>'.$MeetItem['Distance'].'</td>'. 213 229 '<td>'.$MeetItem['Money'].'</td>'. 214 '<td>'.$MeetItem['Rank'].'</td>'. 215 '</tr>'; 230 '<td>'.$MeetItem['Rank'].'</td>'; 231 if ($MeetItem['Duration'] != null) $Output .= '<td>'.$PrefixMultiplier->Add($MeetItem['Duration'], '', 4, 'Time').'</td>'; 232 else $Output .= '<td> </td>'; 233 $Output .= '<td>'.$MeetItem['Length'].'</td>'; 234 if ($MeetItem['Duration'] > 0) $Output .= '<td>'.$PrefixMultiplier->Add($MeetItem['Length'] / $MeetItem['Duration'] * 3600, '', 4, 'Decimal').'</td>'; 235 else $Output .= '<td> </td>'; 236 $Output .= '</tr>'; 216 237 } 217 238 $Output .= '</table>';
Note:
See TracChangeset
for help on using the changeset viewer.