1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-01-05 23:42:21 +00:00

Page comptes orphelins & menu déroulant

This commit is contained in:
galaxyoyo 2019-09-28 01:14:08 +02:00
parent 7ad974c304
commit 81bb33cc8e
6 changed files with 113 additions and 16 deletions

View File

@ -6,3 +6,20 @@
height: var(--navbar-height);
display: block;
}
ul .deroule {
display: none;
position: absolute;
background: #f8f9fa !important;
list-style-type: none;
padding: 20px;
z-index: 42;
}
li:hover ul.deroule {
display:block;
}
a.nav-link:hover {
background-color: #d8d9da;
}

View File

@ -51,6 +51,7 @@ $ROUTES["^mon-equipe/?$"] = ["server_files/controllers/mon_equipe.php"];
$ROUTES["^mon-tournoi/?$"] = ["server_files/controllers/mon_tournoi.php"];
$ROUTES["^poser-questions-2$"] = ["server_files/controllers/poser_questions.php"];
$ROUTES["^probleme/([1-4])/?$"] = ["server_files/controllers/probleme.php", "probleme"];
$ROUTES["^profils-orphelins/?$"] = ["server_files/controllers/profils_orphelins.php"];
$ROUTES["^rejoindre-equipe/?$"] = ["server_files/controllers/rejoindre_equipe.php"];
$ROUTES["^repondre-questions-3$"] = ["server_files/controllers/repondre_questions.php"];
$ROUTES["^videos-solutions/?$"] = ["server_files/controllers/videos_solutions.php"];

View File

@ -64,6 +64,21 @@ class User
return $admins;
}
public static function getOrphanUsers()
{
global $DB, $YEAR;
$orphans = [];
$req = $DB->query("SELECT * FROM `users` WHERE `role` != 'ADMIN' AND `team_id` IS NULL AND `year` = $YEAR ORDER BY `role`, `inscription_date`;");
while (($data = $req->fetch()) !== false) {
$orphan = new User();
$orphan->fill($data);
$orphans[] = $orphan;
}
return $orphans;
}
private function fill($data)
{

View File

@ -0,0 +1,8 @@
<?php
if (!isset($_SESSION["user_id"]) || $_SESSION["role"] != Role::ADMIN)
require_once "server_files/403.php";
$orphan_users = User::getOrphanUsers();
require_once "server_files/views/profils_orphelins.php";

View File

@ -10,14 +10,6 @@
<!-- Bootstrap -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<style>
ul .deroule {
display: none;
}
li:hover ul.deroule {display:block;}
</style>
</head>
<body>
@ -79,17 +71,18 @@
<?php } ?>
<?php } ?>
<?php if ($_SESSION["role"] == Role::ADMIN) { ?>
<li>
Liste des problèmes
<li class="nav-item active">
<a class="nav-link">Liste des équipes</a>
<ul class="deroule">
<li><a href="/probleme/1">Problème 1</a></li>
<li><a href="/probleme/2">Problème 2</a></li>
<li><a href="/probleme/3">Problème 3</a></li>
<li><a href="/probleme/4">Problème 4</a></li>
<li class="nav-item active"><a class="nav-link" href="/probleme/1">Problème 1</a></li>
<li class="nav-item active"><a class="nav-link" href="/probleme/2">Problème 2</a></li>
<li class="nav-item active"><a class="nav-link" href="/probleme/3">Problème 3</a></li>
<li class="nav-item active"><a class="nav-link" href="/probleme/4">Problème 4</a></li>
<li class="nav-item active"><a class="nav-link" href="/profils-orphelins">Profils orphelins</a></li>
</ul>
</li>
<li class="nav-item active"><a class="nav-link" href="/ajouter-admin">
Ajouter un administrateur</a>
<li class="nav-item active">
<a class="nav-link" href="/ajouter-admin">Ajouter un administrateur</a>
</li>
<li class="nav-item active">
<a class="nav-link" href="/videos-solutions">Vidéos des solutions</a>

View File

@ -0,0 +1,63 @@
<?php
require_once "header.php";
?>
<div class="mt-4 mb-4">
<h2 class="display-3">Profils orphelins</h2>
</div>
<div>
Cette page recense tous les utilisateurs inscrits mais qui n'ont pas rejoint d'équipe.
</div>
<br />
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th scope="col">
Nom
</th>
<th scope="col">
Rôle
</th>
<th scope="col">
Inscrit le
</th>
</tr>
</thead>
<tbody>
<?php
/** @var User $user */
foreach ($orphan_users as $user) {
?>
<tr>
<th scope="row">
<a href="/informations/<?= $user->getId() . "/" . $user->getFirstName() . " " . $user->getSurname() ?>">
<?= $user->getFirstName() . " " . $user->getSurname() ?>
</a>
</th>
<td><?= Role::getTranslatedName($user->getRole()) ?></td>
<td><?= formatDate($user->getInscriptionDate(), true) ?></td>
</tr>
<?php
}
?>
</tbody>
<tfoot>
<tr>
<th scope="col">
Nom
</th>
<th scope="col">
Rôle
</th>
<th scope="col">
Inscrit le
</th>
</tr>
</tfoot>
</table>
<?php
require_once "footer.php";