ILIAS  release_8 Revision v8.24
class.ilObjRepositorySettingsGUI.php
Go to the documentation of this file.
1<?php
2
20
28{
33
34 public function __construct(
35 $a_data,
36 int $a_id,
37 bool $a_call_by_reference = true,
38 bool $a_prepare_output = true
39 ) {
40 global $DIC;
41
42 $this->error = $DIC["ilErr"];
43 $this->access = $DIC->access();
44 $this->rbacsystem = $DIC->rbac()->system();
45 $this->settings = $DIC->settings();
46 $this->folder_settings = new ilSetting('fold');
47 $this->ctrl = $DIC->ctrl();
48 $this->lng = $DIC->language();
49 $this->toolbar = $DIC->toolbar();
50 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
51
52 $this->type = 'reps';
53 $this->lng->loadLanguageModule('rep');
54 $this->lng->loadLanguageModule('cmps');
55
56 $this->admin_gui_request = $DIC
57 ->repository()
58 ->internal()
59 ->gui()
60 ->administration()
61 ->request();
62 }
63
64 public function executeCommand(): void
65 {
67 $ilAccess = $this->access;
68
69 $next_class = $this->ctrl->getNextClass($this);
70 $cmd = $this->ctrl->getCmd();
71
72 $this->prepareOutput();
73
74 if (!$ilAccess->checkAccess('read', '', $this->object->getRefId())) {
75 $ilErr->raiseError($this->lng->txt('no_permission'), $ilErr->WARNING);
76 }
77
78 switch ($next_class) {
79 case 'ilpermissiongui':
80 $this->tabs_gui->setTabActive('perm_settings');
81 $perm_gui = new ilPermissionGUI($this);
82 $this->ctrl->forwardCommand($perm_gui);
83 break;
84
85 default:
86 $this->$cmd();
87 break;
88 }
89 }
90
91 public function getAdminTabs(): void
92 {
94
95 $this->tabs_gui->addTab(
96 "settings",
97 $this->lng->txt("settings"),
98 $this->ctrl->getLinkTarget($this, "view")
99 );
100
101 $this->tabs_gui->addTab(
102 "icons",
103 $this->lng->txt("rep_custom_icons"),
104 $this->ctrl->getLinkTarget($this, "customIcons")
105 );
106
107 $this->tabs_gui->addTab(
108 "modules",
109 $this->lng->txt("cmps_repository_object_types"),
110 $this->ctrl->getLinkTarget($this, "listModules")
111 );
112
113 if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) {
114 $this->tabs_gui->addTab(
115 "perm_settings",
116 $this->lng->txt("perm_settings"),
117 $this->ctrl->getLinkTargetByClass('ilpermissiongui', "perm")
118 );
119 }
120 }
121
122 public function view(ilPropertyFormGUI $a_form = null): void
123 {
124 $this->tabs_gui->activateTab("settings");
125
126 if (!$a_form) {
127 $a_form = $this->initSettingsForm();
128 }
129
130 $this->tpl->setContent($a_form->getHTML());
131 }
132
134 {
136 $ilAccess = $this->access;
137
138 $form = new ilPropertyFormGUI();
139 $form->setTitle($this->lng->txt("settings"));
140 $form->setFormAction($this->ctrl->getFormAction($this, 'saveSettings'));
141
142 // default repository view
143 /*
144 $options = array(
145 "flat" => $this->lng->txt("flatview"),
146 "tree" => $this->lng->txt("treeview")
147 );
148 $si = new ilSelectInputGUI($this->lng->txt("def_repository_view"), "default_rep_view");
149 $si->setOptions($options);
150 $si->setInfo($this->lng->txt(""));
151 if ($ilSetting->get("default_repository_view") == "tree") {
152 $si->setValue("tree");
153 } else {
154 $si->setValue("flat");
155 }
156 $form->addItem($si);*/
157
158 //
159 $options = [
160 "" => $this->lng->txt("adm_rep_tree_only_container"),
161 "tree" => $this->lng->txt("adm_all_resource_types")
162 ];
163
164 // repository tree
165 $radg = new ilRadioGroupInputGUI($this->lng->txt("adm_rep_tree_presentation"), "tree_pres");
166 $radg->setValue($ilSetting->get("repository_tree_pres") ?? "");
167 $op1 = new ilRadioOption(
168 $this->lng->txt("adm_rep_tree_only_cntr"),
169 "",
170 $this->lng->txt("adm_rep_tree_only_cntr_info")
171 );
172 $radg->addOption($op1);
173
174 $op2 = new ilRadioOption(
175 $this->lng->txt("adm_rep_tree_all_types"),
176 "all_types",
177 $this->lng->txt("adm_rep_tree_all_types_info")
178 );
179
180 // limit tree in courses and groups
181 $cb = new ilCheckboxInputGUI($this->lng->txt("adm_rep_tree_limit_grp_crs"), "rep_tree_limit_grp_crs");
182 $cb->setChecked((bool) $ilSetting->get("rep_tree_limit_grp_crs"));
183 $cb->setInfo($this->lng->txt("adm_rep_tree_limit_grp_crs_info"));
184 $op2->addSubItem($cb);
185
186 $radg->addOption($op2);
187
188 $form->addItem($radg);
189
190 // limit items in tree
191 $tree_limit = new ilCheckboxInputGUI($this->lng->txt("rep_tree_limit"), "rep_tree_limit");
192 $tree_limit->setChecked($ilSetting->get("rep_tree_limit_number") > 0);
193 $tree_limit->setInfo($this->lng->txt("rep_tree_limit_info"));
194 $form->addItem($tree_limit);
195
196 // limit items in tree (number)
197 $tree_limit_number = new ilNumberInputGUI($this->lng->txt("rep_tree_limit_number"), "rep_tree_limit_number");
198 $tree_limit_number->setMaxLength(3);
199 $tree_limit_number->setSize(3);
200 $tree_limit_number->setValue($ilSetting->get("rep_tree_limit_number"));
201 $tree_limit_number->setInfo($this->lng->txt("rep_tree_limit_number_info"));
202 $tree_limit->addSubItem($tree_limit_number);
203
204 // breadcrumbs start with courses
205 $cb = new ilCheckboxInputGUI($this->lng->txt("rep_breadcr_crs"), "rep_breadcr_crs");
206 $cb->setChecked((bool) $ilSetting->get("rep_breadcr_crs"));
207 $form->addItem($cb);
208
209 $radg = new ilRadioGroupInputGUI($this->lng->txt("rep_breadcr_crs_config"), "rep_breadcr_crs_overwrite");
210 $radg->setValue((string) ((int) $ilSetting->get("rep_breadcr_crs_overwrite")));
211
212 $op0 = new ilRadioOption($this->lng->txt("rep_breadcr_crs_overwrite"), '1');
213 $cb0 = new ilCheckboxInputGUI($this->lng->txt("rep_crs_default_shortened"), "rep_breadcr_crs_default");
214 $cb0->setChecked((bool) $ilSetting->get("rep_breadcr_crs_default"));
215 $op0->addSubItem($cb0);
216 $radg->addOption($op0);
217
218 $op1 = new ilRadioOption($this->lng->txt("rep_breadcr_crs_overwrite_not"), '0');
219 $radg->addOption($op1);
220
221
222 $cb->addSubItem($radg);
223
224
225
226 // trash
227 $cb = new ilCheckboxInputGUI($this->lng->txt("enable_trash"), "enable_trash");
228 $cb->setInfo($this->lng->txt("enable_trash_info"));
229 if ($ilSetting->get("enable_trash")) {
230 $cb->setChecked(true);
231 }
232 $form->addItem($cb);
233
234 // change event
235 $this->lng->loadLanguageModule("trac");
236 $event = new ilCheckboxInputGUI($this->lng->txt('trac_show_repository_views'), 'change_event_tracking');
237 $event->setInfo($this->lng->txt("trac_show_repository_views_info"));
238 $event->setChecked(ilChangeEvent::_isActive());
239 $form->addItem($event);
240
241
244 $form,
245 $this
246 );
247
248 // export limitations
249 $limiter = new ilExportLimitation();
250 $exp_limit = new ilRadioGroupInputGUI($this->lng->txt("rep_export_limitation"), "rep_export_limitation");
251 $exp_limit->setValue((string) $limiter->getLimitationMode());
252 $exp_limit->setInfo($this->lng->txt("rep_export_limitation_info"));
253
254 $op_disabled = new ilRadioOption(
255 $this->lng->txt("rep_export_limitation_disabled"),
257 );
258 $exp_limit->addOption($op_disabled);
259
260 $op_limited = new ilRadioOption(
261 $this->lng->txt("rep_export_limitation_limited"),
263 );
264 $exp_limit->addOption($op_limited);
265
266 // limit items in tree (number)
267 $exp_limit_num = new ilNumberInputGUI($this->lng->txt("rep_export_limit_number"), "rep_export_limit_number");
268 $exp_limit_num->setMaxLength(6);
269 $exp_limit_num->setSize(6);
270 $exp_limit_num->setValue($ilSetting->get("rep_export_limit_number"));
271 $op_limited->addSubItem($exp_limit_num);
272
273 $form->addItem($exp_limit);
274
275 // Show download action for folder
276 $dl_prop = new ilCheckboxInputGUI($this->lng->txt("enable_download_folder"), "enable_download_folder");
277 $dl_prop->setValue('1');
278 // default value should reflect previous behaviour (-> 0)
279 $dl_prop->setChecked((int) $this->folder_settings->get("enable_download_folder", '0') === 1);
280 $dl_prop->setInfo($this->lng->txt('enable_download_folder_info'));
281 $form->addItem($dl_prop);
282
283 // multi download
284 $dl_prop = new ilCheckboxInputGUI($this->lng->txt("enable_multi_download"), "enable_multi_download");
285 $dl_prop->setValue('1');
286 // default value should reflect previous behaviour (-> 0)
287 $dl_prop->setChecked((int) $this->folder_settings->get("enable_multi_download", '1') === 1);
288 $dl_prop->setInfo($this->lng->txt('enable_multi_download_info'));
289 $form->addItem($dl_prop);
290
291 // favourites
292 $cb = new ilCheckboxInputGUI($this->lng->txt("rep_favourites"), "rep_favourites");
293 $cb->setInfo($this->lng->txt("rep_favourites_info"));
294 $cb->setChecked((bool) $ilSetting->get("rep_favourites"));
295 $form->addItem($cb);
296
297
298 // object lists
299
300 $lists = new ilFormSectionHeaderGUI();
301 $lists->setTitle($this->lng->txt("rep_object_lists"));
302 $form->addItem($lists);
303
304 $sdesc = new ilCheckboxInputGUI($this->lng->txt("adm_rep_shorten_description"), "rep_shorten_description");
305 $sdesc->setInfo($this->lng->txt("adm_rep_shorten_description_info"));
306 $sdesc->setChecked((bool) $ilSetting->get("rep_shorten_description"));
307 $form->addItem($sdesc);
308
309 $sdesclen = new ilNumberInputGUI($this->lng->txt("adm_rep_shorten_description_length"), "rep_shorten_description_length");
310 $sdesclen->setValue($ilSetting->get("rep_shorten_description_length"));
311 $sdesclen->setSize(3);
312 $sdesc->addSubItem($sdesclen);
313
314 // load action commands asynchronously
315 $cb = new ilCheckboxInputGUI($this->lng->txt("adm_item_cmd_asynch"), "item_cmd_asynch");
316 $cb->setInfo($this->lng->txt("adm_item_cmd_asynch_info"));
317 $cb->setChecked((bool) $ilSetting->get("item_cmd_asynch"));
318 $form->addItem($cb);
319
320 // notes/comments/tagging
321 $pl = new ilCheckboxInputGUI($this->lng->txt('adm_show_comments_tagging_in_lists'), 'comments_tagging_in_lists');
322 $pl->setValue('1');
323 $pl->setChecked((bool) $ilSetting->get('comments_tagging_in_lists'));
324 $form->addItem($pl);
325
326 $pltags = new ilCheckboxInputGUI($this->lng->txt('adm_show_comments_tagging_in_lists_tags'), 'comments_tagging_in_lists_tags');
327 $pltags->setValue('1');
328 $pltags->setChecked((bool) $ilSetting->get('comments_tagging_in_lists_tags'));
329 $pl->addSubItem($pltags);
330
331 if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
332 $form->addCommandButton('saveSettings', $this->lng->txt('save'));
333 }
334
335 return $form;
336 }
337
338 public function saveSettings(): void
339 {
341 $ilAccess = $this->access;
342
343 if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
344 $this->ctrl->redirect($this, "view");
345 }
346
347 $form = $this->initSettingsForm();
348 if ($form->checkInput()) {
349 $ilSetting->set(
350 "default_repository_view",
351 $form->getInput("default_rep_view")
352 );
353 $ilSetting->set(
354 "repository_tree_pres",
355 $form->getInput("tree_pres")
356 );
357 $rep_tree_limit_grp_crs = $form->getInput("rep_tree_limit_grp_crs");
358 if ($form->getInput("tree_pres") == "") {
359 $rep_tree_limit_grp_crs = "";
360 }
361 $ilSetting->set(
362 "rep_tree_limit_grp_crs",
363 $rep_tree_limit_grp_crs
364 );
365
366 $ilSetting->set(
367 "rep_favourites",
368 $form->getInput("rep_favourites")
369 );
370
371 $ilSetting->set(
372 "rep_export_limitation",
373 $form->getInput("rep_export_limitation")
374 );
375 $ilSetting->set(
376 "rep_export_limit_number",
377 (string) $form->getInput("rep_export_limit_number")
378 );
379 $ilSetting->set(
380 "enable_trash",
381 $form->getInput("enable_trash")
382 );
383 $ilSetting->set(
384 "rep_breadcr_crs_overwrite",
385 (string) ((int) $form->getInput("rep_breadcr_crs_overwrite"))
386 );
387 $ilSetting->set(
388 "rep_breadcr_crs",
389 (string) ((int) $form->getInput("rep_breadcr_crs"))
390 );
391 $ilSetting->set(
392 "rep_breadcr_crs_default",
393 (string) ((int) $form->getInput("rep_breadcr_crs_default"))
394 );
395 $ilSetting->set(
396 "rep_shorten_description",
397 $form->getInput('rep_shorten_description')
398 );
399 $ilSetting->set(
400 "rep_shorten_description_length",
401 (string) ((int) $form->getInput('rep_shorten_description_length'))
402 );
403 $ilSetting->set(
404 'item_cmd_asynch',
405 (string) ((int) $form->getInput('item_cmd_asynch'))
406 );
407 $ilSetting->set(
408 'comments_tagging_in_lists',
409 (string) ((int) $form->getInput('comments_tagging_in_lists'))
410 );
411 $ilSetting->set(
412 'comments_tagging_in_lists_tags',
413 $form->getInput('comments_tagging_in_lists_tags')
414 );
415
416 // repository tree limit of children
417 $limit_number = ($form->getInput('rep_tree_limit') &&
418 $form->getInput('rep_tree_limit_number') > 0)
419 ? (int) $form->getInput('rep_tree_limit_number')
420 : 0;
421 $ilSetting->set('rep_tree_limit_number', (string) $limit_number);
422
423 $this->folder_settings->set(
424 "enable_download_folder",
425 (string) ((int) $form->getInput("enable_download_folder") === 1)
426 );
427 $this->folder_settings->set(
428 "enable_multi_download",
429 (string) ((int) $form->getInput("enable_multi_download") === 1)
430 );
431 if ($form->getInput('change_event_tracking')) {
433 } else {
435 }
436
437 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
438 $this->ctrl->redirect($this, "view");
439 }
440
441 $form->setValuesByPost();
442 $this->view($form);
443 }
444
445 public function customIcons(ilPropertyFormGUI $a_form = null): void
446 {
447 $this->tabs_gui->activateTab("icons");
448
449 if (!$a_form) {
450 $a_form = $this->initCustomIconsForm();
451 }
452
453 $this->tpl->setContent($a_form->getHTML());
454 }
455
457 {
459 $ilAccess = $this->access;
460
461 $form = new ilPropertyFormGUI();
462 $form->setTitle($this->lng->txt("rep_custom_icons"));
463 $form->setFormAction($this->ctrl->getFormAction($this, 'saveCustomIcons'));
464
465 $cb = new ilCheckboxInputGUI($this->lng->txt("enable_custom_icons"), "custom_icons");
466 $cb->setInfo($this->lng->txt("enable_custom_icons_info"));
467 $cb->setChecked((bool) $ilSetting->get("custom_icons"));
468 $form->addItem($cb);
469
470 if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
471 $form->addCommandButton('saveCustomIcons', $this->lng->txt('save'));
472 }
473
474 return $form;
475 }
476
477 public function saveCustomIcons(): void
478 {
480 $ilAccess = $this->access;
481
482 if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
483 $this->ctrl->redirect($this, "customIcons");
484 }
485
486 $form = $this->initCustomIconsForm();
487 if ($form->checkInput()) {
488 $ilSetting->set("custom_icons", (string) ((int) $form->getInput("custom_icons")));
489 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
490 $this->ctrl->redirect($this, "customIcons");
491 }
492
493 $form->setValuesByPost();
494 $this->customIcons($form);
495 }
496
497 protected function setModuleSubTabs(string $a_active): void
498 {
499 $this->tabs_gui->activateTab('modules');
500
501 $this->tabs_gui->addSubTab(
502 "list_mods",
503 $this->lng->txt("rep_new_item_menu"),
504 $this->ctrl->getLinkTarget($this, "listModules")
505 );
506
507 $this->tabs_gui->addSubTab(
508 "new_item_groups",
509 $this->lng->txt("rep_new_item_groups"),
510 $this->ctrl->getLinkTarget($this, "listNewItemGroups")
511 );
512
513 $this->tabs_gui->activateSubTab($a_active);
514 }
515
516 protected function listModules(): void
517 {
518 $ilAccess = $this->access;
519
520 $this->setModuleSubTabs("list_mods");
521
522 $has_write = $ilAccess->checkAccess('write', '', $this->object->getRefId());
523
524 $comp_table = new ilModulesTableGUI($this, "listModules", $has_write);
525
526 $this->tpl->setContent($comp_table->getHTML());
527 }
528
529 protected function saveModules(): void
530 {
532 $ilCtrl = $this->ctrl;
534 $ilAccess = $this->access;
535
536 $item_groups = $this->admin_gui_request->getNewItemGroups();
537 $item_positions = $this->admin_gui_request->getNewItemPositions();
538
539 if (count($item_groups) === 0 || count($item_positions) === 0 ||
540 !$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
541 $ilCtrl->redirect($this, "listModules");
542 }
543
544 $grp_pos_map = [0 => 9999];
545 foreach (ilObjRepositorySettings::getNewItemGroups() as $item) {
546 $grp_pos_map[$item["id"]] = $item["pos"];
547 }
548
549 $type_pos_map = [];
550 $item_enablings = $this->admin_gui_request->getNewItemEnablings();
551 foreach ($item_positions as $obj_type => $pos) {
552 $grp_id = ($item_groups[$obj_type] ?? 0);
553 $type_pos_map[$grp_id][$obj_type] = $pos;
554
555 // enable creation?
556 $ilSetting->set(
557 "obj_dis_creation_" . $obj_type,
558 (string) ((int) (!($item_enablings[$obj_type] ?? false)))
559 );
560 }
561
562 foreach ($type_pos_map as $grp_id => $obj_types) {
563 $grp_pos = str_pad($grp_pos_map[$grp_id], 4, "0", STR_PAD_LEFT);
564
565 asort($obj_types);
566 $pos = 0;
567 foreach (array_keys($obj_types) as $obj_type) {
568 $pos += 10;
569 $type_pos = $grp_pos . str_pad((string) $pos, 4, "0", STR_PAD_LEFT);
570 $ilSetting->set("obj_add_new_pos_" . $obj_type, $type_pos);
571 $ilSetting->set("obj_add_new_pos_grp_" . $obj_type, $grp_id);
572 }
573 }
574
575 $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
576 $ilCtrl->redirect($this, "listModules");
577 }
578
579 protected function listNewItemGroups(): void
580 {
581 $ilToolbar = $this->toolbar;
582 $ilAccess = $this->access;
583
584 $this->setModuleSubTabs("new_item_groups");
585
586 $has_write = $ilAccess->checkAccess('write', '', $this->object->getRefId());
587
588 if ($has_write) {
589 $ilToolbar->addButton(
590 $this->lng->txt("rep_new_item_group_add"),
591 $this->ctrl->getLinkTarget($this, "addNewItemGroup")
592 );
593
594 $ilToolbar->addButton(
595 $this->lng->txt("rep_new_item_group_add_separator"),
596 $this->ctrl->getLinkTarget($this, "addNewItemGroupSeparator")
597 );
598 }
599
600 $grp_table = new ilNewItemGroupTableGUI($this, "listNewItemGroups", $has_write);
601
602 $this->tpl->setContent($grp_table->getHTML());
603 }
604
605 protected function initNewItemGroupForm(int $a_grp_id = 0): ilPropertyFormGUI
606 {
607 $this->setModuleSubTabs("new_item_groups");
608
609 $form = new ilPropertyFormGUI();
610
611 $this->lng->loadLanguageModule("meta");
612 $def_lng = $this->lng->getDefaultLanguage();
613
614 $title = new ilTextInputGUI($this->lng->txt("title"), "title_" . $def_lng);
615 $title->setInfo($this->lng->txt("meta_l_" . $def_lng) .
616 " (" . $this->lng->txt("default_language") . ")");
617 $title->setRequired(true);
618 $form->addItem($title);
619
620 foreach ($this->lng->getInstalledLanguages() as $lang_id) {
621 if ($lang_id !== $def_lng) {
622 $title = new ilTextInputGUI($this->lng->txt("translation"), "title_" . $lang_id);
623 $title->setInfo($this->lng->txt("meta_l_" . $lang_id));
624 $form->addItem($title);
625 }
626 }
627
628 if (!$a_grp_id) {
629 $form->setTitle($this->lng->txt("rep_new_item_group_add"));
630 $form->setFormAction($this->ctrl->getFormAction($this, "saveNewItemGroup"));
631
632 $form->addCommandButton("saveNewItemGroup", $this->lng->txt("save"));
633 } else {
634 $form->setTitle($this->lng->txt("rep_new_item_group_edit"));
635 $form->setFormAction($this->ctrl->getFormAction($this, "updateNewItemGroup"));
636
638 $grp = $grp[$a_grp_id];
639
640 foreach ($grp["titles"] as $id => $value) {
641 $field = $form->getItemByPostVar("title_" . $id);
642 if ($field) {
643 $field->setValue($value);
644 }
645 }
646
647 $form->addCommandButton("updateNewItemGroup", $this->lng->txt("save"));
648 }
649 $form->addCommandButton("listNewItemGroups", $this->lng->txt("cancel"));
650
651 return $form;
652 }
653
654 protected function addNewItemGroup(ilPropertyFormGUI $a_form = null): void
655 {
656 if (!$a_form) {
657 $a_form = $this->initNewItemGroupForm();
658 }
659
660 $this->tpl->setContent($a_form->getHTML());
661 }
662
663 protected function saveNewItemGroup(): void
664 {
665 $form = $this->initNewItemGroupForm();
666 if ($form->checkInput()) {
667 $titles = [];
668 foreach ($this->lng->getInstalledLanguages() as $lang_id) {
669 $titles[$lang_id] = $form->getInput("title_" . $lang_id);
670 }
671
673 $this->tpl->setOnScreenMessage('success', $this->lng->txt("settings_saved"), true);
674 $this->ctrl->redirect($this, "listNewItemGroups");
675 }
676 }
677
678 $form->setValuesByPost();
679 $this->addNewItemGroup($form);
680 }
681
682 protected function editNewItemGroup(ilPropertyFormGUI $a_form = null): void
683 {
684 $grp_id = $this->admin_gui_request->getNewItemGroupId();
685 if (!$grp_id) {
686 $this->ctrl->redirect($this, "listNewItemGroups");
687 }
688
689 if (!$a_form) {
690 $this->ctrl->setParameter($this, "grp_id", $grp_id);
691 $a_form = $this->initNewItemGroupForm($grp_id);
692 }
693
694 $this->tpl->setContent($a_form->getHTML());
695 }
696
697 protected function updateNewItemGroup(): void
698 {
699 $grp_id = $this->admin_gui_request->getNewItemGroupId();
700 if (!$grp_id) {
701 $this->ctrl->redirect($this, "listNewItemGroups");
702 }
703
704 $this->ctrl->setParameter($this, "grp_id", $grp_id);
705
706 $form = $this->initNewItemGroupForm($grp_id);
707 if ($form->checkInput()) {
708 $titles = [];
709 foreach ($this->lng->getInstalledLanguages() as $lang_id) {
710 $titles[$lang_id] = $form->getInput("title_" . $lang_id);
711 }
712
713 if (ilObjRepositorySettings::updateNewItemGroup($grp_id, $titles)) {
714 $this->tpl->setOnScreenMessage('success', $this->lng->txt("settings_saved"), true);
715 $this->ctrl->redirect($this, "listNewItemGroups");
716 }
717 }
718
719 $form->setValuesByPost();
720 $this->addNewItemGroup($form);
721 }
722
723 protected function addNewItemGroupSeparator(): void
724 {
726 $this->tpl->setOnScreenMessage('success', $this->lng->txt("settings_saved"), true);
727 }
728 $this->ctrl->redirect($this, "listNewItemGroups");
729 }
730
731 protected function saveNewItemGroupOrder(): void
732 {
734
735 $group_order = $this->admin_gui_request->getNewItemGroupOrder();
736 if (count($group_order) > 0) {
738
739 $grp_pos_map = [];
740 foreach (ilObjRepositorySettings::getNewItemGroups() as $item) {
741 $grp_pos_map[$item["id"]] = str_pad((string) $item["pos"], 4, "0", STR_PAD_LEFT);
742 }
743
744 // update order of assigned objects
745 foreach (ilObjRepositorySettings::getNewItemGroupSubItems() as $grp_id => $subitems) {
746 // unassigned objects will always be last
747 if ($grp_id) {
748 foreach ($subitems as $obj_type) {
749 $old_pos = $ilSetting->get("obj_add_new_pos_" . $obj_type);
750 if (strlen($old_pos) === 8) {
751 $new_pos = $grp_pos_map[$grp_id] . substr($old_pos, 4);
752 $ilSetting->set("obj_add_new_pos_" . $obj_type, $new_pos);
753 }
754 }
755 }
756 }
757
758 $this->tpl->setOnScreenMessage('success', $this->lng->txt("settings_saved"), true);
759 }
760 $this->ctrl->redirect($this, "listNewItemGroups");
761 }
762
763 protected function confirmDeleteNewItemGroup(): void
764 {
765 $group_ids = $this->admin_gui_request->getNewItemGroupIds();
766 if (count($group_ids) === 0) {
767 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("select_one"));
768 $this->listNewItemGroups();
769 return;
770 }
771
772 $this->setModuleSubTabs("new_item_groups");
773
774 $cgui = new ilConfirmationGUI();
775 $cgui->setHeaderText($this->lng->txt("rep_new_item_group_delete_sure"));
776
777 $cgui->setFormAction($this->ctrl->getFormAction($this));
778 $cgui->setCancel($this->lng->txt("cancel"), "listNewItemGroups");
779 $cgui->setConfirm($this->lng->txt("confirm"), "deleteNewItemGroup");
780
782
783 foreach ($group_ids as $grp_id) {
784 $cgui->addItem("grp_ids[]", (string) $grp_id, $groups[$grp_id]["title"]);
785 }
786
787 $this->tpl->setContent($cgui->getHTML());
788 }
789
790 protected function deleteNewItemGroup(): void
791 {
792 $group_ids = $this->admin_gui_request->getNewItemGroupIds();
793 if (count($group_ids) === 0) {
794 $this->listNewItemGroups();
795 return;
796 }
797
798 foreach ($group_ids as $grp_id) {
800 }
801
802 $this->tpl->setOnScreenMessage('success', $this->lng->txt("settings_saved"), true);
803 $this->ctrl->redirect($this, "listNewItemGroups");
804 }
805
806 public function addToExternalSettingsForm(int $a_form_id): ?array
807 {
809
810 switch ($a_form_id) {
812
813 $fields = ['trac_show_repository_views' => [ilChangeEvent::_isActive(), ilAdministrationSettingsFormHandler::VALUE_BOOL]];
814
815 return [["view", $fields]];
816
817
819
820 $fields = [
821 'adm_show_comments_tagging_in_lists' => [
822 $ilSetting->get('comments_tagging_in_lists'), ilAdministrationSettingsFormHandler::VALUE_BOOL,
823 ['adm_show_comments_tagging_in_lists_tags' => [$ilSetting->get('comments_tagging_in_lists_tags'), ilAdministrationSettingsFormHandler::VALUE_BOOL]]
824 ]
825 ];
826
827 return [["view", $fields]];
828 }
829 return null;
830 }
831}
error(string $a_errmsg)
static addFieldsToForm(int $a_form_id, ilPropertyFormGUI $a_form, ilObjectGUI $a_parent_gui)
static _isActive()
Returns true, if change event tracking is active.
static _activate()
Activates change event tracking.
static _deactivate()
Deactivates change event tracking.
This class represents a checkbox property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Error Handling & global info handling uses PEAR error class.
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...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
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...
This class represents a number property in a property form.
editNewItemGroup(ilPropertyFormGUI $a_form=null)
view(ilPropertyFormGUI $a_form=null)
customIcons(ilPropertyFormGUI $a_form=null)
getAdminTabs()
administration tabs show only permissions and trash folder
addNewItemGroup(ilPropertyFormGUI $a_form=null)
__construct( $a_data, int $a_id, bool $a_call_by_reference=true, bool $a_prepare_output=true)
static updateNewItemGroup(int $a_id, array $a_titles)
static updateNewItemGroupOrder(array $a_order)
static addNewItemGroup(array $a_titles)
Class ilObjectGUI Basic methods of all Output classes.
ilAccessHandler $access
ilSetting $settings
ilToolbarGUI $toolbar
prepareOutput(bool $show_sub_objects=true)
ilLanguage $lng
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This class represents a property form user interface.
This class represents a property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
checkAccess(string $a_operations, int $a_ref_id, string $a_type="")
checkAccess represents the main method of the RBAC-system in ILIAS3 developers want to use With this ...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text property in a property form.
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $ilSetting
Definition: privfeed.php:17
$ilErr
Definition: raiseError.php:17