ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
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/classes/class.ilObjStyleSheetGUI.php");
8 include_once("./Services/Style/classes/class.ilPageLayout.php");
9 
25 {
31  function ilObjSCORM2004LearningModuleGUI($a_data,$a_id,$a_call_by_reference, $a_prepare_output = true)
32  {
33  global $lng;
34 
35  $lng->loadLanguageModule("content");
36  $lng->loadLanguageModule("sahs");
37  $lng->loadLanguageModule("search");
38  $lng->loadLanguageModule("exp");
39  $this->type = "sahs";
40  $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference,false);
41  #$this->tabs_gui =& new ilTabsGUI();
42  }
43 
47  function executeCommand()
48  {
49  global $ilAccess, $ilCtrl, $tpl, $ilTabs, $lng;
50 
51  $next_class = $ilCtrl->getNextClass($this);
52  $cmd = $ilCtrl->getCmd();
53 
54  if ($this->object->getEditable() && $cmd != "showEditTree") // show editing frameset
55  {
56  $this->showEditTree();
57  }
58 
59  // update expander
60  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
61  $form_gui = new ilSCORM2004OrganizationHFormGUI();
62  $form_gui->setTree($this->getEditTree());
63  $form_gui->updateExpanded();
64  switch($next_class)
65  {
66  // notes
67  case "ilnotegui":
68  $this->getTemplate();
69  $this->setLocator();
70  $this->setTabs();
71  switch($_GET["notes_mode"])
72  {
73  default:
74  $ilTabs->setTabActive("sahs_organization");
75  return $this->showOrganization();
76  }
77  break;
78 
79  // chapters
80  case "ilscorm2004chaptergui":
81  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004ChapterGUI.php");
82  $chap_gui = new ilSCORM2004ChapterGUI($this->object, $_GET["obj_id"]);
83  $chap_gui->setParentGUI($this);
84  return $ilCtrl->forwardCommand($chap_gui);
85 
86  // sequencing chapters
87  case "ilscorm2004seqchaptergui":
88  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004SeqChapterGUI.php");
89  $chap_gui = new ilSCORM2004SeqChapterGUI($this->object, $_GET["obj_id"]);
90  $chap_gui->setParentGUI($this);
91  return $ilCtrl->forwardCommand($chap_gui);
92 
93  // scos
94  case "ilscorm2004scogui":
95  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004ScoGUI.php");
96  $sco_gui = new ilSCORM2004ScoGUI($this->object, $_GET["obj_id"]);
97  $sco_gui->setParentGUI($this);
98  return $ilCtrl->forwardCommand($sco_gui);
99 
100  // assets
101  case "ilscorm2004assetgui":
102  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004AssetGUI.php");
103  $ass_gui = new ilSCORM2004AssetGUI($this->object, $_GET["obj_id"]);
104  $ass_gui->setParentGUI($this);
105  return $ilCtrl->forwardCommand($ass_gui);
106 
107  // pages
108  case "ilscorm2004pagenodegui":
109  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004PageNodeGUI.php");
110  $page_gui = new ilSCORM2004PageNodeGUI($this->object, $_GET["obj_id"]);
111  $page_gui->setParentGUI($this);
112  $ilCtrl->forwardCommand($page_gui);
113  break;
114 
115  default:
116  parent::executeCommand();
117  $this->addHeaderAction();
118  break;
119  }
120  }
121 
128  function showEditTree()
129  {
130  global $tpl;
131 
132  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004EditorExplorerGUI.php");
133  $exp = new ilSCORM2004EditorExplorerGUI($this, "showEditTree", $this->object);
134  if (!$exp->handleCommand())
135  {
136  $tpl->setLeftNavContent($exp->getHTML());
137  }
138  }
139 
140 
147  function editOrganization($a_to_organization = true)
148  {
149  if ($_GET["obj_id"] > 0)
150  {
151  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
152  $type = ilSCORM2004Node::_lookupType($_GET["obj_id"]);
153  }
154  if (in_array($type, array("sco", "chap", "seqc", "page")))
155  {
156  $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
157  $this->ctrl->redirect($this, "jumpToNode");
158  }
159  else
160  {
161  if ($a_to_organization)
162  {
163  $this->ctrl->redirect($this, "showOrganization");
164  }
165  else
166  {
167  $this->ctrl->redirect($this, "properties");
168  }
169  }
170 
171  }
172 
178  // UK change possible
179  function frameset($a_to_organization = false)
180  {
181  if ($this->object->getEditable()) // show editing frameset
182  {
183 $this->ctrl->redirect($this, "properties");
184  include_once("./Services/Frameset/classes/class.ilFramesetGUI.php");
185  $fs_gui = new ilFramesetGUI();
186  $fs_gui->setFramesetTitle($this->lng->txt("editor"));
187  $fs_gui->setMainFrameName("content");
188  $fs_gui->setSideFrameName("tree");
189  $this->ctrl->setParameter($this, "active_node", $_GET["obj_id"]);
190  $fs_gui->setSideFrameSource($this->ctrl->getLinkTarget($this, "showTree"));
191  $this->ctrl->setParameter($this, "activeNode", "");
192  if ($_GET["obj_id"] > 0)
193  {
194  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
195  $type = ilSCORM2004Node::_lookupType($_GET["obj_id"]);
196  }
197  if (in_array($type, array("sco", "chap", "seqc", "page")))
198  {
199  $this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
200  $fs_gui->setMainFrameSource($this->ctrl->getLinkTarget($this, "jumpToNode"));
201  }
202  else
203  {
204  if ($a_to_organization)
205  {
206  $fs_gui->setMainFrameSource($this->ctrl->getLinkTarget($this, "showOrganization"));
207  }
208  else
209  {
210  $fs_gui->setMainFrameSource($this->ctrl->getLinkTarget($this, "properties"));
211  }
212  }
213  $fs_gui->show();
214  exit;
215  }
216  else // otherwise show standard frameset
217  {
218  $this->tpl = new ilTemplate("tpl.sahs_edit_frameset.html", false, false, "Modules/ScormAicc");
219  $this->tpl->setVariable("SRC",
220  $this->ctrl->getLinkTarget($this, "properties"));
221  $this->tpl->show("DEFAULT", false);
222  }
223  exit;
224  }
225 
226  function jumpToNode($a_anchor_node = "", $a_highlight_ids = "")
227  {
228  global $ilCtrl;
229 
230  $anchor = ($a_anchor_node != "")
231  ? "node_".$a_anchor_node
232  : "";
233 
234  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
235  $type = ilSCORM2004Node::_lookupType($_GET["obj_id"]);
236  $ilCtrl->setParameter($this, "obj_id", $_GET["obj_id"]);
237  switch($type)
238  {
239  case "sco":
240  $ilCtrl->setParameterByClass("ilscorm2004scogui", "highlight", $a_highlight_ids);
241  $ilCtrl->redirectByClass("ilscorm2004scogui", "showOrganization", $anchor);
242  case "ass":
243  $ilCtrl->setParameterByClass("ilscorm2004assetgui", "highlight", $a_highlight_ids);
244  $ilCtrl->redirectByClass("ilscorm2004assetgui", "showOrganization", $anchor);
245  case "chap":
246  $ilCtrl->setParameterByClass("ilscorm2004chaptergui", "highlight", $a_highlight_ids);
247  $ilCtrl->redirectByClass("ilscorm2004chaptergui", "showOrganization", $anchor);
248  case "seqc":
249  $ilCtrl->setParameterByClass("ilscorm2004seqchaptergui", "highlight", $a_highlight_ids);
250  $ilCtrl->redirectByClass("ilscorm2004seqchaptergui", "showOrganization", $anchor);
251  case "page":
252  $ilCtrl->redirectByClass("ilscorm2004pagenodegui", "edit");
253  }
254  }
255 
259  function properties()
260  {
261  global $rbacsystem, $tree, $tpl, $lng, $ilToolbar, $ilCtrl, $ilSetting, $ilTabs;
262 
263  $this->setSubTabs("settings", "general_settings");
264 
265  $lng->loadLanguageModule("style");
266 
267  // not editable
268  if ($this->object->editable != 1)
269  {
271  $ilTabs->setSubTabActive('cont_settings');
272  // view
273  $ilToolbar->addButton($this->lng->txt("view"),
274  "ilias.php?baseClass=ilSAHSPresentationGUI&amp;ref_id=".$this->object->getRefID(),
275  "_blank");
276  }
277  else // editable
278  {
279  // glossary buttons to toolbar
280  $sep = false;
281  if (ilObject::_lookupType($this->object->getAssignedGlossary()) != "glo")
282  {
283  $parent_ref_id = $tree->getParentId((int) $_GET["ref_id"]);
284  if ($rbacsystem->checkAccess("create", $parent_ref_id, "glo"))
285  {
286  $ilToolbar->addButton($this->lng->txt("cont_glo_create"),
287  $ilCtrl->getLinkTarget($this, "createGlossary"));
288  }
289  $ilToolbar->addButton($this->lng->txt("cont_glo_assign"),
290  $ilCtrl->getLinkTarget($this, "assignGlossary"));
291  }
292  else
293  {
294  $ilToolbar->addButton($this->lng->txt("cont_glo_detach"),
295  $ilCtrl->getLinkTarget($this, "detachGlossary"));
296  }
297 
298  // style buttons to toolbar
299  $fixed_style = $ilSetting->get("fixed_content_style_id");
300  $style_id = $this->object->getStyleSheetId();
301 
302  if ($fixed_style == 0)
303  {
304  $st_styles = ilObjStyleSheet::_getStandardStyles(true, false,
305  $_GET["ref_id"]);
306 
307  $st_styles[0] = $this->lng->txt("default");
308  ksort($st_styles);
309 
310  if ($style_id > 0)
311  {
312  // individual style
313  if (!ilObjStyleSheet::_lookupStandard($style_id))
314  {
315  $ilToolbar->addSeparator();
316 
317  // delete command
318  $ilToolbar->addButton($this->lng->txt("cont_edit_style"),
319  $ilCtrl->getLinkTarget($this, "editStyle"));
320  $ilToolbar->addButton($this->lng->txt("cont_delete_style"),
321  $ilCtrl->getLinkTarget($this, "deleteStyle"));
322  }
323  }
324 
325  if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id))
326  {
327  $ilToolbar->addSeparator();
328 
329  $ilToolbar->addButton($this->lng->txt("sty_create_ind_style"),
330  $ilCtrl->getLinkTarget($this, "createStyle"));
331  }
332  }
333  }
334 
335  // output forms
336  if ($this->object->editable != 1)
337  {
338  $this->initPropertiesForm();
339  $tpl->setContent($this->form->getHTML());
340  }
341  else
342  {
345  $tpl->setContent($this->form->getHTML());
346  }
347  }
348 
356  {
357  global $lng, $ilCtrl;
358 
359  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
360  $this->form = new ilPropertyFormGUI();
361  $this->form->setFormAction($ilCtrl->getFormAction($this));
362  $this->form->setTitle($this->lng->txt("cont_lm_properties"));
363 
364  // SCORM-type
365  $ne = new ilNonEditableValueGUI($this->lng->txt("type"), "");
366  $ne->setValue($this->lng->txt( "lm_type_" . ilObjSAHSLearningModule::_lookupSubType( $this->object->getID() ) ) );
367  $this->form->addItem($ne);
368 
369  // version
370  $ne = new ilNonEditableValueGUI($this->lng->txt("cont_sc_version"), "");
371  $ne->setValue($this->object->getModuleVersion());
372  $this->form->addItem($ne);
373 
374  // online
375  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_online"), "cobj_online");
376  $cb->setValue("y");
377  if ($this->object->getOnline())
378  {
379  $cb->setChecked(true);
380  }
381  $this->form->addItem($cb);
382 
383  // offline Mode
384  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_offline_mode_allow"), "cobj_offline_mode");
385  $cb->setValue("y");
386  $cb->setChecked($this->object->getOfflineMode());
387  include_once("./Modules/ScormAicc/classes/class.ilSCORMOfflineMode.php");
388  if ($this->object->getOfflineMode()== true && ilSCORMOfflineMode::checkIfAnyoneIsInOfflineMode($this->object->getID()) == true) {
389  $cb->setDisabled(true);
390  $cb->setInfo($this->lng->txt("cont_offline_mode_disable_not_allowed_info"));
391  } else {
392  $cb->setInfo($this->lng->txt("cont_offline_mode_allow_info"));
393  }
394  $this->form->addItem($cb);
395 
396  //
397  // presentation
398  //
399  $sh = new ilFormSectionHeaderGUI();
400  $sh->setTitle($this->lng->txt("cont_presentation"));
401  $this->form->addItem($sh);
402 
403  // display mode (open)
404  $options = array(
405  "0" => $this->lng->txt("cont_open_normal"),
406  "1" => $this->lng->txt("cont_open_iframe_max"),
407  "2" => $this->lng->txt("cont_open_iframe_defined"),
408  "5" => $this->lng->txt("cont_open_window_undefined"),
409  "6" => $this->lng->txt("cont_open_window_defined")
410  );
411  $si = new ilSelectInputGUI($this->lng->txt("cont_open"), "open_mode");
412  $si->setOptions($options);
413  $si->setValue($this->object->getOpenMode());
414  $this->form->addItem($si);
415 
416  // width
417  $ni = new ilNumberInputGUI($this->lng->txt("cont_width"), "width");
418  $ni->setMaxLength(4);
419  $ni->setSize(4);
420  $ni->setValue($this->object->getWidth());
421  $this->form->addItem($ni);
422 
423  // height
424  $ni = new ilNumberInputGUI($this->lng->txt("cont_height"), "height");
425  $ni->setMaxLength(4);
426  $ni->setSize(4);
427  $ni->setValue($this->object->getHeight());
428  $this->form->addItem($ni);
429 
430  // disable top menu
431  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_nomenu"), "cobj_nomenu");
432  $cb->setValue("y");
433  $cb->setChecked($this->object->getNoMenu());
434  $this->form->addItem($cb);
435 
436  // disable left-side navigation
437  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_hidenavig"), "cobj_hidenavig");
438  $cb->setValue("y");
439  $cb->setChecked($this->object->getHideNavig());
440  $this->form->addItem($cb);
441 
442  // auto navigation to last visited item
443  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_auto_last_visited"), "cobj_auto_last_visited");
444  $cb->setValue("y");
445  $cb->setChecked($this->object->getAuto_last_visited());
446  $cb->setInfo($this->lng->txt("cont_auto_last_visited_info"));
447  $this->form->addItem($cb);
448 
449  // set IE compatibility mode
450  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_ie_compatibility"), "cobj_ie_compatibility");
451  $cb->setValue("y");
452  $cb->setChecked($this->object->getIe_compatibility());
453  $cb->setInfo($this->lng->txt("cont_ie_compatibility_info"));
454  $this->form->addItem($cb);
455 
456  // force IE to render again
457  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_ie_force_render"), "cobj_ie_force_render");
458  $cb->setValue("y");
459  $cb->setChecked($this->object->getIe_force_render());
460  $cb->setInfo($this->lng->txt("cont_ie_force_render_info"));
461  $this->form->addItem($cb);
462 
463  //
464  // scorm options
465  //
466  $sh = new ilFormSectionHeaderGUI();
467  $sh->setTitle($this->lng->txt("cont_scorm_options"));
468  $this->form->addItem($sh);
469 
470  // max attempts
471  $ni = new ilNumberInputGUI($this->lng->txt("cont_sc_max_attempt"), "max_attempt");
472  $ni->setMaxLength(3);
473  $ni->setSize(3);
474  $ni->setValue($this->object->getMaxAttempt());
475  $this->form->addItem($ni);
476 
477  // lesson mode
478  $options = array("normal" => $this->lng->txt("cont_sc_less_mode_normal"),
479  "browse" => $this->lng->txt("cont_sc_less_mode_browse"));
480  $si = new ilSelectInputGUI($this->lng->txt("cont_def_lesson_mode"), "lesson_mode");
481  $si->setOptions($options);
482  $si->setValue($this->object->getDefaultLessonMode());
483  $this->form->addItem($si);
484 
485  // credit mode
486  $options = array("credit" => $this->lng->txt("cont_credit_on"),
487  "no_credit" => $this->lng->txt("cont_credit_off"));
488  $si = new ilSelectInputGUI($this->lng->txt("cont_credit_mode"), "credit_mode");
489  $si->setOptions($options);
490  $si->setValue($this->object->getCreditMode());
491  $si->setInfo($this->lng->txt("cont_credit_mode_info"));
492  $this->form->addItem($si);
493 
494  // set lesson mode review when completed
495  $options = array(
496  "n" => $this->lng->txt("cont_sc_auto_review_no"),
497  "r" => $this->lng->txt("cont_sc_auto_review_completed_not_failed_or_passed"),
498  "p" => $this->lng->txt("cont_sc_auto_review_passed"),
499  "q" => $this->lng->txt("cont_sc_auto_review_passed_or_failed"),
500  "c" => $this->lng->txt("cont_sc_auto_review_completed"),
501  "d" => $this->lng->txt("cont_sc_auto_review_completed_and_passed"),
502  "y" => $this->lng->txt("cont_sc_auto_review_completed_or_passed"),
503  );
504  $si = new ilSelectInputGUI($this->lng->txt("cont_sc_auto_review_2004"), "auto_review");
505  $si->setOptions($options);
506  $si->setValue($this->object->getAutoReviewChar());
507  $si->setInfo($this->lng->txt("cont_sc_auto_review_info_2004"));
508  $this->form->addItem($si);
509 
510  //
511  // rte settings
512  //
513  $sh = new ilFormSectionHeaderGUI();
514  $sh->setTitle($this->lng->txt("cont_rte_settings"));
515  $this->form->addItem($sh);
516 
517  // unlimited session timeout
518  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_sc_usession"), "cobj_session");
519  $cb->setValue("y");
520  $cb->setChecked($this->object->getSession());
521  $cb->setInfo($this->lng->txt("cont_sc_usession_info"));
522  $this->form->addItem($cb);
523 
524  // SCORM 2004 fourth edition features
525  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_fourth_edition"), "cobj_fourth_edition");
526  $cb->setValue("y");
527  $cb->setChecked($this->object->getFourth_edition());
528  $cb->setInfo($this->lng->txt("cont_fourth_edition_info"));
529  $this->form->addItem($cb);
530 
531  // sequencing
532  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_sequencing"), "cobj_sequencing");
533  $cb->setValue("y");
534  $cb->setChecked($this->object->getSequencing());
535  $cb->setInfo($this->lng->txt("cont_sequencing_info"));
536  $this->form->addItem($cb);
537 
538  // storage of interactions
539  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_interactions"), "cobj_interactions");
540  $cb->setValue("y");
541  $cb->setChecked($this->object->getInteractions());
542  $this->form->addItem($cb);
543 
544  // objectives
545  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_objectives"), "cobj_objectives");
546  $cb->setValue("y");
547  $cb->setChecked($this->object->getObjectives());
548  $this->form->addItem($cb);
549 
550  // comments
551  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_comments"), "cobj_comments");
552  $cb->setValue("y");
553  $cb->setChecked($this->object->getComments());
554  $this->form->addItem($cb);
555 
556  // time from lms
557  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_time_from_lms"), "cobj_time_from_lms");
558  $cb->setValue("y");
559  $cb->setChecked($this->object->getTime_from_lms());
560  $cb->setInfo($this->lng->txt("cont_time_from_lms_info"));
561  $this->form->addItem($cb);
562 
563  // check values
564  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_check_values"), "cobj_check_values");
565  $cb->setValue("y");
566  $cb->setChecked($this->object->getCheck_values());
567  $this->form->addItem($cb);
568 
569  // auto cmi.exit to suspend
570  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_auto_suspend"), "cobj_auto_suspend");
571  $cb->setValue("y");
572  $cb->setChecked($this->object->getAutoSuspend());
573  $cb->setInfo($this->lng->txt("cont_auto_suspend_info"));
574  $this->form->addItem($cb);
575 
576  //
577  // debugging
578  //
579  $sh = new ilFormSectionHeaderGUI();
580  $sh->setTitle($this->lng->txt("cont_debugging"));
581  $this->form->addItem($sh);
582 
583  // test tool
584  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_debug"), "cobj_debug");
585  $cb->setValue("y");
586  $cb->setChecked($this->object->getDebug());
587  if ($this->object->getDebugActivated() == false)
588  {
589  $cb->setDisabled(true);
590  $cb->setInfo($this->lng->txt("cont_debug_deactivated"));
591  }
592  else
593  {
594  $cb->setInfo($this->lng->txt("cont_debug_deactivate"));
595  }
596  $this->form->addItem($cb);
597  $this->form->addCommandButton("saveProperties", $lng->txt("save"));
598  }
599 
600 
604  public function initPropertiesEditableForm()
605  {
606  global $lng, $ilCtrl, $tree, $rbacsystem, $ilSetting;
607 
608  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
609  $this->form = new ilPropertyFormGUI();
610 
611  // localization
612  $options = array(
613  "" => $lng->txt("please_select"),
614  );
615  $langs = $lng->getInstalledLanguages();
616  $lng->loadLanguageModule("meta");
617  foreach ($langs as $l)
618  {
619  $options[$l] = $lng->txt("meta_l_".$l);
620  }
621  $loc = new ilSelectInputGUI($this->lng->txt("cont_localization"), "localization");
622  $loc->setOptions($options);
623  $loc->setInfo($this->lng->txt("cont_localization_info"));
624  $this->form->addItem($loc);
625 
626  // glossary
627  $ne = new ilNonEditableValueGUI($lng->txt("obj_glo"), "glossary");
628  $this->form->addItem($ne);
629 
630  // style
631  $lng->loadLanguageModule("style");
632  $fixed_style = $ilSetting->get("fixed_content_style_id");
633  $style_id = $this->object->getStyleSheetId();
634 
635  if ($fixed_style > 0)
636  {
637  $st = new ilNonEditableValueGUI($lng->txt("cont_current_style"));
638  $st->setValue(ilObject::_lookupTitle($fixed_style)." (".
639  $this->lng->txt("global_fixed").")");
640  $this->form->addItem($st);
641  }
642  else
643  {
644  $st_styles = ilObjStyleSheet::_getStandardStyles(true, false,
645  $_GET["ref_id"]);
646 
647  $st_styles[0] = $this->lng->txt("default");
648  ksort($st_styles);
649 
650  if ($style_id > 0)
651  {
652  // individual style
653  if (!ilObjStyleSheet::_lookupStandard($style_id))
654  {
655  $st = new ilNonEditableValueGUI($lng->txt("cont_current_style"));
656  $st->setValue(ilObject::_lookupTitle($style_id));
657  $this->form->addItem($st);
658  }
659  }
660 
661  if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id))
662  {
663  $style_sel = ilUtil::formSelect ($style_id, "style_id",
664  $st_styles, false, true);
665  $style_sel = new ilSelectInputGUI($lng->txt("cont_current_style"), "style_id");
666  $style_sel->setOptions($st_styles);
667  $style_sel->setValue($style_id);
668  $this->form->addItem($style_sel);
669  }
670  }
671 
672  // number of tries
673  $ni = new ilNumberInputGUI($lng->txt("cont_qtries"), "q_tries");
674  $ni->setInfo($lng->txt("cont_qtries_info")); // #15133
675  $ni->setMaxLength(3);
676  $ni->setSize(3);
677  $this->form->addItem($ni);
678 
679 
680  $this->form->addCommandButton("saveProperties", $lng->txt("save"));
681 
682  $this->form->setTitle($lng->txt("cont_scorm_ed_properties"));
683  $this->form->setFormAction($ilCtrl->getFormAction($this));
684  }
685 
689  public function getPropertiesEditableValues()
690  {
691  $values = array();
692 
693  if (ilObject::_lookupType($this->object->getAssignedGlossary()) == "glo")
694  {
695  $values["glossary"] = ilObject::_lookupTitle($this->object->getAssignedGlossary());
696  }
697  else
698  {
699  $values["glossary"] = $this->lng->txt("cont_no_glossary");
700  }
701  $values["q_tries"] = $this->object->getTries();
702  $values["localization"] = $this->object->getLocalization();
703  $values["style_id"] = $this->object->getStyleSheetId();
704 
705  $this->form->setValuesByArray($values);
706  }
707 
711  function saveProperties()
712  {
713  global $ilSetting;
714 
715  if ($this->object->editable != 1)
716  {
717  //check if OfflineMode-Zip has to be created
718  $tmpOfflineMode= ilUtil::yn2tf($_POST["cobj_offline_mode"]);
719  $tmpFourth_edition = ilUtil::yn2tf($_POST["cobj_fourth_edition"]);
720  $tmpSequencing = ilUtil::yn2tf($_POST["cobj_sequencing"]);
721  if ($tmpOfflineMode == true) {
722 // $tmpSequencing = false; //actually no sequencing for offline_mode
723  $tmpFourth_edition = false; //4th edition is not possible
724  if ($this->object->getOfflineMode() == false) {
725  $this->object->zipLmForOfflineMode();
726  }
727  }
728 
729  $this->object->setOnline(ilUtil::yn2tf($_POST["cobj_online"]));
730  $this->object->setOpenMode($_POST["open_mode"]);
731  $this->object->setWidth($_POST["width"]);
732  $this->object->setHeight($_POST["height"]);
733  $this->object->setCreditMode($_POST["credit_mode"]);
734  $this->object->setMaxAttempt($_POST["max_attempt"]);
735  $this->object->setAutoReviewChar($_POST["auto_review"]);
736  $this->object->setDefaultLessonMode($_POST["lesson_mode"]);
737  $this->object->setSession(ilUtil::yn2tf($_POST["cobj_session"]));
738  $this->object->setNoMenu(ilUtil::yn2tf($_POST["cobj_nomenu"]));
739  $this->object->setHideNavig(ilUtil::yn2tf($_POST["cobj_hidenavig"]));
740  $this->object->setAuto_last_visited(ilUtil::yn2tf($_POST["cobj_auto_last_visited"]));
741  $this->object->setIe_compatibility(ilUtil::yn2tf($_POST["cobj_ie_compatibility"]));
742  $this->object->setIe_force_render(ilUtil::yn2tf($_POST["cobj_ie_force_render"]));
743  $this->object->setFourth_edition($tmpFourth_edition);
744  $this->object->setSequencing($tmpSequencing);
745  $this->object->setInteractions(ilUtil::yn2tf($_POST["cobj_interactions"]));
746  $this->object->setObjectives(ilUtil::yn2tf($_POST["cobj_objectives"]));
747  $this->object->setComments(ilUtil::yn2tf($_POST["cobj_comments"]));
748  $this->object->setTime_from_lms(ilUtil::yn2tf($_POST["cobj_time_from_lms"]));
749  $this->object->setCheck_values(ilUtil::yn2tf($_POST["cobj_check_values"]));
750  $this->object->setAutoSuspend(ilUtil::yn2tf($_POST["cobj_auto_suspend"]));
751  $this->object->setOfflineMode($tmpOfflineMode);
752  $this->object->setDebug(ilUtil::yn2tf($_POST["cobj_debug"]));
753  //$this->object->setDebugPw($_POST["debug_pw"]);
754 
755  }
756  else
757  {
759  if ($this->form->checkInput())
760  {
761  $this->object->setTries($_POST["q_tries"]);
762  $this->object->setLocalization($_POST["localization"]);
763 
764  if ($ilSetting->get("fixed_content_style_id") <= 0 &&
765  (ilObjStyleSheet::_lookupStandard($this->object->getStyleSheetId())
766  || $this->object->getStyleSheetId() == 0))
767  {
768  $this->object->setStyleSheetId(ilUtil::stripSlashes($_POST["style_id"]));
769  }
770  }
771  }
772  $this->object->update();
773  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
774  $this->ctrl->redirect($this, "properties");
775  }
776 
780  function detachGlossary()
781  {
782  global $ilCtrl;
783 
784  $this->object->setAssignedGlossary(0);
785  $this->object->update();
786  $ilCtrl->redirect($this, "properties");
787  }
788 
792  function createGlossary()
793  {
794  global $tpl;
795 
796  $this->initGlossaryCreationForm();
797  $tpl->setContent($this->form->getHTML());
798  }
799 
803  public function initGlossaryCreationForm()
804  {
805  global $lng, $ilCtrl;
806 
807  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
808  $this->form = new ilPropertyFormGUI();
809 
810  // title
811  $ti = new ilTextInputGUI($lng->txt("title"), "title");
812  $ti->setRequired(true);
813  $this->form->addItem($ti);
814 
815  // description
816  $ta = new ilTextAreaInputGUI($lng->txt("desc"), "description");
817  $this->form->addItem($ta);
818 
819  $this->form->addCommandButton("saveGlossary", $lng->txt("save"));
820  $this->form->addCommandButton("properties", $lng->txt("cancel"));
821 
822  $this->form->setTitle($lng->txt("cont_glo_create"));
823  $this->form->setFormAction($ilCtrl->getFormAction($this));
824  }
825 
829  public function saveGlossary()
830  {
831  global $tpl, $lng, $ilCtrl, $rbacsystem, $tree;
832 
833  $parent_ref_id = $tree->getParentId((int) $_GET["ref_id"]);
834  if (!$rbacsystem->checkAccess("create", $parent_ref_id, "glo"))
835  {
836  ilUtil::sendFailure($lng->txt("no_permission"), true);
837  $ilCtrl->redirect($this, "properties");
838  }
839 
840  $this->initGlossaryCreationForm();
841  if ($this->form->checkInput())
842  {
843  include_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
844  $newObj = new ilObjGlossary();
845  $newObj->setType("glo");
846  $newObj->setTitle($_POST["title"]);
847  $newObj->setDescription($_POST["description"]);
848  $newObj->setVirtualMode("none");
849  $newObj->create();
850  $newObj->createReference();
851  $newObj->putInTree($parent_ref_id);
852  $newObj->setPermissions($parent_ref_id);
853  $newObj->notify("new",$parent_ref_id,$_GET["parent_non_rbac_id"],$parent_ref_id,$newObj->getRefId());
854 
855  // perform save
856  $this->object->setAssignedGlossary($newObj->getId());
857  $this->object->update();
858 
859  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
860  $ilCtrl->redirect($this, "properties");
861  }
862 
863  $this->form->setValuesByPost();
864  $tpl->setContent($this->form->getHtml());
865  }
866 
870  function assignGlossary()
871  {
872  global $tpl, $ilCtrl, $tree;
873 
874  include_once("./Modules/Scorm2004/classes/class.ilGlossarySelectorGUI.php");
875  $exp = new ilGlossarySelectorGUI(
876  $ilCtrl->getLinkTarget($this, "selectGlossary"), "ilobjscorm2004learningmodulegui");
877  $exp->setSelectableTypes(array("glo"));
878 
879  if ($_GET["expand"] == "")
880  {
881  $expanded = $tree->readRootId();
882  }
883  else
884  {
885  $expanded = $_GET["expand"];
886  }
887  $exp->setExpand($expanded);
888 
889  $exp->setTargetGet("glo_id");
890  //$this->ctrl->setParameter($this, "target_type", $a_type);
891  //$ilCtrl->setParameter($this, "subCmd", "insertFromRepository");
892  $exp->setParamsGet($this->ctrl->getParameterArray($this, "assignGlossary"));
893 
894  // filter
895  $exp->setFiltered(true);
896  $exp->setFilterMode(IL_FM_POSITIVE);
897  $exp->addFilter("root");
898  $exp->addFilter("cat");
899  $exp->addFilter("grp");
900  $exp->addFilter("fold");
901  $exp->addFilter("crs");
902  $exp->addFilter("glo");
903 
904  $exp->setOutput(0);
905 
906  $tpl->setContent($exp->getOutput());
907  }
908 
912  function selectGlossary()
913  {
914  global $ilCtrl;
915 
916  $this->object->setAssignedGlossary(ilObject::_lookupObjId((int) $_GET["glo_ref_id"]));
917  $this->object->update();
918  $ilCtrl->redirect($this, "properties");
919  }
920 
924  function assignObject()
925  {
926  if ($this->id != 0)
927  {
928  if ($this->call_by_reference)
929  {
930  $this->object =& new ilObjSCORM2004LearningModule($this->id, true);
931  }
932  else
933  {
934  $this->object =& new ilObjSCORM2004LearningModule($this->id, false);
935  }
936  }
937  }
938 
943  {
944  global $tpl;
945 
946  $this->initStylePropertiesForm();
947  $tpl->setContent($this->form->getHTML());
948  }
949 
954  {
955  global $ilCtrl, $lng, $ilTabs, $ilSetting;
956 
957  $lng->loadLanguageModule("style");
958  $this->setSubTabs("settings", "style");
959  $ilTabs->setTabActive("settings");
960 
961  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
962  $this->form = new ilPropertyFormGUI();
963 
964  $fixed_style = $ilSetting->get("fixed_content_style_id");
965  $style_id = $this->object->getStyleSheetId();
966 
967  if ($fixed_style > 0)
968  {
969  $st = new ilNonEditableValueGUI($lng->txt("cont_current_style"));
970  $st->setValue(ilObject::_lookupTitle($fixed_style)." (".
971  $this->lng->txt("global_fixed").")");
972  $this->form->addItem($st);
973  }
974  else
975  {
976  $st_styles = ilObjStyleSheet::_getStandardStyles(true, false,
977  $_GET["ref_id"]);
978 
979  $st_styles[0] = $this->lng->txt("default");
980  ksort($st_styles);
981 
982  if ($style_id > 0)
983  {
984  // individual style
985  if (!ilObjStyleSheet::_lookupStandard($style_id))
986  {
987  $st = new ilNonEditableValueGUI($lng->txt("cont_current_style"));
988  $st->setValue(ilObject::_lookupTitle($style_id));
989  $this->form->addItem($st);
990 
991 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "edit"));
992 
993  // delete command
994  $this->form->addCommandButton("editStyle",
995  $lng->txt("cont_edit_style"));
996  $this->form->addCommandButton("deleteStyle",
997  $lng->txt("cont_delete_style"));
998 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "delete"));
999  }
1000  }
1001 
1002  if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id))
1003  {
1004  $style_sel = ilUtil::formSelect ($style_id, "style_id",
1005  $st_styles, false, true);
1006  $style_sel = new ilSelectInputGUI($lng->txt("cont_current_style"), "style_id");
1007  $style_sel->setOptions($st_styles);
1008  $style_sel->setValue($style_id);
1009  $this->form->addItem($style_sel);
1010 //$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "create"));
1011  $this->form->addCommandButton("saveStyleSettings",
1012  $lng->txt("save"));
1013  $this->form->addCommandButton("createStyle",
1014  $lng->txt("sty_create_ind_style"));
1015  }
1016  }
1017  $this->form->setTitle($lng->txt("cont_style"));
1018  $this->form->setFormAction($ilCtrl->getFormAction($this));
1019  }
1020 
1024  function createStyle()
1025  {
1026  global $ilCtrl;
1027 
1028  $ilCtrl->redirectByClass("ilobjstylesheetgui", "create");
1029  }
1030 
1034  function editStyle()
1035  {
1036  global $ilCtrl;
1037 
1038  $ilCtrl->redirectByClass("ilobjstylesheetgui", "edit");
1039  }
1040 
1044  function deleteStyle()
1045  {
1046  global $ilCtrl;
1047 
1048  $ilCtrl->redirectByClass("ilobjstylesheetgui", "delete");
1049  }
1050 
1055  {
1056  global $ilSetting;
1057 
1058  if ($ilSetting->get("fixed_content_style_id") <= 0 &&
1059  (ilObjStyleSheet::_lookupStandard($this->object->getStyleSheetId())
1060  || $this->object->getStyleSheetId() == 0))
1061  {
1062  $this->object->setStyleSheetId(ilUtil::stripSlashes($_POST["style_id"]));
1063  $this->object->update();
1064  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1065  }
1066  $this->ctrl->redirect($this, "editStyleProperties");
1067  }
1068 
1072  protected function showTrackingItemsBySco()
1073  {
1074  global $ilTabs;
1075 
1076 
1078  $ilTabs->setTabActive("cont_tracking_data");
1079  $ilTabs->setSubTabActive("cont_tracking_bysco");
1080 
1081  $reports = array('exportSelectedCore','exportSelectedInteractions','exportSelectedObjectives','tracInteractionItem','tracInteractionUser','tracInteractionUserAnswers');
1082 
1083  $scoSelected = "all";
1084  if (isset($_GET["scoSelected"])) $scoSelected = ilUtil::stripSlashes($_GET["scoSelected"]);
1085  if (isset($_POST["scoSelected"])) $scoSelected = ilUtil::stripSlashes($_POST["scoSelected"]);
1086  $this->ctrl->setParameter($this,'scoSelected',$scoSelected);
1087 
1088  $report = "choose";
1089  if (isset($_GET["report"])) $report = ilUtil::stripSlashes($_GET["report"]);
1090  if (isset($_POST["report"])) $report = ilUtil::stripSlashes($_POST["report"]);
1091  $this->ctrl->setParameter($this,'report',$report);
1092 
1093  include_once './Modules/Scorm2004/classes/class.ilSCORM2004TrackingItemsPerScoFilterGUI.php';
1094  $filter = new ilSCORM2004TrackingItemsPerScoFilterGUI($this, 'showTrackingItemsBySco');
1095  $filter->parse($scoSelected,$report,$reports);
1096  if($report == "choose") {
1097  $this->tpl->setContent($filter->form->getHTML());
1098  } else {
1099  $scosSelected = array();
1100  if ($scoSelected != "all") $scosSelected[] = $scoSelected;
1101  else {
1102  $tmpscos=$this->object->getTrackedItems();
1103  for ($i=0; $i<count($tmpscos); $i++) {
1104  $scosSelected[] = $tmpscos[$i]["id"];
1105  }
1106  }
1107  //with check for course ...
1108  include_once "Services/Tracking/classes/class.ilTrQuery.php";
1109  $a_users=ilTrQuery::getParticipantsForObject($this->ref_id);
1110  // var_dump($this->object->getTrackedUsers(""));
1111  include_once './Modules/Scorm2004/classes/class.ilSCORM2004TrackingItemsTableGUI.php';
1112  $tbl = new ilSCORM2004TrackingItemsTableGUI($this->object->getId(), $this, 'showTrackingItemsBySco', $a_users, $scosSelected, $report);
1113  $this->tpl->setContent($filter->form->getHTML().$tbl->getHTML());
1114  }
1115  return true;
1116  }
1118  {
1119  global $ilTabs, $ilAccess;
1120 
1121  $ilTabs->setTabActive('cont_tracking_data');
1122 
1123  if($ilAccess->checkAccess("read_learning_progress", "", $_GET["ref_id"])) {
1124 
1126  $ilTabs->setSubTabActive('cont_tracking_byuser');
1127 
1128  $reports = array('exportSelectedSuccess','exportSelectedCore','exportSelectedInteractions','exportSelectedObjectives','exportObjGlobalToSystem');
1129 
1130  $userSelected = "all";
1131  if (isset($_GET["userSelected"])) $userSelected = ilUtil::stripSlashes($_GET["userSelected"]);
1132  if (isset($_POST["userSelected"])) $userSelected = ilUtil::stripSlashes($_POST["userSelected"]);
1133  $this->ctrl->setParameter($this,'userSelected',$userSelected);
1134 
1135  $report = "choose";
1136  if (isset($_GET["report"])) $report = ilUtil::stripSlashes($_GET["report"]);
1137  if (isset($_POST["report"])) $report = ilUtil::stripSlashes($_POST["report"]);
1138  $this->ctrl->setParameter($this,'report',$report);
1139 
1140  include_once './Modules/Scorm2004/classes/class.ilSCORM2004TrackingItemsPerUserFilterGUI.php';
1141  $filter = new ilSCORM2004TrackingItemsPerUserFilterGUI($this, 'showTrackingItems');
1142  $filter->parse($userSelected,$report,$reports);
1143  if($report == "choose") {
1144  $this->tpl->setContent($filter->form->getHTML());
1145  } else {
1146  $usersSelected = array();
1147  if ($userSelected != "all") $usersSelected[] = $userSelected;
1148  else {
1149  include_once "Services/Tracking/classes/class.ilTrQuery.php";
1150  $users=ilTrQuery::getParticipantsForObject($this->ref_id);
1151  foreach($users as $user) {
1152  if(ilObject::_exists($user) && ilObject::_lookUpType($user) == 'usr') {
1153  $usersSelected[] = $user;
1154  }
1155  }
1156  }
1157  $scosSelected = array();
1158  $tmpscos=$this->object->getTrackedItems();
1159  for ($i=0; $i<count($tmpscos); $i++) {
1160  $scosSelected[] = $tmpscos[$i]["id"];
1161  }
1162  //with check for course ...
1163  // include_once "Services/Tracking/classes/class.ilTrQuery.php";
1164  // $a_users=ilTrQuery::getParticipantsForObject($this->ref_id);
1165  // var_dump($this->object->getTrackedUsers(""));
1166  include_once './Modules/Scorm2004/classes/class.ilSCORM2004TrackingItemsTableGUI.php';
1167  $tbl = new ilSCORM2004TrackingItemsTableGUI($this->object->getId(), $this, 'showTrackingItems', $usersSelected, $scosSelected, $report);
1168  $this->tpl->setContent($filter->form->getHTML().$tbl->getHTML());
1169  }
1170  }
1171  else if($ilAccess->checkAccess("edit_learning_progress", "", $_GET["ref_id"])) {
1172  $this->modifyTrackingItems();
1173  }
1174  return true;
1175  }
1176 
1177 
1183  {
1184  foreach ($_POST["user"] as $user)
1185  {
1186  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004DeleteData.php");
1187  ilSCORM2004DeleteData::removeCMIDataForUserAndPackage($user,$this->object->getId());
1188 
1189  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
1190  ilLPStatusWrapper::_updateStatus($this->object->getId(), $user);
1191  }
1192 
1193  $this->ctrl->redirect($this, "modifyTrackingItems");
1194  }
1195 
1196  //UK may be erased
1198  {
1199  if (is_array($_POST["id"]))
1200  {
1201  $this->object->deleteTrackingDataOfUsers($_POST["id"]);
1202  }
1203  $this->modifyTrackingItems();
1204  }
1205 
1209  function showTree()
1210  {
1211  global $ilUser, $ilias, $ilCtrl, $lng;
1212 
1213  $mtree = new ilTree($this->object->getId());
1214  $mtree->setTableNames('sahs_sc13_tree','sahs_sc13_tree_node');
1215  $mtree->setTreeTablePK("slm_id");
1216 
1217  if ($_POST["expandAll"] != "")
1218  {
1219  $_GET["scexpand"] = "";
1220  $stree = $mtree->getSubTree($mtree->getNodeData($mtree->readRootId()));
1221  $n_arr = array();
1222  foreach ($stree as $n)
1223  {
1224  $n_arr[] = $n["child"];
1225  }
1226  $_SESSION["scexpand"] = $n_arr;
1227  }
1228 
1229  if ($_POST["collapseAll"] != "")
1230  {
1231  $_GET["scexpand"] = "";
1232  $_SESSION["scexpand"] = array($mtree->readRootId());
1233  }
1234 
1235  $this->tpl = new ilTemplate("tpl.main.html", true, true);
1236  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
1237 
1238  $ilCtrl->setParameter($this, "active_node", $_GET["active_node"]);
1239 
1240  $this->tpl->addBlockFile("CONTENT", "content", "tpl.explorer.html");
1241  $this->tpl->setVariable("IMG_SPACE", ilUtil::getImagePath("spacer.png", false));
1242 
1243  $this->tpl->setCurrentBlock("exp2_button");
1244  $this->tpl->setVariable("CMD_EXP2_BTN", "expandAll");
1245  $this->tpl->setVariable("TXT_EXP2_BTN", $lng->txt("expand_all"));
1246  $this->tpl->parseCurrentBlock();
1247 
1248  $this->tpl->setCurrentBlock("exp2_button");
1249  $this->tpl->setVariable("CMD_EXP2_BTN", "collapseAll");
1250  $this->tpl->setVariable("TXT_EXP2_BTN", $lng->txt("collapse_all"));
1251  $this->tpl->parseCurrentBlock();
1252 
1253  require_once ("./Modules/Scorm2004/classes/class.ilSCORM2004EditorExplorer.php");
1254  $exp = new ilSCORM2004EditorExplorer($this->ctrl->getLinkTarget($this, "edit"),
1255  $this->object);
1256  $exp->setFrameUpdater("content", "ilHierarchyFormUpdater");
1257  $exp->setTargetGet("obj_id");
1258  $exp->setExpandTarget($this->ctrl->getLinkTarget($this, "showTree"));
1259 
1260  if ($_GET["scexpand"] == "")
1261  {
1262  $expanded = $mtree->readRootId();
1263  }
1264  else
1265  {
1266  $expanded = $_GET["scexpand"];
1267  }
1268 
1269 //echo "-".$_GET["active_node"]."-";
1270  if ($_GET["active_node"] != "")
1271  {
1272  $path = $mtree->getPathId($_GET["active_node"]);
1273  $exp->setForceOpenPath($path);
1274 
1275  $exp->highlightNode($_GET["active_node"]);
1276  }
1277  $exp->setExpand($expanded);
1278 
1279  // build html-output
1280  $exp->setOutput(0);
1281  $output = $exp->getOutput();
1282 
1283  // asynchronous output
1284  if ($ilCtrl->isAsynch())
1285  {
1286  echo $output; exit;
1287  }
1288 
1289  $this->tpl->setCurrentBlock("content");
1290  $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("sahs_organization"));
1291  $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
1292  $this->tpl->setVariable("EXPLORER",$output);
1293  $this->ctrl->setParameter($this, "scexpand", $_GET["scexpand"]);
1294  $this->tpl->setVariable("ACTION", $this->ctrl->getLinkTarget($this, "showTree"));
1295  $this->tpl->parseCurrentBlock();
1296 
1297  include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
1298  iljQueryUtil::initjQuery($this->tpl);
1299 
1300  $this->tpl->show(false);
1301 
1302 
1303  exit;
1304  }
1305 
1309  function showSequencing()
1310  {
1311  global $tpl, $lng, $ilTabs, $ilToolbar, $ilCtrl;
1312 
1313  $ilTabs->setTabActive("sahs_sequencing");
1314 
1315  include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Item.php");
1316 
1317  if (!$this->object->getSequencingExpertMode())
1318  {
1319  $ilToolbar->addButton($lng->txt("sahs_activate_expert_mode"),
1320  $ilCtrl->getLinkTarget($this, "confirmExpertMode"));
1321  }
1322  else
1323  {
1324  include_once("./Services/UIComponent/NestedList/classes/class.ilNestedList.php");
1325  $list = new ilNestedList();
1326  $t = $this->object->getTree();
1327  $root_node = $t->getNodeData($t->getRootId());
1328  $nodes = $this->object->getTree()->getSubtree($root_node);
1329  foreach ($nodes as $node)
1330  {
1331  if (in_array($node["type"], array("", "chap", "sco")))
1332  {
1333  $ntpl = new ilTemplate("tpl.seq_node.html", true, true, "Modules/Scorm2004");
1334  $ntpl->setVariable("NODE_ID", $node["child"]);
1335  if ($node["type"] == "")
1336  {
1337  $ntpl->setVariable("TITLE", $this->object->getTitle());
1338  $item = new ilSCORM2004Item($this->object->getId(), true);
1339  }
1340  else
1341  {
1342  $ntpl->setVariable("TITLE", $node["title"]);
1343  $item = new ilSCORM2004Item($node["child"]);
1344  }
1345  $ntpl->setVariable("SEQ_INFO",
1346  ilUtil::prepareFormOutput($item->exportAsXML(false)));
1347  $list->addListNode($ntpl->get(), $node["child"], $node["parent"]);
1348  }
1349  }
1350 
1351  $tb = new ilToolbarGUI();
1352  $tb->addFormButton($lng->txt("save"), "saveSequencing");
1353  $ftpl = new ilTemplate("tpl.sequencing.html", true, true, "Modules/Scorm2004");
1354  $ftpl->setVariable("CONTENT", $list->getHTML());
1355  $ftpl->setVariable("FORM_ACTION", $ilCtrl->getFormAction($this));
1356  $ftpl->setVariable("TB", $tb->getHTML());
1357  $tpl->setContent($ftpl->get());
1358  }
1359  }
1360 
1365  {
1366  global $ilCtrl, $tpl, $lng, $ilTabs;
1367 
1368  $ilTabs->setTabActive("sahs_sequencing");
1369 
1370  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1371  $cgui = new ilConfirmationGUI();
1372  $cgui->setFormAction($ilCtrl->getFormAction($this));
1373  $cgui->setHeaderText($lng->txt("sahs_activate_expert_mode_info"));
1374  $cgui->setCancel($lng->txt("cancel"), "showSequencing");
1375  $cgui->setConfirm($lng->txt("sahs_activate_expert_mode"), "activateExpertMode");
1376 
1377  $tpl->setContent($cgui->getHTML());
1378  }
1379 
1387  {
1388  global $ilCtrl, $lng;
1389 
1390  $this->object->setSequencingExpertMode(true);
1391  $this->object->update();
1392  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1393  $ilCtrl->redirect($this, "showSequencing");
1394  }
1395 
1396 
1400  function saveSequencing()
1401  {
1402  global $tpl,$lng, $ilCtrl;
1403 
1404  include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Item.php");
1405  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
1406  $t = $this->object->getTree();
1407  $root_node = $t->getNodeData($t->getRootId());
1408  $nodes = $this->object->getTree()->getSubtree($root_node);
1409  foreach ($nodes as $node)
1410  {
1411  if (in_array($node["type"], array("", "chap", "sco")))
1412  {
1413  if ($node["type"] == "")
1414  {
1415  $item = new ilSCORM2004Item($this->object->getId(), true);
1416  }
1417  else
1418  {
1419  $item = new ilSCORM2004Item($node["child"]);
1420  }
1421  $xml = '<?xml version="1.0"?>'.ilUtil::stripSlashes($_POST["seq"][$node["child"]], false);
1422 
1423  $ob_texts = array();
1424  if ($node["type"] == "sco")
1425  {
1426  $sco = new ilSCORM2004Sco($this->object, $node["child"]);
1427  $objectives = $sco->getObjectives();
1428  foreach ($objectives as $o)
1429  {
1430  $ob_texts[$o->getId()] = $o->getObjectiveId();
1431  }
1432  }
1433 
1434  $item->setSeqXml($xml);
1435  $item->initDom();
1436  $item->update();
1437 
1438  if ($node["type"] == "sco")
1439  {
1440  foreach ($ob_texts as $id => $t)
1441  {
1442  $objective = new ilScorm2004Objective($node["child"], $id);
1443  $objective->setObjectiveId($t);
1444  $objective->updateObjective();
1445  }
1446  }
1447  }
1448  }
1449 
1450  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1451 
1452  $ilCtrl->redirect($this, "showSequencing");
1453  }
1454 
1459  {
1460  global $tpl, $lng, $ilCtrl, $ilToolbar;
1461 
1462  $chaps = $this->object->getTree()->getChilds(
1463  $this->object->getTree()->getRootId());
1464  $s_chaps = array();
1465  foreach($chaps as $chap)
1466  {
1467  if ($chap["type"] == "chap")
1468  {
1469  $s_chaps[$chap["child"]] = $chap["title"];
1470  }
1471  }
1472  $cur_chap = $_SESSION["sahs_cur_chap"]
1473  ? $_SESSION["sahs_cur_chap"]
1474  : 0;
1475 
1476  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
1477  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
1478  $options = array(
1479  "0" => $lng->txt("all")
1480  );
1481  $options = $options + $s_chaps;
1482  $si = new ilSelectInputGUI($lng->txt("chapter"), "chapter");
1483  $si->setOptions($options);
1484  $si->setValue($cur_chap);
1485  $ilToolbar->addInputItem($si, true);
1486  $ilToolbar->addFormButton($lng->txt("change"), "selectLObjChapter");
1487 
1488  include_once("./Modules/Scorm2004/classes/class.ilObjectivesAlignmentTableGUI.php");
1489  $obj_table = new ilObjectivesAlignmentTableGUI($this, "showLearningObjectivesAlignment",
1490  $this->getEditTree(), $this->object, $cur_chap);
1491  $tpl->setContent($obj_table->getHTML());
1492  }
1493 
1495  {
1496  global $ilCtrl;
1497 
1498  $_SESSION["sahs_cur_chap"] = (int) $_POST["chapter"];
1499  $ilCtrl->redirect($this, "showLearningObjectivesAlignment");
1500  }
1501 
1505  public function selectExport()
1506  {
1507  switch ($_POST['select_export'])
1508  {
1509  case "exportScorm12":
1510  case "exportScorm2004_3rd":
1511  case "exportScorm2004_4th":
1512  case "exportPDF":
1513  case "exportISO":
1514  case "exportHTML":
1515  case "exportHTMLOne":
1516  $this->ctrl->redirect($this, $_POST['select_export']);
1517  break;
1518  default:
1519  $this->ctrl->redirect($this, 'showExportList');
1520  break;
1521  }
1522  }
1523 
1527  function showExportList()
1528  {
1529  global $tpl, $ilToolbar;
1530 
1531  $ilToolbar->setFormAction($this->ctrl->getFormAction($this, 'selectExport'));
1532  $ilToolbar->setId("scorm2004export");
1533 
1534  //$template = new ilTemplate("tpl.scorm2004_export_buttons.html", true, true, 'Modules/Scorm2004');
1535 
1536 /* $buttons = array(
1537  "exportScorm2004_3rd" => $this->lng->txt("scorm_create_export_file_scrom2004"),
1538  "exportScorm2004_4th" => $this->lng->txt("scorm_create_export_file_scrom2004_4th"),
1539  "exportScorm12" => $this->lng->txt("scorm_create_export_file_scrom12"),
1540  "exportPDF" => $this->lng->txt("scorm_create_export_file_pdf"),
1541  "exportISO" => $this->lng->txt("scorm_create_export_file_iso"),
1542  "exportHTML" => $this->lng->txt("scorm_create_export_file_html"),
1543  "exportHTMLOne" => $this->lng->txt("scorm_create_export_file_html_one")
1544  );*/
1545  $buttons = array(
1546  "exportScorm2004_3rd" => $this->lng->txt("scorm_create_export_file_scrom2004"),
1547  "exportScorm2004_4th" => $this->lng->txt("scorm_create_export_file_scrom2004_4th"),
1548  "exportScorm12" => $this->lng->txt("scorm_create_export_file_scrom12"),
1549  "exportHTML" => $this->lng->txt("scorm_create_export_file_html"),
1550  "exportHTMLOne" => $this->lng->txt("scorm_create_export_file_html_one")
1551  );
1552 
1553  //
1554  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
1555  $si = new ilSelectInputGUI($this->lng->txt('type'), "select_export");
1556  $si->setOptions($buttons);
1557  $ilToolbar->addInputItem($si, true);
1558 
1559  $ilToolbar->addFormButton($this->lng->txt('export'), "selectExport");
1560 
1561  $export_files = $this->object->getExportFiles();
1562 
1563  include_once "./Modules/Scorm2004/classes/class.ilSCORM2004ExportTableGUI.php";
1564  $table_gui = new ilSCORM2004ExportTableGUI($this, 'showExportList');
1565  $data = array();
1566  foreach ($export_files as $exp_file)
1567  {
1568  $filetype = $exp_file['type'];
1569  $public_str = ($exp_file["file"] == $this->object->getPublicExportFile($filetype))
1570  ? " <b>(".$this->lng->txt("public").")<b>"
1571  : "";
1572  $file_arr = explode("__", $exp_file["file"]);
1573  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));
1574  }
1575  $table_gui->setData($data);
1576 
1577  $this->tpl->setContent($table_gui->getHTML());
1578  }
1579 
1585  function getTabs(&$tabs_gui)
1586  {
1587  global $ilAccess, $ilHelp;
1588 
1589  if ($this->ctrl->getCmd() == "delete")
1590  {
1591  return;
1592  }
1593 
1594  if (!$this->object->getEditable())
1595  {
1596  return parent::getTabs($tabs_gui);
1597  }
1598 
1599  $ilHelp->setScreenIdComponent("sahsed");
1600 
1601  // organization
1602  $tabs_gui->addTarget("sahs_organization",
1603  $this->ctrl->getLinkTarget($this, "showOrganization"), "showOrganization",
1604  get_class($this));
1605 
1606  // info screen
1607  $force_active = ($this->ctrl->getNextClass() == "ilinfoscreengui")
1608  ? true
1609  : false;
1610  $tabs_gui->addTarget("info_short",
1611  $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"), "",
1612  "ilinfoscreengui", "", $force_active);
1613 
1614  // settings
1615  $tabs_gui->addTarget("settings",
1616  $this->ctrl->getLinkTarget($this, "properties"), "properties",
1617  get_class($this));
1618 
1619  // tracking data
1620  /* Later, only if tracking data exists
1621  $tabs_gui->addTarget("cont_tracking_data",
1622  $this->ctrl->getLinkTarget($this, "showTrackingItems"), "showTrackingItems",
1623  get_class($this));
1624  */
1625 
1626  // objective alignment
1627  $tabs_gui->addTarget("sahs_objectives_alignment",
1628  $this->ctrl->getLinkTarget($this, "showLearningObjectivesAlignment"), "showLearningObjectivesAlignment",
1629  get_class($this));
1630 
1631  // sequencing
1632  $tabs_gui->addTarget("sahs_sequencing",
1633  $this->ctrl->getLinkTarget($this, "showSequencing"), "showSequencing",
1634  get_class($this));
1635 
1636  // learning progress
1637  /* Later, only if tracking data exists
1638  include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
1639  if(ilObjUserTracking::_enabledLearningProgress())
1640  {
1641  $tabs_gui->addTarget('learning_progress',
1642  $this->ctrl->getLinkTargetByClass(array('illearningprogressgui'),''),
1643  '',
1644  array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui'));
1645  }
1646  */
1647 
1648  // edit meta
1649  $tabs_gui->addTarget("meta_data",
1650  $this->ctrl->getLinkTargetByClass('ilmdeditorgui',''),
1651  "", "ilmdeditorgui");
1652 
1653  // export
1654  $tabs_gui->addTarget("export",
1655  $this->ctrl->getLinkTarget($this, "showExportList"), array("showExportList", 'confirmDeleteExportFile'),
1656  get_class($this));
1657 
1658  // perm
1659  if ($ilAccess->checkAccess('edit_permission', '', $this->object->getRefId()))
1660  {
1661  $tabs_gui->addTarget("perm_settings",
1662  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
1663  }
1664 
1665  if ($this->object->editable==1)
1666  {
1667  // preview
1668  $tabs_gui->addNonTabbedLink("preview",
1669  $this->lng->txt("cont_sc_preview"),
1670  $this->ctrl->getLinkTarget($this, "preview"),
1671  "_blank");
1672  }
1673 
1674  }
1675 
1679  function setSubTabs($a_main_tab, $a_active)
1680  {
1681  global $ilTabs, $ilCtrl, $lng;
1682 
1683  if ($a_main_tab == "settings" &&
1684  $this->object->editable == 1)
1685  {
1686 /* // general properties
1687  $ilTabs->addSubTab("general_settings",
1688  $lng->txt("general_settings"),
1689  $ilCtrl->getLinkTarget($this, 'properties'));
1690 
1691  // style properties
1692  $ilTabs->addSubTab("style",
1693  $lng->txt("cont_style"),
1694  $ilCtrl->getLinkTarget($this, 'editStyleProperties'));
1695 */
1696  $ilTabs->activateSubTab($a_active);
1697  }
1698  }
1699 
1700 
1704  function getEditTree()
1705  {
1706  $slm_tree = new ilTree($this->object->getId());
1707  $slm_tree->setTreeTablePK("slm_id");
1708  $slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1709  return $slm_tree;
1710  }
1711 
1715  function showOrganization($a_top_node = 0, $a_form_action = "",
1716  $a_title = "", $a_icon = "", $a_gui_obj = null, $a_gui_cmd = "")
1717  {
1718  global $lng, $ilCtrl, $tpl;
1719 
1720  if ($a_form_action == "")
1721  {
1722  $a_form_action = $ilCtrl->getFormAction($this);
1723  }
1724 
1725  if ($a_icon == "")
1726  {
1727  $a_title = $this->object->getTitle();
1728  $a_icon = ilUtil::getImagePath("icon_lm.svg");
1729  }
1730 
1731  $slm_tree = $this->getEditTree();
1732 
1733  if ($a_top_node == 0)
1734  {
1735  $a_top_node = $slm_tree->getRootId();
1736  }
1737 
1738  if (is_null($a_gui_obj))
1739  {
1740  $a_gui_obj = $this;
1741  $a_gui_cmd = "showOrganization";
1742  }
1743 
1744  $ilCtrl->setParameter($this, "backcmd", "showOrganization");
1745  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
1746  $form_gui = new ilSCORM2004OrganizationHFormGUI();
1747  $form_gui->setParentCommand($a_gui_obj, $a_gui_cmd);
1748  $form_gui->setFormAction($a_form_action);
1749 // $form_gui->setTitle($a_title);
1750 // $form_gui->setIcon($a_icon);
1751  $form_gui->setTree($slm_tree);
1752  $form_gui->setCurrentTopNodeId($a_top_node);
1753  $form_gui->addMultiCommand($lng->txt("delete"), "deleteNodes");
1754  $form_gui->addMultiCommand($lng->txt("cut"), "cutItems");
1755  $form_gui->addMultiCommand($lng->txt("copy"), "copyItems");
1756  $form_gui->addCommand($lng->txt("cont_save_all_titles"), "saveAllTitles");
1757  $form_gui->addCommand($lng->txt("expand_all"), "expandAll");
1758  $form_gui->addCommand($lng->txt("collapse_all"), "collapseAll");
1759  $form_gui->setTriggeredUpdateCommand("saveAllTitles");
1760 
1761  // highlighted nodes
1762  if ($_GET["highlight"] != "")
1763  {
1764  $hl = explode(":", $_GET["highlight"]);
1765  $form_gui->setHighlightedNodes($hl);
1766  $form_gui->setFocusId($hl[0]);
1767  }
1768 
1769  $ilCtrl->setParameter($this, "active_node", $_GET["obj_id"]);
1770 // $form_gui->setExplorerUpdater("tree", "tree_div",
1771 // $ilCtrl->getLinkTarget($this, "showTree", "", true));
1772  $sc_tpl = new ilTemplate("tpl.scormeditor_orga_screen.html", true, true, "Modules/Scorm2004");
1773  $sc_tpl->setVariable("ORGANIZATION", $form_gui->getHTML());
1774  $sc_tpl->setVariable("NOTES", $this->getNotesHTML());
1775 
1776  $tpl->setContent($sc_tpl->get());
1777  }
1778 
1782  function getNotesHTML($a_mode = "")
1783  {
1784  global $ilCtrl, $ilAccess, $ilSetting;
1785 
1786  // notes
1787  $ilCtrl->setParameter($this, "nodes_mode", $a_mode);
1788  include_once("Services/Notes/classes/class.ilNoteGUI.php");
1789  $node_id = $_GET["obj_id"];
1790  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
1791  $node_type = ($node_id > 0)
1792  ? ilSCORM2004Node::_lookupType($node_id)
1793  : "sahs";
1794 
1795  $notes_gui = new ilNoteGUI($this->object->getId(),
1796  (int) $node_id, $node_type);
1797  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]) && $ilSetting->get("comments_del_tutor", 1))
1798  {
1799  $notes_gui->enablePublicNotesDeletion(true);
1800  }
1801  $notes_gui->enablePrivateNotes();
1802  $notes_gui->enablePublicNotes();
1803 
1804  $next_class = $ilCtrl->getNextClass($this);
1805  if ($next_class == "ilnotegui")
1806  {
1807  $html = $this->ctrl->forwardCommand($notes_gui);
1808  }
1809  else
1810  {
1811  $html = $notes_gui->getNotesHTML();
1812  }
1813  return $html;
1814  }
1815 
1819  function insertChapter($a_redirect = true)
1820  {
1821  global $ilCtrl, $lng;
1822 
1823  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
1824 
1825  $slm_tree =& new ilTree($this->object->getId());
1826  $slm_tree->setTreeTablePK("slm_id");
1827  $slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1828 
1831 
1832  if (!ilSCORM2004OrganizationHFormGUI::getPostFirstChild()) // insert after node id
1833  {
1834  $parent_id = $slm_tree->getParentId($node_id);
1835  $target = $node_id;
1836  }
1837  else // insert as first child
1838  {
1839  $parent_id = $node_id;
1840  $target = IL_FIRST_NODE;
1841  }
1842  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Chapter.php");
1843  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
1844 
1845  $chap_ids = array();
1846  for ($i = 1; $i <= $num; $i++)
1847  {
1848  $chap = new ilSCORM2004Chapter($this->object);
1849  $chap->setTitle($lng->txt("sahs_new_chapter"));
1850  $chap->setSLMId($this->object->getId());
1851  $chap->create();
1852  ilSCORM2004Node::putInTree($chap, $parent_id, $target);
1853  $chap_ids[] = $chap->getId();
1854  }
1855  $chap_ids = array_reverse($chap_ids);
1856  $chap_ids = implode($chap_ids, ":");
1857 
1858  if ($a_redirect)
1859  {
1860  $ilCtrl->setParameter($this, "highlight", $chap_ids);
1861  $ilCtrl->redirect($this, "showOrganization", "node_".$node_id);
1862  }
1863  return array("node_id" => $node_id, "items" => $chap_ids);
1864  }
1865 
1869  function insertSco($a_redirect = true)
1870  {
1871  global $ilCtrl, $lng;
1872 
1873  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
1874 
1875  $slm_tree =& new ilTree($this->object->getId());
1876  $slm_tree->setTreeTablePK("slm_id");
1877  $slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1878 
1881 
1882  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
1883  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
1884 
1885  if (!ilSCORM2004OrganizationHFormGUI::getPostFirstChild()) // insert after node id
1886  {
1887  $parent_id = $slm_tree->getParentId($node_id);
1888  $target = $node_id;
1889  }
1890  else // insert as first child
1891  {
1892  $parent_id = $node_id;
1893  $target = IL_FIRST_NODE;
1894  }
1895 
1896  $sco_ids = array();
1897  for ($i = 1; $i <= $num; $i++)
1898  {
1899  $sco = new ilSCORM2004Sco($this->object);
1900  $sco->setTitle($lng->txt("sahs_new_sco"));
1901  $sco->setSLMId($this->object->getId());
1902  $sco->create();
1903  ilSCORM2004Node::putInTree($sco, $parent_id, $target);
1904  $sco_ids[] = $sco->getId();
1905  }
1906  $sco_ids = array_reverse($sco_ids);
1907  $sco_ids = implode($sco_ids, ":");
1908 
1909  if ($a_redirect)
1910  {
1911  $ilCtrl->setParameter($this, "highlight", $sco_ids);
1912  $ilCtrl->redirect($this, "showOrganization", "node_".$node_id);
1913  }
1914  return array("node_id" => $node_id, "items" => $sco_ids);
1915  }
1916 
1920  function insertAsset($a_redirect = true)
1921  {
1922  global $ilCtrl, $lng;
1923 
1924  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
1925 
1926  $slm_tree =& new ilTree($this->object->getId());
1927  $slm_tree->setTreeTablePK("slm_id");
1928  $slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1929 
1932 
1933  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Asset.php");
1934  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
1935 
1936  if (!ilSCORM2004OrganizationHFormGUI::getPostFirstChild()) // insert after node id
1937  {
1938  $parent_id = $slm_tree->getParentId($node_id);
1939  $target = $node_id;
1940  }
1941  else // insert as first child
1942  {
1943  $parent_id = $node_id;
1944  $target = IL_FIRST_NODE;
1945  }
1946 
1947  $ass_ids = array();
1948  for ($i = 1; $i <= $num; $i++)
1949  {
1950  $ass = new ilSCORM2004Asset($this->object);
1951  $ass->setTitle($lng->txt("sahs_new_asset"));
1952  $ass->setSLMId($this->object->getId());
1953  $ass->create();
1954  ilSCORM2004Node::putInTree($ass, $parent_id, $target);
1955  $ass_ids[] = $ass->getId();
1956  }
1957  $ass_ids = array_reverse($ass_ids);
1958  $ass_ids = implode($ass_ids, ":");
1959 
1960  if ($a_redirect)
1961  {
1962  $ilCtrl->setParameter($this, "highlight", $ass_ids);
1963  $ilCtrl->redirect($this, "showOrganization", "node_".$node_id);
1964  }
1965  return array("node_id" => $node_id, "items" => $ass_ids);
1966  }
1967 
1971  function insertPage($a_redirect = true)
1972  {
1973  global $ilCtrl, $lng;
1974 
1975  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
1976 
1977  $slm_tree =& new ilTree($this->object->getId());
1978  $slm_tree->setTreeTablePK("slm_id");
1979  $slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1980 
1983 
1984  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004PageNode.php");
1985  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
1986  if (!ilSCORM2004OrganizationHFormGUI::getPostFirstChild()) // insert after node id
1987  {
1988  $parent_id = $slm_tree->getParentId($node_id);
1989  $target = $node_id;
1990  }
1991  else // insert as first child
1992  {
1993  $parent_id = $node_id;
1994  $target = IL_FIRST_NODE;
1995  }
1996 
1997  $page_ids = array();
1998  for ($i = 1; $i <= $num; $i++)
1999  {
2000  $page = new ilSCORM2004PageNode($this->object);
2001  $page->setTitle($lng->txt("sahs_new_page"));
2002  $page->setSLMId($this->object->getId());
2003  $page->create();
2004  ilSCORM2004Node::putInTree($page, $parent_id, $target);
2005  $page_ids[] = $page->getId();
2006  }
2007  $page_ids = array_reverse($page_ids);
2008  $page_ids = implode($page_ids, ":");
2009 
2010  if ($a_redirect)
2011  {
2012  $ilCtrl->setParameter($this, "highlight", $page_ids);
2013  $ilCtrl->redirect($this, "showOrganization", "node_".$node_id);
2014  }
2015  return array("node_id" => $node_id, "items" => $page_ids);
2016  }
2017 
2018 
2023  {
2024 
2025  global $ilCtrl,$lng, $tpl;
2026 
2027  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
2028  include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004SeqTemplate.php");
2029 
2030  $templates = array();
2031  $description = null;
2032  $image = null;
2033 
2034  $default_identifier = $_POST["identifier"];
2035 
2036  //get available templates
2037  $arr_templates = ilSCORM2004SeqTemplate::availableTemplates();
2038 
2039  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.scormeditor_seq_chooser.html", "Modules/Scorm2004");
2040 
2041  $this->tpl->setCurrentBlock("option_item");
2042 
2043  $active = null;
2044  foreach ($arr_templates as $templ)
2045  {
2046  $sel= "";
2047  $item_data = $templ->getMetadataProperties();
2048  $item_data['identifier'] = $templ->getIdentifier();
2049  array_push($templates,$item_data);
2050  if ($default_identifier == $item_data['identifier']) {$sel = 'selected'; $active = $item_data;}
2051  $this->tpl->setVariable("VAL_SELECTED",$sel );
2052  $this->tpl->setVariable("VAL_IDENTIFIER",$item_data['identifier'] );
2053  $this->tpl->setVariable("VAL_TITLE",$item_data['title'] );
2054  $this->tpl->parseCurrentBlock();
2055  }
2056 
2057  //default
2058  if ($active == null )
2059  {
2060  $this->saveAllTitles(false);
2061  $description = $templates[0]['description'];
2062  $image = $templates[0]['thumbnail'];
2063  } else {
2064  $description = $active['description'];
2065  $image = $active['thumbnail'];
2066  }
2067 
2068  $this->tpl->setVariable("VAL_DESCRIPTION",$description);
2069  $this->tpl->setVariable("VAL_IMAGE",ilSCORM2004SeqTemplate::SEQ_TEMPLATE_DIR."/images/".$image);
2070 
2071  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
2072  $this->tpl->setVariable("BTN_NAME", "insertScenario");
2073  $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
2074  $this->tpl->setVariable("TXT_INSERT", $this->lng->txt("insert"));
2075  $this->tpl->setVariable("TXT_CHANGE", $this->lng->txt("change"));
2076 
2077  $this->tpl->setVariable("TXT_TITLE", "Choose Sequencing Template");
2078 
2079  $node_id = $_POST["node_id"];
2080  $first_child = $_POST["first_child"];
2081 
2082  if (!$node_id) {$node_id = ilSCORM2004OrganizationHFormGUI::getPostNodeId();}
2083  if (!$first_child) {$first_child = ilSCORM2004OrganizationHFormGUI::getPostFirstChild();}
2084 
2085  $this->tpl->setVariable("VAL_NODE_ID", $node_id);
2086  $this->tpl->setVariable("VAL_FIRST_CHILD", $first_child);
2087 
2088  }
2089 
2090 
2094  function insertScenario()
2095  {
2096  global $ilCtrl;
2097 
2098  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
2099 
2100  $slm_tree =& new ilTree($this->object->getId());
2101  $slm_tree->setTreeTablePK("slm_id");
2102  $slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
2103 
2104  $node_id = $_POST["node_id"];
2105 
2106  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004PageNode.php");
2107  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2108  include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004SeqTemplate.php");
2109 
2110  if (!$_POST["first_child"]) // insert after node id
2111  {
2112  $parent_id = $slm_tree->getParentId($node_id);
2113  $target = $node_id;
2114  }
2115  else // insert as first child
2116  {
2117  $parent_id = $node_id;
2118  $target = IL_FIRST_NODE;
2119  }
2120 
2121  $template = new ilSCORM2004SeqTemplate($_POST["identifier"]);
2122  $id = $template->insertTemplateForObjectAtParent($this->object,$parent_id,$target);
2123  $ilCtrl->setParameter($this, "highlight", $id);
2124  $ilCtrl->redirect($this, "showOrganization", "node_".$node_id);
2125 
2126  }
2127 
2131  function insertSpecialPage($a_redirect = true)
2132  {
2133  $this->insertTemplateGUI($a_redirect, true);
2134  }
2135 
2136 
2140  function insertTemplateGUI($a_redirect = true, $a_special_page = false)
2141  {
2142  global $ilCtrl,$lng, $tpl;
2143 
2144  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
2145 
2146  $arr_templates = ilPageLayout::activeLayouts($a_special_page, ilPageLayout::MODULE_SCORM);
2147 
2148  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.scormeditor_page_layout_chooser.html", "Modules/Scorm2004");
2149 
2150  $this->tpl->setCurrentBlock("option_item");
2151 
2152  $count = 0;
2153  foreach ($arr_templates as $templ)
2154  {
2155  $count++;
2156  $sel= "";
2157  $templ->readObject();
2158  $this->tpl->setVariable("VAL_LAYOUT_TITLE",$templ->getTitle());
2159  $this->tpl->setVariable("VAL_LAYOUT_IMAGE",$templ->getPreview());
2160  $this->tpl->setVariable("VAL_LAYOUT_ID",$templ->getId());
2161  $this->tpl->setVariable("VAL_DISPLAY","inline");
2162  if ($count==1) {
2163  $this->tpl->setVariable("VAL_CHECKED","checked");
2164  }
2165  if ($count%4 == 0) {
2166  $this->tpl->setVariable("END_ROW","</tr>");
2167  }
2168  if ($count == 1 || ($count-1)%4 == 0) {
2169  $this->tpl->setVariable("BEGIN_ROW","<tr>");
2170  }
2171  $this->tpl->parseCurrentBlock();
2172  }
2173 
2174  //matrix table
2175  if ($count%4!=0) {
2176  $rest = 4-($count%4);
2177  } else {
2178  $rest=0;
2179  }
2180 
2181  for ($i=1;$i<=$rest;$i++) {
2182  $this->tpl->setVariable("VAL_DISPLAY","none");
2183  $this->tpl->setVariable("VAL_LAYOUT_ID",$templ->getId());
2184 
2185  if ($i == $rest) {
2186  $this->tpl->setVariable("END_ROW","</tr>");
2187  }
2188  $this->tpl->parseCurrentBlock();
2189  }
2190 
2191  //empty cells and closing <tr>
2192 
2193  $this->tpl->setVariable("VAL_NODE_ID",ilSCORM2004OrganizationHFormGUI::getPostNodeId());
2194  $this->tpl->setVariable("VAL_MULTI", ilSCORM2004OrganizationHFormGUI::getPostMulti());
2195  $this->tpl->setVariable("VAL_FIRST_CHILD", ilSCORM2004OrganizationHFormGUI::getPostFirstChild());
2196  $this->tpl->setVariable("VAL_OBJ_ID", ilSCORM2004OrganizationHFormGUI::getPostFirstChild());
2197 
2198  $ilCtrl->saveParameter($this,"obj_id");
2199 
2200  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
2201 
2202  $this->tpl->setVariable("BTN_NAME", "insertTemplate");
2203  $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
2204  $this->tpl->setVariable("TXT_INSERT", $this->lng->txt("create"));
2205  $this->tpl->setVariable("CMD_CANCEL", "showOrganization");
2206 
2207  $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
2208  $this->tpl->setVariable("TXT_INSERT", $this->lng->txt("insert"));
2209  $this->tpl->setVariable("TXT_CHANGE", $this->lng->txt("change"));
2210  if ($a_special_page)
2211  {
2212  $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("sahs_choose_special_page"));
2213  }
2214  else
2215  {
2216  $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("sahs_choose_page_template"));
2217  }
2218  }
2219 
2220 
2221 
2225  function insertTemplate($a_redirect = true)
2226  {
2227  global $ilCtrl, $lng;
2228 
2229  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
2230 
2231  $slm_tree =& new ilTree($this->object->getId());
2232  $slm_tree->setTreeTablePK("slm_id");
2233  $slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
2234 
2235  $num = $_POST["multi"];
2236  $node_id = $_POST["node_id"];
2237  $layout_id = $_POST["layout_id"];
2238 
2239 
2240  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004PageNode.php");
2241  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2242 
2243  if (!$_POST["first_child"]) // insert after node id
2244  {
2245  $parent_id = $slm_tree->getParentId($node_id);
2246  $target = $node_id;
2247  }
2248  else // insert as first child
2249  {
2250  $parent_id = $node_id;
2251  $target = IL_FIRST_NODE;
2252  }
2253 
2254  $page_ids = array();
2255  for ($i = 1; $i <= $num; $i++)
2256  {
2257  $page = new ilSCORM2004PageNode($this->object);
2258  $page->setTitle($lng->txt("sahs_new_page"));
2259  $page->setSLMId($this->object->getId());
2260  $page->create(false,$layout_id);
2261  ilSCORM2004Node::putInTree($page, $parent_id, $target);
2262  $page_ids[] = $page->getId();
2263  }
2264  $page_ids = array_reverse($page_ids);
2265  $page_ids = implode($page_ids, ":");
2266 
2267  if ($a_redirect)
2268  {
2269  if ($_GET["obj_id"] != "")
2270  {
2271  $this->jumpToNode($node_id, $page_ids);
2272  }
2273  else
2274  {
2275  $ilCtrl->setParameter($this, "highlight", $page_ids);
2276  $ilCtrl->redirect($this, "showOrganization", "node_".$node_id);
2277  }
2278  }
2279  }
2280 
2284  function expandAll($a_redirect = true)
2285  {
2286  $_GET["scexpand"] = "";
2287  $mtree = $this->object->getTree();
2288  $n_id = ($_GET["obj_id"] > 0)
2289  ? $_GET["obj_id"]
2290  : $mtree->readRootId();
2291  $stree = $mtree->getSubTree($mtree->getNodeData($n_id));
2292  $n_arr = array();
2293  foreach ($stree as $n)
2294  {
2295  $n_arr[] = $n["child"];
2296  $_SESSION["scexpand"] = $n_arr;
2297  }
2298  $this->saveAllTitles($a_redirect);
2299  }
2300 
2304  function collapseAll($a_redirect = true)
2305  {
2306  $_GET["scexpand"] = "";
2307  $mtree = $this->object->getTree();
2308  $n_id = ($_GET["obj_id"] > 0)
2309  ? $_GET["obj_id"]
2310  : $mtree->readRootId();
2311  $stree = $mtree->getSubTree($mtree->getNodeData($n_id));
2312  $old = $_SESSION["scexpand"];
2313  foreach ($stree as $n)
2314  {
2315  if (in_array($n["child"], $old) && $n["child"] != $n_id)
2316  {
2317  $k = array_search($n["child"], $old);
2318  unset($old[$k]);
2319  }
2320  }
2321  $_SESSION["scexpand"] = $old;
2322  $this->saveAllTitles($a_redirect);
2323  }
2324 
2328  function saveAllTitles($a_redirect = true)
2329  {
2330  global $ilCtrl;
2331 
2332  if (is_array($_POST["title"]))
2333  {
2334  include_once("./Services/MetaData/classes/class.ilMD.php");
2335  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004NodeFactory.php");
2336  foreach($_POST["title"] as $id => $title)
2337  {
2338  $node_obj = ilSCORM2004NodeFactory::getInstance($this->object, $id, false);
2339  if (is_object($node_obj))
2340  {
2341  // Update Title and description
2342  $md = new ilMD($this->object->getId(), $id, $node_obj->getType());
2343  $md_gen = $md->getGeneral();
2344  $md_gen->setTitle(ilUtil::stripSlashes($title));
2345  $md_gen->update();
2346  $md->update();
2348  }
2349  }
2350  }
2351  if ($a_redirect)
2352  {
2353  $ilCtrl->redirect($this, "showOrganization");
2354  }
2355  }
2356 
2362  function deleteNodes($a_form_action = "")
2363  {
2364  global $lng, $tpl;
2365 
2366  if(!isset($_POST["id"]))
2367  {
2368  $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
2369  }
2370 
2371  // SAVE POST VALUES
2372  $_SESSION["saved_post"] = $_POST["id"];
2373 
2374  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
2375  $confirmation_gui = new ilConfirmationGUI();
2376 
2377  if ($a_form_action == "")
2378  {
2379  $cmd = ($_GET["backcmd"] == "")
2380  ? "showOrganization"
2381  : $_GET["backcmd"];
2382  $this->ctrl->setParameter($this, "backcmd", $cmd);
2383  $a_form_action = $this->ctrl->getFormAction($this);
2384  }
2385  $confirmation_gui->setFormAction($a_form_action);
2386  $confirmation_gui->setHeaderText($this->lng->txt("info_delete_sure"));
2387 
2388  // Add items to delete
2389  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004NodeFactory.php");
2390  foreach($_POST["id"] as $id)
2391  {
2392  if ($id != IL_FIRST_NODE)
2393  {
2394  $node_obj = ilSCORM2004NodeFactory::getInstance($this->object, $id, false);
2395  $confirmation_gui->addItem("id[]", $node_obj->getId(),
2396  $node_obj->getTitle(), ilUtil::getImagePath("icon_".$node_obj->getType().".svg"));
2397  }
2398  }
2399 
2400  $confirmation_gui->setCancel($lng->txt("cancel"), "cancelDelete");
2401  $confirmation_gui->setConfirm($lng->txt("confirm"), "confirmedDelete");
2402 
2403  $tpl->setContent($confirmation_gui->getHTML());
2404  }
2405 
2409  function cancelDelete()
2410  {
2411  $this->ctrl->redirect($this, $_GET["backcmd"]);
2412  }
2413 
2417  function confirmedDelete($a_redirect = true)
2418  {
2419  global $ilCtrl;
2420 
2421  $tree = new ilTree($this->object->getId());
2422  $tree->setTableNames('sahs_sc13_tree','sahs_sc13_tree_node');
2423  $tree->setTreeTablePK("slm_id");
2424 
2425  // delete all selected objects
2426  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004NodeFactory.php");
2427  foreach ($_POST["id"] as $id)
2428  {
2429  if ($id != IL_FIRST_NODE)
2430  {
2431  $obj = ilSCORM2004NodeFactory::getInstance($this->object, $id, false);
2432  $node_data = $tree->getNodeData($id);
2433  if (is_object($obj))
2434  {
2435  $obj->setSLMId($this->object->getId());
2436 
2437  /*include_once("./Services/History/classes/class.ilHistory.php");
2438  ilHistory::_createEntry($this->object->getId(), "delete_".$obj->getType(),
2439  array(ilLMObject::_lookupTitle($id), $id),
2440  $this->object->getType());*/
2441 
2442  $obj->delete();
2443  }
2444  if($tree->isInTree($id))
2445  {
2446  $tree->deleteTree($node_data);
2447  }
2448  }
2449  }
2450 
2451  // check the tree
2452  // $this->object->checkTree();
2453 
2454  // feedback
2455  ilUtil::sendInfo($this->lng->txt("info_deleted"),true);
2456 
2457  if ($a_redirect)
2458  {
2459  $ilCtrl->redirect($this, "showOrganization");
2460  }
2461  }
2462 
2466  function proceedDragDrop()
2467  {
2468  global $ilCtrl;
2469 
2470  $this->object->executeDragDrop($_POST["il_hform_source_id"], $_POST["il_hform_target_id"],
2471  $_POST["il_hform_fc"], $_POST["il_hform_as_subitem"]);
2472  $ilCtrl->redirect($this, "showOrganization");
2473  }
2474 
2478  function copyItems($a_return = "showOrganization")
2479  {
2480  global $ilCtrl, $lng;
2481 
2482  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2483 
2484  $items = ilUtil::stripSlashesArray($_POST["id"]);
2485  $todel = array(); // delete IDs < 0 (needed for non-js editing)
2486  foreach($items as $k => $item)
2487  {
2488  if ($item < 0)
2489  {
2490  $todel[] = $k;
2491  }
2492  }
2493  foreach($todel as $k)
2494  {
2495  unset($items[$k]);
2496  }
2497  if (!ilSCORM2004Node::uniqueTypesCheck($items))
2498  {
2499  ilUtil::sendFailure($lng->txt("sahs_choose_pages_chap_scos_ass_only"), true);
2500  $ilCtrl->redirect($this, $a_return);
2501  }
2502  ilSCORM2004Node::clipboardCopy($this->object->getId(), $items);
2503 
2504  // @todo: move this to a service since it can be used here, too
2505  include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
2507  ilUtil::sendInfo($lng->txt("cont_selected_items_have_been_copied"), true);
2508 
2509  $ilCtrl->redirect($this, $a_return);
2510  }
2511 
2515  function cutItems($a_return = "showOrganization")
2516  {
2517  global $ilCtrl, $lng;
2518 
2519  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2520 
2521  $items = ilUtil::stripSlashesArray($_POST["id"]);
2522  $todel = array(); // delete IDs < 0 (needed for non-js editing)
2523  foreach($items as $k => $item)
2524  {
2525  if ($item < 0)
2526  {
2527  $todel[] = $k;
2528  }
2529  }
2530  foreach($todel as $k)
2531  {
2532  unset($items[$k]);
2533  }
2534 
2535  if (!ilSCORM2004Node::uniqueTypesCheck($items))
2536  {
2537  ilUtil::sendFailure($lng->txt("sahs_choose_pages_chap_scos_ass_only"), true);
2538  $ilCtrl->redirect($this, $a_return);
2539  }
2540 
2541  ilSCORM2004Node::clipboardCut($this->object->getId(), $items);
2542 
2543  include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
2545 
2546  ilUtil::sendInfo($lng->txt("cont_selected_items_have_been_cut"), true);
2547 
2548  $ilCtrl->redirect($this, $a_return);
2549  }
2550 
2554  function insertPageClip()
2555  {
2556  global $ilCtrl, $ilUser;
2557 
2558  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2559  ilSCORM2004Node::insertPageClip($this->object);
2560 
2561  $ilCtrl->redirect($this, "showOrganization",
2563  }
2564 
2568  function insertScoClip()
2569  {
2570  global $ilCtrl, $ilUser;
2571 
2572  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2573  ilSCORM2004Node::insertScoClip($this->object);
2574 
2575  $ilCtrl->redirect($this, "showOrganization",
2577  }
2578 
2582  function insertAssetClip()
2583  {
2584  global $ilCtrl, $ilUser;
2585 
2586  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2587  ilSCORM2004Node::insertAssetClip($this->object);
2588 
2589  $ilCtrl->redirect($this, "showOrganization",
2591  }
2592 
2597  {
2598  global $ilCtrl, $ilUser;
2599 
2600  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2601  ilSCORM2004Node::insertChapterClip($this->object);
2602 
2603  $ilCtrl->redirect($this, "showOrganization",
2605  }
2606 
2607 
2609  {
2610  $export = new ilScorm2004Export($this->object,'SCORM 2004 4th');
2611  $export->buildExportFile();
2612  ilUtil::sendSuccess($this->lng->txt("exp_file_created"), true);
2613  $this->ctrl->redirect($this, "showExportList");
2614  }
2615 
2617  {
2618  $export = new ilScorm2004Export($this->object,'SCORM 2004 3rd');
2619  $export->buildExportFile();
2620  ilUtil::sendSuccess($this->lng->txt("exp_file_created"), true);
2621  $this->ctrl->redirect($this, "showExportList");
2622  }
2623 
2624  function exportScorm12()
2625  {
2626  $export = new ilScorm2004Export($this->object,'SCORM 1.2');
2627  $export->buildExportFile();
2628  ilUtil::sendSuccess($this->lng->txt("exp_file_created"), true);
2629  $this->ctrl->redirect($this, "showExportList");
2630  }
2631 
2632  function exportHTML()
2633  {
2634  $export = new ilScorm2004Export($this->object,'HTML');
2635  $export->buildExportFile();
2636  ilUtil::sendSuccess($this->lng->txt("exp_file_created"), true);
2637  $this->ctrl->redirect($this, "showExportList");
2638  }
2639 
2640  function exportHTMLOne()
2641  {
2642  $export = new ilScorm2004Export($this->object,'HTMLOne');
2643  $export->buildExportFile();
2644  ilUtil::sendSuccess($this->lng->txt("exp_file_created"), true);
2645  $this->ctrl->redirect($this, "showExportList");
2646  }
2647 
2648  function exportISO()
2649  {
2650  $export = new ilScorm2004Export($this->object,'ISO');
2651  if(!$export->buildExportFile())
2652  {
2653  if(!PATH_TO_MKISOFS)
2654  $this->ilias->raiseError($this->lng->txt("no_mkisofs_configured"),$this->ilias->error_obj->MESSAGE);
2655  }
2656  $this->ctrl->redirect($this, "showExportList");
2657  }
2658 
2659  function exportPDF()
2660  {
2661  $export = new ilScorm2004Export($this->object,'PDF');
2662  $export->buildExportFile();
2663  $this->ctrl->redirect($this, "showExportList");
2664  }
2665 
2667  {
2668  $export = new ilSCORM2004Export($this->object);
2669 
2670  $export_dir = $export->getExportDirectoryForType($_GET['type']);
2671  ilUtil::deliverFile($export_dir."/".$_GET['file'], $_GET['file']);
2672  }
2673 
2678  {
2679  if(!isset($_POST["file"]))
2680  {
2681  ilUtil::sendInfo($this->lng->txt("no_checkbox"),true);
2682  $this->ctrl->redirect($this, "showExportList");
2683  }
2684 
2685  ilUtil::sendQuestion($this->lng->txt("info_delete_sure"));
2686  $export_files = $this->object->getExportFiles();
2687 
2688  include_once "./Modules/Scorm2004/classes/class.ilSCORM2004ExportTableGUI.php";
2689  $table_gui = new ilSCORM2004ExportTableGUI($this, 'showExportList', true);
2690  $data = array();
2691  foreach ($export_files as $exp_file)
2692  {
2693  foreach ($_POST['file'] as $delete_file)
2694  {
2695  if (strcmp($delete_file, $exp_file['file']) == 0)
2696  {
2697  $public_str = ($exp_file["file"] == $this->object->getPublicExportFile($exp_file["type"]))
2698  ? " <b>(".$this->lng->txt("public").")<b>"
2699  : "";
2700  $file_arr = explode("__", $exp_file["file"]);
2701  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));
2702  }
2703  }
2704  }
2705  $table_gui->setData($data);
2706  $this->tpl->setVariable('ADM_CONTENT', $table_gui->getHTML());
2707  }
2708 
2713  {
2714  ilSession::clear("ilExportFiles");
2715  $this->ctrl->redirect($this, "showExportList");
2716  }
2717 
2718 
2722  function deleteExportFile()
2723  {
2724  include_once "./Services/Utilities/classes/class.ilUtil.php";
2725  $export = new ilSCORM2004Export($this->object);
2726  foreach($_POST['file'] as $idx => $file)
2727  {
2728  $export_dir = $export->getExportDirectoryForType($_POST['type'][$idx]);
2729  $exp_file = $export_dir."/".$file;
2730  if (@is_file($exp_file))
2731  {
2732  unlink($exp_file);
2733  }
2734  }
2735  ilUtil::sendSuccess($this->lng->txt('msg_deleted_export_files'), true);
2736  $this->ctrl->redirect($this, "showExportList");
2737  }
2738 
2739  /*
2740  * download export file
2741  */
2743  {
2744  if(!isset($_POST["file"]))
2745  {
2746  $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
2747  }
2748  if (count($_POST["file"]) > 1)
2749  {
2750  $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
2751  }
2752 
2753  $export = new ilSCORM2004Export($this->object);
2754  $file = $_POST['file'][0];
2755  $type = $_POST['type'][$_POST['file'][0]];
2756 
2757  if ($this->object->getPublicExportFile($type) == $file)
2758  {
2759  $this->object->setPublicExportFile($type, "");
2760  }
2761  else
2762  {
2763  $this->object->setPublicExportFile($type, $file);
2764  }
2765  $this->object->update();
2766  $this->ctrl->redirect($this, "showExportList");
2767  }
2768 
2769  /*
2770  * perform silent scorm 2004 export and import for view player
2771  */
2772  function preview()
2773  {
2774  global $ilias;
2775 
2776  $export = new ilScorm2004Export($this->object,'SCORM 2004 3rd');
2777  $zipfile = $export->buildExportFile();
2778  $zipPathinfo = pathinfo($zipfile);
2779  $file_path = $this->object->getDataDirectory()."/".($zipPathinfo["basename"]);
2780  copy($zipfile,$file_path);
2781  unlink($zipfile);
2782 
2783  ilUtil::unzip($file_path,true);
2784  ilUtil::renameExecutables($this->object->getDataDirectory());
2785  unlink($file_path);
2786 
2787  include_once ("./Modules/Scorm2004/classes/ilSCORM13Package.php");
2788  $rte_pkg = new ilSCORM13Package();
2789  $rte_pkg->il_import($this->object->getDataDirectory(),$this->object->getId(),$ilias,false,true);
2790 
2791  //increase module version is it necessary?
2792  //$this->object->setModuleVersion($module_version+1);
2793  //$this->object->update();
2794 
2795  //redirect to view player
2796  ilUtil::redirect("ilias.php?baseClass=ilSAHSPresentationGUI&ref_id=".$this->object->getRefID()."&envEditor=1");
2797  }
2798 
2799 
2800 }
2801 ?>
cancelDeleteExportFile()
cancel deletion of export files
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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
Class ilSCORM2004PageNode.
static getPostMulti()
Get multi number of _POST input.
print $file
Class ilObjSCORMLearningModuleGUI.
$rest
Definition: goto.php:85
insertTemplate($a_redirect=true)
Insert (multiple) pages at node.
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
put this object into content object tree
exit
Definition: login.php:54
Class ilSCORM2004Sco.
$_POST['username']
Definition: cron.php:12
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.
insertChapter($a_redirect=true)
Insert (multiple) chapters at node.
This class represents a selection list property in a property form.
This class represents a property form user interface.
initPropertiesEditableForm()
Init properties (editable) form.
saveProperties()
save scorm 2004 module properties
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_no_raise=false, $a_force_raise=false)
Update status.
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.
copyItems($a_return="showOrganization")
Copy items to clipboard.
saveAllTitles($a_redirect=true)
Save all titles of chapters/scos/pages.
setSubTabs($a_main_tab, $a_active)
Set sub tabs.
Nested List.
removeCMIDataForUserAndPackage($user_id, $packageId)
$cmd
Definition: sahs_server.php:35
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
ilObjectGUI($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Constructor public.
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.
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.
frameset($a_to_organization=false)
output main frameset of media pool left frame: explorer tree of folders right frame: media pool conte...
insertChapterClip($a_slm_obj, $a_as_sub=false)
Insert Chapter from clipboard.
Notes GUI class.
global $ilCtrl
Definition: ilias.php:18
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) ...
Class ilSCORM2004TrackingItemsTableGUI.
if(!is_array($argv)) $options
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 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 _lookupType($a_obj_id)
Lookup Type.
ilObjSCORM2004LearningModuleGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
Constructor.
confirmDeleteExportFile()
confirmation screen for export file deletion
static _lookupObjId($a_id)
const IL_FIRST_NODE
Definition: class.ilTree.php:5
setValue($a_value)
Set Value.
special template class to simplify handling of ITX/PEAR
setTitle($a_title)
Set Title.
insertTemplateGUI($a_redirect=true, $a_special_page=false)
Displays GUI to select template for page.
This class represents a text property in a property form.
static formatDate(ilDateTime $date)
Format a date public.
_lookupSubType($a_obj_id)
lookup subtype id (scorm, aicc, hacp)
& getGeneral()
Definition: class.ilMD.php:55
Date and time handling
_getStandardStyles($a_exclude_default_style=false, $a_include_deactivated=false, $a_scope=0)
Get standard styles.
Class ilSCORM2004PageNodeGUI.
redirection script todo: (a better solution should control the processing via a xml file) ...
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.
setTableNames($a_table_tree, $a_table_obj_data, $a_table_obj_reference="")
set table names The primary key of the table containing your object_data must be &#39;obj_id&#39; You may use...
$n
Definition: RandomTest.php:80
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)
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
setOptions($a_options)
Set Options.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
editOrganization($a_to_organization=true)
Edit organization (called from listgui, must setup frameset)
static _lookupType($a_id, $a_reference=false)
lookup object type
setTreeTablePK($a_column_name)
set column containing primary key in tree table public
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
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.
Class ilSCORM2004Chapter.
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.
_lookupStandard($a_id)
Lookup standard flag.
setMaxLength($a_maxlength)
Set Max Length.
selectExport()
Select the export type of the SCORM 2004 module.
static getParticipantsForObject($a_ref_id)
Get participant ids for given object.
This class represents a non editable value in a property form.
clipboardCut($a_slm_obj_id, $a_ids)
Cut and copy a set of chapters/pages into the clipboard.
global $ilUser
Definition: imgupload.php:15
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
global $ilSetting
Definition: privfeed.php:40
Class ilObjSCORM2004LearningModule.
$path
Definition: index.php:22
This class represents a text area property in a property form.
Class ilSCORM2004Asset.
getTabs(&$tabs_gui)
Adds tabs to tab gui object.
Class ilSCORM2004ChapterGUI.
confirmedDelete($a_redirect=true)
Delete chapters/scos/pages.
assignObject()
assign scorm object to scorm gui object
This class allows quick editing of a chapter/sco/page hierarchy.
static initjQuery($a_tpl=null)
Init jQuery.
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.
setTabs()
output main frameset of media pool left frame: explorer tree of folders right frame: media pool conte...
static yn2tf($a_yn)
convert "y"/"n" to true/false
static _writeTitle($a_obj_id, $a_title)
Write Title.
static redirect($a_script)
http redirect to other script
addHeaderAction()
Add header action menu.
static insertAssetClip($a_slm_obj, $a_type="ass")
Insert assets from clipboard.
Class ilSCORM2004AssetGUI.
setRequired($a_required)
Set Required.
setLocator()
set Locator
Confirmation screen class.
Class ilFramesetGUI.
confirmExpertMode()
Confirm activation of expert mode.