示例#1
0
 protected function attached($presenter)
 {
     parent::attached($presenter);
     if (!$presenter instanceof Presenter) {
         return;
     }
     //připojen presenter
     if (!isset($presenter->page)) {
         throw new InvalidStateException('MetaControl attached to uncompatible Presenter');
     }
     $this->page = $presenter->page;
 }
示例#2
0
 protected function attached($presenter)
 {
     parent::attached($presenter);
     if (!$presenter instanceof Presenter) {
         return;
     }
     //připojen presenter
     if (!isset($presenter->page)) {
         throw new InvalidStateException('ShopControl attached to uncompatible Presenter');
     }
     $this->page = $presenter->page;
     $this->template->page = $presenter->page;
     $this->template->lang = $presenter->lang;
     $this->template->setTranslator(new TranslationsModel($presenter->lang));
 }
示例#3
0
 protected function attached($presenter)
 {
     parent::attached($presenter);
     if (!$presenter instanceof Presenter) {
         return;
     }
     //připojen presenter
     if (!isset($presenter->page)) {
         throw new InvalidStateException('FieldsPlugin attached to uncompatible Presenter');
     }
     $this->page = $presenter->page;
     $this->template->page = $presenter->page;
     $this->template->lang = $presenter->lang;
     $this->template->setTranslator(new TranslationsModel($presenter->lang));
     //parse fields
     $json = $this->page->getParent()->getMeta('.sectionFields');
     $sectionFields = array();
     try {
         if ($json) {
             $sectionFields = Neon::decode($json);
         }
     } catch (Exception $e) {
         $m = htmlspecialchars($e->getMessage());
         $this->error .= "<div class='control-group' title=\"{$m}\">.sectionFields not valid</div>";
     }
     $fields = array();
     $json = $this->page->getMeta('.fields');
     try {
         if ($json) {
             $fields = Neon::decode($json);
         }
     } catch (Exception $e) {
         $m = htmlspecialchars($e->getMessage() . "\"");
         $this->error .= "<div class='control-group' title=\"{$m}\">.fields not valid</div>";
     }
     $fields = array_merge($fields, $sectionFields);
     foreach ($fields as $k => $f) {
         if (substr($k, -1) == '_') {
             $k .= $this->page->lang;
         }
         $this->fields[$k] = $f;
     }
 }
示例#4
0
 protected function attached($presenter)
 {
     parent::attached($presenter);
     self::$presenter = $presenter;
     $this->user = $presenter->getUser();
 }