mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2025-06-24 19:40:28 +02:00
Flexibilité sur la validation des vidéos accrue
This commit is contained in:
@ -16,6 +16,7 @@ class User
|
||||
private $confirm_email;
|
||||
private $forgotten_password;
|
||||
private $inscription_date;
|
||||
private $receive_animath_mails;
|
||||
|
||||
private function __construct() {}
|
||||
|
||||
@ -48,6 +49,21 @@ class User
|
||||
$user->fill($data);
|
||||
return $user;
|
||||
}
|
||||
|
||||
public static function getAdmins()
|
||||
{
|
||||
global $DB, $YEAR;
|
||||
$admins = [];
|
||||
$req = $DB->query("SELECT * FROM `users` WHERE `year` = $YEAR;");
|
||||
|
||||
while (($data = $req->fetch()) !== false) {
|
||||
$admin = new User();
|
||||
$admin->fill($data);
|
||||
$admins[] = $admin;
|
||||
}
|
||||
|
||||
return $admins;
|
||||
}
|
||||
|
||||
private function fill($data)
|
||||
{
|
||||
@ -65,6 +81,7 @@ class User
|
||||
$this->confirm_email = $data["confirm_email"];
|
||||
$this->forgotten_password = $data["forgotten_password"];
|
||||
$this->inscription_date = $data["inscription_date"];
|
||||
$this->receive_animath_mails = $data["receive_animath_mails"];
|
||||
}
|
||||
|
||||
public function getEmail()
|
||||
@ -170,7 +187,6 @@ class User
|
||||
{
|
||||
global $DB;
|
||||
$this->role = $role;
|
||||
/** @noinspection PhpUndefinedMethodInspection */
|
||||
$DB->prepare("UPDATE `users` SET `role` = ? WHERE `id` = ?;")->execute([Role::getName($role), $this->getId()]);
|
||||
}
|
||||
|
||||
@ -215,6 +231,18 @@ class User
|
||||
return $this->inscription_date;
|
||||
}
|
||||
|
||||
public function doReceiveAnimathMails()
|
||||
{
|
||||
return $this->receive_animath_mails;
|
||||
}
|
||||
|
||||
public function setReceiveAnimathMails($receive_animath_mails)
|
||||
{
|
||||
global $DB;
|
||||
$this->receive_animath_mails = $receive_animath_mails;
|
||||
$DB->prepare("UPDATE `users` SET `receive_animath_mails` = ? WHERE `id` = ?;")->execute([$receive_animath_mails, $this->getId()]);
|
||||
}
|
||||
|
||||
public function getAllDocuments($problem)
|
||||
{
|
||||
global $DB;
|
||||
|
Reference in New Issue
Block a user