ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
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, ?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
 This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_IN_MINUTES = 2
 This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_IN_HOURS = 3
 This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_IN_DAYS = 4
 This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_WEEKLY = 5
 This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_MONTHLY = 6
 This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_QUARTERLY = 7
 This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_YEARLY = 8
 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.

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

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
+ 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 66 of file class.ilCalendarCronRemoteReader.php.

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

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  }
+ Here is the call graph for this function:

◆ getDefaultScheduleType()

ilCalendarCronRemoteReader::getDefaultScheduleType ( )

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

82  : int
83  {
84  return self::SCHEDULE_TYPE_IN_HOURS;
85  }

◆ getDefaultScheduleValue()

ilCalendarCronRemoteReader::getDefaultScheduleValue ( )

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

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

◆ getDescription()

ilCalendarCronRemoteReader::getDescription ( )

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

References ILIAS\Repository\lng().

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

◆ getId()

ilCalendarCronRemoteReader::getId ( )

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

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

◆ getTitle()

ilCalendarCronRemoteReader::getTitle ( )

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

References ILIAS\Repository\lng().

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

◆ hasAutoActivation()

ilCalendarCronRemoteReader::hasAutoActivation ( )

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

56  : bool
57  {
58  return false;
59  }

◆ hasCustomSettings()

ilCalendarCronRemoteReader::hasCustomSettings ( )

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

77  : bool
78  {
79  return true;
80  }

◆ hasFlexibleSchedule()

ilCalendarCronRemoteReader::hasFlexibleSchedule ( )

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

61  : bool
62  {
63  return true;
64  }

◆ run()

ilCalendarCronRemoteReader::run ( )

Definition at line 95 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.

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();
115  $status = ilCronJobResult::STATUS_OK;
116  ++$counter;
117  }
118  $result = new ilCronJobResult();
119  $result->setStatus($status);
120  return $result;
121  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const IL_CAL_UNIX
+ 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.


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