Anthony RICHARD 1 year ago
parent 090f0c0025
commit faedf5654e

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Before

Width:  |  Height:  |  Size: 4.3 MiB

After

Width:  |  Height:  |  Size: 4.3 MiB

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Before

Width:  |  Height:  |  Size: 210 KiB

After

Width:  |  Height:  |  Size: 210 KiB

Before

Width:  |  Height:  |  Size: 294 KiB

After

Width:  |  Height:  |  Size: 294 KiB

Before

Width:  |  Height:  |  Size: 181 KiB

After

Width:  |  Height:  |  Size: 181 KiB

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Before

Width:  |  Height:  |  Size: 882 KiB

After

Width:  |  Height:  |  Size: 882 KiB

Before

Width:  |  Height:  |  Size: 6.6 MiB

After

Width:  |  Height:  |  Size: 6.6 MiB

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 98 KiB

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

@ -18,4 +18,4 @@ global $password;
$password = 'achanger';
global $altorouterPath;
$altorouterPath = "/SAE_2A_Anglais/Project/php";
$altorouterPath = "/~anrichard7/SAE_2A_Anglais/Project/php";

@ -10,37 +10,41 @@ class AdminController
{
public function showAllUsers(): void {
global $twig;
global $user;
$model = new MdlAdmin();
$users = $model->getAllUsers();
echo $twig->render('usersView.html', ['users' => $users]);
echo $twig->render('usersView.html', ['users' => $users, 'userID' => $user->getId()]);
}
public function showAllAdmins(): void {
global $twig;
global $user;
$model = new MdlAdmin();
$users = $model->getAllAdmins();
echo $twig->render('usersView.html', ['users' => $users]);
echo $twig->render('usersView.html', ['users' => $users, 'userID' => $user->getId()]);
}
public function showAllTeachers(): void {
global $twig;
global $user;
$model = new MdlAdmin();
$users = $model->getAllTeachers();
echo $twig->render('usersView.html', ['users' => $users]);
echo $twig->render('usersView.html', ['users' => $users, 'userID' => $user->getId()]);
}
public function showAllStudents(): void {
global $twig;
global $user;
$model = new MdlAdmin();
$users = $model->getAllStudents();
echo $twig->render('usersView.html', ['users' => $users]);
echo $twig->render('usersView.html', ['users' => $users, 'userID' => $user->getId()]);
}
public function removeUser(): void {
try {
$id = Validation::filter_int($_GET['userID'] ?? null);
global $user;
$model = new MdlAdmin();
$model->removeUser($id);
$model->removeUser($user->getId());
$this->showAllUsers();
}
catch (Exception $e) {
@ -50,21 +54,24 @@ class AdminController
public function showAllGroups(): void {
global $twig;
global $user;
$model = new MdlAdmin();
$groups = $model->getAllGroups();
$unassignedUsers = $model->getUnassignedUsers();
echo $twig->render('manageGroupView.html', ['groups' => $groups, 'unassignedUsers' => $unassignedUsers]);
echo $twig->render('manageGroupView.html', ['groups' => $groups, 'unassignedUsers' => $unassignedUsers, 'userID' => $user->getId()]);
}
public function showGroupDetails(): void {
try {
global $twig;
global $user;
$selectedGroup = Validation::filter_int($_GET['selectedGroup'] ?? null);
$model = new MdlAdmin();
$groups = $model->getAllGroups();
$users = $model->getUsersOfGroup($selectedGroup);
$unassignedUsers = $model->getUnassignedUsers();
echo $twig->render('manageGroupView.html', ['groups' => $groups, 'selectedGroup' => $selectedGroup, 'users' => $users, 'unassignedUsers' => $unassignedUsers]);
echo $twig->render('manageGroupView.html', ['groups' => $groups, 'selectedGroup' => $selectedGroup, 'users' => $users, 'unassignedUsers' => $unassignedUsers, 'userID' => $user->getId()]);
}
catch (Exception $e) {
throw new Exception("invalid group ID");
@ -113,10 +120,10 @@ class AdminController
public function addUserToGroup(): void {
try {
$user = Validation::filter_int($_GET['userID'] ?? null);
global $user;
$group = Validation::filter_int($_GET['groupID'] ?? null);
$model = new MdlAdmin();
$model->addUserToGroup($user, $group);
$model->addUserToGroup($user->getId(), $group);
$_GET['selectedGroup'] = $group;
$this->showGroupDetails();
}

@ -1,4 +1,4 @@
<form action="addGroup" method="GET">
<form action="{{ base }}/admin/{{ userID }}/addGroup" method="GET">
<input name="num" type="text" placeholder="number" required>
<input name="year" type="text" placeholder="year" required>
<input name="sector" type="text" placeholder="sector" required>

@ -21,11 +21,10 @@
<section>
<h1>Add words</h1>
{% if user is defined %}
<form action="index.php" method="GET">
<form action="{{base}}/teacher/addVocabList" method="GET">
<table>
<tr>
<td colspan="2">
<input type="hidden" name="action" value="addVocabList">
<input type="hidden" name="userID" value="{{user}}">
<input type="text" name="listName" placeholder="list name" required>
</td>

@ -1,4 +1,5 @@
<table>
{{ userID }}
{% if groups is defined %}
{% for row in groups %}
{% if selectedGroup is defined and selectedGroup == row.id %}
@ -21,7 +22,7 @@
{% if 'showGroupDetails' in actions %}
<td>
<a href="showGroupDetails?selectedGroup={{ row.id }}">
<a href="{{base}}/admin/{{userID}}/showGroupDetails?selectedGroup={{ row.id }}">
<input class="btn-black" type="button" value="Show"/>
</a>
</td>
@ -29,7 +30,7 @@
{% if 'removeGroup' in actions %}
<td>
<a href="removeGroup?selectedGroup={{ row.id }}">
<a href="{{base}}/admin/{{userID}}/removeGroup?selectedGroup={{ row.id }}">
<input class="btn-black" type="button" value="Remove"/>
</a>
</td>

@ -28,7 +28,6 @@
<h2>Group list</h2>
{% include 'groupContainer.twig' with {'actions' : ['showGroupDetails', 'removeGroup']} %}
</section>
<section class="users">
<h2>Users of the group</h2>
{% include 'userContainer.twig' with {'users' : users, 'action' : 'removeUserFromGroup'} %}

@ -1,4 +1,4 @@
<form action="modifyPassword" method="GET">
<form action="{{base}}/user/modifyPassword" method="GET">
<input type="hidden" name="user" value={{user.id}}>
<input type="text" name="currentPassword" placeholder="current password" required>
<input type="text" name="newPassword" placeholder="new password" required>

@ -32,7 +32,7 @@
<tr><td>ID : </td><td>{{user.id}}</td></tr>
<tr><td>Nickname : </td><td>{{user.nickname}}</td>
<td>
<form action="modifyNickname" method="GET">
<form action="{{base}}/user/modifyNickname" method="GET">
<input type="hidden" name="user" value={{user.id}}>
<input name="newNickname" type="text" placeholder="new nickname" required>
<input type="submit" value="Modify your nickname">

@ -24,17 +24,17 @@
{% if action is defined %}
{% if action == 'removeUserFromGroup' %}
<td><a href="removeUserFromGroup?id={{row.id}}&selectedGroup={{selectedGroup}}">
<td><a href="{{base}}/admin/{{ userID }}/removeUserFromGroup?id={{row.id}}&selectedGroup={{selectedGroup}}">
<input class="btn-black" type="button" value="Delete from group"/>
</a></td>
{% elseif action == 'addUserToGroup' %}
<td><a href="addUserToGroup?userID={{row.id}}&groupID={{selectedGroup}}">
<td><a href="{{base}}/admin/{{ userID }}/addUserToGroup?userID={{row.id}}&groupID={{selectedGroup}}">
<input class="btn-black" type="button" value="Add to group"/>
</a></td>
{% elseif action == 'removeUser' %}
<td><a href="removeUser?userID={{row.id}}">
<td><a href="{{base}}/admin/{{ userID }}/removeUser?userID={{row.id}}">
<input class="btn-black" type="button" value="Delete"/>
</a></td>
{% endif %}

Loading…
Cancel
Save