ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilCalendarCronRemoteReader Class Reference
+ Inheritance diagram for ilCalendarCronRemoteReader:
+ Collaboration diagram for ilCalendarCronRemoteReader:

Public Member Functions

 __construct ()
 
 getId ()
 
 getTitle ()
 
 getDescription ()
 
 hasAutoActivation ()
 
 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, ?CronJobScheduleType $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 (?CronJobScheduleType $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

- Protected Attributes inherited from ilCronJob
CronJobScheduleType $schedule_type = null
 
int $schedule_value = null
 
Closure $date_time_provider = null
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilCalendarCronRemoteReader::__construct ( )

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

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

33  {
34  global $DIC;
35 
36  $this->lng = $DIC->language();
37  $this->logger = $DIC->logger()->cal();
38  $this->calendar_settings = ilCalendarSettings::_getInstance();
39  }
global $DIC
Definition: shib_login.php:25
+ 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 
)

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

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

68  : void
69  {
70  switch ($a_form_id) {
72  $a_fields['cal_webcal_sync'] = $a_is_active ?
73  $this->lng->txt('enabled') :
74  $this->lng->txt('disabled');
75  break;
76  }
77  }
+ Here is the call graph for this function:

◆ getDefaultScheduleType()

ilCalendarCronRemoteReader::getDefaultScheduleType ( )

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

85  {
86  return \ILIAS\Cron\Schedule\CronJobScheduleType::SCHEDULE_TYPE_IN_MINUTES;
87  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ getDefaultScheduleValue()

ilCalendarCronRemoteReader::getDefaultScheduleValue ( )

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

89  : ?int
90  {
91  if ($this->calendar_settings === null) {
92  return self::DEFAULT_SYNC_HOURS;
93  }
94  return $this->calendar_settings->getWebCalSyncHours();
95  }

◆ getDescription()

ilCalendarCronRemoteReader::getDescription ( )

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

References ILIAS\Repository\lng().

52  : string
53  {
54  $this->lng->loadLanguageModule('dateplaner');
55  return $this->lng->txt('cal_cronjob_remote_description');
56  }
+ Here is the call graph for this function:

◆ getId()

ilCalendarCronRemoteReader::getId ( )

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

41  : string
42  {
43  return 'cal_remote_reader';
44  }

◆ getTitle()

ilCalendarCronRemoteReader::getTitle ( )

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

References ILIAS\Repository\lng().

46  : string
47  {
48  $this->lng->loadLanguageModule('dateplaner');
49  return $this->lng->txt('cal_cronjob_remote_title');
50  }
+ Here is the call graph for this function:

◆ hasAutoActivation()

ilCalendarCronRemoteReader::hasAutoActivation ( )

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

58  : bool
59  {
60  return false;
61  }

◆ hasCustomSettings()

ilCalendarCronRemoteReader::hasCustomSettings ( )

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

79  : bool
80  {
81  return true;
82  }

◆ hasFlexibleSchedule()

ilCalendarCronRemoteReader::hasFlexibleSchedule ( )

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

63  : bool
64  {
65  return true;
66  }

◆ run()

ilCalendarCronRemoteReader::run ( )

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

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

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

Field Documentation

◆ $calendar_settings

ilCalendarSettings ilCalendarCronRemoteReader::$calendar_settings = null
private

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

◆ $lng

ilLanguage ilCalendarCronRemoteReader::$lng
private

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

◆ $logger

ilLogger ilCalendarCronRemoteReader::$logger
private

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

◆ DEFAULT_SYNC_HOURS

const ilCalendarCronRemoteReader::DEFAULT_SYNC_HOURS = 1
private

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


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