mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-25 11:00:31 +02:00
Ajouts & correction de bugs
This commit is contained in:
@ -182,4 +182,20 @@ class Team
|
||||
{
|
||||
return $this->year;
|
||||
}
|
||||
|
||||
public static function getAllTeams($only_not_validated = false)
|
||||
{
|
||||
global $DB, $YEAR;
|
||||
$req = $DB->query("SELECT * FROM `teams` WHERE " . ($only_not_validated ? "`validation_status` = 'NOT_READY' AND " : "") . "`year` = $YEAR;");
|
||||
|
||||
$teams = [];
|
||||
|
||||
while (($data = $req->fetch()) != false) {
|
||||
$team = new Team();
|
||||
$team->fill($data);
|
||||
$teams[] = $team;
|
||||
}
|
||||
|
||||
return $teams;
|
||||
}
|
||||
}
|
||||
|
@ -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