/**
  * @param \GeorgRinger\Newsadvancedsearch\Domain\Model\Dto\Search $search
  */
 public function resultAction(\GeorgRinger\Newsadvancedsearch\Domain\Model\Dto\Search $search = NULL)
 {
     if (is_null($search)) {
         $search = $this->objectManager->get('GeorgRinger\\Newsadvancedsearch\\Domain\\Model\\Dto\\Search');
     }
     /** @var \GeorgRinger\Newsadvancedsearch\Domain\Model\Dto\Demand $demand */
     $demand = $this->objectManager->get('GeorgRinger\\Newsadvancedsearch\\Domain\\Model\\Dto\\Demand');
     $demand->setLocations($search->getLocations());
     $demand->setTypes($search->getTypes());
     $demand->setSubject($search->getSubject());
     $newsItems = $this->newsRepository->findDemanded($demand);
     $this->view->assignMultiple(array('search' => $search, 'demand' => $demand, 'news' => $newsItems));
 }
 /**
  * Test for creating correct demand call
  *
  * @test
  * @return void
  */
 public function listActionFindsDemandedNewsByDemandFromSettings()
 {
     $demand = clone new Tx_News_Domain_Model_Dto_AdministrationDemand();
     $settings = array('list' => 'foo');
     $configurationManager = $this->getMock('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface');
     $configurationManager->expects($this->any())->method('getConfiguration')->will($this->returnValue($settings));
     $fixture = $this->getMock('Tx_News_Controller_NewsController', array('createDemandObjectFromSettings'));
     $fixture->injectNewsRepository($this->newsRepository);
     $fixture->injectConfigurationManager($configurationManager);
     $fixture->setView($this->getMock('Tx_Fluid_View_TemplateView', array(), array(), '', FALSE));
     $fixture->expects($this->once())->method('createDemandObjectFromSettings')->with($settings)->will($this->returnValue($demand));
     $this->newsRepository->expects($this->once())->method('findDemanded')->with($demand);
     $fixture->listAction();
 }
Ejemplo n.º 3
0
 /**
  * @param array $queueItem
  * @param array $importItemOverwrite
  * @return void
  */
 protected function importL10nOverlay(array $queueItem, array $importItemOverwrite)
 {
     $importItem = $queueItem['importItem'];
     $parentNews = $this->newsRepository->findOneByImportSourceAndImportId($importItem['import_source'], $importItem['l10n_parent']);
     if ($parentNews !== NULL) {
         $news = $this->initializeNewsRecord($importItem);
         $this->hydrateNewsRecord($news, $importItem, $importItemOverwrite);
         $news->setSysLanguageUid($importItem['sys_language_uid']);
         $news->setL10nParent($parentNews->getUid());
     }
 }
 /**
  * Displays the search result
  *
  * @param Tx_News_Domain_Model_Dto_Search $search
  * @param array $overwriteDemand
  * @return void
  */
 public function searchResultAction(Tx_News_Domain_Model_Dto_Search $search = NULL, array $overwriteDemand = array())
 {
     $demand = $this->createDemandObjectFromSettings($this->settings);
     if ($this->settings['disableOverrideDemand'] != 1 && $overwriteDemand !== NULL) {
         $demand = $this->overwriteDemandObject($demand, $overwriteDemand);
     }
     if (!is_null($search)) {
         $search->setFields($this->settings['search']['fields']);
     }
     $demand->setSearch($search);
     $this->view->assignMultiple(array('news' => $this->newsRepository->findDemanded($demand), 'overwriteDemand' => $overwriteDemand, 'search' => $search, 'demand' => $demand));
 }
Ejemplo n.º 5
0
 /**
  * Test if latest limit constraint works
  *
  * @test
  * @return void
  */
 public function findLatestLimitRecords()
 {
     /** @var $demand Tx_News_Domain_Model_Dto_NewsDemand */
     $demand = $this->objectManager->get('Tx_News_Domain_Model_Dto_NewsDemand');
     $demand->setStoragePage(9);
     $GLOBALS['EXEC_TIME'] = strtotime('2014-04-03');
     // get all news maximum 6 days old
     $demand->setTimeRestriction(6 * 86400);
     $this->assertEquals((int) $this->newsRepository->findDemanded($demand)->count(), 4);
     // no restriction should get you all
     $demand->setTimeRestriction(0);
     $this->assertEquals((int) $this->newsRepository->findDemanded($demand)->count(), 6);
 }
Ejemplo n.º 6
0
 /**
  * Displays the search result
  *
  * @param Tx_News_Domain_Model_Dto_Search $search
  * @param array $overwriteDemand
  * @return void
  */
 public function searchResultAction(Tx_News_Domain_Model_Dto_Search $search = NULL, array $overwriteDemand = array())
 {
     $demand = $this->createDemandObjectFromSettings($this->settings);
     if ($this->settings['disableOverrideDemand'] != 1 && $overwriteDemand !== NULL) {
         $demand = $this->overwriteDemandObject($demand, $overwriteDemand);
     }
     if (!is_null($search)) {
         $search->setFields($this->settings['search']['fields']);
         $search->setDateField($this->settings['dateField']);
     }
     $demand->setSearch($search);
     $assignedValues = array('news' => $this->newsRepository->findDemanded($demand), 'overwriteDemand' => $overwriteDemand, 'search' => $search, 'demand' => $demand);
     $this->emitActionSignal('NewsController', self::SIGNAL_NEWS_SEARCHRESULT_ACTION, $assignedValues);
     $this->view->assignMultiple($assignedValues);
 }
 /**
  * Main action for administration
  *
  * @param Tx_News_Domain_Model_Dto_AdministrationDemand $demand
  * @dontvalidate  $demand
  * @return void
  */
 public function indexAction(Tx_News_Domain_Model_Dto_AdministrationDemand $demand = NULL)
 {
     if (is_null($demand)) {
         $demand = $this->objectManager->get('Tx_News_Domain_Model_Dto_AdministrationDemand');
         // Preselect by TsConfig (e.g. tx_news.module.preselect.topNewsRestriction = 1)
         $tsConfig = t3lib_BEfunc::getPagesTSconfig($this->pageUid);
         if (isset($tsConfig['tx_news.']['module.']['preselect.']) && is_array($tsConfig['tx_news.']['module.']['preselect.'])) {
             unset($tsConfig['tx_news.']['module.']['preselect.']['orderByAllowed']);
             foreach ($tsConfig['tx_news.']['module.']['preselect.'] as $propertyName => $propertyValue) {
                 Tx_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();
     }
     $this->view->assignMultiple(array('page' => $this->pageUid, 'demand' => $demand, 'news' => $this->newsRepository->findDemanded($demand, FALSE), 'categories' => $this->categoryRepository->findTree($idList), 'dateformat' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy']));
 }
Ejemplo n.º 8
0
 /**
  * Output a nivolider view of news
  *
  * @return return string the Rendered view
  */
 public function nivosliderAction()
 {
     $demand = parent::createDemandObjectFromSettings($this->settings);
     $this->view->assign('news', $this->newsRepository->findDemanded($demand));
 }