Пример #1
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_MooxNews_Domain_Model_News $news
  * @return NULL|Tx_MooxNews_Domain_Model_News
  */
 protected function checkPidOfNewsRecord(Tx_MooxNews_Domain_Model_News $news)
 {
     $allowedStoragePages = GeneralUtility::trimExplode(',', Tx_MooxNews_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;
 }
 /**
  * Create the demand object which define which records will get shown
  *
  * @param Tx_MooxNews_Domain_Model_Dto_AdministrationDemand $demand
  * @return Tx_MooxNews_Domain_Model_Dto_NewsDemand
  */
 protected function createDemandObjectFromSettings(Tx_MooxNews_Domain_Model_Dto_AdministrationDemand $demand)
 {
     $demand->setCategories($demand->getSelectedCategories());
     $demand->setYear($demand->getYear() > 0 ? $demand->getYear() : "");
     $demand->setOrder($demand->getSortingField() . ' ' . $demand->getSortingDirection());
     $demand->setStoragePage(Tx_MooxNews_Utility_Page::extendPidListByChildren($this->page, (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;
 }