39 lines
997 B
PHP
39 lines
997 B
PHP
<?php
|
|
$app = require '../../../app/inc.php';
|
|
|
|
$model = $app->model('Teamtable');
|
|
|
|
if (!isset($_GET['item']))
|
|
{
|
|
$app->session->flash('Kunne ikke endre lag: ID ikke definert som GET parameter', 'danger');
|
|
$app->redirect('index.php');
|
|
}
|
|
$id = $_GET['item'];
|
|
|
|
// ID must be numeric
|
|
if (!is_numeric($id))
|
|
{
|
|
$app->session->flash('Kunne ikke endre lag: ID må være tall', 'danger');
|
|
$app->redirect('index.php');
|
|
}
|
|
|
|
// Check if ID is in teamtable
|
|
$currentTeam = $model->getTeamByID($id);
|
|
if (!$currentTeam)
|
|
{
|
|
$app->session->flash("Kunne ikke endre lag: ID $id finnes ikke", "danger");
|
|
$app->redirect('index.php');
|
|
}
|
|
|
|
// todo: update team details here...
|
|
// $model->updateTeamByID(...)
|
|
|
|
// Escape all values
|
|
foreach ($currentTeam as $key => $value)
|
|
{
|
|
$currentTeam[$key] = htmlspecialchars($currentTeam[$key]);
|
|
}
|
|
|
|
$app->view('template/header', ['title' => 'Endre lagdetaljer']);
|
|
$app->view('pages/teamtable/edit/update', ["team" => $currentTeam]);
|
|
$app->view('template/footer'); |