Exemple #1
0
 public function execute()
 {
     $success = true;
     $service = new ICalendarService();
     $service->update($this->uid);
     return $success;
 }
 /**
  *  @param array $calendar
  *  @param array $fieldArray
  *  @param \TYPO3\CMS\Cal\Service\ICalendarService $service
  **/
 public function processICS($calendar, &$fieldArray, &$service)
 {
     if ($fieldArray['ics_file'] or $fieldArray['ext_url']) {
         if ($fieldArray['ics_file']) {
             $url = GeneralUtility::getFileAbsFileName('uploads/tx_cal/ics/' . $fieldArray['ics_file']);
         } elseif ($fieldArray['ext_url']) {
             $fieldArray['ext_url'] = trim($fieldArray['ext_url']);
             $url = $fieldArray['ext_url'];
         }
         $newMD5 = $service->updateEvents($calendar['uid'], $calendar['pid'], $url, $calendar['md5'], $calendar['cruser_id']);
         if ($newMD5) {
             $fieldArray['md5'] = $newMD5;
             $pageTSConf = BackendUtility::getPagesTSconfig($calendar['pid']);
             if ($pageTSConf['options.']['tx_cal_controller.']['pageIDForPlugin']) {
                 $pageIDForPlugin = $pageTSConf['options.']['tx_cal_controller.']['pageIDForPlugin'];
             } else {
                 $pageIDForPlugin = $calendar['pid'];
             }
             $page = BackendUtility::getRecord('pages', intval($pageIDForPlugin), "doktype");
             if ($page['doktype'] != 254) {
                 /** @var \TYPO3\CMS\Cal\Utility\RecurrenceGenerator $rgc */
                 $rgc = GeneralUtility::makeInstance('TYPO3\\CMS\\Cal\\Utility\\RecurrenceGenerator', $pageIDForPlugin);
                 $rgc->generateIndexForCalendarUid($calendar['uid']);
             }
         }
         $service->scheduleUpdates($fieldArray['refresh'], $calendar['uid']);
     }
 }