1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2024-12-27 05:02:23 +00:00
plateforme-tfjm2/server_files/classes/Role.php
2019-09-06 13:48:50 +02:00

38 lines
877 B
PHP

<?php
class Role extends SplEnum
{
const __default = self::PARTICIPANT;
const PARTICIPANT = 0;
const ENCADRANT = 1;
const ORGANIZER = 2;
const ADMIN = 3;
public function getName() {
switch ($this) {
case self::ENCADRANT:
return "Encadrant";
case self::ORGANIZER:
return "Organisateur";
case self::ADMIN:
return "Administrateur";
default:
return "Participant";
}
}
public static function fromName($name) {
switch ($name) {
case "ENCADRANT":
return self::ENCADRANT;
case "ORGANIZER":
return self::ORGANIZER;
case "ADMIN":
return self::ADMIN;
default:
return self::PARTICIPANT;
}
}
}