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