/**
  * check if any events of categories below are present and free for booking
  *
  * @param Tx_WoehrlSeminare_Domain_Model_Category $category
  * @return boolean
  * @api
  */
 public function render(Tx_WoehrlSeminare_Domain_Model_Category $category)
 {
     $events = $this->eventRepository->findAllGbByCategory($category);
     $categories = $this->categoryRepository->findCurrentBranch($category);
     $showLink = FALSE;
     if (count($categories) == 0 || count($events) == 0) {
         foreach ($events as $event) {
             $showLink = TRUE;
             if ($this->subscriberRepository->countAllByEvent($event) >= $event->getMaxSubscriber()) {
                 $showLink = FALSE;
             }
             // event is cancelled
             if ($event->getCancelled()) {
                 $showLink = FALSE;
             }
             // deadline reached....
             if (is_object($event->getSubEndDateTime())) {
                 if ($event->getSubEndDateTime()->getTimestamp() < time()) {
                     $showLink = FALSE;
                 }
             }
             // if any event exists and is valid, break here and return TRUE
             if ($showLink) {
                 break;
             }
         }
     }
     //~ else
     //~ return TRUE;
     return $showLink;
 }
 /**
  * check if any events of categories below are present and free for booking
  *
  * @param Tx_WoehrlSeminare_Domain_Model_Category $category
  * @return int
  * @author Alexander Fuchs <*****@*****.**>
  * @api
  */
 public function render(Tx_WoehrlSeminare_Domain_Model_Category $category)
 {
     $categories = $this->categoryRepository->findCurrentBranch($category);
     if (count($categories) == 0) {
         return FALSE;
     } else {
         return TRUE;
     }
 }
 /**
  * makeStatisticsReportsCommand
  *
  * @param int stroagePid
  * @param string senderEmailAddress
  * @param string receiverEmailAddress list of receiver email addresses separated by comma
  * @return void
  */
 public function makeStatisticsReportsCommand($storagePid, $senderEmailAddress = '', $receiverEmailAddress = '')
 {
     // do some init work...
     $this->initializeAction();
     // abort if no storagePid is found
     if (!t3lib_utility_Math::canBeInterpretedAsInteger($storagePid)) {
         echo 'NO storagePid given. Please enter the storagePid in the scheduler task.';
         exit(1);
     }
     // abort if no senderEmailAddress is found
     if (empty($senderEmailAddress)) {
         echo 'NO senderEmailAddress given. Please enter the senderEmailAddress in the scheduler task.';
         exit(1);
     }
     // abort if no senderEmailAddress is found
     if (empty($receiverEmailAddress)) {
         echo 'NO receiverEmailAddress given. Please enter the receiverEmailAddress in the scheduler task.';
         exit(1);
     } else {
         $receiverEmailAddress = explode(', ', $receiverEmailAddress);
     }
     // set storagePid to point extbase to the right repositories
     $configurationArray = array('persistence' => array('storagePid' => $storagePid));
     $this->configurationManager->setConfiguration($configurationArray);
     // start the work...
     // 1. get the categories
     $categories = $this->categoryRepository->findAll();
     foreach ($categories as $uid => $category) {
         $searchParameter['category'][$uid] = $uid;
     }
     // 2. get events of last month
     $startDateTime = strtotime('first day of last month 00:00:00');
     $endDateTime = strtotime('last day of last month 23:59:59');
     $allevents = $this->eventRepository->findAllByCategoriesAndDateInterval($searchParameter['category'], $startDateTime, $endDateTime);
     // used to name the csv file...
     $helper['nameto'] = strftime('%Y%m', $startDateTime);
     // email to all receivers...
     $out = $this->sendTemplateEmail($receiverEmailAddress, array($senderEmailAddress => 'WÖHRL Akademie - noreply'), 'Statistik Report Veranstaltungen: ' . ': ' . strftime('%x', $startDateTime) . ' - ' . strftime('%x', $endDateTime), 'Statistics', array('events' => $allevents, 'categories' => $categories, 'helper' => $helper, 'attachCsv' => TRUE, 'attachIcs' => FALSE));
     return;
 }