ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilCronOerHarvester Class Reference

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

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

Public Member Functions

 __construct ()
 ilOerHarvester constructor. More...
 
 getTitle ()
 
 getDescription ()
 
 getId ()
 
 hasAutoActivation ()
 
 hasFlexibleSchedule ()
 
 getDefaultScheduleType ()
 
 getDefaultScheduleValue ()
 
 hasCustomSettings ()
 
 addCustomSettingsToForm (ilPropertyFormGUI $a_form)
 
 saveCustomSettings (ilPropertyFormGUI $a_form)
 
 run ()
 
 addToExternalSettingsForm ($a_form_id, array &$a_fields, $a_is_active)
 Provide external settings for presentation in MD settings. More...
 
- Public Member Functions inherited from ilCronJob
 isActive ($a_ts_last_run, $a_schedule_type, $a_schedule_value, $a_manual=false)
 Is job currently active? More...
 
 getScheduleType ()
 Get current schedule type (if flexible) More...
 
 getScheduleValue ()
 Get current schedule value (if flexible) More...
 
 setSchedule ($a_type, $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...
 
 getTitle ()
 Get title. More...
 
 getDescription ()
 Get description. More...
 
 isManuallyExecutable ()
 Defines whether or not a cron job can be started manually. More...
 
 hasCustomSettings ()
 Has cron job any custom setting which can be edited? More...
 
 addCustomSettingsToForm (ilPropertyFormGUI $a_form)
 Add custom settings to form. More...
 
 saveCustomSettings (ilPropertyFormGUI $a_form)
 Save custom settings. More...
 
 addToExternalSettingsForm ($a_form_id, array &$a_fields, $a_is_active)
 Add external settings to form. More...
 
 activationWasToggled ($a_currently_active)
 Cron job status was changed. More...
 
 getId ()
 Get id. More...
 
 hasAutoActivation ()
 Is to be activated on "installation". More...
 
 hasFlexibleSchedule ()
 Can the schedule be configured? More...
 
 getDefaultScheduleType ()
 Get schedule type. More...
 
 getDefaultScheduleValue ()
 Get schedule value. More...
 
 run ()
 Run job. More...
 

Data Fields

const CRON_JOB_IDENTIFIER = 'meta_oer_harvester'
 
const DEFAULT_SCHEDULE_VALUE = 1
 
- Data Fields inherited from ilCronJob
const SCHEDULE_TYPE_DAILY = 1
 
const SCHEDULE_TYPE_IN_MINUTES = 2
 
const SCHEDULE_TYPE_IN_HOURS = 3
 
const SCHEDULE_TYPE_IN_DAYS = 4
 
const SCHEDULE_TYPE_WEEKLY = 5
 
const SCHEDULE_TYPE_MONTHLY = 6
 
const SCHEDULE_TYPE_QUARTERLY = 7
 
const SCHEDULE_TYPE_YEARLY = 8
 

Private Attributes

 $logger = null
 
 $lng = null
 
 $settings = null
 

Additional Inherited Members

- Protected Member Functions inherited from ilCronJob
 checkSchedule ($a_ts_last_run, $a_schedule_type, $a_schedule_value)
 

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 ( )

ilOerHarvester constructor.

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

References $DIC, ilOerHarvesterSettings\getInstance(), and settings().

43  {
44  global $DIC;
45 
46  $this->logger = $DIC->logger()->meta();
47  $this->lng = $DIC->language();
48  $this->lng->loadLanguageModule('meta');
49 
51  }
settings()
Definition: settings.php:2
global $DIC
Definition: saml.php:7
+ Here is the call graph for this function:

Member Function Documentation

◆ addCustomSettingsToForm()

ilCronOerHarvester::addCustomSettingsToForm ( ilPropertyFormGUI  $a_form)
Parameters
ilPropertyFormGUI$a_form

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

References $target, ilMDCopyrightSelectionEntry\_getEntries(), ilPropertyFormGUI\addItem(), ilFormPropertyGUI\setRequired(), and settings().

123  {
124  // target selection
126  $this->lng->txt('meta_oer_target'),
127  'target',
128  false
129  );
130 
131  $explorer = $target->getExplorerGUI();
132  $explorer->setSelectMode('target', false);
133  $explorer->setRootId(ROOT_FOLDER_ID);
134  $explorer->setTypeWhiteList(['cat']);
135 
136  if ($this->settings->getTarget()) {
137  $explorer->setPathOpen($this->settings->getTarget());
138  $target->setValue($this->settings->getTarget());
139  }
140 
141  $target->setRequired(true);
142  $a_form->addItem($target);
143 
144 
145  // copyright selection
146  $checkbox_group = new ilCheckboxGroupInputGUI(
147  $this->lng->txt('meta_oer_copyright_selection'),
148  'copyright'
149  );
150  $checkbox_group->setRequired(true);
151  $checkbox_group->setValue($this->settings->getCopyrightTemplates());
152  $checkbox_group->setInfo(
153  $this->lng->txt('meta_oer_copyright_selection_info')
154  );
155 
156  foreach (ilMDCopyrightSelectionEntry::_getEntries() as $copyright_entry) {
157  $copyright_checkox = new ilCheckboxOption(
158  $copyright_entry->getTitle(),
159  $copyright_entry->getEntryId(),
160  $copyright_entry->getDescription()
161  );
162  $checkbox_group->addOption($copyright_checkox);
163  }
164  $a_form->addItem($checkbox_group);
165  return $a_form;
166  }
settings()
Definition: settings.php:2
This class represents an option in a checkbox group.
addItem($a_item)
Add Item (Property, SectionHeader).
This class represents a property in a property form.
$target
Definition: test.php:19
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:

◆ addToExternalSettingsForm()

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

Provide external settings for presentation in MD settings.

Parameters
int$a_form_id
array$a_fields
bool$a_is_active

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

References $DIC, $lng, and ilAdministrationSettingsFormHandler\FORM_META_COPYRIGHT.

203  {
204  #23901
205  global $DIC;
206  $lng = $DIC->language();
207 
208  switch ($a_form_id) {
210 
211  $a_fields['meta_oer_harvester'] =
212  (
213  $a_is_active ?
214  $lng->txt('enabled') :
215  $lng->txt('disabled')
216  );
217  break;
218  }
219  }
global $DIC
Definition: saml.php:7

◆ getDefaultScheduleType()

ilCronOerHarvester::getDefaultScheduleType ( )

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

98  {
99  return self::SCHEDULE_TYPE_DAILY;
100  }

◆ getDefaultScheduleValue()

ilCronOerHarvester::getDefaultScheduleValue ( )

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

106  {
107  return self::DEFAULT_SCHEDULE_VALUE;
108  }

◆ getDescription()

ilCronOerHarvester::getDescription ( )

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

65  {
66  return $this->lng->txt('meta_oer_harvester_desc');
67  }

◆ getId()

ilCronOerHarvester::getId ( )

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

73  {
74  return self::CRON_JOB_IDENTIFIER;
75  }

◆ getTitle()

ilCronOerHarvester::getTitle ( )

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

57  {
58  return $this->lng->txt('meta_oer_harvester');
59  }

◆ hasAutoActivation()

ilCronOerHarvester::hasAutoActivation ( )

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

82  {
83  return false;
84  }

◆ hasCustomSettings()

ilCronOerHarvester::hasCustomSettings ( )

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

115  {
116  return true;
117  }

◆ hasFlexibleSchedule()

ilCronOerHarvester::hasFlexibleSchedule ( )

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

90  {
91  return true;
92  }

◆ run()

ilCronOerHarvester::run ( )

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

References $res.

186  {
187  $this->logger->info('Started cron oer harvester.');
188  $harvester = new ilOerHarvester(new ilCronJobResult());
189  $res = $harvester->run();
190  $this->logger->info('cron oer harvester finished');
191 
192  return $res;
193  }
Cron job for definition for oer harvesting.
foreach($_POST as $key=> $value) $res
Cron job result data container.

◆ saveCustomSettings()

ilCronOerHarvester::saveCustomSettings ( ilPropertyFormGUI  $a_form)
Parameters
\ilPropertyFormGUI$a_form
Returns
bool|void

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

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

174  {
175  $this->settings->setTarget($a_form->getInput('target'));
176  $this->settings->setCopyrightTemplates($a_form->getInput('copyright'));
177  $this->settings->save();
178 
179  return true;
180  }
settings()
Definition: settings.php:2
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilCronOerHarvester::$lng = null
private

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

Referenced by addToExternalSettingsForm().

◆ $logger

ilCronOerHarvester::$logger = null
private

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

◆ $settings

ilCronOerHarvester::$settings = null
private

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

◆ CRON_JOB_IDENTIFIER

const ilCronOerHarvester::CRON_JOB_IDENTIFIER = 'meta_oer_harvester'
Parameters
string

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

◆ DEFAULT_SCHEDULE_VALUE

const ilCronOerHarvester::DEFAULT_SCHEDULE_VALUE = 1
Parameters
int

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


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