ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilObjSCORM2004LearningModuleGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once("./Modules/ScormAicc/classes/class.ilObjSCORMLearningModuleGUI.php");
5 require_once("./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
6 require_once("./Modules/Scorm2004/classes/class.ilSCORM2004Export.php");
7 include_once("./Services/Style/Content/classes/class.ilObjStyleSheetGUI.php");
8 include_once("./Services/COPage/Layout/classes/class.ilPageLayout.php");
9 
26 {
30  protected $tabs;
31 
35  protected $rbacsystem;
36 
40  protected $help;
41 
45  protected $error;
46 
52  public function __construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output = true)
53  {
54  global $DIC;
55 
56  $this->lng = $DIC->language();
57  $this->access = $DIC->access();
58  $this->ctrl = $DIC->ctrl();
59  $this->tpl = $DIC["tpl"];
60  $this->tabs = $DIC->tabs();
61  $this->rbacsystem = $DIC->rbac()->system();
62  $this->tree = $DIC->repositoryTree();
63  $this->toolbar = $DIC->toolbar();
64  $this->settings = $DIC->settings();
65  $this->help = $DIC["ilHelp"];
66  $this->error = $DIC["ilErr"];
67  $this->user = $DIC->user();
68  $lng = $DIC->language();
69 
70  $lng->loadLanguageModule("content");
71  $lng->loadLanguageModule("sahs");
72  $lng->loadLanguageModule("search");
73  $lng->loadLanguageModule("exp");
74  $this->type = "sahs";
75  parent::__construct($a_data, $a_id, $a_call_by_reference, false);
76  #$this->tabs_gui = new ilTabsGUI();
77  }
78 
82  public function executeCommand()
83  {
84  $ilAccess = $this->access;
86  $tpl = $this->tpl;
87  $ilTabs = $this->tabs;
88  $lng = $this->lng;
89 
90  $next_class = $ilCtrl->getNextClass($this);
91  $cmd = $ilCtrl->getCmd();
92 
93  if ($this->object->getEditable() && $cmd != "showEditTree") { // show editing frameset
94  $this->showEditTree();
95  }
96 
97  // update expander
98  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
99  $form_gui = new ilSCORM2004OrganizationHFormGUI();
100  $form_gui->setTree($this->getEditTree());
101  $form_gui->updateExpanded();
102  switch ($next_class) {
103  // notes
104  case "ilnotegui":
105  $this->getTemplate();
106  $this->setLocator();
107  $this->setTabs();
108  switch ($_GET["notes_mode"]) {
109  default:
110  $ilTabs->setTabActive("sahs_organization");
111  return $this->showOrganization();
112  }
113  break;
114 
115  // chapters
116  case "ilscorm2004chaptergui":
117  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004ChapterGUI.php");
118  $chap_gui = new ilSCORM2004ChapterGUI($this->object, $_GET["obj_id"]);
119  $chap_gui->setParentGUI($this);
120  return $ilCtrl->forwardCommand($chap_gui);
121 
122  // sequencing chapters
123  case "ilscorm2004seqchaptergui":
124  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004SeqChapterGUI.php");
125  $chap_gui = new ilSCORM2004SeqChapterGUI($this->object, $_GET["obj_id"]);
126  $chap_gui->setParentGUI($this);
127  return $ilCtrl->forwardCommand($chap_gui);
128 
129  // scos
130  case "ilscorm2004scogui":
131  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004ScoGUI.php");
132  $sco_gui = new ilSCORM2004ScoGUI($this->object, $_GET["obj_id"]);
133  $sco_gui->setParentGUI($this);
134  return $ilCtrl->forwardCommand($sco_gui);
135 
136  // assets
137  case "ilscorm2004assetgui":
138  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004AssetGUI.php");
139  $ass_gui = new ilSCORM2004AssetGUI($this->object, $_GET["obj_id"]);
140  $ass_gui->setParentGUI($this);
141  return $ilCtrl->forwardCommand($ass_gui);
142 
143  // pages
144  case "ilscorm2004pagenodegui":
145  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004PageNodeGUI.php");
146  $page_gui = new ilSCORM2004PageNodeGUI($this->object, $_GET["obj_id"]);
147  $page_gui->setParentGUI($this);
148  $ilCtrl->forwardCommand($page_gui);
149  break;
150 
151  default:
152  parent::executeCommand();
153  $this->addHeaderAction();
154  break;
155  }
156  }
157 
164  public function showEditTree()
165  {
166  $tpl = $this->tpl;
167 
168  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004EditorExplorerGUI.php");
169  $exp = new ilSCORM2004EditorExplorerGUI($this, "showEditTree", $this->object);
170  if (!$exp->handleCommand()) {
171  $tpl->setLeftNavContent($exp->getHTML());
172  }
173  }
174 
175 
182  public function editOrganization($a_to_organization = true)
183  {
184  if ($_GET["obj_id"] > 0) {
185  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
187  }
188  if (in_array($type, array("sco", "chap", "seqc", "page"))) {
189  $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
190  $this->ctrl->redirect($this, "jumpToNode");
191  } else {
192  if ($a_to_organization) {
193  $this->ctrl->redirect($this, "showOrganization");
194  } else {
195  $this->ctrl->redirect($this, "properties");
196  }
197  }
198  }
199 
205  // UK change possible
206  public function frameset($a_to_organization = false)
207  {
208  if ($this->object->getEditable()) { // show editing frameset
209  $this->ctrl->redirect($this, "properties");
210  } else { // otherwise show standard frameset
211  $this->tpl = new ilTemplate("tpl.sahs_edit_frameset.html", false, false, "Modules/ScormAicc");
212  $this->tpl->setVariable(
213  "SRC",
214  $this->ctrl->getLinkTarget($this, "properties")
215  );
216  $this->tpl->show("DEFAULT", false);
217  }
218  exit;
219  }
220 
221  public function jumpToNode($a_anchor_node = "", $a_highlight_ids = "")
222  {
224 
225  $anchor = ($a_anchor_node != "")
226  ? "node_" . $a_anchor_node
227  : "";
228 
229  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
231  $ilCtrl->setParameter($this, "obj_id", $_GET["obj_id"]);
232  switch ($type) {
233  case "sco":
234  $ilCtrl->setParameterByClass("ilscorm2004scogui", "highlight", $a_highlight_ids);
235  $ilCtrl->redirectByClass("ilscorm2004scogui", "showOrganization", $anchor);
236  // no break
237  case "ass":
238  $ilCtrl->setParameterByClass("ilscorm2004assetgui", "highlight", $a_highlight_ids);
239  $ilCtrl->redirectByClass("ilscorm2004assetgui", "showOrganization", $anchor);
240  // no break
241  case "chap":
242  $ilCtrl->setParameterByClass("ilscorm2004chaptergui", "highlight", $a_highlight_ids);
243  $ilCtrl->redirectByClass("ilscorm2004chaptergui", "showOrganization", $anchor);
244  // no break
245  case "seqc":
246  $ilCtrl->setParameterByClass("ilscorm2004seqchaptergui", "highlight", $a_highlight_ids);
247  $ilCtrl->redirectByClass("ilscorm2004seqchaptergui", "showOrganization", $anchor);
248  // no break
249  case "page":
250  $ilCtrl->redirectByClass("ilscorm2004pagenodegui", "edit");
251  }
252  }
253 
257  public function properties()
258  {
260  $tree = $this->tree;
261  $tpl = $this->tpl;
262  $lng = $this->lng;
263  $ilToolbar = $this->toolbar;
266  $ilTabs = $this->tabs;
267 
268  $this->setSubTabs("settings", "general_settings");
269 
270  $lng->loadLanguageModule("style");
271 
272  // not editable
273  if ($this->object->editable != 1) {
275  $ilTabs->setSubTabActive('cont_settings');
276  // view
277  $ilToolbar->addButtonInstance($this->object->getViewButton());
278  } else { // editable
279  // glossary buttons to toolbar
280  $sep = false;
281  if (ilObject::_lookupType($this->object->getAssignedGlossary()) != "glo") {
282  $parent_ref_id = $tree->getParentId((int) $_GET["ref_id"]);
283  if ($rbacsystem->checkAccess("create", $parent_ref_id, "glo")) {
284  $ilToolbar->addButton(
285  $this->lng->txt("cont_glo_create"),
286  $ilCtrl->getLinkTarget($this, "createGlossary")
287  );
288  }
289  $ilToolbar->addButton(
290  $this->lng->txt("cont_glo_assign"),
291  $ilCtrl->getLinkTarget($this, "assignGlossary")
292  );
293  } else {
294  $ilToolbar->addButton(
295  $this->lng->txt("cont_glo_detach"),
296  $ilCtrl->getLinkTarget($this, "detachGlossary")
297  );
298  }
299 
300  // style buttons to toolbar
301  $fixed_style = $ilSetting->get("fixed_content_style_id");
302  $style_id = $this->object->getStyleSheetId();
303 
304  if ($fixed_style == 0) {
306  true,
307  false,
308  $_GET["ref_id"]
309  );
310 
311  $st_styles[0] = $this->lng->txt("default");
312  ksort($st_styles);
313 
314  if ($style_id > 0) {
315  // individual style
316  if (!ilObjStyleSheet::_lookupStandard($style_id)) {
317  $ilToolbar->addSeparator();
318 
319  // delete command
320  $ilToolbar->addButton(
321  $this->lng->txt("cont_edit_style"),
322  $ilCtrl->getLinkTarget($this, "editStyle")
323  );
324  $ilToolbar->addButton(
325  $this->lng->txt("cont_delete_style"),
326  $ilCtrl->getLinkTarget($this, "deleteStyle")
327  );
328  }
329  }
330 
331  if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id)) {
332  $ilToolbar->addSeparator();
333 
334  $ilToolbar->addButton(
335  $this->lng->txt("sty_create_ind_style"),
336  $ilCtrl->getLinkTarget($this, "createStyle")
337  );
338  }
339  }
340  }
341 
342  // output forms
343  if ($this->object->editable != 1) {
344  $this->initPropertiesForm();
345  $tpl->setContent($this->form->getHTML());
346  } else {
349  $tpl->setContent($this->form->getHTML());
350  }
351  }
352 
359  public function initPropertiesForm()
360  {
361  $lng = $this->lng;
363  $obj_service = $this->getObjectService();
364 
365  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
366  $this->form = new ilPropertyFormGUI();
367  $this->form->setFormAction($ilCtrl->getFormAction($this));
368  $this->form->setTitle($this->lng->txt("cont_lm_properties"));
369 
370  //check/select only once
371  $this->object->checkMasteryScoreValues();
372 
373  //title
374  $ti = new ilTextInputGUI($this->lng->txt("title"), "Fobject_title");
375  $ti->setMaxLength(200);
376  $ti->setValue($this->object->getTitle());
377  $this->form->addItem($ti);
378 
379  //description
380  $ti = new ilTextAreaInputGUI($this->lng->txt("description"), "Fobject_description");
381  $ti->setValue($this->object->getDescription());
382  $this->form->addItem($ti);
383 
384  // SCORM-type
385  $ne = new ilNonEditableValueGUI($this->lng->txt("type"), "");
386  $ne->setValue($this->lng->txt("lm_type_" . ilObjSAHSLearningModule::_lookupSubType($this->object->getID())));
387  $this->form->addItem($ne);
388 
389  // version
390  $ne = new ilNonEditableValueGUI($this->lng->txt("cont_sc_version"), "");
391  $ne->setValue($this->object->getModuleVersion());
392  $ne->setInfo($this->lng->txt("cont_sc_version_info"));
393  $this->form->addItem($ne);
394 
395  //
396  // activation
397  //
398  $sh = new ilFormSectionHeaderGUI();
399  $sh->setTitle($this->lng->txt("activation"));
400  $this->form->addItem($sh);
401 
402  // online
403  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_online"), "cobj_online");
404  if (!$this->object->getOfflineStatus()) {
405  $cb->setChecked(true);
406  }
407  $cb->setInfo($this->lng->txt("cont_online_info"));
408  $this->form->addItem($cb);
409 
410  // offline Mode
411  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_offline_mode_allow"), "cobj_offline_mode");
412  $cb->setValue("y");
413  $cb->setChecked($this->object->getOfflineMode());
414  include_once("./Modules/ScormAicc/classes/class.ilSCORMOfflineMode.php");
415  if ($this->object->getOfflineMode() == true && ilSCORMOfflineMode::checkIfAnyoneIsInOfflineMode($this->object->getID()) == true) {
416  $cb->setDisabled(true);
417  $cb->setInfo($this->lng->txt("cont_offline_mode_disable_not_allowed_info"));
418  } else {
419  $cb->setInfo($this->lng->txt("cont_offline_mode_allow_info"));
420  }
421  $this->form->addItem($cb);
422 
423  //
424  // presentation
425  //
426  $sh = new ilFormSectionHeaderGUI();
427  $sh->setTitle($this->lng->txt("cont_presentation"));
428  $this->form->addItem($sh);
429 
430  // display mode (open)
431  // $options = array(
432  // "0" => $this->lng->txt("cont_open_normal"),
433  // "1" => $this->lng->txt("cont_open_iframe_max"),
434  // "2" => $this->lng->txt("cont_open_iframe_defined"),
435  // "5" => $this->lng->txt("cont_open_window_undefined"),
436  // "6" => $this->lng->txt("cont_open_window_defined")
437  // );
438  // $si = new ilSelectInputGUI($this->lng->txt("cont_open"), "open_mode");
439  // $si->setOptions($options);
440  // $si->setValue($this->object->getOpenMode());
441  // $this->form->addItem($si);
442 
443  $radg = new ilRadioGroupInputGUI($lng->txt("cont_open"), "open_mode");
444  $op0 = new ilRadioOption($this->lng->txt("cont_open_normal"), "0");
445  $radg->addOption($op0);
446  $op1 = new ilRadioOption($this->lng->txt("cont_open_iframe"), "1");
447  $radg->addOption($op1);
448  $op2 = new ilRadioOption($this->lng->txt("cont_open_window"), "5");
449  $radg->addOption($op2);
450  $radg->setValue($this->object->getOpenMode()); //ACHTUNG: DATENBANK
451  // width
452  $ni = new ilNumberInputGUI($this->lng->txt("cont_width"), "width_0");
453  $ni->setMaxLength(4);
454  $ni->setSize(4);
455  $ni->setValue($this->object->getWidth());
456  $op1->addSubItem($ni);
457  $ni = new ilNumberInputGUI($this->lng->txt("cont_width"), "width_1");
458  $ni->setMaxLength(4);
459  $ni->setSize(4);
460  $ni->setValue($this->object->getWidth());
461  $op2->addSubItem($ni);
462  // height
463  $ni = new ilNumberInputGUI($this->lng->txt("cont_height"), "height_0");
464  $ni->setMaxLength(4);
465  $ni->setSize(4);
466  $ni->setValue($this->object->getHeight());
467  $ni->setInfo($this->lng->txt("cont_width_height_info"));
468  $op1->addSubItem($ni);
469  $ni = new ilNumberInputGUI($this->lng->txt("cont_height"), "height_1");
470  $ni->setMaxLength(4);
471  $ni->setSize(4);
472  $ni->setValue($this->object->getHeight());
473  $ni->setInfo($this->lng->txt("cont_width_height_info"));
474  $op2->addSubItem($ni);
475 
476  // force IE to render again
477  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_ie_force_render"), "cobj_ie_force_render");
478  $cb->setValue("y");
479  $cb->setChecked($this->object->getIe_force_render());
480  $cb->setInfo($this->lng->txt("cont_ie_force_render_info"));
481  $op2->addSubItem($cb);
482 
483  $this->form->addItem($radg);
484 
485 
486  // disable top menu
487  //Hide Top Navigation Bar
488  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_nomenu"), "cobj_nomenu");
489  $cb->setValue("y");
490  $cb->setChecked($this->object->getNoMenu());
491  $cb->setInfo($this->lng->txt("cont_nomenu_info"));
492  $this->form->addItem($cb);
493 
494  // disable left-side navigation
495  // Hide Left Navigation Tree
496  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_hidenavig"), "cobj_hidenavig");
497  $cb->setValue("y");
498  $cb->setChecked($this->object->getHideNavig());
499  $cb->setInfo($this->lng->txt("cont_hidenavig_info"));
500  $this->form->addItem($cb);
501 
502  // auto navigation to last visited item
503  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_auto_last_visited"), "cobj_auto_last_visited");
504  $cb->setValue("y");
505  $cb->setChecked($this->object->getAuto_last_visited());
506  $cb->setInfo($this->lng->txt("cont_auto_last_visited_info"));
507  $this->form->addItem($cb);
508 
509  // tile image
510  $obj_service->commonSettings()->legacyForm($this->form, $this->object)->addTileImage();
511 
512  //
513  // scorm options
514  //
515  $sh = new ilFormSectionHeaderGUI();
516  $sh->setTitle($this->lng->txt("cont_scorm_options"));
517  $this->form->addItem($sh);
518 
519  // lesson mode
520  $radg = new ilRadioGroupInputGUI($lng->txt("cont_def_lesson_mode"), "lesson_mode");
521  $op0 = new ilRadioOption($this->lng->txt("cont_sc_less_mode_normal"), "normal");
522  $radg->addOption($op0);
523  $op1 = new ilRadioOption($this->lng->txt("cont_sc_less_mode_browse"), "browse");
524  $radg->addOption($op1);
525  $radg->setValue($this->object->getDefaultLessonMode());
526  // credit mode
527  $cmradg = new ilRadioGroupInputGUI($lng->txt("cont_credit_mode"), "credit_mode");
528  $cmop0 = new ilRadioOption($this->lng->txt("cont_credit_on"), "credit");
529  $cmradg->addOption($cmop0);
530  $cmop1 = new ilRadioOption($this->lng->txt("cont_credit_off"), "no_credit");
531  $cmradg->addOption($cmop1);
532  $cmradg->setValue($this->object->getCreditMode());
533  $op0->addSubItem($cmradg);
534  // set lesson mode review when completed
535  $options = array(
536  "n" => $this->lng->txt("cont_sc_auto_review_no"),
537  "r" => $this->lng->txt("cont_sc_auto_review_completed_not_failed_or_passed"),
538  "p" => $this->lng->txt("cont_sc_auto_review_passed"),
539  "q" => $this->lng->txt("cont_sc_auto_review_passed_or_failed"),
540  "c" => $this->lng->txt("cont_sc_auto_review_completed"),
541  "d" => $this->lng->txt("cont_sc_auto_review_completed_and_passed"),
542  "y" => $this->lng->txt("cont_sc_auto_review_completed_or_passed"),
543  "s" => $this->lng->txt("cont_sc_store_if_previous_score_was_lower")
544  );
545  $si = new ilSelectInputGUI($this->lng->txt("cont_sc_auto_review_2004"), "auto_review");
546  $si->setOptions($options);
547  $si->setValue($this->object->getAutoReviewChar());
548  $si->setInfo($this->lng->txt("cont_sc_auto_review_info_2004"));
549  $op0->addSubItem($si);
550  // end lesson mode
551  $this->form->addItem($radg);
552 
553 
554  // mastery_score
555  if ($this->object->getMasteryScoreValues() != "") {
556  $ni = new ilNumberInputGUI($this->lng->txt("cont_mastery_score_2004"), "mastery_score");
557  $ni->setMaxLength(3);
558  $ni->setSize(3);
559  $ni->setValue($this->object->getMasteryScore());
560  $ni->setInfo($this->lng->txt("cont_mastery_score_2004_info") . $this->object->getMasteryScoreValues());
561  $this->form->addItem($ni);
562  }
563 
564  //
565  // rte settings
566  //
567  $sh = new ilFormSectionHeaderGUI();
568  $sh->setTitle($this->lng->txt("cont_rte_settings"));
569  $this->form->addItem($sh);
570 
571  // unlimited session timeout
572  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_sc_usession"), "cobj_session");
573  $cb->setValue("y");
574  $cb->setChecked($this->object->getSession());
575  $cb->setInfo($this->lng->txt("cont_sc_usession_info"));
576  $this->form->addItem($cb);
577 
578  // SCORM 2004 fourth edition features
579  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_fourth_edition"), "cobj_fourth_edition");
580  $cb->setValue("y");
581  $cb->setChecked($this->object->getFourth_edition());
582  $cb->setInfo($this->lng->txt("cont_fourth_edition_info"));
583  $this->form->addItem($cb);
584 
585  // sequencing
586  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_sequencing"), "cobj_sequencing");
587  $cb->setValue("y");
588  $cb->setChecked($this->object->getSequencing());
589  $cb->setInfo($this->lng->txt("cont_sequencing_info"));
590  $this->form->addItem($cb);
591 
592  // storage of interactions
593  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_interactions"), "cobj_interactions");
594  $cb->setValue("y");
595  $cb->setChecked($this->object->getInteractions());
596  $cb->setInfo($this->lng->txt("cont_interactions_info"));
597  $this->form->addItem($cb);
598 
599  // objectives
600  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_objectives"), "cobj_objectives");
601  $cb->setValue("y");
602  $cb->setChecked($this->object->getObjectives());
603  $cb->setInfo($this->lng->txt("cont_objectives_info"));
604  $this->form->addItem($cb);
605 
606  // comments
607  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_comments"), "cobj_comments");
608  $cb->setValue("y");
609  $cb->setChecked($this->object->getComments());
610  $cb->setInfo($this->lng->txt("cont_comments_info"));
611  $this->form->addItem($cb);
612 
613  // time from lms
614  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_time_from_lms"), "cobj_time_from_lms");
615  $cb->setValue("y");
616  $cb->setChecked($this->object->getTime_from_lms());
617  $cb->setInfo($this->lng->txt("cont_time_from_lms_info"));
618  $this->form->addItem($cb);
619 
620  // check values
621  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_check_values"), "cobj_check_values");
622  $cb->setValue("y");
623  $cb->setChecked($this->object->getCheck_values());
624  $cb->setInfo($this->lng->txt("cont_check_values_info"));
625  $this->form->addItem($cb);
626 
627  // auto cmi.exit to suspend
628  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_auto_suspend"), "cobj_auto_suspend");
629  $cb->setValue("y");
630  $cb->setChecked($this->object->getAutoSuspend());
631  $cb->setInfo($this->lng->txt("cont_auto_suspend_info"));
632  $this->form->addItem($cb);
633 
634  // settings for student_id
635  $options = array(
636  0 => $this->lng->txt("cont_sc_id_setting_user_id"),
637  1 => $this->lng->txt("cont_sc_id_setting_user_login"),
638  2 => $this->lng->txt("cont_sc_id_setting_user_id_plus_ref_id"),
639  3 => $this->lng->txt("cont_sc_id_setting_user_login_plus_ref_id"),
640  4 => $this->lng->txt("cont_sc_id_setting_user_id_plus_obj_id"),
641  5 => $this->lng->txt("cont_sc_id_setting_user_login_plus_obj_id")
642  );
643  $si = new ilSelectInputGUI($this->lng->txt("cont_sc_id_setting_2004"), "id_setting");
644  $si->setOptions($options);
645  $si->setValue($this->object->getIdSetting());
646  $si->setInfo($this->lng->txt("cont_sc_id_setting_info"));
647  $this->form->addItem($si);
648 
649  // settings for student_name
650  $options = array(
651  0 => $this->lng->txt("cont_sc_name_setting_last_firstname"),
652  1 => $this->lng->txt("cont_sc_name_setting_first_lastname"),
653  2 => $this->lng->txt("cont_sc_name_setting_fullname"),
654  3 => $this->lng->txt("cont_sc_name_setting_salutation_lastname"),
655  4 => $this->lng->txt("cont_sc_name_setting_first_name"),
656  9 => $this->lng->txt("cont_sc_name_setting_no_name")
657  );
658  $si = new ilSelectInputGUI($this->lng->txt("cont_sc_name_setting_2004"), "name_setting");
659  $si->setOptions($options);
660  $si->setValue($this->object->getNameSetting());
661  $si->setInfo($this->lng->txt("cont_sc_name_setting_info"));
662  $this->form->addItem($si);
663 
664  //
665  // debugging
666  //
667  $sh = new ilFormSectionHeaderGUI();
668  $sh->setTitle($this->lng->txt("cont_debugging"));
669  $this->form->addItem($sh);
670 
671  // test tool
672  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_debug"), "cobj_debug");
673  $cb->setValue("y");
674  $cb->setChecked($this->object->getDebug());
675  if ($this->object->getDebugActivated() == false) {
676  $cb->setDisabled(true);
677  $cb->setInfo($this->lng->txt("cont_debug_deactivated"));
678  } else {
679  $cb->setInfo($this->lng->txt("cont_debug_deactivate"));
680  }
681  $this->form->addItem($cb);
682  $this->form->addCommandButton("saveProperties", $lng->txt("save"));
683  }
684 
685 
689  public function initPropertiesEditableForm()
690  {
691  $lng = $this->lng;
694 
695  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
696  $this->form = new ilPropertyFormGUI();
697 
698  // localization
699  $options = array(
700  "" => $lng->txt("please_select"),
701  );
702  $langs = $lng->getInstalledLanguages();
703  $lng->loadLanguageModule("meta");
704  foreach ($langs as $l) {
705  $options[$l] = $lng->txt("meta_l_" . $l);
706  }
707  $loc = new ilSelectInputGUI($this->lng->txt("cont_localization"), "localization");
708  $loc->setOptions($options);
709  $loc->setInfo($this->lng->txt("cont_localization_info"));
710  $this->form->addItem($loc);
711 
712  // glossary
713  $ne = new ilNonEditableValueGUI($lng->txt("obj_glo"), "glossary");
714  $ne->setInfo($lng->txt("sahs_glo_info"));
715  $this->form->addItem($ne);
716 
717  // style
718  $lng->loadLanguageModule("style");
719  $fixed_style = $ilSetting->get("fixed_content_style_id");
720  $style_id = $this->object->getStyleSheetId();
721 
722  if ($fixed_style > 0) {
723  $st = new ilNonEditableValueGUI($lng->txt("cont_current_style"));
724  $st->setValue(ilObject::_lookupTitle($fixed_style) . " (" .
725  $this->lng->txt("global_fixed") . ")");
726  $this->form->addItem($st);
727  } else {
729  true,
730  false,
731  $_GET["ref_id"]
732  );
733 
734  $st_styles[0] = $this->lng->txt("default");
735  ksort($st_styles);
736 
737  if ($style_id > 0) {
738  // individual style
739  if (!ilObjStyleSheet::_lookupStandard($style_id)) {
740  $st = new ilNonEditableValueGUI($lng->txt("cont_current_style"));
741  $st->setValue(ilObject::_lookupTitle($style_id));
742  $this->form->addItem($st);
743  }
744  }
745 
746  if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id)) {
747  $style_sel = ilUtil::formSelect(
748  $style_id,
749  "style_id",
750  $st_styles,
751  false,
752  true
753  );
754  $style_sel = new ilSelectInputGUI($lng->txt("cont_current_style"), "style_id");
755  $style_sel->setOptions($st_styles);
756  $style_sel->setValue($style_id);
757  $this->form->addItem($style_sel);
758  }
759  }
760 
761  // number of tries
762  $ni = new ilNumberInputGUI($lng->txt("cont_qtries"), "q_tries");
763  $ni->setInfo($lng->txt("cont_qtries_info")); // #15133
764  $ni->setMaxLength(3);
765  $ni->setSize(3);
766  $this->form->addItem($ni);
767 
768 
769  $this->form->addCommandButton("saveProperties", $lng->txt("save"));
770 
771  $this->form->setTitle($lng->txt("cont_scorm_ed_properties"));
772  $this->form->setFormAction($ilCtrl->getFormAction($this));
773  }
774 
778  public function getPropertiesEditableValues()
779  {
780  $values = array();
781 
782  if (ilObject::_lookupType($this->object->getAssignedGlossary()) == "glo") {
783  $values["glossary"] = ilObject::_lookupTitle($this->object->getAssignedGlossary());
784  } else {
785  $values["glossary"] = $this->lng->txt("cont_no_glossary");
786  }
787  $values["q_tries"] = $this->object->getTries();
788  $values["localization"] = $this->object->getLocalization();
789  $values["style_id"] = $this->object->getStyleSheetId();
790 
791  $this->form->setValuesByArray($values);
792  }
793 
797  public function saveProperties()
798  {
800  $obj_service = $this->getObjectService();
801  $this->initPropertiesForm();
802  $this->form->checkInput();
803 
804  if ($this->object->editable != 1) {
805  //check if OfflineMode-Zip has to be created
806  $tmpOfflineMode = ilUtil::yn2tf($_POST["cobj_offline_mode"]);
807  $tmpFourth_edition = ilUtil::yn2tf($_POST["cobj_fourth_edition"]);
808  $tmpSequencing = ilUtil::yn2tf($_POST["cobj_sequencing"]);
809  if ($tmpOfflineMode == true) {
810  // $tmpSequencing = false; //actually no sequencing for offline_mode
811  $tmpFourth_edition = false; //4th edition is not possible
812  if ($this->object->getOfflineMode() == false) {
813  $this->object->zipLmForOfflineMode();
814  }
815  }
816 
817  if (isset($_POST["mastery_score"])) {
818  $this->object->setMasteryScore($_POST["mastery_score"]);
819  // $this->object->updateMasteryScoreValues();
820  }
821 
822  $t_auto_review = $_POST["auto_review"];
823  $t_auto_suspend = ilUtil::yn2tf($_POST["cobj_auto_suspend"]);
824  $t_session = ilUtil::yn2tf($_POST["cobj_session"]);
825  if ($t_auto_review == "s") {
826  $t_auto_suspend = true;
827  //if not storing without session
828  $t_session = true;
829  }
830 
831  $t_height = $this->object->getHeight();
832  if ($_POST["height_0"] != $this->object->getHeight()) {
833  $t_height = $_POST["height_0"];
834  }
835  if ($_POST["height_1"] != $this->object->getHeight()) {
836  $t_height = $_POST["height_1"];
837  }
838 
839  $t_width = $this->object->getWidth();
840  if ($_POST["width_0"] != $this->object->getWidth()) {
841  $t_width = $_POST["width_0"];
842  }
843  if ($_POST["width_1"] != $this->object->getWidth()) {
844  $t_width = $_POST["width_1"];
845  }
846 
847  $this->object->setOfflineStatus(!($_POST['cobj_online']));
848  $this->object->setOpenMode($_POST["open_mode"]);
849  $this->object->setWidth($t_width);
850  $this->object->setHeight($t_height);
851  $this->object->setCreditMode($_POST["credit_mode"]);
852  $this->object->setMaxAttempt($_POST["max_attempt"]);
853  $this->object->setAutoReviewChar($t_auto_review);
854  $this->object->setDefaultLessonMode($_POST["lesson_mode"]);
855  $this->object->setSession($t_session);
856  $this->object->setNoMenu(ilUtil::yn2tf($_POST["cobj_nomenu"]));
857  $this->object->setHideNavig(ilUtil::yn2tf($_POST["cobj_hidenavig"]));
858  $this->object->setAuto_last_visited(ilUtil::yn2tf($_POST["cobj_auto_last_visited"]));
859  $this->object->setIe_force_render(ilUtil::yn2tf($_POST["cobj_ie_force_render"]));
860  $this->object->setFourth_edition($tmpFourth_edition);
861  $this->object->setSequencing($tmpSequencing);
862  $this->object->setInteractions(ilUtil::yn2tf($_POST["cobj_interactions"]));
863  $this->object->setObjectives(ilUtil::yn2tf($_POST["cobj_objectives"]));
864  $this->object->setComments(ilUtil::yn2tf($_POST["cobj_comments"]));
865  $this->object->setTime_from_lms(ilUtil::yn2tf($_POST["cobj_time_from_lms"]));
866  $this->object->setCheck_values(ilUtil::yn2tf($_POST["cobj_check_values"]));
867  $this->object->setAutoSuspend($t_auto_suspend);
868  $this->object->setOfflineMode($tmpOfflineMode);
869  $this->object->setDebug(ilUtil::yn2tf($_POST["cobj_debug"]));
870  $this->object->setIdSetting($_POST["id_setting"]);
871  $this->object->setNameSetting($_POST["name_setting"]);
872  $this->object->setTitle($_POST["Fobject_title"]);
873  $this->object->setDescription($_POST["Fobject_description"]);
874 
875  // tile image
876  $obj_service->commonSettings()->legacyForm($this->form, $this->object)->saveTileImage();
877  } else {
879  if ($this->form->checkInput()) {
880  $this->object->setTries($_POST["q_tries"]);
881  $this->object->setLocalization($_POST["localization"]);
882 
883  if ($ilSetting->get("fixed_content_style_id") <= 0 &&
884  (ilObjStyleSheet::_lookupStandard($this->object->getStyleSheetId())
885  || $this->object->getStyleSheetId() == 0)) {
886  $this->object->setStyleSheetId(ilUtil::stripSlashes($_POST["style_id"]));
887  }
888  }
889  }
890  $this->object->update();
891  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
892  $this->ctrl->redirect($this, "properties");
893  }
894 
898  public function detachGlossary()
899  {
901 
902  $this->object->setAssignedGlossary(0);
903  $this->object->update();
904  $ilCtrl->redirect($this, "properties");
905  }
906 
910  public function createGlossary()
911  {
912  $tpl = $this->tpl;
913 
914  $this->initGlossaryCreationForm();
915  $tpl->setContent($this->form->getHTML());
916  }
917 
921  public function initGlossaryCreationForm()
922  {
923  $lng = $this->lng;
925 
926  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
927  $this->form = new ilPropertyFormGUI();
928 
929  // title
930  $ti = new ilTextInputGUI($lng->txt("title"), "title");
931  $ti->setRequired(true);
932  $this->form->addItem($ti);
933 
934  // description
935  $ta = new ilTextAreaInputGUI($lng->txt("desc"), "description");
936  $this->form->addItem($ta);
937 
938  $this->form->addCommandButton("saveGlossary", $lng->txt("save"));
939  $this->form->addCommandButton("properties", $lng->txt("cancel"));
940 
941  $this->form->setTitle($lng->txt("cont_glo_create"));
942  $this->form->setFormAction($ilCtrl->getFormAction($this));
943  }
944 
948  public function saveGlossary()
949  {
950  $tpl = $this->tpl;
951  $lng = $this->lng;
954  $tree = $this->tree;
955 
956  $parent_ref_id = $tree->getParentId((int) $_GET["ref_id"]);
957  if (!$rbacsystem->checkAccess("create", $parent_ref_id, "glo")) {
958  ilUtil::sendFailure($lng->txt("no_permission"), true);
959  $ilCtrl->redirect($this, "properties");
960  }
961 
962  $this->initGlossaryCreationForm();
963  if ($this->form->checkInput()) {
964  include_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
965  $newObj = new ilObjGlossary();
966  $newObj->setType("glo");
967  $newObj->setTitle($_POST["title"]);
968  $newObj->setDescription($_POST["description"]);
969  $newObj->setVirtualMode("none");
970  $newObj->create();
971  $newObj->createReference();
972  $newObj->putInTree($parent_ref_id);
973  $newObj->setPermissions($parent_ref_id);
974 
975  // perform save
976  $this->object->setAssignedGlossary($newObj->getId());
977  $this->object->update();
978 
979  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
980  $ilCtrl->redirect($this, "properties");
981  }
982 
983  $this->form->setValuesByPost();
984  $tpl->setContent($this->form->getHtml());
985  }
986 
990  public function assignGlossary()
991  {
992  $tpl = $this->tpl;
994  $tree = $this->tree;
995 
996  include_once("./Modules/Scorm2004/classes/class.ilGlossarySelectorGUI.php");
997  $exp = new ilGlossarySelectorGUI(
998  $ilCtrl->getLinkTarget($this, "selectGlossary"),
999  "ilobjscorm2004learningmodulegui"
1000  );
1001  $exp->setSelectableTypes(array("glo"));
1002 
1003  if ($_GET["expand"] == "") {
1004  $expanded = $tree->readRootId();
1005  } else {
1006  $expanded = $_GET["expand"];
1007  }
1008  $exp->setExpand($expanded);
1009 
1010  $exp->setTargetGet("glo_id");
1011  //$this->ctrl->setParameter($this, "target_type", $a_type);
1012  //$ilCtrl->setParameter($this, "subCmd", "insertFromRepository");
1013  $exp->setParamsGet($this->ctrl->getParameterArray($this, "assignGlossary"));
1014 
1015  // filter
1016  $exp->setFiltered(true);
1017  $exp->setFilterMode(IL_FM_POSITIVE);
1018  $exp->addFilter("root");
1019  $exp->addFilter("cat");
1020  $exp->addFilter("grp");
1021  $exp->addFilter("fold");
1022  $exp->addFilter("crs");
1023  $exp->addFilter("glo");
1024 
1025  $exp->setOutput(0);
1026 
1027  $tpl->setContent($exp->getOutput());
1028  }
1029 
1033  public function selectGlossary()
1034  {
1035  $ilCtrl = $this->ctrl;
1036 
1037  $this->object->setAssignedGlossary(ilObject::_lookupObjId((int) $_GET["glo_ref_id"]));
1038  $this->object->update();
1039  $ilCtrl->redirect($this, "properties");
1040  }
1041 
1045  public function assignObject()
1046  {
1047  if ($this->id != 0) {
1048  if ($this->call_by_reference) {
1049  $this->object = new ilObjSCORM2004LearningModule($this->id, true);
1050  } else {
1051  $this->object = new ilObjSCORM2004LearningModule($this->id, false);
1052  }
1053  }
1054  }
1055 
1059  public function editStyleProperties()
1060  {
1061  $tpl = $this->tpl;
1062 
1063  $this->initStylePropertiesForm();
1064  $tpl->setContent($this->form->getHTML());
1065  }
1066 
1070  public function initStylePropertiesForm()
1071  {
1072  $ilCtrl = $this->ctrl;
1073  $lng = $this->lng;
1074  $ilTabs = $this->tabs;
1076 
1077  $lng->loadLanguageModule("style");
1078  $this->setSubTabs("settings", "style");
1079  $ilTabs->setTabActive("settings");
1080 
1081  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1082  $this->form = new ilPropertyFormGUI();
1083 
1084  $fixed_style = $ilSetting->get("fixed_content_style_id");
1085  $style_id = $this->object->getStyleSheetId();
1086 
1087  if ($fixed_style > 0) {
1088  $st = new ilNonEditableValueGUI($lng->txt("cont_current_style"));
1089  $st->setValue(ilObject::_lookupTitle($fixed_style) . " (" .
1090  $this->lng->txt("global_fixed") . ")");
1091  $this->form->addItem($st);
1092  } else {
1094  true,
1095  false,
1096  $_GET["ref_id"]
1097  );
1098 
1099  $st_styles[0] = $this->lng->txt("default");
1100  ksort($st_styles);
1101 
1102  if ($style_id > 0) {
1103  // individual style
1104  if (!ilObjStyleSheet::_lookupStandard($style_id)) {
1105  $st = new ilNonEditableValueGUI($lng->txt("cont_current_style"));
1106  $st->setValue(ilObject::_lookupTitle($style_id));
1107  $this->form->addItem($st);
1108 
1109  //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "edit"));
1110 
1111  // delete command
1112  $this->form->addCommandButton(
1113  "editStyle",
1114  $lng->txt("cont_edit_style")
1115  );
1116  $this->form->addCommandButton(
1117  "deleteStyle",
1118  $lng->txt("cont_delete_style")
1119  );
1120  //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "delete"));
1121  }
1122  }
1123 
1124  if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id)) {
1125  $style_sel = ilUtil::formSelect(
1126  $style_id,
1127  "style_id",
1128  $st_styles,
1129  false,
1130  true
1131  );
1132  $style_sel = new ilSelectInputGUI($lng->txt("cont_current_style"), "style_id");
1133  $style_sel->setOptions($st_styles);
1134  $style_sel->setValue($style_id);
1135  $this->form->addItem($style_sel);
1136  //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "create"));
1137  $this->form->addCommandButton(
1138  "saveStyleSettings",
1139  $lng->txt("save")
1140  );
1141  $this->form->addCommandButton(
1142  "createStyle",
1143  $lng->txt("sty_create_ind_style")
1144  );
1145  }
1146  }
1147  $this->form->setTitle($lng->txt("cont_style"));
1148  $this->form->setFormAction($ilCtrl->getFormAction($this));
1149  }
1150 
1154  public function createStyle()
1155  {
1156  $ilCtrl = $this->ctrl;
1157 
1158  $ilCtrl->redirectByClass("ilobjstylesheetgui", "create");
1159  }
1160 
1164  public function editStyle()
1165  {
1166  $ilCtrl = $this->ctrl;
1167 
1168  $ilCtrl->redirectByClass("ilobjstylesheetgui", "edit");
1169  }
1170 
1174  public function deleteStyle()
1175  {
1176  $ilCtrl = $this->ctrl;
1177 
1178  $ilCtrl->redirectByClass("ilobjstylesheetgui", "delete");
1179  }
1180 
1184  public function saveStyleSettings()
1185  {
1187 
1188  if ($ilSetting->get("fixed_content_style_id") <= 0 &&
1189  (ilObjStyleSheet::_lookupStandard($this->object->getStyleSheetId())
1190  || $this->object->getStyleSheetId() == 0)) {
1191  $this->object->setStyleSheetId(ilUtil::stripSlashes($_POST["style_id"]));
1192  $this->object->update();
1193  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1194  }
1195  $this->ctrl->redirect($this, "editStyleProperties");
1196  }
1197 
1201  protected function showTrackingItemsBySco()
1202  {
1203  $ilTabs = $this->tabs;
1204 
1205 
1207  $ilTabs->setTabActive("cont_tracking_data");
1208  $ilTabs->setSubTabActive("cont_tracking_bysco");
1209 
1210  $reports = array('exportSelectedCore','exportSelectedInteractions','exportSelectedObjectives','tracInteractionItem','tracInteractionUser','tracInteractionUserAnswers');
1211 
1212  $scoSelected = "all";
1213  if (isset($_GET["scoSelected"])) {
1214  $scoSelected = ilUtil::stripSlashes($_GET["scoSelected"]);
1215  }
1216  if (isset($_POST["scoSelected"])) {
1217  $scoSelected = ilUtil::stripSlashes($_POST["scoSelected"]);
1218  }
1219  $this->ctrl->setParameter($this, 'scoSelected', $scoSelected);
1220 
1221  $report = "choose";
1222  if (isset($_GET["report"])) {
1223  $report = ilUtil::stripSlashes($_GET["report"]);
1224  }
1225  if (isset($_POST["report"])) {
1226  $report = ilUtil::stripSlashes($_POST["report"]);
1227  }
1228  $this->ctrl->setParameter($this, 'report', $report);
1229 
1230  include_once './Modules/Scorm2004/classes/class.ilSCORM2004TrackingItemsPerScoFilterGUI.php';
1231  $filter = new ilSCORM2004TrackingItemsPerScoFilterGUI($this, 'showTrackingItemsBySco');
1232  $filter->parse($scoSelected, $report, $reports);
1233  if ($report == "choose") {
1234  $this->tpl->setContent($filter->form->getHTML());
1235  } else {
1236  $scosSelected = array();
1237  if ($scoSelected != "all") {
1238  $scosSelected[] = $scoSelected;
1239  } else {
1240  $tmpscos = $this->object->getTrackedItems();
1241  for ($i = 0; $i < count($tmpscos); $i++) {
1242  $scosSelected[] = $tmpscos[$i]["id"];
1243  }
1244  }
1245  //with check for course ...
1246  include_once "Services/Tracking/classes/class.ilTrQuery.php";
1247  $a_users = ilTrQuery::getParticipantsForObject($this->ref_id);
1248  // var_dump($this->object->getTrackedUsers(""));
1249  include_once './Modules/Scorm2004/classes/class.ilSCORM2004TrackingItemsTableGUI.php';
1250  $tbl = new ilSCORM2004TrackingItemsTableGUI($this->object->getId(), $this, 'showTrackingItemsBySco', $a_users, $scosSelected, $report);
1251  $this->tpl->setContent($filter->form->getHTML() . $tbl->getHTML());
1252  }
1253  return true;
1254  }
1255  public function showTrackingItems()
1256  {
1257  $ilTabs = $this->tabs;
1258  $ilAccess = $this->access;
1259 
1260  $ilTabs->setTabActive('cont_tracking_data');
1261 
1262  if ($ilAccess->checkAccess("read_learning_progress", "", $_GET["ref_id"])) {
1264  $ilTabs->setSubTabActive('cont_tracking_byuser');
1265 
1266  $reports = array('exportSelectedSuccess','exportSelectedCore','exportSelectedInteractions','exportSelectedObjectives','exportObjGlobalToSystem');
1267 
1268  $userSelected = "all";
1269  if (isset($_GET["userSelected"])) {
1270  $userSelected = ilUtil::stripSlashes($_GET["userSelected"]);
1271  }
1272  if (isset($_POST["userSelected"])) {
1273  $userSelected = ilUtil::stripSlashes($_POST["userSelected"]);
1274  }
1275  $this->ctrl->setParameter($this, 'userSelected', $userSelected);
1276 
1277  $report = "choose";
1278  if (isset($_GET["report"])) {
1279  $report = ilUtil::stripSlashes($_GET["report"]);
1280  }
1281  if (isset($_POST["report"])) {
1282  $report = ilUtil::stripSlashes($_POST["report"]);
1283  }
1284  $this->ctrl->setParameter($this, 'report', $report);
1285 
1286  include_once './Modules/Scorm2004/classes/class.ilSCORM2004TrackingItemsPerUserFilterGUI.php';
1287  $filter = new ilSCORM2004TrackingItemsPerUserFilterGUI($this, 'showTrackingItems');
1288  $filter->parse($userSelected, $report, $reports);
1289  if ($report == "choose") {
1290  $this->tpl->setContent($filter->form->getHTML());
1291  } else {
1292  $usersSelected = array();
1293  if ($userSelected != "all") {
1294  $usersSelected[] = $userSelected;
1295  } else {
1296  include_once "Services/Tracking/classes/class.ilTrQuery.php";
1298  foreach ($users as $user) {
1299  if (ilObject::_exists($user) && ilObject::_lookUpType($user) == 'usr') {
1300  $usersSelected[] = $user;
1301  }
1302  }
1303  }
1304  $scosSelected = array();
1305  $tmpscos = $this->object->getTrackedItems();
1306  for ($i = 0; $i < count($tmpscos); $i++) {
1307  $scosSelected[] = $tmpscos[$i]["id"];
1308  }
1309  //with check for course ...
1310  // include_once "Services/Tracking/classes/class.ilTrQuery.php";
1311  // $a_users=ilTrQuery::getParticipantsForObject($this->ref_id);
1312  // var_dump($this->object->getTrackedUsers(""));
1313  include_once './Modules/Scorm2004/classes/class.ilSCORM2004TrackingItemsTableGUI.php';
1314  $tbl = new ilSCORM2004TrackingItemsTableGUI($this->object->getId(), $this, 'showTrackingItems', $usersSelected, $scosSelected, $report);
1315  $this->tpl->setContent($filter->form->getHTML() . $tbl->getHTML());
1316  }
1317  } elseif ($ilAccess->checkAccess("edit_learning_progress", "", $_GET["ref_id"])) {
1318  $this->modifyTrackingItems();
1319  }
1320  return true;
1321  }
1322 
1323 
1324 
1328  public function showTree()
1329  {
1330  $ilCtrl = $this->ctrl;
1331  $lng = $this->lng;
1332 
1333  $mtree = new ilTree($this->object->getId());
1334  $mtree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1335  $mtree->setTreeTablePK("slm_id");
1336 
1337  if ($_POST["expandAll"] != "") {
1338  $_GET["scexpand"] = "";
1339  $stree = $mtree->getSubTree($mtree->getNodeData($mtree->readRootId()));
1340  $n_arr = array();
1341  foreach ($stree as $n) {
1342  $n_arr[] = $n["child"];
1343  }
1344  $_SESSION["scexpand"] = $n_arr;
1345  }
1346 
1347  if ($_POST["collapseAll"] != "") {
1348  $_GET["scexpand"] = "";
1349  $_SESSION["scexpand"] = array($mtree->readRootId());
1350  }
1351 
1352  $this->tpl = new ilTemplate("tpl.main.html", true, true);
1353  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
1354 
1355  $ilCtrl->setParameter($this, "active_node", $_GET["active_node"]);
1356 
1357  $this->tpl->addBlockFile("CONTENT", "content", "tpl.explorer.html");
1358  $this->tpl->setVariable("IMG_SPACE", ilUtil::getImagePath("spacer.png", false));
1359 
1360  $this->tpl->setCurrentBlock("exp2_button");
1361  $this->tpl->setVariable("CMD_EXP2_BTN", "expandAll");
1362  $this->tpl->setVariable("TXT_EXP2_BTN", $lng->txt("expand_all"));
1363  $this->tpl->parseCurrentBlock();
1364 
1365  $this->tpl->setCurrentBlock("exp2_button");
1366  $this->tpl->setVariable("CMD_EXP2_BTN", "collapseAll");
1367  $this->tpl->setVariable("TXT_EXP2_BTN", $lng->txt("collapse_all"));
1368  $this->tpl->parseCurrentBlock();
1369 
1370  require_once("./Modules/Scorm2004/classes/class.ilSCORM2004EditorExplorer.php");
1371  $exp = new ilSCORM2004EditorExplorer(
1372  $this->ctrl->getLinkTarget($this, "edit"),
1374  );
1375  $exp->setFrameUpdater("content", "ilHierarchyFormUpdater");
1376  $exp->setTargetGet("obj_id");
1377  $exp->setExpandTarget($this->ctrl->getLinkTarget($this, "showTree"));
1378 
1379  if ($_GET["scexpand"] == "") {
1380  $expanded = $mtree->readRootId();
1381  } else {
1382  $expanded = $_GET["scexpand"];
1383  }
1384 
1385  //echo "-".$_GET["active_node"]."-";
1386  if ($_GET["active_node"] != "") {
1387  $path = $mtree->getPathId($_GET["active_node"]);
1388  $exp->setForceOpenPath($path);
1389 
1390  $exp->highlightNode($_GET["active_node"]);
1391  }
1392  $exp->setExpand($expanded);
1393 
1394  // build html-output
1395  $exp->setOutput(0);
1396  $output = $exp->getOutput();
1397 
1398  // asynchronous output
1399  if ($ilCtrl->isAsynch()) {
1400  echo $output;
1401  exit;
1402  }
1403 
1404  $this->tpl->setCurrentBlock("content");
1405  $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("sahs_organization"));
1406  $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
1407  $this->tpl->setVariable("EXPLORER", $output);
1408  $this->ctrl->setParameter($this, "scexpand", $_GET["scexpand"]);
1409  $this->tpl->setVariable("ACTION", $this->ctrl->getLinkTarget($this, "showTree"));
1410  $this->tpl->parseCurrentBlock();
1411 
1412  include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
1413  iljQueryUtil::initjQuery($this->tpl);
1414 
1415  $this->tpl->show(false);
1416 
1417 
1418  exit;
1419  }
1420 
1424  public function showSequencing()
1425  {
1426  $tpl = $this->tpl;
1427  $lng = $this->lng;
1428  $ilTabs = $this->tabs;
1429  $ilToolbar = $this->toolbar;
1430  $ilCtrl = $this->ctrl;
1431 
1432  $ilTabs->setTabActive("sahs_sequencing");
1433 
1434  include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Item.php");
1435 
1436  if (!$this->object->getSequencingExpertMode()) {
1437  $ilToolbar->addButton(
1438  $lng->txt("sahs_activate_expert_mode"),
1439  $ilCtrl->getLinkTarget($this, "confirmExpertMode")
1440  );
1441  } else {
1442  include_once("./Services/UIComponent/NestedList/classes/class.ilNestedList.php");
1443  $list = new ilNestedList();
1444  $t = $this->object->getTree();
1445  $root_node = $t->getNodeData($t->getRootId());
1446  $nodes = $this->object->getTree()->getSubtree($root_node);
1447  foreach ($nodes as $node) {
1448  if (in_array($node["type"], array("", "chap", "sco"))) {
1449  $ntpl = new ilTemplate("tpl.seq_node.html", true, true, "Modules/Scorm2004");
1450  $ntpl->setVariable("NODE_ID", $node["child"]);
1451  if ($node["type"] == "") {
1452  $ntpl->setVariable("TITLE", $this->object->getTitle());
1453  $item = new ilSCORM2004Item($this->object->getId(), true);
1454  } else {
1455  $ntpl->setVariable("TITLE", $node["title"]);
1456  $item = new ilSCORM2004Item($node["child"]);
1457  }
1458  $ntpl->setVariable(
1459  "SEQ_INFO",
1460  ilUtil::prepareFormOutput($item->exportAsXML(false))
1461  );
1462  $list->addListNode($ntpl->get(), $node["child"], $node["parent"]);
1463  }
1464  }
1465 
1466  $tb = new ilToolbarGUI();
1467  $tb->addFormButton($lng->txt("save"), "saveSequencing");
1468  $ftpl = new ilTemplate("tpl.sequencing.html", true, true, "Modules/Scorm2004");
1469  $ftpl->setVariable("CONTENT", $list->getHTML());
1470  $ftpl->setVariable("FORM_ACTION", $ilCtrl->getFormAction($this));
1471  $ftpl->setVariable("TB", $tb->getHTML());
1472  $tpl->setContent($ftpl->get());
1473  }
1474  }
1475 
1479  public function confirmExpertMode()
1480  {
1481  $ilCtrl = $this->ctrl;
1482  $tpl = $this->tpl;
1483  $lng = $this->lng;
1484  $ilTabs = $this->tabs;
1485 
1486  $ilTabs->setTabActive("sahs_sequencing");
1487 
1488  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1489  $cgui = new ilConfirmationGUI();
1490  $cgui->setFormAction($ilCtrl->getFormAction($this));
1491  $cgui->setHeaderText($lng->txt("sahs_activate_expert_mode_info"));
1492  $cgui->setCancel($lng->txt("cancel"), "showSequencing");
1493  $cgui->setConfirm($lng->txt("sahs_activate_expert_mode"), "activateExpertMode");
1494 
1495  $tpl->setContent($cgui->getHTML());
1496  }
1497 
1504  public function activateExpertMode()
1505  {
1506  $ilCtrl = $this->ctrl;
1507  $lng = $this->lng;
1508 
1509  $this->object->setSequencingExpertMode(true);
1510  $this->object->update();
1511  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1512  $ilCtrl->redirect($this, "showSequencing");
1513  }
1514 
1515 
1519  public function saveSequencing()
1520  {
1521  $tpl = $this->tpl;
1522  $lng = $this->lng;
1523  $ilCtrl = $this->ctrl;
1524 
1525  include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Item.php");
1526  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
1527  $t = $this->object->getTree();
1528  $root_node = $t->getNodeData($t->getRootId());
1529  $nodes = $this->object->getTree()->getSubtree($root_node);
1530  foreach ($nodes as $node) {
1531  if (in_array($node["type"], array("", "chap", "sco"))) {
1532  if ($node["type"] == "") {
1533  $item = new ilSCORM2004Item($this->object->getId(), true);
1534  } else {
1535  $item = new ilSCORM2004Item($node["child"]);
1536  }
1537  $xml = '<?xml version="1.0"?>' . ilUtil::stripSlashes($_POST["seq"][$node["child"]], false);
1538 
1539  $ob_texts = array();
1540  if ($node["type"] == "sco") {
1541  $sco = new ilSCORM2004Sco($this->object, $node["child"]);
1542  $objectives = $sco->getObjectives();
1543  foreach ($objectives as $o) {
1544  $ob_texts[$o->getId()] = $o->getObjectiveId();
1545  }
1546  }
1547 
1548  $item->setSeqXml($xml);
1549  $item->initDom();
1550  $item->update();
1551 
1552  if ($node["type"] == "sco") {
1553  foreach ($ob_texts as $id => $t) {
1554  $objective = new ilScorm2004Objective($node["child"], $id);
1555  $objective->setObjectiveId($t);
1556  $objective->updateObjective();
1557  }
1558  }
1559  }
1560  }
1561 
1562  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1563 
1564  $ilCtrl->redirect($this, "showSequencing");
1565  }
1566 
1571  {
1572  $tpl = $this->tpl;
1573  $lng = $this->lng;
1574  $ilCtrl = $this->ctrl;
1575  $ilToolbar = $this->toolbar;
1576 
1577  $chaps = $this->object->getTree()->getChilds(
1578  $this->object->getTree()->getRootId()
1579  );
1580  $s_chaps = array();
1581  foreach ($chaps as $chap) {
1582  if ($chap["type"] == "chap") {
1583  $s_chaps[$chap["child"]] = $chap["title"];
1584  }
1585  }
1586  $cur_chap = $_SESSION["sahs_cur_chap"]
1587  ? $_SESSION["sahs_cur_chap"]
1588  : 0;
1589 
1590  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
1591  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
1592  $options = array(
1593  "0" => $lng->txt("all")
1594  );
1595  $options = $options + $s_chaps;
1596  $si = new ilSelectInputGUI($lng->txt("chapter"), "chapter");
1597  $si->setOptions($options);
1598  $si->setValue($cur_chap);
1599  $ilToolbar->addInputItem($si, true);
1600  $ilToolbar->addFormButton($lng->txt("change"), "selectLObjChapter");
1601 
1602  include_once("./Modules/Scorm2004/classes/class.ilObjectivesAlignmentTableGUI.php");
1603  $obj_table = new ilObjectivesAlignmentTableGUI(
1604  $this,
1605  "showLearningObjectivesAlignment",
1606  $this->getEditTree(),
1607  $this->object,
1608  $cur_chap
1609  );
1610  $tpl->setContent($obj_table->getHTML());
1611  }
1612 
1613  public function selectLObjChapter()
1614  {
1615  $ilCtrl = $this->ctrl;
1616 
1617  $_SESSION["sahs_cur_chap"] = (int) $_POST["chapter"];
1618  $ilCtrl->redirect($this, "showLearningObjectivesAlignment");
1619  }
1620 
1624  public function selectExport()
1625  {
1626  switch ($_POST['select_export']) {
1627  case "exportScorm12":
1628  case "exportScorm2004_3rd":
1629  case "exportScorm2004_4th":
1630  case "exportPDF":
1631  case "exportISO":
1632  case "exportHTML":
1633  case "exportHTMLOne":
1634  $this->ctrl->redirect($this, $_POST['select_export']);
1635  break;
1636  default:
1637  $this->ctrl->redirect($this, 'showExportList');
1638  break;
1639  }
1640  }
1641 
1645  public function showExportList()
1646  {
1647  $tpl = $this->tpl;
1648  $ilToolbar = $this->toolbar;
1649 
1650  $ilToolbar->setFormAction($this->ctrl->getFormAction($this, 'selectExport'));
1651  $ilToolbar->setId("scorm2004export");
1652 
1653  //$template = new ilTemplate("tpl.scorm2004_export_buttons.html", true, true, 'Modules/Scorm2004');
1654 
1655  /* $buttons = array(
1656  "exportScorm2004_3rd" => $this->lng->txt("scorm_create_export_file_scrom2004"),
1657  "exportScorm2004_4th" => $this->lng->txt("scorm_create_export_file_scrom2004_4th"),
1658  "exportScorm12" => $this->lng->txt("scorm_create_export_file_scrom12"),
1659  "exportPDF" => $this->lng->txt("scorm_create_export_file_pdf"),
1660  "exportISO" => $this->lng->txt("scorm_create_export_file_iso"),
1661  "exportHTML" => $this->lng->txt("scorm_create_export_file_html"),
1662  "exportHTMLOne" => $this->lng->txt("scorm_create_export_file_html_one")
1663  );*/
1664  $buttons = array(
1665  "exportScorm2004_3rd" => $this->lng->txt("scorm_create_export_file_scrom2004"),
1666  "exportScorm2004_4th" => $this->lng->txt("scorm_create_export_file_scrom2004_4th"),
1667  "exportScorm12" => $this->lng->txt("scorm_create_export_file_scrom12"),
1668  "exportHTML" => $this->lng->txt("scorm_create_export_file_html"),
1669  "exportHTMLOne" => $this->lng->txt("scorm_create_export_file_html_one")
1670  );
1671 
1672  //
1673  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
1674  $si = new ilSelectInputGUI($this->lng->txt('type'), "select_export");
1675  $si->setOptions($buttons);
1676  $ilToolbar->addInputItem($si, true);
1677 
1678  $ilToolbar->addFormButton($this->lng->txt('export'), "selectExport");
1679 
1680  $export_files = $this->object->getExportFiles();
1681 
1682  include_once "./Modules/Scorm2004/classes/class.ilSCORM2004ExportTableGUI.php";
1683  $table_gui = new ilSCORM2004ExportTableGUI($this, 'showExportList');
1684  $data = array();
1685  foreach ($export_files as $exp_file) {
1686  $filetype = $exp_file['type'];
1687  $public_str = ($exp_file["file"] == $this->object->getPublicExportFile($filetype))
1688  ? " <b>(" . $this->lng->txt("public") . ")<b>"
1689  : "";
1690  $file_arr = explode("__", $exp_file["file"]);
1691  array_push($data, array('file' => $exp_file['file'], 'filetype' => $filetype, 'date' => ilDatePresentation::formatDate(new ilDateTime($file_arr[0], IL_CAL_UNIX)), 'size' => $exp_file['size'], 'type' => $exp_file['type'] . $public_str));
1692  }
1693  $table_gui->setData($data);
1694 
1695  $this->tpl->setContent($table_gui->getHTML());
1696  }
1697 
1703  public function getTabs()
1704  {
1705  $ilAccess = $this->access;
1706  $ilHelp = $this->help;
1707 
1708  if ($this->ctrl->getCmd() == "delete") {
1709  return;
1710  }
1711 
1712  if (!$this->object->getEditable()) {
1713  return parent::getTabs();
1714  }
1715 
1716  $ilHelp->setScreenIdComponent("sahsed");
1717 
1718  // organization
1719  $this->tabs_gui->addTarget(
1720  "sahs_organization",
1721  $this->ctrl->getLinkTarget($this, "showOrganization"),
1722  "showOrganization",
1723  get_class($this)
1724  );
1725 
1726  // info screen
1727  $force_active = ($this->ctrl->getNextClass() == "ilinfoscreengui")
1728  ? true
1729  : false;
1730  $this->tabs_gui->addTarget(
1731  "info_short",
1732  $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"),
1733  "",
1734  "ilinfoscreengui",
1735  "",
1736  $force_active
1737  );
1738 
1739  // settings
1740  $this->tabs_gui->addTarget(
1741  "settings",
1742  $this->ctrl->getLinkTarget($this, "properties"),
1743  "properties",
1744  get_class($this)
1745  );
1746 
1747  // tracking data
1748  /* Later, only if tracking data exists
1749  $tabs_gui->addTarget("cont_tracking_data",
1750  $this->ctrl->getLinkTarget($this, "showTrackingItems"), "showTrackingItems",
1751  get_class($this));
1752  */
1753 
1754  // objective alignment
1755  $this->tabs_gui->addTarget(
1756  "sahs_objectives_alignment",
1757  $this->ctrl->getLinkTarget($this, "showLearningObjectivesAlignment"),
1758  "showLearningObjectivesAlignment",
1759  get_class($this)
1760  );
1761 
1762  // sequencing
1763  $this->tabs_gui->addTarget(
1764  "sahs_sequencing",
1765  $this->ctrl->getLinkTarget($this, "showSequencing"),
1766  "showSequencing",
1767  get_class($this)
1768  );
1769 
1770  // learning progress
1771  /* Later, only if tracking data exists
1772  include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
1773  if(ilObjUserTracking::_enabledLearningProgress())
1774  {
1775  $tabs_gui->addTarget('learning_progress',
1776  $this->ctrl->getLinkTargetByClass(array('illearningprogressgui'),''),
1777  '',
1778  array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui'));
1779  }
1780  */
1781 
1782  // edit meta
1783  include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
1784  $mdgui = new ilObjectMetaDataGUI($this->object);
1785  $mdtab = $mdgui->getTab();
1786  if ($mdtab) {
1787  $this->tabs_gui->addTarget(
1788  "meta_data",
1789  $mdtab,
1790  "",
1791  "ilmdeditorgui"
1792  );
1793  }
1794 
1795  // export
1796  $this->tabs_gui->addTarget(
1797  "export",
1798  $this->ctrl->getLinkTarget($this, "showExportList"),
1799  array("showExportList", 'confirmDeleteExportFile'),
1800  get_class($this)
1801  );
1802 
1803  // perm
1804  if ($ilAccess->checkAccess('edit_permission', '', $this->object->getRefId())) {
1805  $this->tabs_gui->addTarget(
1806  "perm_settings",
1807  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
1808  array("perm","info","owner"),
1809  'ilpermissiongui'
1810  );
1811  }
1812 
1813  if ($this->object->editable == 1) {
1814  // preview
1815  $this->tabs_gui->addNonTabbedLink(
1816  "preview",
1817  $this->lng->txt("cont_sc_preview"),
1818  $this->ctrl->getLinkTarget($this, "preview"),
1819  "_blank"
1820  );
1821  }
1822  }
1823 
1827  public function setSubTabs($a_main_tab = "", $a_active = "")
1828  {
1829  $ilTabs = $this->tabs;
1830  $ilCtrl = $this->ctrl;
1831  $lng = $this->lng;
1832 
1833  if ($a_main_tab == "settings" &&
1834  $this->object->editable == 1) {
1835  /* // general properties
1836  $ilTabs->addSubTab("general_settings",
1837  $lng->txt("general_settings"),
1838  $ilCtrl->getLinkTarget($this, 'properties'));
1839 
1840  // style properties
1841  $ilTabs->addSubTab("style",
1842  $lng->txt("cont_style"),
1843  $ilCtrl->getLinkTarget($this, 'editStyleProperties'));
1844  */
1845  $ilTabs->activateSubTab($a_active);
1846  }
1847  }
1848 
1849 
1853  public function getEditTree()
1854  {
1855  $slm_tree = new ilTree($this->object->getId());
1856  $slm_tree->setTreeTablePK("slm_id");
1857  $slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1858  return $slm_tree;
1859  }
1860 
1864  public function showOrganization(
1865  $a_top_node = 0,
1866  $a_form_action = "",
1867  $a_title = "",
1868  $a_icon = "",
1869  $a_gui_obj = null,
1870  $a_gui_cmd = ""
1871  ) {
1872  $lng = $this->lng;
1873  $ilCtrl = $this->ctrl;
1874  $tpl = $this->tpl;
1875 
1876  if ($a_form_action == "") {
1877  $a_form_action = $ilCtrl->getFormAction($this);
1878  }
1879 
1880  if ($a_icon == "") {
1881  $a_title = $this->object->getTitle();
1882  $a_icon = ilUtil::getImagePath("icon_lm.svg");
1883  }
1884 
1885  $slm_tree = $this->getEditTree();
1886 
1887  if ($a_top_node == 0) {
1888  $a_top_node = $slm_tree->getRootId();
1889  }
1890 
1891  if (is_null($a_gui_obj)) {
1892  $a_gui_obj = $this;
1893  $a_gui_cmd = "showOrganization";
1894  }
1895 
1896  $ilCtrl->setParameter($this, "backcmd", "showOrganization");
1897  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
1898  $form_gui = new ilSCORM2004OrganizationHFormGUI();
1899  $form_gui->setParentCommand($a_gui_obj, $a_gui_cmd);
1900  $form_gui->setFormAction($a_form_action);
1901  // $form_gui->setTitle($a_title);
1902  // $form_gui->setIcon($a_icon);
1903  $form_gui->setTree($slm_tree);
1904  $form_gui->setCurrentTopNodeId($a_top_node);
1905  $form_gui->addMultiCommand($lng->txt("delete"), "deleteNodes");
1906  $form_gui->addMultiCommand($lng->txt("cut"), "cutItems");
1907  $form_gui->addMultiCommand($lng->txt("copy"), "copyItems");
1908  $form_gui->addCommand($lng->txt("cont_save_all_titles"), "saveAllTitles");
1909  $form_gui->addCommand($lng->txt("expand_all"), "expandAll");
1910  $form_gui->addCommand($lng->txt("collapse_all"), "collapseAll");
1911  $form_gui->setTriggeredUpdateCommand("saveAllTitles");
1912 
1913  // highlighted nodes
1914  if ($_GET["highlight"] != "") {
1915  $hl = explode(":", $_GET["highlight"]);
1916  $form_gui->setHighlightedNodes($hl);
1917  $form_gui->setFocusId($hl[0]);
1918  }
1919 
1920  $ilCtrl->setParameter($this, "active_node", $_GET["obj_id"]);
1921  // $form_gui->setExplorerUpdater("tree", "tree_div",
1922  // $ilCtrl->getLinkTarget($this, "showTree", "", true));
1923  $sc_tpl = new ilTemplate("tpl.scormeditor_orga_screen.html", true, true, "Modules/Scorm2004");
1924  $sc_tpl->setVariable("ORGANIZATION", $form_gui->getHTML());
1925  $sc_tpl->setVariable("NOTES", $this->getNotesHTML());
1926 
1927  $tpl->setContent($sc_tpl->get());
1928  }
1929 
1933  public function getNotesHTML($a_mode = "")
1934  {
1935  $ilCtrl = $this->ctrl;
1936  $ilAccess = $this->access;
1938 
1939  // notes
1940  $ilCtrl->setParameter($this, "nodes_mode", $a_mode);
1941  include_once("Services/Notes/classes/class.ilNoteGUI.php");
1942  $node_id = $_GET["obj_id"];
1943  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
1944  $node_type = ($node_id > 0)
1945  ? ilSCORM2004Node::_lookupType($node_id)
1946  : "sahs";
1947 
1948  $notes_gui = new ilNoteGUI(
1949  $this->object->getId(),
1950  (int) $node_id,
1951  $node_type
1952  );
1953  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]) && $ilSetting->get("comments_del_tutor", 1)) {
1954  $notes_gui->enablePublicNotesDeletion(true);
1955  }
1956  $notes_gui->enablePrivateNotes();
1957  $notes_gui->enablePublicNotes();
1958 
1959  $next_class = $ilCtrl->getNextClass($this);
1960  if ($next_class == "ilnotegui") {
1961  $html = $this->ctrl->forwardCommand($notes_gui);
1962  } else {
1963  $html = $notes_gui->getNotesHTML();
1964  }
1965  return $html;
1966  }
1967 
1971  public function insertChapter($a_redirect = true)
1972  {
1973  $ilCtrl = $this->ctrl;
1974  $lng = $this->lng;
1975 
1976  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
1977 
1978  $slm_tree = new ilTree($this->object->getId());
1979  $slm_tree->setTreeTablePK("slm_id");
1980  $slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1981 
1984 
1985  if (!ilSCORM2004OrganizationHFormGUI::getPostFirstChild()) { // insert after node id
1986  $parent_id = $slm_tree->getParentId($node_id);
1987  $target = $node_id;
1988  } else { // insert as first child
1989  $parent_id = $node_id;
1991  }
1992  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Chapter.php");
1993  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
1994 
1995  $chap_ids = array();
1996  for ($i = 1; $i <= $num; $i++) {
1997  $chap = new ilSCORM2004Chapter($this->object);
1998  $chap->setTitle($lng->txt("sahs_new_chapter"));
1999  $chap->setSLMId($this->object->getId());
2000  $chap->create();
2001  ilSCORM2004Node::putInTree($chap, $parent_id, $target);
2002  $chap_ids[] = $chap->getId();
2003  }
2004  $chap_ids = array_reverse($chap_ids);
2005  $chap_ids = implode(":", $chap_ids);
2006 
2007  if ($a_redirect) {
2008  $ilCtrl->setParameter($this, "highlight", $chap_ids);
2009  $ilCtrl->redirect($this, "showOrganization", "node_" . $node_id);
2010  }
2011  return array("node_id" => $node_id, "items" => $chap_ids);
2012  }
2013 
2017  public function insertSco($a_redirect = true)
2018  {
2019  $ilCtrl = $this->ctrl;
2020  $lng = $this->lng;
2021 
2022  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
2023 
2024  $slm_tree = new ilTree($this->object->getId());
2025  $slm_tree->setTreeTablePK("slm_id");
2026  $slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
2027 
2030 
2031  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
2032  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2033 
2034  if (!ilSCORM2004OrganizationHFormGUI::getPostFirstChild()) { // insert after node id
2035  $parent_id = $slm_tree->getParentId($node_id);
2036  $target = $node_id;
2037  } else { // insert as first child
2038  $parent_id = $node_id;
2040  }
2041 
2042  $sco_ids = array();
2043  for ($i = 1; $i <= $num; $i++) {
2044  $sco = new ilSCORM2004Sco($this->object);
2045  $sco->setTitle($lng->txt("sahs_new_sco"));
2046  $sco->setSLMId($this->object->getId());
2047  $sco->create();
2048  ilSCORM2004Node::putInTree($sco, $parent_id, $target);
2049  $sco_ids[] = $sco->getId();
2050  }
2051  $sco_ids = array_reverse($sco_ids);
2052  $sco_ids = implode(":", $sco_ids);
2053 
2054  if ($a_redirect) {
2055  $ilCtrl->setParameter($this, "highlight", $sco_ids);
2056  $ilCtrl->redirect($this, "showOrganization", "node_" . $node_id);
2057  }
2058  return array("node_id" => $node_id, "items" => $sco_ids);
2059  }
2060 
2064  public function insertAsset($a_redirect = true)
2065  {
2066  $ilCtrl = $this->ctrl;
2067  $lng = $this->lng;
2068 
2069  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
2070 
2071  $slm_tree = new ilTree($this->object->getId());
2072  $slm_tree->setTreeTablePK("slm_id");
2073  $slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
2074 
2077 
2078  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Asset.php");
2079  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2080 
2081  if (!ilSCORM2004OrganizationHFormGUI::getPostFirstChild()) { // insert after node id
2082  $parent_id = $slm_tree->getParentId($node_id);
2083  $target = $node_id;
2084  } else { // insert as first child
2085  $parent_id = $node_id;
2087  }
2088 
2089  $ass_ids = array();
2090  for ($i = 1; $i <= $num; $i++) {
2091  $ass = new ilSCORM2004Asset($this->object);
2092  $ass->setTitle($lng->txt("sahs_new_asset"));
2093  $ass->setSLMId($this->object->getId());
2094  $ass->create();
2095  ilSCORM2004Node::putInTree($ass, $parent_id, $target);
2096  $ass_ids[] = $ass->getId();
2097  }
2098  $ass_ids = array_reverse($ass_ids);
2099  $ass_ids = implode(":", $ass_ids);
2100 
2101  if ($a_redirect) {
2102  $ilCtrl->setParameter($this, "highlight", $ass_ids);
2103  $ilCtrl->redirect($this, "showOrganization", "node_" . $node_id);
2104  }
2105  return array("node_id" => $node_id, "items" => $ass_ids);
2106  }
2107 
2111  public function insertPage($a_redirect = true)
2112  {
2113  $ilCtrl = $this->ctrl;
2114  $lng = $this->lng;
2115 
2116  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
2117 
2118  $slm_tree = new ilTree($this->object->getId());
2119  $slm_tree->setTreeTablePK("slm_id");
2120  $slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
2121 
2124 
2125  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004PageNode.php");
2126  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2127  if (!ilSCORM2004OrganizationHFormGUI::getPostFirstChild()) { // insert after node id
2128  $parent_id = $slm_tree->getParentId($node_id);
2129  $target = $node_id;
2130  } else { // insert as first child
2131  $parent_id = $node_id;
2133  }
2134 
2135  $page_ids = array();
2136  for ($i = 1; $i <= $num; $i++) {
2137  $page = new ilSCORM2004PageNode($this->object);
2138  $page->setTitle($lng->txt("sahs_new_page"));
2139  $page->setSLMId($this->object->getId());
2140  $page->create();
2141  ilSCORM2004Node::putInTree($page, $parent_id, $target);
2142  $page_ids[] = $page->getId();
2143  }
2144  $page_ids = array_reverse($page_ids);
2145  $page_ids = implode(":", $page_ids);
2146 
2147  if ($a_redirect) {
2148  $ilCtrl->setParameter($this, "highlight", $page_ids);
2149  $ilCtrl->redirect($this, "showOrganization", "node_" . $node_id);
2150  }
2151  return array("node_id" => $node_id, "items" => $page_ids);
2152  }
2153 
2154 
2158  public function insertScenarioGUI()
2159  {
2160  $ilCtrl = $this->ctrl;
2161  $lng = $this->lng;
2162  $tpl = $this->tpl;
2163 
2164  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
2165  include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004SeqTemplate.php");
2166 
2167  $templates = array();
2168  $description = null;
2169  $image = null;
2170 
2171  $default_identifier = $_POST["identifier"];
2172 
2173  //get available templates
2174  $arr_templates = ilSCORM2004SeqTemplate::availableTemplates();
2175 
2176  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.scormeditor_seq_chooser.html", "Modules/Scorm2004");
2177 
2178  $this->tpl->setCurrentBlock("option_item");
2179 
2180  $active = null;
2181  foreach ($arr_templates as $templ) {
2182  $sel = "";
2183  $item_data = $templ->getMetadataProperties();
2184  $item_data['identifier'] = $templ->getIdentifier();
2185  array_push($templates, $item_data);
2186  if ($default_identifier == $item_data['identifier']) {
2187  $sel = 'selected';
2188  $active = $item_data;
2189  }
2190  $this->tpl->setVariable("VAL_SELECTED", $sel);
2191  $this->tpl->setVariable("VAL_IDENTIFIER", $item_data['identifier']);
2192  $this->tpl->setVariable("VAL_TITLE", $item_data['title']);
2193  $this->tpl->parseCurrentBlock();
2194  }
2195 
2196  //default
2197  if ($active == null) {
2198  $this->saveAllTitles(false);
2199  $description = $templates[0]['description'];
2200  $image = $templates[0]['thumbnail'];
2201  } else {
2202  $description = $active['description'];
2203  $image = $active['thumbnail'];
2204  }
2205 
2206  $this->tpl->setVariable("VAL_DESCRIPTION", $description);
2207  $this->tpl->setVariable("VAL_IMAGE", ilSCORM2004SeqTemplate::SEQ_TEMPLATE_DIR . "/images/" . $image);
2208 
2209  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
2210  $this->tpl->setVariable("BTN_NAME", "insertScenario");
2211  $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
2212  $this->tpl->setVariable("TXT_INSERT", $this->lng->txt("insert"));
2213  $this->tpl->setVariable("TXT_CHANGE", $this->lng->txt("change"));
2214 
2215  $this->tpl->setVariable("TXT_TITLE", "Choose Sequencing Template");
2216 
2217  $node_id = $_POST["node_id"];
2218  $first_child = $_POST["first_child"];
2219 
2220  if (!$node_id) {
2222  }
2223  if (!$first_child) {
2225  }
2226 
2227  $this->tpl->setVariable("VAL_NODE_ID", $node_id);
2228  $this->tpl->setVariable("VAL_FIRST_CHILD", $first_child);
2229  }
2230 
2231 
2235  public function insertScenario()
2236  {
2237  $ilCtrl = $this->ctrl;
2238 
2239  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
2240 
2241  $slm_tree = new ilTree($this->object->getId());
2242  $slm_tree->setTreeTablePK("slm_id");
2243  $slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
2244 
2245  $node_id = $_POST["node_id"];
2246 
2247  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004PageNode.php");
2248  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2249  include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004SeqTemplate.php");
2250 
2251  if (!$_POST["first_child"]) { // insert after node id
2252  $parent_id = $slm_tree->getParentId($node_id);
2253  $target = $node_id;
2254  } else { // insert as first child
2255  $parent_id = $node_id;
2257  }
2258 
2259  $template = new ilSCORM2004SeqTemplate($_POST["identifier"]);
2260  $id = $template->insertTemplateForObjectAtParent($this->object, $parent_id, $target);
2261  $ilCtrl->setParameter($this, "highlight", $id);
2262  $ilCtrl->redirect($this, "showOrganization", "node_" . $node_id);
2263  }
2264 
2268  public function insertSpecialPage($a_redirect = true)
2269  {
2270  $this->insertTemplateGUI($a_redirect, true);
2271  }
2272 
2273 
2277  public function insertTemplateGUI($a_redirect = true, $a_special_page = false)
2278  {
2279  $ilCtrl = $this->ctrl;
2280  $lng = $this->lng;
2281  $tpl = $this->tpl;
2282 
2283  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
2284 
2285  $arr_templates = ilPageLayout::activeLayouts($a_special_page, ilPageLayout::MODULE_SCORM);
2286 
2287  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.scormeditor_page_layout_chooser.html", "Modules/Scorm2004");
2288 
2289  $this->tpl->setCurrentBlock("option_item");
2290 
2291  $count = 0;
2292  foreach ($arr_templates as $templ) {
2293  $count++;
2294  $sel = "";
2295  $templ->readObject();
2296  $this->tpl->setVariable("VAL_LAYOUT_TITLE", $templ->getTitle());
2297  $this->tpl->setVariable("VAL_LAYOUT_IMAGE", $templ->getPreview());
2298  $this->tpl->setVariable("VAL_LAYOUT_ID", $templ->getId());
2299  $this->tpl->setVariable("VAL_DISPLAY", "inline");
2300  if ($count == 1) {
2301  $this->tpl->setVariable("VAL_CHECKED", "checked");
2302  }
2303  if ($count % 4 == 0) {
2304  $this->tpl->setVariable("END_ROW", "</tr>");
2305  }
2306  if ($count == 1 || ($count - 1) % 4 == 0) {
2307  $this->tpl->setVariable("BEGIN_ROW", "<tr>");
2308  }
2309  $this->tpl->parseCurrentBlock();
2310  }
2311 
2312  //matrix table
2313  if ($count % 4 != 0) {
2314  $rest = 4 - ($count % 4);
2315  } else {
2316  $rest = 0;
2317  }
2318 
2319  for ($i = 1;$i <= $rest;$i++) {
2320  $this->tpl->setVariable("VAL_DISPLAY", "none");
2321  $this->tpl->setVariable("VAL_LAYOUT_ID", $templ->getId());
2322 
2323  if ($i == $rest) {
2324  $this->tpl->setVariable("END_ROW", "</tr>");
2325  }
2326  $this->tpl->parseCurrentBlock();
2327  }
2328 
2329  //empty cells and closing <tr>
2330 
2331  $this->tpl->setVariable("VAL_NODE_ID", ilSCORM2004OrganizationHFormGUI::getPostNodeId());
2332  $this->tpl->setVariable("VAL_MULTI", ilSCORM2004OrganizationHFormGUI::getPostMulti());
2333  $this->tpl->setVariable("VAL_FIRST_CHILD", ilSCORM2004OrganizationHFormGUI::getPostFirstChild());
2334  $this->tpl->setVariable("VAL_OBJ_ID", ilSCORM2004OrganizationHFormGUI::getPostFirstChild());
2335 
2336  $ilCtrl->saveParameter($this, "obj_id");
2337 
2338  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
2339 
2340  $this->tpl->setVariable("BTN_NAME", "insertTemplate");
2341  $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
2342  $this->tpl->setVariable("TXT_INSERT", $this->lng->txt("create"));
2343  $this->tpl->setVariable("CMD_CANCEL", "showOrganization");
2344 
2345  $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
2346  $this->tpl->setVariable("TXT_INSERT", $this->lng->txt("insert"));
2347  $this->tpl->setVariable("TXT_CHANGE", $this->lng->txt("change"));
2348  if ($a_special_page) {
2349  $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("sahs_choose_special_page"));
2350  } else {
2351  $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("sahs_choose_page_template"));
2352  }
2353  }
2354 
2355 
2356 
2360  public function insertTemplate($a_redirect = true)
2361  {
2362  $ilCtrl = $this->ctrl;
2363  $lng = $this->lng;
2364 
2365  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
2366 
2367  $slm_tree = new ilTree($this->object->getId());
2368  $slm_tree->setTreeTablePK("slm_id");
2369  $slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
2370 
2371  $num = $_POST["multi"];
2372  $node_id = $_POST["node_id"];
2373  $layout_id = $_POST["layout_id"];
2374 
2375 
2376  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004PageNode.php");
2377  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2378 
2379  if (!$_POST["first_child"]) { // insert after node id
2380  $parent_id = $slm_tree->getParentId($node_id);
2381  $target = $node_id;
2382  } else { // insert as first child
2383  $parent_id = $node_id;
2385  }
2386 
2387  $page_ids = array();
2388  for ($i = 1; $i <= $num; $i++) {
2389  $page = new ilSCORM2004PageNode($this->object);
2390  $page->setTitle($lng->txt("sahs_new_page"));
2391  $page->setSLMId($this->object->getId());
2392  $page->create(false, $layout_id);
2393  ilSCORM2004Node::putInTree($page, $parent_id, $target);
2394  $page_ids[] = $page->getId();
2395  }
2396  $page_ids = array_reverse($page_ids);
2397  $page_ids = implode(":", $page_ids);
2398 
2399  if ($a_redirect) {
2400  if ($_GET["obj_id"] != "") {
2401  $this->jumpToNode($node_id, $page_ids);
2402  } else {
2403  $ilCtrl->setParameter($this, "highlight", $page_ids);
2404  $ilCtrl->redirect($this, "showOrganization", "node_" . $node_id);
2405  }
2406  }
2407  }
2408 
2412  public function expandAll($a_redirect = true)
2413  {
2414  $_GET["scexpand"] = "";
2415  $mtree = $this->object->getTree();
2416  $n_id = ($_GET["obj_id"] > 0)
2417  ? $_GET["obj_id"]
2418  : $mtree->readRootId();
2419  $stree = $mtree->getSubTree($mtree->getNodeData($n_id));
2420  $n_arr = array();
2421  foreach ($stree as $n) {
2422  $n_arr[] = $n["child"];
2423  $_SESSION["scexpand"] = $n_arr;
2424  }
2425  $this->saveAllTitles($a_redirect);
2426  }
2427 
2431  public function collapseAll($a_redirect = true)
2432  {
2433  $_GET["scexpand"] = "";
2434  $mtree = $this->object->getTree();
2435  $n_id = ($_GET["obj_id"] > 0)
2436  ? $_GET["obj_id"]
2437  : $mtree->readRootId();
2438  $stree = $mtree->getSubTree($mtree->getNodeData($n_id));
2439  $old = $_SESSION["scexpand"];
2440  foreach ($stree as $n) {
2441  if (in_array($n["child"], $old) && $n["child"] != $n_id) {
2442  $k = array_search($n["child"], $old);
2443  unset($old[$k]);
2444  }
2445  }
2446  $_SESSION["scexpand"] = $old;
2447  $this->saveAllTitles($a_redirect);
2448  }
2449 
2453  public function saveAllTitles($a_redirect = true)
2454  {
2455  $ilCtrl = $this->ctrl;
2456 
2457  if (is_array($_POST["title"])) {
2458  include_once("./Services/MetaData/classes/class.ilMD.php");
2459  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004NodeFactory.php");
2460  foreach ($_POST["title"] as $id => $title) {
2461  $node_obj = ilSCORM2004NodeFactory::getInstance($this->object, $id, false);
2462  if (is_object($node_obj)) {
2463  // Update Title and description
2464  $md = new ilMD($this->object->getId(), $id, $node_obj->getType());
2465  $md_gen = $md->getGeneral();
2466  $md_gen->setTitle(ilUtil::stripSlashes($title));
2467  $md_gen->update();
2468  $md->update();
2470  }
2471  }
2472  }
2473  if ($a_redirect) {
2474  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
2475  $ilCtrl->redirect($this, "showOrganization");
2476  }
2477  }
2478 
2484  public function deleteNodes($a_form_action = "")
2485  {
2486  $lng = $this->lng;
2487  $tpl = $this->tpl;
2488  $ilErr = $this->error;
2489 
2490  if (!isset($_POST["id"])) {
2491  $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
2492  }
2493 
2494  // SAVE POST VALUES
2495  $_SESSION["saved_post"] = $_POST["id"];
2496 
2497  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
2498  $confirmation_gui = new ilConfirmationGUI();
2499 
2500  if ($a_form_action == "") {
2501  $cmd = ($_GET["backcmd"] == "")
2502  ? "showOrganization"
2503  : $_GET["backcmd"];
2504  $this->ctrl->setParameter($this, "backcmd", $cmd);
2505  $a_form_action = $this->ctrl->getFormAction($this);
2506  }
2507  $confirmation_gui->setFormAction($a_form_action);
2508  $confirmation_gui->setHeaderText($this->lng->txt("info_delete_sure"));
2509 
2510  // Add items to delete
2511  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004NodeFactory.php");
2512  foreach ($_POST["id"] as $id) {
2513  if ($id != IL_FIRST_NODE) {
2514  $node_obj = ilSCORM2004NodeFactory::getInstance($this->object, $id, false);
2515  $confirmation_gui->addItem(
2516  "id[]",
2517  $node_obj->getId(),
2518  $node_obj->getTitle(),
2519  ilUtil::getImagePath("icon_" . $node_obj->getType() . ".svg")
2520  );
2521  }
2522  }
2523 
2524  $confirmation_gui->setCancel($lng->txt("cancel"), "cancelDelete");
2525  $confirmation_gui->setConfirm($lng->txt("confirm"), "confirmedDelete");
2526 
2527  $tpl->setContent($confirmation_gui->getHTML());
2528  }
2529 
2533  public function cancelDelete()
2534  {
2535  $this->ctrl->redirect($this, $_GET["backcmd"]);
2536  }
2537 
2541  public function confirmedDelete($a_redirect = true)
2542  {
2543  $ilCtrl = $this->ctrl;
2544 
2545  $tree = new ilTree($this->object->getId());
2546  $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
2547  $tree->setTreeTablePK("slm_id");
2548 
2549  // delete all selected objects
2550  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004NodeFactory.php");
2551  foreach ($_POST["id"] as $id) {
2552  if ($id != IL_FIRST_NODE) {
2553  $obj = ilSCORM2004NodeFactory::getInstance($this->object, $id, false);
2554  $node_data = $tree->getNodeData($id);
2555  if (is_object($obj)) {
2556  $obj->setSLMId($this->object->getId());
2557 
2558  /*include_once("./Services/History/classes/class.ilHistory.php");
2559  ilHistory::_createEntry($this->object->getId(), "delete_".$obj->getType(),
2560  array(ilLMObject::_lookupTitle($id), $id),
2561  $this->object->getType());*/
2562 
2563  $obj->delete();
2564  }
2565  if ($tree->isInTree($id)) {
2566  $tree->deleteTree($node_data);
2567  }
2568  }
2569  }
2570 
2571  // check the tree
2572  // $this->object->checkTree();
2573 
2574  // feedback
2575  ilUtil::sendInfo($this->lng->txt("info_deleted"), true);
2576 
2577  if ($a_redirect) {
2578  $ilCtrl->redirect($this, "showOrganization");
2579  }
2580  }
2581 
2585  public function proceedDragDrop()
2586  {
2587  $ilCtrl = $this->ctrl;
2588 
2589  $this->object->executeDragDrop(
2590  $_POST["il_hform_source_id"],
2591  $_POST["il_hform_target_id"],
2592  $_POST["il_hform_fc"],
2593  $_POST["il_hform_as_subitem"]
2594  );
2595  $ilCtrl->redirect($this, "showOrganization");
2596  }
2597 
2601  public function copyItems($a_return = "showOrganization")
2602  {
2603  $ilCtrl = $this->ctrl;
2604  $lng = $this->lng;
2605 
2606  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2607 
2608  $items = ilUtil::stripSlashesArray($_POST["id"]);
2609  $todel = array(); // delete IDs < 0 (needed for non-js editing)
2610  foreach ($items as $k => $item) {
2611  if ($item < 0) {
2612  $todel[] = $k;
2613  }
2614  }
2615  foreach ($todel as $k) {
2616  unset($items[$k]);
2617  }
2618  if (!ilSCORM2004Node::uniqueTypesCheck($items)) {
2619  ilUtil::sendFailure($lng->txt("sahs_choose_pages_chap_scos_ass_only"), true);
2620  $ilCtrl->redirect($this, $a_return);
2621  }
2622  ilSCORM2004Node::clipboardCopy($this->object->getId(), $items);
2623 
2624  // @todo: move this to a service since it can be used here, too
2625  include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
2627  ilUtil::sendInfo($lng->txt("cont_selected_items_have_been_copied"), true);
2628 
2629  $ilCtrl->redirect($this, $a_return);
2630  }
2631 
2635  public function cutItems($a_return = "showOrganization")
2636  {
2637  $ilCtrl = $this->ctrl;
2638  $lng = $this->lng;
2639 
2640  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2641 
2642  $items = ilUtil::stripSlashesArray($_POST["id"]);
2643  $todel = array(); // delete IDs < 0 (needed for non-js editing)
2644  foreach ($items as $k => $item) {
2645  if ($item < 0) {
2646  $todel[] = $k;
2647  }
2648  }
2649  foreach ($todel as $k) {
2650  unset($items[$k]);
2651  }
2652 
2653  if (!ilSCORM2004Node::uniqueTypesCheck($items)) {
2654  ilUtil::sendFailure($lng->txt("sahs_choose_pages_chap_scos_ass_only"), true);
2655  $ilCtrl->redirect($this, $a_return);
2656  }
2657 
2658  ilSCORM2004Node::clipboardCut($this->object->getId(), $items);
2659 
2660  include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
2662 
2663  ilUtil::sendInfo($lng->txt("cont_selected_items_have_been_cut"), true);
2664 
2665  $ilCtrl->redirect($this, $a_return);
2666  }
2667 
2671  public function insertPageClip()
2672  {
2673  $ilCtrl = $this->ctrl;
2674  $ilUser = $this->user;
2675 
2676  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2677  ilSCORM2004Node::insertPageClip($this->object);
2678 
2679  $ilCtrl->redirect(
2680  $this,
2681  "showOrganization",
2683  );
2684  }
2685 
2689  public function insertScoClip()
2690  {
2691  $ilCtrl = $this->ctrl;
2692  $ilUser = $this->user;
2693 
2694  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2695  ilSCORM2004Node::insertScoClip($this->object);
2696 
2697  $ilCtrl->redirect(
2698  $this,
2699  "showOrganization",
2701  );
2702  }
2703 
2707  public function insertAssetClip()
2708  {
2709  $ilCtrl = $this->ctrl;
2710  $ilUser = $this->user;
2711 
2712  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2713  ilSCORM2004Node::insertAssetClip($this->object);
2714 
2715  $ilCtrl->redirect(
2716  $this,
2717  "showOrganization",
2719  );
2720  }
2721 
2725  public function insertChapterClip()
2726  {
2727  $ilCtrl = $this->ctrl;
2728  $ilUser = $this->user;
2729 
2730  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2731  ilSCORM2004Node::insertChapterClip($this->object);
2732 
2733  $ilCtrl->redirect(
2734  $this,
2735  "showOrganization",
2737  );
2738  }
2739 
2743  public function insertLMChapterClip($a_confirm = false, $a_perform = false)
2744  {
2745  $ilCtrl = $this->ctrl;
2746  $tpl = $this->tpl;
2747  $ilToolbar = $this->toolbar;
2748  $ilCtrl = $this->ctrl;
2749  $lng = $this->lng;
2750  $ilTabs = $this->tabs;
2751 
2752  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
2753 
2754 
2755  $pf = "";
2756  foreach (ilSCORM2004OrganizationHFormGUI::getPostFields() as $f => $v) {
2757  $pf .= '<input type="hidden" name="' . $f . '" value="' . $v . '" />';
2758  }
2759  if ($a_confirm && is_array($_POST["node"])) {
2760  foreach ($_POST["node"] as $f => $v) {
2761  $pf .= '<input type="hidden" name="node[' . $f . ']" value="' . $v . '" />';
2762  }
2763  }
2764 
2765 
2768 
2769  include_once("./Modules/Scorm2004/classes/class.ilLMChapterImportForm.php");
2770  $form = new ilLMChapterImportForm($this->object, $node_id, $first_child, $a_confirm);
2771  $tpl->setContent($form->getHTML() . $pf . "</form>");
2772 
2773  $ilTabs->clearTargets();
2774  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
2775  if ($a_confirm) {
2776  if ($form->isCorrect()) {
2777  $ilToolbar->addFormButton($lng->txt("insert"), "performLMChapterInsert");
2778  }
2779  $ilToolbar->addFormButton($lng->txt("back"), "insertLMChapterClip");
2780  } else {
2781  $ilToolbar->addFormButton($lng->txt("check"), "confirmLMChapterInsert");
2782  }
2783  $ilToolbar->addFormButton($lng->txt("cancel"), "showOrganization");
2784  $ilToolbar->setCloseFormTag(false);
2785  }
2786 
2790  public function confirmLMChapterInsert()
2791  {
2792  $this->insertLMChapterClip(true);
2793  }
2794 
2798  public function performLMChapterInsert()
2799  {
2802 
2803  include_once("./Modules/Scorm2004/classes/class.ilLMChapterImportForm.php");
2804  $form = new ilLMChapterImportForm($this->object, $node_id, $first_child);
2805  $form->performInserts();
2806  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
2807  $this->ctrl->redirect($this, "showOrganization");
2808  }
2809 
2810  public function exportScorm2004_4th()
2811  {
2812  $export = new ilScorm2004Export($this->object, 'SCORM 2004 4th');
2813  $export->buildExportFile();
2814  ilUtil::sendSuccess($this->lng->txt("exp_file_created"), true);
2815  $this->ctrl->redirect($this, "showExportList");
2816  }
2817 
2818  public function exportScorm2004_3rd()
2819  {
2820  $export = new ilScorm2004Export($this->object, 'SCORM 2004 3rd');
2821  $export->buildExportFile();
2822  ilUtil::sendSuccess($this->lng->txt("exp_file_created"), true);
2823  $this->ctrl->redirect($this, "showExportList");
2824  }
2825 
2826  public function exportScorm12()
2827  {
2828  $export = new ilScorm2004Export($this->object, 'SCORM 1.2');
2829  $export->buildExportFile();
2830  ilUtil::sendSuccess($this->lng->txt("exp_file_created"), true);
2831  $this->ctrl->redirect($this, "showExportList");
2832  }
2833 
2834  public function exportHTML()
2835  {
2836  $export = new ilScorm2004Export($this->object, 'HTML');
2837  $export->buildExportFile();
2838  ilUtil::sendSuccess($this->lng->txt("exp_file_created"), true);
2839  $this->ctrl->redirect($this, "showExportList");
2840  }
2841 
2842  public function exportHTMLOne()
2843  {
2844  $export = new ilScorm2004Export($this->object, 'HTMLOne');
2845  $export->buildExportFile();
2846  ilUtil::sendSuccess($this->lng->txt("exp_file_created"), true);
2847  $this->ctrl->redirect($this, "showExportList");
2848  }
2849 
2850  public function exportISO()
2851  {
2852  $ilErr = $this->error;
2853 
2854  $export = new ilScorm2004Export($this->object, 'ISO');
2855  if (!$export->buildExportFile()) {
2856  if (!PATH_TO_MKISOFS) {
2857  $ilErr->raiseError($this->lng->txt("no_mkisofs_configured"), $ilErr->MESSAGE);
2858  }
2859  }
2860  $this->ctrl->redirect($this, "showExportList");
2861  }
2862 
2863  public function exportPDF()
2864  {
2865  $export = new ilScorm2004Export($this->object, 'PDF');
2866  $export->buildExportFile();
2867  $this->ctrl->redirect($this, "showExportList");
2868  }
2869 
2870  public function downloadExportFile()
2871  {
2872  $export = new ilSCORM2004Export($this->object);
2873 
2874  $export_dir = $export->getExportDirectoryForType($_GET['type']);
2875  ilUtil::deliverFile($export_dir . "/" . $_GET['file'], $_GET['file']);
2876  }
2877 
2881  public function confirmDeleteExportFile()
2882  {
2883  if (!isset($_POST["file"])) {
2884  ilUtil::sendInfo($this->lng->txt("no_checkbox"), true);
2885  $this->ctrl->redirect($this, "showExportList");
2886  }
2887 
2888  ilUtil::sendQuestion($this->lng->txt("info_delete_sure"));
2889  $export_files = $this->object->getExportFiles();
2890 
2891  include_once "./Modules/Scorm2004/classes/class.ilSCORM2004ExportTableGUI.php";
2892  $table_gui = new ilSCORM2004ExportTableGUI($this, 'showExportList', true);
2893  $data = array();
2894  foreach ($export_files as $exp_file) {
2895  foreach ($_POST['file'] as $delete_file) {
2896  if (strcmp($delete_file, $exp_file['file']) == 0) {
2897  $public_str = ($exp_file["file"] == $this->object->getPublicExportFile($exp_file["type"]))
2898  ? " <b>(" . $this->lng->txt("public") . ")<b>"
2899  : "";
2900  $file_arr = explode("__", $exp_file["file"]);
2901  array_push($data, array('file' => $exp_file['file'], 'date' => ilDatePresentation::formatDate(new ilDateTime($file_arr[0], IL_CAL_UNIX)), 'size' => $exp_file['size'], 'type' => $exp_file['type'] . $public_str));
2902  }
2903  }
2904  }
2905  $table_gui->setData($data);
2906  $this->tpl->setVariable('ADM_CONTENT', $table_gui->getHTML());
2907  }
2908 
2912  public function cancelDeleteExportFile()
2913  {
2914  ilSession::clear("ilExportFiles");
2915  $this->ctrl->redirect($this, "showExportList");
2916  }
2917 
2918 
2922  public function deleteExportFile()
2923  {
2924  include_once "./Services/Utilities/classes/class.ilUtil.php";
2925  $export = new ilSCORM2004Export($this->object);
2926  foreach ($_POST['file'] as $idx => $file) {
2927  $export_dir = $export->getExportDirectoryForType($_POST['type'][$idx]);
2928  $exp_file = $export_dir . "/" . $file;
2929  if (@is_file($exp_file)) {
2930  unlink($exp_file);
2931  }
2932  }
2933  ilUtil::sendSuccess($this->lng->txt('msg_deleted_export_files'), true);
2934  $this->ctrl->redirect($this, "showExportList");
2935  }
2936 
2937  /*
2938  * download export file
2939  */
2940  public function publishExportFile()
2941  {
2942  $ilErr = $this->error;
2943 
2944  if (!isset($_POST["file"])) {
2945  $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
2946  }
2947  if (count($_POST["file"]) > 1) {
2948  $ilErr->raiseError($this->lng->txt("cont_select_max_one_item"), $ilErr->MESSAGE);
2949  }
2950 
2951  $export = new ilSCORM2004Export($this->object);
2952  $file = $_POST['file'][0];
2953  $type = $_POST['type'][$_POST['file'][0]];
2954 
2955  if ($this->object->getPublicExportFile($type) == $file) {
2956  $this->object->setPublicExportFile($type, "");
2957  } else {
2958  $this->object->setPublicExportFile($type, $file);
2959  }
2960  $this->object->update();
2961  $this->ctrl->redirect($this, "showExportList");
2962  }
2963 
2964  /*
2965  * perform silent scorm 2004 export and import for view player
2966  */
2967  public function preview()
2968  {
2969  global $DIC;
2970 
2971  $export = new ilScorm2004Export($this->object, 'SCORM 2004 3rd');
2972  $zipfile = $export->buildExportFile();
2973  $zipPathinfo = pathinfo($zipfile);
2974  $file_path = $this->object->getDataDirectory() . "/" . ($zipPathinfo["basename"]);
2975  copy($zipfile, $file_path);
2976  unlink($zipfile);
2977 
2978  ilUtil::unzip($file_path, true);
2979  ilUtil::renameExecutables($this->object->getDataDirectory());
2980  unlink($file_path);
2981 
2982  include_once("./Modules/Scorm2004/classes/ilSCORM13Package.php");
2983  $rte_pkg = new ilSCORM13Package();
2984  $rte_pkg->il_import($this->object->getDataDirectory(), $this->object->getId(), $DIC["ilias"], false, true);
2985 
2986  //increase module version is it necessary?
2987  //$this->object->setModuleVersion($module_version+1);
2988  //$this->object->update();
2989 
2990  //redirect to view player
2991  ilUtil::redirect("ilias.php?baseClass=ilSAHSPresentationGUI&ref_id=" . $this->object->getRefID() . "&envEditor=1");
2992  }
2993 }
cancelDeleteExportFile()
cancel deletion of export files
insertLMChapterClip($a_confirm=false, $a_perform=false)
Insert chapter from clipboard.
Select file for being added into file lists.
Class ilSCORM2004Condition.
jumpToNode($a_anchor_node="", $a_highlight_ids="")
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
This class represents an option in a radio group.
Class ilSCORM2004PageNode.
static getPostMulti()
Get multi number of _POST input.
Class ilObjectMetaDataGUI.
$path
Definition: aliased.php:25
Class ilObjSCORMLearningModuleGUI.
$rest
Definition: goto.php:46
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
insertTemplate($a_redirect=true)
Insert (multiple) pages at node.
showOrganization( $a_top_node=0, $a_form_action="", $a_title="", $a_icon="", $a_gui_obj=null, $a_gui_cmd="")
Show subhiearchy of chapters, scos and pages.
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
put this object into content object tree
Class ilSCORM2004Sco.
settings()
Definition: settings.php:2
static clipboardCopy($a_slm_obj_id, $a_ids)
Copy a set of chapters/pages/scos into the clipboard.
insertScenarioGUI()
Insert sequencing scenario at node.
TableGUI class for learning objectives alignments.
insertSpecialPage($a_redirect=true)
Insert special page.
$_SESSION["AccountId"]
insertChapter($a_redirect=true)
Insert (multiple) chapters at node.
This class represents a selection list property in a property form.
$template
This class represents a property form user interface.
initPropertiesEditableForm()
Init properties (editable) form.
$type
saveProperties()
save scorm 2004 module properties
global $DIC
Definition: saml.php:7
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
$_GET["client_id"]
$tbl
Definition: example_048.php:81
This class represents a section header in a property form.
Class ilObjGlossary.
static clipboardCut($a_slm_obj_id, $a_ids)
Cut and copy a set of chapters/pages into the clipboard.
copyItems($a_return="showOrganization")
Copy items to clipboard.
saveAllTitles($a_redirect=true)
Save all titles of chapters/scos/pages.
setInfo($a_info)
Set Information Text.
Nested List.
static getPostNodeId()
Get node ID of _POST input.
if(!array_key_exists('StateId', $_REQUEST)) $id
setValue($a_value)
Set Value.
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
insertSco($a_redirect=true)
Insert (multiple) scos at node.
getTemplate()
output main header (title and locator)
Class ilSCORM2004Chapter.
This class represents a checkbox property in a property form.
const IL_FM_POSITIVE
deleteNodes($a_form_action="")
confirm deletion screen of chapters/scos/pages
static _lookupTitle($a_id)
lookup object title
insertPage($a_redirect=true)
Insert (multiple) pages at node.
static insertPageClip($a_slm_obj)
Insert pages from clipboard.
static _getStandardStyles( $a_exclude_default_style=false, $a_include_deactivated=false, $a_scope=0)
Get standard styles.
cutItems($a_return="showOrganization")
Copy items to clipboard, then cut them from the current tree.
static insertScoClip($a_slm_obj)
Insert scos from clipboard.
const IL_CAL_UNIX
insertScenario()
Insert sequencing scenario at node.
static checkIfAnyoneIsInOfflineMode($obj_id)
__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
Constructor.
static _lookupSubType($a_obj_id)
lookup subtype id (scorm, )
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
user()
Definition: user.php:4
frameset($a_to_organization=false)
output main frameset of media pool left frame: explorer tree of folders right frame: media pool conte...
static _lookupStandard($a_id)
Lookup standard flag.
Notes GUI class.
global $ilCtrl
Definition: ilias.php:18
static getPostFields()
Get all post fields.
setInfo($a_info)
Set Information Text.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getPostFirstChild()
Should node be inserted as first child of target node (true) or as successor (false) ...
setChecked($a_checked)
Set Checked.
This class represents a property in a property form.
Class ilSCORM2004TrackingItemsTableGUI.
setValue($a_value)
Set Value.
if(isset($_POST['submit'])) $form
static getInstance($a_slm_object, $a_id=0, $a_halt=true)
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
This class represents a number property in a property form.
$values
static _lookupType($a_obj_id)
Lookup Type.
confirmDeleteExportFile()
confirmation screen for export file deletion
static _lookupObjId($a_id)
const IL_FIRST_NODE
Definition: class.ilTree.php:5
setValue($a_value)
Set Value.
special template class to simplify handling of ITX/PEAR
setTitle($a_title)
Set Title.
insertTemplateGUI($a_redirect=true, $a_special_page=false)
Displays GUI to select template for page.
This class represents a text property in a property form.
& getGeneral()
Definition: class.ilMD.php:40
Date and time handling
setSubTabs($a_main_tab="", $a_active="")
Set sub tabs.
$ilUser
Definition: imgupload.php:18
Class ilSCORM2004PageNodeGUI.
getPropertiesEditableValues()
Get current values for properties (editable) from.
Export class for SCORM 2004 object.
static clear($a_var)
Unset a value.
showLearningObjectivesAlignment()
Show Learning Objectives Alignment.
setMaxLength($a_maxlength)
Set Max Length.
setTableNames($a_table_tree, $a_table_obj_data, $a_table_obj_reference="")
set table names The primary key of the table containing your object_data must be &#39;obj_id&#39; You may use...
$n
Definition: RandomTest.php:85
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
static uniqueTypesCheck($a_items)
Check for unique types (all pages or all chapters or all scos)
setOptions($a_options)
Set Options.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
editOrganization($a_to_organization=true)
Edit organization (called from listgui, must setup frameset)
static _lookupType($a_id, $a_reference=false)
lookup object type
$users
Definition: authpage.php:44
setTreeTablePK($a_column_name)
set column containing primary key in tree table public
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Class ilSCORM2004Chapter.
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.
exit
Definition: backend.php:16
setMaxLength($a_maxlength)
Set Max Length.
selectExport()
Select the export type of the SCORM 2004 module.
static formSelect( $selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
static getParticipantsForObject($a_ref_id)
Get participant ids for given object.
This class represents a non editable value in a property form.
global $l
Definition: afr.php:30
static insertChapterClip($a_slm_obj, $a_as_sub=false)
Insert Chapter from clipboard.
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
global $ilSetting
Definition: privfeed.php:17
Class ilObjSCORM2004LearningModule.
This class represents a text area property in a property form.
Class ilSCORM2004Asset.
Class ilSCORM2004ChapterGUI.
confirmedDelete($a_redirect=true)
Delete chapters/scos/pages.
assignObject()
assign scorm object to scorm gui object
This class allows quick editing of a chapter/sco/page hierarchy.
$i
Definition: disco.tpl.php:19
static initjQuery($a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
static activeLayouts($a_special_page=false, $a_module=null)
Get active layouts.
insertAsset($a_redirect=true)
Insert (multiple) assets at node.
Class ilSCORM2004ScoGUI.
Class ilSCORM2004ChapterGUI.
getObjectService()
Get object service.
static yn2tf($a_yn)
convert "y"/"n" to true/false
static _writeTitle($a_obj_id, $a_title)
Write Title.
static setAction($a_action)
static redirect($a_script)
$target
Definition: test.php:19
addHeaderAction()
Add header action menu.
static insertAssetClip($a_slm_obj, $a_type="ass")
Insert assets from clipboard.
Class ilSCORM2004AssetGUI.
$_POST["username"]
$html
Definition: example_001.php:87
setRequired($a_required)
Set Required.
setLocator()
set Locator
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
Confirmation screen class.
confirmExpertMode()
Confirm activation of expert mode.