19 declare(strict_types=1);
44 $this->
logger = $DIC->logger()->meta();
45 $this->
lng = $DIC->language();
46 $this->
lng->loadLanguageModule(
'meta');
49 $this->
settings = $this->initiator->settings();
54 return $this->
lng->txt(
'meta_oer_harvester');
59 return $this->
lng->txt(
'meta_oer_harvester_desc');
64 return self::CRON_JOB_IDENTIFIER;
79 return CronJobScheduleType::SCHEDULE_TYPE_DAILY;
84 return self::DEFAULT_SCHEDULE_VALUE;
96 $header->setTitle($this->
lng->txt(
'meta_oer_categories'));
100 $this->
lng->txt(
'meta_oer_target'),
106 $explorer = $target->getExplorerGUI();
108 $explorer->setTypeWhiteList([
'cat']);
110 $target_ref_id = $this->
settings->getContainerRefIDForHarvesting();
111 if ($target_ref_id) {
112 $explorer->setPathOpen($target_ref_id);
116 $target->setRequired(
true);
121 $this->
lng->txt(
'meta_oer_exposed_source'),
127 $ex_explorer = $ex_target->getExplorerGUI();
129 $ex_explorer->setTypeWhiteList([
'cat']);
131 $ex_target_ref_id = $this->
settings->getContainerRefIDForExposing();
132 if ($ex_target_ref_id) {
133 $ex_explorer->setPathOpen($ex_target_ref_id);
134 $ex_target->
setValue($ex_target_ref_id);
137 $ex_target->setRequired(
true);
142 $header->setTitle($this->
lng->txt(
'meta_oer_harvested_licences'));
146 $this->
lng->txt(
'meta_oer_copyright_selection'),
149 $checkbox_group->
setValue($this->
settings->getCopyrightEntryIDsSelectedForHarvesting());
150 $checkbox_group->setInfo(
151 $this->
lng->txt(
'meta_oer_copyright_selection_info')
154 foreach ($this->initiator->copyrightRepository()->getAllEntries() as $copyright_entry) {
156 $copyright_entry->title(),
157 (string) $copyright_entry->id(),
158 $copyright_entry->description()
160 $checkbox_group->addOption($copyright_checkox);
162 $a_form->
addItem($checkbox_group);
166 $header->setTitle($this->
lng->txt(
'meta_oer_harvested_types'));
170 $this->
lng->txt(
'meta_oer_object_type_selection'),
174 $checkbox_group->setValue($this->
settings->getObjectTypesSelectedForHarvesting());
176 foreach ($this->
settings->getObjectTypesEligibleForHarvesting() as $type) {
178 $this->
lng->txt(
'objs_' . $type),
181 $checkbox_group->addOption($copyright_checkox);
183 $a_form->
addItem($checkbox_group);
190 $copyrights[] = (
int)
$id;
193 $this->
settings->saveContainerRefIDForHarvesting((
int) $a_form->
getInput(
'target'));
194 $this->
settings->saveContainerRefIDForExposing((
int) $a_form->
getInput(
'exposed_source'));
195 $this->
settings->saveCopyrightEntryIDsSelectedForHarvesting(...$copyrights);
196 $this->
settings->saveObjectTypesSelectedForHarvesting(...$a_form->
getInput(
'object_type'));
202 $this->
logger->info(
'Started cron oer harvester.');
203 $harvester = $this->initiator->harvester();
205 $this->
logger->info(
'cron oer harvester finished');
212 switch ($a_form_id) {
215 $a_fields[
'meta_oer_harvester'] =
218 $this->
lng->txt(
'enabled') :
219 $this->
lng->txt(
'disabled')
const CRON_JOB_IDENTIFIER
SettingsInterface $settings
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...
addCustomSettingsToForm(ilPropertyFormGUI $a_form)
Cron job for definition for oer harvesting.
addToExternalSettingsForm(int $a_form_id, array &$a_fields, bool $a_is_active)
saveCustomSettings(ilPropertyFormGUI $a_form)
const DEFAULT_SCHEDULE_VALUE
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
getDefaultScheduleValue()