Commit
This commit is contained in:
parent
14820d90fd
commit
d3657810b1
4
app/view/pages/race/configure/reset.php
Normal file
4
app/view/pages/race/configure/reset.php
Normal file
@ -0,0 +1,4 @@
|
||||
<h1>Er du sikker?</h1>
|
||||
<p>Er du sikker på at du vil nullstille alle runder?</p>
|
||||
<span>[ <a class="success" href="reset.php?confirm=1">Nullstill</a> ]</span>
|
||||
<span>[ <a class="danger" href="index.php">Avbryt</a> ]</span>
|
@ -1,4 +1,4 @@
|
||||
<h1>Er du sikker?</h1>
|
||||
<p>Er du sikker på at du vil slette lag <?=htmlspecialchars($team->name)?>?</p>
|
||||
<span>[ <a class="success" href="delete.php?item=<?=$team->id?>">Slett</a> ]</span>
|
||||
<span>[ <a class="success" href="delete.php?confirm=1&item=<?=$team->id?>">Slett</a> ]</span>
|
||||
<span>[ <a class="danger" href="index.php">Avbryt</a> ]</span>
|
@ -1,5 +1,6 @@
|
||||
<h1>Endre lagtabell</h1>
|
||||
<span class="float-right">[ <a class="success" href="update.php">Opprett lag</a> ]</span>
|
||||
<span class="float-right">[ <a class="danger" href="../reset.php">Nullstill runder</a> ] </span>
|
||||
<br>
|
||||
<table>
|
||||
<tr>
|
||||
@ -29,7 +30,7 @@
|
||||
echo "<td>" . htmlspecialchars($team->rounds) . "</td>";
|
||||
echo "<td>" . htmlspecialchars(($team->bestTime === NULL) ? "Ukjent" : $team->bestTime) . "</td>";
|
||||
echo "<td>";
|
||||
echo "<span>[ <a class='danger' href='delete.php?item={$team->id}&confirm=1'>Slett</a> ] </span>";
|
||||
echo "<span>[ <a class='danger' href='delete.php?item={$team->id}'>Slett</a> ] </span>";
|
||||
echo "<span>[ <a class='info' href='update.php?item={$team->id}'>Endre</a> ]</span>";
|
||||
echo "</td>";
|
||||
echo '</tr>';
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php $app = require '../../../app/inc.php';
|
||||
/**
|
||||
* Remove times from timetable and update teamtable with new times
|
||||
* Resets team counters and removes all time records
|
||||
*/
|
||||
|
||||
use App\Teamtable\Team;
|
||||
@ -8,6 +8,16 @@ use App\Teamtable\TeamMapper;
|
||||
use App\Timetable\Time;
|
||||
use App\Timetable\TimeMapper;
|
||||
|
||||
$confirm = filter_input(INPUT_GET, 'confirm', FILTER_VALIDATE_BOOLEAN);
|
||||
|
||||
if (!$confirm)
|
||||
{
|
||||
$app->view('template/header', ['title' => 'Nullstill runder']);
|
||||
$app->view('pages/race/configure/reset');
|
||||
$app->view('template/footer');
|
||||
die();
|
||||
}
|
||||
|
||||
$teamMapper = new TeamMapper($app->database->conn);
|
||||
$timeMapper = new TimeMapper($app->database->conn);
|
||||
|
||||
@ -28,3 +38,6 @@ foreach ($times as $key => $time)
|
||||
{
|
||||
$timeMapper->delete($time->id);
|
||||
}
|
||||
|
||||
$app->session->flash("Runder er nullstilt", "success");
|
||||
$app->redirect("index.php");
|
@ -23,7 +23,7 @@ if (!$team)
|
||||
}
|
||||
|
||||
// show confirmation page
|
||||
if ($confirm)
|
||||
if (!$confirm)
|
||||
{
|
||||
$app->view('template/header', ['title' => 'Bekreft sletting']);
|
||||
$app->view('pages/race/configure/teams/delete', ['team' => $team]);
|
||||
|
Reference in New Issue
Block a user