ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilObjSAHSLearningModuleGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2016 ILIAS open source, Extended GPL, see docs/LICENSE */
3require_once "./Services/Object/classes/class.ilObjectGUI.php";
4require_once("./Services/FileSystem/classes/class.ilFileSystemGUI.php");
5
18{
24 public function __construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output = true)
25 {
26 global $DIC;
27 $lng = $DIC['lng'];
28
29 $lng->loadLanguageModule("content");
30 $this->type = "sahs";
31 parent::__construct($a_data, $a_id, $a_call_by_reference, false);
32 }
33
37 public function executeCommand()
38 {
39 global $DIC;
40 $ilAccess = $DIC['ilAccess'];
41 $ilTabs = $DIC['ilTabs'];
42 $ilErr = $DIC['ilErr'];
43
44 $GLOBALS['DIC']["ilLog"]->write("bc:" . $_GET["baseClass"] . "; nc:" . $this->ctrl->getNextClass($this) . "; cmd:" . $this->ctrl->getCmd());
45 if (strtolower($_GET["baseClass"]) == "iladministrationgui" ||
46 strtolower($_GET["baseClass"]) == "ilsahspresentationgui" ||
47 $this->getCreationMode() == true) {
48 $this->prepareOutput();
49 } else {
50 $this->getTemplate();
51 $this->setLocator();
52 $this->setTabs();
53 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm.svg"));
54 $this->tpl->setTitle($this->object->getTitle());
55 }
56
57 $next_class = $this->ctrl->getNextClass($this);
58 $cmd = $this->ctrl->getCmd();
59
60 switch ($next_class) {
61 case 'illtiproviderobjectsettinggui':
62 $this->setSettingsSubTabs();
63 $ilTabs->setSubTabActive('lti_provider');
64 $lti_gui = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
65 $lti_gui->setCustomRolesForSelection($GLOBALS['DIC']->rbac()->review()->getLocalRoles($this->object->getRefId()));
66 $lti_gui->offerLTIRolesForSelection(false);
67 $this->ctrl->forwardCommand($lti_gui);
68 break;
69
70
71 case 'ilobjectmetadatagui':
72 if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
73 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
74 }
75 include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
76 $md_gui = new ilObjectMetaDataGUI($this->object);
77 $this->ctrl->forwardCommand($md_gui);
78 break;
79
80 case 'ilexportgui':
81 case 'ilpermissiongui':
82 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
83 $perm_gui = new ilPermissionGUI($this);
84 $ret = $this->ctrl->forwardCommand($perm_gui);
85 break;
86
87 case "ilfilesystemgui":
88 $this->fs_gui = new ilFileSystemGUI($this->object->getDataDirectory());
89 $this->fs_gui->setUseUploadDirectory(true);
90 $this->fs_gui->setTableId("sahsfs" . $this->object->getId());
91 $ret = $this->ctrl->forwardCommand($this->fs_gui);
92 break;
93
94 case "ilcertificategui":
95 $this->setSettingsSubTabs();
96 $ilTabs->setSubTabActive('certificate');
97
98 $guiFactory = new ilCertificateGUIFactory();
99 $output_gui = $guiFactory->create($this->object);
100
101 $ret = $this->ctrl->forwardCommand($output_gui);
102 break;
103
104 case "illearningprogressgui":
105 include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
106
107 $new_gui = new ilLearningProgressGUI(ilLearningProgressGUI::LP_CONTEXT_REPOSITORY, $this->object->getRefId());
108 $this->ctrl->forwardCommand($new_gui);
109
110 break;
111
112 case "ilinfoscreengui":
113 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
114
115 $info = new ilInfoScreenGUI($this);
116 $info->enablePrivateNotes();
117 $info->enableLearningProgress();
118
119 // add read / back button
120 if ($ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
121 if (!$this->object->getEditable()) {
122 $ilToolbar = $GLOBALS['DIC']->toolbar();
123 $ilToolbar->addButtonInstance($this->object->getViewButton());
124 }
125 }
126
127 $info->enableNews();
128 if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
129 $info->enableNewsEditing();
130 $news_set = new ilSetting("news");
131 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
132 if ($enable_internal_rss) {
133 $info->setBlockProperty("news", "settings", true);
134 }
135 }
136 // show standard meta data section
137 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
138
139 // forward the command
140 $this->ctrl->forwardCommand($info);
141 break;
142
143 case "ilcommonactiondispatchergui":
144 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
146 $this->ctrl->forwardCommand($gui);
147 break;
148
149 case "ilobjstylesheetgui":
150 //$this->addLocations();
151 $this->ctrl->setReturn($this, "properties");
152 $ilTabs->clearTargets();
153 $style_gui = new ilObjStyleSheetGUI("", $this->object->getStyleSheetId(), false, false);
154 $style_gui->omitLocator();
155 if ($cmd == "create" || $_GET["new_type"] == "sty") {
156 $style_gui->setCreationMode(true);
157 }
158 //$ret =& $style_gui->executeCommand();
159
160 if ($cmd == "confirmedDelete") {
161 $this->object->setStyleSheetId(0);
162 $this->object->update();
163 }
164 $ret = $this->ctrl->forwardCommand($style_gui);
165 if ($cmd == "save" || $cmd == "copyStyle" || $cmd == "importStyle") {
166 $style_id = $ret;
167 $this->object->setStyleSheetId($style_id);
168 $this->object->update();
169 $this->ctrl->redirectByClass("ilobjstylesheetgui", "edit");
170 }
171 break;
172
173
174 case 'ilobjectcopygui':
175 $this->prepareOutput();
176 include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
177 $cp = new ilObjectCopyGUI($this);
178 $cp->setType('sahs');
179 $this->ctrl->forwardCommand($cp);
180 break;
181
182 default:
183 if ($this->object && !$this->object->getEditable()) {
184 $cmd = $this->ctrl->getCmd("properties");
185 } else {
186 $cmd = $this->ctrl->getCmd("frameset");
187 }
188 if ((strtolower($_GET["baseClass"]) == "iladministrationgui" ||
189 $this->getCreationMode() == true) &&
190 $cmd != "frameset") {
191 $cmd .= "Object";
192 }
193
194 // #9225
195 if ($cmd == "redrawHeaderAction") {
196 $cmd .= "Object";
197 }
198
199 $ret = $this->$cmd();
200 break;
201 }
202 }
203
204
205 public function viewObject()
206 {
207 if (strtolower($_GET["baseClass"]) == "iladministrationgui") {
208 parent::viewObject();
209 } else {
210 }
211 }
212
216 public function properties()
217 {
218 }
219
223 public function saveProperties()
224 {
225 }
226
230
234 public function initCreationForms($a_new_type)
235 {
236 $forms = array();
237
238 $this->initUploadForm();
239 $forms[self::CFORM_IMPORT] = $this->form;
240
241 $this->initCreationForm();
242 $forms[self::CFORM_NEW] = $this->form;
243
244 $forms[self::CFORM_CLONE] = $this->fillCloneTemplate(null, $a_new_type);
245
246 return $forms;
247 }
248
254 public function initCreationForm()
255 {
256 global $DIC;
257 $lng = $DIC['lng'];
258 $ilCtrl = $DIC['ilCtrl'];
259
260 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
261 $this->form = new ilPropertyFormGUI();
262
263 // title
264 $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
265 $ti->setSize(min(40, ilObject::TITLE_LENGTH));
266 $ti->setMaxLength(ilObject::TITLE_LENGTH);
267 $ti->setRequired(true);
268 $this->form->addItem($ti);
269
270 // text area
271 $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
272 $ta->setCols(40);
273 $ta->setRows(2);
274 $this->form->addItem($ta);
275
276
277 $this->form->addCommandButton("save", $lng->txt("sahs_add"));
278 $this->form->addCommandButton("cancel", $lng->txt("cancel"));
279
280 $this->form->setTitle($lng->txt("scorm_new"));
281 $this->form->setFormAction($ilCtrl->getFormAction($this));
282 $this->form->setTarget(ilFrameTargetInfo::_getFrame("MainContent"));
283 }
284
288 public function initUploadForm()
289 {
290 global $DIC;
291 $lng = $DIC['lng'];
292 $ilCtrl = $DIC['ilCtrl'];
293
294 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
295 $this->form = new ilPropertyFormGUI();
296
297 // type selection
298 $options = array(
299 "scorm2004" => $lng->txt("lm_type_scorm2004"),
300 "scorm" => $lng->txt("lm_type_scorm"),
301 "exportFile" => $lng->txt("sahs_export_file")
302 );
303 $si = new ilSelectInputGUI($this->lng->txt("type"), "sub_type");
304 $si->setOptions($options);
305 $this->form->addItem($si);
306
307
308 // todo wysiwyg editor removement
309
310 $options = array();
311 include_once 'Services/FileSystem/classes/class.ilUploadFiles.php';
313 $options[""] = $this->lng->txt("cont_select_from_upload_dir");
315 foreach ($files as $file) {
316 $file = htmlspecialchars($file, ENT_QUOTES, "utf-8");
317 $options[$file] = $file;
318 }
319 }
320 if (count($options) > 1) {
321 // choose upload directory
322 $radg = new ilRadioGroupInputGUI($lng->txt("cont_choose_file_source"), "file_source");
323 $op0 = new ilRadioOption($this->lng->txt("cont_choose_local"), "local");
324 $radg->addOption($op0);
325 $op1 = new ilRadioOption($this->lng->txt("cont_choose_upload_dir"), "upload_dir");
326 $radg->addOption($op1);
327 $radg->setValue("local");
328
329 $fi = new ilFileInputGUI($this->lng->txt("select_file"), "scormfile");
330 $fi->setRequired(true);
331 $op0->addSubItem($fi);
332
333 $si = new ilSelectInputGUI($this->lng->txt("cont_uploaded_file"), "uploaded_file");
334 $si->setOptions($options);
335 $op1->addSubItem($si);
336
337 $this->form->addItem($radg);
338 } else {
339 $fi = new ilFileInputGUI($this->lng->txt("select_file"), "scormfile");
340 $fi->setRequired(true);
341 $this->form->addItem($fi);
342 }
343
344 // validate file
345 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_validate_file"), "validate");
346 $cb->setValue("y");
347 //$cb->setChecked(true);
348 $this->form->addItem($cb);
349
350 // import for editing
351 $cb = new ilCheckboxInputGUI($this->lng->txt("sahs_authoring_mode"), "editable");
352 $cb->setValue("y");
353 $cb->setInfo($this->lng->txt("sahs_authoring_mode_info"));
354 $this->form->addItem($cb);
355
356 //
357 $radg = new ilRadioGroupInputGUI($lng->txt("sahs_sequencing"), "import_sequencing");
358 $radg->setValue(0);
359 $op1 = new ilRadioOption($lng->txt("sahs_std_sequencing"), 0, $lng->txt("sahs_std_sequencing_info"));
360 $radg->addOption($op1);
361 $op1 = new ilRadioOption($lng->txt("sahs_import_sequencing"), 1, $lng->txt("sahs_import_sequencing_info"));
362 $radg->addOption($op1);
363 $cb->addSubItem($radg);
364
365
366 $this->form->addCommandButton("upload", $lng->txt("import"));
367 $this->form->addCommandButton("cancel", $lng->txt("cancel"));
368
369 $this->form->setTitle($lng->txt("import_sahs"));
370 $this->form->setFormAction($ilCtrl->getFormAction($this, "upload"));
371 $this->form->setTarget(ilFrameTargetInfo::_getFrame("MainContent"));
372 }
373
380 public function uploadObject()
381 {
382 global $DIC;
383 $rbacsystem = $DIC['rbacsystem'];
384
385 include_once 'Services/FileSystem/classes/class.ilUploadFiles.php';
386
387 // check create permission
388 if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], "sahs")) {
389 $this->ilias->raiseError($this->lng->txt("no_create_permission"), $this->ilias->error_obj->WARNING);
390 } elseif ($_FILES["scormfile"]["name"]) {
391 // check if file was uploaded
392 $source = $_FILES["scormfile"]["tmp_name"];
393 if (($source == 'none') || (!$source)) {
394 $this->ilias->raiseError($this->lng->txt("msg_no_file"), $this->ilias->error_obj->MESSAGE);
395 }
396 // get_cfg_var("upload_max_filesize"); // get the may filesize form t he php.ini
397 switch ($_FILES["scormfile"]["error"]) {
398 case UPLOAD_ERR_INI_SIZE:
399 $this->ilias->raiseError($this->lng->txt("err_max_file_size_exceeds"), $this->ilias->error_obj->MESSAGE);
400 break;
401
402 case UPLOAD_ERR_FORM_SIZE:
403 $this->ilias->raiseError($this->lng->txt("err_max_file_size_exceeds"), $this->ilias->error_obj->MESSAGE);
404 break;
405
406 case UPLOAD_ERR_PARTIAL:
407 $this->ilias->raiseError($this->lng->txt("err_partial_file_upload"), $this->ilias->error_obj->MESSAGE);
408 break;
409
410 case UPLOAD_ERR_NO_FILE:
411 $this->ilias->raiseError($this->lng->txt("err_no_file_uploaded"), $this->ilias->error_obj->MESSAGE);
412 break;
413 }
414
415 $file = pathinfo($_FILES["scormfile"]["name"]);
416 } elseif ($_POST["uploaded_file"]) {
417 // check if the file is in the upload directory and readable
418 if (!ilUploadFiles::_checkUploadFile($_POST["uploaded_file"])) {
419 $this->ilias->raiseError($this->lng->txt("upload_error_file_not_found"), $this->ilias->error_obj->MESSAGE);
420 }
421
422 $file = pathinfo($_POST["uploaded_file"]);
423 } else {
424 $this->ilias->raiseError($this->lng->txt("msg_no_file"), $this->ilias->error_obj->MESSAGE);
425 }
426
427 $name = substr($file["basename"], 0, strlen($file["basename"]) - strlen($file["extension"]) - 1);
428 if ($name == "") {
429 $name = $this->lng->txt("no_title");
430 }
431
432 $subType = $_POST["sub_type"];
433
434 // always import authoring packages as scorm2004, see bug #27801
435 if ($_POST["editable"] == 'y') {
436 $subType = "scorm2004";
437 }
438
439 // create and insert object in objecttree
440 switch ($subType) {
441 case "scorm2004":
442 include_once("./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
443 $newObj = new ilObjSCORM2004LearningModule();
444 $newObj->setEditable($_POST["editable"] == 'y');
445 $newObj->setImportSequencing($_POST["import_sequencing"]);
446 $newObj->setSequencingExpertMode($_POST["import_sequencing"]);
447 break;
448
449 case "scorm":
450 include_once("./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php");
451 $newObj = new ilObjSCORMLearningModule();
452 break;
453
454 case "exportFile":
455 $sFile = $_FILES["scormfile"];
456 $fType = $sFile["type"];
457 $cFileTypes = ["application/zip", "application/x-compressed","application/x-zip-compressed"];
458 if (in_array($fType, $cFileTypes)) {
459 $timeStamp = time();
460 $tempFile = $sFile["tmp_name"];
461 $lmDir = ilUtil::getWebspaceDir("filesystem") . "/lm_data/";
462 $lmTempDir = $lmDir . $timeStamp;
463 if (!file_exists($lmTempDir)) {
464 mkdir($lmTempDir, 0755, true);
465 }
466 $zar = new ZipArchive();
467 $zar->open($tempFile);
468 $zar->extractTo($lmTempDir);
469 $zar->close();
470 require_once "./Modules/ScormAicc/classes/class.ilScormAiccImporter.php";
471 $importer = new ilScormAiccImporter();
472 $import_dirname = $lmTempDir . '/' . substr($_FILES["scormfile"]["name"], 0, strlen($a_filename) - 4);
473 if ($importer->importXmlRepresentation("sahs", null, $import_dirname, "") == true) {
474 $importFromXml = true;
475 }
476 $mprops = [];
477 $mprops = $importer->moduleProperties;
478 $subType = $mprops["SubType"][0];
479 if ($subType == "scorm") {
480 include_once("./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php");
481 $newObj = new ilObjSCORMLearningModule();
482 } else {
483 include_once("./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
484 $newObj = new ilObjSCORM2004LearningModule();
485 // $newObj->setEditable($_POST["editable"]=='y');
486 // $newObj->setImportSequencing($_POST["import_sequencing"]);
487 // $newObj->setSequencingExpertMode($_POST["import_sequencing"]);
488 }
489 }
490 break;
491 }
492
493 $newObj->setTitle($name);
494 $newObj->setSubType($subType);
495 $newObj->setDescription("");
496 $newObj->setOfflineStatus(true);
497 $newObj->create(true);
498 $newObj->createReference();
499 $newObj->putInTree($_GET["ref_id"]);
500 $newObj->setPermissions($_GET["ref_id"]);
501
502 // create data directory, copy file to directory
503 $newObj->createDataDirectory();
504
505 if ($_FILES["scormfile"]["name"]) {
506 if ($importFromXml) {
507 $scormFile = "content.zip";
508 $scormFilePath = $import_dirname . "/" . $scormFile;
509 $file_path = $newObj->getDataDirectory() . "/" . $scormFile;
510 ilFileUtils::rename($scormFilePath, $file_path);
511 ilUtil::unzip($file_path);
512 unlink($file_path);
513 ilUtil::delDir($lmTempDir, false);
514 } else {
515 // copy uploaded file to data directory
516 $file_path = $newObj->getDataDirectory() . "/" . $_FILES["scormfile"]["name"];
518 $_FILES["scormfile"]["tmp_name"],
519 $_FILES["scormfile"]["name"],
520 $file_path
521 );
522 ilUtil::unzip($file_path);
523 }
524 } else {
525 // copy uploaded file to data directory
526 $file_path = $newObj->getDataDirectory() . "/" . $_POST["uploaded_file"];
527 ilUploadFiles::_copyUploadFile($_POST["uploaded_file"], $file_path);
528 ilUtil::unzip($file_path);
529 }
530 ilUtil::renameExecutables($newObj->getDataDirectory());
531
532 $title = $newObj->readObject();
533 if ($title != "") {
534 ilObject::_writeTitle($newObj->getId(), $title);
535 }
536
537 //auto set learning progress settings
538 $newObj->setLearningProgressSettingsAtUpload();
539
540 if ($importFromXml) {
541 $importer->writeData("sahs", "5.1.0", $newObj->getId());
542 }
543
544 ilUtil::sendInfo($this->lng->txt($newObj->getType() . "_added"), true);
545 ilUtil::redirect("ilias.php?baseClass=ilSAHSEditGUI&ref_id=" . $newObj->getRefId());
546 }
547
548 public function upload()
549 {
550 $this->uploadObject();
551 }
552
553
554
558 public function saveObject()
559 {
560 if (trim($_POST["title"]) == "") {
561 $this->ilias->raiseError($this->lng->txt("msg_no_title"), $this->ilias->error_obj->MESSAGE);
562 }
563
564 include_once("./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
565 $newObj = new ilObjSCORM2004LearningModule();
566 $newObj->setTitle(ilUtil::stripSlashes($_POST["title"]));
567 $newObj->setSubType("scorm2004");
568 $newObj->setEditable(true);
569 $newObj->setDescription(ilUtil::stripSlashes($_POST["desc"]));
570 $newObj->create();
571 $newObj->createReference();
572 $newObj->putInTree($_GET["ref_id"]);
573 $newObj->setPermissions($_GET["ref_id"]);
574 $newObj->createDataDirectory();
575 $newObj->createScorm2004Tree();
576 ilUtil::sendInfo($this->lng->txt($newObj->getType() . "_added"), true);
577
578 // #7375
579 $this->ctrl->setParameterByClass("ilObjSCORM2004LearningModuleGUI", "ref_id", $newObj->getRefId());
580 $this->ctrl->redirectByClass(array("ilSAHSEditGUI", "ilObjSCORM2004LearningModuleGUI"), "showOrganization");
581 }
582
583
587 public function info()
588 {
589 $this->infoObject();
590 }
591
595 public function owner()
596 {
597 $this->ownerObject();
598 }
599
603 public function getTemplate()
604 {
605 global $DIC;
606 $lng = $DIC['lng'];
607
608 $this->tpl->loadStandardTemplate();
609 }
610
614 public function setTabs()
615 {
616 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm.svg"));
617 $this->tpl->setTitle($this->object->getTitle());
618 if (strtolower($_GET["baseClass"]) == "ilsahseditgui") {
619 $this->getTabs($this->tabs_gui);
620 }
621 //if(strtolower($_GET["baseClass"]) == "ilsahseditgui") $this->getTabs();
622 }
623
627 public function certificate()
628 {
629 $guiFactory = new ilCertificateGUIFactory();
630 $output_gui = $guiFactory->create($this->object);
631
632 $output_gui->certificateEditor();
633 }
634
640 public function getTabs()
641 {
642 global $DIC;
643 $ilCtrl = $DIC['ilCtrl'];
644 $ilHelp = $DIC['ilHelp'];
645 $ilAccess = $DIC->access();
646
647 if ($this->ctrl->getCmd() == "delete") {
648 return;
649 }
650
651 switch ($this->object->getSubType()) {
652 case "scorm2004":
653 $ilHelp->setScreenIdComponent("sahs13");
654 break;
655
656 case "scorm":
657 $ilHelp->setScreenIdComponent("sahs12");
658 break;
659 }
660
661 // file system gui tabs
662 // properties
663 $ilCtrl->setParameterByClass("ilfilesystemgui", "resetoffset", 1);
664 $this->tabs_gui->addTarget(
665 "cont_list_files",
666 $this->ctrl->getLinkTargetByClass("ilfilesystemgui", "listFiles"),
667 "",
668 "ilfilesystemgui"
669 );
670 $ilCtrl->setParameterByClass("ilfilesystemgui", "resetoffset", "");
671
672 // info screen
673 $force_active = ($this->ctrl->getNextClass() == "ilinfoscreengui")
674 ? true
675 : false;
676 $this->tabs_gui->addTarget(
677 "info_short",
678 $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"),
679 "",
680 "ilinfoscreengui",
681 "",
682 $force_active
683 );
684
685 // properties
686 $this->tabs_gui->addTarget(
687 "settings",
688 $this->ctrl->getLinkTarget($this, "properties"),
689 array("", "properties"),
690 get_class($this)
691 );
692
693 // learning progress and offline mode
694 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
695 if (ilLearningProgressAccess::checkAccess($this->object->getRefId()) || $ilAccess->checkAccess("write", "", $this->object->getRefId())) {
696 //if scorm && offline_mode activated
697 if ($this->object->getSubType() == "scorm2004" || $this->object->getSubType() == "scorm") {
698 if ($this->object->getOfflineMode() == true) {
699 $this->tabs_gui->addTarget(
700 "offline_mode_manager",
701 $this->ctrl->getLinkTarget($this, "offlineModeManager"),
702 "offlineModeManager",
703 "ilobjscormlearningmodulegui"
704 );
705 }
706 }
707 }
708 if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
709 $this->tabs_gui->addTarget(
710 'learning_progress',
711 $this->ctrl->getLinkTargetByClass(array('illearningprogressgui'), ''),
712 '',
713 array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui')
714 );
715 }
716
717 // tracking data
718 if ($ilAccess->checkAccess("read_learning_progress", '', $this->object->getRefId()) || $ilAccess->checkAccess("edit_learning_progress", '', $this->object->getRefId())) {
719 if ($this->object->getSubType() == "scorm2004" || $this->object->getSubType() == "scorm") {
720 include_once('./Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
722 if ($privacy->enabledSahsProtocolData()) {
723 $this->tabs_gui->addTarget(
724 "cont_tracking_data",
725 $this->ctrl->getLinkTarget($this, "showTrackingItems"),
726 "showTrackingItems",
727 get_class($this)
728 );
729 }
730 }
731 }
732
733 // edit meta
734 include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
735 $mdgui = new ilObjectMetaDataGUI($this->object);
736 $mdtab = $mdgui->getTab();
737 if ($mdtab) {
738 $this->tabs_gui->addTarget(
739 "meta_data",
740 $mdtab,
741 "",
742 "ilmdeditorgui"
743 );
744 }
745
746 // export
747 if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
748 $this->tabs_gui->addTarget(
749 "export",
750 $this->ctrl->getLinkTarget($this, "export"),
751 array("", "export"),
752 get_class($this)
753 );
754 }
755
756 // perm
757 if ($ilAccess->checkAccess('edit_permission', '', $this->object->getRefId())) {
758 $this->tabs_gui->addTarget(
759 "perm_settings",
760 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
761 array("perm","info","owner"),
762 'ilpermissiongui'
763 );
764 }
765 }
766
770 public static function _goto($a_target)
771 {
772 global $DIC;
773 $ilAccess = $DIC['ilAccess'];
774 $ilErr = $DIC['ilErr'];
775 $lng = $DIC['lng'];
776
777 $parts = explode("_", $a_target);
778
779 if ($ilAccess->checkAccess("write", "", $parts[0])) {
780 $_GET["cmd"] = "";
781 $_GET["baseClass"] = "ilSAHSEditGUI";
782 $_GET["ref_id"] = $parts[0];
783 $_GET["obj_id"] = $parts[1];
784 include("ilias.php");
785 exit;
786 }
787 if ($ilAccess->checkAccess("visible", "", $parts[0]) || $ilAccess->checkAccess("read", "", $parts[0])) {
788 $_GET["cmd"] = "infoScreen";
789 $_GET["baseClass"] = "ilSAHSPresentationGUI";
790 $_GET["ref_id"] = $parts[0];
791 include("ilias.php");
792 exit;
793 } else {
794 if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
795 ilUtil::sendInfo(sprintf(
796 $lng->txt("msg_no_perm_read_item"),
798 ), true);
800 }
801 }
802
803 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
804 }
805
806 public function addLocatorItems()
807 {
808 global $DIC;
809 $ilLocator = $DIC['ilLocator'];
810
811 if (is_object($this->object)) {
812 $ilLocator->addItem(
813 $this->object->getTitle(),
814 $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"),
815 "",
816 $_GET["ref_id"]
817 );
818 }
819 }
820
827 public function editContent()
828 {
829 global $DIC;
830 $ilCtrl = $DIC['ilCtrl'];
831
832 if (!$this->object->getEditable()) {
833 $ilCtrl->redirectByClass("ilfilesystemgui", "listFiles");
834 } else {
835 $ilCtrl->redirectByClass("ilobjscorm2004learningmodulegui", "editOrganization");
836 }
837 }
838
842 public function setSettingsSubTabs()
843 {
844 global $DIC;
845 $lng = $DIC['lng'];
846 $ilTabs = $DIC['ilTabs'];
847 $ilCtrl = $DIC['ilCtrl'];
848
849 $ilTabs->addSubTabTarget(
850 "cont_settings",
851 $this->ctrl->getLinkTarget($this, "properties"),
852 array("edit", ""),
853 get_class($this)
854 );
855
856 $ilTabs->addSubTabTarget(
857 "cont_sc_new_version",
858 $this->ctrl->getLinkTarget($this, "newModuleVersion"),
859 array("edit", ""),
860 get_class($this)
861 );
862
863 $validator = new ilCertificateActiveValidator();
864 if (true === $validator->validate()) {
865 // // create and insert object in objecttree
866 // $ilTabs->addSubTabTarget("certificate",
867 // $this->ctrl->getLinkTarget($this, "certificate"),
868 // array("certificate", "certificateEditor", "certificateRemoveBackground", "certificateSave",
869 // "certificatePreview", "certificateDelete", "certificateUpload", "certificateImport")
870 // );
871 $ilTabs->addSubTabTarget(
872 "certificate",
873 $this->ctrl->getLinkTargetByClass("ilcertificategui", "certificateeditor"),
874 "",
875 "ilcertificategui"
876 );
877 }
878
879 $lti_settings = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
880 if ($lti_settings->hasSettingsAccess()) {
881 $ilTabs->addSubTabTarget(
882 'lti_provider',
883 $this->ctrl->getLinkTargetByClass(ilLTIProviderObjectSettingGUI::class)
884 );
885 }
886
887 $ilTabs->setTabActive('settings');
888 }
889
890 public function export()
891 {
892 global $DIC;
893 $lng = $DIC['lng'];
894 $ilTabs = $DIC['ilTabs'];
895 $ilCtrl = $DIC['ilCtrl'];
896 $tpl = $DIC['tpl'];
897 $ilTabs->activateTab("export");
898 include_once("./Services/Export/classes/class.ilExportGUI.php");
899 $exp_gui = new ilExportGUI($this);
900 $ilCtrl->setCmd("");
901 $exp_gui->addFormat("xml");
902 $ret = $this->ctrl->forwardCommand($exp_gui);
903 return $ret;
904 }
905
906 public function exportModule()
907 {
908 global $DIC;
909 $ilDB = $DIC['ilDB'];
910
911 $moduleId = ilObject::_lookupObjectId($_GET["ref_id"]);
912 require_once "./Modules/ScormAicc/classes/class.ilScormAiccExporter.php";
913 $exporter = new ilScormAiccExporter();
914 $xml = $exporter->getXmlRepresentation("sahs", "5.1.0", $moduleId);
915 }
916
917 public function getType()
918 {
919 return "sahs";
920 }
921} // END class.ilObjSAHSLearningModule
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
This class represents a checkbox property in a property form.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Export User Interface Class.
This class represents a file property in a property form.
File System Explorer GUI class.
static rename($a_source, $a_target)
Rename a file.
static _getFrame($a_class, $a_type='')
Get content frame name.
Class ilInfoScreenGUI.
GUI class for LTI provider object settings.
static checkAccess($a_ref_id, $a_allow_only_read=true)
check access to learning progress
Class ilObjUserTrackingGUI.
addLocatorItems()
should be overwritten to add object specific items (repository items are preloaded)
saveObject()
save new learning module to db
static _goto($a_target)
goto target course
__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
Constructor.
viewObject()
viewObject container presentation for "administration -> repository, trash, permissions"
initCreationForms($a_new_type)
no manual SCORM creation, only import at the time
certificate()
Shows the certificate editor.
owner()
show owner of learning module
getTemplate()
output main header (title and locator)
uploadObject()
display status information or report errors messages in case of error
Class ilObjSCORM2004LearningModule.
Class ilObjSCORMLearningModule.
Class ilObjStyleSheetGUI.
GUI class for the workflow of copying objects.
Class ilObjectGUI Basic methods of all Output classes.
prepareOutput($a_show_subobjects=true)
prepare output
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
fillCloneTemplate($a_tpl_varname, $a_type)
Fill object clone template This method can be called from any object GUI class that wants to offer ob...
getCreationMode()
get creation mode
setLocator()
set Locator
Class ilObjectMetaDataGUI.
static _lookupObjId($a_id)
const TITLE_LENGTH
max length of object title
static _lookupTitle($a_id)
lookup object title
static _lookupObjectId($a_ref_id)
lookup object id
static _writeTitle($a_obj_id, $a_title)
write title to db (static)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static _getInstance()
Get instance of ilPrivacySettings.
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.
This class represents a selection list property in a property form.
ILIAS Setting Class.
This class represents a text area property in a property form.
This class represents a text property in a property form.
static _getUploadFiles()
Get a list of readable files in the upload directory.
static _copyUploadFile($a_file, $a_target, $a_raise_errors=true)
copy an uploaded file to the target directory (including virus check)
static _checkUploadFile($a_file)
Check if a file exists in the upload directory and is readable.
static _getUploadDirectory()
Get the directory with uploaded files.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static getWebspaceDir($mode="filesystem")
get webspace directory
static redirect($a_script)
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 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 renameExecutables($a_dir)
Rename uploaded executables for security reasons.
global $ilCtrl
Definition: ilias.php:18
exit
Definition: login.php:29
if($format !==null) $name
Definition: metadata.php:230
$source
Definition: metadata.php:76
$xml
Definition: metadata.php:332
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
redirection script todo: (a better solution should control the processing via a xml file)
$ret
Definition: parser.php:6
global $ilDB
$DIC
Definition: xapitoken.php:46