ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 $lng;
27
28 $lng->loadLanguageModule("content");
29 $this->type = "sahs";
30 parent::__construct($a_data, $a_id, $a_call_by_reference, false);
31 }
32
36 public function executeCommand()
37 {
38 global $ilAccess, $ilTabs, $ilErr;
39
40 $GLOBALS["ilLog"]->write("bc:" . $_GET["baseClass"] . "; nc:" . $this->ctrl->getNextClass($this) . "; cmd:" . $this->ctrl->getCmd());
41 if (strtolower($_GET["baseClass"]) == "iladministrationgui" ||
42 strtolower($_GET["baseClass"]) == "ilsahspresentationgui" ||
43 $this->getCreationMode() == true) {
44 $this->prepareOutput();
45 } else {
46 $this->getTemplate();
47 $this->setLocator();
48 $this->setTabs();
49 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm.svg"));
50 $this->tpl->setTitle($this->object->getTitle());
51 }
52
53 $next_class = $this->ctrl->getNextClass($this);
54 $cmd = $this->ctrl->getCmd();
55
56 switch ($next_class) {
57 case 'illtiproviderobjectsettinggui':
58 $this->setSettingsSubTabs();
59 $ilTabs->setSubTabActive('lti_provider');
60 $lti_gui = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
61 $lti_gui->setCustomRolesForSelection($GLOBALS['DIC']->rbac()->review()->getLocalRoles($this->object->getRefId()));
62 $lti_gui->offerLTIRolesForSelection(false);
63 $this->ctrl->forwardCommand($lti_gui);
64 break;
65
66
67 case 'ilobjectmetadatagui':
68 if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
69 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
70 }
71 include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
72 $md_gui = new ilObjectMetaDataGUI($this->object);
73 $this->ctrl->forwardCommand($md_gui);
74 break;
75
76 case 'ilexportgui':
77 case 'ilpermissiongui':
78 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
79 $perm_gui = new ilPermissionGUI($this);
80 $ret = $this->ctrl->forwardCommand($perm_gui);
81 break;
82
83 case "ilfilesystemgui":
84 $this->fs_gui = new ilFileSystemGUI($this->object->getDataDirectory());
85 $this->fs_gui->setUseUploadDirectory(true);
86 $this->fs_gui->setTableId("sahsfs" . $this->object->getId());
87 $ret = $this->ctrl->forwardCommand($this->fs_gui);
88 break;
89
90 case "ilcertificategui":
91 $this->setSettingsSubTabs();
92 $ilTabs->setSubTabActive('certificate');
93 include_once "./Services/Certificate/classes/class.ilCertificateGUI.php";
94 include_once "./Modules/ScormAicc/classes/class.ilSCORMCertificateAdapter.php";
95 $output_gui = new ilCertificateGUI(new ilSCORMCertificateAdapter($this->object));
96 $ret = $this->ctrl->forwardCommand($output_gui);
97 break;
98
99 case "illearningprogressgui":
100 include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
101
102 $new_gui = new ilLearningProgressGUI(ilLearningProgressGUI::LP_CONTEXT_REPOSITORY, $this->object->getRefId());
103 $this->ctrl->forwardCommand($new_gui);
104
105 break;
106
107 case 'illicensegui':
108 include_once("./Services/License/classes/class.ilLicenseGUI.php");
109 $license_gui = new ilLicenseGUI($this);
110 $ret = $this->ctrl->forwardCommand($license_gui);
111 break;
112
113 case "ilinfoscreengui":
114 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
115
116 $info = new ilInfoScreenGUI($this);
117 $info->enablePrivateNotes();
118 $info->enableLearningProgress();
119
120 // add read / back button
121 if ($ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
122 if (!$this->object->getEditable()) {
123 $ilToolbar = $GLOBALS['DIC']->toolbar();
124 $ilToolbar->addButtonInstance($this->object->getViewButton());
125 }
126 }
127
128 $info->enableNews();
129 if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
130 $info->enableNewsEditing();
131 $news_set = new ilSetting("news");
132 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
133 if ($enable_internal_rss) {
134 $info->setBlockProperty("news", "settings", true);
135 }
136 }
137 // show standard meta data section
138 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
139
140 // forward the command
141 $this->ctrl->forwardCommand($info);
142 break;
143
144 case "ilcommonactiondispatchergui":
145 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
147 $this->ctrl->forwardCommand($gui);
148 break;
149
150 case "ilobjstylesheetgui":
151 //$this->addLocations();
152 $this->ctrl->setReturn($this, "properties");
153 $ilTabs->clearTargets();
154 $style_gui = new ilObjStyleSheetGUI("", $this->object->getStyleSheetId(), false, false);
155 $style_gui->omitLocator();
156 if ($cmd == "create" || $_GET["new_type"]=="sty") {
157 $style_gui->setCreationMode(true);
158 }
159 //$ret =& $style_gui->executeCommand();
160
161 if ($cmd == "confirmedDelete") {
162 $this->object->setStyleSheetId(0);
163 $this->object->update();
164 }
165 $ret = $this->ctrl->forwardCommand($style_gui);
166 if ($cmd == "save" || $cmd == "copyStyle" || $cmd == "importStyle") {
167 $style_id = $ret;
168 $this->object->setStyleSheetId($style_id);
169 $this->object->update();
170 $this->ctrl->redirectByClass("ilobjstylesheetgui", "edit");
171 }
172 break;
173
174
175 case 'ilobjectcopygui':
176 $this->prepareOutput();
177 include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
178 $cp = new ilObjectCopyGUI($this);
179 $cp->setType('sahs');
180 $this->ctrl->forwardCommand($cp);
181 break;
182
183 default:
184 if ($this->object && !$this->object->getEditable()) {
185 $cmd = $this->ctrl->getCmd("properties");
186 } else {
187 $cmd = $this->ctrl->getCmd("frameset");
188 }
189 if ((strtolower($_GET["baseClass"]) == "iladministrationgui" ||
190 $this->getCreationMode() == true) &&
191 $cmd != "frameset") {
192 $cmd.= "Object";
193 }
194
195 // #9225
196 if ($cmd == "redrawHeaderAction") {
197 $cmd .= "Object";
198 }
199
200 $ret = $this->$cmd();
201 break;
202 }
203 }
204
205
206 public function viewObject()
207 {
208 if (strtolower($_GET["baseClass"]) == "iladministrationgui") {
209 parent::viewObject();
210 } else {
211 }
212 }
213
217 public function properties()
218 {
219 }
220
224 public function saveProperties()
225 {
226 }
227
231
235 public function initCreationForms($a_new_type)
236 {
237 $forms = array();
238
239 $this->initUploadForm();
241
242 $this->initCreationForm();
244
245 $forms[self::CFORM_CLONE] = $this->fillCloneTemplate(null, $a_new_type);
246
247 return $forms;
248 }
249
255 public function initCreationForm()
256 {
257 global $lng, $ilCtrl;
258
259 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
260 $this->form = new ilPropertyFormGUI();
261
262 // title
263 $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
264 $ti->setSize(min(40, ilObject::TITLE_LENGTH));
265 $ti->setMaxLength(ilObject::TITLE_LENGTH);
266 $ti->setRequired(true);
267 $this->form->addItem($ti);
268
269 // text area
270 $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
271 $ta->setCols(40);
272 $ta->setRows(2);
273 $this->form->addItem($ta);
274
275
276 $this->form->addCommandButton("save", $lng->txt("sahs_add"));
277 $this->form->addCommandButton("cancel", $lng->txt("cancel"));
278
279 $this->form->setTitle($lng->txt("scorm_new"));
280 $this->form->setFormAction($ilCtrl->getFormAction($this));
281 $this->form->setTarget(ilFrameTargetInfo::_getFrame("MainContent"));
282 }
283
287 public function initUploadForm()
288 {
289 global $lng, $ilCtrl;
290
291 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
292 $this->form = new ilPropertyFormGUI();
293
294 // type selection
295 $options = array(
296 "scorm2004" => $lng->txt("lm_type_scorm2004"),
297 "scorm" => $lng->txt("lm_type_scorm"),
298 "exportFile" => $lng->txt("sahs_export_file")
299 );
300 $si = new ilSelectInputGUI($this->lng->txt("type"), "sub_type");
301 $si->setOptions($options);
302 $this->form->addItem($si);
303
304 // input file
305 $fi = new ilFileInputGUI($this->lng->txt("select_file"), "scormfile");
306 $fi->setRequired(true);
307 $this->form->addItem($fi);
308
309 // todo "uploaded file"
310 // todo wysiwyg editor removement
311
312 include_once 'Services/FileSystem/classes/class.ilUploadFiles.php';
314 $options = array();
315 $fi->setRequired(false);
317 $options[""] = $this->lng->txt("cont_select_from_upload_dir");
318 foreach ($files as $file) {
319 $file = htmlspecialchars($file, ENT_QUOTES, "utf-8");
321 }
322 //
323 $si = new ilSelectInputGUI($this->lng->txt("cont_uploaded_file"), "uploaded_file");
324 $si->setOptions($options);
325 $this->form->addItem($si);
326 }
327
328
329 // validate file
330 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_validate_file"), "validate");
331 $cb->setValue("y");
332 //$cb->setChecked(true);
333 $this->form->addItem($cb);
334
335 // import for editing
336 $cb = new ilCheckboxInputGUI($this->lng->txt("sahs_authoring_mode"), "editable");
337 $cb->setValue("y");
338 $cb->setInfo($this->lng->txt("sahs_authoring_mode_info"));
339 $this->form->addItem($cb);
340
341 //
342 $radg = new ilRadioGroupInputGUI($lng->txt("sahs_sequencing"), "import_sequencing");
343 $radg->setValue(0);
344 $op1 = new ilRadioOption($lng->txt("sahs_std_sequencing"), 0, $lng->txt("sahs_std_sequencing_info"));
345 $radg->addOption($op1);
346 $op1 = new ilRadioOption($lng->txt("sahs_import_sequencing"), 1, $lng->txt("sahs_import_sequencing_info"));
347 $radg->addOption($op1);
348 $cb->addSubItem($radg);
349
350
351 $this->form->addCommandButton("upload", $lng->txt("import"));
352 $this->form->addCommandButton("cancel", $lng->txt("cancel"));
353
354 $this->form->setTitle($lng->txt("import_sahs"));
355 $this->form->setFormAction($ilCtrl->getFormAction($this, "upload"));
356 $this->form->setTarget(ilFrameTargetInfo::_getFrame("MainContent"));
357 }
358
365 public function uploadObject()
366 {
367 global $_FILES, $rbacsystem;
368
369 include_once 'Services/FileSystem/classes/class.ilUploadFiles.php';
370
371 // check create permission
372 if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], "sahs")) {
373 $this->ilias->raiseError($this->lng->txt("no_create_permission"), $this->ilias->error_obj->WARNING);
374 } elseif ($_FILES["scormfile"]["name"]) {
375 // check if file was uploaded
376 $source = $_FILES["scormfile"]["tmp_name"];
377 if (($source == 'none') || (!$source)) {
378 $this->ilias->raiseError($this->lng->txt("msg_no_file"), $this->ilias->error_obj->MESSAGE);
379 }
380 // get_cfg_var("upload_max_filesize"); // get the may filesize form t he php.ini
381 switch ($_FILES["scormfile"]["error"]) {
382 case UPLOAD_ERR_INI_SIZE:
383 $this->ilias->raiseError($this->lng->txt("err_max_file_size_exceeds"), $this->ilias->error_obj->MESSAGE);
384 break;
385
386 case UPLOAD_ERR_FORM_SIZE:
387 $this->ilias->raiseError($this->lng->txt("err_max_file_size_exceeds"), $this->ilias->error_obj->MESSAGE);
388 break;
389
390 case UPLOAD_ERR_PARTIAL:
391 $this->ilias->raiseError($this->lng->txt("err_partial_file_upload"), $this->ilias->error_obj->MESSAGE);
392 break;
393
394 case UPLOAD_ERR_NO_FILE:
395 $this->ilias->raiseError($this->lng->txt("err_no_file_uploaded"), $this->ilias->error_obj->MESSAGE);
396 break;
397 }
398
399 $file = pathinfo($_FILES["scormfile"]["name"]);
400 } elseif ($_POST["uploaded_file"]) {
401 // check if the file is in the upload directory and readable
402 if (!ilUploadFiles::_checkUploadFile($_POST["uploaded_file"])) {
403 $this->ilias->raiseError($this->lng->txt("upload_error_file_not_found"), $this->ilias->error_obj->MESSAGE);
404 }
405
406 $file = pathinfo($_POST["uploaded_file"]);
407 } else {
408 $this->ilias->raiseError($this->lng->txt("msg_no_file"), $this->ilias->error_obj->MESSAGE);
409 }
410
411 $name = substr($file["basename"], 0, strlen($file["basename"]) - strlen($file["extension"]) - 1);
412 if ($name == "") {
413 $name = $this->lng->txt("no_title");
414 }
415
416 $subType = $_POST["sub_type"];
417 // create and insert object in objecttree
418 switch ($subType) {
419 case "scorm2004":
420 include_once("./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
421 $newObj = new ilObjSCORM2004LearningModule();
422 $newObj->setEditable($_POST["editable"]=='y');
423 $newObj->setImportSequencing($_POST["import_sequencing"]);
424 $newObj->setSequencingExpertMode($_POST["import_sequencing"]);
425 break;
426
427 case "scorm":
428 include_once("./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php");
429 $newObj = new ilObjSCORMLearningModule();
430 break;
431
432 case "exportFile":
433 $sFile = $_FILES["scormfile"];
434 $fType = $sFile["type"];
435 $cFileTypes = ["application/zip", "application/x-compressed","application/x-zip-compressed"];
436 if (in_array($fType, $cFileTypes)) {
437 $timeStamp = time();
438 $tempFile = $sFile["tmp_name"];
439 $lmDir = ilUtil::getWebspaceDir("filesystem") . "/lm_data/";
440 $lmTempDir = $lmDir . $timeStamp;
441 if (!file_exists($lmTempDir)) {
442 mkdir($lmTempDir, 0755, true);
443 }
444 $zar = new ZipArchive();
445 $zar->open($tempFile);
446 $zar->extractTo($lmTempDir);
447 $zar->close();
448 require_once "./Modules/ScormAicc/classes/class.ilScormAiccImporter.php";
449 $importer = new ilScormAiccImporter();
450 $import_dirname = $lmTempDir . '/' . substr($_FILES["scormfile"]["name"], 0, strlen($a_filename) - 4);
451 if ($importer->importXmlRepresentation("sahs", null, $import_dirname, "") == true) {
452 $importFromXml = true;
453 }
454 $mprops = [];
455 $mprops = $importer->moduleProperties;
456 $subType = $mprops["SubType"][0];
457 if ($subType == "scorm") {
458 include_once("./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php");
459 $newObj = new ilObjSCORMLearningModule();
460 } else {
461 include_once("./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
462 $newObj = new ilObjSCORM2004LearningModule();
463 // $newObj->setEditable($_POST["editable"]=='y');
464 // $newObj->setImportSequencing($_POST["import_sequencing"]);
465 // $newObj->setSequencingExpertMode($_POST["import_sequencing"]);
466 }
467 }
468 break;
469 }
470
471 $newObj->setTitle($name);
472 $newObj->setSubType($subType);
473 $newObj->setDescription("");
474 $newObj->create(true);
475 $newObj->createReference();
476 $newObj->putInTree($_GET["ref_id"]);
477 $newObj->setPermissions($_GET["ref_id"]);
478
479 // create data directory, copy file to directory
480 $newObj->createDataDirectory();
481
482 if ($_FILES["scormfile"]["name"]) {
483 if ($importFromXml) {
484 $scormFile = "content.zip";
485 $scormFilePath = $import_dirname . "/" . $scormFile;
486 $file_path = $newObj->getDataDirectory() . "/" . $scormFile;
487 ilFileUtils::rename($scormFilePath, $file_path);
488 ilUtil::unzip($file_path);
489 unlink($file_path);
490 ilUtil::delDir($lmTempDir, false);
491 } else {
492 // copy uploaded file to data directory
493 $file_path = $newObj->getDataDirectory() . "/" . $_FILES["scormfile"]["name"];
494 ilUtil::moveUploadedFile(
495 $_FILES["scormfile"]["tmp_name"],
496 $_FILES["scormfile"]["name"],
497 $file_path
498 );
499 ilUtil::unzip($file_path);
500 }
501 } else {
502 // copy uploaded file to data directory
503 $file_path = $newObj->getDataDirectory() . "/" . $_POST["uploaded_file"];
504 ilUploadFiles::_copyUploadFile($_POST["uploaded_file"], $file_path);
505 ilUtil::unzip($file_path);
506 }
507 ilUtil::renameExecutables($newObj->getDataDirectory());
508
509 $title = $newObj->readObject();
510 if ($title != "") {
511 ilObject::_writeTitle($newObj->getId(), $title);
512 }
513
514 //auto set learning progress settings
515 $newObj->setLearningProgressSettingsAtUpload();
516
517 if ($importFromXml) {
518 $importer->writeData("sahs", "5.1.0", $newObj->getId());
519 }
520
521 ilUtil::sendInfo($this->lng->txt($newObj->getType() . "_added"), true);
522 ilUtil::redirect("ilias.php?baseClass=ilSAHSEditGUI&ref_id=" . $newObj->getRefId());
523 }
524
525 public function upload()
526 {
527 $this->uploadObject();
528 }
529
530
531
535 public function saveObject()
536 {
537 if (trim($_POST["title"]) == "") {
538 $this->ilias->raiseError($this->lng->txt("msg_no_title"), $this->ilias->error_obj->MESSAGE);
539 }
540
541 include_once("./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
542 $newObj = new ilObjSCORM2004LearningModule();
543 $newObj->setTitle(ilUtil::stripSlashes($_POST["title"]));
544 $newObj->setSubType("scorm2004");
545 $newObj->setEditable(true);
546 $newObj->setDescription(ilUtil::stripSlashes($_POST["desc"]));
547 $newObj->create();
548 $newObj->createReference();
549 $newObj->putInTree($_GET["ref_id"]);
550 $newObj->setPermissions($_GET["ref_id"]);
551 $newObj->createDataDirectory();
552 $newObj->createScorm2004Tree();
553 ilUtil::sendInfo($this->lng->txt($newObj->getType() . "_added"), true);
554
555 // #7375
556 $this->ctrl->setParameterByClass("ilObjSCORM2004LearningModuleGUI", "ref_id", $newObj->getRefId());
557 $this->ctrl->redirectByClass(array("ilSAHSEditGUI", "ilObjSCORM2004LearningModuleGUI"), "showOrganization");
558 }
559
560
564 public function info()
565 {
566 $this->infoObject();
567 }
568
572 public function owner()
573 {
574 $this->ownerObject();
575 }
576
580 public function getTemplate()
581 {
582 global $lng;
583
584 $this->tpl->getStandardTemplate();
585 }
586
590 public function setTabs()
591 {
592 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm.svg"));
593 $this->tpl->setTitle($this->object->getTitle());
594 if (strtolower($_GET["baseClass"]) == "ilsahseditgui") {
595 $this->getTabs($this->tabs_gui);
596 }
597 //if(strtolower($_GET["baseClass"]) == "ilsahseditgui") $this->getTabs();
598 }
599
603 public function certificate()
604 {
605 include_once "./Services/Certificate/classes/class.ilCertificateGUI.php";
606 include_once "./Modules/ScormAicc/classes/class.ilSCORMCertificateAdapter.php";
607 $output_gui = new ilCertificateGUI(new ilSCORMCertificateAdapter($this->object));
608 $output_gui->certificateEditor();
609 }
610
616 public function getTabs()
617 {
618 global $rbacsystem, $ilCtrl, $ilHelp;
619
620 if ($this->ctrl->getCmd() == "delete") {
621 return;
622 }
623
624 switch ($this->object->getSubType()) {
625 case "scorm2004":
626 $ilHelp->setScreenIdComponent("sahs13");
627 break;
628
629 case "scorm":
630 $ilHelp->setScreenIdComponent("sahs12");
631 break;
632 }
633
634 // file system gui tabs
635 // properties
636 $ilCtrl->setParameterByClass("ilfilesystemgui", "resetoffset", 1);
637 $this->tabs_gui->addTarget(
638 "cont_list_files",
639 $this->ctrl->getLinkTargetByClass("ilfilesystemgui", "listFiles"),
640 "",
641 "ilfilesystemgui"
642 );
643 $ilCtrl->setParameterByClass("ilfilesystemgui", "resetoffset", "");
644
645 // info screen
646 $force_active = ($this->ctrl->getNextClass() == "ilinfoscreengui")
647 ? true
648 : false;
649 $this->tabs_gui->addTarget(
650 "info_short",
651 $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"),
652 "",
653 "ilinfoscreengui",
654 "",
655 $force_active
656 );
657
658 // properties
659 $this->tabs_gui->addTarget(
660 "settings",
661 $this->ctrl->getLinkTarget($this, "properties"),
662 array("", "properties"),
663 get_class($this)
664 );
665
666 // learning progress and offline mode
667 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
668 if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
669 //if scorm && offline_mode activated
670 if ($this->object->getSubType() == "scorm2004" || $this->object->getSubType() == "scorm") {
671 if ($this->object->getOfflineMode() == true) {
672 $this->tabs_gui->addTarget(
673 "offline_mode_manager",
674 $this->ctrl->getLinkTarget($this, "offlineModeManager"),
675 "offlineModeManager",
676 "ilobjscormlearningmodulegui"
677 );
678 }
679 }
680
681 $this->tabs_gui->addTarget(
682 'learning_progress',
683 $this->ctrl->getLinkTargetByClass(array('illearningprogressgui'), ''),
684 '',
685 array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui')
686 );
687 }
688
689 // tracking data
690 if ($rbacsystem->checkAccess("read_learning_progress", $this->object->getRefId()) || $rbacsystem->checkAccess("edit_learning_progress", $this->object->getRefId())) {
691 if ($this->object->getSubType() == "scorm2004" || $this->object->getSubType() == "scorm") {
692 include_once('./Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
694 if ($privacy->enabledSahsProtocolData()) {
695 $this->tabs_gui->addTarget(
696 "cont_tracking_data",
697 $this->ctrl->getLinkTarget($this, "showTrackingItems"),
698 "showTrackingItems",
699 get_class($this)
700 );
701 }
702 }
703 }
704 include_once("Services/License/classes/class.ilLicenseAccess.php");
705 if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId())
707 $this->tabs_gui->addTarget(
708 "license",
709 $this->ctrl->getLinkTargetByClass('illicensegui', ''),
710 "",
711 "illicensegui"
712 );
713 }
714
715 // edit meta
716 include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
717 $mdgui = new ilObjectMetaDataGUI($this->object);
718 $mdtab = $mdgui->getTab();
719 if ($mdtab) {
720 $this->tabs_gui->addTarget(
721 "meta_data",
722 $mdtab,
723 "",
724 "ilmdeditorgui"
725 );
726 }
727
728 // export
729 if ($rbacsystem->checkAccess("edit_permission", "", $this->object->getRefId())) {
730 $this->tabs_gui->addTarget(
731 "export",
732 $this->ctrl->getLinkTarget($this, "export"),
733 array("", "export"),
734 get_class($this)
735 );
736 }
737
738 // perm
739 if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) {
740 $this->tabs_gui->addTarget(
741 "perm_settings",
742 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
743 array("perm","info","owner"),
744 'ilpermissiongui'
745 );
746 }
747 }
748
752 public static function _goto($a_target)
753 {
754 global $ilAccess, $ilErr, $lng;
755
756 $parts = explode("_", $a_target);
757
758 if ($ilAccess->checkAccess("write", "", $parts[0])) {
759 $_GET["cmd"] = "";
760 $_GET["baseClass"] = "ilSAHSEditGUI";
761 $_GET["ref_id"] = $parts[0];
762 $_GET["obj_id"] = $parts[1];
763 include("ilias.php");
764 exit;
765 }
766 if ($ilAccess->checkAccess("visible", "", $parts[0]) || $ilAccess->checkAccess("read", "", $parts[0])) {
767 $_GET["cmd"] = "infoScreen";
768 $_GET["baseClass"] = "ilSAHSPresentationGUI";
769 $_GET["ref_id"] = $parts[0];
770 include("ilias.php");
771 exit;
772 } else {
773 if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
775 $lng->txt("msg_no_perm_read_item"),
777 ), true);
779 }
780 }
781
782 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
783 }
784
785 public function addLocatorItems()
786 {
787 global $ilLocator;
788
789 if (is_object($this->object)) {
790 $ilLocator->addItem(
791 $this->object->getTitle(),
792 $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"),
793 "",
794 $_GET["ref_id"]
795 );
796 }
797 }
798
805 public function editContent()
806 {
807 global $ilCtrl;
808
809 if (!$this->object->getEditable()) {
810 $ilCtrl->redirectByClass("ilfilesystemgui", "listFiles");
811 } else {
812 $ilCtrl->redirectByClass("ilobjscorm2004learningmodulegui", "editOrganization");
813 }
814 }
815
819 public function setSettingsSubTabs()
820 {
821 global $lng, $ilTabs, $ilCtrl;
822
823 $ilTabs->addSubTabTarget(
824 "cont_settings",
825 $this->ctrl->getLinkTarget($this, "properties"),
826 array("edit", ""),
827 get_class($this)
828 );
829
830 $ilTabs->addSubTabTarget(
831 "cont_sc_new_version",
832 $this->ctrl->getLinkTarget($this, "newModuleVersion"),
833 array("edit", ""),
834 get_class($this)
835 );
836
837 include_once "Services/Certificate/classes/class.ilCertificate.php";
839 // // create and insert object in objecttree
840 // $ilTabs->addSubTabTarget("certificate",
841 // $this->ctrl->getLinkTarget($this, "certificate"),
842 // array("certificate", "certificateEditor", "certificateRemoveBackground", "certificateSave",
843 // "certificatePreview", "certificateDelete", "certificateUpload", "certificateImport")
844 // );
845 $ilTabs->addSubTabTarget(
846 "certificate",
847 $this->ctrl->getLinkTargetByClass("ilcertificategui", "certificateeditor"),
848 "",
849 "ilcertificategui"
850 );
851 }
852
853 $lti_settings = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
854 if ($lti_settings->hasSettingsAccess()) {
855 $ilTabs->addSubTabTarget(
856 'lti_provider',
857 $this->ctrl->getLinkTargetByClass(ilLTIProviderObjectSettingGUI::class)
858 );
859 }
860
861 $ilTabs->setTabActive('settings');
862 }
863
864 public function export()
865 {
866 global $lng, $ilTabs, $ilCtrl, $tpl;
867 $ilTabs->activateTab("export");
868 include_once("./Services/Export/classes/class.ilExportGUI.php");
869 $exp_gui = new ilExportGUI($this);
870 $ilCtrl->setCmd("");
871 $exp_gui->addFormat("xml");
872 $ret = $this->ctrl->forwardCommand($exp_gui);
873 return $ret;
874 }
875
876 public function exportModule()
877 {
878 global $ilDB;
879
880 $moduleId = ilObject::_lookupObjectId($_GET["ref_id"]);
881 require_once "./Modules/ScormAicc/classes/class.ilScormAiccExporter.php";
882 $exporter = new ilScormAiccExporter();
883 $xml = $exporter->getXmlRepresentation("sahs", "5.1.0", $moduleId);
884 }
885
886 public function getType()
887 {
888 return "sahs";
889 }
890} // END class.ilObjSAHSLearningModule
sprintf('%.4f', $callTime)
$files
Definition: add-vimline.php:18
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
$source
Definition: linkback.php:22
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
GUI class to create PDF certificates.
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.
static _isEnabled()
Check, if licencing is enabled This check is called from the ilAccessHandler class.
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()
list childs of current object
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 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.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
global $ilCtrl
Definition: ilias.php:18
if($format !==null) $name
Definition: metadata.php:146
$xml
Definition: metadata.php:240
$info
Definition: index.php:5
redirection script todo: (a better solution should control the processing via a xml file)
$ret
Definition: parser.php:6
if(isset($_POST['submit'])) $form
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file
global $ilDB