ILIAS  release_7 Revision v7.30-3-g800a261c036
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 {
115 $ilCtrl = $this->ctrl;
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 // scormDebugger activation
174 $cb_prop = new ilCheckboxInputGUI($lng->txt("scormdebug_global_activate"), "scormdebug_global_activate");
175 $cb_prop->setInfo($lng->txt("scormdebug_global_activate_info"));
176 $cb_prop->setChecked($lm_set->get("scormdebug_global_activate"));
177 $form->addItem($cb_prop);
178
179 // scorm2004 disableRTECaching
180 $cb_prop = new ilCheckboxInputGUI(
181 $lng->txt("scormdebug_disable_cache"),
182 "scormdebug_disable_cache"
183 );
184 $cb_prop->setInfo($lng->txt("scormdebug_disable_cache_info"));
185 $cb_prop->setChecked($lm_set->get("scormdebug_disable_cache"));
186 $form->addItem($cb_prop);
187
188 // scorm2004 without session
189 $cb_prop = new ilCheckboxInputGUI(
190 $lng->txt("scorm_without_session"),
191 "scorm_without_session"
192 );
193 $cb_prop->setInfo($lng->txt("scorm_without_session_info"));
194 $cb_prop->setChecked($lm_set->get("scorm_without_session"));
195 $form->addItem($cb_prop);
196
198 $check = new ilCheckboxInputGui($lng->txt('enable_sahs_protocol_data'), 'enable_sahs_pd');
199 $check->setInfo($this->lng->txt('enable_sahs_protocol_data_desc'));
200 $check->setChecked($privacy->enabledSahsProtocolData());
201 $form->addItem($check);
202
203 // show and export protocol data with name
204 $check = new ilCheckboxInputGui($this->lng->txt('ps_export_scorm'), 'export_scorm');
205 $check->setInfo($this->lng->txt('enable_export_scorm_desc'));
206 $check->setChecked($privacy->enabledExportSCORM());
207 $form->addItem($check);
208
209 // scorm auto-setting for learning progress
210 $cb_prop = new ilCheckboxInputGUI($lng->txt("scorm_lp_auto_activate"), "scorm_lp_auto_activate");
211 $cb_prop->setInfo($lng->txt("scorm_lp_auto_activate_info"));
212 $cb_prop->setChecked($lm_set->get("scorm_lp_auto_activate"));
213 $form->addItem($cb_prop);
214
215 // command buttons
216 if ($this->checkPermissionBool("write")) {
217 $form->addCommandButton("saveSettings", $lng->txt("save"));
218 $form->addCommandButton("view", $lng->txt("cancel"));
219 }
220
221 $this->tpl->setContent($form->getHTML());
222 }
223
227 public function saveSettings()
228 {
229 $ilCtrl = $this->ctrl;
231
232 $this->checkPermission("write");
233
234 $lm_set = new ilSetting("lm");
235 $lm_set->set(
236 "time_scheduled_page_activation",
237 ilUtil::stripSlashes($_POST["time_scheduled_page_activation"])
238 );
239 $lm_set->set(
240 "lm_starting_point",
241 ilUtil::stripSlashes($_POST["lm_starting_point"])
242 );
243 $lm_set->set(
244 "page_history",
245 (int) ilUtil::stripSlashes($_POST["page_history"])
246 );
247 $lm_set->set(
248 "replace_mob_feature",
249 ilUtil::stripSlashes($_POST["replace_mob_feature"])
250 );
251 $lm_set->set(
252 "html_export_ids",
253 ilUtil::stripSlashes($_POST["html_export_ids"])
254 );
255 $lm_set->setScormDebug(
256 "scormdebug_global_activate",
257 ilUtil::stripSlashes($_POST["scormdebug_global_activate"])
258 );
259 $lm_set->set(
260 "scorm_login_as_learner_id",
261 ilUtil::stripSlashes($_POST["scorm_login_as_learner_id"])
262 );
263 $lm_set->set(
264 "scormdebug_disable_cache",
265 ilUtil::stripSlashes($_POST["scormdebug_disable_cache"])
266 );
267 $lm_set->set(
268 "scorm_without_session",
269 ilUtil::stripSlashes($_POST["scorm_without_session"])
270 );
271 $lm_set->set(
272 "scorm_lp_auto_activate",
273 ilUtil::stripSlashes($_POST["scorm_lp_auto_activate"])
274 );
275
277 $privacy->enableSahsProtocolData((int) $_POST['enable_sahs_pd']);
278 $privacy->enableExportSCORM((int) $_POST['export_scorm']);
279 $privacy->save();
280
281 ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
282
283 $ilCtrl->redirect($this, "view");
284 }
285
286 public function addToExternalSettingsForm($a_form_id)
287 {
288 switch ($a_form_id) {
290
292
293 $fields = array('enable_sahs_protocol_data' => array($privacy->enabledSahsProtocolData(), ilAdministrationSettingsFormHandler::VALUE_BOOL));
294
295 return array(array("editSettings", $fields));
296 }
297 }
298}
$_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.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ret
Definition: parser.php:6
global $ilSetting
Definition: privfeed.php:17
settings()
Definition: settings.php:2
$lm_set