diff --git a/Project/php/controller/AdminController.php b/Project/php/controller/AdminController.php
index 68192e4..1c9a30b 100755
--- a/Project/php/controller/AdminController.php
+++ b/Project/php/controller/AdminController.php
@@ -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 {
diff --git a/Project/php/model/MdlAdmin.php b/Project/php/model/MdlAdmin.php
index d488fd5..a47eb77 100755
--- a/Project/php/model/MdlAdmin.php
+++ b/Project/php/model/MdlAdmin.php
@@ -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 {
diff --git a/Project/php/templates/groupView.html b/Project/php/templates/groupView.html
index 516b9a9..9ef9a32 100755
--- a/Project/php/templates/groupView.html
+++ b/Project/php/templates/groupView.html
@@ -8,14 +8,15 @@
+ Group list
{% if groups is defined %}
{% for row in groups %}
@@ -45,8 +46,9 @@
{% endif %}
-{% if selectedGroup is defined %}
+
+ User list
ID |
@@ -58,7 +60,7 @@
Role |
Extra Time |
- {% if users is defined %}
+ {% if selectedGroup is defined and users is defined %}
{% for row in users %}
{{row.id}} |
@@ -77,7 +79,6 @@
{% endif %}
-{% endif %}