ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilObjLearningResourcesSettingsGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("./Services/Object/classes/class.ilObjectGUI.php");
5include_once('./Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
6
20{
24 protected $rbacsystem;
25
29 protected $error;
30
31 private static $ERROR_MESSAGE;
37 public function __construct($a_data, $a_id, $a_call_by_reference = true, $a_prepare_output = true)
38 {
39 global $DIC;
40
41 $this->rbacsystem = $DIC->rbac()->system();
42 $this->error = $DIC["ilErr"];
43 $this->access = $DIC->access();
44 $this->settings = $DIC->settings();
45 $this->ctrl = $DIC->ctrl();
46 $this->lng = $DIC->language();
47 $this->type = 'lrss';
48 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
49
50 $this->lng->loadLanguageModule('content');
51 }
52
59 public function executeCommand()
60 {
63 $ilAccess = $this->access;
64
65 $next_class = $this->ctrl->getNextClass($this);
66 $cmd = $this->ctrl->getCmd();
67
68 $this->prepareOutput();
69
70 if (!$ilAccess->checkAccess('read', '', $this->object->getRefId())) {
71 $ilErr->raiseError($this->lng->txt('no_permission'), $ilErr->WARNING);
72 }
73
74 switch ($next_class) {
75 case 'illicenseoverviewgui':
76 include_once("./Services/License/classes/class.ilLicenseOverviewGUI.php");
78 $ret = $this->ctrl->forwardCommand($license_gui);
79 break;
80
81 case 'ilpermissiongui':
82 $this->tabs_gui->setTabActive('perm_settings');
83 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
84 $perm_gui = new ilPermissionGUI($this);
85 $ret = $this->ctrl->forwardCommand($perm_gui);
86 break;
87
88 default:
89 if (!$cmd || $cmd == 'view') {
90 $cmd = "editSettings";
91 }
92
93 $this->$cmd();
94 break;
95 }
96 return true;
97 }
98
105 public function getAdminTabs()
106 {
108 $ilAccess = $this->access;
110
111 if ($rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
112 $this->tabs_gui->addTarget(
113 "cont_edit_lrs_settings",
114 $this->ctrl->getLinkTarget($this, "editSettings"),
115 array("editSettings", "view")
116 );
117
118 include_once("Services/License/classes/class.ilLicenseAccess.php");
120 $this->tabs_gui->addTarget(
121 "licenses",
122 $this->ctrl->getLinkTargetByClass('illicenseoverviewgui', ''),
123 "",
124 "illicenseoverviewgui"
125 );
126 }
127 }
128
129 if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) {
130 $this->tabs_gui->addTarget(
131 "perm_settings",
132 $this->ctrl->getLinkTargetByClass('ilpermissiongui', "perm"),
133 array(),
134 'ilpermissiongui'
135 );
136 }
137 }
138
142 public function editSettings()
143 {
147
148 $lm_set = new ilSetting("lm");
149 $lic_set = new ilSetting("license");
150 $lng->loadLanguageModule("license");
151 $lng->loadLanguageModule("scormdebug");
152
153 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
154 $form = new ilPropertyFormGUI();
155 $form->setFormAction($ilCtrl->getFormAction($this));
156 $form->setTitle($lng->txt("cont_lrs_settings"));
157
158 // Page History
159 $cb_prop = new ilCheckboxInputGUI(
160 $lng->txt("cont_enable_page_history"),
161 "page_history"
162 );
163 $cb_prop->setInfo($lng->txt("cont_enable_page_history_info"));
164 $cb_prop->setChecked($lm_set->get("page_history", 1));
165 $form->addItem($cb_prop);
166
167 // Time scheduled page activation
168 $cb_prop = new ilCheckboxInputGUI(
169 $lng->txt("cont_enable_time_scheduled_page_activation"),
170 "time_scheduled_page_activation"
171 );
172 $cb_prop->setInfo($lng->txt("cont_enable_time_scheduled_page_activation_info"));
173 $cb_prop->setChecked($lm_set->get("time_scheduled_page_activation"));
174 $form->addItem($cb_prop);
175
176 // lm starting point
177 $options = array(
178 "" => $this->lng->txt("cont_last_visited_page"),
179 "first" => $this->lng->txt("cont_first_page")
180 );
181 $si = new ilSelectInputGUI($this->lng->txt("cont_lm_starting_point"), "lm_starting_point");
182 $si->setOptions($options);
183 $si->setValue($lm_set->get("lm_starting_point"));
184 $si->setInfo($this->lng->txt("cont_lm_starting_point_info"));
185 $form->addItem($si);
186
187 // Activate replace media object function
188 $cb_prop = new ilCheckboxInputGUI(
189 $lng->txt("cont_replace_mob_feature"),
190 "replace_mob_feature"
191 );
192 $cb_prop->setInfo($lng->txt("cont_replace_mob_feature_info"));
193 $cb_prop->setChecked($lm_set->get("replace_mob_feature"));
194 $form->addItem($cb_prop);
195
196 // Activate HTML export IDs
197 $cb_prop = new ilCheckboxInputGUI(
198 $lng->txt("cont_html_export_ids"),
199 "html_export_ids"
200 );
201 $cb_prop->setInfo($lng->txt("cont_html_export_ids_info"));
202 $cb_prop->setChecked($lm_set->get("html_export_ids"));
203 $form->addItem($cb_prop);
204
205 // Upload dir for learning resources
206 $tx_prop = new ilTextInputGUI(
207 $lng->txt("cont_upload_dir"),
208 "cont_upload_dir"
209 );
210 $tx_prop->setInfo($lng->txt("cont_upload_dir_info"));
211 $tx_prop->setValue($lm_set->get("cont_upload_dir"));
212 $form->addItem($tx_prop);
213
214
215 // license activation
216 $cb_prop = new ilCheckboxInputGUI(
217 $lng->txt("license_counter"),
218 "license_counter"
219 );
220 $cb_prop->setInfo($lng->txt("license_counter_info"));
221 $cb_prop->setChecked($lic_set->get("license_counter"));
222 $form->addItem($cb_prop);
223
224 // license warning
225 $tx_prop = new ilNumberInputGUI(
226 $lng->txt("license_warning"),
227 "license_warning"
228 );
229 $tx_prop->setSize(5);
230 $tx_prop->setInfo($lng->txt("license_warning_info"));
231 $tx_prop->setValue($lic_set->get("license_warning"));
232 $form->addItem($tx_prop);
233
234 // scormDebugger activation
235 $cb_prop = new ilCheckboxInputGUI($lng->txt("scormdebug_global_activate"), "scormdebug_global_activate");
236 $cb_prop->setInfo($lng->txt("scormdebug_global_activate_info"));
237 $cb_prop->setChecked($lm_set->get("scormdebug_global_activate"));
238 $form->addItem($cb_prop);
239
240 // scorm2004 disableRTECaching
241 $cb_prop = new ilCheckboxInputGUI(
242 $lng->txt("scormdebug_disable_cache"),
243 "scormdebug_disable_cache"
244 );
245 $cb_prop->setInfo($lng->txt("scormdebug_disable_cache_info"));
246 $cb_prop->setChecked($lm_set->get("scormdebug_disable_cache"));
247 $form->addItem($cb_prop);
248
249 // scorm2004 without session
250 $cb_prop = new ilCheckboxInputGUI(
251 $lng->txt("scorm_without_session"),
252 "scorm_without_session"
253 );
254 $cb_prop->setInfo($lng->txt("scorm_without_session_info"));
255 $cb_prop->setChecked($lm_set->get("scorm_without_session"));
256 $form->addItem($cb_prop);
257
259 $check = new ilCheckboxInputGui($lng->txt('enable_sahs_protocol_data'), 'enable_sahs_pd');
260 $check->setInfo($this->lng->txt('enable_sahs_protocol_data_desc'));
261 $check->setChecked($privacy->enabledSahsProtocolData());
262 $form->addItem($check);
263
264 // show and export protocol data with name
265 $check = new ilCheckboxInputGui($this->lng->txt('ps_export_scorm'), 'export_scorm');
266 $check->setInfo($this->lng->txt('enable_export_scorm_desc'));
267 $check->setChecked($privacy->enabledExportSCORM());
268 $form->addItem($check);
269
270 // scorm auto-setting for learning progress
271 $cb_prop = new ilCheckboxInputGUI($lng->txt("scorm_lp_auto_activate"), "scorm_lp_auto_activate");
272 $cb_prop->setInfo($lng->txt("scorm_lp_auto_activate_info"));
273 $cb_prop->setChecked($lm_set->get("scorm_lp_auto_activate"));
274 $form->addItem($cb_prop);
275
276 // command buttons
277 if ($this->checkPermissionBool("write")) {
278 $form->addCommandButton("saveSettings", $lng->txt("save"));
279 $form->addCommandButton("view", $lng->txt("cancel"));
280 }
281
282 $this->tpl->setContent($form->getHTML());
283 }
284
288 public function saveSettings()
289 {
292
293 $this->checkPermission("write");
294
295 $lm_set = new ilSetting("lm");
296 $lm_set->set(
297 "time_scheduled_page_activation",
298 ilUtil::stripSlashes($_POST["time_scheduled_page_activation"])
299 );
300 $lm_set->set(
301 "lm_starting_point",
302 ilUtil::stripSlashes($_POST["lm_starting_point"])
303 );
304 $lm_set->set(
305 "page_history",
306 (int) ilUtil::stripSlashes($_POST["page_history"])
307 );
308 $lm_set->set(
309 "replace_mob_feature",
310 ilUtil::stripSlashes($_POST["replace_mob_feature"])
311 );
312 $lm_set->set(
313 "html_export_ids",
314 ilUtil::stripSlashes($_POST["html_export_ids"])
315 );
316 $lm_set->set(
317 "cont_upload_dir",
318 ilUtil::stripSlashes($_POST["cont_upload_dir"])
319 );
320 $lm_set->setScormDebug(
321 "scormdebug_global_activate",
322 ilUtil::stripSlashes($_POST["scormdebug_global_activate"])
323 );
324 $lm_set->set(
325 "scorm_login_as_learner_id",
326 ilUtil::stripSlashes($_POST["scorm_login_as_learner_id"])
327 );
328 $lm_set->set(
329 "scormdebug_disable_cache",
330 ilUtil::stripSlashes($_POST["scormdebug_disable_cache"])
331 );
332 $lm_set->set(
333 "scorm_without_session",
334 ilUtil::stripSlashes($_POST["scorm_without_session"])
335 );
336 $lm_set->set(
337 "scorm_lp_auto_activate",
338 ilUtil::stripSlashes($_POST["scorm_lp_auto_activate"])
339 );
340 $lic_set = new ilSetting("license");
341 $lic_set->set(
342 "license_counter",
343 ilUtil::stripSlashes($_POST["license_counter"])
344 );
345 $lic_set->set(
346 "license_warning",
347 ilUtil::stripSlashes($_POST["license_warning"])
348 );
349
351 $privacy->enableSahsProtocolData((int) $_POST['enable_sahs_pd']);
352 $privacy->enableExportSCORM((int) $_POST['export_scorm']);
353 $privacy->save();
354
355 ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
356
357 $ilCtrl->redirect($this, "view");
358 }
359
360 public function addToExternalSettingsForm($a_form_id)
361 {
362 switch ($a_form_id) {
364
366
367 $fields = array('enable_sahs_protocol_data' => array($privacy->enabledSahsProtocolData(), ilAdministrationSettingsFormHandler::VALUE_BOOL));
368
369 return array(array("editSettings", $fields));
370 }
371 }
372}
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
error($a_errmsg)
set error message @access public
This class represents a checkbox property in a property form.
static _isEnabled()
Check, if licencing is enabled This check is called from the ilAccessHandler class.
This class represents a number property in a property form.
__construct($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
Contructor.
Class ilObjectGUI Basic methods of all Output classes.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
prepareOutput($a_show_subobjects=true)
prepare output
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static _getInstance()
Get instance of ilPrivacySettings.
This class represents a property form user interface.
This class represents a selection list property in a property form.
ILIAS Setting Class.
This class represents a text property in a property form.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
global $ilCtrl
Definition: ilias.php:18
$ret
Definition: parser.php:6
global $ilSetting
Definition: privfeed.php:17
if(isset($_POST['submit'])) $form
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2
$lm_set