ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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/Content/classes/class.ilObjStyleSheetGUI.php");
8include_once("./Services/COPage/Layout/classes/class.ilPageLayout.php");
9
25{
31 function __construct($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 parent::__construct($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 }
185 else // otherwise show standard frameset
186 {
187 $this->tpl = new ilTemplate("tpl.sahs_edit_frameset.html", false, false, "Modules/ScormAicc");
188 $this->tpl->setVariable("SRC",
189 $this->ctrl->getLinkTarget($this, "properties"));
190 $this->tpl->show("DEFAULT", false);
191 }
192 exit;
193 }
194
195 function jumpToNode($a_anchor_node = "", $a_highlight_ids = "")
196 {
197 global $ilCtrl;
198
199 $anchor = ($a_anchor_node != "")
200 ? "node_".$a_anchor_node
201 : "";
202
203 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
204 $type = ilSCORM2004Node::_lookupType($_GET["obj_id"]);
205 $ilCtrl->setParameter($this, "obj_id", $_GET["obj_id"]);
206 switch($type)
207 {
208 case "sco":
209 $ilCtrl->setParameterByClass("ilscorm2004scogui", "highlight", $a_highlight_ids);
210 $ilCtrl->redirectByClass("ilscorm2004scogui", "showOrganization", $anchor);
211 case "ass":
212 $ilCtrl->setParameterByClass("ilscorm2004assetgui", "highlight", $a_highlight_ids);
213 $ilCtrl->redirectByClass("ilscorm2004assetgui", "showOrganization", $anchor);
214 case "chap":
215 $ilCtrl->setParameterByClass("ilscorm2004chaptergui", "highlight", $a_highlight_ids);
216 $ilCtrl->redirectByClass("ilscorm2004chaptergui", "showOrganization", $anchor);
217 case "seqc":
218 $ilCtrl->setParameterByClass("ilscorm2004seqchaptergui", "highlight", $a_highlight_ids);
219 $ilCtrl->redirectByClass("ilscorm2004seqchaptergui", "showOrganization", $anchor);
220 case "page":
221 $ilCtrl->redirectByClass("ilscorm2004pagenodegui", "edit");
222 }
223 }
224
228 function properties()
229 {
230 global $rbacsystem, $tree, $tpl, $lng, $ilToolbar, $ilCtrl, $ilSetting, $ilTabs;
231
232 $this->setSubTabs("settings", "general_settings");
233
234 $lng->loadLanguageModule("style");
235
236 // not editable
237 if ($this->object->editable != 1)
238 {
240 $ilTabs->setSubTabActive('cont_settings');
241 // view
242 $ilToolbar->addButton($this->lng->txt("view"),
243 "ilias.php?baseClass=ilSAHSPresentationGUI&amp;ref_id=".$this->object->getRefID(),
244 "_blank");
245 }
246 else // editable
247 {
248 // glossary buttons to toolbar
249 $sep = false;
250 if (ilObject::_lookupType($this->object->getAssignedGlossary()) != "glo")
251 {
252 $parent_ref_id = $tree->getParentId((int) $_GET["ref_id"]);
253 if ($rbacsystem->checkAccess("create", $parent_ref_id, "glo"))
254 {
255 $ilToolbar->addButton($this->lng->txt("cont_glo_create"),
256 $ilCtrl->getLinkTarget($this, "createGlossary"));
257 }
258 $ilToolbar->addButton($this->lng->txt("cont_glo_assign"),
259 $ilCtrl->getLinkTarget($this, "assignGlossary"));
260 }
261 else
262 {
263 $ilToolbar->addButton($this->lng->txt("cont_glo_detach"),
264 $ilCtrl->getLinkTarget($this, "detachGlossary"));
265 }
266
267 // style buttons to toolbar
268 $fixed_style = $ilSetting->get("fixed_content_style_id");
269 $style_id = $this->object->getStyleSheetId();
270
271 if ($fixed_style == 0)
272 {
273 $st_styles = ilObjStyleSheet::_getStandardStyles(true, false,
274 $_GET["ref_id"]);
275
276 $st_styles[0] = $this->lng->txt("default");
277 ksort($st_styles);
278
279 if ($style_id > 0)
280 {
281 // individual style
282 if (!ilObjStyleSheet::_lookupStandard($style_id))
283 {
284 $ilToolbar->addSeparator();
285
286 // delete command
287 $ilToolbar->addButton($this->lng->txt("cont_edit_style"),
288 $ilCtrl->getLinkTarget($this, "editStyle"));
289 $ilToolbar->addButton($this->lng->txt("cont_delete_style"),
290 $ilCtrl->getLinkTarget($this, "deleteStyle"));
291 }
292 }
293
294 if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id))
295 {
296 $ilToolbar->addSeparator();
297
298 $ilToolbar->addButton($this->lng->txt("sty_create_ind_style"),
299 $ilCtrl->getLinkTarget($this, "createStyle"));
300 }
301 }
302 }
303
304 // output forms
305 if ($this->object->editable != 1)
306 {
307 $this->initPropertiesForm();
308 $tpl->setContent($this->form->getHTML());
309 }
310 else
311 {
314 $tpl->setContent($this->form->getHTML());
315 }
316 }
317
325 {
326 global $lng, $ilCtrl;
327
328 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
329 $this->form = new ilPropertyFormGUI();
330 $this->form->setFormAction($ilCtrl->getFormAction($this));
331 $this->form->setTitle($this->lng->txt("cont_lm_properties"));
332
333 //check/select only once
334 $this->object->checkMasteryScoreValues();
335
336 //title
337 $ti = new ilTextInputGUI($this->lng->txt("title"), "Fobject_title");
338 $ti->setMaxLength(200);
339 $ti->setValue($this->object->getTitle());
340 $this->form->addItem($ti);
341
342 //description
343 $ti = new ilTextAreaInputGUI($this->lng->txt("description"), "Fobject_description");
344 $ti->setValue($this->object->getDescription());
345 $this->form->addItem($ti);
346
347 // SCORM-type
348 $ne = new ilNonEditableValueGUI($this->lng->txt("type"), "");
349 $ne->setValue($this->lng->txt( "lm_type_" . ilObjSAHSLearningModule::_lookupSubType( $this->object->getID() ) ) );
350 $this->form->addItem($ne);
351
352 // version
353 $ne = new ilNonEditableValueGUI($this->lng->txt("cont_sc_version"), "");
354 $ne->setValue($this->object->getModuleVersion());
355 $ne->setInfo($this->lng->txt("cont_sc_version_info"));
356 $this->form->addItem($ne);
357
358 //
359 // activation
360 //
361 $sh = new ilFormSectionHeaderGUI();
362 $sh->setTitle($this->lng->txt("activation"));
363 $this->form->addItem($sh);
364
365 // online
366 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_online"), "cobj_online");
367 $cb->setValue("y");
368 if ($this->object->getOnline())
369 {
370 $cb->setChecked(true);
371 }
372 $cb->setInfo($this->lng->txt("cont_online_info"));
373 $this->form->addItem($cb);
374
375 // offline Mode
376 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_offline_mode_allow"), "cobj_offline_mode");
377 $cb->setValue("y");
378 $cb->setChecked($this->object->getOfflineMode());
379 include_once("./Modules/ScormAicc/classes/class.ilSCORMOfflineMode.php");
380 if ($this->object->getOfflineMode()== true && ilSCORMOfflineMode::checkIfAnyoneIsInOfflineMode($this->object->getID()) == true) {
381 $cb->setDisabled(true);
382 $cb->setInfo($this->lng->txt("cont_offline_mode_disable_not_allowed_info"));
383 } else {
384 $cb->setInfo($this->lng->txt("cont_offline_mode_allow_info"));
385 }
386 $this->form->addItem($cb);
387
388 //
389 // presentation
390 //
391 $sh = new ilFormSectionHeaderGUI();
392 $sh->setTitle($this->lng->txt("cont_presentation"));
393 $this->form->addItem($sh);
394
395 // display mode (open)
396 // $options = array(
397 // "0" => $this->lng->txt("cont_open_normal"),
398 // "1" => $this->lng->txt("cont_open_iframe_max"),
399 // "2" => $this->lng->txt("cont_open_iframe_defined"),
400 // "5" => $this->lng->txt("cont_open_window_undefined"),
401 // "6" => $this->lng->txt("cont_open_window_defined")
402 // );
403 // $si = new ilSelectInputGUI($this->lng->txt("cont_open"), "open_mode");
404 // $si->setOptions($options);
405 // $si->setValue($this->object->getOpenMode());
406 // $this->form->addItem($si);
407
408 $radg = new ilRadioGroupInputGUI($lng->txt("cont_open"), "open_mode");
409 $op0 = new ilRadioOption($this->lng->txt("cont_open_normal"), "0");
410 $radg->addOption($op0);
411 $op1 = new ilRadioOption($this->lng->txt("cont_open_iframe"), "1");
412 $radg->addOption($op1);
413 $op2 = new ilRadioOption($this->lng->txt("cont_open_window"), "5");
414 $radg->addOption($op2);
415 $radg->setValue($this->object->getOpenMode()); //ACHTUNG: DATENBANK
416 // width
417 $ni = new ilNumberInputGUI($this->lng->txt("cont_width"), "width_0");
418 $ni->setMaxLength(4);
419 $ni->setSize(4);
420 $ni->setValue($this->object->getWidth());
421 $op1->addSubItem($ni);
422 $ni = new ilNumberInputGUI($this->lng->txt("cont_width"), "width_1");
423 $ni->setMaxLength(4);
424 $ni->setSize(4);
425 $ni->setValue($this->object->getWidth());
426 $op2->addSubItem($ni);
427 // height
428 $ni = new ilNumberInputGUI($this->lng->txt("cont_height"), "height_0");
429 $ni->setMaxLength(4);
430 $ni->setSize(4);
431 $ni->setValue($this->object->getHeight());
432 $ni->setInfo($this->lng->txt("cont_width_height_info"));
433 $op1->addSubItem($ni);
434 $ni = new ilNumberInputGUI($this->lng->txt("cont_height"), "height_1");
435 $ni->setMaxLength(4);
436 $ni->setSize(4);
437 $ni->setValue($this->object->getHeight());
438 $ni->setInfo($this->lng->txt("cont_width_height_info"));
439 $op2->addSubItem($ni);
440
441 // set IE compatibility mode
442 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_ie_compatibility"), "cobj_ie_compatibility_0");
443 $cb->setValue("y");
444 $cb->setChecked($this->object->getIe_compatibility());
445 $cb->setInfo($this->lng->txt("cont_ie_compatibility_info"));
446 $op0->addSubItem($cb);
447 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_ie_compatibility"), "cobj_ie_compatibility_1");
448 $cb->setValue("y");
449 $cb->setChecked($this->object->getIe_compatibility());
450 $cb->setInfo($this->lng->txt("cont_ie_compatibility_info"));
451 $op2->addSubItem($cb);
452
453 // force IE to render again
454 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_ie_force_render"), "cobj_ie_force_render");
455 $cb->setValue("y");
456 $cb->setChecked($this->object->getIe_force_render());
457 $cb->setInfo($this->lng->txt("cont_ie_force_render_info"));
458 $op2->addSubItem($cb);
459
460 $this->form->addItem($radg);
461
462
463 // disable top menu
464 //Hide Top Navigation Bar
465 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_nomenu"), "cobj_nomenu");
466 $cb->setValue("y");
467 $cb->setChecked($this->object->getNoMenu());
468 $cb->setInfo($this->lng->txt("cont_nomenu_info"));
469 $this->form->addItem($cb);
470
471 // disable left-side navigation
472 // Hide Left Navigation Tree
473 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_hidenavig"), "cobj_hidenavig");
474 $cb->setValue("y");
475 $cb->setChecked($this->object->getHideNavig());
476 $cb->setInfo($this->lng->txt("cont_hidenavig_info"));
477 $this->form->addItem($cb);
478
479 // auto navigation to last visited item
480 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_auto_last_visited"), "cobj_auto_last_visited");
481 $cb->setValue("y");
482 $cb->setChecked($this->object->getAuto_last_visited());
483 $cb->setInfo($this->lng->txt("cont_auto_last_visited_info"));
484 $this->form->addItem($cb);
485
486
487 //
488 // scorm options
489 //
490 $sh = new ilFormSectionHeaderGUI();
491 $sh->setTitle($this->lng->txt("cont_scorm_options"));
492 $this->form->addItem($sh);
493
494 // max attempts
495 //ACHTUNG: DATENBANK KORRIGIEREN
496 // $ni = new ilNumberInputGUI($this->lng->txt("cont_sc_max_attempt"), "max_attempt");
497 // $ni->setMaxLength(3);
498 // $ni->setSize(3);
499 // $ni->setValue($this->object->getMaxAttempt());
500 // $this->form->addItem($ni);
501
502 // lesson mode
503 $options = array("normal" => $this->lng->txt("cont_sc_less_mode_normal"),
504 "browse" => $this->lng->txt("cont_sc_less_mode_browse"));
505 $si = new ilSelectInputGUI($this->lng->txt("cont_def_lesson_mode"), "lesson_mode");
506 $si->setOptions($options);
507 $si->setValue($this->object->getDefaultLessonMode());
508 $this->form->addItem($si);
509
510 // credit mode
511 $options = array("credit" => $this->lng->txt("cont_credit_on"),
512 "no_credit" => $this->lng->txt("cont_credit_off"));
513 $si = new ilSelectInputGUI($this->lng->txt("cont_credit_mode"), "credit_mode");
514 $si->setOptions($options);
515 $si->setValue($this->object->getCreditMode());
516 $si->setInfo($this->lng->txt("cont_credit_mode_info"));
517 $this->form->addItem($si);
518
519 // set lesson mode review when completed
520 $options = array(
521 "n" => $this->lng->txt("cont_sc_auto_review_no"),
522 "r" => $this->lng->txt("cont_sc_auto_review_completed_not_failed_or_passed"),
523 "p" => $this->lng->txt("cont_sc_auto_review_passed"),
524 "q" => $this->lng->txt("cont_sc_auto_review_passed_or_failed"),
525 "c" => $this->lng->txt("cont_sc_auto_review_completed"),
526 "d" => $this->lng->txt("cont_sc_auto_review_completed_and_passed"),
527 "y" => $this->lng->txt("cont_sc_auto_review_completed_or_passed"),
528 "s" => $this->lng->txt("cont_sc_store_if_previous_score_was_lower")
529 );
530 $si = new ilSelectInputGUI($this->lng->txt("cont_sc_auto_review_2004"), "auto_review");
531 $si->setOptions($options);
532 $si->setValue($this->object->getAutoReviewChar());
533 $si->setInfo($this->lng->txt("cont_sc_auto_review_info_2004"));
534 $this->form->addItem($si);
535
536 // mastery_score
537 if ($this->object->getMasteryScoreValues() != "") {
538 $ni = new ilNumberInputGUI($this->lng->txt("cont_mastery_score_2004"), "mastery_score");
539 $ni->setMaxLength(3);
540 $ni->setSize(3);
541 $ni->setValue($this->object->getMasteryScore());
542 $ni->setInfo($this->lng->txt("cont_mastery_score_2004_info").$this->object->getMasteryScoreValues());
543 $this->form->addItem($ni);
544 }
545
546 //
547 // rte settings
548 //
549 $sh = new ilFormSectionHeaderGUI();
550 $sh->setTitle($this->lng->txt("cont_rte_settings"));
551 $this->form->addItem($sh);
552
553 // unlimited session timeout
554 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_sc_usession"), "cobj_session");
555 $cb->setValue("y");
556 $cb->setChecked($this->object->getSession());
557 $cb->setInfo($this->lng->txt("cont_sc_usession_info"));
558 $this->form->addItem($cb);
559
560 // SCORM 2004 fourth edition features
561 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_fourth_edition"), "cobj_fourth_edition");
562 $cb->setValue("y");
563 $cb->setChecked($this->object->getFourth_edition());
564 $cb->setInfo($this->lng->txt("cont_fourth_edition_info"));
565 $this->form->addItem($cb);
566
567 // sequencing
568 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_sequencing"), "cobj_sequencing");
569 $cb->setValue("y");
570 $cb->setChecked($this->object->getSequencing());
571 $cb->setInfo($this->lng->txt("cont_sequencing_info"));
572 $this->form->addItem($cb);
573
574 // storage of interactions
575 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_interactions"), "cobj_interactions");
576 $cb->setValue("y");
577 $cb->setChecked($this->object->getInteractions());
578 $cb->setInfo($this->lng->txt("cont_interactions_info"));
579 $this->form->addItem($cb);
580
581 // objectives
582 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_objectives"), "cobj_objectives");
583 $cb->setValue("y");
584 $cb->setChecked($this->object->getObjectives());
585 $cb->setInfo($this->lng->txt("cont_objectives_info"));
586 $this->form->addItem($cb);
587
588 // comments
589 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_comments"), "cobj_comments");
590 $cb->setValue("y");
591 $cb->setChecked($this->object->getComments());
592 $cb->setInfo($this->lng->txt("cont_comments_info"));
593 $this->form->addItem($cb);
594
595 // time from lms
596 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_time_from_lms"), "cobj_time_from_lms");
597 $cb->setValue("y");
598 $cb->setChecked($this->object->getTime_from_lms());
599 $cb->setInfo($this->lng->txt("cont_time_from_lms_info"));
600 $this->form->addItem($cb);
601
602 // check values
603 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_check_values"), "cobj_check_values");
604 $cb->setValue("y");
605 $cb->setChecked($this->object->getCheck_values());
606 $cb->setInfo($this->lng->txt("cont_check_values_info"));
607 $this->form->addItem($cb);
608
609 // auto cmi.exit to suspend
610 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_auto_suspend"), "cobj_auto_suspend");
611 $cb->setValue("y");
612 $cb->setChecked($this->object->getAutoSuspend());
613 $cb->setInfo($this->lng->txt("cont_auto_suspend_info"));
614 $this->form->addItem($cb);
615
616 //
617 // debugging
618 //
619 $sh = new ilFormSectionHeaderGUI();
620 $sh->setTitle($this->lng->txt("cont_debugging"));
621 $this->form->addItem($sh);
622
623 // test tool
624 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_debug"), "cobj_debug");
625 $cb->setValue("y");
626 $cb->setChecked($this->object->getDebug());
627 if ($this->object->getDebugActivated() == false)
628 {
629 $cb->setDisabled(true);
630 $cb->setInfo($this->lng->txt("cont_debug_deactivated"));
631 }
632 else
633 {
634 $cb->setInfo($this->lng->txt("cont_debug_deactivate"));
635 }
636 $this->form->addItem($cb);
637 $this->form->addCommandButton("saveProperties", $lng->txt("save"));
638 }
639
640
645 {
646 global $lng, $ilCtrl, $tree, $rbacsystem, $ilSetting;
647
648 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
649 $this->form = new ilPropertyFormGUI();
650
651 // localization
652 $options = array(
653 "" => $lng->txt("please_select"),
654 );
655 $langs = $lng->getInstalledLanguages();
656 $lng->loadLanguageModule("meta");
657 foreach ($langs as $l)
658 {
659 $options[$l] = $lng->txt("meta_l_".$l);
660 }
661 $loc = new ilSelectInputGUI($this->lng->txt("cont_localization"), "localization");
662 $loc->setOptions($options);
663 $loc->setInfo($this->lng->txt("cont_localization_info"));
664 $this->form->addItem($loc);
665
666 // glossary
667 $ne = new ilNonEditableValueGUI($lng->txt("obj_glo"), "glossary");
668 $this->form->addItem($ne);
669
670 // style
671 $lng->loadLanguageModule("style");
672 $fixed_style = $ilSetting->get("fixed_content_style_id");
673 $style_id = $this->object->getStyleSheetId();
674
675 if ($fixed_style > 0)
676 {
677 $st = new ilNonEditableValueGUI($lng->txt("cont_current_style"));
678 $st->setValue(ilObject::_lookupTitle($fixed_style)." (".
679 $this->lng->txt("global_fixed").")");
680 $this->form->addItem($st);
681 }
682 else
683 {
684 $st_styles = ilObjStyleSheet::_getStandardStyles(true, false,
685 $_GET["ref_id"]);
686
687 $st_styles[0] = $this->lng->txt("default");
688 ksort($st_styles);
689
690 if ($style_id > 0)
691 {
692 // individual style
693 if (!ilObjStyleSheet::_lookupStandard($style_id))
694 {
695 $st = new ilNonEditableValueGUI($lng->txt("cont_current_style"));
696 $st->setValue(ilObject::_lookupTitle($style_id));
697 $this->form->addItem($st);
698 }
699 }
700
701 if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id))
702 {
703 $style_sel = ilUtil::formSelect ($style_id, "style_id",
704 $st_styles, false, true);
705 $style_sel = new ilSelectInputGUI($lng->txt("cont_current_style"), "style_id");
706 $style_sel->setOptions($st_styles);
707 $style_sel->setValue($style_id);
708 $this->form->addItem($style_sel);
709 }
710 }
711
712 // number of tries
713 $ni = new ilNumberInputGUI($lng->txt("cont_qtries"), "q_tries");
714 $ni->setInfo($lng->txt("cont_qtries_info")); // #15133
715 $ni->setMaxLength(3);
716 $ni->setSize(3);
717 $this->form->addItem($ni);
718
719
720 $this->form->addCommandButton("saveProperties", $lng->txt("save"));
721
722 $this->form->setTitle($lng->txt("cont_scorm_ed_properties"));
723 $this->form->setFormAction($ilCtrl->getFormAction($this));
724 }
725
730 {
731 $values = array();
732
733 if (ilObject::_lookupType($this->object->getAssignedGlossary()) == "glo")
734 {
735 $values["glossary"] = ilObject::_lookupTitle($this->object->getAssignedGlossary());
736 }
737 else
738 {
739 $values["glossary"] = $this->lng->txt("cont_no_glossary");
740 }
741 $values["q_tries"] = $this->object->getTries();
742 $values["localization"] = $this->object->getLocalization();
743 $values["style_id"] = $this->object->getStyleSheetId();
744
745 $this->form->setValuesByArray($values);
746 }
747
751 function saveProperties()
752 {
753 global $ilSetting;
754
755 if ($this->object->editable != 1)
756 {
757 //check if OfflineMode-Zip has to be created
758 $tmpOfflineMode= ilUtil::yn2tf($_POST["cobj_offline_mode"]);
759 $tmpFourth_edition = ilUtil::yn2tf($_POST["cobj_fourth_edition"]);
760 $tmpSequencing = ilUtil::yn2tf($_POST["cobj_sequencing"]);
761 if ($tmpOfflineMode == true) {
762// $tmpSequencing = false; //actually no sequencing for offline_mode
763 $tmpFourth_edition = false; //4th edition is not possible
764 if ($this->object->getOfflineMode() == false) {
765 $this->object->zipLmForOfflineMode();
766 }
767 }
768
769 if (isset($_POST["mastery_score"])){
770 $this->object->setMasteryScore($_POST["mastery_score"]);
771 // $this->object->updateMasteryScoreValues();
772 }
773
774 $t_auto_review = $_POST["auto_review"];
775 $t_auto_suspend = ilUtil::yn2tf($_POST["cobj_auto_suspend"]);
776 $t_session = ilUtil::yn2tf($_POST["cobj_session"]);
777 if ($t_auto_review == "s") {
778 $t_auto_suspend = true;
779 //if not storing without session
780 $t_session = true;
781 }
782
783 $t1_ie_compatibility = false;
784 if (ilUtil::yn2tf($_POST["cobj_ie_compatibility_0"]) != $this->object->getIe_compatibility()) $t_ie_compatibility = ilUtil::yn2tf($_POST["cobj_ie_compatibility_0"]);
785 if (ilUtil::yn2tf($_POST["cobj_ie_compatibility_1"]) != $this->object->getIe_compatibility()) $t_ie_compatibility = ilUtil::yn2tf($_POST["cobj_ie_compatibility_1"]);
786
787 $t_height = $this->object->getHeight();
788 if ($_POST["height_0"] != $this->object->getHeight()) $t_height = $_POST["height_0"];
789 if ($_POST["height_1"] != $this->object->getHeight()) $t_height = $_POST["height_1"];
790
791 $t_width = $this->object->getWidth();
792 if ($_POST["width_0"] != $this->object->getWidth()) $t_width = $_POST["width_0"];
793 if ($_POST["width_1"] != $this->object->getWidth()) $t_width = $_POST["width_1"];
794
795 $this->object->setOnline(ilUtil::yn2tf($_POST["cobj_online"]));
796 $this->object->setOpenMode($_POST["open_mode"]);
797 $this->object->setWidth($t_width);
798 $this->object->setHeight($t_height);
799 $this->object->setCreditMode($_POST["credit_mode"]);
800 $this->object->setMaxAttempt($_POST["max_attempt"]);
801 $this->object->setAutoReviewChar($t_auto_review);
802 $this->object->setDefaultLessonMode($_POST["lesson_mode"]);
803 $this->object->setSession($t_session);
804 $this->object->setNoMenu(ilUtil::yn2tf($_POST["cobj_nomenu"]));
805 $this->object->setHideNavig(ilUtil::yn2tf($_POST["cobj_hidenavig"]));
806 $this->object->setAuto_last_visited(ilUtil::yn2tf($_POST["cobj_auto_last_visited"]));
807 $this->object->setIe_compatibility($t_ie_compatibility);
808 $this->object->setIe_force_render(ilUtil::yn2tf($_POST["cobj_ie_force_render"]));
809 $this->object->setFourth_edition($tmpFourth_edition);
810 $this->object->setSequencing($tmpSequencing);
811 $this->object->setInteractions(ilUtil::yn2tf($_POST["cobj_interactions"]));
812 $this->object->setObjectives(ilUtil::yn2tf($_POST["cobj_objectives"]));
813 $this->object->setComments(ilUtil::yn2tf($_POST["cobj_comments"]));
814 $this->object->setTime_from_lms(ilUtil::yn2tf($_POST["cobj_time_from_lms"]));
815 $this->object->setCheck_values(ilUtil::yn2tf($_POST["cobj_check_values"]));
816 $this->object->setAutoSuspend($t_auto_suspend);
817 $this->object->setOfflineMode($tmpOfflineMode);
818 $this->object->setDebug(ilUtil::yn2tf($_POST["cobj_debug"]));
819 //$this->object->setDebugPw($_POST["debug_pw"]);
820
821 $this->object->setTitle($_POST["Fobject_title"]);
822 $this->object->setDescription($_POST["Fobject_description"]);
823
824 }
825 else
826 {
828 if ($this->form->checkInput())
829 {
830 $this->object->setTries($_POST["q_tries"]);
831 $this->object->setLocalization($_POST["localization"]);
832
833 if ($ilSetting->get("fixed_content_style_id") <= 0 &&
834 (ilObjStyleSheet::_lookupStandard($this->object->getStyleSheetId())
835 || $this->object->getStyleSheetId() == 0))
836 {
837 $this->object->setStyleSheetId(ilUtil::stripSlashes($_POST["style_id"]));
838 }
839 }
840 }
841 $this->object->update();
842 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
843 $this->ctrl->redirect($this, "properties");
844 }
845
849 function detachGlossary()
850 {
851 global $ilCtrl;
852
853 $this->object->setAssignedGlossary(0);
854 $this->object->update();
855 $ilCtrl->redirect($this, "properties");
856 }
857
861 function createGlossary()
862 {
863 global $tpl;
864
866 $tpl->setContent($this->form->getHTML());
867 }
868
872 public function initGlossaryCreationForm()
873 {
874 global $lng, $ilCtrl;
875
876 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
877 $this->form = new ilPropertyFormGUI();
878
879 // title
880 $ti = new ilTextInputGUI($lng->txt("title"), "title");
881 $ti->setRequired(true);
882 $this->form->addItem($ti);
883
884 // description
885 $ta = new ilTextAreaInputGUI($lng->txt("desc"), "description");
886 $this->form->addItem($ta);
887
888 $this->form->addCommandButton("saveGlossary", $lng->txt("save"));
889 $this->form->addCommandButton("properties", $lng->txt("cancel"));
890
891 $this->form->setTitle($lng->txt("cont_glo_create"));
892 $this->form->setFormAction($ilCtrl->getFormAction($this));
893 }
894
898 public function saveGlossary()
899 {
900 global $tpl, $lng, $ilCtrl, $rbacsystem, $tree;
901
902 $parent_ref_id = $tree->getParentId((int) $_GET["ref_id"]);
903 if (!$rbacsystem->checkAccess("create", $parent_ref_id, "glo"))
904 {
905 ilUtil::sendFailure($lng->txt("no_permission"), true);
906 $ilCtrl->redirect($this, "properties");
907 }
908
910 if ($this->form->checkInput())
911 {
912 include_once("./Modules/Glossary/classes/class.ilObjGlossary.php");
913 $newObj = new ilObjGlossary();
914 $newObj->setType("glo");
915 $newObj->setTitle($_POST["title"]);
916 $newObj->setDescription($_POST["description"]);
917 $newObj->setVirtualMode("none");
918 $newObj->create();
919 $newObj->createReference();
920 $newObj->putInTree($parent_ref_id);
921 $newObj->setPermissions($parent_ref_id);
922
923 // perform save
924 $this->object->setAssignedGlossary($newObj->getId());
925 $this->object->update();
926
927 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
928 $ilCtrl->redirect($this, "properties");
929 }
930
931 $this->form->setValuesByPost();
932 $tpl->setContent($this->form->getHtml());
933 }
934
938 function assignGlossary()
939 {
940 global $tpl, $ilCtrl, $tree;
941
942 include_once("./Modules/Scorm2004/classes/class.ilGlossarySelectorGUI.php");
943 $exp = new ilGlossarySelectorGUI(
944 $ilCtrl->getLinkTarget($this, "selectGlossary"), "ilobjscorm2004learningmodulegui");
945 $exp->setSelectableTypes(array("glo"));
946
947 if ($_GET["expand"] == "")
948 {
949 $expanded = $tree->readRootId();
950 }
951 else
952 {
953 $expanded = $_GET["expand"];
954 }
955 $exp->setExpand($expanded);
956
957 $exp->setTargetGet("glo_id");
958 //$this->ctrl->setParameter($this, "target_type", $a_type);
959 //$ilCtrl->setParameter($this, "subCmd", "insertFromRepository");
960 $exp->setParamsGet($this->ctrl->getParameterArray($this, "assignGlossary"));
961
962 // filter
963 $exp->setFiltered(true);
964 $exp->setFilterMode(IL_FM_POSITIVE);
965 $exp->addFilter("root");
966 $exp->addFilter("cat");
967 $exp->addFilter("grp");
968 $exp->addFilter("fold");
969 $exp->addFilter("crs");
970 $exp->addFilter("glo");
971
972 $exp->setOutput(0);
973
974 $tpl->setContent($exp->getOutput());
975 }
976
980 function selectGlossary()
981 {
982 global $ilCtrl;
983
984 $this->object->setAssignedGlossary(ilObject::_lookupObjId((int) $_GET["glo_ref_id"]));
985 $this->object->update();
986 $ilCtrl->redirect($this, "properties");
987 }
988
992 function assignObject()
993 {
994 if ($this->id != 0)
995 {
996 if ($this->call_by_reference)
997 {
998 $this->object = new ilObjSCORM2004LearningModule($this->id, true);
999 }
1000 else
1001 {
1002 $this->object = new ilObjSCORM2004LearningModule($this->id, false);
1003 }
1004 }
1005 }
1006
1011 {
1012 global $tpl;
1013
1014 $this->initStylePropertiesForm();
1015 $tpl->setContent($this->form->getHTML());
1016 }
1017
1022 {
1023 global $ilCtrl, $lng, $ilTabs, $ilSetting;
1024
1025 $lng->loadLanguageModule("style");
1026 $this->setSubTabs("settings", "style");
1027 $ilTabs->setTabActive("settings");
1028
1029 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1030 $this->form = new ilPropertyFormGUI();
1031
1032 $fixed_style = $ilSetting->get("fixed_content_style_id");
1033 $style_id = $this->object->getStyleSheetId();
1034
1035 if ($fixed_style > 0)
1036 {
1037 $st = new ilNonEditableValueGUI($lng->txt("cont_current_style"));
1038 $st->setValue(ilObject::_lookupTitle($fixed_style)." (".
1039 $this->lng->txt("global_fixed").")");
1040 $this->form->addItem($st);
1041 }
1042 else
1043 {
1044 $st_styles = ilObjStyleSheet::_getStandardStyles(true, false,
1045 $_GET["ref_id"]);
1046
1047 $st_styles[0] = $this->lng->txt("default");
1048 ksort($st_styles);
1049
1050 if ($style_id > 0)
1051 {
1052 // individual style
1053 if (!ilObjStyleSheet::_lookupStandard($style_id))
1054 {
1055 $st = new ilNonEditableValueGUI($lng->txt("cont_current_style"));
1056 $st->setValue(ilObject::_lookupTitle($style_id));
1057 $this->form->addItem($st);
1058
1059//$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "edit"));
1060
1061 // delete command
1062 $this->form->addCommandButton("editStyle",
1063 $lng->txt("cont_edit_style"));
1064 $this->form->addCommandButton("deleteStyle",
1065 $lng->txt("cont_delete_style"));
1066//$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "delete"));
1067 }
1068 }
1069
1070 if ($style_id <= 0 || ilObjStyleSheet::_lookupStandard($style_id))
1071 {
1072 $style_sel = ilUtil::formSelect ($style_id, "style_id",
1073 $st_styles, false, true);
1074 $style_sel = new ilSelectInputGUI($lng->txt("cont_current_style"), "style_id");
1075 $style_sel->setOptions($st_styles);
1076 $style_sel->setValue($style_id);
1077 $this->form->addItem($style_sel);
1078//$this->ctrl->getLinkTargetByClass("ilObjStyleSheetGUI", "create"));
1079 $this->form->addCommandButton("saveStyleSettings",
1080 $lng->txt("save"));
1081 $this->form->addCommandButton("createStyle",
1082 $lng->txt("sty_create_ind_style"));
1083 }
1084 }
1085 $this->form->setTitle($lng->txt("cont_style"));
1086 $this->form->setFormAction($ilCtrl->getFormAction($this));
1087 }
1088
1092 function createStyle()
1093 {
1094 global $ilCtrl;
1095
1096 $ilCtrl->redirectByClass("ilobjstylesheetgui", "create");
1097 }
1098
1102 function editStyle()
1103 {
1104 global $ilCtrl;
1105
1106 $ilCtrl->redirectByClass("ilobjstylesheetgui", "edit");
1107 }
1108
1112 function deleteStyle()
1113 {
1114 global $ilCtrl;
1115
1116 $ilCtrl->redirectByClass("ilobjstylesheetgui", "delete");
1117 }
1118
1123 {
1124 global $ilSetting;
1125
1126 if ($ilSetting->get("fixed_content_style_id") <= 0 &&
1127 (ilObjStyleSheet::_lookupStandard($this->object->getStyleSheetId())
1128 || $this->object->getStyleSheetId() == 0))
1129 {
1130 $this->object->setStyleSheetId(ilUtil::stripSlashes($_POST["style_id"]));
1131 $this->object->update();
1132 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1133 }
1134 $this->ctrl->redirect($this, "editStyleProperties");
1135 }
1136
1140 protected function showTrackingItemsBySco()
1141 {
1142 global $ilTabs;
1143
1144
1146 $ilTabs->setTabActive("cont_tracking_data");
1147 $ilTabs->setSubTabActive("cont_tracking_bysco");
1148
1149 $reports = array('exportSelectedCore','exportSelectedInteractions','exportSelectedObjectives','tracInteractionItem','tracInteractionUser','tracInteractionUserAnswers');
1150
1151 $scoSelected = "all";
1152 if (isset($_GET["scoSelected"])) $scoSelected = ilUtil::stripSlashes($_GET["scoSelected"]);
1153 if (isset($_POST["scoSelected"])) $scoSelected = ilUtil::stripSlashes($_POST["scoSelected"]);
1154 $this->ctrl->setParameter($this,'scoSelected',$scoSelected);
1155
1156 $report = "choose";
1157 if (isset($_GET["report"])) $report = ilUtil::stripSlashes($_GET["report"]);
1158 if (isset($_POST["report"])) $report = ilUtil::stripSlashes($_POST["report"]);
1159 $this->ctrl->setParameter($this,'report',$report);
1160
1161 include_once './Modules/Scorm2004/classes/class.ilSCORM2004TrackingItemsPerScoFilterGUI.php';
1162 $filter = new ilSCORM2004TrackingItemsPerScoFilterGUI($this, 'showTrackingItemsBySco');
1163 $filter->parse($scoSelected,$report,$reports);
1164 if($report == "choose") {
1165 $this->tpl->setContent($filter->form->getHTML());
1166 } else {
1167 $scosSelected = array();
1168 if ($scoSelected != "all") $scosSelected[] = $scoSelected;
1169 else {
1170 $tmpscos=$this->object->getTrackedItems();
1171 for ($i=0; $i<count($tmpscos); $i++) {
1172 $scosSelected[] = $tmpscos[$i]["id"];
1173 }
1174 }
1175 //with check for course ...
1176 include_once "Services/Tracking/classes/class.ilTrQuery.php";
1177 $a_users=ilTrQuery::getParticipantsForObject($this->ref_id);
1178 // var_dump($this->object->getTrackedUsers(""));
1179 include_once './Modules/Scorm2004/classes/class.ilSCORM2004TrackingItemsTableGUI.php';
1180 $tbl = new ilSCORM2004TrackingItemsTableGUI($this->object->getId(), $this, 'showTrackingItemsBySco', $a_users, $scosSelected, $report);
1181 $this->tpl->setContent($filter->form->getHTML().$tbl->getHTML());
1182 }
1183 return true;
1184 }
1186 {
1187 global $ilTabs, $ilAccess;
1188
1189 $ilTabs->setTabActive('cont_tracking_data');
1190
1191 if($ilAccess->checkAccess("read_learning_progress", "", $_GET["ref_id"])) {
1192
1194 $ilTabs->setSubTabActive('cont_tracking_byuser');
1195
1196 $reports = array('exportSelectedSuccess','exportSelectedCore','exportSelectedInteractions','exportSelectedObjectives','exportObjGlobalToSystem');
1197
1198 $userSelected = "all";
1199 if (isset($_GET["userSelected"])) $userSelected = ilUtil::stripSlashes($_GET["userSelected"]);
1200 if (isset($_POST["userSelected"])) $userSelected = ilUtil::stripSlashes($_POST["userSelected"]);
1201 $this->ctrl->setParameter($this,'userSelected',$userSelected);
1202
1203 $report = "choose";
1204 if (isset($_GET["report"])) $report = ilUtil::stripSlashes($_GET["report"]);
1205 if (isset($_POST["report"])) $report = ilUtil::stripSlashes($_POST["report"]);
1206 $this->ctrl->setParameter($this,'report',$report);
1207
1208 include_once './Modules/Scorm2004/classes/class.ilSCORM2004TrackingItemsPerUserFilterGUI.php';
1209 $filter = new ilSCORM2004TrackingItemsPerUserFilterGUI($this, 'showTrackingItems');
1210 $filter->parse($userSelected,$report,$reports);
1211 if($report == "choose") {
1212 $this->tpl->setContent($filter->form->getHTML());
1213 } else {
1214 $usersSelected = array();
1215 if ($userSelected != "all") $usersSelected[] = $userSelected;
1216 else {
1217 include_once "Services/Tracking/classes/class.ilTrQuery.php";
1218 $users=ilTrQuery::getParticipantsForObject($this->ref_id);
1219 foreach($users as $user) {
1220 if(ilObject::_exists($user) && ilObject::_lookUpType($user) == 'usr') {
1221 $usersSelected[] = $user;
1222 }
1223 }
1224 }
1225 $scosSelected = array();
1226 $tmpscos=$this->object->getTrackedItems();
1227 for ($i=0; $i<count($tmpscos); $i++) {
1228 $scosSelected[] = $tmpscos[$i]["id"];
1229 }
1230 //with check for course ...
1231 // include_once "Services/Tracking/classes/class.ilTrQuery.php";
1232 // $a_users=ilTrQuery::getParticipantsForObject($this->ref_id);
1233 // var_dump($this->object->getTrackedUsers(""));
1234 include_once './Modules/Scorm2004/classes/class.ilSCORM2004TrackingItemsTableGUI.php';
1235 $tbl = new ilSCORM2004TrackingItemsTableGUI($this->object->getId(), $this, 'showTrackingItems', $usersSelected, $scosSelected, $report);
1236 $this->tpl->setContent($filter->form->getHTML().$tbl->getHTML());
1237 }
1238 }
1239 else if($ilAccess->checkAccess("edit_learning_progress", "", $_GET["ref_id"])) {
1240 $this->modifyTrackingItems();
1241 }
1242 return true;
1243 }
1244
1245
1246
1250 function showTree()
1251 {
1252 global $ilUser, $ilias, $ilCtrl, $lng;
1253
1254 $mtree = new ilTree($this->object->getId());
1255 $mtree->setTableNames('sahs_sc13_tree','sahs_sc13_tree_node');
1256 $mtree->setTreeTablePK("slm_id");
1257
1258 if ($_POST["expandAll"] != "")
1259 {
1260 $_GET["scexpand"] = "";
1261 $stree = $mtree->getSubTree($mtree->getNodeData($mtree->readRootId()));
1262 $n_arr = array();
1263 foreach ($stree as $n)
1264 {
1265 $n_arr[] = $n["child"];
1266 }
1267 $_SESSION["scexpand"] = $n_arr;
1268 }
1269
1270 if ($_POST["collapseAll"] != "")
1271 {
1272 $_GET["scexpand"] = "";
1273 $_SESSION["scexpand"] = array($mtree->readRootId());
1274 }
1275
1276 $this->tpl = new ilTemplate("tpl.main.html", true, true);
1277 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
1278
1279 $ilCtrl->setParameter($this, "active_node", $_GET["active_node"]);
1280
1281 $this->tpl->addBlockFile("CONTENT", "content", "tpl.explorer.html");
1282 $this->tpl->setVariable("IMG_SPACE", ilUtil::getImagePath("spacer.png", false));
1283
1284 $this->tpl->setCurrentBlock("exp2_button");
1285 $this->tpl->setVariable("CMD_EXP2_BTN", "expandAll");
1286 $this->tpl->setVariable("TXT_EXP2_BTN", $lng->txt("expand_all"));
1287 $this->tpl->parseCurrentBlock();
1288
1289 $this->tpl->setCurrentBlock("exp2_button");
1290 $this->tpl->setVariable("CMD_EXP2_BTN", "collapseAll");
1291 $this->tpl->setVariable("TXT_EXP2_BTN", $lng->txt("collapse_all"));
1292 $this->tpl->parseCurrentBlock();
1293
1294 require_once ("./Modules/Scorm2004/classes/class.ilSCORM2004EditorExplorer.php");
1295 $exp = new ilSCORM2004EditorExplorer($this->ctrl->getLinkTarget($this, "edit"),
1296 $this->object);
1297 $exp->setFrameUpdater("content", "ilHierarchyFormUpdater");
1298 $exp->setTargetGet("obj_id");
1299 $exp->setExpandTarget($this->ctrl->getLinkTarget($this, "showTree"));
1300
1301 if ($_GET["scexpand"] == "")
1302 {
1303 $expanded = $mtree->readRootId();
1304 }
1305 else
1306 {
1307 $expanded = $_GET["scexpand"];
1308 }
1309
1310//echo "-".$_GET["active_node"]."-";
1311 if ($_GET["active_node"] != "")
1312 {
1313 $path = $mtree->getPathId($_GET["active_node"]);
1314 $exp->setForceOpenPath($path);
1315
1316 $exp->highlightNode($_GET["active_node"]);
1317 }
1318 $exp->setExpand($expanded);
1319
1320 // build html-output
1321 $exp->setOutput(0);
1322 $output = $exp->getOutput();
1323
1324 // asynchronous output
1325 if ($ilCtrl->isAsynch())
1326 {
1327 echo $output; exit;
1328 }
1329
1330 $this->tpl->setCurrentBlock("content");
1331 $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("sahs_organization"));
1332 $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
1333 $this->tpl->setVariable("EXPLORER",$output);
1334 $this->ctrl->setParameter($this, "scexpand", $_GET["scexpand"]);
1335 $this->tpl->setVariable("ACTION", $this->ctrl->getLinkTarget($this, "showTree"));
1336 $this->tpl->parseCurrentBlock();
1337
1338 include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
1339 iljQueryUtil::initjQuery($this->tpl);
1340
1341 $this->tpl->show(false);
1342
1343
1344 exit;
1345 }
1346
1351 {
1352 global $tpl, $lng, $ilTabs, $ilToolbar, $ilCtrl;
1353
1354 $ilTabs->setTabActive("sahs_sequencing");
1355
1356 include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Item.php");
1357
1358 if (!$this->object->getSequencingExpertMode())
1359 {
1360 $ilToolbar->addButton($lng->txt("sahs_activate_expert_mode"),
1361 $ilCtrl->getLinkTarget($this, "confirmExpertMode"));
1362 }
1363 else
1364 {
1365 include_once("./Services/UIComponent/NestedList/classes/class.ilNestedList.php");
1366 $list = new ilNestedList();
1367 $t = $this->object->getTree();
1368 $root_node = $t->getNodeData($t->getRootId());
1369 $nodes = $this->object->getTree()->getSubtree($root_node);
1370 foreach ($nodes as $node)
1371 {
1372 if (in_array($node["type"], array("", "chap", "sco")))
1373 {
1374 $ntpl = new ilTemplate("tpl.seq_node.html", true, true, "Modules/Scorm2004");
1375 $ntpl->setVariable("NODE_ID", $node["child"]);
1376 if ($node["type"] == "")
1377 {
1378 $ntpl->setVariable("TITLE", $this->object->getTitle());
1379 $item = new ilSCORM2004Item($this->object->getId(), true);
1380 }
1381 else
1382 {
1383 $ntpl->setVariable("TITLE", $node["title"]);
1384 $item = new ilSCORM2004Item($node["child"]);
1385 }
1386 $ntpl->setVariable("SEQ_INFO",
1387 ilUtil::prepareFormOutput($item->exportAsXML(false)));
1388 $list->addListNode($ntpl->get(), $node["child"], $node["parent"]);
1389 }
1390 }
1391
1392 $tb = new ilToolbarGUI();
1393 $tb->addFormButton($lng->txt("save"), "saveSequencing");
1394 $ftpl = new ilTemplate("tpl.sequencing.html", true, true, "Modules/Scorm2004");
1395 $ftpl->setVariable("CONTENT", $list->getHTML());
1396 $ftpl->setVariable("FORM_ACTION", $ilCtrl->getFormAction($this));
1397 $ftpl->setVariable("TB", $tb->getHTML());
1398 $tpl->setContent($ftpl->get());
1399 }
1400 }
1401
1406 {
1407 global $ilCtrl, $tpl, $lng, $ilTabs;
1408
1409 $ilTabs->setTabActive("sahs_sequencing");
1410
1411 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1412 $cgui = new ilConfirmationGUI();
1413 $cgui->setFormAction($ilCtrl->getFormAction($this));
1414 $cgui->setHeaderText($lng->txt("sahs_activate_expert_mode_info"));
1415 $cgui->setCancel($lng->txt("cancel"), "showSequencing");
1416 $cgui->setConfirm($lng->txt("sahs_activate_expert_mode"), "activateExpertMode");
1417
1418 $tpl->setContent($cgui->getHTML());
1419 }
1420
1428 {
1429 global $ilCtrl, $lng;
1430
1431 $this->object->setSequencingExpertMode(true);
1432 $this->object->update();
1433 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1434 $ilCtrl->redirect($this, "showSequencing");
1435 }
1436
1437
1442 {
1443 global $tpl,$lng, $ilCtrl;
1444
1445 include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Item.php");
1446 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
1447 $t = $this->object->getTree();
1448 $root_node = $t->getNodeData($t->getRootId());
1449 $nodes = $this->object->getTree()->getSubtree($root_node);
1450 foreach ($nodes as $node)
1451 {
1452 if (in_array($node["type"], array("", "chap", "sco")))
1453 {
1454 if ($node["type"] == "")
1455 {
1456 $item = new ilSCORM2004Item($this->object->getId(), true);
1457 }
1458 else
1459 {
1460 $item = new ilSCORM2004Item($node["child"]);
1461 }
1462 $xml = '<?xml version="1.0"?>'.ilUtil::stripSlashes($_POST["seq"][$node["child"]], false);
1463
1464 $ob_texts = array();
1465 if ($node["type"] == "sco")
1466 {
1467 $sco = new ilSCORM2004Sco($this->object, $node["child"]);
1468 $objectives = $sco->getObjectives();
1469 foreach ($objectives as $o)
1470 {
1471 $ob_texts[$o->getId()] = $o->getObjectiveId();
1472 }
1473 }
1474
1475 $item->setSeqXml($xml);
1476 $item->initDom();
1477 $item->update();
1478
1479 if ($node["type"] == "sco")
1480 {
1481 foreach ($ob_texts as $id => $t)
1482 {
1483 $objective = new ilScorm2004Objective($node["child"], $id);
1484 $objective->setObjectiveId($t);
1485 $objective->updateObjective();
1486 }
1487 }
1488 }
1489 }
1490
1491 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1492
1493 $ilCtrl->redirect($this, "showSequencing");
1494 }
1495
1500 {
1501 global $tpl, $lng, $ilCtrl, $ilToolbar;
1502
1503 $chaps = $this->object->getTree()->getChilds(
1504 $this->object->getTree()->getRootId());
1505 $s_chaps = array();
1506 foreach($chaps as $chap)
1507 {
1508 if ($chap["type"] == "chap")
1509 {
1510 $s_chaps[$chap["child"]] = $chap["title"];
1511 }
1512 }
1513 $cur_chap = $_SESSION["sahs_cur_chap"]
1514 ? $_SESSION["sahs_cur_chap"]
1515 : 0;
1516
1517 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
1518 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
1519 $options = array(
1520 "0" => $lng->txt("all")
1521 );
1522 $options = $options + $s_chaps;
1523 $si = new ilSelectInputGUI($lng->txt("chapter"), "chapter");
1524 $si->setOptions($options);
1525 $si->setValue($cur_chap);
1526 $ilToolbar->addInputItem($si, true);
1527 $ilToolbar->addFormButton($lng->txt("change"), "selectLObjChapter");
1528
1529 include_once("./Modules/Scorm2004/classes/class.ilObjectivesAlignmentTableGUI.php");
1530 $obj_table = new ilObjectivesAlignmentTableGUI($this, "showLearningObjectivesAlignment",
1531 $this->getEditTree(), $this->object, $cur_chap);
1532 $tpl->setContent($obj_table->getHTML());
1533 }
1534
1536 {
1537 global $ilCtrl;
1538
1539 $_SESSION["sahs_cur_chap"] = (int) $_POST["chapter"];
1540 $ilCtrl->redirect($this, "showLearningObjectivesAlignment");
1541 }
1542
1546 public function selectExport()
1547 {
1548 switch ($_POST['select_export'])
1549 {
1550 case "exportScorm12":
1551 case "exportScorm2004_3rd":
1552 case "exportScorm2004_4th":
1553 case "exportPDF":
1554 case "exportISO":
1555 case "exportHTML":
1556 case "exportHTMLOne":
1557 $this->ctrl->redirect($this, $_POST['select_export']);
1558 break;
1559 default:
1560 $this->ctrl->redirect($this, 'showExportList');
1561 break;
1562 }
1563 }
1564
1569 {
1570 global $tpl, $ilToolbar;
1571
1572 $ilToolbar->setFormAction($this->ctrl->getFormAction($this, 'selectExport'));
1573 $ilToolbar->setId("scorm2004export");
1574
1575 //$template = new ilTemplate("tpl.scorm2004_export_buttons.html", true, true, 'Modules/Scorm2004');
1576
1577/* $buttons = array(
1578 "exportScorm2004_3rd" => $this->lng->txt("scorm_create_export_file_scrom2004"),
1579 "exportScorm2004_4th" => $this->lng->txt("scorm_create_export_file_scrom2004_4th"),
1580 "exportScorm12" => $this->lng->txt("scorm_create_export_file_scrom12"),
1581 "exportPDF" => $this->lng->txt("scorm_create_export_file_pdf"),
1582 "exportISO" => $this->lng->txt("scorm_create_export_file_iso"),
1583 "exportHTML" => $this->lng->txt("scorm_create_export_file_html"),
1584 "exportHTMLOne" => $this->lng->txt("scorm_create_export_file_html_one")
1585 );*/
1586 $buttons = array(
1587 "exportScorm2004_3rd" => $this->lng->txt("scorm_create_export_file_scrom2004"),
1588 "exportScorm2004_4th" => $this->lng->txt("scorm_create_export_file_scrom2004_4th"),
1589 "exportScorm12" => $this->lng->txt("scorm_create_export_file_scrom12"),
1590 "exportHTML" => $this->lng->txt("scorm_create_export_file_html"),
1591 "exportHTMLOne" => $this->lng->txt("scorm_create_export_file_html_one")
1592 );
1593
1594 //
1595 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
1596 $si = new ilSelectInputGUI($this->lng->txt('type'), "select_export");
1597 $si->setOptions($buttons);
1598 $ilToolbar->addInputItem($si, true);
1599
1600 $ilToolbar->addFormButton($this->lng->txt('export'), "selectExport");
1601
1602 $export_files = $this->object->getExportFiles();
1603
1604 include_once "./Modules/Scorm2004/classes/class.ilSCORM2004ExportTableGUI.php";
1605 $table_gui = new ilSCORM2004ExportTableGUI($this, 'showExportList');
1606 $data = array();
1607 foreach ($export_files as $exp_file)
1608 {
1609 $filetype = $exp_file['type'];
1610 $public_str = ($exp_file["file"] == $this->object->getPublicExportFile($filetype))
1611 ? " <b>(".$this->lng->txt("public").")<b>"
1612 : "";
1613 $file_arr = explode("__", $exp_file["file"]);
1614 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));
1615 }
1616 $table_gui->setData($data);
1617
1618 $this->tpl->setContent($table_gui->getHTML());
1619 }
1620
1626 function getTabs()
1627 {
1628 global $ilAccess, $ilHelp;
1629
1630 if ($this->ctrl->getCmd() == "delete")
1631 {
1632 return;
1633 }
1634
1635 if (!$this->object->getEditable())
1636 {
1637 return parent::getTabs();
1638 }
1639
1640 $ilHelp->setScreenIdComponent("sahsed");
1641
1642 // organization
1643 $this->tabs_gui->addTarget("sahs_organization",
1644 $this->ctrl->getLinkTarget($this, "showOrganization"), "showOrganization",
1645 get_class($this));
1646
1647 // info screen
1648 $force_active = ($this->ctrl->getNextClass() == "ilinfoscreengui")
1649 ? true
1650 : false;
1651 $this->tabs_gui->addTarget("info_short",
1652 $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"), "",
1653 "ilinfoscreengui", "", $force_active);
1654
1655 // settings
1656 $this->tabs_gui->addTarget("settings",
1657 $this->ctrl->getLinkTarget($this, "properties"), "properties",
1658 get_class($this));
1659
1660 // tracking data
1661 /* Later, only if tracking data exists
1662 $tabs_gui->addTarget("cont_tracking_data",
1663 $this->ctrl->getLinkTarget($this, "showTrackingItems"), "showTrackingItems",
1664 get_class($this));
1665 */
1666
1667 // objective alignment
1668 $this->tabs_gui->addTarget("sahs_objectives_alignment",
1669 $this->ctrl->getLinkTarget($this, "showLearningObjectivesAlignment"), "showLearningObjectivesAlignment",
1670 get_class($this));
1671
1672 // sequencing
1673 $this->tabs_gui->addTarget("sahs_sequencing",
1674 $this->ctrl->getLinkTarget($this, "showSequencing"), "showSequencing",
1675 get_class($this));
1676
1677 // learning progress
1678 /* Later, only if tracking data exists
1679 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
1680 if(ilObjUserTracking::_enabledLearningProgress())
1681 {
1682 $tabs_gui->addTarget('learning_progress',
1683 $this->ctrl->getLinkTargetByClass(array('illearningprogressgui'),''),
1684 '',
1685 array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui'));
1686 }
1687 */
1688
1689 // edit meta
1690 include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
1691 $mdgui = new ilObjectMetaDataGUI($this->object);
1692 $mdtab = $mdgui->getTab();
1693 if($mdtab)
1694 {
1695 $this->tabs_gui->addTarget("meta_data",
1696 $mdtab,
1697 "", "ilmdeditorgui");
1698 }
1699
1700 // export
1701 $this->tabs_gui->addTarget("export",
1702 $this->ctrl->getLinkTarget($this, "showExportList"), array("showExportList", 'confirmDeleteExportFile'),
1703 get_class($this));
1704
1705 // perm
1706 if ($ilAccess->checkAccess('edit_permission', '', $this->object->getRefId()))
1707 {
1708 $this->tabs_gui->addTarget("perm_settings",
1709 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
1710 }
1711
1712 if ($this->object->editable==1)
1713 {
1714 // preview
1715 $this->tabs_gui->addNonTabbedLink("preview",
1716 $this->lng->txt("cont_sc_preview"),
1717 $this->ctrl->getLinkTarget($this, "preview"),
1718 "_blank");
1719 }
1720
1721 }
1722
1726 function setSubTabs($a_main_tab = "", $a_active = "")
1727 {
1728 global $ilTabs, $ilCtrl, $lng;
1729
1730 if ($a_main_tab == "settings" &&
1731 $this->object->editable == 1)
1732 {
1733/* // general properties
1734 $ilTabs->addSubTab("general_settings",
1735 $lng->txt("general_settings"),
1736 $ilCtrl->getLinkTarget($this, 'properties'));
1737
1738 // style properties
1739 $ilTabs->addSubTab("style",
1740 $lng->txt("cont_style"),
1741 $ilCtrl->getLinkTarget($this, 'editStyleProperties'));
1742*/
1743 $ilTabs->activateSubTab($a_active);
1744 }
1745 }
1746
1747
1751 function getEditTree()
1752 {
1753 $slm_tree = new ilTree($this->object->getId());
1754 $slm_tree->setTreeTablePK("slm_id");
1755 $slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1756 return $slm_tree;
1757 }
1758
1762 function showOrganization($a_top_node = 0, $a_form_action = "",
1763 $a_title = "", $a_icon = "", $a_gui_obj = null, $a_gui_cmd = "")
1764 {
1765 global $lng, $ilCtrl, $tpl;
1766
1767 if ($a_form_action == "")
1768 {
1769 $a_form_action = $ilCtrl->getFormAction($this);
1770 }
1771
1772 if ($a_icon == "")
1773 {
1774 $a_title = $this->object->getTitle();
1775 $a_icon = ilUtil::getImagePath("icon_lm.svg");
1776 }
1777
1778 $slm_tree = $this->getEditTree();
1779
1780 if ($a_top_node == 0)
1781 {
1782 $a_top_node = $slm_tree->getRootId();
1783 }
1784
1785 if (is_null($a_gui_obj))
1786 {
1787 $a_gui_obj = $this;
1788 $a_gui_cmd = "showOrganization";
1789 }
1790
1791 $ilCtrl->setParameter($this, "backcmd", "showOrganization");
1792 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
1793 $form_gui = new ilSCORM2004OrganizationHFormGUI();
1794 $form_gui->setParentCommand($a_gui_obj, $a_gui_cmd);
1795 $form_gui->setFormAction($a_form_action);
1796// $form_gui->setTitle($a_title);
1797// $form_gui->setIcon($a_icon);
1798 $form_gui->setTree($slm_tree);
1799 $form_gui->setCurrentTopNodeId($a_top_node);
1800 $form_gui->addMultiCommand($lng->txt("delete"), "deleteNodes");
1801 $form_gui->addMultiCommand($lng->txt("cut"), "cutItems");
1802 $form_gui->addMultiCommand($lng->txt("copy"), "copyItems");
1803 $form_gui->addCommand($lng->txt("cont_save_all_titles"), "saveAllTitles");
1804 $form_gui->addCommand($lng->txt("expand_all"), "expandAll");
1805 $form_gui->addCommand($lng->txt("collapse_all"), "collapseAll");
1806 $form_gui->setTriggeredUpdateCommand("saveAllTitles");
1807
1808 // highlighted nodes
1809 if ($_GET["highlight"] != "")
1810 {
1811 $hl = explode(":", $_GET["highlight"]);
1812 $form_gui->setHighlightedNodes($hl);
1813 $form_gui->setFocusId($hl[0]);
1814 }
1815
1816 $ilCtrl->setParameter($this, "active_node", $_GET["obj_id"]);
1817// $form_gui->setExplorerUpdater("tree", "tree_div",
1818// $ilCtrl->getLinkTarget($this, "showTree", "", true));
1819 $sc_tpl = new ilTemplate("tpl.scormeditor_orga_screen.html", true, true, "Modules/Scorm2004");
1820 $sc_tpl->setVariable("ORGANIZATION", $form_gui->getHTML());
1821 $sc_tpl->setVariable("NOTES", $this->getNotesHTML());
1822
1823 $tpl->setContent($sc_tpl->get());
1824 }
1825
1829 function getNotesHTML($a_mode = "")
1830 {
1831 global $ilCtrl, $ilAccess, $ilSetting;
1832
1833 // notes
1834 $ilCtrl->setParameter($this, "nodes_mode", $a_mode);
1835 include_once("Services/Notes/classes/class.ilNoteGUI.php");
1836 $node_id = $_GET["obj_id"];
1837 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
1838 $node_type = ($node_id > 0)
1840 : "sahs";
1841
1842 $notes_gui = new ilNoteGUI($this->object->getId(),
1843 (int) $node_id, $node_type);
1844 if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]) && $ilSetting->get("comments_del_tutor", 1))
1845 {
1846 $notes_gui->enablePublicNotesDeletion(true);
1847 }
1848 $notes_gui->enablePrivateNotes();
1849 $notes_gui->enablePublicNotes();
1850
1851 $next_class = $ilCtrl->getNextClass($this);
1852 if ($next_class == "ilnotegui")
1853 {
1854 $html = $this->ctrl->forwardCommand($notes_gui);
1855 }
1856 else
1857 {
1858 $html = $notes_gui->getNotesHTML();
1859 }
1860 return $html;
1861 }
1862
1866 function insertChapter($a_redirect = true)
1867 {
1868 global $ilCtrl, $lng;
1869
1870 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
1871
1872 $slm_tree = new ilTree($this->object->getId());
1873 $slm_tree->setTreeTablePK("slm_id");
1874 $slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1875
1878
1879 if (!ilSCORM2004OrganizationHFormGUI::getPostFirstChild()) // insert after node id
1880 {
1881 $parent_id = $slm_tree->getParentId($node_id);
1882 $target = $node_id;
1883 }
1884 else // insert as first child
1885 {
1886 $parent_id = $node_id;
1888 }
1889 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Chapter.php");
1890 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
1891
1892 $chap_ids = array();
1893 for ($i = 1; $i <= $num; $i++)
1894 {
1895 $chap = new ilSCORM2004Chapter($this->object);
1896 $chap->setTitle($lng->txt("sahs_new_chapter"));
1897 $chap->setSLMId($this->object->getId());
1898 $chap->create();
1899 ilSCORM2004Node::putInTree($chap, $parent_id, $target);
1900 $chap_ids[] = $chap->getId();
1901 }
1902 $chap_ids = array_reverse($chap_ids);
1903 $chap_ids = implode($chap_ids, ":");
1904
1905 if ($a_redirect)
1906 {
1907 $ilCtrl->setParameter($this, "highlight", $chap_ids);
1908 $ilCtrl->redirect($this, "showOrganization", "node_".$node_id);
1909 }
1910 return array("node_id" => $node_id, "items" => $chap_ids);
1911 }
1912
1916 function insertSco($a_redirect = true)
1917 {
1918 global $ilCtrl, $lng;
1919
1920 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
1921
1922 $slm_tree = new ilTree($this->object->getId());
1923 $slm_tree->setTreeTablePK("slm_id");
1924 $slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1925
1928
1929 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
1930 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
1931
1932 if (!ilSCORM2004OrganizationHFormGUI::getPostFirstChild()) // insert after node id
1933 {
1934 $parent_id = $slm_tree->getParentId($node_id);
1935 $target = $node_id;
1936 }
1937 else // insert as first child
1938 {
1939 $parent_id = $node_id;
1941 }
1942
1943 $sco_ids = array();
1944 for ($i = 1; $i <= $num; $i++)
1945 {
1946 $sco = new ilSCORM2004Sco($this->object);
1947 $sco->setTitle($lng->txt("sahs_new_sco"));
1948 $sco->setSLMId($this->object->getId());
1949 $sco->create();
1950 ilSCORM2004Node::putInTree($sco, $parent_id, $target);
1951 $sco_ids[] = $sco->getId();
1952 }
1953 $sco_ids = array_reverse($sco_ids);
1954 $sco_ids = implode($sco_ids, ":");
1955
1956 if ($a_redirect)
1957 {
1958 $ilCtrl->setParameter($this, "highlight", $sco_ids);
1959 $ilCtrl->redirect($this, "showOrganization", "node_".$node_id);
1960 }
1961 return array("node_id" => $node_id, "items" => $sco_ids);
1962 }
1963
1967 function insertAsset($a_redirect = true)
1968 {
1969 global $ilCtrl, $lng;
1970
1971 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
1972
1973 $slm_tree = new ilTree($this->object->getId());
1974 $slm_tree->setTreeTablePK("slm_id");
1975 $slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
1976
1979
1980 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Asset.php");
1981 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
1982
1983 if (!ilSCORM2004OrganizationHFormGUI::getPostFirstChild()) // insert after node id
1984 {
1985 $parent_id = $slm_tree->getParentId($node_id);
1986 $target = $node_id;
1987 }
1988 else // insert as first child
1989 {
1990 $parent_id = $node_id;
1992 }
1993
1994 $ass_ids = array();
1995 for ($i = 1; $i <= $num; $i++)
1996 {
1997 $ass = new ilSCORM2004Asset($this->object);
1998 $ass->setTitle($lng->txt("sahs_new_asset"));
1999 $ass->setSLMId($this->object->getId());
2000 $ass->create();
2001 ilSCORM2004Node::putInTree($ass, $parent_id, $target);
2002 $ass_ids[] = $ass->getId();
2003 }
2004 $ass_ids = array_reverse($ass_ids);
2005 $ass_ids = implode($ass_ids, ":");
2006
2007 if ($a_redirect)
2008 {
2009 $ilCtrl->setParameter($this, "highlight", $ass_ids);
2010 $ilCtrl->redirect($this, "showOrganization", "node_".$node_id);
2011 }
2012 return array("node_id" => $node_id, "items" => $ass_ids);
2013 }
2014
2018 function insertPage($a_redirect = true)
2019 {
2020 global $ilCtrl, $lng;
2021
2022 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
2023
2024 $slm_tree = new ilTree($this->object->getId());
2025 $slm_tree->setTreeTablePK("slm_id");
2026 $slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
2027
2030
2031 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004PageNode.php");
2032 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2033 if (!ilSCORM2004OrganizationHFormGUI::getPostFirstChild()) // insert after node id
2034 {
2035 $parent_id = $slm_tree->getParentId($node_id);
2036 $target = $node_id;
2037 }
2038 else // insert as first child
2039 {
2040 $parent_id = $node_id;
2042 }
2043
2044 $page_ids = array();
2045 for ($i = 1; $i <= $num; $i++)
2046 {
2047 $page = new ilSCORM2004PageNode($this->object);
2048 $page->setTitle($lng->txt("sahs_new_page"));
2049 $page->setSLMId($this->object->getId());
2050 $page->create();
2051 ilSCORM2004Node::putInTree($page, $parent_id, $target);
2052 $page_ids[] = $page->getId();
2053 }
2054 $page_ids = array_reverse($page_ids);
2055 $page_ids = implode($page_ids, ":");
2056
2057 if ($a_redirect)
2058 {
2059 $ilCtrl->setParameter($this, "highlight", $page_ids);
2060 $ilCtrl->redirect($this, "showOrganization", "node_".$node_id);
2061 }
2062 return array("node_id" => $node_id, "items" => $page_ids);
2063 }
2064
2065
2070 {
2071
2072 global $ilCtrl,$lng, $tpl;
2073
2074 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
2075 include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004SeqTemplate.php");
2076
2077 $templates = array();
2078 $description = null;
2079 $image = null;
2080
2081 $default_identifier = $_POST["identifier"];
2082
2083 //get available templates
2085
2086 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.scormeditor_seq_chooser.html", "Modules/Scorm2004");
2087
2088 $this->tpl->setCurrentBlock("option_item");
2089
2090 $active = null;
2091 foreach ($arr_templates as $templ)
2092 {
2093 $sel= "";
2094 $item_data = $templ->getMetadataProperties();
2095 $item_data['identifier'] = $templ->getIdentifier();
2096 array_push($templates,$item_data);
2097 if ($default_identifier == $item_data['identifier']) {$sel = 'selected'; $active = $item_data;}
2098 $this->tpl->setVariable("VAL_SELECTED",$sel );
2099 $this->tpl->setVariable("VAL_IDENTIFIER",$item_data['identifier'] );
2100 $this->tpl->setVariable("VAL_TITLE",$item_data['title'] );
2101 $this->tpl->parseCurrentBlock();
2102 }
2103
2104 //default
2105 if ($active == null )
2106 {
2107 $this->saveAllTitles(false);
2108 $description = $templates[0]['description'];
2109 $image = $templates[0]['thumbnail'];
2110 } else {
2111 $description = $active['description'];
2112 $image = $active['thumbnail'];
2113 }
2114
2115 $this->tpl->setVariable("VAL_DESCRIPTION",$description);
2116 $this->tpl->setVariable("VAL_IMAGE",ilSCORM2004SeqTemplate::SEQ_TEMPLATE_DIR."/images/".$image);
2117
2118 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
2119 $this->tpl->setVariable("BTN_NAME", "insertScenario");
2120 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
2121 $this->tpl->setVariable("TXT_INSERT", $this->lng->txt("insert"));
2122 $this->tpl->setVariable("TXT_CHANGE", $this->lng->txt("change"));
2123
2124 $this->tpl->setVariable("TXT_TITLE", "Choose Sequencing Template");
2125
2126 $node_id = $_POST["node_id"];
2127 $first_child = $_POST["first_child"];
2128
2129 if (!$node_id) {$node_id = ilSCORM2004OrganizationHFormGUI::getPostNodeId();}
2130 if (!$first_child) {$first_child = ilSCORM2004OrganizationHFormGUI::getPostFirstChild();}
2131
2132 $this->tpl->setVariable("VAL_NODE_ID", $node_id);
2133 $this->tpl->setVariable("VAL_FIRST_CHILD", $first_child);
2134
2135 }
2136
2137
2142 {
2143 global $ilCtrl;
2144
2145 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
2146
2147 $slm_tree = new ilTree($this->object->getId());
2148 $slm_tree->setTreeTablePK("slm_id");
2149 $slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
2150
2151 $node_id = $_POST["node_id"];
2152
2153 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004PageNode.php");
2154 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2155 include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004SeqTemplate.php");
2156
2157 if (!$_POST["first_child"]) // insert after node id
2158 {
2159 $parent_id = $slm_tree->getParentId($node_id);
2160 $target = $node_id;
2161 }
2162 else // insert as first child
2163 {
2164 $parent_id = $node_id;
2166 }
2167
2168 $template = new ilSCORM2004SeqTemplate($_POST["identifier"]);
2169 $id = $template->insertTemplateForObjectAtParent($this->object,$parent_id,$target);
2170 $ilCtrl->setParameter($this, "highlight", $id);
2171 $ilCtrl->redirect($this, "showOrganization", "node_".$node_id);
2172
2173 }
2174
2178 function insertSpecialPage($a_redirect = true)
2179 {
2180 $this->insertTemplateGUI($a_redirect, true);
2181 }
2182
2183
2187 function insertTemplateGUI($a_redirect = true, $a_special_page = false)
2188 {
2189 global $ilCtrl,$lng, $tpl;
2190
2191 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
2192
2193 $arr_templates = ilPageLayout::activeLayouts($a_special_page, ilPageLayout::MODULE_SCORM);
2194
2195 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.scormeditor_page_layout_chooser.html", "Modules/Scorm2004");
2196
2197 $this->tpl->setCurrentBlock("option_item");
2198
2199 $count = 0;
2200 foreach ($arr_templates as $templ)
2201 {
2202 $count++;
2203 $sel= "";
2204 $templ->readObject();
2205 $this->tpl->setVariable("VAL_LAYOUT_TITLE",$templ->getTitle());
2206 $this->tpl->setVariable("VAL_LAYOUT_IMAGE",$templ->getPreview());
2207 $this->tpl->setVariable("VAL_LAYOUT_ID",$templ->getId());
2208 $this->tpl->setVariable("VAL_DISPLAY","inline");
2209 if ($count==1) {
2210 $this->tpl->setVariable("VAL_CHECKED","checked");
2211 }
2212 if ($count%4 == 0) {
2213 $this->tpl->setVariable("END_ROW","</tr>");
2214 }
2215 if ($count == 1 || ($count-1)%4 == 0) {
2216 $this->tpl->setVariable("BEGIN_ROW","<tr>");
2217 }
2218 $this->tpl->parseCurrentBlock();
2219 }
2220
2221 //matrix table
2222 if ($count%4!=0) {
2223 $rest = 4-($count%4);
2224 } else {
2225 $rest=0;
2226 }
2227
2228 for ($i=1;$i<=$rest;$i++) {
2229 $this->tpl->setVariable("VAL_DISPLAY","none");
2230 $this->tpl->setVariable("VAL_LAYOUT_ID",$templ->getId());
2231
2232 if ($i == $rest) {
2233 $this->tpl->setVariable("END_ROW","</tr>");
2234 }
2235 $this->tpl->parseCurrentBlock();
2236 }
2237
2238 //empty cells and closing <tr>
2239
2240 $this->tpl->setVariable("VAL_NODE_ID",ilSCORM2004OrganizationHFormGUI::getPostNodeId());
2241 $this->tpl->setVariable("VAL_MULTI", ilSCORM2004OrganizationHFormGUI::getPostMulti());
2242 $this->tpl->setVariable("VAL_FIRST_CHILD", ilSCORM2004OrganizationHFormGUI::getPostFirstChild());
2243 $this->tpl->setVariable("VAL_OBJ_ID", ilSCORM2004OrganizationHFormGUI::getPostFirstChild());
2244
2245 $ilCtrl->saveParameter($this,"obj_id");
2246
2247 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
2248
2249 $this->tpl->setVariable("BTN_NAME", "insertTemplate");
2250 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
2251 $this->tpl->setVariable("TXT_INSERT", $this->lng->txt("create"));
2252 $this->tpl->setVariable("CMD_CANCEL", "showOrganization");
2253
2254 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
2255 $this->tpl->setVariable("TXT_INSERT", $this->lng->txt("insert"));
2256 $this->tpl->setVariable("TXT_CHANGE", $this->lng->txt("change"));
2257 if ($a_special_page)
2258 {
2259 $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("sahs_choose_special_page"));
2260 }
2261 else
2262 {
2263 $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("sahs_choose_page_template"));
2264 }
2265 }
2266
2267
2268
2272 function insertTemplate($a_redirect = true)
2273 {
2274 global $ilCtrl, $lng;
2275
2276 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
2277
2278 $slm_tree = new ilTree($this->object->getId());
2279 $slm_tree->setTreeTablePK("slm_id");
2280 $slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
2281
2282 $num = $_POST["multi"];
2283 $node_id = $_POST["node_id"];
2284 $layout_id = $_POST["layout_id"];
2285
2286
2287 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004PageNode.php");
2288 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2289
2290 if (!$_POST["first_child"]) // insert after node id
2291 {
2292 $parent_id = $slm_tree->getParentId($node_id);
2293 $target = $node_id;
2294 }
2295 else // insert as first child
2296 {
2297 $parent_id = $node_id;
2299 }
2300
2301 $page_ids = array();
2302 for ($i = 1; $i <= $num; $i++)
2303 {
2304 $page = new ilSCORM2004PageNode($this->object);
2305 $page->setTitle($lng->txt("sahs_new_page"));
2306 $page->setSLMId($this->object->getId());
2307 $page->create(false,$layout_id);
2308 ilSCORM2004Node::putInTree($page, $parent_id, $target);
2309 $page_ids[] = $page->getId();
2310 }
2311 $page_ids = array_reverse($page_ids);
2312 $page_ids = implode($page_ids, ":");
2313
2314 if ($a_redirect)
2315 {
2316 if ($_GET["obj_id"] != "")
2317 {
2318 $this->jumpToNode($node_id, $page_ids);
2319 }
2320 else
2321 {
2322 $ilCtrl->setParameter($this, "highlight", $page_ids);
2323 $ilCtrl->redirect($this, "showOrganization", "node_".$node_id);
2324 }
2325 }
2326 }
2327
2331 function expandAll($a_redirect = true)
2332 {
2333 $_GET["scexpand"] = "";
2334 $mtree = $this->object->getTree();
2335 $n_id = ($_GET["obj_id"] > 0)
2336 ? $_GET["obj_id"]
2337 : $mtree->readRootId();
2338 $stree = $mtree->getSubTree($mtree->getNodeData($n_id));
2339 $n_arr = array();
2340 foreach ($stree as $n)
2341 {
2342 $n_arr[] = $n["child"];
2343 $_SESSION["scexpand"] = $n_arr;
2344 }
2345 $this->saveAllTitles($a_redirect);
2346 }
2347
2351 function collapseAll($a_redirect = true)
2352 {
2353 $_GET["scexpand"] = "";
2354 $mtree = $this->object->getTree();
2355 $n_id = ($_GET["obj_id"] > 0)
2356 ? $_GET["obj_id"]
2357 : $mtree->readRootId();
2358 $stree = $mtree->getSubTree($mtree->getNodeData($n_id));
2359 $old = $_SESSION["scexpand"];
2360 foreach ($stree as $n)
2361 {
2362 if (in_array($n["child"], $old) && $n["child"] != $n_id)
2363 {
2364 $k = array_search($n["child"], $old);
2365 unset($old[$k]);
2366 }
2367 }
2368 $_SESSION["scexpand"] = $old;
2369 $this->saveAllTitles($a_redirect);
2370 }
2371
2375 function saveAllTitles($a_redirect = true)
2376 {
2377 global $ilCtrl;
2378
2379 if (is_array($_POST["title"]))
2380 {
2381 include_once("./Services/MetaData/classes/class.ilMD.php");
2382 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004NodeFactory.php");
2383 foreach($_POST["title"] as $id => $title)
2384 {
2385 $node_obj = ilSCORM2004NodeFactory::getInstance($this->object, $id, false);
2386 if (is_object($node_obj))
2387 {
2388 // Update Title and description
2389 $md = new ilMD($this->object->getId(), $id, $node_obj->getType());
2390 $md_gen = $md->getGeneral();
2391 $md_gen->setTitle(ilUtil::stripSlashes($title));
2392 $md_gen->update();
2393 $md->update();
2395 }
2396 }
2397 }
2398 if ($a_redirect)
2399 {
2400 $ilCtrl->redirect($this, "showOrganization");
2401 }
2402 }
2403
2409 function deleteNodes($a_form_action = "")
2410 {
2411 global $lng, $tpl;
2412
2413 if(!isset($_POST["id"]))
2414 {
2415 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
2416 }
2417
2418 // SAVE POST VALUES
2419 $_SESSION["saved_post"] = $_POST["id"];
2420
2421 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
2422 $confirmation_gui = new ilConfirmationGUI();
2423
2424 if ($a_form_action == "")
2425 {
2426 $cmd = ($_GET["backcmd"] == "")
2427 ? "showOrganization"
2428 : $_GET["backcmd"];
2429 $this->ctrl->setParameter($this, "backcmd", $cmd);
2430 $a_form_action = $this->ctrl->getFormAction($this);
2431 }
2432 $confirmation_gui->setFormAction($a_form_action);
2433 $confirmation_gui->setHeaderText($this->lng->txt("info_delete_sure"));
2434
2435 // Add items to delete
2436 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004NodeFactory.php");
2437 foreach($_POST["id"] as $id)
2438 {
2439 if ($id != IL_FIRST_NODE)
2440 {
2441 $node_obj = ilSCORM2004NodeFactory::getInstance($this->object, $id, false);
2442 $confirmation_gui->addItem("id[]", $node_obj->getId(),
2443 $node_obj->getTitle(), ilUtil::getImagePath("icon_".$node_obj->getType().".svg"));
2444 }
2445 }
2446
2447 $confirmation_gui->setCancel($lng->txt("cancel"), "cancelDelete");
2448 $confirmation_gui->setConfirm($lng->txt("confirm"), "confirmedDelete");
2449
2450 $tpl->setContent($confirmation_gui->getHTML());
2451 }
2452
2456 function cancelDelete()
2457 {
2458 $this->ctrl->redirect($this, $_GET["backcmd"]);
2459 }
2460
2464 function confirmedDelete($a_redirect = true)
2465 {
2466 global $ilCtrl;
2467
2468 $tree = new ilTree($this->object->getId());
2469 $tree->setTableNames('sahs_sc13_tree','sahs_sc13_tree_node');
2470 $tree->setTreeTablePK("slm_id");
2471
2472 // delete all selected objects
2473 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004NodeFactory.php");
2474 foreach ($_POST["id"] as $id)
2475 {
2476 if ($id != IL_FIRST_NODE)
2477 {
2478 $obj = ilSCORM2004NodeFactory::getInstance($this->object, $id, false);
2479 $node_data = $tree->getNodeData($id);
2480 if (is_object($obj))
2481 {
2482 $obj->setSLMId($this->object->getId());
2483
2484 /*include_once("./Services/History/classes/class.ilHistory.php");
2485 ilHistory::_createEntry($this->object->getId(), "delete_".$obj->getType(),
2486 array(ilLMObject::_lookupTitle($id), $id),
2487 $this->object->getType());*/
2488
2489 $obj->delete();
2490 }
2491 if($tree->isInTree($id))
2492 {
2493 $tree->deleteTree($node_data);
2494 }
2495 }
2496 }
2497
2498 // check the tree
2499 // $this->object->checkTree();
2500
2501 // feedback
2502 ilUtil::sendInfo($this->lng->txt("info_deleted"),true);
2503
2504 if ($a_redirect)
2505 {
2506 $ilCtrl->redirect($this, "showOrganization");
2507 }
2508 }
2509
2514 {
2515 global $ilCtrl;
2516
2517 $this->object->executeDragDrop($_POST["il_hform_source_id"], $_POST["il_hform_target_id"],
2518 $_POST["il_hform_fc"], $_POST["il_hform_as_subitem"]);
2519 $ilCtrl->redirect($this, "showOrganization");
2520 }
2521
2525 function copyItems($a_return = "showOrganization")
2526 {
2527 global $ilCtrl, $lng;
2528
2529 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2530
2531 $items = ilUtil::stripSlashesArray($_POST["id"]);
2532 $todel = array(); // delete IDs < 0 (needed for non-js editing)
2533 foreach($items as $k => $item)
2534 {
2535 if ($item < 0)
2536 {
2537 $todel[] = $k;
2538 }
2539 }
2540 foreach($todel as $k)
2541 {
2542 unset($items[$k]);
2543 }
2545 {
2546 ilUtil::sendFailure($lng->txt("sahs_choose_pages_chap_scos_ass_only"), true);
2547 $ilCtrl->redirect($this, $a_return);
2548 }
2549 ilSCORM2004Node::clipboardCopy($this->object->getId(), $items);
2550
2551 // @todo: move this to a service since it can be used here, too
2552 include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
2554 ilUtil::sendInfo($lng->txt("cont_selected_items_have_been_copied"), true);
2555
2556 $ilCtrl->redirect($this, $a_return);
2557 }
2558
2562 function cutItems($a_return = "showOrganization")
2563 {
2564 global $ilCtrl, $lng;
2565
2566 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2567
2568 $items = ilUtil::stripSlashesArray($_POST["id"]);
2569 $todel = array(); // delete IDs < 0 (needed for non-js editing)
2570 foreach($items as $k => $item)
2571 {
2572 if ($item < 0)
2573 {
2574 $todel[] = $k;
2575 }
2576 }
2577 foreach($todel as $k)
2578 {
2579 unset($items[$k]);
2580 }
2581
2583 {
2584 ilUtil::sendFailure($lng->txt("sahs_choose_pages_chap_scos_ass_only"), true);
2585 $ilCtrl->redirect($this, $a_return);
2586 }
2587
2588 ilSCORM2004Node::clipboardCut($this->object->getId(), $items);
2589
2590 include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
2592
2593 ilUtil::sendInfo($lng->txt("cont_selected_items_have_been_cut"), true);
2594
2595 $ilCtrl->redirect($this, $a_return);
2596 }
2597
2602 {
2603 global $ilCtrl, $ilUser;
2604
2605 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2606 ilSCORM2004Node::insertPageClip($this->object);
2607
2608 $ilCtrl->redirect($this, "showOrganization",
2610 }
2611
2615 function insertScoClip()
2616 {
2617 global $ilCtrl, $ilUser;
2618
2619 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2620 ilSCORM2004Node::insertScoClip($this->object);
2621
2622 $ilCtrl->redirect($this, "showOrganization",
2624 }
2625
2630 {
2631 global $ilCtrl, $ilUser;
2632
2633 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2634 ilSCORM2004Node::insertAssetClip($this->object);
2635
2636 $ilCtrl->redirect($this, "showOrganization",
2638 }
2639
2644 {
2645 global $ilCtrl, $ilUser;
2646
2647 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
2649
2650 $ilCtrl->redirect($this, "showOrganization",
2652 }
2653
2657 function insertLMChapterClip($a_confirm = false, $a_perform = false)
2658 {
2659 global $ilCtrl, $tpl, $ilToolbar, $ilCtrl, $lng, $ilTabs;
2660
2661 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004OrganizationHFormGUI.php");
2662
2663
2664 $pf = "";
2666 {
2667 $pf.= '<input type="hidden" name="'.$f.'" value="'.$v.'" />';
2668 }
2669 if ($a_confirm && is_array($_POST["node"]))
2670 {
2671 foreach ($_POST["node"] as $f => $v)
2672 {
2673 $pf.= '<input type="hidden" name="node['.$f.']" value="'.$v.'" />';
2674 }
2675 }
2676
2677
2680
2681 include_once("./Modules/Scorm2004/classes/class.ilLMChapterImportForm.php");
2682 $form = new ilLMChapterImportForm($this->object, $node_id, $first_child, $a_confirm);
2683 $tpl->setContent($form->getHTML().$pf."</form>");
2684
2685 $ilTabs->clearTargets();
2686 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
2687 if ($a_confirm)
2688 {
2689 if ($form->isCorrect())
2690 {
2691 $ilToolbar->addFormButton($lng->txt("insert"), "performLMChapterInsert");
2692 }
2693 $ilToolbar->addFormButton($lng->txt("back"), "insertLMChapterClip");
2694 }
2695 else
2696 {
2697 $ilToolbar->addFormButton($lng->txt("check"), "confirmLMChapterInsert");
2698 }
2699 $ilToolbar->addFormButton($lng->txt("cancel"), "showOrganization");
2700 $ilToolbar->setCloseFormTag(false);
2701
2702 }
2703
2708 {
2709 $this->insertLMChapterClip(true);
2710 }
2711
2716 {
2719
2720 include_once("./Modules/Scorm2004/classes/class.ilLMChapterImportForm.php");
2721 $form = new ilLMChapterImportForm($this->object, $node_id, $first_child);
2722 $form->performInserts();
2723 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
2724 $this->ctrl->redirect($this, "showOrganization");
2725 }
2726
2728 {
2729 $export = new ilScorm2004Export($this->object,'SCORM 2004 4th');
2730 $export->buildExportFile();
2731 ilUtil::sendSuccess($this->lng->txt("exp_file_created"), true);
2732 $this->ctrl->redirect($this, "showExportList");
2733 }
2734
2736 {
2737 $export = new ilScorm2004Export($this->object,'SCORM 2004 3rd');
2738 $export->buildExportFile();
2739 ilUtil::sendSuccess($this->lng->txt("exp_file_created"), true);
2740 $this->ctrl->redirect($this, "showExportList");
2741 }
2742
2743 function exportScorm12()
2744 {
2745 $export = new ilScorm2004Export($this->object,'SCORM 1.2');
2746 $export->buildExportFile();
2747 ilUtil::sendSuccess($this->lng->txt("exp_file_created"), true);
2748 $this->ctrl->redirect($this, "showExportList");
2749 }
2750
2751 function exportHTML()
2752 {
2753 $export = new ilScorm2004Export($this->object,'HTML');
2754 $export->buildExportFile();
2755 ilUtil::sendSuccess($this->lng->txt("exp_file_created"), true);
2756 $this->ctrl->redirect($this, "showExportList");
2757 }
2758
2759 function exportHTMLOne()
2760 {
2761 $export = new ilScorm2004Export($this->object,'HTMLOne');
2762 $export->buildExportFile();
2763 ilUtil::sendSuccess($this->lng->txt("exp_file_created"), true);
2764 $this->ctrl->redirect($this, "showExportList");
2765 }
2766
2767 function exportISO()
2768 {
2769 $export = new ilScorm2004Export($this->object,'ISO');
2770 if(!$export->buildExportFile())
2771 {
2772 if(!PATH_TO_MKISOFS)
2773 $this->ilias->raiseError($this->lng->txt("no_mkisofs_configured"),$this->ilias->error_obj->MESSAGE);
2774 }
2775 $this->ctrl->redirect($this, "showExportList");
2776 }
2777
2778 function exportPDF()
2779 {
2780 $export = new ilScorm2004Export($this->object,'PDF');
2781 $export->buildExportFile();
2782 $this->ctrl->redirect($this, "showExportList");
2783 }
2784
2786 {
2787 $export = new ilSCORM2004Export($this->object);
2788
2789 $export_dir = $export->getExportDirectoryForType($_GET['type']);
2790 ilUtil::deliverFile($export_dir."/".$_GET['file'], $_GET['file']);
2791 }
2792
2797 {
2798 if(!isset($_POST["file"]))
2799 {
2800 ilUtil::sendInfo($this->lng->txt("no_checkbox"),true);
2801 $this->ctrl->redirect($this, "showExportList");
2802 }
2803
2804 ilUtil::sendQuestion($this->lng->txt("info_delete_sure"));
2805 $export_files = $this->object->getExportFiles();
2806
2807 include_once "./Modules/Scorm2004/classes/class.ilSCORM2004ExportTableGUI.php";
2808 $table_gui = new ilSCORM2004ExportTableGUI($this, 'showExportList', true);
2809 $data = array();
2810 foreach ($export_files as $exp_file)
2811 {
2812 foreach ($_POST['file'] as $delete_file)
2813 {
2814 if (strcmp($delete_file, $exp_file['file']) == 0)
2815 {
2816 $public_str = ($exp_file["file"] == $this->object->getPublicExportFile($exp_file["type"]))
2817 ? " <b>(".$this->lng->txt("public").")<b>"
2818 : "";
2819 $file_arr = explode("__", $exp_file["file"]);
2820 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));
2821 }
2822 }
2823 }
2824 $table_gui->setData($data);
2825 $this->tpl->setVariable('ADM_CONTENT', $table_gui->getHTML());
2826 }
2827
2832 {
2833 ilSession::clear("ilExportFiles");
2834 $this->ctrl->redirect($this, "showExportList");
2835 }
2836
2837
2842 {
2843 include_once "./Services/Utilities/classes/class.ilUtil.php";
2844 $export = new ilSCORM2004Export($this->object);
2845 foreach($_POST['file'] as $idx => $file)
2846 {
2847 $export_dir = $export->getExportDirectoryForType($_POST['type'][$idx]);
2848 $exp_file = $export_dir."/".$file;
2849 if (@is_file($exp_file))
2850 {
2851 unlink($exp_file);
2852 }
2853 }
2854 ilUtil::sendSuccess($this->lng->txt('msg_deleted_export_files'), true);
2855 $this->ctrl->redirect($this, "showExportList");
2856 }
2857
2858 /*
2859 * download export file
2860 */
2862 {
2863 if(!isset($_POST["file"]))
2864 {
2865 $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
2866 }
2867 if (count($_POST["file"]) > 1)
2868 {
2869 $this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
2870 }
2871
2872 $export = new ilSCORM2004Export($this->object);
2873 $file = $_POST['file'][0];
2874 $type = $_POST['type'][$_POST['file'][0]];
2875
2876 if ($this->object->getPublicExportFile($type) == $file)
2877 {
2878 $this->object->setPublicExportFile($type, "");
2879 }
2880 else
2881 {
2882 $this->object->setPublicExportFile($type, $file);
2883 }
2884 $this->object->update();
2885 $this->ctrl->redirect($this, "showExportList");
2886 }
2887
2888 /*
2889 * perform silent scorm 2004 export and import for view player
2890 */
2891 function preview()
2892 {
2893 global $ilias;
2894
2895 $export = new ilScorm2004Export($this->object,'SCORM 2004 3rd');
2896 $zipfile = $export->buildExportFile();
2897 $zipPathinfo = pathinfo($zipfile);
2898 $file_path = $this->object->getDataDirectory()."/".($zipPathinfo["basename"]);
2899 copy($zipfile,$file_path);
2900 unlink($zipfile);
2901
2902 ilUtil::unzip($file_path,true);
2903 ilUtil::renameExecutables($this->object->getDataDirectory());
2904 unlink($file_path);
2905
2906 include_once ("./Modules/Scorm2004/classes/ilSCORM13Package.php");
2907 $rte_pkg = new ilSCORM13Package();
2908 $rte_pkg->il_import($this->object->getDataDirectory(),$this->object->getId(),$ilias,false,true);
2909
2910 //increase module version is it necessary?
2911 //$this->object->setModuleVersion($module_version+1);
2912 //$this->object->update();
2913
2914 //redirect to view player
2915 ilUtil::redirect("ilias.php?baseClass=ilSAHSPresentationGUI&ref_id=".$this->object->getRefID()."&envEditor=1");
2916 }
2917
2918
2919}
2920?>
$n
Definition: RandomTest.php:80
global $l
Definition: afr.php:30
$path
Definition: aliased.php:25
$_GET["client_id"]
$_POST["username"]
$_SESSION["AccountId"]
An exception for terminatinating execution or to throw for unit testing.
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
static setAction($a_action)
This class represents a section header in a property form.
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.
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.
getTemplate()
output main header (title and locator)
static _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
assignObject()
assign scorm object to scorm gui object
__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
Constructor.
editOrganization($a_to_organization=true)
Edit organization (called from listgui, must setup frameset)
selectExport()
Select the export type of the SCORM 2004 module.
setSubTabs($a_main_tab="", $a_active="")
Set sub tabs.
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.
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.
static _lookupStandard($a_id)
Lookup standard flag.
static _getStandardStyles($a_exclude_default_style=false, $a_include_deactivated=false, $a_scope=0)
Get standard styles.
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.
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)
static insertChapterClip($a_slm_obj, $a_as_sub=false)
Insert Chapter from 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.
static clipboardCut($a_slm_obj_id, $a_ids)
Cut and copy a set of chapters/pages into the clipboard.
This class allows quick editing of a chapter/sco/page hierarchy.
Class ilSCORM2004PageNodeGUI.
Class ilSCORM2004PageNode.
Class ilSCORM2004ScoGUI.
Class ilSCORM2004Sco.
static checkIfAnyoneIsInOfflineMode($obj_id)
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.
$html
Definition: example_001.php:87
$tbl
Definition: example_048.php:81
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output
$rest
Definition: goto.php:48
global $ilCtrl
Definition: ilias.php:18
redirection script todo: (a better solution should control the processing via a xml file)
global $ilSetting
Definition: privfeed.php:17
$old
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file
$cmd
Definition: sahs_server.php:35
if(!is_array($argv)) $options
$ilUser
Definition: imgupload.php:18