示例#1
0
 function createSchedulerTask(&$scheduler, $date, $calEventUID, $timestamp, $offset, $uid)
 {
     if ($date->isFuture()) {
         /* Set up the scheduler event */
         $task = new \TYPO3\CMS\Cal\Cron\ReminderScheduler();
         $task->setUID($calEventUID);
         $taskGroup = BackendUtility::getRecordRaw('tx_scheduler_task_group', 'groupName="cal"');
         if ($taskGroup['uid']) {
             $task->setTaskGroup($taskGroup['uid']);
         } else {
             $crdate = time();
             $insertFields = array();
             $insertFields['pid'] = 0;
             $insertFields['tstamp'] = $crdate;
             $insertFields['crdate'] = $crdate;
             $insertFields['cruser_id'] = 0;
             $insertFields['groupName'] = 'cal';
             $insertFields['description'] = 'Calendar Base';
             $table = 'tx_scheduler_task_group';
             $result = $GLOBALS['TYPO3_DB']->exec_INSERTquery($table, $insertFields);
             if (FALSE === $result) {
                 throw new \RuntimeException('Could not write ' . $table . ' record to database: ' . $GLOBALS['TYPO3_DB']->sql_error(), 1431458160);
             }
             $uid = $GLOBALS['TYPO3_DB']->sql_insert_id();
             $task->setTaskGroup($uid);
         }
         $task->setDescription('Reminder of a calendar event (id=' . $calEventUID . ')');
         /* Schedule the event */
         $execution = new \TYPO3\CMS\Scheduler\Execution();
         $execution->setStart($timestamp - $offset * 60);
         $execution->setIsNewSingleExecution(true);
         $execution->setMultiple(false);
         $execution->setEnd(time() - 1);
         $task->setExecution($execution);
         $scheduler->addTask($task);
         $GLOBALS['TYPO3_DB']->exec_UPDATEquery('tx_cal_fe_user_event_monitor_mm', 'uid=' . $uid, array('schedulerId' => $task->getTaskUid()));
     } else {
     }
 }
示例#2
0
 function createSchedulerTask(&$scheduler, $offset, $calendarUid)
 {
     /* Set up the scheduler event */
     $task = new \TYPO3\CMS\Cal\Cron\CalendarScheduler();
     $task->setUID($calendarUid);
     $taskGroup = BackendUtility::getRecordRaw('tx_scheduler_task_group', 'groupName="cal"');
     if ($taskGroup['uid']) {
         $task->setTaskGroup($taskGroup['uid']);
     } else {
         $crdate = time();
         $insertFields = array();
         $insertFields['pid'] = 0;
         $insertFields['tstamp'] = $crdate;
         $insertFields['crdate'] = $crdate;
         $insertFields['cruser_id'] = 0;
         $insertFields['groupName'] = 'cal';
         $insertFields['description'] = 'Calendar Base';
         $table = 'tx_scheduler_task_group';
         $result = $GLOBALS['TYPO3_DB']->exec_INSERTquery($table, $insertFields);
         if (FALSE === $result) {
             throw new \RuntimeException('Could not write ' . $table . ' record to database: ' . $GLOBALS['TYPO3_DB']->sql_error(), 1431458142);
         }
         $uid = $GLOBALS['TYPO3_DB']->sql_insert_id();
         $task->setTaskGroup($uid);
     }
     $task->setDescription('Import of external calendar (calendar_id=' . $calendarUid . ')');
     /* Schedule the event */
     $execution = new \TYPO3\CMS\Scheduler\Execution();
     $execution->setStart(time() + $offset);
     $execution->setIsNewSingleExecution(true);
     $execution->setMultiple(true);
     $task->setExecution($execution);
     $scheduler->addTask($task);
     $GLOBALS['TYPO3_DB']->exec_UPDATEquery('tx_cal_calendar', 'uid=' . $calendarUid, array('schedulerId' => $task->getTaskUid()));
 }