ILIAS  release_8 Revision v8.25-1-g13de6a5eca6
ilCalendarCronRemoteReader Class Reference
+ Inheritance diagram for ilCalendarCronRemoteReader:
+ Collaboration diagram for ilCalendarCronRemoteReader:

Public Member Functions

 __construct ()
 
 getId ()
 
 getTitle ()
 
 getDescription ()
 
 hasAutoActivation ()
 Is to be activated on "installation", does only work for ILIAS core cron jobs. More...
 
 hasFlexibleSchedule ()
 
 addToExternalSettingsForm (int $a_form_id, array &$a_fields, bool $a_is_active)
 
 hasCustomSettings ()
 
 getDefaultScheduleType ()
 
 getDefaultScheduleValue ()
 
 run ()
 
- Public Member Functions inherited from ilCronJob
 setDateTimeProvider (?Closure $date_time_provider)
 
 isDue (?DateTimeImmutable $last_run, ?int $schedule_type, ?int $schedule_value, bool $is_manually_executed=false)
 
 getScheduleType ()
 Get current schedule type (if flexible) More...
 
 getScheduleValue ()
 Get current schedule value (if flexible) More...
 
 setSchedule (?int $a_type, ?int $a_value)
 Update current schedule (if flexible) More...
 
 getAllScheduleTypes ()
 Get all available schedule types. More...
 
 getScheduleTypesWithValues ()
 
 getValidScheduleTypes ()
 Returns a collection of all valid schedule types for a specific job. More...
 
 isManuallyExecutable ()
 
 hasCustomSettings ()
 
 addCustomSettingsToForm (ilPropertyFormGUI $a_form)
 
 saveCustomSettings (ilPropertyFormGUI $a_form)
 
 addToExternalSettingsForm (int $a_form_id, array &$a_fields, bool $a_is_active)
 
 activationWasToggled (ilDBInterface $db, ilSetting $setting, bool $a_currently_active)
 Important: This method is (also) called from the setup process, where the constructor of an ilCronJob ist NOT executed. More...
 
 getId ()
 
 getTitle ()
 
 getDescription ()
 
 hasAutoActivation ()
 Is to be activated on "installation", does only work for ILIAS core cron jobs. More...
 
 hasFlexibleSchedule ()
 
 getDefaultScheduleType ()
 
 getDefaultScheduleValue ()
 
 run ()
 

Private Attributes

const DEFAULT_SYNC_HOURS = 1
 
ilLanguage $lng
 
ilLogger $logger
 
ilCalendarSettings $calendar_settings = null
 

Additional Inherited Members

- Data Fields inherited from ilCronJob
const SCHEDULE_TYPE_DAILY = 1
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_IN_MINUTES = 2
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_IN_HOURS = 3
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_IN_DAYS = 4
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_WEEKLY = 5
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_MONTHLY = 6
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_QUARTERLY = 7
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_YEARLY = 8
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
- Protected Attributes inherited from ilCronJob
int $schedule_type = null
 
int $schedule_value = null
 
Closure $date_time_provider = null
 

Detailed Description

Definition at line 21 of file class.ilCalendarCronRemoteReader.php.

Constructor & Destructor Documentation

◆ __construct()

ilCalendarCronRemoteReader::__construct ( )

Definition at line 30 of file class.ilCalendarCronRemoteReader.php.

31 {
32 global $DIC;
33
34 $this->lng = $DIC->language();
35 $this->logger = $DIC->logger()->cal();
36 $this->calendar_settings = ilCalendarSettings::_getInstance();
37 }
global $DIC
Definition: feed.php:28

References $DIC, ilCalendarSettings\_getInstance(), ILIAS\Repository\lng(), and ILIAS\Repository\logger().

+ Here is the call graph for this function:

Member Function Documentation

◆ addToExternalSettingsForm()

ilCalendarCronRemoteReader::addToExternalSettingsForm ( int  $a_form_id,
array &  $a_fields,
bool  $a_is_active 
)

Reimplemented from ilCronJob.

Definition at line 66 of file class.ilCalendarCronRemoteReader.php.

66 : void
67 {
68 switch ($a_form_id) {
70 $a_fields['cal_webcal_sync'] = $a_is_active ?
71 $this->lng->txt('enabled') :
72 $this->lng->txt('disabled');
73 break;
74 }
75 }

References ilAdministrationSettingsFormHandler\FORM_CALENDAR, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getDefaultScheduleType()

ilCalendarCronRemoteReader::getDefaultScheduleType ( )

Reimplemented from ilCronJob.

Definition at line 82 of file class.ilCalendarCronRemoteReader.php.

82 : int
83 {
85 }
const SCHEDULE_TYPE_IN_HOURS
@depracated This will be replaced with an ENUM in ILIAS 9

References ilCronJob\SCHEDULE_TYPE_IN_HOURS.

◆ getDefaultScheduleValue()

ilCalendarCronRemoteReader::getDefaultScheduleValue ( )

Reimplemented from ilCronJob.

Definition at line 87 of file class.ilCalendarCronRemoteReader.php.

87 : ?int
88 {
89 if ($this->calendar_settings === null) {
91 }
92 return $this->calendar_settings->getWebCalSyncHours();
93 }

References DEFAULT_SYNC_HOURS.

◆ getDescription()

ilCalendarCronRemoteReader::getDescription ( )

Reimplemented from ilCronJob.

Definition at line 50 of file class.ilCalendarCronRemoteReader.php.

50 : string
51 {
52 $this->lng->loadLanguageModule('dateplaner');
53 return $this->lng->txt('cal_cronjob_remote_description');
54 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getId()

ilCalendarCronRemoteReader::getId ( )

Reimplemented from ilCronJob.

Definition at line 39 of file class.ilCalendarCronRemoteReader.php.

39 : string
40 {
41 return 'cal_remote_reader';
42 }

◆ getTitle()

ilCalendarCronRemoteReader::getTitle ( )

Reimplemented from ilCronJob.

Definition at line 44 of file class.ilCalendarCronRemoteReader.php.

44 : string
45 {
46 $this->lng->loadLanguageModule('dateplaner');
47 return $this->lng->txt('cal_cronjob_remote_title');
48 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ hasAutoActivation()

ilCalendarCronRemoteReader::hasAutoActivation ( )

Is to be activated on "installation", does only work for ILIAS core cron jobs.

Reimplemented from ilCronJob.

Definition at line 56 of file class.ilCalendarCronRemoteReader.php.

56 : bool
57 {
58 return false;
59 }

◆ hasCustomSettings()

ilCalendarCronRemoteReader::hasCustomSettings ( )

Reimplemented from ilCronJob.

Definition at line 77 of file class.ilCalendarCronRemoteReader.php.

77 : bool
78 {
79 return true;
80 }

◆ hasFlexibleSchedule()

ilCalendarCronRemoteReader::hasFlexibleSchedule ( )

Reimplemented from ilCronJob.

Definition at line 61 of file class.ilCalendarCronRemoteReader.php.

61 : bool
62 {
63 return true;
64 }

◆ run()

ilCalendarCronRemoteReader::run ( )

Reimplemented from ilCronJob.

Definition at line 95 of file class.ilCalendarCronRemoteReader.php.

96 {
98
99 $counter = 0;
100 foreach (ilCalendarCategories::lookupRemoteCalendars() as $remoteCalendar) {
102
103 $reader = new ilCalendarRemoteReader($remoteCalendar->getRemoteUrl());
104 $reader->setUser($remoteCalendar->getRemoteUser());
105 $reader->setPass($remoteCalendar->getRemotePass());
106 try {
107 $reader->read();
108 $reader->import($remoteCalendar);
109 } catch (Exception $e) {
110 $this->logger->warning('Remote Calendar: ' . $remoteCalendar->getCategoryID());
111 $this->logger->warning('Reading remote calendar failed with message: ' . $e->getMessage());
112 }
113 $remoteCalendar->setRemoteSyncLastExecution(new ilDateTime(time(), IL_CAL_UNIX));
114 $remoteCalendar->update();
116 ++$counter;
117 }
118 $result = new ilCronJobResult();
119 $result->setStatus($status);
120 return $result;
121 }
const IL_CAL_UNIX
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
@classDescription Date and time handling

References Vendor\Package\$e, IL_CAL_UNIX, ILIAS\Repository\logger(), ilCalendarCategories\lookupRemoteCalendars(), ilCronJobResult\STATUS_CRASHED, ilCronJobResult\STATUS_NO_ACTION, and ilCronJobResult\STATUS_OK.

+ Here is the call graph for this function:

Field Documentation

◆ $calendar_settings

ilCalendarSettings ilCalendarCronRemoteReader::$calendar_settings = null
private

Definition at line 28 of file class.ilCalendarCronRemoteReader.php.

◆ $lng

ilLanguage ilCalendarCronRemoteReader::$lng
private

Definition at line 25 of file class.ilCalendarCronRemoteReader.php.

◆ $logger

ilLogger ilCalendarCronRemoteReader::$logger
private

Definition at line 26 of file class.ilCalendarCronRemoteReader.php.

◆ DEFAULT_SYNC_HOURS

const ilCalendarCronRemoteReader::DEFAULT_SYNC_HOURS = 1
private

Definition at line 23 of file class.ilCalendarCronRemoteReader.php.

Referenced by getDefaultScheduleValue().


The documentation for this class was generated from the following file: