diff --git a/server_files/classes/User.php b/server_files/classes/User.php index 8e51187..3cf143c 100644 --- a/server_files/classes/User.php +++ b/server_files/classes/User.php @@ -8,6 +8,8 @@ class User public $surname; public $first_name; public $school; + public $city; + public $country; public $class; public $description; private $role; @@ -88,6 +90,8 @@ class User $this->surname = $data["surname"]; $this->first_name = $data["first_name"]; $this->school = $data["school"]; + $this->city = $data["city"]; + $this->country = $data["country"]; $this->class = SchoolClass::fromName($data["class"]); $this->description = $data["description"]; $this->role = Role::fromName($data["role"]); @@ -157,17 +161,41 @@ class User $DB->prepare("UPDATE `users` SET `first_name` = ? WHERE `id` = ?;")->execute([$first_name, $this->getId()]); } - public function getSchool() - { - return $this->school; - } + public function getSchool() + { + return $this->school; + } - public function setSchool($school) - { - global $DB; - $this->school = $school; - $DB->prepare("UPDATE `users` SET `school` = ? WHERE `id` = ?;")->execute([$school, $this->getId()]); - } + public function setSchool($school) + { + global $DB; + $this->school = $school; + $DB->prepare("UPDATE `users` SET `school` = ? WHERE `id` = ?;")->execute([$school, $this->getId()]); + } + + public function getCity() + { + return $this->city; + } + + public function setCity($city) + { + global $DB; + $this->city = $city; + $DB->prepare("UPDATE `users` SET `city` = ? WHERE `id` = ?;")->execute([$city, $this->getId()]); + } + + public function getCountry() + { + return $this->country; + } + + public function setCountry($country) + { + global $DB; + $this->country = $country; + $DB->prepare("UPDATE `users` SET `country` = ? WHERE `id` = ?;")->execute([$country, $this->getId()]); + } public function getClass() { diff --git a/server_files/controllers/ajouter_equipe.php b/server_files/controllers/ajouter_equipe.php index cf89f08..8ef688a 100644 --- a/server_files/controllers/ajouter_equipe.php +++ b/server_files/controllers/ajouter_equipe.php @@ -22,6 +22,7 @@ class NewTeam { public $name; public $trigram; public $problem; + public $allow_other_teams; public $allow_publish; public $access_code; @@ -32,6 +33,7 @@ class NewTeam { $this->trigram = strtoupper($this->trigram); + $this->allow_other_teams = $this->allow_other_teams == "on" ? 1 : 0; $this->allow_publish = $this->allow_publish == "on" ? 1 : 0; } @@ -41,11 +43,12 @@ class NewTeam { ensure(date("Y-m-d H:i:s") < $CONFIG->getInscriptionDate(), "La date limite d'inscription est dépassée."); ensure($_SESSION["team"] == null, "Vous êtes déjà dans une équipe."); ensure($this->name != null && $this->name != "", "Vous devez spécifier un nom d'équipe."); - ensure(preg_match("#^[\p{L} ]+$#ui", $this->name), "Le nom de l'équipe ne doit pas comporter de caractères spéciaux."); + ensure(preg_match("#^[\p{L} \d]+$#ui", $this->name), "Le nom de l'équipe ne doit pas comporter de caractères spéciaux."); ensure(preg_match("#^[A-Z]{3}$#", $this->trigram), "Le trigramme entré n'est pas valide."); ensure(!teamExists($this->name), "Une équipe existe déjà avec ce nom."); ensure(!trigramExists($this->trigram), "Une équipe a déjà choisi ce trigramme."); ensure(preg_match("#[0-4]#", $this->problem), "Le problème choisi n'a pas été reconnu."); + ensure($this->allow_other_teams, "Vous devez autoriser de diffuser vos vidéos aux autres équipes participantes pour pouvoir participer."); } public function register() { diff --git a/server_files/controllers/inscription.php b/server_files/controllers/inscription.php index a0c5bb3..c74d40f 100644 --- a/server_files/controllers/inscription.php +++ b/server_files/controllers/inscription.php @@ -22,6 +22,8 @@ class NewUser public $surname; public $role; public $school; + public $city; + public $country; public $class; public $receive_animath_mails; @@ -66,10 +68,12 @@ class NewUser if (!$DB->query("SELECT `id` FROM `users` WHERE `year` = $YEAR;")->fetch()) $this->role = Role::ADMIN; - $req = $DB->prepare("INSERT INTO `users`(`email`, `pwd_hash`, `confirm_email`, `surname`, `first_name`, `school`, `class`, `role`, `description`, `receive_animath_mails`, `year`) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"); - $req->execute([$this->email, password_hash($this->password, PASSWORD_BCRYPT), $this->confirm_email_token, $this->surname, $this->first_name, - $this->school, SchoolClass::getName($this->class), Role::getName($this->role), $this->description, $this->receive_animath_mails, $YEAR]); + $req = $DB->prepare("INSERT INTO `users`(`email`, `pwd_hash`, `confirm_email`, `surname`, `first_name`, + `school`, `city`, `country`, `class`, `role`, `description`, `receive_animath_mails`, `year`) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"); + $req->execute([$this->email, password_hash($this->password, PASSWORD_BCRYPT), $this->confirm_email_token, + $this->surname, $this->first_name, $this->school, $this->city, $this->country, SchoolClass::getName($this->class), + Role::getName($this->role), $this->description, $this->receive_animath_mails, $YEAR]); Mailer::sendRegisterMail($this); } diff --git a/server_files/controllers/mon_compte.php b/server_files/controllers/mon_compte.php index 13c5326..7e68a5c 100644 --- a/server_files/controllers/mon_compte.php +++ b/server_files/controllers/mon_compte.php @@ -52,6 +52,8 @@ class MyAccount public $surname; public $first_name; public $school; + public $city; + public $country; public $class; public $description; public $receive_animath_mails; @@ -89,6 +91,8 @@ class MyAccount $this->user->setSurname($this->surname); $this->user->setFirstName($this->first_name); $this->user->setSchool($this->school); + $this->user->setCity($this->city); + $this->user->setCountry($this->country); $this->user->setClass($this->class); $this->user->setDescription($this->description); $this->user->setReceiveAnimathMails($this->receive_animath_mails); diff --git a/server_files/controllers/mon_equipe.php b/server_files/controllers/mon_equipe.php index 99d4e06..75b510d 100644 --- a/server_files/controllers/mon_equipe.php +++ b/server_files/controllers/mon_equipe.php @@ -78,7 +78,7 @@ class MyTeam ensure($this->name != "" && $this->name != null, "Veuillez spécifier un nom d'équipe."); ensure($this->name == $this->team->getName() || !teamExists($this->name), "Une équipe existe déjà avec ce nom."); - ensure(preg_match("#^[\p{L} ]+$#ui", $this->name), "Le nom de l'équipe ne doit pas comporter de caractères spéciaux."); + ensure(preg_match("#^[\p{L} \d]+$#ui", $this->name), "Le nom de l'équipe ne doit pas comporter de caractères spéciaux."); ensure(preg_match("#^[A-Z]{3}$#", $this->trigram), "Le trigramme n'est pas valide."); ensure($this->trigram == $this->team->getTrigram() || !trigramExists($this->trigram), "Une équipe a déjà choisi ce trigramme."); ensure(preg_match("#^[0-4]$#", $this->problem), "Le problème indiqué n'existe pas."); diff --git a/server_files/views/ajouter_equipe.php b/server_files/views/ajouter_equipe.php index 97f83fd..e48c913 100644 --- a/server_files/views/ajouter_equipe.php +++ b/server_files/views/ajouter_equipe.php @@ -29,7 +29,7 @@ require_once "header.php";
- +
@@ -46,9 +46,17 @@ require_once "header.php"; + + allow_other_teams ? "checked" : "" ?> required/>
+ allow_publish ? "checked" : "" ?> /> + allow_publish ? "checked" : "" ?> /> + +
+ Cette dernière option est modifiable à tout moment, et permet à Animath de diffuser les vidéos primées. +
diff --git a/server_files/views/calendrier.php b/server_files/views/calendrier.php index 7fa6352..4351de8 100644 --- a/server_files/views/calendrier.php +++ b/server_files/views/calendrier.php @@ -90,40 +90,49 @@
"> - : + : getInscriptionDate(), true) ?>
"> - : + : Du getStartPhase1Date(), true) ?> au getEndPhase1Date(), true) ?>
"> - : + : Du getStartPhase2Date(), true) ?> au getEndPhase2Date(), true) ?>
"> - : + : Du getStartPhase3Date(), true) ?> au getEndPhase3Date(), true) ?>
"> - : + : Du getStartPhase4Date(), true) ?> au getEndPhase4Date(), true) ?>
- + - + - + +
+ + + + + +Problème 2 + diff --git a/server_files/views/informations.php b/server_files/views/informations.php index 4fe3ad0..af31d67 100644 --- a/server_files/views/informations.php +++ b/server_files/views/informations.php @@ -66,11 +66,13 @@ if (!$has_error) { getRole() == Role::PARTICIPANT) { ?>
Lycée : getSchool() ?>
+ Ville : getCity() ?>
+ Payer : getCountry() ?>
Classe : getClass()) ?>
getDescription() != "") { ?>
- Description : getDescription() ?> + Activité professionnelle : getDescription() ?>
diff --git a/server_files/views/inscription.php b/server_files/views/inscription.php index f5daaf6..78cd4b6 100644 --- a/server_files/views/inscription.php +++ b/server_files/views/inscription.php @@ -11,7 +11,7 @@ require_once "header.php"; if (isset($user) && !$has_error) { ?>
- Votre inscription est validée ! Merci désormais de confirmer votre boîte mail pour valider votre adresse. + Vous êtes bien inscrit ! Merci désormais de confirmer votre boîte mail pour valider votre adresse.
@@ -46,16 +46,18 @@ if (isset($user) && !$has_error) {
+
+ L'adresse mail sert uniquement à recevoir les informations de déroulement des Correspondances. +
+
+ value="email ?>" required/>
-
@@ -73,6 +75,18 @@ if (isset($user) && !$has_error) {
+
+ + +
+
+
+
+ + "/> +
- + receive_animath_mails ? "checked" : "" ?> />

@@ -107,6 +122,10 @@ if (isset($user) && !$has_error) { document.getElementById("school").style.display = "block"; document.getElementById("class_label").style.display = "block"; document.getElementById("class").style.display = "block"; + document.getElementById("city_label").style.display = "block"; + document.getElementById("city").style.display = "block"; + document.getElementById("country_label").style.display = "block"; + document.getElementById("country").style.display = "block"; document.getElementById("description_label").style.display = "none"; document.getElementById("description").style.display = "none"; break; @@ -115,6 +134,10 @@ if (isset($user) && !$has_error) { document.getElementById("school").style.display = "none"; document.getElementById("class_label").style.display = "none"; document.getElementById("class").style.display = "none"; + document.getElementById("city_label").style.display = "none"; + document.getElementById("city").style.display = "none"; + document.getElementById("country_label").style.display = "none"; + document.getElementById("country").style.display = "none"; document.getElementById("description_label").style.display = "block"; document.getElementById("description").style.display = "block"; break; diff --git a/server_files/views/mon_compte.php b/server_files/views/mon_compte.php index eb0eabf..7e018d1 100644 --- a/server_files/views/mon_compte.php +++ b/server_files/views/mon_compte.php @@ -45,9 +45,12 @@ if (!$has_error && (isset($my_account) || isset($new_password))) {
- - doReceiveAnimathMails() ? "checked" : "" ?> /> + getRole() == Role::PARTICIPANT || $user->getRole() == Role::ENCADRANT) { ?> + + doReceiveAnimathMails() ? "checked" : "" ?> /> + getRole() == Role::PARTICIPANT) { ?>
@@ -56,7 +59,19 @@ if (!$has_error && (isset($my_account) || isset($new_password))) {
+
+ + +
+ +
+
+ + "/> +
@@ -113,7 +128,7 @@ if (!$has_error && (isset($my_account) || isset($new_password))) {
-getValidationStatus() == ValidationStatus::NOT_READY) { ?> +getValidationStatus() == ValidationStatus::NOT_READY) { ?>

Autorisation de droit à l'image

diff --git a/server_files/views/mon_equipe.php b/server_files/views/mon_equipe.php index b79d977..28dff68 100644 --- a/server_files/views/mon_equipe.php +++ b/server_files/views/mon_equipe.php @@ -52,8 +52,8 @@ require_once "header.php";
- Autorise Animath à diffuser mes vidéos : allowPublish() ? "oui" : "non" ?> (changer) + Autorise Animath à diffuser mes vidéos à la fin du tournoi : + allowPublish() ? "oui" : "non" ?> (changer)
= $CONFIG->getInscriptionDate() && $team->getValidationStatus() == ValidationStatus::NOT_READY) { ?> diff --git a/server_files/views/probleme.php b/server_files/views/probleme.php index fe5dbd4..cc18100 100644 --- a/server_files/views/probleme.php +++ b/server_files/views/probleme.php @@ -1,12 +1,14 @@
-

Problème

+

+ +


-

Équipes inscrites pour ce problème :

+

Équipes inscrites 0 ? "pour ce problème" : "sans problème choisi" ?> :