Exemplo n.º 1
0
 protected function startup()
 {
     parent::startup();
     if ($this->session->hasSection('cms_localization')) {
         $localizationSection = $this->session->getSection('cms_localization');
         if ($localizationSection->locale !== null) {
             $this->locale = $localizationSection->locale;
         }
     }
 }
Exemplo n.º 2
0
 protected function createComponent($name)
 {
     $ucname = ucfirst($name);
     $method = 'createComponent' . $ucname;
     $presenterReflection = $this->getReflection();
     if ($presenterReflection->hasMethod($method)) {
         $methodReflection = $presenterReflection->getMethod($method);
         $this->checkRequirements($methodReflection);
         if ($methodReflection->hasAnnotation('Actions')) {
             $actions = explode(',', $methodReflection->getAnnotation('Actions'));
             foreach ($actions as $key => $action) {
                 $actions[$key] = trim($action);
             }
             if (!empty($actions) and !in_array($this->getAction(), $actions)) {
                 throw new ForbiddenRequestException("Creation of component '{$name}' is forbidden for action '{$this->action}'.");
             }
         }
     }
     return parent::createComponent($name);
 }