ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
4require_once("./Modules/ScormAicc/classes/class.ilObjSCORMLearningModuleGUI.php");
5require_once("./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
6require_once("./Modules/Scorm2004/classes/class.ilSCORM2004Export.php");
7include_once("./Services/Style/classes/class.ilObjStyleSheetGUI.php");
8include_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 //check/select only once
365 $this->object->checkMasteryScoreValues();
366
367 //title
368 $ti = new ilTextInputGUI($this->lng->txt("title"), "Fobject_title");
369 $ti->setMaxLength(200);
370 $ti->setValue($this->object->getTitle());
371 $this->form->addItem($ti);
372
373 //description
374 $ti = new ilTextAreaInputGUI($this->lng->txt("description"), "Fobject_description");
375 $ti->setValue($this->object->getDescription());
376 $this->form->addItem($ti);
377
378 // SCORM-type
379 $ne = new ilNonEditableValueGUI($this->lng->txt("type"), "");
380 $ne->setValue($this->lng->txt( "lm_type_" . ilObjSAHSLearningModule::_lookupSubType( $this->object->getID() ) ) );
381 $this->form->addItem($ne);
382
383 // version
384 $ne = new ilNonEditableValueGUI($this->lng->txt("cont_sc_version"), "");
385 $ne->setValue($this->object->getModuleVersion());
386 $ne->setInfo($this->lng->txt("cont_sc_version_info"));
387 $this->form->addItem($ne);
388
389 //
390 // activation
391 //
392 $sh = new ilFormSectionHeaderGUI();
393 $sh->setTitle($this->lng->txt("activation"));
394 $this->form->addItem($sh);
395
396 // online
397 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_online"), "cobj_online");
398 $cb->setValue("y");
399 if ($this->object->getOnline())
400 {
401 $cb->setChecked(true);
402 }
403 $cb->setInfo($this->lng->txt("cont_online_info"));
404 $this->form->addItem($cb);
405
406 // offline Mode
407 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_offline_mode_allow"), "cobj_offline_mode");
408 $cb->setValue("y");
409 $cb->setChecked($this->object->getOfflineMode());
410 include_once("./Modules/ScormAicc/classes/class.ilSCORMOfflineMode.php");
411 if ($this->object->getOfflineMode()== true && ilSCORMOfflineMode::checkIfAnyoneIsInOfflineMode($this->object->getID()) == true) {
412 $cb->setDisabled(true);
413 $cb->setInfo($this->lng->txt("cont_offline_mode_disable_not_allowed_info"));
414 } else {
415 $cb->setInfo($this->lng->txt("cont_offline_mode_allow_info"));
416 }
417 $this->form->addItem($cb);
418
419 //
420 // presentation
421 //
422 $sh = new ilFormSectionHeaderGUI();
423 $sh->setTitle($this->lng->txt("cont_presentation"));
424 $this->form->addItem($sh);
425
426 // display mode (open)
427 // $options = array(
428 // "0" => $this->lng->txt("cont_open_normal"),
429 // "1" => $this->lng->txt("cont_open_iframe_max"),
430 // "2" => $this->lng->txt("cont_open_iframe_defined"),
431 // "5" => $this->lng->txt("cont_open_window_undefined"),
432 // "6" => $this->lng->txt("cont_open_window_defined")
433 // );
434 // $si = new ilSelectInputGUI($this->lng->txt("cont_open"), "open_mode");
435 // $si->setOptions($options);
436 // $si->setValue($this->object->getOpenMode());
437 // $this->form->addItem($si);
438
439 $radg = new ilRadioGroupInputGUI($lng->txt("cont_open"), "open_mode");
440 $op0 = new ilRadioOption($this->lng->txt("cont_open_normal"), "0");
441 $radg->addOption($op0);
442 $op1 = new ilRadioOption($this->lng->txt("cont_open_iframe"), "1");
443 $radg->addOption($op1);
444 $op2 = new ilRadioOption($this->lng->txt("cont_open_window"), "5");
445 $radg->addOption($op2);
446 $radg->setValue($this->object->getOpenMode()); //ACHTUNG: DATENBANK
447 // width
448 $ni = new ilNumberInputGUI($this->lng->txt("cont_width"), "width_0");
449 $ni->setMaxLength(4);
450 $ni->setSize(4);
451 $ni->setValue($this->object->getWidth());
452 $op1->addSubItem($ni);
453 $ni = new ilNumberInputGUI($this->lng->txt("cont_width"), "width_1");
454 $ni->setMaxLength(4);
455 $ni->setSize(4);
456 $ni->setValue($this->object->getWidth());
457 $op2->addSubItem($ni);
458 // height
459 $ni = new ilNumberInputGUI($this->lng->txt("cont_height"), "height_0");
460 $ni->setMaxLength(4);
461 $ni->setSize(4);
462 $ni->setValue($this->object->getHeight());
463 $ni->setInfo($this->lng->txt("cont_width_height_info"));
464 $op1->addSubItem($ni);
465 $ni = new ilNumberInputGUI($this->lng->txt("cont_height"), "height_1");
466 $ni->setMaxLength(4);
467 $ni->setSize(4);
468 $ni->setValue($this->object->getHeight());
469 $ni->setInfo($this->lng->txt("cont_width_height_info"));
470 $op2->addSubItem($ni);
471
472 // set IE compatibility mode
473 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_ie_compatibility"), "cobj_ie_compatibility_0");
474 $cb->setValue("y");
475 $cb->setChecked($this->object->getIe_compatibility());
476 $cb->setInfo($this->lng->txt("cont_ie_compatibility_info"));
477 $op0->addSubItem($cb);
478 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_ie_compatibility"), "cobj_ie_compatibility_1");
479 $cb->setValue("y");
480 $cb->setChecked($this->object->getIe_compatibility());
481 $cb->setInfo($this->lng->txt("cont_ie_compatibility_info"));
482 $op2->addSubItem($cb);
483
484 // force IE to render again
485 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_ie_force_render"), "cobj_ie_force_render");
486 $cb->setValue("y");
487 $cb->setChecked($this->object->getIe_force_render());
488 $cb->setInfo($this->lng->txt("cont_ie_force_render_info"));
489 $op2->addSubItem($cb);
490
491 $this->form->addItem($radg);
492
493
494 // disable top menu
495 //Hide Top Navigation Bar
496 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_nomenu"), "cobj_nomenu");
497 $cb->setValue("y");
498 $cb->setChecked($this->object->getNoMenu());
499 $cb->setInfo($this->lng->txt("cont_nomenu_info"));
500 $this->form->addItem($cb);
501
502 // disable left-side navigation
503 // Hide Left Navigation Tree
504 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_hidenavig"), "cobj_hidenavig");
505 $cb->setValue("y");
506 $cb->setChecked($this->object->getHideNavig());
507 $cb->setInfo($this->lng->txt("cont_hidenavig_info"));
508 $this->form->addItem($cb);
509
510 // auto navigation to last visited item
511 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_auto_last_visited"), "cobj_auto_last_visited");
512 $cb->setValue("y");
513 $cb->setChecked($this->object->getAuto_last_visited());
514 $cb->setInfo($this->lng->txt("cont_auto_last_visited_info"));
515 $this->form->addItem($cb);
516
517
518 //
519 // scorm options
520 //
521 $sh = new ilFormSectionHeaderGUI();
522 $sh->setTitle($this->lng->txt("cont_scorm_options"));
523 $this->form->addItem($sh);
524
525 // max attempts
526 //ACHTUNG: DATENBANK KORRIGIEREN
527 // $ni = new ilNumberInputGUI($this->lng->txt("cont_sc_max_attempt"), "max_attempt");
528 // $ni->setMaxLength(3);
529 // $ni->setSize(3);
530 // $ni->setValue($this->object->getMaxAttempt());
531 // $this->form->addItem($ni);
532
533 // lesson mode
534 $options = array("normal" => $this->lng->txt("cont_sc_less_mode_normal"),
535 "browse" => $this->lng->txt("cont_sc_less_mode_browse"));
536 $si = new ilSelectInputGUI($this->lng->txt("cont_def_lesson_mode"), "lesson_mode");
537 $si->setOptions($options);
538 $si->setValue($this->object->getDefaultLessonMode());
539 $this->form->addItem($si);
540
541 // credit mode
542 $options = array("credit" => $this->lng->txt("cont_credit_on"),
543 "no_credit" => $this->lng->txt("cont_credit_off"));
544 $si = new ilSelectInputGUI($this->lng->txt("cont_credit_mode"), "credit_mode");
545 $si->setOptions($options);
546 $si->setValue($this->object->getCreditMode());
547 $si->setInfo($this->lng->txt("cont_credit_mode_info"));
548 $this->form->addItem($si);
549
550 // set lesson mode review when completed
551 $options = array(
552 "n" => $this->lng->txt("cont_sc_auto_review_no"),
553 "r" => $this->lng->txt("cont_sc_auto_review_completed_not_failed_or_passed"),
554 "p" => $this->lng->txt("cont_sc_auto_review_passed"),
555 "q" => $this->lng->txt("cont_sc_auto_review_passed_or_failed"),
556 "c" => $this->lng->txt("cont_sc_auto_review_completed"),
557 "d" => $this->lng->txt("cont_sc_auto_review_completed_and_passed"),
558 "y" => $this->lng->txt("cont_sc_auto_review_completed_or_passed"),
559 "s" => $this->lng->txt("cont_sc_store_if_previous_score_was_lower")
560 );
561 $si = new ilSelectInputGUI($this->lng->txt("cont_sc_auto_review_2004"), "auto_review");
562 $si->setOptions($options);
563 $si->setValue($this->object->getAutoReviewChar());
564 $si->setInfo($this->lng->txt("cont_sc_auto_review_info_2004"));
565 $this->form->addItem($si);
566
567 // mastery_score
568 if ($this->object->getMasteryScoreValues() != "") {
569 $ni = new ilNumberInputGUI($this->lng->txt("cont_mastery_score_2004"), "mastery_score");
570 $ni->setMaxLength(3);
571 $ni->setSize(3);
572 $ni->setValue($this->object->getMasteryScore());
573 $ni->setInfo($this->lng->txt("cont_mastery_score_2004_info").$this->object->getMasteryScoreValues());
574 $this->form->addItem($ni);
575 }
576
577 //
578 // rte settings
579 //
580 $sh = new ilFormSectionHeaderGUI();
581 $sh->setTitle($this->lng->txt("cont_rte_settings"));
582 $this->form->addItem($sh);
583
584 // unlimited session timeout
585 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_sc_usession"), "cobj_session");
586 $cb->setValue("y");
587 $cb->setChecked($this->object->getSession());
588 $cb->setInfo($this->lng->txt("cont_sc_usession_info"));
589 $this->form->addItem($cb);
590
591 // SCORM 2004 fourth edition features
592 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_fourth_edition"), "cobj_fourth_edition");
593 $cb->setValue("y");
594 $cb->setChecked($this->object->getFourth_edition());
595 $cb->setInfo($this->lng->txt("cont_fourth_edition_info"));
596 $this->form->addItem($cb);
597
598 // sequencing
599 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_sequencing"), "cobj_sequencing");
600 $cb->setValue("y");
601 $cb->setChecked($this->object->getSequencing());
602 $cb->setInfo($this->lng->txt("cont_sequencing_info"));
603 $this->form->addItem($cb);
604
605 // storage of interactions
606 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_interactions"), "cobj_interactions");
607 $cb->setValue("y");
608 $cb->setChecked($this->object->getInteractions());
609 $cb->setInfo($this->lng->txt("cont_interactions_info"));
610 $this->form->addItem($cb);
611
612 // objectives
613 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_objectives"), "cobj_objectives");
614 $cb->setValue("y");
615 $cb->setChecked($this->object->getObjectives());
616 $cb->setInfo($this->lng->txt("cont_objectives_info"));
617 $this->form->addItem($cb);
618
619 // comments
620 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_comments"), "cobj_comments");
621 $cb->setValue("y");
622 $cb->setChecked($this->object->getComments());
623 $cb->setInfo($this->lng->txt("cont_comments_info"));
624 $this->form->addItem($cb);
625
626 // time from lms
627 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_time_from_lms"), "cobj_time_from_lms");
628 $cb->setValue("y");
629 $cb->setChecked($this->object->getTime_from_lms());
630 $cb->setInfo($this->lng->txt("cont_time_from_lms_info"));
631 $this->form->addItem($cb);
632
633 // check values
634 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_check_values"), "cobj_check_values");
635 $cb->setValue("y");
636 $cb->setChecked($this->object->getCheck_values());
637 $cb->setInfo($this->lng->txt("cont_check_values_info"));
638 $this->form->addItem($cb);
639
640 // auto cmi.exit to suspend
641 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_auto_suspend"), "cobj_auto_suspend");
642 $cb->setValue("y");
643 $cb->setChecked($this->object->getAutoSuspend());
644 $cb->setInfo($this->lng->txt("cont_auto_suspend_info"));
645 $this->form->addItem($cb);
646
647 //
648 // debugging
649 //
650 $sh = new ilFormSectionHeaderGUI();
651 $sh->setTitle($this->lng->txt("cont_debugging"));
652 $this->form->addItem($sh);
653
654 // test tool
655 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_debug"), "cobj_debug");
656 $cb->setValue("y");
657 $cb->setChecked($this->object->getDebug());
658 if ($this->object->getDebugActivated() == false)
659 {
660 $cb->setDisabled(true);
661 $cb->setInfo($this->lng->txt("cont_debug_deactivated"));
662 }
663 else
664 {
665 $cb->setInfo($this->lng->txt("cont_debug_deactivate"));
666 }
667 $this->form->addItem($cb);
668 $this->form->addCommandButton("saveProperties", $lng->txt("save"));
669 }
670
671
676 {
677 global $lng, $ilCtrl, $tree, $rbacsystem, $ilSetting;
678
679 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
680 $this->form = new ilPropertyFormGUI();
681
682 // localization
683 $options = array(
684 "" => $lng->txt("please_select"),
685 );
686 $langs = $lng->getInstalledLanguages();
687 $lng->loadLanguageModule("meta");
688 foreach ($langs as $l)
689 {
690 $options[$l] = $lng->txt("meta_l_".$l);
691 }
692 $loc = new ilSelectInputGUI($this->lng->txt("cont_localization"), "localization");
693 $loc->setOptions($options);
694 $loc->setInfo($this->lng->txt("cont_localization_info"));
695 $this->form->addItem($loc);
696
697 // glossary
698 $ne = new ilNonEditableValueGUI($lng->txt("obj_glo"), "glossary");
699 $this->form->addItem($ne);
700
701 // style
702 $lng->loadLanguageModule("style");
703 $fixed_style = $ilSetting->get("fixed_content_style_id");
704 $style_id = $this->object->getStyleSheetId();
705
706 if ($fixed_style > 0)
707 {
708 $st = new ilNonEditableValueGUI($lng->txt("cont_current_style"));
709 $st->setValue(ilObject::_lookupTitle($fixed_style)." (".
710 $this->lng->txt("global_fixed").")");
711 $this->form->addItem($st);
712 }
713 else
714 {
715 $st_styles = ilObjStyleSheet::_getStandardStyles(true, false,
716 $_GET["ref_id"]);
717
718 $st_styles[0] = $this->lng->txt("default");
719 ksort($st_styles);
720
721 if ($style_id > 0)
722 {
723 // individual style
724 if (!ilObjStyleSheet::_lookupStandard($style_id))
725 {
726 $st = new ilNonEditableValueGUI($lng->txt("cont_current_style"));
727 $st->setValue(ilObject::_lookupTitle($style_id));
728 $this->form->addItem($st);
729 }
730 }
731
732 if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id))
733 {
734 $style_sel = ilUtil::formSelect ($style_id, "style_id",
735 $st_styles, false, true);
736 $style_sel = new ilSelectInputGUI($lng->txt("cont_current_style"), "style_id");
737 $style_sel->setOptions($st_styles);
738 $style_sel->setValue($style_id);
739 $this->form->addItem($style_sel);
740 }
741 }
742
743 // number of tries
744 $ni = new ilNumberInputGUI($lng->txt("cont_qtries"), "q_tries");
745 $ni->setInfo($lng->txt("cont_qtries_info")); // #15133
746 $ni->setMaxLength(3);
747 $ni->setSize(3);
748 $this->form->addItem($ni);
749
750
751 $this->form->addCommandButton("saveProperties", $lng->txt("save"));
752
753 $this->form->setTitle($lng->txt("cont_scorm_ed_properties"));
754 $this->form->setFormAction($ilCtrl->getFormAction($this));
755 }
756
761 {
762 $values = array();
763
764 if (ilObject::_lookupType($this->object->getAssignedGlossary()) == "glo")
765 {
766 $values["glossary"] = ilObject::_lookupTitle($this->object->getAssignedGlossary());
767 }
768 else
769 {
770 $values["glossary"] = $this->lng->txt("cont_no_glossary");
771 }
772 $values["q_tries"] = $this->object->getTries();
773 $values["localization"] = $this->object->getLocalization();
774 $values["style_id"] = $this->object->getStyleSheetId();
775
776 $this->form->setValuesByArray($values);
777 }
778
782 function saveProperties()
783 {
784 global $ilSetting;
785
786 if ($this->object->editable != 1)
787 {
788 //check if OfflineMode-Zip has to be created
789 $tmpOfflineMode= ilUtil::yn2tf($_POST["cobj_offline_mode"]);
790 $tmpFourth_edition = ilUtil::yn2tf($_POST["cobj_fourth_edition"]);
791 $tmpSequencing = ilUtil::yn2tf($_POST["cobj_sequencing"]);
792 if ($tmpOfflineMode == true) {
793// $tmpSequencing = false; //actually no sequencing for offline_mode
794 $tmpFourth_edition = false; //4th edition is not possible
795 if ($this->object->getOfflineMode() == false) {
796 $this->object->zipLmForOfflineMode();
797 }
798 }
799
800 if (isset($_POST["mastery_score"])){
801 $this->object->setMasteryScore($_POST["mastery_score"]);
802 // $this->object->updateMasteryScoreValues();
803 }
804
805 $t_auto_review = $_POST["auto_review"];
806 $t_auto_suspend = ilUtil::yn2tf($_POST["cobj_auto_suspend"]);
807 $t_session = ilUtil::yn2tf($_POST["cobj_session"]);
808 if ($t_auto_review == "s") {
809 $t_auto_suspend = true;
810 //if not storing without session
811 $t_session = true;
812 }
813
814 $t1_ie_compatibility = false;
815 if (ilUtil::yn2tf($_POST["cobj_ie_compatibility_0"]) != $this->object->getIe_compatibility()) $t_ie_compatibility = ilUtil::yn2tf($_POST["cobj_ie_compatibility_0"]);
816 if (ilUtil::yn2tf($_POST["cobj_ie_compatibility_1"]) != $this->object->getIe_compatibility()) $t_ie_compatibility = ilUtil::yn2tf($_POST["cobj_ie_compatibility_1"]);
817
818 $t_height = $this->object->getHeight();
819 if ($_POST["height_0"] != $this->object->getHeight()) $t_height = $_POST["height_0"];
820 if ($_POST["height_1"] != $this->object->getHeight()) $t_height = $_POST["height_1"];
821
822 $t_width = $this->object->getWidth();
823 if ($_POST["width_0"] != $this->object->getWidth()) $t_width = $_POST["width_0"];
824 if ($_POST["width_1"] != $this->object->getWidth()) $t_width = $_POST["width_1"];
825
826 $this->object->setOnline(ilUtil::yn2tf($_POST["cobj_online"]));
827 $this->object->setOpenMode($_POST["open_mode"]);
828 $this->object->setWidth($t_width);
829 $this->object->setHeight($t_height);
830 $this->object->setCreditMode($_POST["credit_mode"]);
831 $this->object->setMaxAttempt($_POST["max_attempt"]);
832 $this->object->setAutoReviewChar($t_auto_review);
833 $this->object->setDefaultLessonMode($_POST["lesson_mode"]);
834 $this->object->setSession($t_session);
835 $this->object->setNoMenu(ilUtil::yn2tf($_POST["cobj_nomenu"]));
836 $this->object->setHideNavig(ilUtil::yn2tf($_POST["cobj_hidenavig"]));
837 $this->object->setAuto_last_visited(ilUtil::yn2tf($_POST["cobj_auto_last_visited"]));
838 $this->object->setIe_compatibility($t_ie_compatibility);
839 $this->object->setIe_force_render(ilUtil::yn2tf($_POST["cobj_ie_force_render"]));
840 $this->object->setFourth_edition($tmpFourth_edition);
841 $this->object->setSequencing($tmpSequencing);
842 $this->object->setInteractions(ilUtil::yn2tf($_POST["cobj_interactions"]));
843 $this->object->setObjectives(ilUtil::yn2tf($_POST["cobj_objectives"]));
844 $this->object->setComments(ilUtil::yn2tf($_POST["cobj_comments"]));
845 $this->object->setTime_from_lms(ilUtil::yn2tf($_POST["cobj_time_from_lms"]));
846 $this->object->setCheck_values(ilUtil::yn2tf($_POST["cobj_check_values"]));
847 $this->object->setAutoSuspend($t_auto_suspend);
848 $this->object->setOfflineMode($tmpOfflineMode);
849 $this->object->setDebug(ilUtil::yn2tf($_POST["cobj_debug"]));
850 //$this->object->setDebugPw($_POST["debug_pw"]);
851
852 $this->object->setTitle($_POST["Fobject_title"]);
853 $this->object->setDescription($_POST["Fobject_description"]);
854
855 }
856 else
857 {
859 if ($this->form->checkInput())
860 {
861 $this->object->setTries($_POST["q_tries"]);
862 $this->object->setLocalization($_POST["localization"]);
863
864 if ($ilSetting->get("fixed_content_style_id") <= 0 &&
865 (ilObjStyleSheet::_lookupStandard($this->object->getStyleSheetId())
866 || $this->object->getStyleSheetId() == 0))
867 {
868 $this->object->setStyleSheetId(ilUtil::stripSlashes($_POST["style_id"]));
869 }
870 }
871 }
872 $this->object->update();
873 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
874 $this->ctrl->redirect($this, "properties");
875 }
876
880 function detachGlossary()
881 {
882 global $ilCtrl;
883
884 $this->object->setAssignedGlossary(0);
885 $this->object->update();
886 $ilCtrl->redirect($this, "properties");
887 }
888
892 function createGlossary()
893 {
894 global $tpl;
895
897 $tpl->setContent($this->form->getHTML());
898 }
899
903 public function initGlossaryCreationForm()
904 {
905 global $lng, $ilCtrl;
906
907 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
908 $this->form = new ilPropertyFormGUI();
909
910 // title
911 $ti = new ilTextInputGUI($lng->txt("title"), "title");
912 $ti->setRequired(true);
913 $this->form->addItem($ti);
914
915 // description
916 $ta = new ilTextAreaInputGUI($lng->txt("desc"), "description");
917 $this->form->addItem($ta);
918
919 $this->form->addCommandButton("saveGlossary", $lng->txt("save"));
920 $this->form->addCommandButton("properties", $lng->txt("cancel"));
921
922 $this->form->setTitle($lng->txt("cont_glo_create"));
923 $this->form->setFormAction($ilCtrl->getFormAction($this));
924 }
925
929 public function saveGlossary()
930 {
931 global $tpl, $lng, $ilCtrl, $rbacsystem, $tree;
932
933 $parent_ref_id = $tree->getParentId((int) $_GET["ref_id"]);
934 if (!$rbacsystem->checkAccess("create", $parent_ref_id, "glo"))
935 {
936 ilUtil::sendFailure($lng->txt("no_permission"), true);
937 $ilCtrl->redirect($this, "properties");
938 }
939
941 if ($this->form->checkInput())
942 {
943 include_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
944 $newObj = new ilObjGlossary();
945 $newObj->setType("glo");
946 $newObj->setTitle($_POST["title"]);
947 $newObj->setDescription($_POST["description"]);
948 $newObj->setVirtualMode("none");
949 $newObj->create();
950 $newObj->createReference();
951 $newObj->putInTree($parent_ref_id);
952 $newObj->setPermissions($parent_ref_id);
953 $newObj->notify("new",$parent_ref_id,$_GET["parent_non_rbac_id"],$parent_ref_id,$newObj->getRefId());
954
955 // perform save
956 $this->object->setAssignedGlossary($newObj->getId());
957 $this->object->update();
958
959 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
960 $ilCtrl->redirect($this, "properties");
961 }
962
963 $this->form->setValuesByPost();
964 $tpl->setContent($this->form->getHtml());
965 }
966
970 function assignGlossary()
971 {
972 global $tpl, $ilCtrl, $tree;
973
974 include_once("./Modules/Scorm2004/classes/class.ilGlossarySelectorGUI.php");
975 $exp = new ilGlossarySelectorGUI(
976 $ilCtrl->getLinkTarget($this, "selectGlossary"), "ilobjscorm2004learningmodulegui");
977 $exp->setSelectableTypes(array("glo"));
978
979 if ($_GET["expand"] == "")
980 {
981 $expanded = $tree->readRootId();
982 }
983 else
984 {
985 $expanded = $_GET["expand"];
986 }
987 $exp->setExpand($expanded);
988
989 $exp->setTargetGet("glo_id");
990 //$this->ctrl->setParameter($this, "target_type", $a_type);
991 //$ilCtrl->setParameter($this, "subCmd", "insertFromRepository");
992 $exp->setParamsGet($this->ctrl->getParameterArray($this, "assignGlossary"));
993
994 // filter
995 $exp->setFiltered(true);
996 $exp->setFilterMode(IL_FM_POSITIVE);
997 $exp->addFilter("root");
998 $exp->addFilter("cat");
999 $exp->addFilter("grp");
1000 $exp->addFilter("fold");
1001 $exp->addFilter("crs");
1002 $exp->addFilter("glo");
1003
1004 $exp->setOutput(0);
1005
1006 $tpl->setContent($exp->getOutput());
1007 }
1008
1013 {
1014 global $ilCtrl;
1015
1016 $this->object->setAssignedGlossary(ilObject::_lookupObjId((int) $_GET["glo_ref_id"]));
1017 $this->object->update();
1018 $ilCtrl->redirect($this, "properties");
1019 }
1020
1024 function assignObject()
1025 {
1026 if ($this->id != 0)
1027 {
1028 if ($this->call_by_reference)
1029 {
1030 $this->object =& new ilObjSCORM2004LearningModule($this->id, true);
1031 }
1032 else
1033 {
1034 $this->object =& new ilObjSCORM2004LearningModule($this->id, false);
1035 }
1036 }
1037 }
1038
1043 {
1044 global $tpl;
1045
1046 $this->initStylePropertiesForm();
1047 $tpl->setContent($this->form->getHTML());
1048 }
1049
1054 {
1055 global $ilCtrl, $lng, $ilTabs, $ilSetting;
1056
1057 $lng->loadLanguageModule("style");
1058 $this->setSubTabs("settings", "style");
1059 $ilTabs->setTabActive("settings");
1060
1061 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1062 $this->form = new ilPropertyFormGUI();
1063
1064 $fixed_style = $ilSetting->get("fixed_content_style_id");
1065 $style_id = $this->object->getStyleSheetId();
1066
1067 if ($fixed_style > 0)
1068 {
1069 $st = new ilNonEditableValueGUI($lng->txt("cont_current_style"));
1070 $st->setValue(ilObject::_lookupTitle($fixed_style)." (".
1071 $this->lng->txt("global_fixed").")");
1072 $this->form->addItem($st);
1073 }
1074 else
1075 {
1076 $st_styles = ilObjStyleSheet::_getStandardStyles(true, false,
1077 $_GET["ref_id"]);
1078
1079 $st_styles[0] = $this->lng->txt("default");
1080 ksort($st_styles);
1081
1082 if ($style_id > 0)
1083 {
1084 // individual style
1085 if (!ilObjStyleSheet::_lookupStandard($style_id))
1086 {
1087 $st = new ilNonEditableValueGUI($lng->txt("cont_current_style"));
1088 $st->setValue(ilObject::_lookupTitle($style_id));
1089 $this->form->addItem($st);
1090
1091//$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "edit"));
1092
1093 // delete command
1094 $this->form->addCommandButton("editStyle",
1095 $lng->txt("cont_edit_style"));
1096 $this->form->addCommandButton("deleteStyle",
1097 $lng->txt("cont_delete_style"));
1098//$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "delete"));
1099 }
1100 }
1101
1102 if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id))
1103 {
1104 $style_sel = ilUtil::formSelect ($style_id, "style_id",
1105 $st_styles, false, true);
1106 $style_sel = new ilSelectInputGUI($lng->txt("cont_current_style"), "style_id");
1107 $style_sel->setOptions($st_styles);
1108 $style_sel->setValue($style_id);
1109 $this->form->addItem($style_sel);
1110//$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "create"));
1111 $this->form->addCommandButton("saveStyleSettings",
1112 $lng->txt("save"));
1113 $this->form->addCommandButton("createStyle",
1114 $lng->txt("sty_create_ind_style"));
1115 }
1116 }
1117 $this->form->setTitle($lng->txt("cont_style"));
1118 $this->form->setFormAction($ilCtrl->getFormAction($this));
1119 }
1120
1124 function createStyle()
1125 {
1126 global $ilCtrl;
1127
1128 $ilCtrl->redirectByClass("ilobjstylesheetgui", "create");
1129 }
1130
1134 function editStyle()
1135 {
1136 global $ilCtrl;
1137
1138 $ilCtrl->redirectByClass("ilobjstylesheetgui", "edit");
1139 }
1140
1144 function deleteStyle()
1145 {
1146 global $ilCtrl;
1147
1148 $ilCtrl->redirectByClass("ilobjstylesheetgui", "delete");
1149 }
1150
1155 {
1156 global $ilSetting;
1157
1158 if ($ilSetting->get("fixed_content_style_id") <= 0 &&
1159 (ilObjStyleSheet::_lookupStandard($this->object->getStyleSheetId())
1160 || $this->object->getStyleSheetId() == 0))
1161 {
1162 $this->object->setStyleSheetId(ilUtil::stripSlashes($_POST["style_id"]));
1163 $this->object->update();
1164 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1165 }
1166 $this->ctrl->redirect($this, "editStyleProperties");
1167 }
1168
1172 protected function showTrackingItemsBySco()
1173 {
1174 global $ilTabs;
1175
1176
1178 $ilTabs->setTabActive("cont_tracking_data");
1179 $ilTabs->setSubTabActive("cont_tracking_bysco");
1180
1181 $reports = array('exportSelectedCore','exportSelectedInteractions','exportSelectedObjectives','tracInteractionItem','tracInteractionUser','tracInteractionUserAnswers');
1182
1183 $scoSelected = "all";
1184 if (isset($_GET["scoSelected"])) $scoSelected = ilUtil::stripSlashes($_GET["scoSelected"]);
1185 if (isset($_POST["scoSelected"])) $scoSelected = ilUtil::stripSlashes($_POST["scoSelected"]);
1186 $this->ctrl->setParameter($this,'scoSelected',$scoSelected);
1187
1188 $report = "choose";
1189 if (isset($_GET["report"])) $report = ilUtil::stripSlashes($_GET["report"]);
1190 if (isset($_POST["report"])) $report = ilUtil::stripSlashes($_POST["report"]);
1191 $this->ctrl->setParameter($this,'report',$report);
1192
1193 include_once './Modules/Scorm2004/classes/class.ilSCORM2004TrackingItemsPerScoFilterGUI.php';
1194 $filter = new ilSCORM2004TrackingItemsPerScoFilterGUI($this, 'showTrackingItemsBySco');
1195 $filter->parse($scoSelected,$report,$reports);
1196 if($report == "choose") {
1197 $this->tpl->setContent($filter->form->getHTML());
1198 } else {
1199 $scosSelected = array();
1200 if ($scoSelected != "all") $scosSelected[] = $scoSelected;
1201 else {
1202 $tmpscos=$this->object->getTrackedItems();
1203 for ($i=0; $i<count($tmpscos); $i++) {
1204 $scosSelected[] = $tmpscos[$i]["id"];
1205 }
1206 }
1207 //with check for course ...
1208 include_once "Services/Tracking/classes/class.ilTrQuery.php";
1209 $a_users=ilTrQuery::getParticipantsForObject($this->ref_id);
1210 // var_dump($this->object->getTrackedUsers(""));
1211 include_once './Modules/Scorm2004/classes/class.ilSCORM2004TrackingItemsTableGUI.php';
1212 $tbl = new ilSCORM2004TrackingItemsTableGUI($this->object->getId(), $this, 'showTrackingItemsBySco', $a_users, $scosSelected, $report);
1213 $this->tpl->setContent($filter->form->getHTML().$tbl->getHTML());
1214 }
1215 return true;
1216 }
1218 {
1219 global $ilTabs, $ilAccess;
1220
1221 $ilTabs->setTabActive('cont_tracking_data');
1222
1223 if($ilAccess->checkAccess("read_learning_progress", "", $_GET["ref_id"])) {
1224
1226 $ilTabs->setSubTabActive('cont_tracking_byuser');
1227
1228 $reports = array('exportSelectedSuccess','exportSelectedCore','exportSelectedInteractions','exportSelectedObjectives','exportObjGlobalToSystem');
1229
1230 $userSelected = "all";
1231 if (isset($_GET["userSelected"])) $userSelected = ilUtil::stripSlashes($_GET["userSelected"]);
1232 if (isset($_POST["userSelected"])) $userSelected = ilUtil::stripSlashes($_POST["userSelected"]);
1233 $this->ctrl->setParameter($this,'userSelected',$userSelected);
1234
1235 $report = "choose";
1236 if (isset($_GET["report"])) $report = ilUtil::stripSlashes($_GET["report"]);
1237 if (isset($_POST["report"])) $report = ilUtil::stripSlashes($_POST["report"]);
1238 $this->ctrl->setParameter($this,'report',$report);
1239
1240 include_once './Modules/Scorm2004/classes/class.ilSCORM2004TrackingItemsPerUserFilterGUI.php';
1241 $filter = new ilSCORM2004TrackingItemsPerUserFilterGUI($this, 'showTrackingItems');
1242 $filter->parse($userSelected,$report,$reports);
1243 if($report == "choose") {
1244 $this->tpl->setContent($filter->form->getHTML());
1245 } else {
1246 $usersSelected = array();
1247 if ($userSelected != "all") $usersSelected[] = $userSelected;
1248 else {
1249 include_once "Services/Tracking/classes/class.ilTrQuery.php";
1250 $users=ilTrQuery::getParticipantsForObject($this->ref_id);
1251 foreach($users as $user) {
1252 if(ilObject::_exists($user) && ilObject::_lookUpType($user) == 'usr') {
1253 $usersSelected[] = $user;
1254 }
1255 }
1256 }
1257 $scosSelected = array();
1258 $tmpscos=$this->object->getTrackedItems();
1259 for ($i=0; $i<count($tmpscos); $i++) {
1260 $scosSelected[] = $tmpscos[$i]["id"];
1261 }
1262 //with check for course ...
1263 // include_once "Services/Tracking/classes/class.ilTrQuery.php";
1264 // $a_users=ilTrQuery::getParticipantsForObject($this->ref_id);
1265 // var_dump($this->object->getTrackedUsers(""));
1266 include_once './Modules/Scorm2004/classes/class.ilSCORM2004TrackingItemsTableGUI.php';
1267 $tbl = new ilSCORM2004TrackingItemsTableGUI($this->object->getId(), $this, 'showTrackingItems', $usersSelected, $scosSelected, $report);
1268 $this->tpl->setContent($filter->form->getHTML().$tbl->getHTML());
1269 }
1270 }
1271 else if($ilAccess->checkAccess("edit_learning_progress", "", $_GET["ref_id"])) {
1272 $this->modifyTrackingItems();
1273 }
1274 return true;
1275 }
1276
1277
1283 {
1284 foreach ($_POST["user"] as $user)
1285 {
1286 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004DeleteData.php");
1287 ilSCORM2004DeleteData::removeCMIDataForUserAndPackage($user,$this->object->getId());
1288
1289 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
1290 ilLPStatusWrapper::_updateStatus($this->object->getId(), $user);
1291 }
1292
1293 $this->ctrl->redirect($this, "modifyTrackingItems");
1294 }
1295
1296 //UK may be erased
1298 {
1299 if (is_array($_POST["id"]))
1300 {
1301 $this->object->deleteTrackingDataOfUsers($_POST["id"]);
1302 }
1303 $this->modifyTrackingItems();
1304 }
1305
1309 function showTree()
1310 {
1311 global $ilUser, $ilias, $ilCtrl, $lng;
1312
1313 $mtree = new ilTree($this->object->getId());
1314 $mtree->setTableNames('sahs_sc13_tree','sahs_sc13_tree_node');
1315 $mtree->setTreeTablePK("slm_id");
1316
1317 if ($_POST["expandAll"] != "")
1318 {
1319 $_GET["scexpand"] = "";
1320 $stree = $mtree->getSubTree($mtree->getNodeData($mtree->readRootId()));
1321 $n_arr = array();
1322 foreach ($stree as $n)
1323 {
1324 $n_arr[] = $n["child"];
1325 }
1326 $_SESSION["scexpand"] = $n_arr;
1327 }
1328
1329 if ($_POST["collapseAll"] != "")
1330 {
1331 $_GET["scexpand"] = "";
1332 $_SESSION["scexpand"] = array($mtree->readRootId());
1333 }
1334
1335 $this->tpl = new ilTemplate("tpl.main.html", true, true);
1336 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
1337
1338 $ilCtrl->setParameter($this, "active_node", $_GET["active_node"]);
1339
1340 $this->tpl->addBlockFile("CONTENT", "content", "tpl.explorer.html");
1341 $this->tpl->setVariable("IMG_SPACE", ilUtil::getImagePath("spacer.png", false));
1342
1343 $this->tpl->setCurrentBlock("exp2_button");
1344 $this->tpl->setVariable("CMD_EXP2_BTN", "expandAll");
1345 $this->tpl->setVariable("TXT_EXP2_BTN", $lng->txt("expand_all"));
1346 $this->tpl->parseCurrentBlock();
1347
1348 $this->tpl->setCurrentBlock("exp2_button");
1349 $this->tpl->setVariable("CMD_EXP2_BTN", "collapseAll");
1350 $this->tpl->setVariable("TXT_EXP2_BTN", $lng->txt("collapse_all"));
1351 $this->tpl->parseCurrentBlock();
1352
1353 require_once ("./Modules/Scorm2004/classes/class.ilSCORM2004EditorExplorer.php");
1354 $exp = new ilSCORM2004EditorExplorer($this->ctrl->getLinkTarget($this, "edit"),
1355 $this->object);
1356 $exp->setFrameUpdater("content", "ilHierarchyFormUpdater");
1357 $exp->setTargetGet("obj_id");
1358 $exp->setExpandTarget($this->ctrl->getLinkTarget($this, "showTree"));
1359
1360 if ($_GET["scexpand"] == "")
1361 {
1362 $expanded = $mtree->readRootId();
1363 }
1364 else
1365 {
1366 $expanded = $_GET["scexpand"];
1367 }
1368
1369//echo "-".$_GET["active_node"]."-";
1370 if ($_GET["active_node"] != "")
1371 {
1372 $path = $mtree->getPathId($_GET["active_node"]);
1373 $exp->setForceOpenPath($path);
1374
1375 $exp->highlightNode($_GET["active_node"]);
1376 }
1377 $exp->setExpand($expanded);
1378
1379 // build html-output
1380 $exp->setOutput(0);
1381 $output = $exp->getOutput();
1382
1383 // asynchronous output
1384 if ($ilCtrl->isAsynch())
1385 {
1386 echo $output; exit;
1387 }
1388
1389 $this->tpl->setCurrentBlock("content");
1390 $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("sahs_organization"));
1391 $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
1392 $this->tpl->setVariable("EXPLORER",$output);
1393 $this->ctrl->setParameter($this, "scexpand", $_GET["scexpand"]);
1394 $this->tpl->setVariable("ACTION", $this->ctrl->getLinkTarget($this, "showTree"));
1395 $this->tpl->parseCurrentBlock();
1396
1397 include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
1398 iljQueryUtil::initjQuery($this->tpl);
1399
1400 $this->tpl->show(false);
1401
1402
1403 exit;
1404 }
1405
1410 {
1411 global $tpl, $lng, $ilTabs, $ilToolbar, $ilCtrl;
1412
1413 $ilTabs->setTabActive("sahs_sequencing");
1414
1415 include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Item.php");
1416
1417 if (!$this->object->getSequencingExpertMode())
1418 {
1419 $ilToolbar->addButton($lng->txt("sahs_activate_expert_mode"),
1420 $ilCtrl->getLinkTarget($this, "confirmExpertMode"));
1421 }
1422 else
1423 {
1424 include_once("./Services/UIComponent/NestedList/classes/class.ilNestedList.php");
1425 $list = new ilNestedList();
1426 $t = $this->object->getTree();
1427 $root_node = $t->getNodeData($t->getRootId());
1428 $nodes = $this->object->getTree()->getSubtree($root_node);
1429 foreach ($nodes as $node)
1430 {
1431 if (in_array($node["type"], array("", "chap", "sco")))
1432 {
1433 $ntpl = new ilTemplate("tpl.seq_node.html", true, true, "Modules/Scorm2004");
1434 $ntpl->setVariable("NODE_ID", $node["child"]);
1435 if ($node["type"] == "")
1436 {
1437 $ntpl->setVariable("TITLE", $this->object->getTitle());
1438 $item = new ilSCORM2004Item($this->object->getId(), true);
1439 }
1440 else
1441 {
1442 $ntpl->setVariable("TITLE", $node["title"]);
1443 $item = new ilSCORM2004Item($node["child"]);
1444 }
1445 $ntpl->setVariable("SEQ_INFO",
1446 ilUtil::prepareFormOutput($item->exportAsXML(false)));
1447 $list->addListNode($ntpl->get(), $node["child"], $node["parent"]);
1448 }
1449 }
1450
1451 $tb = new ilToolbarGUI();
1452 $tb->addFormButton($lng->txt("save"), "saveSequencing");
1453 $ftpl = new ilTemplate("tpl.sequencing.html", true, true, "Modules/Scorm2004");
1454 $ftpl->setVariable("CONTENT", $list->getHTML());
1455 $ftpl->setVariable("FORM_ACTION", $ilCtrl->getFormAction($this));
1456 $ftpl->setVariable("TB", $tb->getHTML());
1457 $tpl->setContent($ftpl->get());
1458 }
1459 }
1460
1465 {
1466 global $ilCtrl, $tpl, $lng, $ilTabs;
1467
1468 $ilTabs->setTabActive("sahs_sequencing");
1469
1470 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1471 $cgui = new ilConfirmationGUI();
1472 $cgui->setFormAction($ilCtrl->getFormAction($this));
1473 $cgui->setHeaderText($lng->txt("sahs_activate_expert_mode_info"));
1474 $cgui->setCancel($lng->txt("cancel"), "showSequencing");
1475 $cgui->setConfirm($lng->txt("sahs_activate_expert_mode"), "activateExpertMode");
1476
1477 $tpl->setContent($cgui->getHTML());
1478 }
1479
1487 {
1488 global $ilCtrl, $lng;
1489
1490 $this->object->setSequencingExpertMode(true);
1491 $this->object->update();
1492 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1493 $ilCtrl->redirect($this, "showSequencing");
1494 }
1495
1496
1501 {
1502 global $tpl,$lng, $ilCtrl;
1503
1504 include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Item.php");
1505 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
1506 $t = $this->object->getTree();
1507 $root_node = $t->getNodeData($t->getRootId());
1508 $nodes = $this->object->getTree()->getSubtree($root_node);
1509 foreach ($nodes as $node)
1510 {
1511 if (in_array($node["type"], array("", "chap", "sco")))
1512 {
1513 if ($node["type"] == "")
1514 {
1515 $item = new ilSCORM2004Item($this->object->getId(), true);
1516 }
1517 else
1518 {
1519 $item = new ilSCORM2004Item($node["child"]);
1520 }
1521 $xml = '<?xml version="1.0"?>'.ilUtil::stripSlashes($_POST["seq"][$node["child"]], false);
1522
1523 $ob_texts = array();
1524 if ($node["type"] == "sco")
1525 {
1526 $sco = new ilSCORM2004Sco($this->object, $node["child"]);
1527 $objectives = $sco->getObjectives();
1528 foreach ($objectives as $o)
1529 {
1530 $ob_texts[$o->getId()] = $o->getObjectiveId();
1531 }
1532 }
1533
1534 $item->setSeqXml($xml);
1535 $item->initDom();
1536 $item->update();
1537
1538 if ($node["type"] == "sco")
1539 {
1540 foreach ($ob_texts as $id => $t)
1541 {
1542 $objective = new ilScorm2004Objective($node["child"], $id);
1543 $objective->setObjectiveId($t);
1544 $objective->updateObjective();
1545 }
1546 }
1547 }
1548 }
1549
1550 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1551
1552 $ilCtrl->redirect($this, "showSequencing");
1553 }
1554
1559 {
1560 global $tpl, $lng, $ilCtrl, $ilToolbar;
1561
1562 $chaps = $this->object->getTree()->getChilds(
1563 $this->object->getTree()->getRootId());
1564 $s_chaps = array();
1565 foreach($chaps as $chap)
1566 {
1567 if ($chap["type"] == "chap")
1568 {
1569 $s_chaps[$chap["child"]] = $chap["title"];
1570 }
1571 }
1572 $cur_chap = $_SESSION["sahs_cur_chap"]
1573 ? $_SESSION["sahs_cur_chap"]
1574 : 0;
1575
1576 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
1577 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
1578 $options = array(
1579 "0" => $lng->txt("all")
1580 );
1581 $options = $options + $s_chaps;
1582 $si = new ilSelectInputGUI($lng->txt("chapter"), "chapter");
1583 $si->setOptions($options);
1584 $si->setValue($cur_chap);
1585 $ilToolbar->addInputItem($si, true);
1586 $ilToolbar->addFormButton($lng->txt("change"), "selectLObjChapter");
1587
1588 include_once("./Modules/Scorm2004/classes/class.ilObjectivesAlignmentTableGUI.php");
1589 $obj_table = new ilObjectivesAlignmentTableGUI($this, "showLearningObjectivesAlignment",
1590 $this->getEditTree(), $this->object, $cur_chap);
1591 $tpl->setContent($obj_table->getHTML());
1592 }
1593
1595 {
1596 global $ilCtrl;
1597
1598 $_SESSION["sahs_cur_chap"] = (int) $_POST["chapter"];
1599 $ilCtrl->redirect($this, "showLearningObjectivesAlignment");
1600 }
1601
1605 public function selectExport()
1606 {
1607 switch ($_POST['select_export'])
1608 {
1609 case "exportScorm12":
1610 case "exportScorm2004_3rd":
1611 case "exportScorm2004_4th":
1612 case "exportPDF":
1613 case "exportISO":
1614 case "exportHTML":
1615 case "exportHTMLOne":
1616 $this->ctrl->redirect($this, $_POST['select_export']);
1617 break;
1618 default:
1619 $this->ctrl->redirect($this, 'showExportList');
1620 break;
1621 }
1622 }
1623
1628 {
1629 global $tpl, $ilToolbar;
1630
1631 $ilToolbar->setFormAction($this->ctrl->getFormAction($this, 'selectExport'));
1632 $ilToolbar->setId("scorm2004export");
1633
1634 //$template = new ilTemplate("tpl.scorm2004_export_buttons.html", true, true, 'Modules/Scorm2004');
1635
1636/* $buttons = array(
1637 "exportScorm2004_3rd" => $this->lng->txt("scorm_create_export_file_scrom2004"),
1638 "exportScorm2004_4th" => $this->lng->txt("scorm_create_export_file_scrom2004_4th"),
1639 "exportScorm12" => $this->lng->txt("scorm_create_export_file_scrom12"),
1640 "exportPDF" => $this->lng->txt("scorm_create_export_file_pdf"),
1641 "exportISO" => $this->lng->txt("scorm_create_export_file_iso"),
1642 "exportHTML" => $this->lng->txt("scorm_create_export_file_html"),
1643 "exportHTMLOne" => $this->lng->txt("scorm_create_export_file_html_one")
1644 );*/
1645 $buttons = array(
1646 "exportScorm2004_3rd" => $this->lng->txt("scorm_create_export_file_scrom2004"),
1647 "exportScorm2004_4th" => $this->lng->txt("scorm_create_export_file_scrom2004_4th"),
1648 "exportScorm12" => $this->lng->txt("scorm_create_export_file_scrom12"),
1649 "exportHTML" => $this->lng->txt("scorm_create_export_file_html"),
1650 "exportHTMLOne" => $this->lng->txt("scorm_create_export_file_html_one")
1651 );
1652
1653 //
1654 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
1655 $si = new ilSelectInputGUI($this->lng->txt('type'), "select_export");
1656 $si->setOptions($buttons);
1657 $ilToolbar->addInputItem($si, true);
1658
1659 $ilToolbar->addFormButton($this->lng->txt('export'), "selectExport");
1660
1661 $export_files = $this->object->getExportFiles();
1662
1663 include_once "./Modules/Scorm2004/classes/class.ilSCORM2004ExportTableGUI.php";
1664 $table_gui = new ilSCORM2004ExportTableGUI($this, 'showExportList');
1665 $data = array();
1666 foreach ($export_files as $exp_file)
1667 {
1668 $filetype = $exp_file['type'];
1669 $public_str = ($exp_file["file"] == $this->object->getPublicExportFile($filetype))
1670 ? " <b>(".$this->lng->txt("public").")<b>"
1671 : "";
1672 $file_arr = explode("__", $exp_file["file"]);
1673 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));
1674 }
1675 $table_gui->setData($data);
1676
1677 $this->tpl->setContent($table_gui->getHTML());
1678 }
1679
1685 function getTabs(&$tabs_gui)
1686 {
1687 global $ilAccess, $ilHelp;
1688
1689 if ($this->ctrl->getCmd() == "delete")
1690 {
1691 return;
1692 }
1693
1694 if (!$this->object->getEditable())
1695 {
1696 return parent::getTabs($tabs_gui);
1697 }
1698
1699 $ilHelp->setScreenIdComponent("sahsed");
1700
1701 // organization
1702 $tabs_gui->addTarget("sahs_organization",
1703 $this->ctrl->getLinkTarget($this, "showOrganization"), "showOrganization",
1704 get_class($this));
1705
1706 // info screen
1707 $force_active = ($this->ctrl->getNextClass() == "ilinfoscreengui")
1708 ? true
1709 : false;
1710 $tabs_gui->addTarget("info_short",
1711 $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"), "",
1712 "ilinfoscreengui", "", $force_active);
1713
1714 // settings
1715 $tabs_gui->addTarget("settings",
1716 $this->ctrl->getLinkTarget($this, "properties"), "properties",
1717 get_class($this));
1718
1719 // tracking data
1720 /* Later, only if tracking data exists
1721 $tabs_gui->addTarget("cont_tracking_data",
1722 $this->ctrl->getLinkTarget($this, "showTrackingItems"), "showTrackingItems",
1723 get_class($this));
1724 */
1725
1726 // objective alignment
1727 $tabs_gui->addTarget("sahs_objectives_alignment",
1728 $this->ctrl->getLinkTarget($this, "showLearningObjectivesAlignment"), "showLearningObjectivesAlignment",
1729 get_class($this));
1730
1731 // sequencing
1732 $tabs_gui->addTarget("sahs_sequencing",
1733 $this->ctrl->getLinkTarget($this, "showSequencing"), "showSequencing",
1734 get_class($this));
1735
1736 // learning progress
1737 /* Later, only if tracking data exists
1738 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
1739 if(ilObjUserTracking::_enabledLearningProgress())
1740 {
1741 $tabs_gui->addTarget('learning_progress',
1742 $this->ctrl->getLinkTargetByClass(array('illearningprogressgui'),''),
1743 '',
1744 array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui'));
1745 }
1746 */
1747
1748 // edit meta
1749 include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
1750 $mdgui = new ilObjectMetaDataGUI($this->object);
1751 $mdtab = $mdgui->getTab();
1752 if($mdtab)
1753 {
1754 $tabs_gui->addTarget("meta_data",
1755 $mdtab,
1756 "", "ilmdeditorgui");
1757 }
1758
1759 // export
1760 $tabs_gui->addTarget("export",
1761 $this->ctrl->getLinkTarget($this, "showExportList"), array("showExportList", 'confirmDeleteExportFile'),
1762 get_class($this));
1763
1764 // perm
1765 if ($ilAccess->checkAccess('edit_permission', '', $this->object->getRefId()))
1766 {
1767 $tabs_gui->addTarget("perm_settings",
1768 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
1769 }
1770
1771 if ($this->object->editable==1)
1772 {
1773 // preview
1774 $tabs_gui->addNonTabbedLink("preview",
1775 $this->lng->txt("cont_sc_preview"),
1776 $this->ctrl->getLinkTarget($this, "preview"),
1777 "_blank");
1778 }
1779
1780 }
1781
1785 function setSubTabs($a_main_tab, $a_active)
1786 {
1787 global $ilTabs, $ilCtrl, $lng;
1788
1789 if ($a_main_tab == "settings" &&
1790 $this->object->editable == 1)
1791 {
1792/* // general properties
1793 $ilTabs->addSubTab("general_settings",
1794 $lng->txt("general_settings"),
1795 $ilCtrl->getLinkTarget($this, 'properties'));
1796
1797 // style properties
1798 $ilTabs->addSubTab("style",
1799 $lng->txt("cont_style"),
1800 $ilCtrl->getLinkTarget($this, 'editStyleProperties'));
1801*/
1802 $ilTabs->activateSubTab($a_active);
1803 }
1804 }
1805
1806
1810 function getEditTree()
1811 {
1812 $slm_tree = new ilTree($this->object->getId());
1813 $slm_tree->setTreeTablePK("slm_id");
1814 $slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1815 return $slm_tree;
1816 }
1817
1821 function showOrganization($a_top_node = 0, $a_form_action = "",
1822 $a_title = "", $a_icon = "", $a_gui_obj = null, $a_gui_cmd = "")
1823 {
1824 global $lng, $ilCtrl, $tpl;
1825
1826 if ($a_form_action == "")
1827 {
1828 $a_form_action = $ilCtrl->getFormAction($this);
1829 }
1830
1831 if ($a_icon == "")
1832 {
1833 $a_title = $this->object->getTitle();
1834 $a_icon = ilUtil::getImagePath("icon_lm.svg");
1835 }
1836
1837 $slm_tree = $this->getEditTree();
1838
1839 if ($a_top_node == 0)
1840 {
1841 $a_top_node = $slm_tree->getRootId();
1842 }
1843
1844 if (is_null($a_gui_obj))
1845 {
1846 $a_gui_obj = $this;
1847 $a_gui_cmd = "showOrganization";
1848 }
1849
1850 $ilCtrl->setParameter($this, "backcmd", "showOrganization");
1851 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
1852 $form_gui = new ilSCORM2004OrganizationHFormGUI();
1853 $form_gui->setParentCommand($a_gui_obj, $a_gui_cmd);
1854 $form_gui->setFormAction($a_form_action);
1855// $form_gui->setTitle($a_title);
1856// $form_gui->setIcon($a_icon);
1857 $form_gui->setTree($slm_tree);
1858 $form_gui->setCurrentTopNodeId($a_top_node);
1859 $form_gui->addMultiCommand($lng->txt("delete"), "deleteNodes");
1860 $form_gui->addMultiCommand($lng->txt("cut"), "cutItems");
1861 $form_gui->addMultiCommand($lng->txt("copy"), "copyItems");
1862 $form_gui->addCommand($lng->txt("cont_save_all_titles"), "saveAllTitles");
1863 $form_gui->addCommand($lng->txt("expand_all"), "expandAll");
1864 $form_gui->addCommand($lng->txt("collapse_all"), "collapseAll");
1865 $form_gui->setTriggeredUpdateCommand("saveAllTitles");
1866
1867 // highlighted nodes
1868 if ($_GET["highlight"] != "")
1869 {
1870 $hl = explode(":", $_GET["highlight"]);
1871 $form_gui->setHighlightedNodes($hl);
1872 $form_gui->setFocusId($hl[0]);
1873 }
1874
1875 $ilCtrl->setParameter($this, "active_node", $_GET["obj_id"]);
1876// $form_gui->setExplorerUpdater("tree", "tree_div",
1877// $ilCtrl->getLinkTarget($this, "showTree", "", true));
1878 $sc_tpl = new ilTemplate("tpl.scormeditor_orga_screen.html", true, true, "Modules/Scorm2004");
1879 $sc_tpl->setVariable("ORGANIZATION", $form_gui->getHTML());
1880 $sc_tpl->setVariable("NOTES", $this->getNotesHTML());
1881
1882 $tpl->setContent($sc_tpl->get());
1883 }
1884
1888 function getNotesHTML($a_mode = "")
1889 {
1890 global $ilCtrl, $ilAccess, $ilSetting;
1891
1892 // notes
1893 $ilCtrl->setParameter($this, "nodes_mode", $a_mode);
1894 include_once("Services/Notes/classes/class.ilNoteGUI.php");
1895 $node_id = $_GET["obj_id"];
1896 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
1897 $node_type = ($node_id > 0)
1899 : "sahs";
1900
1901 $notes_gui = new ilNoteGUI($this->object->getId(),
1902 (int) $node_id, $node_type);
1903 if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]) && $ilSetting->get("comments_del_tutor", 1))
1904 {
1905 $notes_gui->enablePublicNotesDeletion(true);
1906 }
1907 $notes_gui->enablePrivateNotes();
1908 $notes_gui->enablePublicNotes();
1909
1910 $next_class = $ilCtrl->getNextClass($this);
1911 if ($next_class == "ilnotegui")
1912 {
1913 $html = $this->ctrl->forwardCommand($notes_gui);
1914 }
1915 else
1916 {
1917 $html = $notes_gui->getNotesHTML();
1918 }
1919 return $html;
1920 }
1921
1925 function insertChapter($a_redirect = true)
1926 {
1927 global $ilCtrl, $lng;
1928
1929 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
1930
1931 $slm_tree =& new ilTree($this->object->getId());
1932 $slm_tree->setTreeTablePK("slm_id");
1933 $slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1934
1937
1938 if (!ilSCORM2004OrganizationHFormGUI::getPostFirstChild()) // insert after node id
1939 {
1940 $parent_id = $slm_tree->getParentId($node_id);
1941 $target = $node_id;
1942 }
1943 else // insert as first child
1944 {
1945 $parent_id = $node_id;
1946 $target = IL_FIRST_NODE;
1947 }
1948 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Chapter.php");
1949 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
1950
1951 $chap_ids = array();
1952 for ($i = 1; $i <= $num; $i++)
1953 {
1954 $chap = new ilSCORM2004Chapter($this->object);
1955 $chap->setTitle($lng->txt("sahs_new_chapter"));
1956 $chap->setSLMId($this->object->getId());
1957 $chap->create();
1958 ilSCORM2004Node::putInTree($chap, $parent_id, $target);
1959 $chap_ids[] = $chap->getId();
1960 }
1961 $chap_ids = array_reverse($chap_ids);
1962 $chap_ids = implode($chap_ids, ":");
1963
1964 if ($a_redirect)
1965 {
1966 $ilCtrl->setParameter($this, "highlight", $chap_ids);
1967 $ilCtrl->redirect($this, "showOrganization", "node_".$node_id);
1968 }
1969 return array("node_id" => $node_id, "items" => $chap_ids);
1970 }
1971
1975 function insertSco($a_redirect = true)
1976 {
1977 global $ilCtrl, $lng;
1978
1979 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
1980
1981 $slm_tree =& new ilTree($this->object->getId());
1982 $slm_tree->setTreeTablePK("slm_id");
1983 $slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1984
1987
1988 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
1989 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
1990
1991 if (!ilSCORM2004OrganizationHFormGUI::getPostFirstChild()) // insert after node id
1992 {
1993 $parent_id = $slm_tree->getParentId($node_id);
1994 $target = $node_id;
1995 }
1996 else // insert as first child
1997 {
1998 $parent_id = $node_id;
1999 $target = IL_FIRST_NODE;
2000 }
2001
2002 $sco_ids = array();
2003 for ($i = 1; $i <= $num; $i++)
2004 {
2005 $sco = new ilSCORM2004Sco($this->object);
2006 $sco->setTitle($lng->txt("sahs_new_sco"));
2007 $sco->setSLMId($this->object->getId());
2008 $sco->create();
2009 ilSCORM2004Node::putInTree($sco, $parent_id, $target);
2010 $sco_ids[] = $sco->getId();
2011 }
2012 $sco_ids = array_reverse($sco_ids);
2013 $sco_ids = implode($sco_ids, ":");
2014
2015 if ($a_redirect)
2016 {
2017 $ilCtrl->setParameter($this, "highlight", $sco_ids);
2018 $ilCtrl->redirect($this, "showOrganization", "node_".$node_id);
2019 }
2020 return array("node_id" => $node_id, "items" => $sco_ids);
2021 }
2022
2026 function insertAsset($a_redirect = true)
2027 {
2028 global $ilCtrl, $lng;
2029
2030 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
2031
2032 $slm_tree =& new ilTree($this->object->getId());
2033 $slm_tree->setTreeTablePK("slm_id");
2034 $slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
2035
2038
2039 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Asset.php");
2040 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2041
2042 if (!ilSCORM2004OrganizationHFormGUI::getPostFirstChild()) // insert after node id
2043 {
2044 $parent_id = $slm_tree->getParentId($node_id);
2045 $target = $node_id;
2046 }
2047 else // insert as first child
2048 {
2049 $parent_id = $node_id;
2050 $target = IL_FIRST_NODE;
2051 }
2052
2053 $ass_ids = array();
2054 for ($i = 1; $i <= $num; $i++)
2055 {
2056 $ass = new ilSCORM2004Asset($this->object);
2057 $ass->setTitle($lng->txt("sahs_new_asset"));
2058 $ass->setSLMId($this->object->getId());
2059 $ass->create();
2060 ilSCORM2004Node::putInTree($ass, $parent_id, $target);
2061 $ass_ids[] = $ass->getId();
2062 }
2063 $ass_ids = array_reverse($ass_ids);
2064 $ass_ids = implode($ass_ids, ":");
2065
2066 if ($a_redirect)
2067 {
2068 $ilCtrl->setParameter($this, "highlight", $ass_ids);
2069 $ilCtrl->redirect($this, "showOrganization", "node_".$node_id);
2070 }
2071 return array("node_id" => $node_id, "items" => $ass_ids);
2072 }
2073
2077 function insertPage($a_redirect = true)
2078 {
2079 global $ilCtrl, $lng;
2080
2081 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
2082
2083 $slm_tree =& new ilTree($this->object->getId());
2084 $slm_tree->setTreeTablePK("slm_id");
2085 $slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
2086
2089
2090 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004PageNode.php");
2091 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2092 if (!ilSCORM2004OrganizationHFormGUI::getPostFirstChild()) // insert after node id
2093 {
2094 $parent_id = $slm_tree->getParentId($node_id);
2095 $target = $node_id;
2096 }
2097 else // insert as first child
2098 {
2099 $parent_id = $node_id;
2100 $target = IL_FIRST_NODE;
2101 }
2102
2103 $page_ids = array();
2104 for ($i = 1; $i <= $num; $i++)
2105 {
2106 $page = new ilSCORM2004PageNode($this->object);
2107 $page->setTitle($lng->txt("sahs_new_page"));
2108 $page->setSLMId($this->object->getId());
2109 $page->create();
2110 ilSCORM2004Node::putInTree($page, $parent_id, $target);
2111 $page_ids[] = $page->getId();
2112 }
2113 $page_ids = array_reverse($page_ids);
2114 $page_ids = implode($page_ids, ":");
2115
2116 if ($a_redirect)
2117 {
2118 $ilCtrl->setParameter($this, "highlight", $page_ids);
2119 $ilCtrl->redirect($this, "showOrganization", "node_".$node_id);
2120 }
2121 return array("node_id" => $node_id, "items" => $page_ids);
2122 }
2123
2124
2129 {
2130
2131 global $ilCtrl,$lng, $tpl;
2132
2133 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
2134 include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004SeqTemplate.php");
2135
2136 $templates = array();
2137 $description = null;
2138 $image = null;
2139
2140 $default_identifier = $_POST["identifier"];
2141
2142 //get available templates
2144
2145 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.scormeditor_seq_chooser.html", "Modules/Scorm2004");
2146
2147 $this->tpl->setCurrentBlock("option_item");
2148
2149 $active = null;
2150 foreach ($arr_templates as $templ)
2151 {
2152 $sel= "";
2153 $item_data = $templ->getMetadataProperties();
2154 $item_data['identifier'] = $templ->getIdentifier();
2155 array_push($templates,$item_data);
2156 if ($default_identifier == $item_data['identifier']) {$sel = 'selected'; $active = $item_data;}
2157 $this->tpl->setVariable("VAL_SELECTED",$sel );
2158 $this->tpl->setVariable("VAL_IDENTIFIER",$item_data['identifier'] );
2159 $this->tpl->setVariable("VAL_TITLE",$item_data['title'] );
2160 $this->tpl->parseCurrentBlock();
2161 }
2162
2163 //default
2164 if ($active == null )
2165 {
2166 $this->saveAllTitles(false);
2167 $description = $templates[0]['description'];
2168 $image = $templates[0]['thumbnail'];
2169 } else {
2170 $description = $active['description'];
2171 $image = $active['thumbnail'];
2172 }
2173
2174 $this->tpl->setVariable("VAL_DESCRIPTION",$description);
2175 $this->tpl->setVariable("VAL_IMAGE",ilSCORM2004SeqTemplate::SEQ_TEMPLATE_DIR."/images/".$image);
2176
2177 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
2178 $this->tpl->setVariable("BTN_NAME", "insertScenario");
2179 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
2180 $this->tpl->setVariable("TXT_INSERT", $this->lng->txt("insert"));
2181 $this->tpl->setVariable("TXT_CHANGE", $this->lng->txt("change"));
2182
2183 $this->tpl->setVariable("TXT_TITLE", "Choose Sequencing Template");
2184
2185 $node_id = $_POST["node_id"];
2186 $first_child = $_POST["first_child"];
2187
2188 if (!$node_id) {$node_id = ilSCORM2004OrganizationHFormGUI::getPostNodeId();}
2189 if (!$first_child) {$first_child = ilSCORM2004OrganizationHFormGUI::getPostFirstChild();}
2190
2191 $this->tpl->setVariable("VAL_NODE_ID", $node_id);
2192 $this->tpl->setVariable("VAL_FIRST_CHILD", $first_child);
2193
2194 }
2195
2196
2201 {
2202 global $ilCtrl;
2203
2204 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
2205
2206 $slm_tree =& new ilTree($this->object->getId());
2207 $slm_tree->setTreeTablePK("slm_id");
2208 $slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
2209
2210 $node_id = $_POST["node_id"];
2211
2212 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004PageNode.php");
2213 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2214 include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004SeqTemplate.php");
2215
2216 if (!$_POST["first_child"]) // insert after node id
2217 {
2218 $parent_id = $slm_tree->getParentId($node_id);
2219 $target = $node_id;
2220 }
2221 else // insert as first child
2222 {
2223 $parent_id = $node_id;
2224 $target = IL_FIRST_NODE;
2225 }
2226
2227 $template = new ilSCORM2004SeqTemplate($_POST["identifier"]);
2228 $id = $template->insertTemplateForObjectAtParent($this->object,$parent_id,$target);
2229 $ilCtrl->setParameter($this, "highlight", $id);
2230 $ilCtrl->redirect($this, "showOrganization", "node_".$node_id);
2231
2232 }
2233
2237 function insertSpecialPage($a_redirect = true)
2238 {
2239 $this->insertTemplateGUI($a_redirect, true);
2240 }
2241
2242
2246 function insertTemplateGUI($a_redirect = true, $a_special_page = false)
2247 {
2248 global $ilCtrl,$lng, $tpl;
2249
2250 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
2251
2252 $arr_templates = ilPageLayout::activeLayouts($a_special_page, ilPageLayout::MODULE_SCORM);
2253
2254 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.scormeditor_page_layout_chooser.html", "Modules/Scorm2004");
2255
2256 $this->tpl->setCurrentBlock("option_item");
2257
2258 $count = 0;
2259 foreach ($arr_templates as $templ)
2260 {
2261 $count++;
2262 $sel= "";
2263 $templ->readObject();
2264 $this->tpl->setVariable("VAL_LAYOUT_TITLE",$templ->getTitle());
2265 $this->tpl->setVariable("VAL_LAYOUT_IMAGE",$templ->getPreview());
2266 $this->tpl->setVariable("VAL_LAYOUT_ID",$templ->getId());
2267 $this->tpl->setVariable("VAL_DISPLAY","inline");
2268 if ($count==1) {
2269 $this->tpl->setVariable("VAL_CHECKED","checked");
2270 }
2271 if ($count%4 == 0) {
2272 $this->tpl->setVariable("END_ROW","</tr>");
2273 }
2274 if ($count == 1 || ($count-1)%4 == 0) {
2275 $this->tpl->setVariable("BEGIN_ROW","<tr>");
2276 }
2277 $this->tpl->parseCurrentBlock();
2278 }
2279
2280 //matrix table
2281 if ($count%4!=0) {
2282 $rest = 4-($count%4);
2283 } else {
2284 $rest=0;
2285 }
2286
2287 for ($i=1;$i<=$rest;$i++) {
2288 $this->tpl->setVariable("VAL_DISPLAY","none");
2289 $this->tpl->setVariable("VAL_LAYOUT_ID",$templ->getId());
2290
2291 if ($i == $rest) {
2292 $this->tpl->setVariable("END_ROW","</tr>");
2293 }
2294 $this->tpl->parseCurrentBlock();
2295 }
2296
2297 //empty cells and closing <tr>
2298
2299 $this->tpl->setVariable("VAL_NODE_ID",ilSCORM2004OrganizationHFormGUI::getPostNodeId());
2300 $this->tpl->setVariable("VAL_MULTI", ilSCORM2004OrganizationHFormGUI::getPostMulti());
2301 $this->tpl->setVariable("VAL_FIRST_CHILD", ilSCORM2004OrganizationHFormGUI::getPostFirstChild());
2302 $this->tpl->setVariable("VAL_OBJ_ID", ilSCORM2004OrganizationHFormGUI::getPostFirstChild());
2303
2304 $ilCtrl->saveParameter($this,"obj_id");
2305
2306 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
2307
2308 $this->tpl->setVariable("BTN_NAME", "insertTemplate");
2309 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
2310 $this->tpl->setVariable("TXT_INSERT", $this->lng->txt("create"));
2311 $this->tpl->setVariable("CMD_CANCEL", "showOrganization");
2312
2313 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
2314 $this->tpl->setVariable("TXT_INSERT", $this->lng->txt("insert"));
2315 $this->tpl->setVariable("TXT_CHANGE", $this->lng->txt("change"));
2316 if ($a_special_page)
2317 {
2318 $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("sahs_choose_special_page"));
2319 }
2320 else
2321 {
2322 $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("sahs_choose_page_template"));
2323 }
2324 }
2325
2326
2327
2331 function insertTemplate($a_redirect = true)
2332 {
2333 global $ilCtrl, $lng;
2334
2335 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
2336
2337 $slm_tree =& new ilTree($this->object->getId());
2338 $slm_tree->setTreeTablePK("slm_id");
2339 $slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
2340
2341 $num = $_POST["multi"];
2342 $node_id = $_POST["node_id"];
2343 $layout_id = $_POST["layout_id"];
2344
2345
2346 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004PageNode.php");
2347 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2348
2349 if (!$_POST["first_child"]) // insert after node id
2350 {
2351 $parent_id = $slm_tree->getParentId($node_id);
2352 $target = $node_id;
2353 }
2354 else // insert as first child
2355 {
2356 $parent_id = $node_id;
2357 $target = IL_FIRST_NODE;
2358 }
2359
2360 $page_ids = array();
2361 for ($i = 1; $i <= $num; $i++)
2362 {
2363 $page = new ilSCORM2004PageNode($this->object);
2364 $page->setTitle($lng->txt("sahs_new_page"));
2365 $page->setSLMId($this->object->getId());
2366 $page->create(false,$layout_id);
2367 ilSCORM2004Node::putInTree($page, $parent_id, $target);
2368 $page_ids[] = $page->getId();
2369 }
2370 $page_ids = array_reverse($page_ids);
2371 $page_ids = implode($page_ids, ":");
2372
2373 if ($a_redirect)
2374 {
2375 if ($_GET["obj_id"] != "")
2376 {
2377 $this->jumpToNode($node_id, $page_ids);
2378 }
2379 else
2380 {
2381 $ilCtrl->setParameter($this, "highlight", $page_ids);
2382 $ilCtrl->redirect($this, "showOrganization", "node_".$node_id);
2383 }
2384 }
2385 }
2386
2390 function expandAll($a_redirect = true)
2391 {
2392 $_GET["scexpand"] = "";
2393 $mtree = $this->object->getTree();
2394 $n_id = ($_GET["obj_id"] > 0)
2395 ? $_GET["obj_id"]
2396 : $mtree->readRootId();
2397 $stree = $mtree->getSubTree($mtree->getNodeData($n_id));
2398 $n_arr = array();
2399 foreach ($stree as $n)
2400 {
2401 $n_arr[] = $n["child"];
2402 $_SESSION["scexpand"] = $n_arr;
2403 }
2404 $this->saveAllTitles($a_redirect);
2405 }
2406
2410 function collapseAll($a_redirect = true)
2411 {
2412 $_GET["scexpand"] = "";
2413 $mtree = $this->object->getTree();
2414 $n_id = ($_GET["obj_id"] > 0)
2415 ? $_GET["obj_id"]
2416 : $mtree->readRootId();
2417 $stree = $mtree->getSubTree($mtree->getNodeData($n_id));
2418 $old = $_SESSION["scexpand"];
2419 foreach ($stree as $n)
2420 {
2421 if (in_array($n["child"], $old) && $n["child"] != $n_id)
2422 {
2423 $k = array_search($n["child"], $old);
2424 unset($old[$k]);
2425 }
2426 }
2427 $_SESSION["scexpand"] = $old;
2428 $this->saveAllTitles($a_redirect);
2429 }
2430
2434 function saveAllTitles($a_redirect = true)
2435 {
2436 global $ilCtrl;
2437
2438 if (is_array($_POST["title"]))
2439 {
2440 include_once("./Services/MetaData/classes/class.ilMD.php");
2441 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004NodeFactory.php");
2442 foreach($_POST["title"] as $id => $title)
2443 {
2444 $node_obj = ilSCORM2004NodeFactory::getInstance($this->object, $id, false);
2445 if (is_object($node_obj))
2446 {
2447 // Update Title and description
2448 $md = new ilMD($this->object->getId(), $id, $node_obj->getType());
2449 $md_gen = $md->getGeneral();
2450 $md_gen->setTitle(ilUtil::stripSlashes($title));
2451 $md_gen->update();
2452 $md->update();
2454 }
2455 }
2456 }
2457 if ($a_redirect)
2458 {
2459 $ilCtrl->redirect($this, "showOrganization");
2460 }
2461 }
2462
2468 function deleteNodes($a_form_action = "")
2469 {
2470 global $lng, $tpl;
2471
2472 if(!isset($_POST["id"]))
2473 {
2474 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
2475 }
2476
2477 // SAVE POST VALUES
2478 $_SESSION["saved_post"] = $_POST["id"];
2479
2480 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
2481 $confirmation_gui = new ilConfirmationGUI();
2482
2483 if ($a_form_action == "")
2484 {
2485 $cmd = ($_GET["backcmd"] == "")
2486 ? "showOrganization"
2487 : $_GET["backcmd"];
2488 $this->ctrl->setParameter($this, "backcmd", $cmd);
2489 $a_form_action = $this->ctrl->getFormAction($this);
2490 }
2491 $confirmation_gui->setFormAction($a_form_action);
2492 $confirmation_gui->setHeaderText($this->lng->txt("info_delete_sure"));
2493
2494 // Add items to delete
2495 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004NodeFactory.php");
2496 foreach($_POST["id"] as $id)
2497 {
2498 if ($id != IL_FIRST_NODE)
2499 {
2500 $node_obj = ilSCORM2004NodeFactory::getInstance($this->object, $id, false);
2501 $confirmation_gui->addItem("id[]", $node_obj->getId(),
2502 $node_obj->getTitle(), ilUtil::getImagePath("icon_".$node_obj->getType().".svg"));
2503 }
2504 }
2505
2506 $confirmation_gui->setCancel($lng->txt("cancel"), "cancelDelete");
2507 $confirmation_gui->setConfirm($lng->txt("confirm"), "confirmedDelete");
2508
2509 $tpl->setContent($confirmation_gui->getHTML());
2510 }
2511
2515 function cancelDelete()
2516 {
2517 $this->ctrl->redirect($this, $_GET["backcmd"]);
2518 }
2519
2523 function confirmedDelete($a_redirect = true)
2524 {
2525 global $ilCtrl;
2526
2527 $tree = new ilTree($this->object->getId());
2528 $tree->setTableNames('sahs_sc13_tree','sahs_sc13_tree_node');
2529 $tree->setTreeTablePK("slm_id");
2530
2531 // delete all selected objects
2532 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004NodeFactory.php");
2533 foreach ($_POST["id"] as $id)
2534 {
2535 if ($id != IL_FIRST_NODE)
2536 {
2537 $obj = ilSCORM2004NodeFactory::getInstance($this->object, $id, false);
2538 $node_data = $tree->getNodeData($id);
2539 if (is_object($obj))
2540 {
2541 $obj->setSLMId($this->object->getId());
2542
2543 /*include_once("./Services/History/classes/class.ilHistory.php");
2544 ilHistory::_createEntry($this->object->getId(), "delete_".$obj->getType(),
2545 array(ilLMObject::_lookupTitle($id), $id),
2546 $this->object->getType());*/
2547
2548 $obj->delete();
2549 }
2550 if($tree->isInTree($id))
2551 {
2552 $tree->deleteTree($node_data);
2553 }
2554 }
2555 }
2556
2557 // check the tree
2558 // $this->object->checkTree();
2559
2560 // feedback
2561 ilUtil::sendInfo($this->lng->txt("info_deleted"),true);
2562
2563 if ($a_redirect)
2564 {
2565 $ilCtrl->redirect($this, "showOrganization");
2566 }
2567 }
2568
2573 {
2574 global $ilCtrl;
2575
2576 $this->object->executeDragDrop($_POST["il_hform_source_id"], $_POST["il_hform_target_id"],
2577 $_POST["il_hform_fc"], $_POST["il_hform_as_subitem"]);
2578 $ilCtrl->redirect($this, "showOrganization");
2579 }
2580
2584 function copyItems($a_return = "showOrganization")
2585 {
2586 global $ilCtrl, $lng;
2587
2588 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2589
2590 $items = ilUtil::stripSlashesArray($_POST["id"]);
2591 $todel = array(); // delete IDs < 0 (needed for non-js editing)
2592 foreach($items as $k => $item)
2593 {
2594 if ($item < 0)
2595 {
2596 $todel[] = $k;
2597 }
2598 }
2599 foreach($todel as $k)
2600 {
2601 unset($items[$k]);
2602 }
2604 {
2605 ilUtil::sendFailure($lng->txt("sahs_choose_pages_chap_scos_ass_only"), true);
2606 $ilCtrl->redirect($this, $a_return);
2607 }
2608 ilSCORM2004Node::clipboardCopy($this->object->getId(), $items);
2609
2610 // @todo: move this to a service since it can be used here, too
2611 include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
2613 ilUtil::sendInfo($lng->txt("cont_selected_items_have_been_copied"), true);
2614
2615 $ilCtrl->redirect($this, $a_return);
2616 }
2617
2621 function cutItems($a_return = "showOrganization")
2622 {
2623 global $ilCtrl, $lng;
2624
2625 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2626
2627 $items = ilUtil::stripSlashesArray($_POST["id"]);
2628 $todel = array(); // delete IDs < 0 (needed for non-js editing)
2629 foreach($items as $k => $item)
2630 {
2631 if ($item < 0)
2632 {
2633 $todel[] = $k;
2634 }
2635 }
2636 foreach($todel as $k)
2637 {
2638 unset($items[$k]);
2639 }
2640
2642 {
2643 ilUtil::sendFailure($lng->txt("sahs_choose_pages_chap_scos_ass_only"), true);
2644 $ilCtrl->redirect($this, $a_return);
2645 }
2646
2647 ilSCORM2004Node::clipboardCut($this->object->getId(), $items);
2648
2649 include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
2651
2652 ilUtil::sendInfo($lng->txt("cont_selected_items_have_been_cut"), true);
2653
2654 $ilCtrl->redirect($this, $a_return);
2655 }
2656
2661 {
2662 global $ilCtrl, $ilUser;
2663
2664 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2665 ilSCORM2004Node::insertPageClip($this->object);
2666
2667 $ilCtrl->redirect($this, "showOrganization",
2669 }
2670
2674 function insertScoClip()
2675 {
2676 global $ilCtrl, $ilUser;
2677
2678 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2679 ilSCORM2004Node::insertScoClip($this->object);
2680
2681 $ilCtrl->redirect($this, "showOrganization",
2683 }
2684
2689 {
2690 global $ilCtrl, $ilUser;
2691
2692 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2693 ilSCORM2004Node::insertAssetClip($this->object);
2694
2695 $ilCtrl->redirect($this, "showOrganization",
2697 }
2698
2703 {
2704 global $ilCtrl, $ilUser;
2705
2706 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2708
2709 $ilCtrl->redirect($this, "showOrganization",
2711 }
2712
2716 function insertLMChapterClip($a_confirm = false, $a_perform = false)
2717 {
2718 global $ilCtrl, $tpl, $ilToolbar, $ilCtrl, $lng, $ilTabs;
2719
2720 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
2721
2722
2723 $pf = "";
2725 {
2726 $pf.= '<input type="hidden" name="'.$f.'" value="'.$v.'" />';
2727 }
2728 if ($a_confirm && is_array($_POST["node"]))
2729 {
2730 foreach ($_POST["node"] as $f => $v)
2731 {
2732 $pf.= '<input type="hidden" name="node['.$f.']" value="'.$v.'" />';
2733 }
2734 }
2735
2736
2739
2740 include_once("./Modules/Scorm2004/classes/class.ilLMChapterImportForm.php");
2741 $form = new ilLMChapterImportForm($this->object, $node_id, $first_child, $a_confirm);
2742 $tpl->setContent($form->getHTML().$pf."</form>");
2743
2744 $ilTabs->clearTargets();
2745 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
2746 if ($a_confirm)
2747 {
2748 if ($form->isCorrect())
2749 {
2750 $ilToolbar->addFormButton($lng->txt("insert"), "performLMChapterInsert");
2751 }
2752 $ilToolbar->addFormButton($lng->txt("back"), "insertLMChapterClip");
2753 }
2754 else
2755 {
2756 $ilToolbar->addFormButton($lng->txt("check"), "confirmLMChapterInsert");
2757 }
2758 $ilToolbar->addFormButton($lng->txt("cancel"), "showOrganization");
2759 $ilToolbar->setCloseFormTag(false);
2760
2761 }
2762
2767 {
2768 $this->insertLMChapterClip(true);
2769 }
2770
2775 {
2778
2779 include_once("./Modules/Scorm2004/classes/class.ilLMChapterImportForm.php");
2780 $form = new ilLMChapterImportForm($this->object, $node_id, $first_child);
2781 $form->performInserts();
2782 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
2783 $this->ctrl->redirect($this, "showOrganization");
2784 }
2785
2787 {
2788 $export = new ilScorm2004Export($this->object,'SCORM 2004 4th');
2789 $export->buildExportFile();
2790 ilUtil::sendSuccess($this->lng->txt("exp_file_created"), true);
2791 $this->ctrl->redirect($this, "showExportList");
2792 }
2793
2795 {
2796 $export = new ilScorm2004Export($this->object,'SCORM 2004 3rd');
2797 $export->buildExportFile();
2798 ilUtil::sendSuccess($this->lng->txt("exp_file_created"), true);
2799 $this->ctrl->redirect($this, "showExportList");
2800 }
2801
2802 function exportScorm12()
2803 {
2804 $export = new ilScorm2004Export($this->object,'SCORM 1.2');
2805 $export->buildExportFile();
2806 ilUtil::sendSuccess($this->lng->txt("exp_file_created"), true);
2807 $this->ctrl->redirect($this, "showExportList");
2808 }
2809
2810 function exportHTML()
2811 {
2812 $export = new ilScorm2004Export($this->object,'HTML');
2813 $export->buildExportFile();
2814 ilUtil::sendSuccess($this->lng->txt("exp_file_created"), true);
2815 $this->ctrl->redirect($this, "showExportList");
2816 }
2817
2818 function exportHTMLOne()
2819 {
2820 $export = new ilScorm2004Export($this->object,'HTMLOne');
2821 $export->buildExportFile();
2822 ilUtil::sendSuccess($this->lng->txt("exp_file_created"), true);
2823 $this->ctrl->redirect($this, "showExportList");
2824 }
2825
2826 function exportISO()
2827 {
2828 $export = new ilScorm2004Export($this->object,'ISO');
2829 if(!$export->buildExportFile())
2830 {
2831 if(!PATH_TO_MKISOFS)
2832 $this->ilias->raiseError($this->lng->txt("no_mkisofs_configured"),$this->ilias->error_obj->MESSAGE);
2833 }
2834 $this->ctrl->redirect($this, "showExportList");
2835 }
2836
2837 function exportPDF()
2838 {
2839 $export = new ilScorm2004Export($this->object,'PDF');
2840 $export->buildExportFile();
2841 $this->ctrl->redirect($this, "showExportList");
2842 }
2843
2845 {
2846 $export = new ilSCORM2004Export($this->object);
2847
2848 $export_dir = $export->getExportDirectoryForType($_GET['type']);
2849 ilUtil::deliverFile($export_dir."/".$_GET['file'], $_GET['file']);
2850 }
2851
2856 {
2857 if(!isset($_POST["file"]))
2858 {
2859 ilUtil::sendInfo($this->lng->txt("no_checkbox"),true);
2860 $this->ctrl->redirect($this, "showExportList");
2861 }
2862
2863 ilUtil::sendQuestion($this->lng->txt("info_delete_sure"));
2864 $export_files = $this->object->getExportFiles();
2865
2866 include_once "./Modules/Scorm2004/classes/class.ilSCORM2004ExportTableGUI.php";
2867 $table_gui = new ilSCORM2004ExportTableGUI($this, 'showExportList', true);
2868 $data = array();
2869 foreach ($export_files as $exp_file)
2870 {
2871 foreach ($_POST['file'] as $delete_file)
2872 {
2873 if (strcmp($delete_file, $exp_file['file']) == 0)
2874 {
2875 $public_str = ($exp_file["file"] == $this->object->getPublicExportFile($exp_file["type"]))
2876 ? " <b>(".$this->lng->txt("public").")<b>"
2877 : "";
2878 $file_arr = explode("__", $exp_file["file"]);
2879 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));
2880 }
2881 }
2882 }
2883 $table_gui->setData($data);
2884 $this->tpl->setVariable('ADM_CONTENT', $table_gui->getHTML());
2885 }
2886
2891 {
2892 ilSession::clear("ilExportFiles");
2893 $this->ctrl->redirect($this, "showExportList");
2894 }
2895
2896
2901 {
2902 include_once "./Services/Utilities/classes/class.ilUtil.php";
2903 $export = new ilSCORM2004Export($this->object);
2904 foreach($_POST['file'] as $idx => $file)
2905 {
2906 $export_dir = $export->getExportDirectoryForType($_POST['type'][$idx]);
2907 $exp_file = $export_dir."/".$file;
2908 if (@is_file($exp_file))
2909 {
2910 unlink($exp_file);
2911 }
2912 }
2913 ilUtil::sendSuccess($this->lng->txt('msg_deleted_export_files'), true);
2914 $this->ctrl->redirect($this, "showExportList");
2915 }
2916
2917 /*
2918 * download export file
2919 */
2921 {
2922 if(!isset($_POST["file"]))
2923 {
2924 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
2925 }
2926 if (count($_POST["file"]) > 1)
2927 {
2928 $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
2929 }
2930
2931 $export = new ilSCORM2004Export($this->object);
2932 $file = $_POST['file'][0];
2933 $type = $_POST['type'][$_POST['file'][0]];
2934
2935 if ($this->object->getPublicExportFile($type) == $file)
2936 {
2937 $this->object->setPublicExportFile($type, "");
2938 }
2939 else
2940 {
2941 $this->object->setPublicExportFile($type, $file);
2942 }
2943 $this->object->update();
2944 $this->ctrl->redirect($this, "showExportList");
2945 }
2946
2947 /*
2948 * perform silent scorm 2004 export and import for view player
2949 */
2950 function preview()
2951 {
2952 global $ilias;
2953
2954 $export = new ilScorm2004Export($this->object,'SCORM 2004 3rd');
2955 $zipfile = $export->buildExportFile();
2956 $zipPathinfo = pathinfo($zipfile);
2957 $file_path = $this->object->getDataDirectory()."/".($zipPathinfo["basename"]);
2958 copy($zipfile,$file_path);
2959 unlink($zipfile);
2960
2961 ilUtil::unzip($file_path,true);
2962 ilUtil::renameExecutables($this->object->getDataDirectory());
2963 unlink($file_path);
2964
2965 include_once ("./Modules/Scorm2004/classes/ilSCORM13Package.php");
2966 $rte_pkg = new ilSCORM13Package();
2967 $rte_pkg->il_import($this->object->getDataDirectory(),$this->object->getId(),$ilias,false,true);
2968
2969 //increase module version is it necessary?
2970 //$this->object->setModuleVersion($module_version+1);
2971 //$this->object->update();
2972
2973 //redirect to view player
2974 ilUtil::redirect("ilias.php?baseClass=ilSAHSPresentationGUI&ref_id=".$this->object->getRefID()."&envEditor=1");
2975 }
2976
2977
2978}
2979?>
print $file
$n
Definition: RandomTest.php:80
global $l
Definition: afr.php:30
$_GET["client_id"]
$_SESSION["AccountId"]
const IL_CAL_UNIX
const IL_FM_POSITIVE
const IL_FIRST_NODE
Definition: class.ilTree.php:5
This class represents a checkbox property in a property form.
Confirmation screen class.
static formatDate(ilDateTime $date)
Format a date @access public.
@classDescription Date and time handling
This class represents a section header in a property form.
Class ilFramesetGUI.
Select file for being added into file lists.
static getPostNodeId()
Get node ID of _POST input.
static getPostFields()
Get all post fields.
static getPostFirstChild()
Should node be inserted as first child of target node (true) or as successor (false)
static getPostMulti()
Get multi number of _POST input.
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
This class represents a non editable value in a property form.
Notes GUI class.
This class represents a number property in a property form.
Class ilObjGlossary.
setTabs()
output main frameset of media pool left frame: explorer tree of folders right frame: media pool conte...
getTemplate()
output main header (title and locator)
_lookupSubType($a_obj_id)
lookup subtype id (scorm, aicc, hacp)
insertTemplate($a_redirect=true)
Insert (multiple) pages at node.
getPropertiesEditableValues()
Get current values for properties (editable) from.
insertScenarioGUI()
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...
initPropertiesEditableForm()
Init properties (editable) form.
insertLMChapterClip($a_confirm=false, $a_perform=false)
Insert chapter from clipboard.
jumpToNode($a_anchor_node="", $a_highlight_ids="")
deleteNodes($a_form_action="")
confirm deletion screen of chapters/scos/pages
cancelDeleteExportFile()
cancel deletion of export files
insertSco($a_redirect=true)
Insert (multiple) scos at node.
confirmDeleteExportFile()
confirmation screen for export file deletion
ilObjSCORM2004LearningModuleGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
Constructor.
assignObject()
assign scorm object to scorm gui object
editOrganization($a_to_organization=true)
Edit organization (called from listgui, must setup frameset)
getTabs(&$tabs_gui)
Adds tabs to tab gui object.
selectExport()
Select the export type of the SCORM 2004 module.
showTrackingItems()
Show tracking table @global ilTabs $ilTabs $global ilToolbar $ilToolbar.
copyItems($a_return="showOrganization")
Copy items to clipboard.
insertScenario()
Insert sequencing scenario at node.
confirmedDelete($a_redirect=true)
Delete chapters/scos/pages.
insertChapter($a_redirect=true)
Insert (multiple) chapters at node.
insertTemplateGUI($a_redirect=true, $a_special_page=false)
Displays GUI to select template for page.
insertAsset($a_redirect=true)
Insert (multiple) assets at node.
saveAllTitles($a_redirect=true)
Save all titles of chapters/scos/pages.
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.
setSubTabs($a_main_tab, $a_active)
Set sub tabs.
insertSpecialPage($a_redirect=true)
Insert special page.
cutItems($a_return="showOrganization")
Copy items to clipboard, then cut them from the current tree.
confirmExpertMode()
Confirm activation of expert mode.
insertPage($a_redirect=true)
Insert (multiple) pages at node.
saveProperties()
save scorm 2004 module properties
showLearningObjectivesAlignment()
Show Learning Objectives Alignment.
Class ilObjSCORM2004LearningModule.
Class ilObjSCORMLearningModuleGUI.
_getStandardStyles($a_exclude_default_style=false, $a_include_deactivated=false, $a_scope=0)
Get standard styles.
_lookupStandard($a_id)
Lookup standard flag.
ilObjectGUI($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Constructor @access public.
addHeaderAction()
Add header action menu.
setLocator()
set Locator
Class ilObjectMetaDataGUI.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
static _lookupType($a_id, $a_reference=false)
lookup object type
TableGUI class for learning objectives alignments.
static activeLayouts($a_special_page=false, $a_module=null)
Get active layouts.
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
Class ilSCORM2004AssetGUI.
Class ilSCORM2004Asset.
Class ilSCORM2004ChapterGUI.
Class ilSCORM2004Chapter.
removeCMIDataForUserAndPackage($user_id, $packageId)
Class ilSCORM2004Condition.
static getInstance($a_slm_object, $a_id=0, $a_halt=true)
static uniqueTypesCheck($a_items)
Check for unique types (all pages or all chapters or all scos)
insertChapterClip($a_slm_obj, $a_as_sub=false)
Insert Chapter from clipboard.
clipboardCut($a_slm_obj_id, $a_ids)
Cut and copy a set of chapters/pages into the clipboard.
static _lookupType($a_obj_id)
Lookup Type.
static insertAssetClip($a_slm_obj, $a_type="ass")
Insert assets from clipboard.
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
put this object into content object tree
static clipboardCopy($a_slm_obj_id, $a_ids)
Copy a set of chapters/pages/scos into the clipboard.
static insertPageClip($a_slm_obj)
Insert pages from clipboard.
static insertScoClip($a_slm_obj)
Insert scos from clipboard.
static _writeTitle($a_obj_id, $a_title)
Write Title.
This class allows quick editing of a chapter/sco/page hierarchy.
Class ilSCORM2004PageNodeGUI.
Class ilSCORM2004PageNode.
Class ilSCORM2004ScoGUI.
Class ilSCORM2004Sco.
Class ilSCORM2004Chapter.
Export class for SCORM 2004 object.
This class represents a selection list property in a property form.
static clear($a_var)
Unset a value.
special template class to simplify handling of ITX/PEAR
This class represents a text area property in a property form.
This class represents a text property in a property form.
static getParticipantsForObject($a_ref_id)
Get participant ids for given object.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static redirect($a_script)
http redirect to other script
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static yn2tf($a_yn)
convert "y"/"n" to true/false
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
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 getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.
static initjQuery($a_tpl=null)
Init jQuery.
$_POST['username']
Definition: cron.php:12
$html
Definition: example_001.php:87
$tbl
Definition: example_048.php:81
$rest
Definition: goto.php:85
global $ilCtrl
Definition: ilias.php:18
exit
Definition: login.php:54
redirection script todo: (a better solution should control the processing via a xml file)
global $ilSetting
Definition: privfeed.php:40
$cmd
Definition: sahs_server.php:35
$path
Definition: index.php:22
if(!is_array($argv)) $options
global $ilUser
Definition: imgupload.php:15