ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilObjLearningResourcesSettingsGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
17{
18
22 protected $error;
23
24 private static $ERROR_MESSAGE;
30 public function __construct($a_data, $a_id, $a_call_by_reference = true, $a_prepare_output = true)
31 {
32 global $DIC;
33
34 $this->error = $DIC["ilErr"];
35 $this->access = $DIC->access();
36 $this->settings = $DIC->settings();
37 $this->ctrl = $DIC->ctrl();
38 $this->lng = $DIC->language();
39 $this->type = 'lrss';
40 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
41
42 $this->lng->loadLanguageModule('content');
43 }
44
51 public function executeCommand()
52 {
54
55 $next_class = $this->ctrl->getNextClass($this);
56 $cmd = $this->ctrl->getCmd();
57
58 $this->prepareOutput();
59
60 if (!$this->rbacsystem->checkAccess("visible,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 $ret = $this->ctrl->forwardCommand($perm_gui);
69 break;
70
71 default:
72 if (!$cmd || $cmd == 'view') {
73 $cmd = "editSettings";
74 }
75
76 $this->$cmd();
77 break;
78 }
79 return true;
80 }
81
88 public function getAdminTabs()
89 {
91
92 if ($rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
93 $this->tabs_gui->addTarget(
94 "cont_edit_lrs_settings",
95 $this->ctrl->getLinkTarget($this, "editSettings"),
96 array("editSettings", "view")
97 );
98 }
99
100 if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) {
101 $this->tabs_gui->addTarget(
102 "perm_settings",
103 $this->ctrl->getLinkTargetByClass('ilpermissiongui', "perm"),
104 array(),
105 'ilpermissiongui'
106 );
107 }
108 }
109
113 public function editSettings()
114 {
118
119 $lm_set = new ilSetting("lm");
120 $lng->loadLanguageModule("scormdebug");
121
122 $form = new ilPropertyFormGUI();
123 $form->setFormAction($ilCtrl->getFormAction($this));
124 $form->setTitle($lng->txt("cont_lrs_settings"));
125
126 // Page History
127 $cb_prop = new ilCheckboxInputGUI(
128 $lng->txt("cont_enable_page_history"),
129 "page_history"
130 );
131 $cb_prop->setInfo($lng->txt("cont_enable_page_history_info"));
132 $cb_prop->setChecked($lm_set->get("page_history", 1));
133 $form->addItem($cb_prop);
134
135 // Time scheduled page activation
136 $cb_prop = new ilCheckboxInputGUI(
137 $lng->txt("cont_enable_time_scheduled_page_activation"),
138 "time_scheduled_page_activation"
139 );
140 $cb_prop->setInfo($lng->txt("cont_enable_time_scheduled_page_activation_info"));
141 $cb_prop->setChecked($lm_set->get("time_scheduled_page_activation"));
142 $form->addItem($cb_prop);
143
144 // lm starting point
145 $options = array(
146 "" => $this->lng->txt("cont_last_visited_page"),
147 "first" => $this->lng->txt("cont_first_page")
148 );
149 $si = new ilSelectInputGUI($this->lng->txt("cont_lm_starting_point"), "lm_starting_point");
150 $si->setOptions($options);
151 $si->setValue($lm_set->get("lm_starting_point"));
152 $si->setInfo($this->lng->txt("cont_lm_starting_point_info"));
153 $form->addItem($si);
154
155 // Activate replace media object function
156 $cb_prop = new ilCheckboxInputGUI(
157 $lng->txt("cont_replace_mob_feature"),
158 "replace_mob_feature"
159 );
160 $cb_prop->setInfo($lng->txt("cont_replace_mob_feature_info"));
161 $cb_prop->setChecked($lm_set->get("replace_mob_feature"));
162 $form->addItem($cb_prop);
163
164 // Activate HTML export IDs
165 $cb_prop = new ilCheckboxInputGUI(
166 $lng->txt("cont_html_export_ids"),
167 "html_export_ids"
168 );
169 $cb_prop->setInfo($lng->txt("cont_html_export_ids_info"));
170 $cb_prop->setChecked($lm_set->get("html_export_ids"));
171 $form->addItem($cb_prop);
172
173 // Upload dir for learning resources
174 $tx_prop = new ilTextInputGUI(
175 $lng->txt("cont_upload_dir"),
176 "cont_upload_dir"
177 );
178 $tx_prop->setInfo($lng->txt("cont_upload_dir_info"));
179 $tx_prop->setValue($lm_set->get("cont_upload_dir"));
180 $form->addItem($tx_prop);
181
182 // scormDebugger activation
183 $cb_prop = new ilCheckboxInputGUI($lng->txt("scormdebug_global_activate"), "scormdebug_global_activate");
184 $cb_prop->setInfo($lng->txt("scormdebug_global_activate_info"));
185 $cb_prop->setChecked($lm_set->get("scormdebug_global_activate"));
186 $form->addItem($cb_prop);
187
188 // scorm2004 disableRTECaching
189 $cb_prop = new ilCheckboxInputGUI(
190 $lng->txt("scormdebug_disable_cache"),
191 "scormdebug_disable_cache"
192 );
193 $cb_prop->setInfo($lng->txt("scormdebug_disable_cache_info"));
194 $cb_prop->setChecked($lm_set->get("scormdebug_disable_cache"));
195 $form->addItem($cb_prop);
196
197 // scorm2004 without session
198 $cb_prop = new ilCheckboxInputGUI(
199 $lng->txt("scorm_without_session"),
200 "scorm_without_session"
201 );
202 $cb_prop->setInfo($lng->txt("scorm_without_session_info"));
203 $cb_prop->setChecked($lm_set->get("scorm_without_session"));
204 $form->addItem($cb_prop);
205
207 $check = new ilCheckboxInputGui($lng->txt('enable_sahs_protocol_data'), 'enable_sahs_pd');
208 $check->setInfo($this->lng->txt('enable_sahs_protocol_data_desc'));
209 $check->setChecked($privacy->enabledSahsProtocolData());
210 $form->addItem($check);
211
212 // show and export protocol data with name
213 $check = new ilCheckboxInputGui($this->lng->txt('ps_export_scorm'), 'export_scorm');
214 $check->setInfo($this->lng->txt('enable_export_scorm_desc'));
215 $check->setChecked($privacy->enabledExportSCORM());
216 $form->addItem($check);
217
218 // scorm auto-setting for learning progress
219 $cb_prop = new ilCheckboxInputGUI($lng->txt("scorm_lp_auto_activate"), "scorm_lp_auto_activate");
220 $cb_prop->setInfo($lng->txt("scorm_lp_auto_activate_info"));
221 $cb_prop->setChecked($lm_set->get("scorm_lp_auto_activate"));
222 $form->addItem($cb_prop);
223
224 // command buttons
225 if ($this->checkPermissionBool("write")) {
226 $form->addCommandButton("saveSettings", $lng->txt("save"));
227 $form->addCommandButton("view", $lng->txt("cancel"));
228 }
229
230 $this->tpl->setContent($form->getHTML());
231 }
232
236 public function saveSettings()
237 {
240
241 $this->checkPermission("write");
242
243 $lm_set = new ilSetting("lm");
244 $lm_set->set(
245 "time_scheduled_page_activation",
246 ilUtil::stripSlashes($_POST["time_scheduled_page_activation"])
247 );
248 $lm_set->set(
249 "lm_starting_point",
250 ilUtil::stripSlashes($_POST["lm_starting_point"])
251 );
252 $lm_set->set(
253 "page_history",
254 (int) ilUtil::stripSlashes($_POST["page_history"])
255 );
256 $lm_set->set(
257 "replace_mob_feature",
258 ilUtil::stripSlashes($_POST["replace_mob_feature"])
259 );
260 $lm_set->set(
261 "html_export_ids",
262 ilUtil::stripSlashes($_POST["html_export_ids"])
263 );
264 $lm_set->set(
265 "cont_upload_dir",
266 ilUtil::stripSlashes($_POST["cont_upload_dir"])
267 );
268 $lm_set->setScormDebug(
269 "scormdebug_global_activate",
270 ilUtil::stripSlashes($_POST["scormdebug_global_activate"])
271 );
272 $lm_set->set(
273 "scorm_login_as_learner_id",
274 ilUtil::stripSlashes($_POST["scorm_login_as_learner_id"])
275 );
276 $lm_set->set(
277 "scormdebug_disable_cache",
278 ilUtil::stripSlashes($_POST["scormdebug_disable_cache"])
279 );
280 $lm_set->set(
281 "scorm_without_session",
282 ilUtil::stripSlashes($_POST["scorm_without_session"])
283 );
284 $lm_set->set(
285 "scorm_lp_auto_activate",
286 ilUtil::stripSlashes($_POST["scorm_lp_auto_activate"])
287 );
288
290 $privacy->enableSahsProtocolData((int) $_POST['enable_sahs_pd']);
291 $privacy->enableExportSCORM((int) $_POST['export_scorm']);
292 $privacy->save();
293
294 ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
295
296 $ilCtrl->redirect($this, "view");
297 }
298
299 public function addToExternalSettingsForm($a_form_id)
300 {
301 switch ($a_form_id) {
303
305
306 $fields = array('enable_sahs_protocol_data' => array($privacy->enabledSahsProtocolData(), ilAdministrationSettingsFormHandler::VALUE_BOOL));
307
308 return array(array("editSettings", $fields));
309 }
310 }
311}
$_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.
__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 stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
global $ilCtrl
Definition: ilias.php:18
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ret
Definition: parser.php:6
global $ilSetting
Definition: privfeed.php:17
settings()
Definition: settings.php:2
$lm_set
$DIC
Definition: xapitoken.php:46