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