Beispiel #1
0
 /**
  * @return CommentsControl
  */
 public function createComponentComments()
 {
     $control = new CommentsControl($this->commentsRepository, $this->formFactory);
     $control->setPageId($this->page->id());
     $control->setArticleId(null);
     return $control;
 }
Beispiel #2
0
 /**
  * @param $id
  */
 public function handleInTopMenu($id)
 {
     $this->page = $this->pagesRepository->get($id);
     $items = json_decode($this->page->inMenu(), true);
     $key = array_search('topMenu', $items);
     if (is_numeric($key)) {
         unset($items[$key]);
     } else {
         array_push($items, 'topMenu');
     }
     $this->page->inMenu(json_encode($items));
     $this->pagesRepository->save($this->page);
     if (!$this->isAjax()) {
         $this->redirect('default');
     }
     $this->redrawControl();
 }
Beispiel #3
0
 private function getUrl($values, $iterator = 1)
 {
     if ($values->url == "/") {
         return $values->url;
     }
     if ($values->url == "") {
         $url = Strings::webalize($values->name) . ($iterator != 1 ? "-" . $iterator : '');
     } else {
         $url = $values->url . ($iterator != 1 ? "-" . $iterator : '');
     }
     if (count($this->pagesRepository->getAllWhere(['url' => $url]))) {
         $this->getUrl($values, ++$iterator);
     } else {
         $this->page->url($url);
         $this->pagesRepository->save($this->page);
     }
 }
Beispiel #4
0
 /**
  * @param PagesEntity $page
  * @return array
  */
 public function getPosibleParentsTree(PagesEntity $page)
 {
     return $this->db->select('id, CONCAT(REPEAT(\'- \', level), name) as name')->from($this->tableName)->where('lft < %i OR rgt > %i', $page->lft(), $page->rgt())->orderBy('lft')->fetchPairs();
 }