ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjLearningResourcesSettingsGUI.php
Go to the documentation of this file.
1<?php
2
28{
33 public function __construct(
34 $a_data,
35 int $a_id,
36 bool $a_call_by_reference = true,
37 bool $a_prepare_output = true
38 ) {
39 global $DIC;
40
41 $this->access = $DIC->access();
42 $this->settings = $DIC->settings();
43 $this->ctrl = $DIC->ctrl();
44 $this->lng = $DIC->language();
45 $this->type = 'lrss';
46 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
47
48 $this->lng->loadLanguageModule('content');
49 $this->lng->loadLanguageModule('lm');
50 }
51
52 public function executeCommand(): void
53 {
54 $next_class = $this->ctrl->getNextClass($this);
55 $cmd = $this->ctrl->getCmd();
56
57 $this->prepareOutput();
58
59 if (!$this->rbac_system->checkAccess("visible,read", $this->object->getRefId())) {
60 throw new ilPermissionException($this->lng->txt('no_permission'));
61 }
62
63 switch ($next_class) {
64 case 'ilpermissiongui':
65 $this->tabs_gui->setTabActive('perm_settings');
66 $perm_gui = new ilPermissionGUI($this);
67 $ret = $this->ctrl->forwardCommand($perm_gui);
68 break;
69
70 default:
71 if (!$cmd || $cmd == 'view') {
72 $cmd = "editSettings";
73 }
74 $this->$cmd();
75 break;
76 }
77 }
78
79 public function getAdminTabs(): void
80 {
82
83 if ($rbac_system->checkAccess("visible,read", $this->object->getRefId())) {
84 $this->tabs_gui->addTarget(
85 "cont_edit_lrs_settings",
86 $this->ctrl->getLinkTarget($this, "editSettings"),
87 array("editSettings", "view")
88 );
89 }
90
91 if ($rbac_system->checkAccess('edit_permission', $this->object->getRefId())) {
92 $this->tabs_gui->addTarget(
93 "perm_settings",
94 $this->ctrl->getLinkTargetByClass('ilpermissiongui', "perm"),
95 array(),
96 'ilpermissiongui'
97 );
98 }
99 }
100
101 public function editSettings(?ilPropertyFormGUI $form = null): void
102 {
103 if (is_null($form)) {
104 $form = $this->getSettingsForm();
105 }
106 $this->tpl->setContent($form->getHTML());
107 }
108
110 {
111 $ilCtrl = $this->ctrl;
113
114 $lm_set = new ilSetting("lm");
115 $lng->loadLanguageModule("scormdebug");
116
117 $form = new ilPropertyFormGUI();
118 $form->setFormAction($ilCtrl->getFormAction($this));
119 $form->setTitle($lng->txt("cont_lrs_settings") . " - " . $lng->txt("obj_lm"));
120
121 // Page History
122 $cb_prop = new ilCheckboxInputGUI(
123 $lng->txt("cont_enable_page_history"),
124 "page_history"
125 );
126 $cb_prop->setInfo($lng->txt("cont_enable_page_history_info"));
127 $cb_prop->setChecked((bool) $lm_set->get("page_history", '1'));
128 $form->addItem($cb_prop);
129
130 // Time scheduled page activation
131 $cb_prop = new ilCheckboxInputGUI(
132 $lng->txt("cont_enable_time_scheduled_page_activation"),
133 "time_scheduled_page_activation"
134 );
135 $cb_prop->setInfo($lng->txt("cont_enable_time_scheduled_page_activation_info"));
136 $cb_prop->setChecked((bool) $lm_set->get("time_scheduled_page_activation"));
137 $form->addItem($cb_prop);
138
139 // lm starting point
140 $options = array(
141 "" => $this->lng->txt("cont_last_visited_page"),
142 "first" => $this->lng->txt("cont_first_page")
143 );
144 $si = new ilSelectInputGUI($this->lng->txt("cont_lm_starting_point"), "lm_starting_point");
145 $si->setOptions($options);
146 $si->setValue($lm_set->get("lm_starting_point"));
147 $si->setInfo($this->lng->txt("cont_lm_starting_point_info"));
148 $form->addItem($si);
149
150 // Activate replace media object function
151 $cb_prop = new ilCheckboxInputGUI(
152 $lng->txt("cont_replace_mob_feature"),
153 "replace_mob_feature"
154 );
155 $cb_prop->setInfo($lng->txt("cont_replace_mob_feature_info"));
156 $cb_prop->setChecked((bool) $lm_set->get("replace_mob_feature"));
157 $form->addItem($cb_prop);
158
159 // Activate HTML export IDs
160 $cb_prop = new ilCheckboxInputGUI(
161 $lng->txt("cont_html_export_ids"),
162 "html_export_ids"
163 );
164 $cb_prop->setInfo($lng->txt("cont_html_export_ids_info"));
165 $cb_prop->setChecked((bool) $lm_set->get("html_export_ids"));
166 $form->addItem($cb_prop);
167
168 // Activate replace media object function
169 $cb_prop = new ilCheckboxInputGUI(
170 $lng->txt("lm_est_reading_time"),
171 "lm_est_reading_time"
172 );
173 $cb_prop->setInfo($lng->txt("lm_est_reading_time_info"));
174 $cb_prop->setChecked((bool) $lm_set->get("est_reading_time"));
175 $form->addItem($cb_prop);
176
177 $sh = new ilFormSectionHeaderGUI();
178 $sh->setTitle($lng->txt("cont_lrs_settings") . " - " . $lng->txt("obj_sahs"));
179 $form->addItem($sh);
180
181 // scormDebugger activation
182 $cb_prop = new ilCheckboxInputGUI($lng->txt("scormdebug_global_activate"), "scormdebug_global_activate");
183 $cb_prop->setInfo($lng->txt("scormdebug_global_activate_info"));
184 $cb_prop->setChecked((bool) $lm_set->get("scormdebug_global_activate"));
185 $form->addItem($cb_prop);
186
187 // scorm2004 disableRTECaching
188 $cb_prop = new ilCheckboxInputGUI(
189 $lng->txt("scormdebug_disable_cache"),
190 "scormdebug_disable_cache"
191 );
192 $cb_prop->setInfo($lng->txt("scormdebug_disable_cache_info"));
193 $cb_prop->setChecked((bool) $lm_set->get("scormdebug_disable_cache"));
194 $form->addItem($cb_prop);
195
196 // scorm2004 without session
197 $cb_prop = new ilCheckboxInputGUI(
198 $lng->txt("scorm_without_session"),
199 "scorm_without_session"
200 );
201 $cb_prop->setInfo($lng->txt("scorm_without_session_info"));
202 $cb_prop->setChecked((bool) $lm_set->get("scorm_without_session"));
203 $form->addItem($cb_prop);
204
206 $check = new ilCheckboxInputGUI($lng->txt('enable_sahs_protocol_data'), 'enable_sahs_pd');
207 $check->setInfo($this->lng->txt('enable_sahs_protocol_data_desc'));
208 $check->setChecked((bool) $privacy->enabledSahsProtocolData());
209 $form->addItem($check);
210
211 // show and export protocol data with name
212 $check = new ilCheckboxInputGUI($this->lng->txt('ps_export_scorm'), 'export_scorm');
213 $check->setInfo($this->lng->txt('enable_export_scorm_desc'));
214 $check->setChecked($privacy->enabledExportSCORM());
215 $form->addItem($check);
216
217 // scorm auto-setting for learning progress
218 $cb_prop = new ilCheckboxInputGUI($lng->txt("scorm_lp_auto_activate"), "scorm_lp_auto_activate");
219 $cb_prop->setInfo($lng->txt("scorm_lp_auto_activate_info"));
220 $cb_prop->setChecked((bool) $lm_set->get("scorm_lp_auto_activate"));
221 $form->addItem($cb_prop);
222
223 // command buttons
224 if ($this->checkPermissionBool("write")) {
225 $form->addCommandButton("saveSettings", $lng->txt("save"));
226 $form->addCommandButton("view", $lng->txt("cancel"));
227 }
228 return $form;
229 }
230
231 public function saveSettings(): void
232 {
233 $ilCtrl = $this->ctrl;
234
235 $form = $this->getSettingsForm();
236
237 $this->checkPermission("write");
238
239 if ($form->checkInput()) {
240 $lm_set = new ilSetting("lm");
241 $lm_set->set(
242 "time_scheduled_page_activation",
243 $form->getInput("time_scheduled_page_activation")
244 );
245 $lm_set->set(
246 "lm_starting_point",
247 $form->getInput("lm_starting_point")
248 );
249 $lm_set->set(
250 "page_history",
251 $form->getInput("page_history")
252 );
253 $lm_set->set(
254 "replace_mob_feature",
255 $form->getInput("replace_mob_feature")
256 );
257 $lm_set->set(
258 "html_export_ids",
259 $form->getInput("html_export_ids")
260 );
261 $lm_set->setScormDebug(
262 "scormdebug_global_activate",
263 $form->getInput("scormdebug_global_activate")
264 );
265 $lm_set->set(
266 "scorm_login_as_learner_id",
267 $form->getInput("scorm_login_as_learner_id")
268 );
269 $lm_set->set(
270 "scormdebug_disable_cache",
271 $form->getInput("scormdebug_disable_cache")
272 );
273 $lm_set->set(
274 "scorm_without_session",
275 $form->getInput("scorm_without_session")
276 );
277 $lm_set->set(
278 "scorm_lp_auto_activate",
279 $form->getInput("scorm_lp_auto_activate")
280 );
281 $lm_set->set(
282 "est_reading_time",
283 $form->getInput("lm_est_reading_time")
284 );
285
286
288 $privacy->enableSahsProtocolData((int) $form->getInput('enable_sahs_pd'));
289 $privacy->enableExportSCORM((int) $form->getInput('export_scorm'));
290 $privacy->save();
291
292 $this->tpl->setOnScreenMessage('success', $this->lng->txt("settings_saved"), true);
293 $ilCtrl->redirect($this, "view");
294 } else {
295 $form->setValuesByPost();
296 $this->editSettings($form);
297 }
298 }
299
300 public function addToExternalSettingsForm(int $a_form_id): array
301 {
302 switch ($a_form_id) {
304
306
307 $fields = array('enable_sahs_protocol_data' => array($privacy->enabledSahsProtocolData(), ilAdministrationSettingsFormHandler::VALUE_BOOL));
308
309 return array(array("editSettings", $fields));
310 }
311 return [];
312 }
313}
$check
Definition: buildRTE.php:81
This class represents a checkbox property in a property form.
This class represents a section header in a property form.
loadLanguageModule(string $a_module)
Load language module.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getAdminTabs()
administration tabs show only permissions and trash folder
__construct( $a_data, int $a_id, bool $a_call_by_reference=true, bool $a_prepare_output=true)
Class ilObjectGUI Basic methods of all Output classes.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
ilRbacSystem $rbac_system
prepareOutput(bool $show_sub_objects=true)
ilLanguage $lng
This class represents a property form user interface.
checkAccess(string $a_operations, int $a_ref_id, string $a_type="")
checkAccess represents the main method of the RBAC-system in ILIAS3 developers want to use With this ...
This class represents a selection list property in a property form.
ILIAS Setting Class.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26
$lm_set