ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilObjSCORM2004LearningModuleGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
37 {
39  protected \ILIAS\DI\Container $dic;
40  protected ilTabsGUI $tabs;
42  protected ilHelpGUI $help;
45 
46  public function __construct(array $a_data, int $a_id, bool $a_call_by_reference, ?bool $a_prepare_output = true)
47  {
48  global $DIC;
49  $this->dic = $DIC;
50  $this->lng = $DIC->language();
51  $this->access = $DIC->access();
52  $this->ctrl = $DIC->ctrl();
53  $this->tpl = $DIC["tpl"];
54  $this->tabs = $DIC->tabs();
55  $this->rbacsystem = $DIC->rbac()->system();
56  $this->tree = $DIC->repositoryTree();
57  $this->toolbar = $DIC->toolbar();
58  $this->settings = $DIC->settings();
59  $this->help = $DIC["ilHelp"];
60  $this->error = $DIC["ilErr"];
61  $this->user = $DIC->user();
62  $this->tool_context = $DIC->globalScreen()->tool()->context();
63  $lng = $DIC->language();
64 
65  $lng->loadLanguageModule("content");
66  $lng->loadLanguageModule("sahs");
67  $lng->loadLanguageModule("search");
68  $lng->loadLanguageModule("exp");
69  $this->type = "sahs";
70  parent::__construct($a_data, $a_id, $a_call_by_reference, false);
71  #$this->tabs_gui = new ilTabsGUI();
72  }
73 
77  protected function assignObject(): void
78  {
79  if ($this->id != 0) {
80  if ($this->call_by_reference) {
81  $this->object = new ilObjSCORM2004LearningModule($this->id, true);
82  } else {
83  $this->object = new ilObjSCORM2004LearningModule($this->id, false);
84  }
85  }
86  }
87 
88  public function executeCommand(): void
89  {
90  $ilCtrl = $this->ctrl;
91 
92  $next_class = $ilCtrl->getNextClass($this);
93  $cmd = $ilCtrl->getCmd();
94  parent::executeCommand();
95  $this->addHeaderAction();
96  }
97 
101  public function properties(): void
102  {
103  $rbacsystem = $this->rbacsystem;
104  $tree = $this->tree;
105  $tpl = $this->tpl;
106  $lng = $this->lng;
107  $ilToolbar = $this->toolbar;
108  $ilCtrl = $this->ctrl;
110  $ilTabs = $this->tabs;
111 
112  $this->setSettingsSubTabs();
113  $ilTabs->setSubTabActive('cont_settings');
114  // view
115  $ilToolbar->addButtonInstance($this->object->getViewButton());
116 
117  // output forms
118  $this->initPropertiesForm();
119  $this->getPropertiesFormValues();
120  $tpl->setContent($this->form->getHTML());
121  }
122 
126  public function initPropertiesForm(): void
127  {
128  $lng = $this->lng;
129  $ilCtrl = $this->ctrl;
130  $obj_service = $this->getObjectService();
131 
132  //check/select only once
133  $this->object->checkMasteryScoreValues();
134 
135  $this->form = new ilPropertyFormGUI();
136  $this->form->setFormAction($ilCtrl->getFormAction($this));
137  $this->form->setTitle($this->lng->txt("cont_lm_properties"));
138 
139  //title
140  $ti = new ilTextInputGUI($this->lng->txt("title"), "Fobject_title");
141  $ti->setMaxLength(200);
142  $this->form->addItem($ti);
143 
144  //description
145  $ti = new ilTextAreaInputGUI($this->lng->txt("description"), "Fobject_description");
146  $ti->setCols(40);
147  $ti->setRows(2);
148  $this->form->addItem($ti);
149 
150  // SCORM-type
151  $ne = new ilNonEditableValueGUI($this->lng->txt("type"), "");
152  $ne->setValue($this->lng->txt("lm_type_" . ilObjSAHSLearningModule::_lookupSubType($this->object->getID())));
153  $this->form->addItem($ne);
154 
155  // version
156  $ne = new ilNonEditableValueGUI($this->lng->txt("cont_sc_version"), "");
157  $ne->setValue($this->object->getModuleVersion());
158  $ne->setInfo($this->lng->txt("cont_sc_version_info"));
159  $this->form->addItem($ne);
160 
161  //
162  // activation
163  //
164  $sh = new ilFormSectionHeaderGUI();
165  $sh->setTitle($this->lng->txt("activation"));
166  $this->form->addItem($sh);
167 
168  // online
169  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_online"), "cobj_online");
170  $cb->setInfo($this->lng->txt("cont_online_info"));
171  $this->form->addItem($cb);
172 
173 
174  //
175  // presentation
176  //
177  $sh = new ilFormSectionHeaderGUI();
178  $sh->setTitle($this->lng->txt("cont_presentation"));
179  $this->form->addItem($sh);
180 
181  // display mode (open)
182  // $options = array(
183  // "0" => $this->lng->txt("cont_open_normal"),
184  // "1" => $this->lng->txt("cont_open_iframe_max"),
185  // "2" => $this->lng->txt("cont_open_iframe_defined"),
186  // "5" => $this->lng->txt("cont_open_window_undefined"),
187  // "6" => $this->lng->txt("cont_open_window_defined")
188  // );
189  // $si = new ilSelectInputGUI($this->lng->txt("cont_open"), "open_mode");
190  // $si->setOptions($options);
191  // $si->setValue($this->object->getOpenMode());
192  // $this->form->addItem($si);
193 
194  $radg = new ilRadioGroupInputGUI($lng->txt("cont_open"), "open_mode");
195  $op0 = new ilRadioOption($this->lng->txt("cont_open_normal"), "0");
196  $op0->setInfo($this->lng->txt("cont_open_normal_info"));
197  $radg->addOption($op0);
198  $op1 = new ilRadioOption($this->lng->txt("cont_open_iframe"), "1");
199  $op1->setInfo($this->lng->txt("cont_open_iframe_info"));
200  $radg->addOption($op1);
201  $op2 = new ilRadioOption($this->lng->txt("cont_open_window"), "5");
202  $op2->setInfo($this->lng->txt("cont_open_window_info"));
203  $radg->addOption($op2);
204  // width
205  $ni = new ilNumberInputGUI($this->lng->txt("cont_width"), "width_0");
206  $ni->setMaxLength(4);
207  $ni->setSize(4);
208  $op1->addSubItem($ni);
209  $ni = new ilNumberInputGUI($this->lng->txt("cont_width"), "width_1");
210  $ni->setMaxLength(4);
211  $ni->setSize(4);
212  $op2->addSubItem($ni);
213  // height
214  $ni = new ilNumberInputGUI($this->lng->txt("cont_height"), "height_0");
215  $ni->setMaxLength(4);
216  $ni->setSize(4);
217  $ni->setInfo($this->lng->txt("cont_width_height_info"));
218  $op1->addSubItem($ni);
219  $ni = new ilNumberInputGUI($this->lng->txt("cont_height"), "height_1");
220  $ni->setMaxLength(4);
221  $ni->setSize(4);
222  $ni->setInfo($this->lng->txt("cont_width_height_info"));
223  $op2->addSubItem($ni);
224 
225  // force IE to render again
226  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_ie_force_render"), "cobj_ie_force_render");
227  $cb->setValue("y");
228  $cb->setInfo($this->lng->txt("cont_ie_force_render_info"));
229  $op2->addSubItem($cb);
230 
231  $this->form->addItem($radg);
232 
233 
234  // disable top menu
235  //Hide Top Navigation Bar
236  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_nomenu"), "cobj_nomenu");
237  $cb->setValue("y");
238  $cb->setInfo($this->lng->txt("cont_nomenu_info"));
239  $this->form->addItem($cb);
240 
241  // disable left-side navigation
242  // Hide Left Navigation Tree
243  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_hidenavig"), "cobj_hidenavig");
244  $cb->setValue("y");
245  $cb->setInfo($this->lng->txt("cont_hidenavig_info"));
246  $this->form->addItem($cb);
247 
248  // auto navigation to last visited item
249  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_auto_last_visited"), "cobj_auto_last_visited");
250  $cb->setValue("y");
251  $cb->setInfo($this->lng->txt("cont_auto_last_visited_info"));
252  $this->form->addItem($cb);
253 
254  // tile image
255  $obj_service->commonSettings()->legacyForm($this->form, $this->object)->addTileImage();
256 
257  //
258  // scorm options
259  //
260  $sh = new ilFormSectionHeaderGUI();
261  $sh->setTitle($this->lng->txt("cont_scorm_options"));
262  $this->form->addItem($sh);
263 
264  // lesson mode
265  $radg = new ilRadioGroupInputGUI($lng->txt("cont_def_lesson_mode"), "lesson_mode");
266  $op0 = new ilRadioOption($this->lng->txt("cont_sc_less_mode_normal"), "normal");
267  $op0->setInfo($this->lng->txt("cont_sc_less_mode_normal_info"));
268  $radg->addOption($op0);
269  $op1 = new ilRadioOption($this->lng->txt("cont_sc_less_mode_browse"), "browse");
270  $op1->setInfo($this->lng->txt("cont_sc_less_mode_browse_info"));
271  $radg->addOption($op1);
272  // set lesson mode review when completed
273  $options = array(
274  "n" => $this->lng->txt("cont_sc_auto_review_no"),
275  "r" => $this->lng->txt("cont_sc_auto_review_completed_not_failed_or_passed"),
276  "p" => $this->lng->txt("cont_sc_auto_review_passed"),
277  "q" => $this->lng->txt("cont_sc_auto_review_passed_or_failed"),
278  "c" => $this->lng->txt("cont_sc_auto_review_completed"),
279  "d" => $this->lng->txt("cont_sc_auto_review_completed_and_passed"),
280  "y" => $this->lng->txt("cont_sc_auto_review_completed_or_passed"),
281  "s" => $this->lng->txt("cont_sc_store_if_previous_score_was_lower")
282  );
283  $si = new ilSelectInputGUI($this->lng->txt("cont_sc_auto_review_2004"), "auto_review");
284  $si->setOptions($options);
285  $si->setInfo($this->lng->txt("cont_sc_auto_review_info_2004"));
286  $op0->addSubItem($si);
287  // end lesson mode
288  $this->form->addItem($radg);
289 
290  // mastery_score
291  if ($this->object->getMasteryScoreValues() != "") {
292  $ni = new ilNumberInputGUI($this->lng->txt("cont_mastery_score_2004"), "mastery_score");
293  $ni->setMaxLength(3);
294  $ni->setSize(3);
295  $ni->setInfo($this->lng->txt("cont_mastery_score_2004_info") . ' ' . $this->object->getMasteryScoreValues());
296  $this->form->addItem($ni);
297  }
298 
299  //
300  // rte settings
301  //
302  $sh = new ilFormSectionHeaderGUI();
303  $sh->setTitle($this->lng->txt("cont_rte_settings"));
304  $this->form->addItem($sh);
305 
306  // unlimited session timeout
307  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_sc_usession"), "cobj_session");
308  $cb->setValue("y");
309  $cb->setInfo($this->lng->txt("cont_sc_usession_info"));
310  $this->form->addItem($cb);
311 
312  // SCORM 2004 fourth edition features
313  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_fourth_edition"), "cobj_fourth_edition");
314  $cb->setValue("y");
315  $cb->setInfo($this->lng->txt("cont_fourth_edition_info"));
316  $this->form->addItem($cb);
317 
318  // sequencing
319  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_sequencing"), "cobj_sequencing");
320  $cb->setValue("y");
321  $cb->setInfo($this->lng->txt("cont_sequencing_info"));
322  $this->form->addItem($cb);
323 
324  // storage of interactions
325  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_interactions"), "cobj_interactions");
326  $cb->setValue("y");
327  $cb->setInfo($this->lng->txt("cont_interactions_info"));
328  $this->form->addItem($cb);
329 
330  // objectives
331  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_objectives"), "cobj_objectives");
332  $cb->setValue("y");
333  $cb->setInfo($this->lng->txt("cont_objectives_info"));
334  $this->form->addItem($cb);
335 
336  // comments
337  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_comments"), "cobj_comments");
338  $cb->setValue("y");
339  $cb->setInfo($this->lng->txt("cont_comments_info"));
340  $this->form->addItem($cb);
341 
342  // time from lms
343  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_time_from_lms"), "cobj_time_from_lms");
344  $cb->setValue("y");
345  $cb->setInfo($this->lng->txt("cont_time_from_lms_info"));
346  $this->form->addItem($cb);
347 
348  // check values
349  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_check_values"), "cobj_check_values");
350  $cb->setValue("y");
351  $cb->setInfo($this->lng->txt("cont_check_values_info"));
352  $this->form->addItem($cb);
353 
354  // auto cmi.exit to suspend
355  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_auto_suspend"), "cobj_auto_suspend");
356  $cb->setValue("y");
357  $cb->setInfo($this->lng->txt("cont_auto_suspend_info"));
358  $this->form->addItem($cb);
359 
360  // settings for student_id
361  $options = array(
362  0 => $this->lng->txt("cont_sc_id_setting_user_id"),
363  1 => $this->lng->txt("cont_sc_id_setting_user_login"),
364  2 => $this->lng->txt("cont_sc_id_setting_user_id_plus_ref_id"),
365  3 => $this->lng->txt("cont_sc_id_setting_user_login_plus_ref_id"),
366  4 => $this->lng->txt("cont_sc_id_setting_user_id_plus_obj_id"),
367  5 => $this->lng->txt("cont_sc_id_setting_user_login_plus_obj_id")
368  );
369  $si = new ilSelectInputGUI($this->lng->txt("cont_sc_id_setting_2004"), "id_setting");
370  $si->setOptions($options);
371  $si->setInfo($this->lng->txt("cont_sc_id_setting_info"));
372  $this->form->addItem($si);
373 
374  // settings for student_name
375  $options = array(
376  0 => $this->lng->txt("cont_sc_name_setting_last_firstname"),
377  1 => $this->lng->txt("cont_sc_name_setting_first_lastname"),
378  2 => $this->lng->txt("cont_sc_name_setting_fullname"),
379  3 => $this->lng->txt("cont_sc_name_setting_salutation_lastname"),
380  4 => $this->lng->txt("cont_sc_name_setting_first_name"),
381  9 => $this->lng->txt("cont_sc_name_setting_no_name")
382  );
383  $si = new ilSelectInputGUI($this->lng->txt("cont_sc_name_setting_2004"), "name_setting");
384  $si->setOptions($options);
385  $si->setInfo($this->lng->txt("cont_sc_name_setting_info"));
386  $this->form->addItem($si);
387 
388  //
389  // debugging
390  //
391  $sh = new ilFormSectionHeaderGUI();
392  $sh->setTitle($this->lng->txt("cont_debugging"));
393  $this->form->addItem($sh);
394 
395  // test tool
396  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_debug"), "cobj_debug");
397  $cb->setValue("y");
398  if ($this->object->getDebugActivated() == false) {
399  $cb->setDisabled(true);
400  $cb->setInfo($this->lng->txt("cont_debug_deactivated"));
401  } else {
402  $cb->setInfo($this->lng->txt("cont_debug_deactivate"));
403  }
404  $this->form->addItem($cb);
405  $this->form->addCommandButton("saveProperties", $lng->txt("save"));
406  }
407 
408 
412  public function getPropertiesFormValues(): void
413  {
414  $values = array();
415  $values["Fobject_title"] = $this->object->getTitle();
416  $values["Fobject_description"] = $this->object->getLongDescription();
417  if (!$this->object->getOfflineStatus()) {
418  $values["cobj_online"] = true;
419  }
420  $values["open_mode"] = $this->object->getOpenMode();
421  $values["width_0"] = $this->object->getWidth();
422  $values["width_1"] = $this->object->getWidth();
423  $values["height_0"] = $this->object->getHeight();
424  $values["height_1"] = $this->object->getHeight();
425  $values["cobj_ie_force_render"] = $this->object->getIe_force_render();
426  $values["cobj_nomenu"] = $this->object->getNoMenu();
427  $values["cobj_hidenavig"] = $this->object->getHideNavig();
428  $values["cobj_auto_last_visited"] = $this->object->getAuto_last_visited();
429  $values["lesson_mode"] = $this->object->getDefaultLessonMode();
430  $values["auto_review"] = $this->object->getAutoReviewChar();
431  $values["mastery_score"] = $this->object->getMasteryScore();
432  $values["cobj_session"] = $this->object->getSession();
433  $values["cobj_fourth_edition"] = $this->object->getFourth_edition();
434  $values["cobj_sequencing"] = $this->object->getSequencing();
435  $values["cobj_interactions"] = $this->object->getInteractions();
436  $values["cobj_objectives"] = $this->object->getObjectives();
437  $values["cobj_comments"] = $this->object->getComments();
438  $values["cobj_time_from_lms"] = $this->object->getTime_from_lms();
439  $values["cobj_check_values"] = $this->object->getCheck_values();
440  $values["cobj_auto_suspend"] = $this->object->getAutoSuspend();
441  $values["id_setting"] = $this->object->getIdSetting();
442  $values["name_setting"] = $this->object->getNameSetting();
443  $values["cobj_debug"] = $this->object->getDebug();
444  $this->form->setValuesByArray($values);
445  }
446 
450  public function saveProperties(): void
451  {
453  $obj_service = $this->getObjectService();
454  $this->initPropertiesForm();
455  $this->form->checkInput();
456  if ($this->dic->http()->wrapper()->post()->has('mastery_score')) {
457  $sMasteryScore = $this->dic->http()->wrapper()->post()->retrieve('mastery_score', $this->dic->refinery()->kindlyTo()->string());
458  if ($sMasteryScore !== "") {
459  $this->object->setMasteryScore((int) $sMasteryScore);
460  } else {
461  $this->object->setMasteryScore(null);
462  }
463  }
464 
465  $t_auto_review = $this->dic->http()->wrapper()->post()->retrieve('auto_review', $this->dic->refinery()->kindlyTo()->string());
466  $t_auto_suspend = $this->dic->http()->wrapper()->post()->has('cobj_auto_suspend');
467  $t_session = $this->dic->http()->wrapper()->post()->has('cobj_session');
468  if ($t_auto_review === "s") {
469  $t_auto_suspend = true;
470  //if not storing without session
471  $t_session = true;
472  }
473 
474  $t_height = $this->object->getHeight();
475  if ($this->dic->http()->wrapper()->post()->retrieve('height_0', $this->dic->refinery()->kindlyTo()->int()) != $this->object->getHeight()) {
476  $t_height = $this->dic->http()->wrapper()->post()->retrieve('height_0', $this->dic->refinery()->kindlyTo()->int());
477  }
478  if ($this->dic->http()->wrapper()->post()->retrieve('height_1', $this->dic->refinery()->kindlyTo()->int()) != $this->object->getHeight()) {
479  $t_height = $this->dic->http()->wrapper()->post()->retrieve('height_1', $this->dic->refinery()->kindlyTo()->int());
480  }
481 
482  $t_width = $this->object->getWidth();
483  if ($this->dic->http()->wrapper()->post()->retrieve('width_0', $this->dic->refinery()->kindlyTo()->int()) != $this->object->getWidth()) {
484  $t_width = $this->dic->http()->wrapper()->post()->retrieve('width_0', $this->dic->refinery()->kindlyTo()->int());
485  }
486  if ($this->dic->http()->wrapper()->post()->retrieve('width_1', $this->dic->refinery()->kindlyTo()->int()) != $this->object->getWidth()) {
487  $t_width = $this->dic->http()->wrapper()->post()->retrieve('width_1', $this->dic->refinery()->kindlyTo()->int());
488  }
489 
490  $this->object->setOfflineStatus(!($this->dic->http()->wrapper()->post()->has('cobj_online')));
491  $this->object->setOpenMode($this->dic->http()->wrapper()->post()->retrieve('open_mode', $this->dic->refinery()->kindlyTo()->int()));
492  $this->object->setWidth($t_width);
493  $this->object->setHeight($t_height);
494  // $this->object->setMaxAttempt($this->dic->http()->wrapper()->post()->retrieve('max_attempt',$this->dic->refinery()->kindlyTo()->int()));
495  $this->object->setAutoReviewChar($t_auto_review);
496  $this->object->setDefaultLessonMode($this->dic->http()->wrapper()->post()->retrieve('lesson_mode', $this->dic->refinery()->kindlyTo()->string()));
497  $this->object->setSession($t_session);
498  $this->object->setNoMenu($this->dic->http()->wrapper()->post()->has('cobj_nomenu'));
499  $this->object->setHideNavig($this->dic->http()->wrapper()->post()->has('cobj_hidenavig'));
500  $this->object->setAuto_last_visited($this->dic->http()->wrapper()->post()->has('cobj_auto_last_visited'));
501  $this->object->setIe_force_render($this->dic->http()->wrapper()->post()->has('cobj_ie_force_render'));
502  $this->object->setFourth_edition($this->dic->http()->wrapper()->post()->has('cobj_fourth_edition'));
503  $this->object->setSequencing($this->dic->http()->wrapper()->post()->has('cobj_sequencing'));
504  $this->object->setInteractions($this->dic->http()->wrapper()->post()->has('cobj_interactions'));
505  $this->object->setObjectives($this->dic->http()->wrapper()->post()->has('cobj_objectives'));
506  $this->object->setComments($this->dic->http()->wrapper()->post()->has('cobj_comments'));
507  $this->object->setTime_from_lms($this->dic->http()->wrapper()->post()->has('cobj_time_from_lms'));
508  $this->object->setCheck_values($this->dic->http()->wrapper()->post()->has('cobj_check_values'));
509  $this->object->setAutoSuspend($t_auto_suspend);
510  // $this->object->setOfflineMode($tmpOfflineMode);
511  $this->object->setDebug($this->dic->http()->wrapper()->post()->has('cobj_debug'));//ilUtil::yn2tf($this->dic->http()->wrapper()->post()->retrieve('cobj_debug',$this->dic->refinery()->kindlyTo()->string())));
512  $this->object->setIdSetting($this->dic->http()->wrapper()->post()->retrieve('id_setting', $this->dic->refinery()->kindlyTo()->int()));
513  $this->object->setNameSetting($this->dic->http()->wrapper()->post()->retrieve('name_setting', $this->dic->refinery()->kindlyTo()->int()));
514  $this->object->setTitle($this->dic->http()->wrapper()->post()->retrieve('Fobject_title', $this->dic->refinery()->kindlyTo()->string()));
515  $this->object->setDescription($this->dic->http()->wrapper()->post()->retrieve('Fobject_description', $this->dic->refinery()->kindlyTo()->string()));
516 
517  // tile image
518  $obj_service->commonSettings()->legacyForm($this->form, $this->object)->saveTileImage();
519 
520  $this->object->update();
521  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
522  $this->ctrl->redirect($this, "properties");
523  }
524 
528  protected function showTrackingItemsBySco(): bool
529  {
530  $ilTabs = $this->tabs;
531 
532  $this->setSubTabs();
533  $ilTabs->setTabActive("cont_tracking_data");
534  $ilTabs->setSubTabActive("cont_tracking_bysco");
535 
536  $reports = array('exportSelectedCore','exportSelectedInteractions','exportSelectedObjectives','tracInteractionItem','tracInteractionUser','tracInteractionUserAnswers');
537 
538  $scoSelected = "all";
539  if ($this->dic->http()->wrapper()->query()->has('scoSelected')) {
540  $scoSelected = ilUtil::stripSlashes($this->dic->http()->wrapper()->query()->retrieve('scoSelected', $this->dic->refinery()->kindlyTo()->string()));
541  }
542  if ($this->dic->http()->wrapper()->post()->has('scoSelected')) {
543  $scoSelected = ilUtil::stripSlashes($this->dic->http()->wrapper()->post()->retrieve('scoSelected', $this->dic->refinery()->kindlyTo()->string()));
544  }
545 
546  $this->ctrl->setParameter($this, 'scoSelected', $scoSelected);
547 
548  $report = "choose";
549  if ($this->dic->http()->wrapper()->query()->has('report')) {
550  $report = ilUtil::stripSlashes($this->dic->http()->wrapper()->query()->retrieve('report', $this->dic->refinery()->kindlyTo()->string()));
551  }
552  if ($this->dic->http()->wrapper()->post()->has('report')) {
553  $report = ilUtil::stripSlashes($this->dic->http()->wrapper()->post()->retrieve('report', $this->dic->refinery()->kindlyTo()->string()));
554  }
555  $this->ctrl->setParameter($this, 'report', $report);
556  $filter = new ilSCORM2004TrackingItemsPerScoFilterGUI($this, 'showTrackingItemsBySco');
557  $filter->parse($scoSelected, $report, $reports);
558  if ($report === "choose") {
559  $this->tpl->setContent($filter->form->getHTML());
560  } else {
561  $scosSelected = array();
562  if ($scoSelected !== "all") {
563  $scosSelected[] = $scoSelected;
564  } else {
565  $tmpscos = $this->object->getTrackedItems();
566  foreach ($tmpscos as $i => $value) {
567  $scosSelected[] = $value["id"];
568  }
569  }
570  $a_users = ilTrQuery::getParticipantsForObject($this->ref_id);
571  $tbl = new ilSCORM2004TrackingItemsTableGUI($this->object->getId(), $this, 'showTrackingItemsBySco', $a_users, $scosSelected, $report);
572  $this->tpl->setContent($filter->form->getHTML() . $tbl->getHTML());
573  }
574  return true;
575  }
576 
577  public function showTrackingItems(): bool
578  {
579  $ilTabs = $this->tabs;
580  $ilAccess = $this->access;
581 
582  $ilTabs->setTabActive('cont_tracking_data');
583 
584  if ($ilAccess->checkAccess("read_learning_progress", "", $this->object->getRefId())) {
585  $this->setSubTabs();
586  $ilTabs->setSubTabActive('cont_tracking_byuser');
587 
588  $reports = array('exportSelectedSuccess','exportSelectedCore','exportSelectedInteractions','exportSelectedObjectives','exportObjGlobalToSystem');
589 
590  $userSelected = "all";
591  if ($this->dic->http()->wrapper()->query()->has('userSelected')) {
592  $userSelected = ilUtil::stripSlashes($this->dic->http()->wrapper()->query()->retrieve('userSelected', $this->dic->refinery()->kindlyTo()->string()));
593  }
594  if ($this->dic->http()->wrapper()->post()->has('userSelected')) {
595  $userSelected = ilUtil::stripSlashes($this->dic->http()->wrapper()->post()->retrieve('userSelected', $this->dic->refinery()->kindlyTo()->string()));
596  }
597  $this->ctrl->setParameter($this, 'userSelected', $userSelected);
598 
599  $report = "choose";
600  if ($this->dic->http()->wrapper()->query()->has('report')) {
601  $report = ilUtil::stripSlashes($this->dic->http()->wrapper()->query()->retrieve('report', $this->dic->refinery()->kindlyTo()->string()));
602  }
603  if ($this->dic->http()->wrapper()->post()->has('report')) {
604  $report = ilUtil::stripSlashes($this->dic->http()->wrapper()->post()->retrieve('report', $this->dic->refinery()->kindlyTo()->string()));
605  }
606  $this->ctrl->setParameter($this, 'report', $report);
607  $filter = new ilSCORM2004TrackingItemsPerUserFilterGUI($this, 'showTrackingItems');
608  $filter->parse($userSelected, $report, $reports);
609  if ($report === "choose") {
610  $this->tpl->setContent($filter->form->getHTML());
611  } else {
612  $usersSelected = array();
613  if ($userSelected !== "all") {
614  $usersSelected[] = $userSelected;
615  } else {
616  $users = ilTrQuery::getParticipantsForObject($this->ref_id);
617  foreach ($users as $usr) {
618  $user = (int) $usr;
619  if (ilObject::_exists($user) && ilObject::_lookUpType($user) === 'usr') {
620  $usersSelected[] = $user;
621  }
622  }
623  }
624  $scosSelected = array();
625  $tmpscos = $this->object->getTrackedItems();
626  foreach ($tmpscos as $i => $value) {
627  $scosSelected[] = $value["id"];
628  }
629  $tbl = new ilSCORM2004TrackingItemsTableGUI($this->object->getId(), $this, 'showTrackingItems', $usersSelected, $scosSelected, $report);
630  $this->tpl->setContent($filter->form->getHTML() . $tbl->getHTML());
631  }
632  } elseif ($ilAccess->checkAccess("edit_learning_progress", "", $this->object->getRefId())) {
633  $this->modifyTrackingItems();
634  }
635  return true;
636  }
637 }
This class represents an option in a radio group.
Class ilObjSCORMLearningModuleGUI.
This class represents a selection list property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
saveProperties()
save scorm 2004 module properties
setInfo(string $a_info)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
setMaxLength(int $a_maxlength)
Help GUI class.
setContent(string $a_html)
Sets content for standard template.
loadLanguageModule(string $a_module)
Load language module.
setOptions(array $a_options)
getPropertiesFormValues()
Get values for properties form.
static _lookupSubType(int $a_obj_id)
lookup subtype id (scorm, )
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ilLanguage $lng
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
getNextClass($a_gui_class=null)
This class represents a property in a property form.
Class ilSCORM2004TrackingItemsTableGUI.
ilGlobalTemplateInterface $tpl
This class represents a number property in a property form.
global $DIC
Definition: shib_login.php:26
ilToolbarGUI $toolbar
form( $class_path, string $cmd, string $submit_caption="")
global $ilSetting
Definition: privfeed.php:31
__construct(Container $dic, ilPlugin $plugin)
Class ilObjSCORM2004LearningModule.
This class represents a text area property in a property form.
ilAccessHandler $access
static getParticipantsForObject(int $a_ref_id)
Get participant ids for given object.
assignObject()
assign scorm object to scorm gui object
__construct(array $a_data, int $a_id, bool $a_call_by_reference, ?bool $a_prepare_output=true)
addHeaderAction()
Add header action menu.
ilSetting $settings