Esempio n. 1
0
 protected function _invite(&$event)
 {
     $notificationService =& \TYPO3\CMS\Cal\Utility\Functions::getNotificationService();
     $oldView = $this->conf['view'];
     $this->conf['view'] = 'ics';
     $eventValues = array();
     $eventValues['uid'] = $event->getUid();
     $notificationService->invite($eventValues, $eventValues);
     $this->conf['view'] = $oldView;
 }
Esempio n. 2
0
 function processCmdmap_preProcess(&$command, &$table, &$id, &$value, &$tce)
 {
     switch ($table) {
         case 'tx_cal_event':
             if ($command == 'delete') {
                 $select = '*';
                 $table = 'tx_cal_event';
                 $where = 'uid = ' . $id;
                 $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $table, $where);
                 if ($result) {
                     while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
                         /* If we're in a workspace, don't notify anyone about the event */
                         if ($row['pid'] > 0 && !$GLOBALS['BE_USER']->workspace) {
                             /* Check Page TSConfig for a preview page that we should use */
                             $pageTSConf = BackendUtility::getPagesTSconfig($row['pid']);
                             if ($pageTSConf['options.']['tx_cal_controller.']['pageIDForPlugin']) {
                                 $pageIDForPlugin = $pageTSConf['options.']['tx_cal_controller.']['pageIDForPlugin'];
                             } else {
                                 $pageIDForPlugin = $row['pid'];
                             }
                             $page = BackendUtility::getRecord('pages', intval($pageIDForPlugin), "doktype");
                             if ($page['doktype'] != 254) {
                                 $tx_cal_api = GeneralUtility::makeInstance('TYPO3\\CMS\\Cal\\Controller\\Api');
                                 $tx_cal_api =& $tx_cal_api->tx_cal_api_without($pageIDForPlugin);
                                 $notificationService =& \TYPO3\CMS\Cal\Utility\Functions::getNotificationService();
                                 // Need to enforce deletion mode
                                 $notificationService->notify($row, 1);
                             }
                         }
                     }
                 }
                 // We have to delete the gabriel/scheduler events BEFORE the tx_cal_events and
                 // its related tx_cal_fe_user_event_monitor_mm records are gone
                 /* Clean up any pending reminders for this event */
                 $reminderService =& \TYPO3\CMS\Cal\Utility\Functions::getReminderService();
                 try {
                     $reminderService->deleteReminderForEvent($id);
                 } catch (OutOfBoundsException $e) {
                 }
             }
             break;
         case 'tx_cal_fe_user_event_monitor_mm':
             if ($command == 'delete') {
                 $relationRecord = BackendUtility::getRecord('tx_cal_fe_user_event_monitor_mm', $id);
                 // We have to delete the gabriel events BEFORE the tx_cal_events and
                 // its related tx_cal_fe_user_event_monitor_mm records are gone
                 /* Clean up any pending reminders for this event */
                 $reminderService =& \TYPO3\CMS\Cal\Utility\Functions::getReminderService();
                 try {
                     $reminderService->deleteReminder($relationRecord['uid_local']);
                 } catch (OutOfBoundsException $e) {
                 }
             }
             break;
     }
 }
Esempio n. 3
0
 function processDatamap_afterDatabaseOperations($status, $table, $id, &$fieldArray, &$tcemain)
 {
     /* If we have a new calendar event */
     if (($table == 'tx_cal_event' || $table == 'tx_cal_exception_event') && count($fieldArray) > 1) {
         $event = BackendUtility::getRecord($table, $status == 'new' ? $tcemain->substNEWwithIDs[$id] : $id);
         /* If we're in a workspace, don't notify anyone about the event */
         if ($event['pid'] > 0 && !$GLOBALS['BE_USER']->workspace) {
             /* Check Page TSConfig for a preview page that we should use */
             $pageTSConf = BackendUtility::getPagesTSconfig($event['pid']);
             if ($pageTSConf['options.']['tx_cal_controller.']['pageIDForPlugin']) {
                 $pageIDForPlugin = $pageTSConf['options.']['tx_cal_controller.']['pageIDForPlugin'];
             } else {
                 $pageIDForPlugin = $event['pid'];
             }
             $page = BackendUtility::getRecord('pages', intval($pageIDForPlugin), 'doktype');
             if ($page['doktype'] != 254) {
                 $tx_cal_api = new \TYPO3\CMS\Cal\Controller\Api();
                 $tx_cal_api =& $tx_cal_api->tx_cal_api_without($pageIDForPlugin);
                 if ($event['event_type'] == 3 && !$event['ref_event_id']) {
                     $modelObj =& \TYPO3\CMS\Cal\Utility\Registry::Registry('basic', 'modelcontroller');
                     $modelObj->updateEventAttendees($event['uid'], 'tx_cal_phpicalendar');
                 }
                 if ($table == 'tx_cal_event' && ($status == 'new' || $fieldArray['send_invitation'])) {
                     /* Notify of new event */
                     $notificationService =& \TYPO3\CMS\Cal\Utility\Functions::getNotificationService();
                     $oldPath =& $notificationService->conf['view.']['event.']['eventModelTemplate'];
                     $extPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('cal');
                     $oldPath = str_replace('EXT:cal/', $extPath, $oldPath);
                     // $oldPath = str_replace(PATH_site, '', $oldPath);
                     $tx_cal_api->conf['view.']['event.']['eventModelTemplate'] = $oldPath;
                     $oldBackPath = $GLOBALS['TSFE']->tmpl->getFileName_backPath;
                     $GLOBALS['TSFE']->tmpl->getFileName_backPath = '';
                     $fileInfo = GeneralUtility::split_fileref($oldPath);
                     $GLOBALS['TSFE']->tmpl->allowedPaths[] = $fileInfo['path'];
                     $notificationService->controller->getDateTimeObject = new \TYPO3\CMS\Cal\Model\CalDate($event['start_date'] . '000000');
                     if ($status == 'new') {
                         $notificationService->notify($event);
                     }
                     if ($fieldArray['send_invitation']) {
                         $notificationService->invite($fieldArray);
                         $fieldArray['send_invitation'] = 0;
                     }
                     $GLOBALS['TSFE']->tmpl->getFileName_backPath = $oldBackPath;
                 }
                 /** @var \TYPO3\CMS\Cal\Utility\RecurrenceGenerator $rgc */
                 $rgc = GeneralUtility::makeInstance('TYPO3\\CMS\\Cal\\Utility\\RecurrenceGenerator', $pageIDForPlugin);
                 $rgc->generateIndexForUid($event['uid'], $table);
                 if ($table == 'tx_cal_event' && $tx_cal_api->conf['view.']['event.']['remind']) {
                     /* Schedule reminders for new and changed events */
                     $reminderService =& \TYPO3\CMS\Cal\Utility\Functions::getReminderService();
                     $reminderService->scheduleReminder($event['uid']);
                 }
             }
         }
     }
     if ($table == 'pages' && $status == 'new') {
         $GLOBALS['BE_USER']->setAndSaveSessionData('cal_itemsProcFunc', array());
     }
 }