1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-25 11:00:31 +02:00

Restructuration de la page d'inscription

This commit is contained in:
galaxyoyo
2019-09-07 15:51:16 +02:00
parent 25a31b7f40
commit b8dfe1a607
7 changed files with 291 additions and 247 deletions

View File

@ -0,0 +1,41 @@
<?php
class SchoolClass
{
const SECONDE = 0;
const PREMIERE = 1;
const TERMINALE = 2;
public static function getTranslatedName($class) {
switch ($class) {
case self::SECONDE:
return "Seconde ou inférieur";
case self::PREMIERE:
return "Première";
default:
return "Terminale";
}
}
public static function getName($class) {
switch ($class) {
case self::SECONDE:
return "SECONDE";
case self::PREMIERE:
return "PREMIERE";
default:
return "TERMINALE";
}
}
public static function fromName($name) {
switch ($name) {
case "SECONDE":
return self::SECONDE;
case "PREMIERE":
return self::PREMIERE;
default:
return self::TERMINALE;
}
}
}

View File

@ -74,7 +74,7 @@ class User
$this->country = $data["country"];
$this->phone_number = $data["phone_number"];
$this->school = $data["school"];
$this->class = $data["class"];
$this->class = SchoolClass::fromName($data["class"]);
$this->responsible_name = $data["responsible_name"];
$this->responsible_phone = $data["responsible_phone"];
$this->responsible_email = $data["responsible_email"];
@ -250,7 +250,7 @@ class User
{
global $DB;
$this->class = $class;
$DB->prepare("UPDATE `users` SET `class` = ? WHERE `id` = ?;")->execute([$class, $this->getId()]);
$DB->prepare("UPDATE `users` SET `class` = ? WHERE `id` = ?;")->execute([SchoolClass::getName($class), $this->getId()]);
}
public function getResponsibleName()