19 declare(strict_types=1);
46 $this->
logger = $DIC->logger()->meta();
47 $this->
lng = $DIC->language();
48 $this->
lng->loadLanguageModule(
'meta');
51 $this->
settings = $this->initiator->settings();
56 return $this->
lng->txt(
'meta_oer_harvester');
61 return $this->
lng->txt(
'meta_oer_harvester_desc');
66 return self::CRON_JOB_IDENTIFIER;
81 return JobScheduleType::DAILY;
86 return self::DEFAULT_SCHEDULE_VALUE;
98 $header->setTitle($this->
lng->txt(
'meta_oer_categories'));
102 $this->
lng->txt(
'meta_oer_target'),
108 $explorer = $target->getExplorerGUI();
110 $explorer->setTypeWhiteList([
'cat']);
112 $target_ref_id = $this->
settings->getContainerRefIDForHarvesting();
113 if ($target_ref_id) {
114 $explorer->setPathOpen($target_ref_id);
118 $target->setRequired(
true);
123 $this->
lng->txt(
'meta_oer_exposed_source'),
129 $ex_explorer = $ex_target->getExplorerGUI();
131 $ex_explorer->setTypeWhiteList([
'cat']);
133 $ex_target_ref_id = $this->
settings->getContainerRefIDForExposing();
134 if ($ex_target_ref_id) {
135 $ex_explorer->setPathOpen($ex_target_ref_id);
136 $ex_target->
setValue($ex_target_ref_id);
139 $ex_target->setRequired(
true);
144 $header->setTitle($this->
lng->txt(
'meta_oer_harvested_licences'));
148 $this->
lng->txt(
'meta_oer_copyright_selection'),
152 $checkbox_group->setValue($this->
settings->getCopyrightEntryIDsSelectedForHarvesting());
153 $checkbox_group->setInfo(
154 $this->
lng->txt(
'meta_oer_copyright_selection_info')
157 foreach ($this->initiator->copyrightRepository()->getAllEntries() as $copyright_entry) {
159 $copyright_entry->title(),
160 (string) $copyright_entry->id(),
161 $copyright_entry->description()
163 $checkbox_group->addOption($copyright_checkox);
165 $a_form->
addItem($checkbox_group);
169 $header->setTitle($this->
lng->txt(
'meta_oer_harvested_types'));
173 $this->
lng->txt(
'meta_oer_object_type_selection'),
177 $checkbox_group->setValue($this->
settings->getObjectTypesSelectedForHarvesting());
179 foreach ($this->
settings->getObjectTypesEligibleForHarvesting() as $type) {
181 $this->
lng->txt(
'objs_' . $type),
184 $checkbox_group->addOption($copyright_checkox);
186 $a_form->
addItem($checkbox_group);
193 $copyrights[] = (
int)
$id;
196 $this->
settings->saveContainerRefIDForHarvesting((
int) $a_form->
getInput(
'target'));
197 $this->
settings->saveContainerRefIDForExposing((
int) $a_form->
getInput(
'exposed_source'));
198 $this->
settings->saveCopyrightEntryIDsSelectedForHarvesting(...$copyrights);
199 $this->
settings->saveObjectTypesSelectedForHarvesting(...$a_form->
getInput(
'object_type'));
205 $this->
logger->info(
'Started cron oer harvester.');
206 $harvester = $this->initiator->harvester();
208 $this->
logger->info(
'cron oer harvester finished');
215 switch ($a_form_id) {
218 $a_fields[
'meta_oer_harvester'] =
221 $this->
lng->txt(
'enabled') :
222 $this->
lng->txt(
'disabled')
SettingsInterface $settings
const int DEFAULT_SCHEDULE_VALUE
This class represents an option in a checkbox group.
addCustomSettingsToForm(ilPropertyFormGUI $a_form)
Cron job for definition for oer harvesting.
const string CRON_JOB_IDENTIFIER
addToExternalSettingsForm(int $a_form_id, array &$a_fields, bool $a_is_active)
saveCustomSettings(ilPropertyFormGUI $a_form)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
getDefaultScheduleValue()