hundeprofile sind jetzt öffentlich
All checks were successful
Build and push / Pulling repo on server (push) Successful in 3s

This commit is contained in:
Chris 2023-11-01 19:53:36 +01:00
parent 46cf4dcd40
commit 4794f46add
2 changed files with 69 additions and 57 deletions

View File

@ -209,12 +209,12 @@ class Dogs extends Page {
{
$dogid = $this->params[0];
$d = new Dog();
$res = new Result();
if(!$d->isMyDog($dogid))
return 'Not your dog :(';
//if(!$d->isMyDog($dogid))
// return 'Not your dog :(';
$d->load($dogid);
$this->set('ismydog',$d->isMyDog($dogid));
$this->set('results', $d->getResults());
$this->set('dogdata', $d->data);
$this->set('dogid', $dogid);

View File

@ -37,11 +37,13 @@
<?php endif; ?>
</ul>
<?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>
</div>
<?php endif; ?>
</div>
</div>
</div>
@ -68,71 +70,81 @@
</tr>
</thead>
<tbody>
<?php foreach($results as $result) : ?>
<?php
$t = new Tournament();
$run = new Run();
<?php if(count($results) > 0): ?>
<?php foreach($results as $result) : ?>
<?php
$t = new Tournament();
$run = new Run();
$tname = $t->getField('name',$result['tournament']);
$tdate = $t->getField('date',$result['tournament']);
$rname = $run->getField('name',$result['run']);
$tname = $t->getField('name',$result['tournament']);
$tdate = $t->getField('date',$result['tournament']);
$rname = $run->getField('name',$result['run']);
$sdata['dates'][] = $tdate;
$sdata['dates'][] = $tdate;
$sdata['speed'][] = $result['speed'];
$sdata['errors'][] = $result['errors'];
$sdata['refusals'][] = $result['refusals'];
$sdata['time'][] = $result['runtime'];
$sdata['points'][] = $result['points'];
$sdata['rating'][] = $result['rating'];
$sdata['speed'][] = $result['speed'];
$sdata['errors'][] = $result['errors'];
$sdata['refusals'][] = $result['refusals'];
$sdata['time'][] = $result['runtime'];
$sdata['points'][] = $result['points'];
$sdata['rating'][] = $result['rating'];
//'Geschwindigkeit', 'Fehler', 'Verweigerungen', 'Zeit', 'Punkte','Platz'
//'Geschwindigkeit', 'Fehler', 'Verweigerungen', 'Zeit', 'Punkte','Platz'
?>
?>
<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>
<?= escape($result['rating']); ?>
</td>
<td><a href="/dogs/overview/<?= $result['dog'] ?>">
<?= escape( (new Dog())->getField('name',$result['dog']) ); ?>
</a></td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<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 colspan="12">
<div class="alert alert-info" role="alert">
<i class="fas fa-info-circle"></i> Dieser Hund hat noch keine Ergebnisse
</div>
</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>
<?= escape($result['rating']); ?>
</td>
<td><a href="/dogs/overview/<?= $result['dog'] ?>">
<?= escape( (new Dog())->getField('name',$result['dog']) ); ?>
</a></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
<?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>
@ -214,6 +226,6 @@
myChart.setOption(option);
</script>
</div>
<?php endif; ?>
</div>
</div>