tried to implement import

This commit is contained in:
piapassecker 2023-12-23 18:20:50 +01:00
parent bd49027ad6
commit 53a614c5fd
2 changed files with 46 additions and 2 deletions

View File

@ -34,6 +34,7 @@
<th>msek</th> <th>msek</th>
<th>bew</th> <th>bew</th>
<th>punkte</th> <th>punkte</th>
<th>Action</th>
</tr> </tr>
<?php foreach ($results as $res) : <?php foreach ($results as $res) :
// graph data preparation // graph data preparation
@ -67,7 +68,7 @@
?> ?>
<tr> <tr>
<td><?= $res['event'] ?></td> <td><?= $res['event'] ?></td>
<td><?= $res['ago'] ?></td> <td><?= date("d.m.Y", strtotime($res['date'])) ?></td>
<td><?= $res['run'] ?></td> <td><?= $res['run'] ?></td>
<td><?= $res['rang'] ?></td> <td><?= $res['rang'] ?></td>
<td><?= $res['stnr'] ?></td> <td><?= $res['stnr'] ?></td>
@ -82,7 +83,24 @@
<td><?= $res['msek'] ?></td> <td><?= $res['msek'] ?></td>
<td><?= $res['bew'] ?></td> <td><?= $res['bew'] ?></td>
<td><?= $res['punkte'] ?></td> <td><?= $res['punkte'] ?></td>
<td>
<form id="tournament_import" hx-post="/tournaments/add" hx-encoding="multipart/form-data">
<input type="hidden" name="tournament_name" value="<?= $res['event'] ?>">
<input type="hidden" name="tournament_date" value="<?= date("d.m.Y", strtotime($res['date'])) ?>">
<input type="hidden" name="tournament_run" value="<?= $res['run'] ?>">
<input type="hidden" name="tournament_ranking" value="<?= $res['rang'] ?>">
<input type="hidden" name="tournament_number" value="<?= $res['stnr'] ?>">
<input type="hidden" name="tournament_participant" value="<?= $res['teilnehmer'] ?>">
<input type="hidden" name="tournament_dog" value="<?= $res['hund'] ?>">
<input type="hidden" name="tournament_club" value="<?= $res['verein'] ?>">
<input type="hidden" name="tournament_faults" value="<?= $res['f'] ?>">
<input type="hidden" name="tournament_refusals" value="<?= $res['vw'] ?>">
<input type="hidden" name="tournament_time" value="<?= $res['zeit'] ?>">
<input type="hidden" name="tournament_speed" value="<?= $res['msek'] ?>">
<input type="hidden" name="tournament_points" value="<?= $res['punkte'] ?>">
<button type="submit">Importieren</button>
</form>
</td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</table> </table>

View File

@ -32,8 +32,33 @@ class Tournaments extends Page {
function add() function add()
{ {
$t = new Tournament();
$t->name = $_REQUEST['tournament_name'];
$t->date = date("d.m.Y", strtotime($_REQUEST['tournament_date']));
$t->duration = intval($_REQUEST['tournament_duration']);
$t->referee = $_REQUEST['tournament_referee'];
$t->text = $_REQUEST['tournament_text'];
$t->url = $_REQUEST['tournament_url'];
$t->logo = $_REQUEST['tournament_logo'];
$t->run = $_REQUEST['tournament_run'];
$t->run = $_REQUEST['tournament_run'];
$t->ranking = $_REQUEST['tournament_ranking'];
$t->number = $_REQUEST['tournament_number'];
$t->participant = $_REQUEST['tournament_participant'];
$t->dog = $_REQUEST['tournament_dog'];
$t->club = $_REQUEST['tournament_club'];
$t->faults = $_REQUEST['tournament_faults'];
$t->refusals = $_REQUEST['tournament_refusals'];
$t->time = $_REQUEST['tournament_time'];
$t->points = $_REQUEST['tournament_points'];
$t->speed = $_REQUEST['tournament_speed'];
$this->set('tournamentdata',$t->data);
$this->set('template','edit_tournament.html'); $this->set('template','edit_tournament.html');
} }
function index() { function index() {
$events = $_SESSION['user']->data['tournaments']; $events = $_SESSION['user']->data['tournaments'];
@ -126,6 +151,7 @@ class Tournaments extends Page {
{ {
if($_REQUEST['submit']) if($_REQUEST['submit'])
{ {
var_dump($_REQUEST);
$id = $_REQUEST['tournament_id']; $id = $_REQUEST['tournament_id'];
$name = $_REQUEST['tournament_name']; $name = $_REQUEST['tournament_name'];
$date = $_REQUEST['tournament_date']; $date = $_REQUEST['tournament_date'];