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