/**
  * Inject JS file in the header code.
  *
  * @param Tx_CalendarDisplay_Domain_Model_FeUser $user
  * @param Tx_CalendarDisplay_Domain_Model_Event $event
  * @return boolean
  */
 public function render($user, $event)
 {
     $result = FALSE;
     if ($user->getTxCalendardisplayAdmin() || $event->getPurchaser()->getUid() == $user->getUid()) {
         $result = TRUE;
     }
     return $result;
 }
예제 #2
0
 /**
  * Deletes an existing Event
  *
  * @param Tx_CalendarDisplay_Domain_Model_Event $event the Event to be deleted
  * @return void
  */
 public function deleteAction(Tx_CalendarDisplay_Domain_Model_Event $event)
 {
     // get current login user if it have right then add the new event
     $currentUser = $this->feUserRepository->findByUid(intval($GLOBALS['TSFE']->fe_user->user['uid']));
     $getPurchaserId = $event->getPurchaser() ? $event->getPurchaser()->getUid() : NULL;
     if ($currentUser->getUid() == $getPurchaserId || $currentUser->getTxCalendardisplayAdmin() == 1) {
         // @bug Bookings are not deleted even if they seem attached to the event
         $this->eventRepository->remove($event);
         $this->flashMessageContainer->add(Tx_Extbase_Utility_Localization::translate('event_removed', 'CalendarDisplay'));
     } else {
         $this->flashMessageContainer->add(Tx_Extbase_Utility_Localization::translate('event_not_removed', 'CalendarDisplay'));
     }
     $this->redirect('list');
 }