Merge branch 'master' of gitea.haschek.at:Crispi/dogstats
Build and push / Pulling repo on server (push) Successful in 32s Details

This commit is contained in:
Chris 2023-11-24 20:49:37 +00:00
commit 9571c10db3
28 changed files with 2449 additions and 291 deletions

View File

@ -61,4 +61,17 @@ xdebug.client_port=5902 #same port as in launch.json
│ └── home Am einfachsten einen bestehenden anschauen oder kopieren 😁
└── templates Allgemeine Templates, mal schauen ob benötigt
└── partials
```
```
#Colors
#041337 - dunkelblau
#041337 - hellblau
#4c5597 - blau
#fefefc - white
#c8d2e9 - grau
#c9dd55 - hellgrün
#c9dd55 - dunkelgrün
#f0dcb3 - hellbraun
#a98d5d - dunkelbraun
#150d05 - schwarz

View File

@ -1,3 +1,57 @@
:root {
--white: #fefefd;
--lightblue: #47cafe;
--blue: #2ca6fc;
--darkblue: #021135;
--lightgreen: #cadc57;
--darkgreen: #788f08;
--lightbrown: #eddbb6;
--darkbrown: #ab8f5f;
--grey: #c5cbe9;
--black: #150d05;
}
@font-face {
font-family: 'Kalam-Light';
src: url(../webfonts/kalam/Kalam-Light.woff2) format('woff2');
}
@font-face {
font-family: 'Kalam-Regular';
src: url(../webfonts/kalam/Kalam-Regular.woff2) format('woff2');
}
@font-face {
font-family: 'Kalam-Bold';
src: url(../webfonts/kalam/Kalam-Bold.woff2) format('woff2');
}
h1, h2, h3 {
font-family: 'Kalam-Bold', sans-serif;
}
h4, h5, h6 {
font-family: 'Kalam-Regular', sans-serif;
}
.btn-primary {
--bs-btn-bg: var(--blue);
--bs-btn-border-color: var(--blue);
--bs-btn-hover-bg: var(--lightblue);
--bs-btn-hover-border-color: var(--lightblue);
--bs-btn-active-bg: var(--lightblue);
--bs-btn-disabled-color: var(--grey);
--bs-btn-disabled-bg: var(--blue);
--bs-btn-disabled-border-color: var(--blue);
}
.btn-secondary {
--bs-btn-bg: var(--darkgreen);
--bs-btn-border-color: var(--darkgreen);
--bs-btn-hover-bg: var(--lightgreen);
--bs-btn-hover-border-color: var(--lightgreen);
--bs-btn-active-bg: var(--lightgreen);
--bs-btn-active-border-color: var(--lightgreen);
--bs-btn-disabled-bg: var(--darkgreen);
--bs-btn-disabled-border-color: var(--darkgreen);
}
main>.container {
padding: 60px 15px 0;
}
@ -54,6 +108,13 @@ main>.container {
opacity: 1;
}
/* Dropzone overrides */
.dropzone {
min-height: 150px;
border: 2px solid rgba(0,0,0,.3);
padding: 20px 20px;
}
/* XDEBUG */
.xdebug-error th
{
@ -81,4 +142,14 @@ main>.container {
border:1px solid green;
background: #D1FFE8;
color:#000000;
}
#dog-data {
padding: 1rem 1rem 1rem 6rem;
border: 2px solid var(--blue);
}
#dog-data .dog-image {
position: absolute;
left: -50px;
top: -35px;
border: 1px solid var(--grey);
}

1
web/css/dropzone.min.css vendored Normal file

File diff suppressed because one or more lines are too long

1778
web/css/output.css Normal file

File diff suppressed because it is too large Load Diff

View File

@ -243,6 +243,68 @@ function pictshareUploadImage($path,$hash=false)
return $json;
}
// takes $_FILES['file'] as input and validates, throws error if fails, else returns URL of the image
function pictShareFormValidateAndUpload($file,$key=false)
{
if($key===false)
{
$photo_name = $file['name'];
$photo_tmp_name = $file['tmp_name'];
$photo_size = $file['size'];
$photo_error = $file['error'];
$photo_type = $file['type'];
}
else
{
$photo_name = $file['name'][$key];
$photo_tmp_name = $file['tmp_name'][$key];
$photo_size = $file['size'][$key];
$photo_error = $file['error'][$key];
$photo_type = $file['type'][$key];
}
$allowed = ['jpg','jpeg','png','gif'];
$photo_ext = strtolower(end(explode('.', $photo_name)));
if(in_array($photo_ext, $allowed))
{
if($photo_error === 0)
{
if($photo_size < 10000000)
{
$answer = pictshareUploadImage($photo_tmp_name);
if($answer['status']=='ok' && in_array($answer['filetype'],['jpeg','png','gif']))
return $answer['url'];
else
throw new Exception('Fehler beim CDN Upload: '.json_encode($answer,true));
}
else
throw new Exception('Die Datei ist zu groß. Bitte eine kleinere Datei hochladen');
}
else
throw new Exception('Fehler beim Upload: '.getFileUploadError($photo_error));
}
else
throw new Exception('Dateityp nicht erlaubt. Bitte nur '.implode(', ',$allowed).' hochladen');
}
function getFileUploadError($error)
{
$phpFileUploadErrors = array(
0 => 'There is no error, the file uploaded with success',
1 => 'The uploaded file exceeds the upload_max_filesize directive in php.ini',
2 => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form',
3 => 'The uploaded file was only partially uploaded',
4 => 'No file was uploaded',
6 => 'Missing a temporary folder',
7 => 'Failed to write file to disk.',
8 => 'A PHP extension stopped the file upload.',
);
return $phpFileUploadErrors[$error];
}
function partial($name,$variables=[])
{
$templatefile = ROOT.DS.'templates'.DS.'partials'.DS.$name;

1
web/js/dropzone.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -12,12 +12,12 @@ class Result extends Model
'disqualified' => ['type' => 'bool','default'=>0],
'refusals' => ['type' => 'int','default'=>0],
'errors' => ['type' => 'int','default'=>0],
'timefaults' => ['type' => 'int','default'=>0],
'runtime' => ['type' => 'int','default'=>0],
'penalties' => ['type' => 'int','default'=>0],
'timefaults' => ['type' => 'float','default'=>0],
'runtime' => ['type' => 'float','default'=>0],
'penalties' => ['type' => 'float','default'=>0],
'rating' => ['type' => 'text'],
'points' => ['type' => 'int','default'=>0],
'speed' => ['type' => 'int','default'=>0], //in m/sec
'speed' => ['type' => 'float','default'=>0], //in m/sec
'ranking' => ['type' => 'int','default'=>0],
'photos' => ['type' => 'array','default'=>[]],
'videos' => ['type' => 'array','default'=>[]],

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

@ -1,138 +1,185 @@
<!-- FILEPATH: /home/chris/git/dogstats/web/pages/dogs/dog.html -->
<div class="container">
<div class="row">
<div class="col-3">
<div class="card">
<img src="<?= $dogdata['photo']?:'https://pictshare.net/1ch3e5.png' ?>/300x200/forcesize" class="card-img-top" alt="<?= escape($dogdata['name']); ?>'s profile Picture">
<div class="card-body">
<h5 class="card-title">
<?= escape($dogdata['name']); ?>
</h5>
<p class="card-text">
<ul>
<li>Alter:
<?= date_diff(date_create($dogdata['birthday']), date_create('now'))->y ?>
</li>
<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">
<?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>
<h1 class="mb-3">
<?= escape($dogdata['name']); ?>
</h1>
<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>
<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>
<?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>
</div>
<?php endif; ?>
</div>
</div>
</div>
<div class="container" id="sitemain">
<!-- table of all runs of this dog-->
<h2>Alle Ergebnisse</h2>
<div class="accordion" id="accordion-dog-runs">
<div class="accordion-item">
<h3 class="accordion-header">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
2023
</button>
</h3>
<div id="collapseOne" class="accordion-collapse collapse show" data-bs-parent="#accordion-dog-runs">
<div class="accordion-body">
<table class="table">
<thead>
<tr>
<th>Turnier</th>
<th>Lauf</th>
<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>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="col-9" id="sitemain">
<!-- table of all runs of this dog-->
<div class="card p-2">
<h4>Alle Ergebnisse</h4>
<div class="table-responsive">
<div class="table-responsive">
<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>
<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>
</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['ranking'][] = $result['ranking'];
//'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 class="text-end">
<?= $result['disqualified']?'':escape($result['refusals']); ?>
</td>
<td class="text-end">
<?= $result['disqualified']?'':escape($result['errors']); ?>
</td>
<td class="text-end">
<?= $result['disqualified']?'':escape($result['timefaults']); ?>
</td>
<td class="text-end">
<?= $result['disqualified']?'':escape($result['runtime']); ?>
</td>
<td class="text-end">
<?= $result['disqualified']?'':escape($result['penalties']); ?>
</td>
<td class="text-end">
<?= $result['disqualified']?'':escape($result['speed']); ?>
</td>
<td class="text-end">
<?= $result['disqualified']?'':escape($result['rating']); ?>
</td>
<td class="text-end">
<?= $result['disqualified']?'Dis':escape($result['ranking'] . '. Platz'); ?>
</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> <?= escape($dogdata['name']); ?> 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 +261,6 @@
myChart.setOption(option);
</script>
</div>
<?php endif; ?>
</div>
</div>

View File

@ -1,7 +1,7 @@
<div>
<h1>Hund <?= $dogid?'Bearbeiten':'Hinzufügen'; ?></h1>
<form id="dogeditform" hx-post="/dogs/edit" hx-encoding='multipart/form-data' hx-target="#response">
<form id="dogeditform" hx-post="/dogs/edit" hx-encoding='multipart/form-data' hx-target="#response" class="row row-cols-2">
<input type="hidden" name="dog_id" value="<?= $dogid; ?>">
<div class="mb-3 mb-md-4">
<label for="name" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Name</label>

View File

@ -1,60 +1,26 @@
<h1>Meine Hunde</h1>
<figure>
<table class="table">
<thead>
<tr>
<th>
Foto
</th>
<th>
Name
</th>
<th>
Geburstag
</th>
<th>
Aktiv
</th>
<th>
Bearbeiten
</th>
<th>
Löschen
</th>
<th>Foto</th>
<th>Name</th>
<th>Geburstag</th>
<th>Aktiv</th>
<th>Bearbeiten</th>
<th>Löschen</th>
</tr>
</thead>
<tbody>
<?php foreach ($doggos as $dog) : ?>
<tr>
<td>
<img src="<?= $dog['photo'] ?>/50x50/forcesize">
</td>
<td>
<?= escape($dog['name']); ?>
</td>
<td>
<?= escape($dog['birthday']); ?>
</td>
<td>
<?= escape($dog['active'])?'Ja':'Nein'; ?>
</td>
<td>
<button hx-get="/dogs/edit/<?= $dog['id'] ?>" hx-push-url="/dogs/edit/<?= $dog['id'] ?>" hx-target="#main" >Bearbeiten</button>
</td>
<td>
<button hx-get="/dogs/delete/<?= $dog['id'] ?>" hx-target="#main" hx-confirm="Bist du sicher, dass du <?= escape($dog['name']); ?> löschen willst">Löschen</button>
</td>
</tr>
<tr>
<td><img src="<?= $dog['photo'] ?>/50x50/forcesize"></td>
<td><?= escape($dog['name']); ?></td>
<td><?= escape($dog['birthday']); ?></td>
<td><?= escape($dog['active'])?'Ja':'Nein'; ?></td>
<td><button hx-get="/dogs/edit/<?= $dog['id'] ?>" hx-push-url="/dogs/edit/<?= $dog['id'] ?>" hx-target="#main" class="btn btn-primary"><i class="fas fa-edit"></i></button></td>
<td><button hx-get="/dogs/delete/<?= $dog['id'] ?>" hx-target="#main" hx-confirm="Bist du sicher, dass du <?= escape($dog['name']); ?> löschen willst" class="btn btn-danger"><i class="fas fa-trash"></i></button></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>

View File

@ -1,7 +1,7 @@
<div>
<h1>Mein Profil bearbeiten</h1>
<form id="dogeditform" hx-post="/profile/edit" hx-encoding='multipart/form-data' hx-target="#response">
<form id="dogeditform" hx-post="/profile/edit" hx-encoding='multipart/form-data' hx-target="#response" class="row row-cols-2">
<div>
<label for="firstname">Vorname</label>
<input type="text" value="<?= $user['firstname']; ?>" id="firstname" name="firstname" class="form-control" placeholder="Max">

View File

@ -103,6 +103,25 @@ class Runs extends Page {
$res->run = $rid;
$res->user = $_SESSION['user']->id;
if($_FILES['photos'])
{
foreach($_FILES['photos']['tmp_name'] as $key => $tmp_name)
{
try{
$url = pictShareFormValidateAndUpload($_FILES['photos'],$key);
$res->data['photos'][] = $url;
}
catch(Exception $e)
{
return partial('error.html', ['errorMessage' => 'Fehler beim Upload des Fotos: '.$e->getMessage()]);
}
}
//filter out unique values so we don't have double entries
$res->data['photos'] = array_unique($res->data['photos']);
}
try{
$resid = $res->save();

View File

@ -22,12 +22,13 @@
<h2>Ergebnis
<?= $result_id?'Bearbeiten':'Eintragen'; ?>
</h2>
<form hx-post="/runs/validateresults" hx-encoding='multipart/form-data' hx-target="#response">
<form id="resulteditform" hx-post="/runs/validateresults" hx-encoding='multipart/form-data' hx-target="#response" hx-disabled-elt="#submit">
<div class="dropzone-previews"></div>
<input type="hidden" name="result_id" value="<?= $result_id; ?>">
<input type="hidden" name="run_id" value="<?= $run_id; ?>">
<div>
<label for="dog">Hund</label>
<select id="dog" name="dog">
<select id="dog" name="dog" class="form-control">
<option value="false" <?=!$result['dog']?'selected':''; ?>>-- Bitte auswählen --</option>
<?php foreach($_SESSION['user']->data['dogs'] as $dogid) : ?>
<?php
@ -43,35 +44,35 @@
</div>
<div class="form-check form-switch">
<label class="form-check-label" for="disqualified">Disqualifiziert</label>
<input class="form-check-input" type="checkbox" id="disqualified" name="disqualified" value="1" <?=$result['disqualified']=='1' ?'checked':''; ?>>
<input class="form-control form-check-input" type="checkbox" id="disqualified" name="disqualified" value="1" <?=$result['disqualified']=='1' ?'checked':''; ?>>
</div>
<div>
<label for="refusals">Verweigerungen</label>
<input type="number" value="<?= $result['refusals']; ?>" id="refusals" name="refusals" placeholder="Flowbite">
<input type="number" value="<?= $result['refusals']; ?>" id="refusals" name="refusals" class="form-control">
</div>
<div>
<label for="faults">Fehler</label>
<input type="number" value="<?= $result['faults']; ?>" id="faults" name="faults" placeholder="Flowbite">
<input type="number" value="<?= $result['faults']; ?>" id="faults" name="faults" class="form-control">
</div>
<div>
<label for="time_faults">Zeitfehler</label>
<input type="number" value="<?= $result['time_faults']; ?>" id="time_faults" name="time_faults" placeholder="Flowbite">
<input type="number" step="0.01" value="<?= $result['time_faults']; ?>" id="time_faults" name="time_faults" class="form-control">
</div>
<div>
<label for="time">Zeit</label>
<input type="number" value="<?= $result['time']; ?>" id="time" name="time" placeholder="Flowbite">
<input type="number" step="0.01" value="<?= $result['time']; ?>" id="time" name="time" class="form-control">
</div>
<div>
<label for="penalties">Gesamtfehler</label>
<input type="number" value="<?= $result['penalties']; ?>" id="penalties" name="penalties" placeholder="Flowbite">
<input type="number" step="0.01" value="<?= $result['penalties']; ?>" id="penalties" name="penalties" class="form-control">
</div>
<div>
<label for="time_speed">m/Sek</label>
<input type="number" value="<?= $result['time_speed']; ?>" id="time_speed" name="time_speed" placeholder="Flowbite">
<input type="number" step="0.01" value="<?= $result['time_speed']; ?>" id="time_speed" name="time_speed" class="form-control">
</div>
<div>
<label for="bewertung">Bewertung</label>
<select id="bewertung" name="bewertung">
<select id="bewertung" name="bewertung" class="form-control">
<option value="V" <?=$result['bewertung']=='V' ?'selected':''; ?>>V</option>
<option value="SG" <?=$result['bewertung']=='SG' ?'selected':''; ?>>SG</option>
<option value="G" <?=$result['bewertung']=='G' ?'selected':''; ?>>G</option>
@ -80,30 +81,36 @@
</div>
<div>
<label for="points">Punkte</label>
<input type="number" value="<?= $result['points']; ?>" id="points" name="points" placeholder="Flowbite">
<input type="number" value="<?= $result['points']; ?>" id="points" name="points" class="form-control">
</div>
<div>
<label for="rank">Platz</label>
<input type="number" value="<?= $result['rank']; ?>" id="rank" name="rank" placeholder="Flowbite">
<input type="number" value="<?= $result['rank']; ?>" id="rank" name="rank" class="form-control">
</div>
<div>
<label for="uploads">Uploads</label>
<input type="file" accept="image/png, image/jpeg, image/gif" id="uploads" name="uploads">
<input type="file" accept="image/png, image/jpeg, image/gif" id="uploads" class="form-control" name="photos[]" multiple>
</div>
<div>
<label for="video-url">Video Url</label>
<input type="text" value="<?= $result['video-url']; ?>" class="form-control" id="video-url" aria-describedby="basic-addon3">
<input type="text" value="<?= $result['video-url']; ?>" class="form-control" id="video-url" aria-describedby="basic-addon3" placeholder="https://www.youtube.com/...">
</div>
<div>
<label for="memo">Memo</label>
<textarea value="<?= $result['memo']; ?>" id="memo" name="memo" placeholder="Deine Gedankengänge"></textarea>
<textarea value="<?= $result['memo']; ?>" id="memo" name="memo" class="form-control" placeholder="Deine Gedankengänge"></textarea>
</div>
<div class="form-check form-switch">
<label class="form-check-label" for="public">Daten im Lauf veröffentlichen</label>
<input class="form-check-input" type="checkbox" id="public" name="public" value="1" <?=$result['public']!='0' ?'checked':''; ?>>
<input class="form-control form-check-input" type="checkbox" id="public" name="public" value="1" <?=$result['public']!='0' ?'checked':''; ?>>
</div>
<button type="submit" name="submit" value="true" class="btn btn-primary">Speichern</button>
<button type="submit" id="submit" name="submit" value="true" class="btn btn-primary">Speichern</button>
<progress id='progress' value='0' max='100'></progress>
<div id="response"></div>
</form>
</div>
</div>
<script>
htmx.on('#resulteditform', 'htmx:xhr:progress', function(evt) {
htmx.find('#progress').setAttribute('value', evt.detail.loaded/evt.detail.total * 100)
});
</script>

View File

@ -6,33 +6,33 @@
<input type="hidden" name="tournament_id" value="<?= $tournament_id; ?>">
<input type="hidden" name="run_id" value="<?= $run_id; ?>">
<h2>Parcourdetails</h2>
<div>
<div class="mb-3 mb-md-4">
<label for="name">Bezeichnung</label>
<input type="text" value="<?= $run['name']; ?>" id="name" name="name" placeholder="zb: Oldies Jumping" required>
<input type="text" value="<?= $run['name']; ?>" id="name" name="name" class="form-control" placeholder="zb: Oldies Jumping" required>
</div>
<div>
<div class="mb-3 mb-md-4">
<label for="category">Parcourtyp</label>
<select id="category" name="category" >
<select id="category" name="category" class="form-control">
<option value="Agility" <?= $run['category']=='Agility'?'selected':''; ?>>Agility</option>
<option value="Jumping" <?= $run['category']=='Jumping'?'selected':''; ?>>Jumping</option>
</select>
</div>
<div>
<div class="mb-3 mb-md-4">
<label for="length">Parcourlänge (in m)</label>
<input type="number" min="1" max="1000" value="<?= $run['length']; ?>" id="length" name="length" placeholder="Max">
<input type="number" min="1" max="1000" value="<?= $run['length']; ?>" id="length" name="length" class="form-control" placeholder="180">
</div>
<div>
<div class="mb-3 mb-md-4">
<label for="time_standard">Normzeit</label>
<input type="number" value="<?= $run['time_standard']?:0; ?>" id="time_standard" name="time_standard" placeholder="Zuchtname">
<input type="number" value="<?= $run['time_standard']?:0; ?>" id="time_standard" name="time_standard" class="form-control" placeholder="50.000">
</div>
<div>
<div class="mb-3 mb-md-4">
<label for="time_max">Maxzeit</label>
<input type="number" value="<?= $run['time_max']?:0; ?>" id="time_max" name="time_max" placeholder="Flowbite">
<input type="number" value="<?= $run['time_max']?:0; ?>" id="time_max" name="time_max" class="form-control" placeholder="100.000">
</div>
<div class="mb-3 mb-md-4">
<label for="referee">Richter</label>
<input type="text" value="<?= $run['referee']; ?>" id="referee" name="referee" placeholder="Franz Ferdinand" class="form-control">
<input type="text" value="<?= $run['referee']; ?>" id="referee" name="referee" class="form-control" placeholder="Franz Ferdinand" class="form-control">
</div>
<button type="submit" name="submit" value="true" class="btn btn-primary">Speichern</button>
<button type="submit" name="submit" value="forward" class="btn btn-primary">Speichern und Ergebnisse eintragen</button>

View File

@ -1,33 +1,61 @@
<div class="container">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item">
<i class="fas fa-calendar-star"></i>
<a href="/tournaments/event/<?= $tournament_id; ?>" hx-push-url="/tournaments/event/<?= $tournament_id; ?>" hx-get="/tournaments/event/<?= $tournament_id; ?>" hx-target="#main"><?= escape($tournament['name']); ?></a>
</li>
<li class="breadcrumb-item active" aria-current="page">
<i class="far fa-running"></i> <?= escape($run['name']); ?>
</li>
<li class="breadcrumb-item">
<i class="fas fa-calendar-star"></i>
<a href="/tournaments/event/<?= $tournament_id; ?>" hx-push-url="/tournaments/event/<?= $tournament_id; ?>" hx-get="/tournaments/event/<?= $tournament_id; ?>" hx-target="#main">
<?= escape($tournament['name']); ?>
</a>
</li>
<li class="breadcrumb-item active" aria-current="page">
<i class="far fa-running"></i>
<?= escape($run['name']); ?>
</li>
</ol>
</nav>
</nav>
<div class="row">
<div class="col-3">
<div class="card">
<?php if($run['photo']): ?><img src="<?= $run['photo'] ?>/300x170/fixedsize" class="card-img-top" alt="<?= escape($run['name']); ?>'s profile Picture"> <?php endif; ?>
<?php if($run['photo']): ?><img src="<?= $run['photo'] ?>/300x170/fixedsize" class="card-img-top" alt="<?= escape($run['name']); ?>'s profile Picture">
<?php endif; ?>
<div class="card-body">
<h5 class="card-title"><?= escape($run['name']); ?></h5>
<h5 class="card-title">
<?= escape($run['name']); ?>
</h5>
<p class="card-text">
<ul>
<li>Gehört zu <a href="/tournaments/event/<?= $tournament_id; ?>" hx-push-url="/tournaments/event/<?= $tournament_id; ?>" hx-get="/tournaments/event/<?= $tournament_id; ?>" hx-target="#main"><?= escape($tournament['name']); ?></a></li>
<?php if($run['category']): ?> <li>Typ: <?= escape($run['category']); ?></li><?php endif; ?>
<?php if($run['length']): ?> <li>Länge: <?= escape($run['length']); ?>m</li><?php endif; ?>
<?php if($run['time_standard']): ?> <li>Normzeit: <?= escape($run['time_standard']); ?>s</li><?php endif; ?>
<?php if($run['time_max']): ?> <li>Maxzeit: <?= escape($run['time_max']); ?>s</li><?php endif; ?>
<?php if($run['referee']): ?> <li>Richter: <?= escape($run['referee']); ?></li><?php endif; ?>
</ul>
<ul>
<li>Gehört zu <a href="/tournaments/event/<?= $tournament_id; ?>" hx-push-url="/tournaments/event/<?= $tournament_id; ?>" hx-get="/tournaments/event/<?= $tournament_id; ?>" hx-target="#main">
<?= escape($tournament['name']); ?>
</a></li>
<?php if($run['category']): ?>
<li>Typ:
<?= escape($run['category']); ?>
</li>
<?php endif; ?>
<?php if($run['length']): ?>
<li>Länge:
<?= escape($run['length']); ?>m
</li>
<?php endif; ?>
<?php if($run['time_standard']): ?>
<li>Normzeit:
<?= escape($run['time_standard']); ?>s
</li>
<?php endif; ?>
<?php if($run['time_max']): ?>
<li>Maxzeit:
<?= escape($run['time_max']); ?>s
</li>
<?php endif; ?>
<?php if($run['referee']): ?>
<li>Richter:
<?= escape($run['referee']); ?>
</li>
<?php endif; ?>
</ul>
<div class="d-flex justify-content-end">
<?php if($admin===true): ?>
<button type="button" class="btn btn-secondary" hx-get="/runs/edit/<?= $run_id; ?>" hx-target="#main">
@ -36,15 +64,36 @@
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
<div class="col" id="sitemain">
<div class="card p-2 mb-2">
<div class="row">
<h3>Fotos</h3>
<?php foreach($results as $result) : ?>
<?php if($result['photos']): ?>
<?php foreach($result['photos'] as $photo) : ?>
<div class="col-md-4 mt-3 col-lg-3">
<a href="<?= $photo; ?>">
<img src="<?= $photo; ?>/100x100/forcesize" alt="<?= escape( (new Dog())->getField('name',$result['dog']) ) ?>'s Lauf" class="figure-img rounded">
</a>
</div>
<?php endforeach; ?>
<?php endif; ?>
<?php endforeach; ?>
</div>
</div>
<div class="card p-2">
<h4>Ergebnisse</h4>
<p class="card-text">
<button hx-get="/runs/addresults/<?= $run_id; ?>" hx-push-url="/runs/addresults/<?= $run_id; ?>" hx-target="#main" class="btn btn-primary"><i class="fas fa-plus-circle"></i> Ergebnis Eintragen</button>
</p>
</p>
<table class="table">
<thead>
@ -64,23 +113,42 @@
<tbody>
<?php foreach($results as $result) : ?>
<tr>
<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>
<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; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -16,11 +16,16 @@ class Tournaments extends Page {
if($_SESSION['user']->data['tournaments'] && count($_SESSION['user']->data['tournaments']) > 0)
{
$this->addSubmenuItem('divider');
$counter = 0;
foreach($_SESSION['user']->data['tournaments'] as $tid)
{
$t = new Tournament();
$t->load($tid);
$this->addSubmenuItem($t->data['name'],'/tournaments/event/'.$tid,'fas fa-calendar-star');
$counter++;
if ($counter === 5) {
break;
}
}
}
}
@ -31,6 +36,34 @@ class Tournaments extends Page {
}
function index() {
$events = $_SESSION['user']->data['tournaments'];
$tournaments = [];
foreach($events as $key => $eventid)
{
//var_dump($dogid);
$event = new Tournament();
try{
$event->load($eventid);
}
catch(Exception $e)
{
error_log("Event $eventid not found. Deleting from user");
unset($_SESSION['user']->data['tournament'][$key]);
$_SESSION['user']->save();
continue;
}
if($event->data)
$tournaments[] = array_merge($event->data,['id'=>$eventid]);
}
if(count($_SESSION['user']->data['tournaments']) > 0)
{
$this->set('tournaments',$tournaments);
$this->set('template', 'tournaments.html');
}
}
@ -150,8 +183,14 @@ class Tournaments extends Page {
else
{
$t = new Tournament();
if($id)
{
if($t->exists($id))
$t->load($id);
else
return partial('error.html', ['errorTitle' => 'Error', 'errorMessage' => 'Dieses Turnier existiert nicht']);
if(!in_array($_SESSION['user']->id, $t->data['admins']))
return partial('error.html', ['errorTitle' => 'Error', 'errorMessage' => 'Du bist nicht berechtigt, dieses Turnier zu bearbeiten']);
else
@ -183,7 +222,7 @@ class Tournaments extends Page {
return;
}
//var_dump($_SESSION['user']->data['dogs']);
//var_dump($_SESSION['user']->data['tournaments']);
if(!is_array($_SESSION['user']->data['tournaments']) || !in_array($tid, $_SESSION['user']->data['tournaments'])) // new t!
{

View File

@ -15,7 +15,7 @@
<div class="mb-3 mb-md-4">
<label for="tournament_duration">Dauer der Veranstaltung in Tagen</label>
<input type="number" min="1" max="7" value="<?= $tournamentdata['duration']; ?>" id="tournament_duration" name="tournament_duration" placeholder="1" class="form-control">
<input type="number" min="1" max="7" value="<?= $tournamentdata['duration']; ?>" id="tournament_duration" name="tournament_duration" value="1" class="form-control">
</div>
<div class="mb-3 mb-md-4">

View File

@ -69,34 +69,38 @@
<button hx-get="/runs/add/<?= $tournament_id; ?>" hx-push-url="/runs/add/<?= $tournament_id; ?>" hx-target="#main" class="btn btn-primary"><i class="fas fa-plus-circle"></i> Lauf hinzufügen</button>
<?php endif; ?>
<table class="table">
<thead>
<tr>
<th>Bezeichnung</th>
<th>Lauf</th>
<th>Parcourlänge</th>
<th>Normzeit</th>
<th>Maxzeit</th>
<th>Richter</th>
</tr>
</thead>
<tbody>
<?php foreach($tdata['runs'] as $rid) : ?>
<?php
$run = new Run();
$run->load($rid);
?>
<tr>
<td><a href="/runs/overview/<?= $rid; ?>" hx-get="/runs/overview/<?= $rid; ?>" hx-push-url="/runs/overview/<?= $rid; ?>" hx-target="#main"><?= escape($run->data['name']); ?></a></td>
<td><?= escape($run->data['category']); ?></td>
<td><?= escape($run->data['length']); ?>m</td>
<td><?= escape($run->data['time_standard']); ?>s</td>
<td><?= escape($run->data['time_max']); ?>s</td>
<td><?= escape($run->data['referee']); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Bezeichnung</th>
<th>Lauf</th>
<th>Parcourlänge</th>
<th>Normzeit</th>
<th>Maxzeit</th>
<th>Richter</th>
<th>Hund</th>
</tr>
</thead>
<tbody>
<?php foreach($tdata['runs'] as $rid) : ?>
<?php
$run = new Run();
$run->load($rid);
?>
<tr>
<td><a href="/runs/overview/<?= $rid; ?>" hx-get="/runs/overview/<?= $rid; ?>" hx-push-url="/runs/overview/<?= $rid; ?>" hx-target="#main"><?= escape($run->data['name']); ?></a></td>
<td><?= escape($run->data['category']); ?></td>
<td><?= escape($run->data['length']); ?>m</td>
<td><?= escape($run->data['time_standard']); ?>s</td>
<td><?= escape($run->data['time_max']); ?>s</td>
<td><?= escape($run->data['referee']); ?></td>
<td><?= escape($run->data['dog']); ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</p>
</div>

View File

@ -1,35 +1,21 @@
<!-- FILEPATH: /home/chris/git/dogstats/web/pages/dogs/dog.html -->
<div class="container">
<h1>Wettkämpfe</h1>
<div class="row">
<div class="col-3">
<div class="card">
<img src="<?= $dogdata['photo']?:'https://pictshare.net/1ch3e5.png' ?>/300x170/forcesize" class="card-img-top" alt="<?= escape($dogdata['name']); ?>'s profile Picture">
<div class="card-body">
<h5 class="card-title"><?= escape($dogdata['name']); ?></h5>
<p class="card-text">
<ul>
<li>Rasse: <?= escape($dogdata['breed'])?:'Nicht eingetragen'; ?></li>
<li>Alter: <?= date_diff(date_create($dogdata['birthday']), date_create('now'))->y ?></li>
<?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>
<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>
<h1>Turnier Veranstaltungen</h1>
<p>Hier kannst du alle Veranstaltungen einsehen.</p>
<div class="tournaments-list row row-cols-sm-2">
<?php foreach ($tournaments as $tournament) : ?>
<div class="p-2">
<div class="d-flex border">
<img src="<?= $tournament['photo']?:'https://pictshare.net/prrnrk.jpg' ?>/130x100/forcesize" class="" alt="<?= escape($tournament['name']); ?>'s event Picture">
<div class="m-3">
<h3 class="h5"><a href="/tournaments/event/<?= $tournament['id'] ?>" class="text-body link-underline link-underline-opacity-0"><?= escape($tournament['name']); ?></a></h3>
<p><?= date("d.m.y",strtotime($tournament['date'])); ?></p>
</div>
</div>
<div class="m-3 ms-auto">
<button hx-get="/tournament/edit/<?= $tournament['id'] ?>" hx-push-url="/tournament/edit/<?= $tournament['id'] ?>" hx-target="#main" class="btn btn-primary"><i class="fas fa-edit"></i></button>
<button hx-get="/tournament/delete/<?= $tournament['id'] ?>" hx-target="#main" hx-confirm="Bist du sicher, dass du <?= escape($tournament['name']); ?> löschen willst" class="btn btn-danger"><i class="fas fa-trash"></i></button>
</div>
</div>
</div>
<div class="col-8">
Second Column
</div>
</div>
<?php endforeach; ?>
</div>

View File

@ -8,7 +8,9 @@
<link href="/css/animate.min.css" rel="stylesheet">
<link href="/css/fontawesome.min.css" rel="stylesheet">
<link href="/css/bootstrap.min.css" rel="stylesheet">
<link href="/css/dogstats.css" rel="stylesheet">
<script src="/js/echarts.min.js"></script>
</head>
@ -37,6 +39,7 @@
<script src="/js/htmx.min.js"></script>
<script src="/js/bootstrap.bundle.min.js"></script>
<script src="/js/dropzone.min.js"></script>
<?php if((!$_SESSION['user'] || !$_SESSION['user']->theme)): ?><script src="/js/color-modes.js"></script><?php endif; ?>
</body>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,93 @@
Copyright (c) 2014, Indian Type Foundry (info@indiantypefoundry.com).
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.