Ejemplo n.º 1
0
 /**
  * Main action for administration
  *
  * @param \GeorgRinger\News\Domain\Model\Dto\AdministrationDemand $demand
  * @dontvalidate  $demand
  * @return void
  */
 public function indexAction(\GeorgRinger\News\Domain\Model\Dto\AdministrationDemand $demand = null)
 {
     $this->redirectToPageOnStart();
     if (is_null($demand)) {
         $demand = $this->objectManager->get(\GeorgRinger\News\Domain\Model\Dto\AdministrationDemand::class);
         // Preselect by TsConfig (e.g. tx_news.module.preselect.topNewsRestriction = 1)
         if (isset($this->tsConfiguration['preselect.']) && is_array($this->tsConfiguration['preselect.'])) {
             unset($this->tsConfiguration['preselect.']['orderByAllowed']);
             foreach ($this->tsConfiguration['preselect.'] as $propertyName => $propertyValue) {
                 ObjectAccess::setProperty($demand, $propertyName, $propertyValue);
             }
         }
         $this->view->assign('hideForm', true);
     }
     $demand = $this->createDemandObject($demand);
     $demand->setActionAndClass(__METHOD__, __CLASS__);
     $categories = $this->categoryRepository->findParentCategoriesByPid($this->pageUid);
     $idList = [];
     foreach ($categories as $c) {
         $idList[] = $c->getUid();
     }
     if (empty($idList) && !$this->getBackendUser()->isAdmin()) {
         $idList = $this->getBackendUser()->getCategoryMountPoints();
     }
     $newsItems = $this->newsRepository->findDemanded($demand, false);
     $assignedValues = ['moduleToken' => $this->getToken(true), 'page' => $this->pageUid, 'demand' => $demand, 'news' => $newsItems, 'showSearchForm' => !is_null($demand) || count($newsItems) > 0, 'categories' => $this->categoryRepository->findTree($idList), 'dateformat' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy']];
     $assignedValues = $this->emitActionSignal('AdministrationController', self::SIGNAL_ADMINISTRATION_INDEX_ACTION, $assignedValues);
     $this->view->assignMultiple($assignedValues);
 }
Ejemplo n.º 2
0
 /**
  * Main action for administration
  *
  * @param \GeorgRinger\News\Domain\Model\Dto\AdministrationDemand $demand
  * @dontvalidate  $demand
  * @return void
  */
 public function indexAction(\GeorgRinger\News\Domain\Model\Dto\AdministrationDemand $demand = NULL)
 {
     $this->redirectToPageOnStart();
     if (is_null($demand)) {
         $demand = $this->objectManager->get('GeorgRinger\\News\\Domain\\Model\\Dto\\AdministrationDemand');
         // Preselect by TsConfig (e.g. tx_news.module.preselect.topNewsRestriction = 1)
         if (isset($this->tsConfiguration['preselect.']) && is_array($this->tsConfiguration['preselect.'])) {
             unset($this->tsConfiguration['preselect.']['orderByAllowed']);
             foreach ($this->tsConfiguration['preselect.'] as $propertyName => $propertyValue) {
                 \TYPO3\CMS\Extbase\Reflection\ObjectAccess::setProperty($demand, $propertyName, $propertyValue);
             }
         }
     }
     $demand = $this->createDemandObjectFromSettings($demand);
     $categories = $this->categoryRepository->findParentCategoriesByPid($this->pageUid);
     $idList = array();
     foreach ($categories as $c) {
         $idList[] = $c->getUid();
     }
     $assignedValues = array('moduleToken' => $this->getToken(TRUE), 'page' => $this->pageUid, 'demand' => $demand, 'news' => $this->newsRepository->findDemanded($demand, FALSE), 'categories' => $this->categoryRepository->findTree($idList), 'dateformat' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy']);
     $this->emitActionSignal('AdministrationController', self::SIGNAL_ADMINISTRATION_INDEX_ACTION, $assignedValues);
     $this->view->assignMultiple($assignedValues);
 }