meilleure redirections

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

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

@ -68,9 +68,9 @@ class MdlAdmin extends AbsModel
$gtw->remove($id); $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 = 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 { public function addUserToGroup($user, $group): void {

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

Loading…
Cancel
Save