19declare(strict_types=1);
51 $this->
ctrl = $DIC->ctrl();
52 $this->
lng = $DIC->language();
53 $this->tpl =
$DIC->ui()->mainTemplate();
54 $this->cron_manager =
$DIC->cron()->manager();
55 $this->ui_factory =
$DIC->ui()->factory();
56 $this->ui_renderer =
$DIC->ui()->renderer();
60 $this->parent_obj_gui->getRefId(),
66 $this->publishing_settings = $internal->OERHarvester()->settings();
67 $this->copyright_repo = $internal->copyright()->repository();
69 $this->
lng->loadLanguageModule(
"meta");
74 $next_class = $this->
ctrl->getNextClass($this);
75 $cmd = $this->
ctrl->getCmd();
78 !$this->access_service->hasCurrentUserReadAccess()
83 switch ($next_class) {
84 case strtolower(ilPropertyFormGUI::class):
86 $this->
ctrl->forwardCommand($form);
90 if (!$cmd || $cmd ===
'view') {
91 $cmd =
'showPublishingSettings';
94 case 'showPublishingSettings':
98 case 'savePublishingSettings':
115 $this->tpl->setContent(
116 $this->ui_renderer->render($message_box) .
123 if (!$this->access_service->hasCurrentUserWriteAccess()) {
124 $this->
ctrl->redirect($this,
'showPublishingSettings');
127 if ($form->checkInput()) {
129 foreach ($form->getInput(
'copyright') as
$id) {
130 $copyrights[] = (
int)
$id;
133 $modes = $form->getInput(
'mode');
134 $this->publishing_settings->saveManualPublishingEnabled(in_array(
'manual', $modes));
135 $this->publishing_settings->saveAutomaticPublishingEnabled(in_array(
'automatic', $modes));
137 $editorial_step_enabled = (bool) $form->getInput(
'editorial_step');
138 $this->publishing_settings->saveEditorialStepEnabled($editorial_step_enabled);
139 if ($editorial_step_enabled) {
140 $this->publishing_settings->saveContainerRefIDForEditorialStep((
int) $form->getInput(
'target'));
143 $this->publishing_settings->saveContainerRefIDForPublishing((
int) $form->getInput(
'exposed_source'));
144 $this->publishing_settings->saveCopyrightEntryIDsSelectedForPublishing(...$copyrights);
145 $this->publishing_settings->saveObjectTypesSelectedForPublishing(...$form->getInput(
'object_type'));
146 $this->
MDSettings()->activateOAIPMH((
bool) $form->getInput(
'oai_active'));
147 $this->
MDSettings()->saveOAIRepositoryName((
string) $form->getInput(
'oai_repository_name'));
148 $this->
MDSettings()->saveOAIIdentifierPrefix((
string) $form->getInput(
'oai_identifier_prefix'));
149 $this->
MDSettings()->saveOAIContactMail((
string) $form->getInput(
'oai_contact_mail'));
150 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
151 $this->
ctrl->redirect($this,
'showPublishingSettings');
153 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'),
true);
154 $form->setValuesByPost();
164 $form->setFormAction($this->
ctrl->getFormAction($this));
166 if ($this->access_service->hasCurrentUserWriteAccess()) {
167 $form->addCommandButton(
'savePublishingSettings', $this->
lng->txt(
'save'));
185 $header->setTitle($this->
lng->txt(
'md_publishing_workflow'));
190 $this->
lng->txt(
'md_publishing_workflow_mode'),
193 $mode->setInfo($this->
lng->txt(
'md_publishing_workflow_mode_info'));
196 $this->
lng->txt(
'md_publishing_workflow_manual'),
198 $this->lng->txt(
'md_publishing_workflow_manual_info')
200 if ($this->publishing_settings->isManualPublishingEnabled()) {
201 $checked[] =
'manual';
203 $mode->addOption($manual_checkbox);
205 $this->
lng->txt(
'md_publishing_workflow_automatic'),
207 $this->lng->txt(
'md_publishing_workflow_automatic_info')
209 if ($this->publishing_settings->isAutomaticPublishingEnabled()) {
210 $checked[] =
'automatic';
212 $mode->addOption($automatic_checkbox);
213 $mode->setValue($checked);
218 $this->
lng->txt(
'meta_oer_exposed_source'),
224 $ex_explorer = $ex_target->getExplorerGUI();
226 $ex_explorer->setTypeWhiteList([
'cat']);
228 $ex_target_ref_id = $this->publishing_settings->getContainerRefIDForPublishing();
229 if ($ex_target_ref_id) {
230 $ex_explorer->setPathOpen($ex_target_ref_id);
231 $ex_target->setValue($ex_target_ref_id);
234 $ex_target->setRequired(
true);
239 $this->
lng->txt(
'meta_oer_editorial_step_toggle'),
242 $checkbox->setInfo($this->
lng->txt(
'meta_oer_editorial_step_info'));
243 $checkbox->setChecked($this->publishing_settings->isEditorialStepEnabled());
247 $this->
lng->txt(
'meta_oer_editorial_category'),
253 $explorer = $target->getExplorerGUI();
255 $explorer->setTypeWhiteList([
'cat']);
257 $target_ref_id = $this->publishing_settings->getContainerRefIDForEditorialStep();
258 if ($target_ref_id) {
259 $explorer->setPathOpen($target_ref_id);
260 $target->setValue($target_ref_id);
263 $target->setRequired(
true);
264 $checkbox->addSubItem($target);
270 $header->setTitle($this->
lng->txt(
'meta_oer_harvested_licences'));
274 $this->
lng->txt(
'meta_oer_copyright_selection'),
277 $checkbox_group->setValue($this->publishing_settings->getCopyrightEntryIDsSelectedForPublishing());
278 $checkbox_group->setInfo(
279 $this->
lng->txt(
'meta_oer_copyright_selection_info')
282 foreach ($this->copyright_repo->getAllEntries() as $copyright_entry) {
283 if ($copyright_entry->isDefault()) {
287 $copyright_entry->title(),
288 (
string) $copyright_entry->id(),
289 $copyright_entry->description()
291 $checkbox_group->addOption($copyright_checkbox);
293 $checkbox_group->setRequired(
true);
294 $form->
addItem($checkbox_group);
300 $header->setTitle($this->
lng->txt(
'meta_oer_harvested_types'));
304 $this->
lng->txt(
'meta_oer_object_type_selection'),
307 $checkbox_group->setRequired(
true);
308 $checkbox_group->setValue($this->publishing_settings->getObjectTypesSelectedForPublishing());
310 foreach ($this->publishing_settings->getObjectTypesEligibleForPublishing() as $type) {
312 $this->
lng->txt(
'objs_' . $type),
315 $checkbox_group->addOption($type_checkbox);
317 $form->
addItem($checkbox_group);
323 $header->setTitle($this->
lng->txt(
'md_settings_publishing'));
327 $oai_check->setChecked($this->
MDSettings()->isOAIPMHActive());
328 $oai_check->setValue(
'1');
329 $oai_check->setInfo($this->
lng->txt(
'md_oai_pmh_enabled_info'));
332 $oai_repo_name =
new ilTextInputGUI($this->
lng->txt(
'md_oai_repository_name'),
'oai_repository_name');
333 $oai_repo_name->setValue($this->
MDSettings()->getOAIRepositoryName());
334 $oai_repo_name->setInfo($this->
lng->txt(
'md_oai_repository_name_info'));
335 $oai_repo_name->setRequired(
true);
336 $oai_check->addSubItem($oai_repo_name);
338 $oai_id_prefix =
new ilTextInputGUI($this->
lng->txt(
'md_oai_identifier_prefix'),
'oai_identifier_prefix');
339 $oai_id_prefix->setValue($this->
MDSettings()->getOAIIdentifierPrefix());
340 $oai_id_prefix->setInfo($this->
lng->txt(
'md_oai_identifier_prefix_info'));
341 $oai_id_prefix->setRequired(
true);
342 $oai_check->addSubItem($oai_id_prefix);
344 $oai_contact_mail =
new ilTextInputGUI($this->
lng->txt(
'md_oai_contact_mail'),
'oai_contact_mail');
345 $oai_contact_mail->setValue($this->
MDSettings()->getOAIContactMail());
346 $oai_contact_mail->setRequired(
true);
347 $oai_check->addSubItem($oai_contact_mail);
352 $enabled = $this->
lng->txt(
'meta_publishing_config_enabled');
353 $disabled = $this->
lng->txt(
'meta_publishing_config_disabled');
355 $text = $this->
lng->txt(
'meta_publishing_config_status') .
'<br/>' .
357 $this->
lng->txt(
'meta_publishing_config_cp'),
358 $this->MDSettings()->isCopyrightSelectionActive() ? $enabled : $disabled
361 $this->
lng->txt(
'meta_publishing_config_harvester'),
362 $this->isOERHarvesterActive() ? $enabled : $disabled
365 $url = $this->
ctrl->getLinkTargetByClass(
366 [ilAdministrationGUI::class, ilObjCronGUI::class],
368 $link = $this->ui_factory->link()->standard(
369 $this->
lng->txt(
'meta_publishing_config_cron_job_admin'),
373 return $this->ui_factory->messageBox()->info(
$text)->withLinks([$link]);
383 if (!isset($this->md_settings)) {
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Builds a Color from either hex- or rgb values.
This class represents an option in a checkbox group.
const string CRON_JOB_IDENTIFIER
Class ilCtrl provides processing control methods.
@ilCtrl_Calls ilMDPublishingSettingsGUI: ilPropertyFormGUI
ilObjMDSettingsGUI $parent_obj_gui
addObjectTypeSection(ilPropertyFormGUI $form)
addOAIPMHSection(ilPropertyFormGUI $form)
initSettingsForm()
TODO move to KS when repository picker is available there.
__construct(ilObjMDSettingsGUI $parent_obj_gui)
ilMDSettingsAccessService $access_service
CronJobManager $cron_manager
getConfigStatusMessageBox()
ilGlobalTemplateInterface $tpl
addPublishingWorkflowSection(ilPropertyFormGUI $form)
PublishingSettings $publishing_settings
ilMDSettings $md_settings
addCopyrightSection(ilPropertyFormGUI $form)
showPublishingSettings(?ilPropertyFormGUI $form=null)
CopyrightRepository $copyright_repo
This class represents a text property in a property form.
An entity that renders components to a string output.