1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2024-12-25 07:02:22 +00:00

Minor fixes

This commit is contained in:
Yohann D'ANELLO 2020-02-21 23:26:47 +01:00
parent 88dcb68aa8
commit 45426e6835
7 changed files with 14 additions and 7 deletions

View File

@ -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":

View File

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

View File

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

View File

@ -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.");

View File

@ -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">

View File

@ -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"

View File

@ -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"