示例#1
0
 public function actionDefault($section, $subsection)
 {
     if (!$this->session->started) {
         $this->session->start();
     }
     $this->template->editorial = $this->textManager->getText(TextManager::EDITORIAL);
     $get = $this->getRequest()->parameters;
     if (isset($get['log']) && $get['log'] == 'in' && !$this->session->started) {
         $this->template->customFlashMessage = 'Nemáte zapnuté soubory cookies, pro přihlášení musí být povoleny.';
     }
     if (!$subsection && !$section) {
         $this->paginator = new Paginator();
         $this->paginator->setItemCount($this->articleManager->countNewArticleList());
         $this->paginator->setItemsPerPage(8);
         $this->template->articles = $this->articleManager->getNewArticleList($this->paginator);
         return;
     }
     $this->template->setFile(__DIR__ . '/templates/Article/section.latte');
     if ($section && !$subsection) {
         $sectionDat = $this->articleManager->getSectionByUrl($section);
         if (!$sectionDat) {
             throw new Nette\Application\BadRequestException();
         }
         $this->template->section = $sectionDat;
         $this->template->subSections = $this->articleManager->getSubSectionFor($sectionDat->id);
         $this->template->articles = $this->articleManager->getArticleNotSubsection($sectionDat);
         $this->template->serials = $this->articleManager->getSerialForSection($sectionDat->id);
     }
     if ($subsection) {
         $subSectionDat = $this->articleManager->getSectionByUrl($subsection, 'subSectionDat');
         if (!$subSectionDat) {
             throw new Nette\Application\BadRequestException();
         }
         $this->template->section = $subSectionDat;
         $this->template->subSections = null;
         $this->template->articles = $this->articleManager->getArticleBySubSection($subSectionDat);
         $this->template->serials = $this->articleManager->getSerialForSubSection($subSectionDat->id);
     }
 }