/**
  * Create the demand object which define which records will get shown
  *
  * @param Tx_News_Domain_Model_Dto_AdministrationDemand $demand
  * @return Tx_News_Domain_Model_Dto_NewsDemand
  */
 protected function createDemandObjectFromSettings(Tx_News_Domain_Model_Dto_AdministrationDemand $demand)
 {
     $demand->setCategories($demand->getSelectedCategories());
     $demand->setOrder($demand->getSortingField() . ' ' . $demand->getSortingDirection());
     $demand->setStoragePage(Tx_News_Utility_Page::extendPidListByChildren($this->pageUid, (int) $demand->getRecursive()));
     $demand->setOrderByAllowed($this->settings['orderByAllowed']);
     // Ensure that always a storage page is set
     if ((int) $demand->getStoragePage() === 0) {
         $demand->setStoragePage('-3');
     }
     return $demand;
 }
 /**
  * Single view of a news record
  *
  * @param Tx_News_Domain_Model_News $news news item
  * @param integer $currentPage current page for optional pagination
  * @return void
  */
 public function detailAction(Tx_News_Domain_Model_News $news = NULL, $currentPage = 1)
 {
     if (is_null($news)) {
         $previewNewsId = (int) $this->settings['singleNews'] > 0 ? $this->settings['singleNews'] : 0;
         if ($this->request->hasArgument('news_preview')) {
             $previewNewsId = (int) $this->request->getArgument('news_preview');
         }
         if ($previewNewsId > 0) {
             if ($this->isPreviewOfHiddenRecordsEnabled()) {
                 $news = $this->newsRepository->findByUid($previewNewsId, FALSE);
             } else {
                 $news = $this->newsRepository->findByUid($previewNewsId);
             }
         }
     }
     if (is_null($news) && isset($this->settings['detail']['errorHandling'])) {
         $this->handleNoNewsFoundError($this->settings['detail']['errorHandling']);
     }
     $this->view->assignMultiple(array('newsItem' => $news, 'currentPage' => (int) $currentPage));
     Tx_News_Utility_Page::setRegisterProperties($this->settings['detail']['registerProperties'], $news);
 }
示例#3
0
 /**
  * Checks if the news pid could be found in the startingpoint settings of the detail plugin and
  * if the pid could not be found it return NULL instead of the news object.
  *
  * @param Tx_News_Domain_Model_News $news
  * @return NULL|Tx_News_Domain_Model_News
  */
 protected function checkPidOfNewsRecord(Tx_News_Domain_Model_News $news)
 {
     $allowedStoragePages = GeneralUtility::trimExplode(',', Tx_News_Utility_Page::extendPidListByChildren($this->settings['startingpoint'], $this->settings['recursive']), TRUE);
     if (count($allowedStoragePages) > 0 && !in_array($news->getPid(), $allowedStoragePages)) {
         $this->signalSlotDispatcher->dispatch(__CLASS__, 'checkPidOfNewsRecordFailedInDetailAction', array('news' => $news, 'newsController' => $this));
         $news = NULL;
     }
     return $news;
 }