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