ILIAS  release_8 Revision v8.24
class.ilObjSAHSLearningModuleGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
33{
35
39 public function __construct($data, int $id, bool $call_by_reference, bool $prepare_output = true)//missing typehint because mixed
40 {
41 global $DIC;
42 $lng = $DIC->language();
43 $rbacsystem = $DIC->access();
44 $lng->loadLanguageModule("content");
45 $this->type = "sahs";
47 }
48
54 public function executeCommand(): void
55 {
56 global $DIC;
57 $ilAccess = $DIC->access();
58 $ilTabs = $DIC->tabs();
59 $ilErr = $DIC['ilErr'];
60 $navigationHistory = $DIC['ilNavigationHistory'];
61
62 $baseClass = $refId = $DIC->http()->wrapper()->query()->retrieve('baseClass', $DIC->refinery()->kindlyTo()->string());
63 $ilLog = ilLoggerFactory::getLogger('sahs');
64 $ilLog->debug("bc:" . $baseClass . "; nc:" . $this->ctrl->getNextClass($this) . "; cmd:" . $this->ctrl->getCmd());
65 if (strtolower($baseClass) === "iladministrationgui" ||
66 strtolower($baseClass) === "ilsahspresentationgui" ||
67 $this->getCreationMode() == true) {
68 $this->prepareOutput();
69 } else {
70 $this->getTemplate();
71 $this->setLocator();
72 $this->setTabs();
73 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm.svg"));
74 $this->tpl->setTitle($this->object->getTitle());
75 $navigationHistory->addItem(
76 $this->object->getRefId(),
77 ilLink::_getLink($this->object->getRefId(), $this->object->getType()),
78 $this->object->getType()
79 );
80 }
81
82 $next_class = $this->ctrl->getNextClass($this);
83 $cmd = $this->ctrl->getCmd();
84
85 switch ($next_class) {
86 case 'illtiproviderobjectsettinggui':
87 $this->setSettingsSubTabs();
88 $ilTabs->setSubTabActive('lti_provider');
89 $lti_gui = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
90 $lti_gui->setCustomRolesForSelection($GLOBALS['DIC']->rbac()->review()->getLocalRoles($this->object->getRefId()));
91 $lti_gui->offerLTIRolesForSelection(false);
92 $this->ctrl->forwardCommand($lti_gui);
93 break;
94
95
96 case 'ilobjectmetadatagui':
97 if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
98 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
99 }
100 $md_gui = new ilObjectMetaDataGUI($this->object);
101 $this->ctrl->forwardCommand($md_gui);
102 break;
103
104 // case 'ilexportgui':
105 // $exp = new ilExportGUI($this);
106 // $exp->addFormat('xml');
107 // $this->ctrl->forwardCommand($exp);
108 // break;
109
110 case 'ilpermissiongui':
111 $perm_gui = new ilPermissionGUI($this);
112 $this->ctrl->forwardCommand($perm_gui);
113 break;
114
115 case "ilfilesystemgui":
116 $fs_gui = new ilFileSystemGUI($this->object->getDataDirectory());
117 $fs_gui->setUseUploadDirectory(true);
118 $fs_gui->setTableId("sahsfs" . $this->object->getId());
119 $this->ctrl->forwardCommand($fs_gui);
120 break;
121
122 case "ilcertificategui":
123 $this->setSettingsSubTabs();
124 $ilTabs->setSubTabActive('certificate');
125
126 $guiFactory = new ilCertificateGUIFactory();
127 $output_gui = $guiFactory->create($this->object);
128
129 $this->ctrl->forwardCommand($output_gui);
130 break;
131
132 case "illearningprogressgui":
134 $this->ctrl->forwardCommand($new_gui);
135
136 break;
137
138 case "ilinfoscreengui":
139 $ilTabs->setTabActive('info_short');
140 $this->infoScreenForward();
141 break;
142
143 case "ilcommonactiondispatchergui":
145 if ($gui !== null) {
146 $this->ctrl->forwardCommand($gui);
147 }
148 break;
149
150 case 'ilobjectcopygui':
151 $this->prepareOutput();
152 $cp = new ilObjectCopyGUI($this);
153 $cp->setType('sahs');
154 $this->ctrl->forwardCommand($cp);
155 break;
156
157 default:
158 // if ($this->object && !$this->object->getEditable()) {
159 $cmd = $this->ctrl->getCmd("properties");
160 // }
161 if ((strtolower($baseClass) === "iladministrationgui" ||
162 $this->getCreationMode() == true) &&
163 $cmd !== "frameset") {
164 $cmd .= "Object";
165 }
166
167 // #9225
168 if ($cmd === "redrawHeaderAction") {
169 $cmd .= "Object";
170 }
171
172 $this->$cmd();
173 break;
174 }
175 }
176
177 protected function infoScreen(): void
178 {
179 $this->ctrl->setCmd("showSummary");
180 $this->ctrl->setCmdClass("ilinfoscreengui");
181 $this->infoScreenForward();
182 }
183
184 protected function infoScreenForward(): void
185 {
186 if (!$this->checkPermissionBool("visible") && !$this->checkPermissionBool("read")) {
187 $this->error->raiseError($this->lng->txt("msg_no_perm_read"));
188 }
189
190 $info = new ilInfoScreenGUI($this);
191 $info->enablePrivateNotes();
192 $info->enableLearningProgress();
193
194 // add read / back button
195 if ($this->checkPermissionBool("read")) {
196 $ilToolbar = $GLOBALS['DIC']->toolbar();
197 $ilToolbar->addButtonInstance($this->object->getViewButton());
198 }
199
200 $info->enableNewsEditing(false);
201 if ($this->checkPermissionBool("write")) {
202 $news_set = new ilSetting("news");
203 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
204 if ($enable_internal_rss) {
205 $info->setBlockProperty("news", "settings", "");
206 $info->setBlockProperty("news", "public_notifications_option", "true");
207 }
208 }
209 // show standard meta data section
210 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
211
212 // forward the command
213 $this->ctrl->forwardCommand($info);
214 }
215
216
217 // /**
218 // * @return void
219 // * @throws ilObjectException
220 // */
221 // public function viewObject() : void
222 // {
223 // if (strtolower($_GET["baseClass"]) == "iladministrationgui") {
224 // parent::viewObject();
225 // } else {
226 // }
227 // }
228
232 public function properties(): void
233 {
234 $this->ctrl->setParameterByClass(
235 "ilSAHSEditGUI",
236 "ref_id",
237 $this->ref_id
238 );
239 $this->ctrl->redirectByClass(ilSAHSEditGUI::class);
240 }
241
242 public function saveProperties(): void
243 {
244 }
245
249
255 protected function initCreationForms(string $a_new_type): array
256 {
257 $forms = [];
258
259 $this->initUploadForm();
261
262 $forms[self::CFORM_CLONE] = $this->fillCloneTemplate(null, $a_new_type);
263
264 return $forms;
265 }
266
270 public function initUploadForm(): void
271 {
272 global $DIC;
273 $lng = $DIC->language();
274 $ilCtrl = $DIC->ctrl();
275 $this->form = new ilPropertyFormGUI();
276
277 // type selection
278 $options = array(
279 "scorm2004" => $lng->txt("lm_type_scorm2004"),
280 "scorm" => $lng->txt("lm_type_scorm"),
281 "exportFile" => $lng->txt("sahs_export_file")
282 );
283 $si = new ilSelectInputGUI($this->lng->txt("type"), "sub_type");
284 $si->setOptions($options);
285 $this->form->addItem($si);
286
287 $options = array();
289 $options[""] = $this->lng->txt("cont_select_from_upload_dir");
291 foreach ($files as $file) {
292 $file = htmlspecialchars($file, ENT_QUOTES, "utf-8");
293 $options[$file] = $file;
294 }
295 }
296 if (count($options) > 1) {
297 // choose upload directory
298 $radg = new ilRadioGroupInputGUI($lng->txt("cont_choose_file_source"), "file_source");
299 $op0 = new ilRadioOption($this->lng->txt("cont_choose_local"), "local");
300 $radg->addOption($op0);
301 $op1 = new ilRadioOption($this->lng->txt("cont_choose_upload_dir"), "upload_dir");
302 $radg->addOption($op1);
303 $radg->setValue("local");
304
305 $fi = new ilFileInputGUI($this->lng->txt("select_file"), "scormfile");
306 $fi->setRequired(true);
307 $op0->addSubItem($fi);
308
309 $si = new ilSelectInputGUI($this->lng->txt("cont_uploaded_file"), "uploaded_file");
310 $si->setOptions($options);
311 $op1->addSubItem($si);
312
313 $this->form->addItem($radg);
314 } else {
315 $fi = new ilFileInputGUI($this->lng->txt("select_file"), "scormfile");
316 $fi->setRequired(true);
317 $this->form->addItem($fi);
318 }
319
320 $this->form->addCommandButton("upload", $lng->txt("import"));
321 $this->form->addCommandButton("cancel", $lng->txt("cancel"));
322
323 $this->form->setTitle($lng->txt("import_sahs"));
324 $this->form->setFormAction($ilCtrl->getFormAction($this, "upload"));
325 $this->form->setTarget(ilFrameTargetInfo::_getFrame("MainContent"));
326 }
327
336 public function uploadObject(): void
337 {
338 global $DIC;
339 $rbacsystem = $DIC->access();
340 $ilErr = $DIC['ilErr'];
341 $ilLog = ilLoggerFactory::getLogger('sahs');
342 $refId = $DIC->http()->wrapper()->query()->retrieve('ref_id', $DIC->refinery()->kindlyTo()->int());
343 $importFromXml = false;
344
345 // check create permission
346 if (!$rbacsystem->checkAccess("create", '', $refId, "sahs")) {
347 $ilErr->raiseError($this->lng->txt("no_create_permission"), $ilErr->WARNING);
348 } elseif ($_FILES["scormfile"]["name"]) {
349 // check if file was uploaded
350 $source = $_FILES["scormfile"]["tmp_name"];
351 if (($source === 'none') || (!$source)) {
352 $ilErr->raiseError($this->lng->txt("msg_no_file"), $ilErr->MESSAGE);
353 }
354 // get_cfg_var("upload_max_filesize"); // get the may filesize form t he php.ini
355 switch ($_FILES["scormfile"]["error"]) {
356 case UPLOAD_ERR_INI_SIZE:
357 case UPLOAD_ERR_FORM_SIZE:
358 $ilErr->raiseError($this->lng->txt("err_max_file_size_exceeds"), $ilErr->MESSAGE);
359 break;
360
361 case UPLOAD_ERR_PARTIAL:
362 $ilErr->raiseError($this->lng->txt("err_partial_file_upload"), $ilErr->MESSAGE);
363 break;
364
365 case UPLOAD_ERR_NO_FILE:
366 $ilErr->raiseError($this->lng->txt("err_no_file_uploaded"), $ilErr->MESSAGE);
367 break;
368 }
369
370 $file = pathinfo($_FILES["scormfile"]["name"]);
371 } elseif ($DIC->http()->wrapper()->post()->has('uploaded_file')) {
372 $uploadedFile = $DIC->http()->wrapper()->post()->retrieve('uploaded_file', $DIC->refinery()->kindlyTo()->string());
373 // check if the file is in the upload directory and readable
375 $ilErr->raiseError($this->lng->txt("upload_error_file_not_found"), $ilErr->MESSAGE);
376 }
377
378 $file = pathinfo($uploadedFile);
379 } else {
380 $ilErr->raiseError($this->lng->txt("msg_no_file"), $ilErr->MESSAGE);
381 }
382
383 $name = substr($file["basename"], 0, strlen($file["basename"]) - strlen($file["extension"]) - 1);
384 if ($name == "") {
385 $name = $this->lng->txt("no_title");
386 }
387
388 $description = "";
389
390 $subType = "scorm2004";
391 if ($DIC->http()->wrapper()->post()->has('sub_type')) {
392 $subType = $DIC->http()->wrapper()->post()->retrieve('sub_type', $DIC->refinery()->kindlyTo()->string());
393 }
394
395 // always import authoring packages as scorm2004, see bug #27801
396 // if ($_POST["editable"] == 'y') {
397 // $subType = "scorm2004";
398 // }
399
400 // create and insert object in objecttree
401 switch ($subType) {
402 case "scorm2004":
403 $newObj = new ilObjSCORM2004LearningModule();
404 break;
405
406 case "scorm":
407 $newObj = new ilObjSCORMLearningModule();
408 break;
409
410 case "exportFile":
411 $sFile = $_FILES["scormfile"];
412 $fType = $sFile["type"];
413 $cFileTypes = ["application/zip", "application/x-compressed","application/x-zip-compressed"];
414 if (in_array($fType, $cFileTypes)) {
415 $tempFile = $sFile["tmp_name"];
416 $lmTempDir = ilFileUtils::ilTempnam();
417 ilFileUtils::makeDir($lmTempDir);
418 $zar = new ZipArchive();
419 $zar->open($tempFile);
420 $zar->extractTo($lmTempDir);
421 $zar->close();
423 $importer = new ilScormAiccImporter();
424 $import_dirname = $lmTempDir . '/' . substr($_FILES["scormfile"]["name"], 0, -4);
425 $importer->importXmlRepresentation("sahs", "", $import_dirname, null);
426 $import_result = $importer->getResult();
427
428 $importFromXml = true;
429 if ($import_result->isOK()) {
430 $properties = $import_result->value();
431 if (($subType = $properties['SubType']) === 'scorm') {
432 $newObj = new ilObjSCORMLearningModule();
433 } else {
434 $newObj = new ilObjSCORM2004LearningModule();
435 }
436 $name = $properties['Title'];
437 $description = $properties['Description'];
438 } else {
439 ilFileUtils::delDir($lmTempDir, false);
440 $ilLog->error('SCORM import of ILIAS exportfile not possible because parsing error');
441 $ilLog->error($import_result->error());
442 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("import_file_not_valid"), true);
443 return;
444 }
445 }
446 break;
447 }
448
449 $newObj->setTitle($name);
450 $newObj->setSubType($subType);
451 $newObj->setDescription($description);
452 $newObj->setOfflineStatus(false);
453 $newObj->create(true);
454 $newObj->createReference();
455 $newObj->putInTree($refId);
456 $newObj->setPermissions($refId);
457
458 // create data directory, copy file to directory
459 $newObj->createDataDirectory();
460
461 if ($_FILES["scormfile"]["name"]) {
462 if ($importFromXml) {
463 $scormFile = "content.zip";
464 $scormFilePath = $import_dirname . "/" . $scormFile;
465 $file_path = $newObj->getDataDirectory() . "/" . $scormFile;
466 ilFileUtils::rename($scormFilePath, $file_path);
467 ilFileUtils::unzip($file_path);
468 unlink($file_path);
469 ilFileUtils::delDir($lmTempDir, false);
470 } else {
471 // copy uploaded file to data directory
472 $file_path = $newObj->getDataDirectory() . "/" . $_FILES["scormfile"]["name"];
474 $_FILES["scormfile"]["tmp_name"],
475 $_FILES["scormfile"]["name"],
476 $file_path
477 );
478 ilFileUtils::unzip($file_path);
479 }
480 } else {
481 // copy uploaded file to data directory
482 $uploadedFile = $DIC->http()->wrapper()->post()->retrieve('uploaded_file', $DIC->refinery()->kindlyTo()->string());
483 $file_path = $newObj->getDataDirectory() . "/" . $uploadedFile;
485 ilFileUtils::unzip($file_path);
486 }
487 ilFileUtils::renameExecutables($newObj->getDataDirectory());
488
489 $title = $newObj->readObject();
490 if ($title != "") {
491 ilObject::_writeTitle($newObj->getId(), $title);
492 }
493
494 //auto set learning progress settings
495 $newObj->setLearningProgressSettingsAtUpload();
496
497 if ($importFromXml) {
498 $importer->writeData("sahs", "5.1.0", $newObj->getId());
499 }
500
501 $this->tpl->setOnScreenMessage('info', $this->lng->txt($newObj->getType() . "_added"), true);
502 ilUtil::redirect("ilias.php?baseClass=ilSAHSEditGUI&ref_id=" . $newObj->getRefId());
503 }
504
511 public function upload(): void
512 {
513 $this->uploadObject();
514 }
515
516
517
521 // public function saveObject()
522 // {
523 // global $DIC;
524 // $ilErr = $DIC["ilErr"];
525 //
526 // if (trim($_POST["title"]) == "") {
527 // $ilErr->raiseError($this->lng->txt("msg_no_title"), $ilErr->MESSAGE);
528 // }
529 // $newObj = new ilObjSCORM2004LearningModule();
530 // $newObj->setTitle(ilUtil::stripSlashes($_POST["title"]));
531 // $newObj->setSubType("scorm2004");
532 // $newObj->setEditable(true);
533 // $newObj->setDescription(ilUtil::stripSlashes($_POST["desc"]));
534 // $newObj->create();
535 // $newObj->createReference();
536 // $newObj->putInTree($_GET["ref_id"]);
537 // $newObj->setPermissions($_GET["ref_id"]);
538 // $newObj->createDataDirectory();
539 // $newObj->createScorm2004Tree();
540 // ilUtil::sendInfo($this->lng->txt($newObj->getType() . "_added"), true);
541 //
542 // // #7375
543 // $this->ctrl->setParameterByClass("ilObjSCORM2004LearningModuleGUI", "ref_id", $newObj->getRefId());
544 // $this->ctrl->redirectByClass(array("ilSAHSEditGUI", "ilObjSCORM2004LearningModuleGUI"), "showOrganization");
545 // }
546
547
548 // /**
549 // * permission form
550 // */
551 // public function info()
552 // {
553 // $this->infoObject();
554 // }
555
556 // /**
557 // * show owner of learning module
558 // */
559 // public function owner()
560 // {
561 // $this->ownerObject();
562 // }
563
567 public function getTemplate(): void
568 {
569 global $DIC;
570 $lng = $DIC->language();
571
572 $this->tpl->loadStandardTemplate();
573 }
574
578 protected function setTabs(): void
579 {
580 global $DIC;
581 $baseClass = $refId = $DIC->http()->wrapper()->query()->retrieve('baseClass', $DIC->refinery()->kindlyTo()->string());
582 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm.svg"));
583 $this->tpl->setTitle($this->object->getTitle());
584 $this->tpl->setDescription($this->object->getDescription());
585 if ($this->object && $this->object->getOfflineStatus()) {
586 $this->tpl->setAlertProperties(array(
587 array("alert" => true,
588 "property" => $this->lng->txt("status"),
589 "value" => $this->lng->txt("offline"))
590 ));
591 }
592 if (strtolower($baseClass) === "ilsahseditgui" || strtolower($baseClass) === "ilrepositorygui") {
593 $this->getTabs();
594 }
595 }
596
600 public function certificate(): void
601 {
602 $guiFactory = new ilCertificateGUIFactory();
603 $output_gui = $guiFactory->create($this->object);
604
605 $output_gui->certificateEditor();
606 }
607
612 protected function getTabs(): void
613 {
614 global $DIC;
615 $rbacsystem = $DIC->access();
616 $ilCtrl = $DIC->ctrl();
617 $ilHelp = $DIC->help();
618
619 if ($this->ctrl->getCmd() === "delete") {
620 return;
621 }
622
623 switch ($this->object->getSubType()) {
624 case "scorm2004":
625 $ilHelp->setScreenIdComponent("sahs13");
626 break;
627
628 case "scorm":
629 $ilHelp->setScreenIdComponent("sahs12");
630 break;
631 }
632
633 // file system gui tabs
634 // properties
635 if ($rbacsystem->checkAccess("write", "", $this->object->getRefId())) {
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 // if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
667 // $this->tabs_gui->addTarget(
668 // 'learning_progress',
669 // $this->ctrl->getLinkTargetByClass(array('illearningprogressgui'), ''),
670 // '',
671 // array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui')
672 // );
673 // }
674
675 // tracking data
676 if ($rbacsystem->checkAccess("read_learning_progress", "", $this->object->getRefId()) || $rbacsystem->checkAccess("edit_learning_progress", "", $this->object->getRefId())) {
677 $ar_rights = [];
678 if ($rbacsystem->checkAccess("read_learning_progress", "", $this->object->getRefId())) {
679 $ar_rights = ['illplistofobjectsgui'];
680 }
681 if ($rbacsystem->checkAccess("edit_learning_progress", "", $this->object->getRefId())) {
682 $ar_rights[] = 'illplistofsettingsgui';
683 }
684 if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
685 $this->tabs_gui->addTarget(
686 'learning_progress',
687 $this->ctrl->getLinkTargetByClass(array('illearningprogressgui'), ''),
688 '',
689 $ar_rights
690 );
691 }
692
693 if ($this->object->getSubType() === "scorm2004" || $this->object->getSubType() === "scorm") {
695 if ($privacy->enabledSahsProtocolData()) {
696 $scormClass = "ilobjscormlearningmodulegui";
697 if ($this->object->getSubType() === "scorm2004") {
698 $scormClass = "ilobjscorm2004learningmodulegui";
699 }
700 $this->ctrl->setParameterByClass($scormClass, "ref_id", $this->object->getRefId());
701 $this->tabs_gui->addTarget(
702 "cont_tracking_data",
703 $this->ctrl->getLinkTargetByClass(['ilsahseditgui',$scormClass], "showTrackingItems"),
704 "showTrackingItems"
705 );
706 }
707 }
708 }
709
710 if ($rbacsystem->checkAccess("write", "", $this->object->getRefId())) {
711 $mdgui = new ilObjectMetaDataGUI($this->object);
712 $mdtab = $mdgui->getTab();
713 if ($mdtab) {
714 $this->tabs_gui->addTarget(
715 "meta_data",
716 $mdtab,
717 "",
718 "ilmdeditorgui"
719 );
720 }
721 }
722 // export - Jour Fixe Date for Decission not to allow for Users with Right Wirite?
723 if ($rbacsystem->checkAccess("edit", "", $this->object->getRefId())) {
724 $this->tabs_gui->addTarget(
725 "export",
726 $this->ctrl->getLinkTarget($this, "export"),
727 array("", "export"),
728 get_class($this)
729 );
730 }
731
732 // perm
733 if ($rbacsystem->checkAccess('edit_permission', "", $this->object->getRefId())) {
734 $this->tabs_gui->addTarget(
735 "perm_settings",
736 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
737 array("perm","info","owner"),
738 'ilpermissiongui'
739 );
740 }
741 }
742
743
747 public static function _goto(string $a_target): void
748 {
749 global $DIC;
750 $main_tpl = $DIC->ui()->mainTemplate();
751 $ilAccess = $DIC->access();
752 $ilErr = $DIC['ilErr'];
753 $lng = $DIC->language();
754
755 $targetParameters = explode('_', $a_target);
756 $id = (int) $targetParameters[0];
757
758 if ($id <= 0) {
759 $ilErr->raiseError($lng->txt('msg_no_perm_read'), $ilErr->FATAL);
760 }
761
762 if ($ilAccess->checkAccess("write", "", $id)) {
763 $DIC->ctrl()->setParameterByClass("ilSAHSEditGUI", "ref_id", (string) $id);
764 $DIC->ctrl()->redirectByClass("ilSAHSEditGUI", "infoScreen"); //cmd was "" in 7
765 }
766
767 if ($ilAccess->checkAccess("visible", "", $id) || $ilAccess->checkAccess("read", "", $id)) {
768 $DIC->ctrl()->setParameterByClass("ilSAHSPresentationGUI", "ref_id", (string) $id);
769 $DIC->ctrl()->redirectByClass("ilSAHSPresentationGUI", "infoScreen");
770 } else {
771 if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
772 $main_tpl->setOnScreenMessage('info', sprintf(
773 $lng->txt("msg_no_perm_read_item"),
775 ), true);
777 }
778 }
779
780 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
781 }
782
786 public function addLocatorItems(): void
787 {
788 global $DIC;
789 $ilLocator = $DIC['ilLocator'];
790
791 if (is_object($this->object)) {
792 $ilLocator->addItem(
793 $this->object->getTitle(),
794 $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"),
795 "",
796 $DIC->http()->wrapper()->query()->retrieve('ref_id', $DIC->refinery()->kindlyTo()->int())
797 );
798 }
799 }
800
801 // /**
802 // * List files
803 // *
804 // * @param
805 // * @return
806 // */
807 // public function editContent()
808 // {
809 // global $DIC;
810 // $ilCtrl = $DIC->ctrl();
811 //
815 // $ilCtrl->redirectByClass("ilobjscorm2004learningmodulegui", "editOrganization");
817 // }
818
822 public function setSettingsSubTabs(): void
823 {
824 global $DIC;
825 $lng = $DIC->language();
826 $ilTabs = $DIC->tabs();
827 $ilCtrl = $DIC->ctrl();
828
829 $ilTabs->addSubTabTarget(
830 "cont_settings",
831 $this->ctrl->getLinkTarget($this, "properties"),
832 array("edit", ""),
833 get_class($this)
834 );
835
836 $ilTabs->addSubTabTarget(
837 "cont_sc_new_version",
838 $this->ctrl->getLinkTarget($this, "newModuleVersion"),
839 array("edit", ""),
840 get_class($this)
841 );
842
843 $validator = new ilCertificateActiveValidator();
844 if (true === $validator->validate()) {
845 // // create and insert object in objecttree
846 // $ilTabs->addSubTabTarget("certificate",
847 // $this->ctrl->getLinkTarget($this, "certificate"),
848 // array("certificate", "certificateEditor", "certificateRemoveBackground", "certificateSave",
849 // "certificatePreview", "certificateDelete", "certificateUpload", "certificateImport")
850 // );
851 $ilTabs->addSubTabTarget(
852 "certificate",
853 $this->ctrl->getLinkTargetByClass([static::class, "ilcertificategui"], "certificateeditor"),
854 "",
855 "ilcertificategui"
856 );
857 }
858
859 $lti_settings = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
860 if ($lti_settings->hasSettingsAccess()) {
861 $ilTabs->addSubTabTarget(
862 'lti_provider',
863 $this->ctrl->getLinkTargetByClass(ilLTIProviderObjectSettingGUI::class)
864 );
865 }
866
867 $ilTabs->setTabActive('settings');
868 }
869
874 public function export()
875 {
876 $GLOBALS['DIC']->tabs()->setTabActive('export');
877 $exp_gui = new ilExportGUI($this);
878 $this->ctrl->setCmd("listExportFiles");
879 $exp_gui->addFormat("xml");
880 return $this->ctrl->forwardCommand($exp_gui);
881 }
882
883 public function exportModule(): void
884 {
885 global $DIC;
886 // $ilDB = $DIC->database();
887 //
888 $moduleId = ilObject::_lookupObjectId($DIC->http()->wrapper()->query()->retrieve('ref_id', $DIC->refinery()->kindlyTo()->int()));
889 $exporter = new ilScormAiccExporter();
890 // $xml = $exporter->getXmlRepresentation("sahs", "5.1.0", $moduleId);
891 }
892
893 public function getType(): string
894 {
895 return "sahs";
896 }
897} // END class.ilObjSAHSLearningModule
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
error(string $a_errmsg)
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a file property in a property form.
File System Explorer GUI class.
static unzip(string $path_to_zip_file, bool $overwrite_existing=false, bool $unpack_flat=false)
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static ilTempnam(?string $a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
static rename(string $a_source, string $a_target)
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static renameExecutables(string $a_dir)
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
static _getFrame(string $a_class)
Class ilInfoScreenGUI.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
loadLanguageModule(string $a_module)
Load language module.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getLogger(string $a_component_id)
Get component logger.
static _goto(string $a_target)
goto target course
certificate()
Shows the certificate editor.
initCreationForms(string $a_new_type)
no manual SCORM creation, only import at the time
getTemplate()
save new learning module to db
uploadObject()
display status information or report errors messages in case of error
__construct($data, int $id, bool $call_by_reference, bool $prepare_output=true)
Constructor.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
GUI class for the workflow of copying objects.
Class ilObjectGUI Basic methods of all Output classes.
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
fillCloneTemplate(?string $tpl_name, string $type)
Fill object clone template This method can be called from any object GUI class that wants to offer ob...
prepareOutput(bool $show_sub_objects=true)
ilLanguage $lng
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupObjectId(int $ref_id)
static _writeTitle(int $obj_id, string $title)
write title to db (static)
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This class represents a property form user interface.
This class represents a property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a selection list property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _copyUploadFile(string $a_file, string $a_target, bool $a_raise_errors=true)
static _checkUploadFile(string $a_file)
static _getUploadDirectory()
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static redirect(string $a_script)
const ROOT_FOLDER_ID
Definition: constants.php:32
global $DIC
Definition: feed.php:28
if($DIC->http() ->wrapper() ->query() ->has('update')) $uploadedFile
Definition: imgupload.php:101
if($format !==null) $name
Definition: metadata.php:247
$source
Definition: metadata.php:93
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
form( $class_path, string $cmd)
$ilErr
Definition: raiseError.php:17
$refId
Definition: xapitoken.php:58