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