1
0
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:
Yohann D'ANELLO
2019-12-26 22:30:42 +01:00
parent e9f10ca14f
commit da8efde057
16 changed files with 363 additions and 32 deletions

View File

@ -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;
}
}

View File

@ -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()
{