mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-26 06:37:38 +02:00
Ajouts & correction de bugs
This commit is contained in:
@ -86,6 +86,52 @@ class User
|
||||
$this->forgotten_password = $data["forgotten_password"];
|
||||
$this->inscription_date = $data["inscription_date"];
|
||||
}
|
||||
public static function getOrganizers()
|
||||
{
|
||||
global $DB, $YEAR;
|
||||
$admins = [];
|
||||
$req = $DB->query("SELECT * FROM `users` WHERE `role` = 'ORGANIZER' OR `role` = 'ADMIN' AND `year` = $YEAR;");
|
||||
|
||||
while (($data = $req->fetch()) !== false) {
|
||||
$admin = new User();
|
||||
$admin->fill($data);
|
||||
$admins[] = $admin;
|
||||
}
|
||||
|
||||
return $admins;
|
||||
}
|
||||
|
||||
public static function getAllUsers()
|
||||
{
|
||||
global $DB, $YEAR;
|
||||
$users = [];
|
||||
$req = $DB->query("SELECT * FROM `users` WHERE (`role` = 'PARTICIPANT' OR `role` = 'ENCADRANT') "
|
||||
. "AND `year` = $YEAR ORDER BY `role`, `inscription_date`;");
|
||||
|
||||
while (($data = $req->fetch()) !== false) {
|
||||
$orphan = new User();
|
||||
$orphan->fill($data);
|
||||
$users[] = $orphan;
|
||||
}
|
||||
|
||||
return $users;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public function getEmail()
|
||||
{
|
||||
|
Reference in New Issue
Block a user