fast kann man schon ergebnisse eintragne
All checks were successful
Build and push / Pulling repo on server (push) Successful in 2s

This commit is contained in:
2023-10-31 11:26:54 +01:00
parent 9b6e3080c2
commit d96dc2fae3
5 changed files with 166 additions and 31 deletions

View File

@ -27,6 +27,52 @@ class Runs extends Page {
$this->set('template', 'run.html');
}
function addresults()
{
$rid = $this->params[0];
$run = new Run();
if(!$run->exists($rid))
return partial('error.html', ['errorMessage' => 'Dieser Lauf existiert nicht']);
$run->load($rid);
$t = new Tournament();
$tid = $run->data['tournament'];
$t->load($tid);
if(!$t->amIAdmin() && !$t->isMyEvent($tid))
return partial('error.html', ['errorMessage' => 'Du bist in diesem Turnier nicht angemeldet']);
else
{
$this->set('tournament', $t->data);
$this->set('tournament_id', $tid);
$this->set('run', $run->data);
$this->set('run_id', $rid);
$this->set('template', 'edit_result.html');
}
}
function validateResults()
{
$rid = $_REQUEST['run_id'];
$run = new Run();
if(!$run->exists($rid))
return partial('error.html', ['errorMessage' => 'Dieser Lauf existiert nicht']);
$run->load($rid);
$t = new Tournament();
$tid = $run->data['tournament'];
$t->load($tid);
if(!$t->amIAdmin() && !$t->isMyEvent($tid))
return partial('error.html', ['errorMessage' => 'Du bist in diesem Turnier nicht angemeldet']);
else
{
$run->data['results'] = [];
$run->data['results']['time'] = $_REQUEST['time'];
$run->data['results']['penalty'] = $_REQUEST['penalty'];
$run->data['results']['disq'] = $_REQUEST['disq'];
$run->data['results']['comment'] = $_REQUEST['comment'];
$run->data['results']['referee'] = $_REQUEST['referee'];
$run->data['results']['judge'] = $_REQUEST['judge'];
}
}
function add()
{
$tournament = $this->params[0];
@ -69,7 +115,7 @@ class Runs extends Page {
function validate()
{
if($_REQUEST['submit']=='true')
if($_REQUEST['submit'])
{
$t = new Tournament();
@ -116,7 +162,12 @@ class Runs extends Page {
$t->save();
}
$this->redirect('/tournaments/event/'.$t->id);
if($_REQUEST['submit']=='forward')
{
$this->redirect('/runs/addresults/'.$runid);
}
else
$this->redirect('/tournaments/event/'.$t->id);
}
else return partial('error.html', ['errorMessage' => 'Fehler beim Speichern des Laufs']);
}