This repository has been archived on 2023-12-29. You can view files and clone it, but cannot push or open issues or pull requests.
dogstats/web/pages/smart/search.html.php
2023-12-11 19:54:21 +01:00

163 lines
5.9 KiB
PHP

<h2>Hunde:</h2>
<ul>
<?php foreach ($dogs as $dog) : ?>
<li><a href="#<?= $dog ?>"><?= $dog ?></a></li>
<?php endforeach; ?>
</ul>
<?php foreach ($dogs as $dog) :
$results = $results_dogs[$dog];
$sdata = [];
?>
<h1 id="<?= $dog; ?>"><?= $dog; ?></h1>
<button onClick="getElementById('table_<?= $dog ?>').style.display='table'">Tabelle anzeigen</button>
<div class="table-responsive">
<table id="table_<?= $dog ?>" class="table" style="display:none">
<tr>
<th>Event</th>
<th>Datum</th>
<th>Lauf</th>
<th>Startnummer</th>
<th>Teilnehmer</th>
<th>Hund</th>
<th>Verein</th>
<th>F</th>
<th>VW</th>
<th>ZF</th>
<th>Zeit</th>
<th>GF</th>
<th>m/sek</th>
<th>Bew.</th>
<th>Punkte</th>
<th>Rang</th>
<th>Aktion</th>
</tr>
<?php foreach ($results as $res) :
// graph data preparation
if ($res['bew'] != 'DIS' && $res['punkte'] != 'DIS')
{
$sdata['dates'][] = date("d.m.Y", strtotime($res['date']));
$sdata['speed'][] = $res['msek'] ?: 0;
$sdata['errors'][] = $res['f'] ?: 0;
$sdata['refusals'][] = $res['vw'] ?: 0;
$sdata['time'][] = $res['zeit'] ?: 0;
$sdata['points'][] = $res['punkte'];
$sdata['ranking'][] = $res['rang'];
}
?>
<tr>
<td><?= $res['event'] ?></td>
<td><?= date("d.m.Y", strtotime($res['date'])) ?></td>
<td><?= $res['run'] ?></td>
<td><?= $res['stnr'] ?></td>
<td><?= $res['teilnehmer'] ?></td>
<td><?= $res['hund'] ?></td>
<td><?= $res['verein'] ?></td>
<td><?= $res['f'] ?></td>
<td><?= $res['vw'] ?></td>
<td><?= $res['zf'] ?></td>
<td><?= $res['zeit'] ?></td>
<td><?= $res['gf'] ?></td>
<td><?= $res['msek'] ?></td>
<td><?= $res['bew'] ?></td>
<td><?= $res['punkte'] ?></td>
<td><?= $res['rang'] ?></td>
<td><a href="#" class="btn btn-primary" title="Importieren"><i class="fas fa-file-import"></i></a></td>
</tr>
<?php endforeach; ?>
</table>
</div>
<?php if (count($results) > 0) : ?>
<div class="col">
<div id="graph<?= $dog ?>" data-bs-theme="light" class="card bg-light text-black" style="min-height: 400px;"></div>
<script type="text/javascript">
// Initialize the echarts instance based on the prepared dom
var myChart = echarts.init(document.getElementById('graph<?= $dog ?>'));
// Specify the configuration items and data for the chart
var option = {
title: {
text: 'Stacked Line'
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['Geschwindigkeit', 'Fehler', 'Verweigerungen', 'Zeit', 'Geschwindigkeit', 'Punkte', 'Platz']
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
toolbox: {
feature: {
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: <?= json_encode($sdata['dates']); ?>
},
yAxis: {
type: 'value'
},
series: [{
name: 'Geschwindigkeit',
type: 'line',
stack: 'Total',
data: <?= json_encode($sdata['speed']); ?>
},
{
name: 'Fehler',
type: 'line',
stack: 'Total',
data: <?= json_encode($sdata['errors']); ?>
},
{
name: 'Verweigerungen',
type: 'line',
stack: 'Total',
data: <?= json_encode($sdata['refusals']); ?>
},
{
name: 'Zeit',
type: 'line',
stack: 'Total',
data: <?= json_encode($sdata['time']); ?>
},
{
name: 'Punkte',
type: 'line',
stack: 'Total',
data: <?= json_encode($sdata['points']); ?>
},
{
name: 'Platz',
type: 'line',
stack: 'Total',
data: <?= json_encode($sdata['ranking']); ?>
}
]
};
// Display the chart using the configuration items and data just specified.
myChart.setOption(option);
</script>
</div>
<?php endif; ?>
<hr>
<?php endforeach; ?>