2022-03-14 19:13:10 +01:00
|
|
|
<?php
|
|
|
|
$menu = '<nav>';
|
|
|
|
$menuSelect = '<select id="menu-select">';
|
|
|
|
/*################################
|
|
|
|
## generate the car category selection menu
|
|
|
|
################################
|
|
|
|
*/
|
2024-04-07 22:40:57 +02:00
|
|
|
foreach ($carCategoriesList as $cat)
|
|
|
|
{
|
2022-03-14 19:13:10 +01:00
|
|
|
$class = '';
|
|
|
|
$selected = '';
|
|
|
|
//if the category contain no cars we do no consider it
|
|
|
|
//todo: should we display only officially released ones?
|
2024-04-07 22:40:57 +02:00
|
|
|
if ($cat->totalCars > 0)
|
|
|
|
{
|
2022-03-14 19:13:10 +01:00
|
|
|
//if no category has been chosen by the user, used the first valid (non empty) one
|
2024-04-07 22:40:57 +02:00
|
|
|
if ($carCatId == '') $carCatId = $cat->id;
|
2022-03-14 19:13:10 +01:00
|
|
|
|
|
|
|
//set a splecial class for the menu item that represent the currently selected class
|
2024-04-07 22:40:57 +02:00
|
|
|
if ($carCatId == $cat->id )
|
|
|
|
{
|
2022-03-14 19:13:10 +01:00
|
|
|
$class = 'class="selected"';
|
|
|
|
$selected = 'selected';
|
|
|
|
}
|
2024-04-07 22:40:57 +02:00
|
|
|
|
2022-03-14 19:13:10 +01:00
|
|
|
//echo "\n<a href='?cat=".$id."' $class>".$category->name."</a>";
|
2024-04-07 22:40:57 +02:00
|
|
|
$url = rewriteUrl('cat', $cat->id);
|
|
|
|
$menu .= "<a href=\"$url\" $class>{$cat->name}</a>";
|
|
|
|
$menuSelect .= "<option value=\"$url\" $selected>{$cat->name}</option>";
|
2022-03-14 19:13:10 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
$menu .= '</nav>';
|
|
|
|
$menuSelect .= '</select>';
|
|
|
|
?>
|
|
|
|
<div class="col-2 navbar navbar-vert" id="menu">
|
|
|
|
<div id="menu-title">Categories:</div>
|
|
|
|
<?= $menu ?>
|
|
|
|
<?= $menuSelect ?>
|
|
|
|
</div>
|
|
|
|
<div class="container">
|
|
|
|
<nav id="period">
|
|
|
|
<strong>Period:</strong>
|
|
|
|
<a id="today" href="<?= rewriteUrl('period','today'); ?>">Today</a>
|
|
|
|
<a id="week" href="<?= rewriteUrl('period','week'); ?>">Week</a>
|
|
|
|
<a id="month" href="<?= rewriteUrl('period','month'); ?>">Month</a>
|
|
|
|
<a id="year" href="<?= rewriteUrl('period','year'); ?>">Year</a>
|
|
|
|
<a id="allTime" href="<?= rewriteUrl('period','allTime'); ?>">All Time</a>
|
|
|
|
</nav>
|
2024-04-07 22:40:57 +02:00
|
|
|
|
|
|
|
<?php if (!empty($currCat)): ?>
|
2022-03-14 19:13:10 +01:00
|
|
|
<h1 id="cat-title">
|
2024-04-07 22:40:57 +02:00
|
|
|
<?= $currCat->name ?>
|
2022-03-14 19:13:10 +01:00
|
|
|
</h1>
|
2024-04-07 22:40:57 +02:00
|
|
|
<?php endif ?>
|
|
|
|
|
2022-03-14 19:13:10 +01:00
|
|
|
<h3>
|
|
|
|
Most active users<br />
|
|
|
|
<small><?= $periodString; ?></small>
|
|
|
|
</h3>
|
|
|
|
<table class="fullPage responsive cat-table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Pilot</th>
|
|
|
|
<th>Races</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<?php
|
2024-04-07 22:40:57 +02:00
|
|
|
foreach ($users as $user):
|
2022-03-14 19:13:10 +01:00
|
|
|
?>
|
|
|
|
<tr>
|
|
|
|
<td data-title="Pilot">
|
2024-04-07 22:40:57 +02:00
|
|
|
<?= clickableName($user->username, 'user', $user->username) ?>
|
2022-03-14 19:13:10 +01:00
|
|
|
</td>
|
|
|
|
<td data-title="Races">
|
2024-04-07 22:40:57 +02:00
|
|
|
<?= $user->count ?>
|
2022-03-14 19:13:10 +01:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<?php endforeach; ?>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<h3>
|
|
|
|
Bests lap for each track<br />
|
|
|
|
<small><?=$periodString; ?></small>
|
|
|
|
</h3>
|
|
|
|
<table class="fullPage responsive cat-table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Track</th>
|
|
|
|
<th>Pilot</th>
|
|
|
|
<th>Car</th>
|
|
|
|
<th>Laptime</th>
|
|
|
|
<th>Weather</th>
|
|
|
|
<th>Date</th>
|
|
|
|
<th>Session</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<?php
|
|
|
|
foreach ($mylaps as $mylap):
|
|
|
|
$track = $mylap->track_id;
|
|
|
|
$car = $mylap->car_id;
|
|
|
|
?>
|
|
|
|
<tr>
|
|
|
|
<td data-title="Track">
|
2024-04-07 22:40:57 +02:00
|
|
|
<?= clickableName($mylap->track_id, 'track', $mylap->track_name) ?>
|
2022-03-14 19:13:10 +01:00
|
|
|
</td>
|
|
|
|
<td data-title="Pilot">
|
2024-04-07 22:40:57 +02:00
|
|
|
<?= clickableName($mylap->username, 'user', $mylap->username) ?>
|
2022-03-14 19:13:10 +01:00
|
|
|
</td>
|
|
|
|
<td data-title="Car">
|
2024-04-07 22:40:57 +02:00
|
|
|
<?= clickableName($mylap->car_id, 'car', $mylap->car_name) ?>
|
2022-03-14 19:13:10 +01:00
|
|
|
</td>
|
|
|
|
<td data-title="Laptime">
|
|
|
|
<?= formatLaptime($mylap->bestlap); ?>
|
|
|
|
</td>
|
|
|
|
<td data-title="Weather">
|
|
|
|
<?= weatherTag($mylap->wettness); ?>
|
|
|
|
</td>
|
|
|
|
<td data-title="Date">
|
|
|
|
<?= $mylap->timestamp; ?>
|
|
|
|
</td>
|
|
|
|
<td data-title="Session">
|
2024-04-07 22:40:57 +02:00
|
|
|
<a href="<?= base_url() ?>race/<?= $mylap->race_id ?>">#<?=$mylap->race_id?></a>
|
2022-03-14 19:13:10 +01:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<?php endforeach ?>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<h3>
|
|
|
|
Most used Tracks<br />
|
|
|
|
<small><?php echo $periodString; ?></small>
|
|
|
|
</h3>
|
|
|
|
<table class="fullPage responsive cat-table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Track</th>
|
|
|
|
<th>Races</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<?php foreach ($tracks as $race): ?>
|
|
|
|
<tr>
|
|
|
|
<td data-title="Track">
|
2024-04-07 22:40:57 +02:00
|
|
|
<?= clickableName($race->track_id, 'track', $tracksNames[$race->track_id]) ?>
|
2022-03-14 19:13:10 +01:00
|
|
|
</td>
|
|
|
|
<td data-title="Races">
|
|
|
|
<?= $race->count ?>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<?php endforeach ?>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<h3>
|
|
|
|
Top cars<br />
|
|
|
|
<small><?php echo $periodString; ?></small>
|
|
|
|
</h3>
|
|
|
|
<table class="fullPage responsive cat-table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Car</th>
|
|
|
|
<th>Races</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2024-04-07 22:40:57 +02:00
|
|
|
<?php foreach ($cars as $car): ?>
|
2022-03-14 19:13:10 +01:00
|
|
|
<tr>
|
|
|
|
<td data-title="Car">
|
2024-04-07 22:40:57 +02:00
|
|
|
<?= clickableName($car->car_id, 'car', $car->name) ?>
|
2022-03-14 19:13:10 +01:00
|
|
|
</td>
|
|
|
|
<td data-title="Races">
|
2024-04-07 22:40:57 +02:00
|
|
|
<?= $car->count ?>
|
2022-03-14 19:13:10 +01:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<?php endforeach ?>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<script>
|
|
|
|
period = '<?= $period ?>';
|
|
|
|
</script>
|