meilleure redirections

php
Anthony RICHARD 2 years ago
parent 6ee3b356f7
commit 4962a0ed80

@ -160,8 +160,9 @@ class AdminController
$num = $_GET['num'];
$year = $_GET['year'];
$sector = $_GET['sector'];
$model->addGroup($num, $year, $sector);
$this->showAllGroups();
$groupID = $model->addGroup($num, $year, $sector);
$_GET['selectedGroup'] = $groupID;
$this->showGroupDetails();
}
public function addUserToGroup(): void {

@ -68,9 +68,9 @@ class MdlAdmin extends AbsModel
$gtw->remove($id);
}
public function addGroup(int $num, int $year, string $sector): void {
public function addGroup(int $num, int $year, string $sector): int {
$gtw = new GroupGateway(new Connection('mysql:host=localhost;dbname=dbanrichard7', 'anrichard7', 'achanger'));
$gtw->add(array($num, $year, $sector));
return $gtw->add(array($num, $year, $sector));
}
public function addUserToGroup($user, $group): void {

@ -8,14 +8,15 @@
<style>
body{
display: flex;
justify-content: space-around;
flex-wrap: wrap;
}
section{
border: 1px solid black;
width: 33%;
}
</style>
<section class="groupList">
<h2>Group list</h2>
<table>
{% if groups is defined %}
{% for row in groups %}
@ -45,8 +46,9 @@
{% endif %}
</table>
</section>
{% if selectedGroup is defined %}
<section class="users">
<h2>User list</h2>
<table>
<tr>
<td>ID</td>
@ -58,7 +60,7 @@
<td>Role</td>
<td>Extra Time</td>
</tr>
{% if users is defined %}
{% if selectedGroup is defined and users is defined %}
{% for row in users %}
<tr>
<td>{{row.id}}</td>
@ -77,7 +79,6 @@
{% endif %}
</table>
</section>
{% endif %}
<section class="addGroupForm">
<h2>Add group</h2>
<form action="index.php" method="GET">

Loading…
Cancel
Save