plateforme-tfjm2/server_files/classes/Role.php

38 lines
877 B
PHP
Raw Normal View History

<?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;
}
}
}