Пример #1
0
 /**
  * Single view of a news event record
  *
  * @param Event $event
  * @param integer $currentPage current page for optional pagination
  * @return void
  */
 public function eventDetailAction(Event $event = null, $currentPage = 1)
 {
     $this->settings = $this->initializeSettings($this->settings);
     if (is_null($event)) {
         if ((int) $this->settings['singleNews'] > 0) {
             $previewNewsId = $this->settings['singleNews'];
         } elseif ($this->request->hasArgument('news_preview')) {
             $previewNewsId = $this->request->getArgument('news_preview');
         } else {
             $previewNewsId = $this->request->getArgument('news');
         }
         if ($this->settings['previewHiddenRecords']) {
             $event = $this->eventRepository->findByUid($previewNewsId, false);
         } else {
             $event = $this->eventRepository->findByUid($previewNewsId);
         }
     }
     if (is_null($event) && isset($this->settings['detail']['errorHandling'])) {
         $this->handleNoNewsFoundError($this->settings['detail']['errorHandling']);
     }
     $this->view->assignMultiple(array('newsItem' => $event, 'currentPage' => (int) $currentPage));
     \GeorgRinger\News\Utility\Page::setRegisterProperties($this->settings['detail']['registerProperties'], $event);
     if ($event instanceof Event) {
         \GeorgRinger\News\Utility\Cache::addCacheTagsByNewsRecords(array($event));
     }
 }
Пример #2
0
 /**
  * Single view of a news record
  *
  * @param \GeorgRinger\News\Domain\Model\News $news news item
  * @param int $currentPage current page for optional pagination
  * @return void
  */
 public function detailAction(\GeorgRinger\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_a($news, 'GeorgRinger\\News\\Domain\\Model\\News') && $this->settings['detail']['checkPidOfNewsRecord']) {
         $news = $this->checkPidOfNewsRecord($news);
     }
     if (is_null($news) && isset($this->settings['detail']['errorHandling'])) {
         $this->handleNoNewsFoundError($this->settings['detail']['errorHandling']);
     }
     $demand = $this->createDemandObjectFromSettings($this->settings);
     $demand->setActionAndClass(__METHOD__, __CLASS__);
     $assignedValues = ['newsItem' => $news, 'currentPage' => (int) $currentPage, 'demand' => $demand];
     $assignedValues = $this->emitActionSignal('NewsController', self::SIGNAL_NEWS_DETAIL_ACTION, $assignedValues);
     $this->view->assignMultiple($assignedValues);
     Page::setRegisterProperties($this->settings['detail']['registerProperties'], $news);
     if (!is_null($news) && is_a($news, 'GeorgRinger\\News\\Domain\\Model\\News')) {
         Cache::addCacheTagsByNewsRecords([$news]);
     }
 }
 /**
  * Renders the slider
  */
 public function sliderAction()
 {
     if (!$this->isHtmlFormat()) {
         $this->forward('list');
     }
     $demand = $this->createDemandObjectFromSettings($this->settings);
     $this->initializeDefaultLimitForCurrentActionIfNotSet($demand);
     $sliderNewsRecords = $this->newsRepository->findDemanded($demand);
     $inSideColumn = $this->inSideColumn();
     $columnSettings = $this->settings;
     if ($inSideColumn) {
         \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($columnSettings, $this->settings['sideColumn']);
     }
     $this->view->assignMultiple(array('news' => $sliderNewsRecords, 'demand' => $demand, 'inSideColumn' => $inSideColumn, 'columnSettings' => $columnSettings));
     Cache::addPageCacheTagsByDemandObject($demand);
 }