3 declare(strict_types=1);
44 public function __construct($a_data, $a_id,
bool $a_call_by_reference =
true,
bool $a_prepare_output =
true)
50 $this->
lng->loadLanguageModule(
"meta");
51 $this->
http = $DIC->http();
53 $this->ui_factory = $DIC->ui()->factory();
54 $this->ui_renderer = $DIC->ui()->renderer();
60 if ($this->
http->wrapper()->query()->has(
'entry_id')) {
61 $entry_id = $this->
http->wrapper()->query()->retrieve(
72 if ($this->
http->wrapper()->post()->has(
'entry_id')) {
73 return $this->
http->wrapper()->post()->retrieve(
85 $next_class = $this->
ctrl->getNextClass($this);
86 $cmd = $this->
ctrl->getCmd();
90 if (!$this->rbac_system->checkAccess(
"visible,read", $this->object->getRefId())) {
91 $this->error->raiseError($this->
lng->txt(
'no_permission'), $this->error->WARNING);
94 switch ($next_class) {
95 case 'iladvancedmdsettingsgui':
96 $this->tabs_gui->setTabActive(
'md_advanced');
101 $ret = $this->
ctrl->forwardCommand($adv_md);
104 case 'ilpermissiongui':
105 $this->tabs_gui->setTabActive(
'perm_settings');
108 $ret = $this->
ctrl->forwardCommand($perm_gui);
111 case 'ilmdcopyrightusagegui':
113 $this->
ctrl->setReturn($this,
'showCopyrightSettings');
116 $this->
ctrl->forwardCommand($gui);
121 if (!$cmd || $cmd ===
'view') {
122 $cmd =
"showGeneralSettings";
147 if ($this->rbac_system->checkAccess(
"visible,read", $this->object->getRefId())) {
148 $this->tabs_gui->addTarget(
149 "md_general_settings",
150 $this->
ctrl->getLinkTarget($this,
"showGeneralSettings"),
151 array(
"showGeneralSettings",
"view")
154 $this->tabs_gui->addTarget(
156 $this->
ctrl->getLinkTarget($this,
"showCopyrightSettings"),
157 array(
"showCopyrightSettings")
160 $this->tabs_gui->addTarget(
162 $this->
ctrl->getLinkTargetByClass(
'iladvancedmdsettingsgui',
""),
164 'iladvancedmdsettingsgui' 168 if ($this->rbac_system->checkAccess(
'edit_permission', $this->object->getRefId())) {
169 $this->tabs_gui->addTarget(
171 $this->
ctrl->getLinkTargetByClass(
'ilpermissiongui',
"perm"),
183 $this->tpl->setContent($form->
getHTML());
188 $this->tabs_gui->setTabActive(
'md_general_settings');
191 $ti->setInfo($this->
lng->txt(
"md_delimiter_info"));
192 $ti->setMaxLength(1);
194 $ti->setValue($this->md_settings->getDelimiter());
197 if ($this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
201 $form->
setTitle($this->
lng->txt(
"md_general_settings"));
208 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
209 $this->
ctrl->redirect($this,
"showGeneralSettings");
213 $delim = $form->
getInput(
'delimiter');
215 trim($delim) ===
'' ?
219 $this->md_settings->setDelimiter($delim);
220 $this->md_settings->save();
221 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
222 $this->
ctrl->redirect($this,
"showGeneralSettings");
224 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'),
true);
231 $this->tabs_gui->setTabActive(
'md_copyright');
232 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.settings.html',
'Services/MetaData');
237 $this->tpl->setVariable(
'SETTINGS_TABLE', $form->
getHTML());
239 $has_write = $this->
access->checkAccess(
'write',
'', $this->
object->getRefId());
241 $table_gui->setTitle($this->
lng->txt(
"md_copyright_selection"));
242 $table_gui->parseSelections();
245 $table_gui->addCommandButton(
'addEntry', $this->
lng->txt(
'add'));
246 $table_gui->addMultiCommand(
"confirmDeleteEntries", $this->
lng->txt(
"delete"));
247 $table_gui->setSelectAllCheckbox(
"entry_id");
249 $this->tpl->setVariable(
'COPYRIGHT_TABLE', $table_gui->getHTML());
254 if (!$this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
255 $this->
ctrl->redirect($this,
"showCopyrightSettings");
259 $this->md_settings->activateCopyrightSelection((
bool) $form->
getInput(
'active'));
260 $this->md_settings->save();
261 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
262 $this->
ctrl->redirect($this,
'showCopyrightSettings');
264 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'),
true);
271 $this->
ctrl->redirectByClass(
'ilmdcopyrightusagegui',
"showUsageTable");
276 $this->
ctrl->saveParameter($this,
'entry_id');
280 $this->tabs_gui->clearTargets();
281 $this->tabs_gui->setBackTarget(
282 $this->
lng->txt(
'back'),
283 $post_url = $this->
ctrl->getLinkTarget($this,
'showCopyrightSettings')
285 $this->tpl->setContent($this->ui_renderer->render($form));
293 $this->tabs_gui->clearTargets();
294 $this->tabs_gui->setBackTarget(
295 $this->
lng->txt(
'back'),
296 $post_url = $this->
ctrl->getLinkTarget($this,
'showCopyrightSettings')
298 $this->tpl->setContent($this->ui_renderer->render($form));
304 if (
$data = $form->getData()) {
307 $this->entry->setTitle(
$data[
'title']);
308 $this->entry->setDescription(
$data[
'description']);
309 $this->entry->setCopyrightData(
310 $data[
'copyright'][
'full_name'],
311 $data[
'copyright'][
'link'],
312 $data[
'copyright'][
'image_link'],
313 $data[
'copyright'][
'alt_text']
315 $this->entry->setOutdated((
bool)
$data[
'outdated']);
316 $this->entry->setLanguage(
'en');
317 $this->entry->setCopyrightAndOtherRestrictions(
true);
318 $this->entry->setCosts(
false);
320 if (!$this->entry->validate()) {
321 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'fill_out_all_required_fields'));
326 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
327 $this->
ctrl->redirect($this,
'showCopyrightSettings');
330 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'),
true);
338 if (!count($entry_ids)) {
339 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'select_one'));
346 $c_gui->setFormAction($this->
ctrl->getFormAction($this,
"deleteEntries"));
347 $c_gui->setHeaderText($this->
lng->txt(
"md_delete_cp_sure"));
348 $c_gui->setCancel($this->
lng->txt(
"cancel"),
"showCopyrightSettings");
349 $c_gui->setConfirm($this->
lng->txt(
"confirm"),
"deleteEntries");
352 foreach ($entry_ids as $entry_id) {
354 $c_gui->addItem(
'entry_id[]', (
string) $entry_id, $entry->
getTitle());
356 $this->tpl->setContent($c_gui->getHTML());
362 if (!count($entry_ids)) {
363 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'select_one'));
368 foreach ($entry_ids as $entry_id) {
372 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'md_copyrights_deleted'));
381 if (
$data = $form->getData()) {
383 $this->entry->setTitle(
$data[
'title']);
384 $this->entry->setDescription(
$data[
'description']);
385 $this->entry->setCopyrightData(
386 $data[
'copyright'][
'full_name'],
387 $data[
'copyright'][
'link'],
388 $data[
'copyright'][
'image_link'],
389 $data[
'copyright'][
'alt_text']
391 $this->entry->setOutdated((
bool)
$data[
'outdated']);
392 if (!$this->entry->validate()) {
393 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'fill_out_all_required_fields'));
397 $this->entry->update();
398 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
399 $this->
ctrl->redirect($this,
'showCopyrightSettings');
402 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
411 $form->
setTitle($this->
lng->txt(
'md_copyright_settings'));
413 if ($this->
access->checkAccess(
'write',
'', $this->object->getRefId())) {
419 $check->setChecked($this->md_settings->isCopyrightSelectionActive());
421 $check->setInfo($this->
lng->txt(
'md_copyright_enable_info'));
434 if (!is_object($this->entry)) {
439 $ff = $this->ui_factory->input()->field();
442 ->text($this->
lng->txt(
'title'))
445 ->withMaxLength(255);
449 ->textarea($this->
lng->txt(
'description'))
450 ->
withValue($this->entry->getDescription());
454 ->radio($this->
lng->txt(
'meta_copyright_usage'))
455 ->withOption(
'0', $this->
lng->txt(
'meta_copyright_in_use'))
456 ->withOption(
'1', $this->
lng->txt(
'meta_copyright_outdated'))
457 ->
withValue((
int) $this->entry->getOutdated());
460 $cp_data = $this->entry->getCopyrightData();
463 ->text($this->
lng->txt(
'md_copyright_full_name'))
468 $this->
lng->txt(
'md_copyright_link'),
469 $this->
lng->txt(
'md_copyright_link_info')
473 $this->
refinery->custom()->transformation(fn ($v) => $v instanceof
URI ? $v : null)
477 ->url($this->
lng->txt(
'md_copyright_image_link'))
478 ->
withValue((
string) $cp_data->imageLink())
480 fn ($v) => $v instanceof
URI ? $v : null
485 $this->
lng->txt(
'md_copyright_alt_text'),
486 $this->
lng->txt(
'md_copyright_alt_text_info')
493 'full_name' => $full_name,
495 'image_link' => $image_link,
496 'alt_text' => $alt_text
498 $this->
lng->txt(
'md_copyright_value')
506 $form_title = $this->
lng->txt(
'md_copyright_edit');
507 $post_url = $this->
ctrl->getLinkTarget($this,
'updateEntry');
511 $form_title = $this->
lng->txt(
'md_copyright_add');
512 $post_url = $this->
ctrl->getLinkTarget($this,
'saveEntry');
515 return $this->ui_factory->input()->container()->form()->standard(
517 [$ff->section(
$inputs, $form_title)]
528 if (!$this->
http->wrapper()->post()->has(
'order')) {
529 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_select_one'),
true);
530 $this->
ctrl->redirect($this,
'showCopyrightSettings');
533 $positions = $this->
http->wrapper()->post()->retrieve(
535 $this->
refinery->kindlyTo()->dictOf(
536 $this->
refinery->kindlyTo()->string()
541 foreach ($positions as $entry_id => $position_ignored) {
543 $copyright->setOrderPosition($position++);
544 $copyright->update();
546 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'));
547 $this->
ctrl->redirect($this,
'showCopyrightSettings');
Interface GlobalHttpState.
ilMDSettings $md_settings
prepareOutput(bool $show_sub_objects=true)
showGeneralSettings(?ilPropertyFormGUI $form=null)
addEntry(?StandardForm $form=null)
getAdministrationFormId()
initGeneralSettingsForm(string $a_mode="edit")
static http()
Fetches the global http state from ILIAS.
Class ilObjectGUI Basic methods of all Output classes.
__construct($a_data, $a_id, bool $a_call_by_reference=true, bool $a_prepare_output=true)
ilMDCopyrightSelectionEntry $entry
The scope of this class is split ilias-conform URI's into components.
initCopyrightEditForm(string $a_mode='edit')
editEntry(?StandardForm $form=null)
showCopyrightSettings(?ilPropertyFormGUI $form=null)
__construct(Container $dic, ilPlugin $plugin)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const CONTEXT_ADMINISTRATION