/** * display a single event * * @param integer $event * @return null */ public function showAction($event) { /* don't let Extbase fetch the event * as you won't be able to extend the model * via an extension */ $event = $this->eventRepository->findByUid($event); if (empty($event)) { $this->throwStatus(404, 'Not found', 'The requested event could not be found.'); } $this->view->assign('event', $event); }
/** * get an event object by its uid * * @param integer $id * @throws InvalidArgumentException * @return Tx_CzSimpleCal_Domain_Model_Event */ protected function fetchEventObject($id) { $event = $this->eventRepository->findOneByUidEverywhere($id); if (empty($event)) { throw new InvalidArgumentException(sprintf('An event with uid %d could not be found.', $id)); } return $event; }
/** * Deletes an existing event * * @param Tx_CzSimpleCal_Domain_Model_Event $event The event to delete * @return void * @dontvalidate $event */ public function deleteAction(Tx_CzSimpleCal_Domain_Model_Event $event) { $this->abortOnInvalidUser($event); // delete index for event $this->getObjectManager()->get('Tx_CzSimpleCal_Indexer_Event')->delete($event); $this->eventRepository->remove($event); $this->flashMessageContainer->add(sprintf('The event "%s" was deleted.', $event->getTitle()), '', t3lib_FlashMessage::OK); $this->clearCache(); $this->logEventLifecycle($event, 3); $this->redirect('list'); }
/** * execute this task * * @return boolean */ public function execute() { $this->init(); while ($this->shouldAnotherChunkBeProcessed()) { $events = $this->eventRepository->findRecordsForReindexing($this->chunkSize, $this->minIndexAgeAbsolute); if (!$events->count() > 0) { // if: there is nothing more to do return true; } $this->indexEvents($events); } // if: the script stopped, but not all data could be processed if ($GLOBALS['LANG']) { $message = t3lib_div::makeInstance('t3lib_FlashMessage', sprintf('cz_simple_cal (uid: %d): %s', $this->getTaskUid(), sprintf($GLOBALS['LANG']->sL('LLL:EXT:cz_simple_cal/Resources/Private/Language/locallang_mod.xml:tx_czsimplecal_scheduler_index.info_index_not_finished'), date('c', $this->eventRepository->getMaxIndexAge()))), '', t3lib_FlashMessage::INFO); t3lib_FlashMessageQueue::addMessage($message); } return true; }