示例#1
0
 /**
  * @param Form $form
  * @param $form->values
  */
 private function formSubmitted(Form $form)
 {
     /** @var PagesEntity $pageParent */
     $pageParent = $this->pagesRepository->get($form->values->parent);
     $this->pagesRepository->begin();
     $this->pagesRepository->prepareBeforeAdd($pageParent);
     $this->page = new PagesEntity();
     $this->page->level($pageParent->level() + 1);
     $this->page->lft($pageParent->rgt());
     $this->page->rgt($pageParent->rgt() + 1);
     $this->page->parent($pageParent->id());
     $this->page->date(new DateTime());
     $this->page->upDate(new DateTime());
     $this->page->name($form->values->name);
     $this->page->inMenu(json_encode($form->values->inMenu));
     $this->page->menuTitle($form->values->menuTitle);
     $this->page->perex($form->values->perex);
     $this->page->text($form->values->text);
     $this->page->pictureName($form->values->pictureName);
     $this->page->pictureDescription($form->values->pictureDescription);
     $this->page->active($form->values->active);
     $this->page->onHomepage($form->values->onHomepage);
     $this->page->secret($form->values->secret);
     $this->page->title($form->values->title);
     $this->page->description($form->values->description);
     $this->page->keywords($form->values->keywords);
     $this->page->secretText($form->values->secretText);
     $this->page->galleryIds(json_encode($form->values->galleryIds));
     $this->page->upDate(new DateTime());
     $this->getUrl($form->values);
     $this->pagesRepository->commit();
 }
示例#2
0
 /**
  * @param $id
  */
 public function actionView($id)
 {
     $this->page = $this->pagesRepository->get($id);
     if ($this->page->secret() == 1 && !$this->user->isLoggedIn()) {
         $this->flashMessage('Ke stránce ' . (string) $this->page->name() . ' nemáte oprávnění', 'danger');
         $this->redirect('Homepage:default');
     }
     $this->getTemplate()->page = $this->page;
     $this->getTemplate()->title = $this->page->title() > '' ? $this->page->title() : $this->page->name();
     $this->getTemplate()->description = $this->page->description() > '' ? $this->page->description() : $this->page->text();
     $this->getTemplate()->keywords = $this->page->keywords() > '' ? $this->page->keywords() : '';
 }
示例#3
0
 /**
  * Inicializace třídních proměnných
  */
 public function startup()
 {
     parent::startup();
     $pages = $this->pagesRepository->getAll()->fetch();
     if ($pages === FALSE) {
         $page = new PagesEntity();
         $page->level(0);
         $page->lft(1);
         $page->rgt(2);
         $page->parent(0);
         $page->active(1);
         $page->date(new DateTime());
         $page->upDate(new DateTime());
         $page->name('root');
         $page->menuTitle('root');
         $page->title('root');
         $page->url('/');
         $this->pagesRepository->save($page);
     }
 }