ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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, ?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 ()
 

Data Fields

const CRON_JOB_IDENTIFIER = 'meta_oer_harvester'
 
const DEFAULT_SCHEDULE_VALUE = 1
 

Private Attributes

ilLogger $logger
 
ilLanguage $lng
 
ilOerHarvesterSettings $settings
 

Additional Inherited Members

- Protected Attributes inherited from ilCronJob
CronJobScheduleType $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 13 of file class.ilCronOerHarvester.php.

Constructor & Destructor Documentation

◆ __construct()

ilCronOerHarvester::__construct ( )

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

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

24  {
25  global $DIC;
26 
27  $this->logger = $DIC->logger()->meta();
28  $this->lng = $DIC->language();
29  $this->lng->loadLanguageModule('meta');
30 
32  }
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 74 of file class.ilCronOerHarvester.php.

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

74  : void
75  {
76  // target selection
77  $target = new ilRepositorySelector2InputGUI(
78  $this->lng->txt('meta_oer_target'),
79  'target',
80  false,
81  $a_form
82  );
83 
84  $explorer = $target->getExplorerGUI();
85  $explorer->setSelectMode('target', false);
86  $explorer->setRootId(ROOT_FOLDER_ID);
87  $explorer->setTypeWhiteList(['cat']);
88 
89  if ($this->settings->getTarget()) {
90  $explorer->setPathOpen($this->settings->getTarget());
91  $target->setValue($this->settings->getTarget());
92  }
93 
94  $target->setRequired(true);
95  $a_form->addItem($target);
96 
97  // copyright selection
98  $checkbox_group = new ilCheckboxGroupInputGUI(
99  $this->lng->txt('meta_oer_copyright_selection'),
100  'copyright'
101  );
102  $checkbox_group->setValue($this->settings->getCopyrightTemplates());
103  $checkbox_group->setInfo(
104  $this->lng->txt('meta_oer_copyright_selection_info')
105  );
106 
107  foreach (ilMDCopyrightSelectionEntry::_getEntries() as $copyright_entry) {
108  $copyright_checkox = new ilCheckboxOption(
109  $copyright_entry->getTitle(),
110  (string) $copyright_entry->getEntryId(),
111  $copyright_entry->getDescription()
112  );
113  $checkbox_group->addOption($copyright_checkox);
114  }
115  $a_form->addItem($checkbox_group);
116  }
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...
+ 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 137 of file class.ilCronOerHarvester.php.

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

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

◆ getDefaultScheduleType()

ilCronOerHarvester::getDefaultScheduleType ( )

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

60  {
61  return CronJobScheduleType::SCHEDULE_TYPE_DAILY;
62  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ getDefaultScheduleValue()

ilCronOerHarvester::getDefaultScheduleValue ( )

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

64  : ?int
65  {
66  return self::DEFAULT_SCHEDULE_VALUE;
67  }

◆ getDescription()

ilCronOerHarvester::getDescription ( )

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

References ILIAS\Repository\lng().

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

◆ getId()

ilCronOerHarvester::getId ( )

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

44  : string
45  {
46  return self::CRON_JOB_IDENTIFIER;
47  }

◆ getTitle()

ilCronOerHarvester::getTitle ( )

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

References ILIAS\Repository\lng().

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

◆ hasAutoActivation()

ilCronOerHarvester::hasAutoActivation ( )

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

49  : bool
50  {
51  return false;
52  }

◆ hasCustomSettings()

ilCronOerHarvester::hasCustomSettings ( )

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

69  : bool
70  {
71  return true;
72  }

◆ hasFlexibleSchedule()

ilCronOerHarvester::hasFlexibleSchedule ( )

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

54  : bool
55  {
56  return true;
57  }

◆ run()

ilCronOerHarvester::run ( )

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

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

128  {
129  $this->logger->info('Started cron oer harvester.');
130  $harvester = new ilOerHarvester(new ilCronJobResult());
131  $res = $harvester->run();
132  $this->logger->info('cron oer harvester finished');
133 
134  return $res;
135  }
$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 118 of file class.ilCronOerHarvester.php.

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

118  : bool
119  {
120  $this->settings->setTarget((int) $a_form->getInput('target'));
121  $this->settings->setCopyrightTemplates($a_form->getInput('copyright'));
122  $this->settings->save();
123 
124  return true;
125  }
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 19 of file class.ilCronOerHarvester.php.

◆ $logger

ilLogger ilCronOerHarvester::$logger
private

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

◆ $settings

ilOerHarvesterSettings ilCronOerHarvester::$settings
private

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

◆ CRON_JOB_IDENTIFIER

const ilCronOerHarvester::CRON_JOB_IDENTIFIER = 'meta_oer_harvester'

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

◆ DEFAULT_SCHEDULE_VALUE

const ilCronOerHarvester::DEFAULT_SCHEDULE_VALUE = 1

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


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