plateforme-corres2math/server_files/classes/Role.php

41 lines
787 B
PHP

<?php
class Role
{
const PARTICIPANT = 0;
const ENCADRANT = 1;
const ADMIN = 2;
public static function getTranslatedName($role) {
switch ($role) {
case self::ENCADRANT:
return "Encadrant";
case self::ADMIN:
return "Administrateur";
default:
return "Participant";
}
}
public static function getName($role) {
switch ($role) {
case self::ENCADRANT:
return "ENCADRANT";
case self::ADMIN:
return "ADMIN";
default:
return "PARTICIPANT";
}
}
public static function fromName($name) {
switch ($name) {
case "ENCADRANT":
return self::ENCADRANT;
case "ADMIN":
return self::ADMIN;
default:
return self::PARTICIPANT;
}
}
}