This commit is contained in:
William 2022-02-07 11:09:16 +01:00
parent b5cd0c82a8
commit 4c19cbcbb5
5 changed files with 57 additions and 0 deletions

17
app/model/Teamtable.php Normal file
View File

@ -0,0 +1,17 @@
<?php
class Teamtable
{
public PDO $dbh;
public function __construct(Database $database)
{
$this->dbh = $database->conn;
}
public function getTable(): array
{
$sth = $this->dbh->query('SELECT * FROM lagtabell');
return $sth->fetchAll(PDO::FETCH_ASSOC);
}
}

View File

@ -0,0 +1,24 @@
<h1>Endre lagtabell</h1>
<br>
<table>
<tr>
<th>ID</th>
<th>Navn</th>
<th>Bedrift</th>
<th>Kortnummer</th>
<th>Leder</th>
<th>Telefon</th>
<th>Deltagere</th>
<th>Runder</th>
<th>Bestetid</th>
</tr>
<?php
foreach ($teams as $row) {
echo '<tr>';
foreach ($row as $key) {
echo "<td>$key</td>";
}
echo '</tr>';
}
?>
</table>

View File

@ -0,0 +1,8 @@
<?php
$app = require '../../../app/inc.php';
$model = $app->model('Teamtable');
$app->view('template/header', ['title' => 'Endre lagtabell']);
$app->view('teamtable/edit/index', ["teams" => $model->getTable()]);
$app->view('template/footer');

View File

@ -0,0 +1,8 @@
<?php
$app = require '../../app/inc.php';
$model = $app->model('Teamtable');
$app->view('template/header', ['title' => 'Lagtabell']);
$app->view('teamtable/index', ["teams" => $model->getTable()]);
$app->view('template/footer');