/** * Instantiates the ACL * @param \Lyra\Interfaces\Container $container */ public function __construct(\Lyra\Interfaces\Container &$container) { $this->container = $container; \Profiler::setTime('ACL::constructor'); // is the player logged in? $sessionModel = \App::getModel('Session'); \Profiler::setTime('ACL::_construct SessionModel loaded'); $playerModel = \App::getModel('Player'); \Profiler::setTime('ACL::_construct playerModel loaded'); if ($sessionModel->isLoggedIn()) { $this->setPlayer($playerModel->find($sessionModel->getPlayerId())); \Profiler::setTime('ACL::_construct setPlayer to Loggedin'); } else { $this->setPlayer($playerModel->findGuest()); \Profiler::setTime('ACL::_construct setPlayer as Guest'); } // lookup in cache for roles if (\Config::get('cache.use') === true && isset($container['cache']['acl_player_' . $this->player['player_id'] . '_roles'])) { $roles = \Cache::get('acl_player_' . $this->player['player_id'] . '_roles'); \Profiler::setTime('ACL::_construct CacheUse is true, set roles'); } else { $roles = \App::getModel('PlayerRole')->findAllForPlayer($this->player['player_id']); \Profiler::setTime('ACL::_construct CacheUse is false, set roles'); if (\Config::get('cache.use') === true) { $container['cache']['acl_player_' . $this->player['player_id'] . '_roles'] = $roles; } } $this->addRoles($roles); \Profiler::setTime('ACL::_construct addRoles'); $container['acl'] = $this; }
public function __construct(\Lyra\Interfaces\Container $container) { $this->container = $container; $container['view'] = $this; $this->data = array(); $this->registerHelpers(); $this->loadData(); $this->modPath = 'modules/'; $this->themePath = 'themes/'; //Always set by default $this->theme = \Config::get('site.theme'); //Load from Config $this->adminTheme = \Config::get('site.adminTheme'); }
/** * Get a configuration value * @param string $variable * @return mixed */ public function getConfig() { return \Config::getAll(); }