mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2024-12-27 05:42:24 +00:00
38 lines
877 B
PHP
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;
|
||
|
}
|
||
|
}
|
||
|
}
|