Пример #1
0
 /**
  * action list
  *
  * @param array $overwriteDemand
  * @return void
  */
 public function listAction($overwriteDemand = NULL)
 {
     $demand = $this->createDemandFromSettings($overwriteDemand);
     $courses = $this->courseRepository->findDemanded($demand);
     if ($courses instanceof QueryResult and !$courses->count() or !count($courses)) {
         $this->addFlashMessage($this->translate('message.noCoursesFound.text'), $this->translate('message.noCoursesFound.title'), FlashMessage::WARNING);
     }
     $configuration = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
     $this->view->assignMultiple(['courses' => $courses, 'demand' => $demand, 'settings' => $this->settings, 'storagePid' => $configuration['persistence']['storagePid']]);
 }
 /**
  * action list
  *
  * @param array $overwriteDemand
  * @return void
  */
 public function listAction($overwriteDemand = NULL)
 {
     $demand = $this->createDemandFromSettings($this->settings);
     if ($overwriteDemand === NULL) {
         $overwriteDemand = $this->moduleData->getOverwriteDemand();
     } else {
         $this->moduleData->setOverwriteDemand($overwriteDemand);
     }
     $this->overwriteDemandObject($demand, $overwriteDemand);
     $this->moduleData->setDemand($demand);
     $courses = $this->courseRepository->findDemanded($demand);
     if ($courses instanceof QueryResultInterface and !$courses->count() or !count($courses)) {
         $this->addFlashMessage($this->translate('message.noCoursesFound.text'), $this->translate('message.noCoursesFound.title'), FlashMessage::WARNING);
     }
     $configuration = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
     $templateVariables = ['courses' => $courses, 'demand' => $demand, 'overwriteDemand' => $overwriteDemand, 'filterOptions' => $this->getFilterOptions($this->settings['filter']), 'storagePid' => $configuration['persistence']['storagePid'], 'settings' => $this->settings];
     $this->emitSignal(__CLASS__, self::COURSE_LIST_ACTION, $templateVariables);
     $this->view->assignMultiple($templateVariables);
 }
 /**
  * Filter action
  *
  * @param array $overwriteDemand
  */
 public function filterAction($overwriteDemand = NULL)
 {
     $genreUids = GeneralUtility::intExplode(',', $this->settings['genres'], TRUE);
     $eventLocationUids = GeneralUtility::intExplode(',', $this->settings['eventLocations'], TRUE);
     $eventTypeUids = GeneralUtility::intExplode(',', $this->settings['eventTypes'], TRUE);
     $audienceUids = GeneralUtility::intExplode(',', $this->settings['audiences'], TRUE);
     if (count($genreUids)) {
         $genres = [];
         foreach ($genreUids as $genreUid) {
             if ($this->courseRepository->countContainingGenre($genreUid)) {
                 $genres[] = $this->genreRepository->findByUid($genreUid);
             }
         }
     } else {
         $genres = $this->genreRepository->findAll();
     }
     if (count($eventLocationUids)) {
         $eventLocations = [];
         foreach ($eventLocationUids as $eventLocationUid) {
             if ($this->lessonRepository->countByEventLocation($eventLocationUid)) {
                 $eventLocations[] = $this->eventLocationRepository->findByUid($eventLocationUid);
             }
         }
     } else {
         $eventLocations = $this->eventLocationRepository->findAll();
     }
     if (count($eventTypeUids)) {
         $eventTypes = [];
         foreach ($eventTypeUids as $eventTypeUid) {
             if ($this->courseRepository->countByEventType($eventTypeUid)) {
                 $eventTypes[] = $this->eventTypeRepository->findByUid($eventTypeUid);
             }
         }
     } else {
         $eventTypes = $this->eventTypeRepository->findAll();
     }
     if (count($audienceUids)) {
         $audiences = [];
         foreach ($audienceUids as $audienceUid) {
             if ($this->courseRepository->countContainingAudience($audienceUid)) {
                 $audiences[] = $this->audienceRepository->findByUid($audienceUid);
             }
         }
     } else {
         $audiences = $this->audienceRepository->findAll();
     }
     $this->view->assignMultiple(['overwriteDemand' => $overwriteDemand, 'genres' => $genres, 'eventLocations' => $eventLocations, 'audiences' => $audiences, 'eventTypes' => $eventTypes]);
 }