Esempio n. 1
0
 function removeEvent($uid)
 {
     $event = $this->find($uid, $this->conf['pidList'], true, true);
     if (is_object($event) && $event->isUserAllowedToDelete()) {
         $config = $this->conf['calendar'];
         $this->conf['calendar'] = intval($this->controller->piVars['calendar_id']);
         $event = $this->find($uid, $this->conf['pidList'], true, true);
         $this->conf['calendar'] = $config;
         $updateFields = array('tstamp' => time(), 'deleted' => 1);
         $table = 'tx_cal_event';
         $where = 'uid = ' . $uid;
         $result = $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, $where, $updateFields);
         if (FALSE === $result) {
             throw new \RuntimeException('Could not delete event record from database: ' . $GLOBALS['TYPO3_DB']->sql_error(), 1431458133);
         }
         $fields = $event->getValuesAsArray();
         $fields['deleted'] = 1;
         $fields['tstamp'] = $updateFields['tstamp'];
         $this->_notify($fields);
         $this->stopReminder($uid);
         /** @var \TYPO3\CMS\Cal\Utility\RecurrenceGenerator $rgc */
         $rgc = GeneralUtility::makeInstance('TYPO3\\CMS\\Cal\\Utility\\RecurrenceGenerator');
         $rgc->cleanIndexTableOfUid($uid, $table);
         // Hook: removeEvent
         $hookObjectsArr = \TYPO3\CMS\Cal\Utility\Functions::getHookObjectsArray('tx_cal_event_service', 'eventServiceClass');
         \TYPO3\CMS\Cal\Utility\Functions::executeHookObjectsFunction($hookObjectsArr, 'removeEvent', $this, $event);
         \TYPO3\CMS\Cal\Utility\Functions::clearCache();
         $this->unsetPiVars();
     }
 }