public static function init(){ self::$parameters = self::parse_url(); $controller_name = "\\" . \Dreamblaze\Helpers\Toolbox::to_camel_case(self::$parameters['controller'], true) . 'Controller'; $action = self::$parameters['action']; if(!class_exists($controller_name)) throw new RouteException("Controller $controller_name doesn't exist"); if(!method_exists($controller_name, $action)) throw new RouteException("Action '$action' on $controller_name doesn't exist"); Logger::debug("Executing $action on $controller_name", 'Router'); Logger::debug(self::$parameters, 'Router'); self::$action = $action; self::$controller = new $controller_name(); }
public function is_permitted_to($action,$controller){ if(strpos($controller,'Controller') === false) $controller = ucfirst(Toolbox::to_camel_case($controller . "_controller")); return Permissions::check_permission($controller, $action, $this->get_role()); }