コード例 #1
0
 public function reindexEvent($eventUid, $pid)
 {
     /* If we're in a workspace, don't notify anyone about the event */
     if ($pid > 0 && !$GLOBALS['BE_USER']->workspace) {
         /* Check Page TSConfig for a preview page that we should use */
         $pageIDForPlugin = $this->getPageIDForPlugin($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);
             /** @var \TYPO3\CMS\Cal\Utility\RecurrenceGenerator $rgc */
             $rgc = GeneralUtility::makeInstance('TYPO3\\CMS\\Cal\\Utility\\RecurrenceGenerator');
             $rgc->generateIndexForUid($eventUid, 'tx_cal_event');
         }
     }
 }
コード例 #2
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());
     }
 }