/** * 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; } }