/**
  * action list
  *
  * @return void
  */
 public function listAction()
 {
     if (!$this->div->isLoggedUserInGroup($this->settings['participantGroupId'])) {
         $this->addFlashMessage($this->div->translate('message.noParticipant', $this->extensionName), '', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);
         $this->redirect('list');
     }
     $oldestEventYear = $this->div->getOldestEventYear();
     $currentYear = date("Y");
     $index = 0;
     $statistics = array();
     for ($i = $currentYear; $i >= $oldestEventYear; $i--) {
         $year = $i;
         $statistics[$index]['year'] = $year;
         $statistics[$index]['activeEvents'] = $this->eventRepository->findEventsOfYearByActive($year, true)->count();
         $statistics[$index]['inactiveEvents'] = $this->eventRepository->findEventsOfYearByActive($year, false)->count();
         $averageAccepts = $this->eventRepository->calculateAverageAcceptsPerEventByYear($year, true);
         $statistics[$index]['averageAccepts'] = $averageAccepts["0"]["average"];
         $statistics[$index]['minimumAccepts'] = $averageAccepts["0"]["minimum"];
         $statistics[$index]['maximumAccepts'] = $averageAccepts["0"]["maximum"];
         $averageCancels = $this->eventRepository->calculateAverageAcceptsPerEventByYear($year, false);
         $statistics[$index]['averageCancels'] = $averageCancels["0"]["average"];
         $statistics[$index]['minimumCancels'] = $averageCancels["0"]["minimum"];
         $statistics[$index]['maximumCancels'] = $averageCancels["0"]["maximum"];
         $tops = $this->eventRepository->topParticipantsByYear($year);
         for ($j = 0; $j <= count($tops) - 1; $j++) {
             $statistics[$index]['tops'][$j]['participantName'] = $tops[$j]["participantName"];
             $statistics[$index]['tops'][$j]['eventsAccepted'] = $tops[$j]["eventsAccepted"];
         }
         $index++;
     }
     $this->view->assign('statistics', $statistics);
 }
 /**
  * action delete
  *
  * @param \PoiCom\PcEventScheduler\Domain\Model\Holiday $holiday
  * @return void
  */
 public function deleteAction(\PoiCom\PcEventScheduler\Domain\Model\Holiday $holiday)
 {
     if (!$this->div->isLoggedUserInGroup($this->settings['eventAdminGroupId'])) {
         $this->addFlashMessage($this->div->translate('message.noAdmin', $this->extensionName), '', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);
         $this->redirect('list');
     }
     $this->addFlashMessage($this->div->translate('message.holidayDeleted', $this->extensionName), '', \TYPO3\CMS\Core\Messaging\AbstractMessage::OK);
     $this->holidayRepository->remove($holiday);
     $this->redirect('list');
 }
 /**
  * action location
  *
  * @return void
  */
 public function locationAction()
 {
     if (!$this->div->isLoggedUserInGroup($this->settings['eventAdminGroupId'])) {
         $this->addFlashMessage($this->div->translate('message.noAdmin', $this->extensionName), '', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);
         $this->redirect('list');
     }
     $location = $this->request->getArgument('location');
     if ($this->request->hasArgument('offset')) {
         $offset = $this->request->getArgument('offset');
         if ($offset < 0) {
             $this->addFlashMessage($this->div->translate('message.pastEventError', $this->extensionName), '', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);
             $this->redirect('list', Null, Null, array('offset' => $offset));
         }
     }
     if (!$this->request->hasArgument('offset')) {
         $offset = 0;
     }
     $eventStartDate = $this->div->nextEventDate($offset);
     $events = $this->eventRepository->findByStart($eventStartDate->format("Y-m-d H:i:s"));
     $events->getFirst()->setLocation($location);
     $this->eventRepository->update($events->getFirst());
     $this->addFlashMessage($this->div->translate('message.setLocation', $this->extensionName) . ": {$location}", '', \TYPO3\CMS\Core\Messaging\AbstractMessage::OK);
     $this->redirect('list', Null, Null, array('offset' => $offset));
 }