ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilOrgUnitGlobalSettingsGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4
14{
18 protected $ctrl;
19
23 protected $lng;
24
28 protected $tpl;
29
34 public function __construct()
35 {
36 global $DIC;
37
38 $this->ctrl = $DIC->ctrl();
39 $this->lng = $DIC->language();
40 $this->lng->loadLanguageModule('orgu');
41 $this->tpl = $DIC->ui()->mainTemplate();
42 }
43
47 public function executeCommand()
48 {
49 $cmd = $this->ctrl->getCmd('settings');
50 $next_class = $this->ctrl->getNextClass($this);
51
52 switch ($next_class) {
53 default:
54 $this->$cmd();
55 break;
56 }
57 }
58
63 protected function settings(ilPropertyFormGUI $form = null)
64 {
65 if (!$form instanceof ilPropertyFormGUI) {
66 $form = $this->initSettingsForm();
67 }
68 $this->tpl->setContent($form->getHTML());
69 }
70
74 protected function initSettingsForm()
75 {
76 global $DIC;
77
79 $form->setFormAction($this->ctrl->getFormAction($this, 'saveSettings'));
80
81 // My Staff
83 $section->setTitle($this->lng->txt('orgu_enable_my_staff'));
84 $form->addItem($section);
85
86 $item = new ilCheckboxInputGUI($this->lng->txt("orgu_enable_my_staff"), "enable_my_staff");
87 $item->setInfo($this->lng->txt("orgu_enable_my_staff_info"));
88 $item->setValue("1");
89 $item->setChecked(($DIC->settings()->get("enable_my_staff") ? true : false));
90 $form->addItem($item);
91
92 // Positions in Modules
94 $section->setTitle($this->lng->txt('orgu_global_set_positions'));
95 $form->addItem($section);
96
97 $available_types = $GLOBALS['DIC']['objDefinition']->getOrgUnitPermissionTypes();
98 foreach ($available_types as $object_type) {
99 $setting = new ilOrgUnitObjectTypePositionSetting($object_type);
100
102 $this->lng->txt('orgu_global_set_positions_type_active') . ' ' . $this->lng->txt('objs_' . $object_type),
103 $object_type . '_active'
104 );
105 $type->setValue(1);
106 $type->setChecked($setting->isActive());
107
108 $scope = new ilRadioGroupInputGUI($this->lng->txt('orgu_global_set_type_changeable'), $object_type . '_changeable');
109 $scope->setValue((int) $setting->isChangeableForObject());
110
111 $scope_object = new ilRadioOption(
112 $this->lng->txt('orgu_global_set_type_changeable_object'),
113 1
114 );
115 $default = new ilCheckboxInputGUI($this->lng->txt('orgu_global_set_type_default'), $object_type . '_default');
116 $default->setInfo($this->lng->txt('orgu_global_set_type_default_info'));
118 $default->setChecked($setting->getActivationDefault());
119
120 $scope_object->addSubItem($default);
121 $scope->addOption($scope_object);
122
123 $scope_global = new ilRadioOption(
124 $this->lng->txt('orgu_global_set_type_changeable_no'),
125 0
126 );
127 $scope->addOption($scope_global);
128
129 $type->addSubItem($scope);
130 $form->addItem($type);
131 }
132 $form->addCommandButton('saveSettings', $this->lng->txt('save'));
133
134 return $form;
135 }
136
137
138 protected function saveSettings()
139 {
143 global $DIC;
144 $objDefinition = $DIC['objDefinition'];
145 $form = $this->initSettingsForm();
146 if ($form->checkInput()) {
147 // Orgu Permissions / Positions in Modules
148 $available_types = $objDefinition->getOrgUnitPermissionTypes();
149 foreach ($available_types as $object_type) {
150 $obj_setting = new ilOrgUnitObjectTypePositionSetting($object_type);
151 $obj_setting->setActive((bool) $form->getInput($object_type . '_active'));
152 $obj_setting->setActivationDefault((int) $form->getInput($object_type . '_default'));
153 $obj_setting->setChangeableForObject((bool) $form->getInput($object_type
154 . '_changeable'));
155 $obj_setting->update();
156 }
157
158
159 // MyStaff
160 $DIC->settings()->set("enable_my_staff", (int) ($_POST["enable_my_staff"] ? 1 : 0));
161
162 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
163 $this->ctrl->redirect($this, 'settings');
164 } else {
165 $form->setValuesByPost();
166 ilUtil::sendFailure($this->lng->txt('err_check_input'), false);
167 $this->settings($form);
168 }
169 }
170}
$section
Definition: Utf8Test.php:83
$default
Definition: build.php:20
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
This class represents a checkbox property in a property form.
This class represents a section header in a property form.
settings(ilPropertyFormGUI $form=null)
Show settings.
__construct()
Default constructor @global type $DIC.
Object settings regarding position permissions.
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.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
$type
if(isset($_POST['submit'])) $form
global $DIC
Definition: saml.php:7