Minor fixes
This commit is contained in:
parent
88dcb68aa8
commit
45426e6835
|
@ -2,6 +2,7 @@
|
|||
|
||||
class Role
|
||||
{
|
||||
const OBSERVER = -1;
|
||||
const PARTICIPANT = 0;
|
||||
const ENCADRANT = 1;
|
||||
const ORGANIZER = 2;
|
||||
|
@ -9,6 +10,8 @@ class Role
|
|||
|
||||
public static function getTranslatedName($role) {
|
||||
switch ($role) {
|
||||
case self::OBSERVER:
|
||||
return "Observateur";
|
||||
case self::ENCADRANT:
|
||||
return "Encadrant";
|
||||
case self::ORGANIZER:
|
||||
|
@ -22,6 +25,8 @@ class Role
|
|||
|
||||
public static function getName($role) {
|
||||
switch ($role) {
|
||||
case self::OBSERVER:
|
||||
return "OBSERVER";
|
||||
case self::ENCADRANT:
|
||||
return "ENCADRANT";
|
||||
case self::ORGANIZER:
|
||||
|
@ -35,6 +40,8 @@ class Role
|
|||
|
||||
public static function fromName($name) {
|
||||
switch ($name) {
|
||||
case "OBSERVER":
|
||||
return self::OBSERVER;
|
||||
case "ENCADRANT":
|
||||
return self::ENCADRANT;
|
||||
case "ORGANIZER":
|
||||
|
|
|
@ -90,7 +90,7 @@ class User
|
|||
{
|
||||
global $DB, $YEAR;
|
||||
$admins = [];
|
||||
$req = $DB->query("SELECT * FROM `users` WHERE `role` = 'ORGANIZER' OR `role` = 'ADMIN' AND `year` = $YEAR ORDER BY `role`, `surname`, `first_name`;");
|
||||
$req = $DB->query("SELECT * FROM `users` WHERE `role` = 'ORGANIZER' OR `role` = 'ADMIN' AND `year` = $YEAR ORDER BY `role` DESC, `surname`, `first_name`;");
|
||||
|
||||
while (($data = $req->fetch()) !== false) {
|
||||
$admin = new User();
|
||||
|
|
|
@ -57,7 +57,7 @@ class NewUser
|
|||
ensure($this->first_name != "", "Le prénom est obligatoire.");
|
||||
ensure(dateWellFormed($this->birth_date), "La date de naissance est invalide.");
|
||||
ensure($this->birth_date < $YEAR . "-01-01", "Vous devez être né.");
|
||||
ensure($this->gender == "M" || $this->gender == "F", "Le sexe indiqué est invalide.");
|
||||
ensure($this->gender == "M" || $this->gender == "F", "Merci de spécifier un genre.");
|
||||
ensure(preg_match("#^[0-9]{4}[0-9]?$#", $this->postal_code) && intval($this->postal_code) >= 01000 && intval($this->postal_code) <= 95999, "Le code postal est invalide.");
|
||||
if ($this->country == "")
|
||||
$this->country = "France";
|
||||
|
|
|
@ -101,7 +101,7 @@ class MyAccount
|
|||
ensure($this->email == $this->user->getEmail() || !userExists($this->email), "Un compte existe déjà avec cette adresse e-mail.");
|
||||
ensure(dateWellFormed($this->birth_date), "La date de naissance est invalide.");
|
||||
ensure($this->birth_date < $YEAR . "-01-01", "Vous devez être né.");
|
||||
ensure($this->gender == "M" || $this->gender == "F", "Le sexe indiqué est invalide.");
|
||||
ensure($this->gender == "M" || $this->gender == "F", "Merci de spécifier un genre.");
|
||||
ensure(preg_match("#^[0-9]{4}[0-9]?$#", $this->postal_code) && intval($this->postal_code) >= 01000 && intval($this->postal_code) <= 95999, "Le code postal est invalide.");
|
||||
ensure(strlen($this->phone_number) >= 10, "Le numéro de téléphone est invalide.");
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ if ($user->getRole() == Role::PARTICIPANT || $user->getRole() == Role::ENCADRANT
|
|||
</div>
|
||||
|
||||
<div class="alert alert-info">
|
||||
<strong>Sexe :</strong> <?= $user->getGender() == "M" ? "Masculin" : "Féminin" ?><br />
|
||||
<strong>Genre :</strong> <?= $user->getGender() == "M" ? "Masculin" : "Féminin" ?><br />
|
||||
</div>
|
||||
|
||||
<div class="alert alert-info">
|
||||
|
@ -93,7 +93,7 @@ if ($user->getRole() == Role::PARTICIPANT || $user->getRole() == Role::ENCADRANT
|
|||
<?php if ($user->getRole() == Role::PARTICIPANT) { ?>
|
||||
<div class="alert alert-info">
|
||||
Lycée : <?= $user->getSchool() ?><br />
|
||||
Classe : <?php SchoolClass::getTranslatedName($user->getClass()) ?>
|
||||
Classe : <?= SchoolClass::getTranslatedName($user->getClass()) ?>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-info">
|
||||
|
|
|
@ -72,7 +72,7 @@ if (isset($user) && !$has_error) {
|
|||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="gender" class="mr-2">Sexe :</label>
|
||||
<label for="gender" class="mr-2">Genre :</label>
|
||||
<br/>
|
||||
<div class="custom-control custom-radio custom-control-inline">
|
||||
<input type="radio" class="custom-control-input" id="male" name="gender" value="M"
|
||||
|
|
|
@ -61,7 +61,7 @@ if (!$has_error && (isset($my_account) || isset($new_password))) {
|
|||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="gender" class="mr-2">Sexe :</label>
|
||||
<label for="gender" class="mr-2">Genre :</label>
|
||||
<br/>
|
||||
<div class="custom-control custom-radio custom-control-inline">
|
||||
<input type="radio" class="custom-control-input" id="male" name="gender" value="M"
|
||||
|
|
Loading…
Reference in New Issue