blob: 7a80e8b38d698902db291545d625a933b09210e3 [file] [log] [blame]
<?php
namespace Synergy\Model;
use Synergy\App\Synergy;
/**
* Description of Platform
*
* @author vriha
*/
class Platform {
public $id;
public $name;
public $isActive;
function __construct($id, $name, $isActive=1) {
$this->id = intval($id);
$this->isActive = intval($isActive);
$this->name = $name;
}
function addControls($role) {
$this->controls = array();
switch ($role) {
case "admin":
case "manager":
array_push($this->controls, new Action("Edit", "edit", "icon-pencil"));
array_push($this->controls, new Action("Delete", "delete", "icon-trash"));
break;
default:
break;
}
}
public static function canEdit() {
$role = Synergy::getSessionProvider()->getUserRole();
switch ($role) {
case "manager" :
case "admin" :
return true;
default :
return false;
}
}
public static function canDelete() {
$role = Synergy::getSessionProvider()->getUserRole();
switch ($role) {
case "manager" :
case "admin" :
return true;
default :
return false;
}
}
public static function canCreate() {
$role = Synergy::getSessionProvider()->getUserRole();
switch ($role) {
case "manager" :
case "admin" :
return true;
default :
return false;
}
}
}
?>