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/dogs/dog.html.php

231 lines
10 KiB
PHP
Raw Normal View History

2023-10-26 13:46:55 +02:00
<!-- FILEPATH: /home/chris/git/dogstats/web/pages/dogs/dog.html -->
<div class="container">
<div class="row">
<div class="col-3">
<div class="card">
2023-10-29 17:43:26 +01:00
<img src="<?= $dogdata['photo']?:'https://pictshare.net/1ch3e5.png' ?>/300x200/forcesize" class="card-img-top" alt="<?= escape($dogdata['name']); ?>'s profile Picture">
2023-10-26 13:46:55 +02:00
<div class="card-body">
2023-10-31 23:16:41 +01:00
<h5 class="card-title">
<?= escape($dogdata['name']); ?>
</h5>
2023-10-26 13:46:55 +02:00
<p class="card-text">
2023-10-31 23:16:41 +01:00
<ul>
<li>Alter:
<?= date_diff(date_create($dogdata['birthday']), date_create('now'))->y ?>
</li>
<?php if($dogdata['breed']): ?>
<li>Rasse:
<?= escape($dogdata['breed']); ?>
</li>
<?php endif; ?>
<?php if($dogdata['kennel_name']): ?>
<li>Zuchtname:
<?= escape($dogdata['kennel_name']); ?>
</li>
<?php endif; ?>
<?php if($dogdata['size']): ?>
<li>Größe:
<?= escape($dogdata['size']); ?> cm
</li>
<?php endif; ?>
<?php if($dogdata['agility_size']): ?>
<li>Agility Größe:
<?= escape($dogdata['agility_size']); ?>
</li>
<?php endif; ?>
</ul>
2023-11-01 19:53:36 +01:00
<?php if($ismydog===true): ?>
2023-10-26 13:46:55 +02:00
<div class="d-flex justify-content-end">
<button type="button" class="btn btn-secondary" hx-get="/dogs/edit/<?= $dogid; ?>" hx-target="#main">
<i class="fas fa-edit"></i>
</button>
</div>
2023-11-01 19:53:36 +01:00
<?php endif; ?>
2023-10-26 13:46:55 +02:00
</div>
2023-10-31 23:16:41 +01:00
</div>
2023-10-26 13:46:55 +02:00
</div>
2023-10-31 22:43:08 +01:00
<div class="col-9" id="sitemain">
<!-- table of all runs of this dog-->
<div class="card p-2">
2023-10-31 22:50:36 +01:00
<h4>Alle Ergebnisse</h4>
2023-10-31 22:43:08 +01:00
<div class="table-responsive">
2023-10-31 23:16:41 +01:00
<table class="table">
<thead>
<tr>
<th>Turnier</th>
<th>Lauf</th>
<th>Platz</th>
<th>Disqualifiziert</th>
<th>Verweigerungen</th>
<th>Fehler</th>
<th>Zeitfehler</th>
<th>Zeit</th>
<th>Gesamtfehler</th>
<th>m/Sek</th>
<th>Bewertung</th>
<th>Teilnehmer</th>
</tr>
</thead>
<tbody>
2023-11-01 19:53:36 +01:00
<?php if(count($results) > 0): ?>
<?php foreach($results as $result) : ?>
<?php
$t = new Tournament();
$run = new Run();
2023-10-31 22:50:36 +01:00
2023-11-01 19:53:36 +01:00
$tname = $t->getField('name',$result['tournament']);
$tdate = $t->getField('date',$result['tournament']);
$rname = $run->getField('name',$result['run']);
2023-10-31 22:50:36 +01:00
2023-11-01 19:53:36 +01:00
$sdata['dates'][] = $tdate;
2023-10-31 23:42:26 +01:00
2023-11-01 19:53:36 +01:00
$sdata['speed'][] = $result['speed'];
$sdata['errors'][] = $result['errors'];
$sdata['refusals'][] = $result['refusals'];
$sdata['time'][] = $result['runtime'];
$sdata['points'][] = $result['points'];
2023-11-08 14:38:18 +01:00
$sdata['ranking'][] = $result['ranking'];
2023-10-31 23:42:26 +01:00
2023-11-01 19:53:36 +01:00
//'Geschwindigkeit', 'Fehler', 'Verweigerungen', 'Zeit', 'Punkte','Platz'
2023-10-31 23:42:26 +01:00
2023-11-01 19:53:36 +01:00
?>
<tr>
<td><a href="/tournaments/event/<?= $result['tournament']; ?>">
<?= $tname; ?>
</a></td>
<td><a href="/runs/overview/<?= $result['run']; ?>">
<?= $rname; ?>
</a></td>
<td>
<?= escape($result['ranking']); ?>
</td>
<td>
<?= $result['disqualified']?'Ja':'Nein'; ?>
</td>
<td>
<?= escape($result['refusals']); ?>
</td>
<td>
<?= escape($result['errors']); ?>
</td>
<td>
<?= escape($result['timefaults']); ?>
</td>
<td>
<?= escape($result['runtime']); ?>
</td>
<td>
<?= escape($result['penalties']); ?>
</td>
<td>
<?= escape($result['speed']); ?>
</td>
<td>
2023-11-08 14:38:18 +01:00
<?= escape($result['ranking']); ?>
2023-11-01 19:53:36 +01:00
</td>
<td><a href="/dogs/overview/<?= $result['dog'] ?>">
<?= escape( escape($dogdata['name']) ); ?>
2023-11-01 19:53:36 +01:00
</a></td>
</tr>
<?php endforeach; ?>
<?php else: ?>
2023-10-31 23:16:41 +01:00
<tr>
2023-11-01 19:53:36 +01:00
<td colspan="12">
<div class="alert alert-info" role="alert">
<i class="fas fa-info-circle"></i> <?= escape($dogdata['name']); ?> hat noch keine Ergebnisse
2023-11-01 19:53:36 +01:00
</div>
2023-10-31 23:16:41 +01:00
</td>
2023-11-01 19:53:36 +01:00
<?php endif; ?>
2023-10-31 23:16:41 +01:00
</tbody>
</table>
2023-10-31 22:43:08 +01:00
</div>
2023-10-31 23:16:41 +01:00
</div>
2023-11-01 19:53:36 +01:00
<?php if(count($results) > 0): ?>
2023-10-31 23:16:41 +01:00
<div class="col">
2023-10-31 23:42:26 +01:00
<div id="graph" data-bs-theme="light" class="card bg-light text-black" style="min-height: 400px;"></div>
2023-10-26 13:46:55 +02:00
2023-10-31 23:16:41 +01:00
<script type="text/javascript">
// Initialize the echarts instance based on the prepared dom
var myChart = echarts.init(document.getElementById('graph'));
// Specify the configuration items and data for the chart
var option = {
title: {
text: 'Stacked Line'
},
tooltip: {
trigger: 'axis'
},
legend: {
2023-10-31 23:42:26 +01:00
data: ['Geschwindigkeit', 'Fehler', 'Verweigerungen', 'Zeit', 'Geschwindigkeit','Punkte','Platz']
2023-10-31 23:16:41 +01:00
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
toolbox: {
feature: {
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
2023-10-31 23:42:26 +01:00
data: <?= json_encode($sdata['dates']); ?>
2023-10-31 23:16:41 +01:00
},
yAxis: {
type: 'value'
},
series: [
{
2023-10-31 23:42:26 +01:00
name: 'Geschwindigkeit',
type: 'line',
stack: 'Total',
data: <?= json_encode($sdata['speed']); ?>
},
{
name: 'Fehler',
2023-10-31 23:16:41 +01:00
type: 'line',
stack: 'Total',
2023-10-31 23:42:26 +01:00
data: <?= json_encode($sdata['errors']); ?>
2023-10-31 23:16:41 +01:00
},
{
2023-10-31 23:42:26 +01:00
name: 'Verweigerungen',
2023-10-31 23:16:41 +01:00
type: 'line',
stack: 'Total',
2023-10-31 23:42:26 +01:00
data: <?= json_encode($sdata['refusals']); ?>
2023-10-31 23:16:41 +01:00
},
{
2023-10-31 23:42:26 +01:00
name: 'Zeit',
2023-10-31 23:16:41 +01:00
type: 'line',
stack: 'Total',
2023-10-31 23:42:26 +01:00
data: <?= json_encode($sdata['time']); ?>
2023-10-31 23:16:41 +01:00
},
{
2023-10-31 23:42:26 +01:00
name: 'Punkte',
2023-10-31 23:16:41 +01:00
type: 'line',
stack: 'Total',
2023-10-31 23:42:26 +01:00
data: <?= json_encode($sdata['points']); ?>
2023-10-31 23:16:41 +01:00
},
{
2023-10-31 23:42:26 +01:00
name: 'Platz',
2023-10-31 23:16:41 +01:00
type: 'line',
stack: 'Total',
2023-10-31 23:42:26 +01:00
data: <?= json_encode($sdata['ranking']); ?>
2023-10-31 23:16:41 +01:00
}
]
};
// Display the chart using the configuration items and data just specified.
myChart.setOption(option);
</script>
</div>
2023-11-01 19:53:36 +01:00
<?php endif; ?>
2023-10-31 23:16:41 +01:00
</div>
</div>