2019-09-05 17:07:59 +00:00
|
|
|
<?php
|
|
|
|
|
2019-09-06 23:33:05 +00:00
|
|
|
class Role
|
2019-09-05 17:07:59 +00:00
|
|
|
{
|
|
|
|
const PARTICIPANT = 0;
|
|
|
|
const ENCADRANT = 1;
|
|
|
|
const ORGANIZER = 2;
|
|
|
|
const ADMIN = 3;
|
|
|
|
|
2019-09-06 23:33:05 +00:00
|
|
|
public static function getTranslatedName($role) {
|
|
|
|
switch ($role) {
|
|
|
|
case self::ENCADRANT:
|
|
|
|
return "Encadrant";
|
|
|
|
case self::ORGANIZER:
|
|
|
|
return "Organisateur";
|
|
|
|
case self::ADMIN:
|
|
|
|
return "Administrateur";
|
|
|
|
default:
|
|
|
|
return "Participant";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function getName($role) {
|
|
|
|
switch ($role) {
|
|
|
|
case self::ENCADRANT:
|
|
|
|
return "ENCADRANT";
|
|
|
|
case self::ORGANIZER:
|
|
|
|
return "ORGANIZER";
|
|
|
|
case self::ADMIN:
|
|
|
|
return "ADMIN";
|
|
|
|
default:
|
|
|
|
return "PARTICIPANT";
|
|
|
|
}
|
|
|
|
}
|
2019-09-05 17:07:59 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|