ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilCronOerHarvester Class Reference

Cron job for definition for oer harvesting. More...

+ Inheritance diagram for ilCronOerHarvester:
+ Collaboration diagram for ilCronOerHarvester:

Public Member Functions

 __construct ()
 
 getTitle ()
 
 getDescription ()
 
 getId ()
 
 hasAutoActivation ()
 
 hasFlexibleSchedule ()
 
 getDefaultScheduleType ()
 
 getDefaultScheduleValue ()
 
 hasCustomSettings ()
 
 addCustomSettingsToForm (ilPropertyFormGUI $a_form)
 
 saveCustomSettings (ilPropertyFormGUI $a_form)
 
 run ()
 
 addToExternalSettingsForm (int $a_form_id, array &$a_fields, bool $a_is_active)
 
- 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 ()
 

Data Fields

const CRON_JOB_IDENTIFIER = 'meta_oer_harvester'
 
const DEFAULT_SCHEDULE_VALUE = 1
 
- 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...
 

Private Attributes

ilLogger $logger
 
ilLanguage $lng
 
ilOerHarvesterSettings $settings
 

Additional Inherited Members

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

Detailed Description

Cron job for definition for oer harvesting.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

Definition at line 11 of file class.ilCronOerHarvester.php.

Constructor & Destructor Documentation

◆ __construct()

ilCronOerHarvester::__construct ( )

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

References $DIC, ilOerHarvesterSettings\getInstance(), ILIAS\Repository\lng(), ILIAS\Repository\logger(), and ILIAS\Repository\settings().

22  {
23  global $DIC;
24 
25  $this->logger = $DIC->logger()->meta();
26  $this->lng = $DIC->language();
27  $this->lng->loadLanguageModule('meta');
28 
30  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ addCustomSettingsToForm()

ilCronOerHarvester::addCustomSettingsToForm ( ilPropertyFormGUI  $a_form)

Definition at line 72 of file class.ilCronOerHarvester.php.

References ilMDCopyrightSelectionEntry\_getEntries(), ilPropertyFormGUI\addItem(), ilRepositorySelector2InputGUI\getExplorerGUI(), ILIAS\Repository\lng(), ROOT_FOLDER_ID, ilFormPropertyGUI\setRequired(), ILIAS\Repository\settings(), and ilExplorerSelectInputGUI\setValue().

72  : void
73  {
74  // target selection
75  $target = new ilRepositorySelector2InputGUI(
76  $this->lng->txt('meta_oer_target'),
77  'target',
78  false,
79  $a_form
80  );
81 
82  $explorer = $target->getExplorerGUI();
83  $explorer->setSelectMode('target', false);
84  $explorer->setRootId(ROOT_FOLDER_ID);
85  $explorer->setTypeWhiteList(['cat']);
86 
87  if ($this->settings->getTarget()) {
88  $explorer->setPathOpen($this->settings->getTarget());
89  $target->setValue($this->settings->getTarget());
90  }
91 
92  $target->setRequired(true);
93  $a_form->addItem($target);
94 
95  // copyright selection
96  $checkbox_group = new ilCheckboxGroupInputGUI(
97  $this->lng->txt('meta_oer_copyright_selection'),
98  'copyright'
99  );
100  $checkbox_group->setRequired(true);
101  $checkbox_group->setValue($this->settings->getCopyrightTemplates());
102  $checkbox_group->setInfo(
103  $this->lng->txt('meta_oer_copyright_selection_info')
104  );
105 
106  foreach (ilMDCopyrightSelectionEntry::_getEntries() as $copyright_entry) {
107  $copyright_checkox = new ilCheckboxOption(
108  $copyright_entry->getTitle(),
109  (string) $copyright_entry->getEntryId(),
110  $copyright_entry->getDescription()
111  );
112  $checkbox_group->addOption($copyright_checkox);
113  }
114  $a_form->addItem($checkbox_group);
115  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const ROOT_FOLDER_ID
Definition: constants.php:32
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setRequired(bool $a_required)
+ Here is the call graph for this function:

◆ addToExternalSettingsForm()

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

Definition at line 136 of file class.ilCronOerHarvester.php.

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

136  : void
137  {
138  switch ($a_form_id) {
140 
141  $a_fields['meta_oer_harvester'] =
142  (
143  $a_is_active ?
144  $this->lng->txt('enabled') :
145  $this->lng->txt('disabled')
146  );
147  break;
148  }
149  }
+ Here is the call graph for this function:

◆ getDefaultScheduleType()

ilCronOerHarvester::getDefaultScheduleType ( )

Definition at line 57 of file class.ilCronOerHarvester.php.

57  : int
58  {
59  return self::SCHEDULE_TYPE_DAILY;
60  }

◆ getDefaultScheduleValue()

ilCronOerHarvester::getDefaultScheduleValue ( )

Definition at line 62 of file class.ilCronOerHarvester.php.

62  : ?int
63  {
64  return self::DEFAULT_SCHEDULE_VALUE;
65  }

◆ getDescription()

ilCronOerHarvester::getDescription ( )

Definition at line 37 of file class.ilCronOerHarvester.php.

References ILIAS\Repository\lng().

37  : string
38  {
39  return $this->lng->txt('meta_oer_harvester_desc');
40  }
+ Here is the call graph for this function:

◆ getId()

ilCronOerHarvester::getId ( )

Definition at line 42 of file class.ilCronOerHarvester.php.

42  : string
43  {
44  return self::CRON_JOB_IDENTIFIER;
45  }

◆ getTitle()

ilCronOerHarvester::getTitle ( )

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

References ILIAS\Repository\lng().

32  : string
33  {
34  return $this->lng->txt('meta_oer_harvester');
35  }
+ Here is the call graph for this function:

◆ hasAutoActivation()

ilCronOerHarvester::hasAutoActivation ( )

Definition at line 47 of file class.ilCronOerHarvester.php.

47  : bool
48  {
49  return false;
50  }

◆ hasCustomSettings()

ilCronOerHarvester::hasCustomSettings ( )

Definition at line 67 of file class.ilCronOerHarvester.php.

67  : bool
68  {
69  return true;
70  }

◆ hasFlexibleSchedule()

ilCronOerHarvester::hasFlexibleSchedule ( )

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

52  : bool
53  {
54  return true;
55  }

◆ run()

ilCronOerHarvester::run ( )

Definition at line 126 of file class.ilCronOerHarvester.php.

References $res, and ILIAS\Repository\logger().

127  {
128  $this->logger->info('Started cron oer harvester.');
129  $harvester = new ilOerHarvester(new ilCronJobResult());
130  $res = $harvester->run();
131  $this->logger->info('cron oer harvester finished');
132 
133  return $res;
134  }
$res
Definition: ltiservices.php:69
Cron job for definition for oer harvesting.
+ Here is the call graph for this function:

◆ saveCustomSettings()

ilCronOerHarvester::saveCustomSettings ( ilPropertyFormGUI  $a_form)

Definition at line 117 of file class.ilCronOerHarvester.php.

References ilPropertyFormGUI\getInput(), and ILIAS\Repository\settings().

117  : bool
118  {
119  $this->settings->setTarget((int) $a_form->getInput('target'));
120  $this->settings->setCopyrightTemplates($a_form->getInput('copyright'));
121  $this->settings->save();
122 
123  return true;
124  }
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilLanguage ilCronOerHarvester::$lng
private

Definition at line 17 of file class.ilCronOerHarvester.php.

◆ $logger

ilLogger ilCronOerHarvester::$logger
private

Definition at line 16 of file class.ilCronOerHarvester.php.

◆ $settings

ilOerHarvesterSettings ilCronOerHarvester::$settings
private

Definition at line 19 of file class.ilCronOerHarvester.php.

◆ CRON_JOB_IDENTIFIER

const ilCronOerHarvester::CRON_JOB_IDENTIFIER = 'meta_oer_harvester'

Definition at line 13 of file class.ilCronOerHarvester.php.

◆ DEFAULT_SCHEDULE_VALUE

const ilCronOerHarvester::DEFAULT_SCHEDULE_VALUE = 1

Definition at line 14 of file class.ilCronOerHarvester.php.


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