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

245 lines
13 KiB
PHP
Raw Permalink Normal View History

2023-10-26 13:46:55 +02:00
<!-- FILEPATH: /home/chris/git/dogstats/web/pages/dogs/dog.html -->
<div class="container">
2023-11-20 19:49:06 +01:00
<div class="">
<div class="row">
<div id="dog-data" class="col-sm-6 offset-sm-3 position-relative rounded-2 shadow mb-3 mb-md-5">
<img src="<?= $dogdata['photo']?:'https://pictshare.net/1ch3e5.png' ?>/120x160/forcesize" width="120" height="160" class="rounded-5 rounded-top-0 dog-image shadow" alt="<?= escape($dogdata['name']); ?>'s profile Picture">
2023-10-31 23:16:41 +01:00
2023-11-20 20:18:17 +01:00
<h1 class="mb-3">
2023-11-20 19:49:06 +01:00
<?= escape($dogdata['name']); ?>
2023-11-20 20:18:17 +01:00
</h1>
2023-11-20 19:49:06 +01:00
<div class="table-responsive">
<table class="table">
<tbody>
<tr>
<td>Alter:</td>
<td><?= date_diff(date_create($dogdata['birthday']), date_create('now'))->y ?></td>
</tr>
2023-10-31 23:16:41 +01:00
2023-11-20 19:49:06 +01:00
<?php if($dogdata['breed']): ?>
<tr>
<td>Rasse:</td>
<td><?= escape($dogdata['breed']); ?></td>
</tr>
<?php endif; ?>
<?php if($dogdata['kennel_name']): ?>
<tr>
<td>Zuchtname:</td>
<td><?= escape($dogdata['kennel_name']); ?></td>
</tr>
<?php endif; ?>
<?php if($dogdata['size']): ?>
<tr>
<td>Größe:</td>
<td><?= escape($dogdata['size']); ?> cm</td>
</tr>
<?php endif; ?>
<?php if($dogdata['agility_size']): ?>
<tr>
<td>Agility Größe:</td>
<td><?= escape($dogdata['agility_size']); ?></td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
<?php if($ismydog===true): ?>
<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>
2023-10-26 13:46:55 +02:00
</div>
2023-11-20 19:49:06 +01:00
<?php endif; ?>
2023-10-31 23:16:41 +01:00
</div>
2023-10-26 13:46:55 +02:00
</div>
2023-11-20 19:49:06 +01:00
</div>
2023-11-28 16:23:22 +01:00
<div class="container pb-4" id="sitemain">
2023-10-31 22:43:08 +01:00
<!-- table of all runs of this dog-->
2023-11-20 20:18:17 +01:00
<h2>Alle Ergebnisse</h2>
2023-11-20 19:49:06 +01:00
<div class="accordion" id="accordion-dog-runs">
<div class="accordion-item">
2023-11-20 20:18:17 +01:00
<h3 class="accordion-header">
2023-11-20 19:49:06 +01:00
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
2023
</button>
2023-11-20 20:18:17 +01:00
</h3>
2023-11-28 16:23:22 +01:00
<div id="collapseOne" class="accordion-collapse collapse" data-bs-parent="#accordion-dog-runs">
2023-11-20 19:49:06 +01:00
<div class="accordion-body">
<table class="table">
<thead>
<tr>
<th>Turnier</th>
<th>Lauf</th>
2023-11-20 20:18:17 +01:00
<th class="text-end">VW</th>
<th class="text-end">F</th>
<th class="text-end">ZF</th>
<th class="text-end">Zeit</th>
<th class="text-end">GF</th>
<th class="text-end">m/Sek</th>
<th class="text-end">Bew.</th>
<th class="text-end">Platz</th>
2023-11-20 19:49:06 +01:00
</tr>
</thead>
2023-11-28 16:23:22 +01:00
<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>
2023-11-20 20:18:17 +01:00
<td class="text-end">
<?= $result['disqualified']?'':escape($result['refusals']); ?>
2023-11-01 19:53:36 +01:00
</td>
2023-11-20 20:18:17 +01:00
<td class="text-end">
<?= $result['disqualified']?'':escape($result['errors']); ?>
2023-11-01 19:53:36 +01:00
</td>
2023-11-20 20:18:17 +01:00
<td class="text-end">
<?= $result['disqualified']?'':escape($result['timefaults']); ?>
2023-11-01 19:53:36 +01:00
</td>
2023-11-20 20:18:17 +01:00
<td class="text-end">
<?= $result['disqualified']?'':escape($result['runtime']); ?>
2023-11-01 19:53:36 +01:00
</td>
2023-11-20 20:18:17 +01:00
<td class="text-end">
<?= $result['disqualified']?'':escape($result['penalties']); ?>
2023-11-01 19:53:36 +01:00
</td>
2023-11-20 20:18:17 +01:00
<td class="text-end">
<?= $result['disqualified']?'':escape($result['speed']); ?>
2023-11-01 19:53:36 +01:00
</td>
2023-11-20 20:18:17 +01:00
<td class="text-end">
<?= $result['disqualified']?'':escape($result['rating']); ?>
2023-11-01 19:53:36 +01:00
</td>
2023-11-20 20:18:17 +01:00
<td class="text-end">
<?= $result['disqualified']?'Dis':escape($result['ranking'] . '. Platz'); ?>
2023-11-01 19:53:36 +01:00
</td>
2023-11-20 20:18:17 +01:00
2023-11-01 19:53:36 +01:00
</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>
2023-11-28 16:23:22 +01:00
</table>
2023-10-31 23:16:41 +01:00
2023-11-28 16:23:22 +01:00
<?php if(count($results) > 0): ?>
<div class="col">
<div id="graph" 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'));
// 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; ?>
</div>
</div>
</div>
</div>
2023-10-31 23:16:41 +01:00
</div>
2023-11-28 16:23:22 +01:00
</div>