ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjSAHSLearningModuleGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
35{
37 private $archives;
38
42 public function __construct($data, int $id, bool $call_by_reference, bool $prepare_output = true)//missing typehint because mixed
43 {
44 global $DIC;
45 $this->archives = $DIC->legacyArchives();
46 $lng = $DIC->language();
47 $rbacsystem = $DIC->access();
48 $lng->loadLanguageModule("content");
49 $this->type = "sahs";
51 }
52
58 public function executeCommand(): void
59 {
60 global $DIC;
61 $ilAccess = $DIC->access();
62 $ilTabs = $DIC->tabs();
63 $ilErr = $DIC['ilErr'];
64 $navigationHistory = $DIC['ilNavigationHistory'];
65
66 $baseClass = $refId = $DIC->http()->wrapper()->query()->retrieve('baseClass', $DIC->refinery()->kindlyTo()->string());
67 $ilLog = ilLoggerFactory::getLogger('sahs');
68 $ilLog->debug("bc:" . $baseClass . "; nc:" . $this->ctrl->getNextClass($this) . "; cmd:" . $this->ctrl->getCmd());
69 if (strtolower($baseClass) === "iladministrationgui" ||
70 strtolower($baseClass) === "ilsahspresentationgui" ||
71 $this->getCreationMode() == true) {
72 $this->prepareOutput();
73 } else {
74 $this->getTemplate();
75 $this->setLocator();
76 $this->setTabs();
77 $this->tpl->setTitleIcon(ilUtil::getImagePath("standard/icon_lm.svg"));
78 $this->tpl->setTitle($this->object->getTitle());
79 $navigationHistory->addItem(
80 $this->object->getRefId(),
81 ilLink::_getLink($this->object->getRefId(), $this->object->getType()),
82 $this->object->getType()
83 );
84 }
85
86 $next_class = $this->ctrl->getNextClass($this);
87 $cmd = $this->ctrl->getCmd();
88
89 switch ($next_class) {
90 case 'illtiproviderobjectsettinggui':
91 $this->setSettingsSubTabs();
92 $ilTabs->setSubTabActive('lti_provider');
93 $lti_gui = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
94 $lti_gui->setCustomRolesForSelection($GLOBALS['DIC']->rbac()->review()->getLocalRoles($this->object->getRefId()));
95 $lti_gui->offerLTIRolesForSelection(false);
96 $this->ctrl->forwardCommand($lti_gui);
97 break;
98
99
100 case 'ilobjectmetadatagui':
101 if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
102 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
103 }
104 $md_gui = new ilObjectMetaDataGUI($this->object);
105 $this->ctrl->forwardCommand($md_gui);
106 break;
107
108 // case 'ilexportgui':
109 // $exp = new ilExportGUI($this);
110 // $exp->addFormat('xml');
111 // $this->ctrl->forwardCommand($exp);
112 // break;
113
114 case 'ilpermissiongui':
115 $perm_gui = new ilPermissionGUI($this);
116 $this->ctrl->forwardCommand($perm_gui);
117 break;
118
119 case "ilfilesystemgui":
120 $fs_gui = new ilFileSystemGUI($this->object->getDataDirectory());
121 $fs_gui->setUseUploadDirectory(true);
122 $fs_gui->setTableId("sahsfs" . $this->object->getId());
123 $this->ctrl->forwardCommand($fs_gui);
124 break;
125
126 case "ilcertificategui":
127 $this->setSettingsSubTabs();
128 $ilTabs->setSubTabActive('certificate');
129
130 $guiFactory = new ilCertificateGUIFactory();
131 $output_gui = $guiFactory->create($this->object);
132
133 $this->ctrl->forwardCommand($output_gui);
134 break;
135
136 case "illearningprogressgui":
138 $this->ctrl->forwardCommand($new_gui);
139
140 break;
141
142 case "ilinfoscreengui":
143 $ilTabs->setTabActive('info_short');
144 $this->infoScreenForward();
145 break;
146
147 case "ilcommonactiondispatchergui":
149 if ($gui !== null) {
150 $this->ctrl->forwardCommand($gui);
151 }
152 break;
153
154 case 'ilobjectcopygui':
155 $this->prepareOutput();
156 $cp = new ilObjectCopyGUI($this);
157 $cp->setType('sahs');
158 $this->ctrl->forwardCommand($cp);
159 break;
160
161 default:
162 // if ($this->object && !$this->object->getEditable()) {
163 $cmd = $this->ctrl->getCmd("properties");
164 // }
165 if ((strtolower($baseClass) === "iladministrationgui" ||
166 $this->getCreationMode() == true) &&
167 $cmd !== "frameset") {
168 $cmd .= "Object";
169 }
170
171 // #9225
172 if ($cmd === "redrawHeaderAction") {
173 $cmd .= "Object";
174 }
175
176 $this->$cmd();
177 break;
178 }
179 }
180
181 protected function infoScreen(): void
182 {
183 if (strtolower($this->ctrl->getCmd() ?? '') === 'infoscreen') {
184 $this->ctrl->redirectByClass(ilInfoScreenGUI::class, 'showSummary');
185 }
186
187 $this->infoScreenForward();
188 }
189
190 protected function infoScreenForward(): void
191 {
192 if (!$this->checkPermissionBool("visible") && !$this->checkPermissionBool("read")) {
193 $this->error->raiseError($this->lng->txt("msg_no_perm_read"), $this->error->MESSAGE);
194 }
195
196 $info = new ilInfoScreenGUI($this);
197 $info->enablePrivateNotes();
198 $info->enableLearningProgress();
199
200 // add read / back button
201 if ($this->checkPermissionBool("read")) {
202 $ilToolbar = $GLOBALS['DIC']->toolbar();
203 $ilToolbar->addButtonInstance($this->object->getViewButton());
204 }
205
206 $info->enableNewsEditing(false);
207 if ($this->checkPermissionBool("write")) {
208 $news_set = new ilSetting("news");
209 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
210 if ($enable_internal_rss) {
211 $info->setBlockProperty("news", "settings", "");
212 $info->setBlockProperty("news", "public_notifications_option", "true");
213 }
214 }
215 // show standard meta data section
216 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
217
218 // forward the command
219 $this->ctrl->forwardCommand($info);
220 }
221
222
223 // /**
224 // * @return void
225 // * @throws ilObjectException
226 // */
227 // public function viewObject() : void
228 // {
229 // if (strtolower($_GET["baseClass"]) == "iladministrationgui") {
230 // parent::viewObject();
231 // } else {
232 // }
233 // }
234
238 public function properties(): void
239 {
240 $this->ctrl->setParameterByClass(
241 "ilSAHSEditGUI",
242 "ref_id",
243 $this->ref_id
244 );
245 $this->ctrl->redirectByClass(ilSAHSEditGUI::class);
246 }
247
248 public function saveProperties(): void
249 {
250 }
251
252 protected function initCreateForm(string $new_type): ilPropertyFormGUI
253 {
254 global $DIC;
255 $lng = $DIC->language();
256 $ilCtrl = $DIC->ctrl();
257 $form = new ilPropertyFormGUI();
258
259 // type selection
260 $radg = new ilRadioGroupInputGUI($lng->txt("type"), "sub_type");
261 $op0 = new ilRadioOption($this->lng->txt("lm_type_scorm"), "scorm");
262 $op0->setInfo($this->lng->txt("lm_type_scorm_info"));
263 $radg->addOption($op0);
264 $op0 = new ilRadioOption($this->lng->txt("lm_type_scorm2004"), "scorm2004");
265 $op0->setInfo($this->lng->txt("lm_type_scorm2004_info"));
266 $radg->addOption($op0);
267 $radg->setValue("scorm");
268 $form->addItem($radg);
269
270 $options = array();
272 $options[""] = $this->lng->txt("cont_select_from_upload_dir");
274 foreach ($files as $file) {
275 $file = htmlspecialchars($file, ENT_QUOTES, "utf-8");
276 $options[$file] = $file;
277 }
278 }
279 if (count($options) > 1) {
280 // choose upload directory
281 $radg = new ilRadioGroupInputGUI($lng->txt("cont_choose_file_source"), "file_source");
282 $op0 = new ilRadioOption($this->lng->txt("cont_choose_local"), "local");
283 $radg->addOption($op0);
284 $op1 = new ilRadioOption($this->lng->txt("cont_choose_upload_dir"), "upload_dir");
285 $radg->addOption($op1);
286 $radg->setValue("local");
287
288 $fi = new ilFileInputGUI($this->lng->txt("select_file"), "scormfile");
289 $fi->setRequired(true);
290 $op0->addSubItem($fi);
291
292 $si = new ilSelectInputGUI($this->lng->txt("cont_uploaded_file"), "uploaded_file");
293 $si->setOptions($options);
294 $op1->addSubItem($si);
295
296 $form->addItem($radg);
297 } else {
298 $fi = new ilFileInputGUI($this->lng->txt("select_file"), "scormfile");
299 $fi->setRequired(true);
300 $form->addItem($fi);
301 }
302
303 $form->addCommandButton("upload", $lng->txt("create"));
304 $form->addCommandButton("cancel", $lng->txt("cancel"));
305
306 $form->setTitle($lng->txt("import_sahs"));
307 $form->setFormAction($ilCtrl->getFormAction($this, "upload"));
309 return $form;
310 }
311
320 public function uploadObject(): void
321 {
322 global $DIC;
323 $rbacsystem = $DIC->access();
324 $ilErr = $DIC['ilErr'];
325 $ilLog = ilLoggerFactory::getLogger('sahs');
326 $refId = $DIC->http()->wrapper()->query()->retrieve('ref_id', $DIC->refinery()->kindlyTo()->int());
327 $importFromXml = false;
328
329 // check create permission
330 if (!$rbacsystem->checkAccess("create", '', $refId, "sahs")) {
331 $ilErr->raiseError($this->lng->txt("no_create_permission"), $ilErr->WARNING);
332 } elseif ($_FILES["scormfile"]["name"]) {
333 // check if file was uploaded
334 $source = $_FILES["scormfile"]["tmp_name"];
335 if (($source === 'none') || (!$source)) {
336 $ilErr->raiseError($this->lng->txt("msg_no_file"), $ilErr->MESSAGE);
337 }
338 // get_cfg_var("upload_max_filesize"); // get the may filesize form t he php.ini
339 switch ($_FILES["scormfile"]["error"]) {
340 case UPLOAD_ERR_INI_SIZE:
341 case UPLOAD_ERR_FORM_SIZE:
342 $ilErr->raiseError($this->lng->txt("err_max_file_size_exceeds"), $ilErr->MESSAGE);
343 break;
344
345 case UPLOAD_ERR_PARTIAL:
346 $ilErr->raiseError($this->lng->txt("err_partial_file_upload"), $ilErr->MESSAGE);
347 break;
348
349 case UPLOAD_ERR_NO_FILE:
350 $ilErr->raiseError($this->lng->txt("err_no_file_uploaded"), $ilErr->MESSAGE);
351 break;
352 }
353
354 $file = pathinfo($_FILES["scormfile"]["name"]);
355 } elseif ($DIC->http()->wrapper()->post()->has('uploaded_file')) {
356 $uploadedFile = $DIC->http()->wrapper()->post()->retrieve('uploaded_file', $DIC->refinery()->kindlyTo()->string());
357 // check if the file is in the upload directory and readable
358 if (!ilUploadFiles::_checkUploadFile($uploadedFile)) {
359 $ilErr->raiseError($this->lng->txt("upload_error_file_not_found"), $ilErr->MESSAGE);
360 }
361
362 $file = pathinfo($uploadedFile);
363 } else {
364 $ilErr->raiseError($this->lng->txt("msg_no_file"), $ilErr->MESSAGE);
365 }
366
367 $name = substr($file["basename"], 0, strlen($file["basename"]) - strlen($file["extension"]) - 1);
368 if ($name == "") {
369 $name = $this->lng->txt("no_title");
370 }
371
372 $description = "";
373
374 $subType = "scorm2004";
375 if ($DIC->http()->wrapper()->post()->has('sub_type')) {
376 $subType = $DIC->http()->wrapper()->post()->retrieve('sub_type', $DIC->refinery()->kindlyTo()->string());
377 }
378
379 // always import authoring packages as scorm2004, see bug #27801
380 // if ($_POST["editable"] == 'y') {
381 // $subType = "scorm2004";
382 // }
383
384 // create and insert object in objecttree
385 switch ($subType) {
386 case "scorm2004":
387 $newObj = new ilObjSCORM2004LearningModule();
388 break;
389
390 case "scorm":
391 $newObj = new ilObjSCORMLearningModule();
392 break;
393 }
394
395 $newObj->setTitle($name);
396 $newObj->setSubType($subType);
397 $newObj->setDescription($description);
398 $newObj->create(true);
399 $newObj->createReference();
400 $newObj->putInTree($refId);
401 $newObj->setPermissions($refId);
402 $newObj->setOfflineStatus(true);
403
404 // create data directory, copy file to directory
405 $newObj->createDataDirectory();
406
407 if ($_FILES["scormfile"]["name"]) {
408 // copy uploaded file to data directory
409 $file_path = $newObj->getDataDirectory() . "/" . $_FILES["scormfile"]["name"];
411 $_FILES["scormfile"]["tmp_name"],
412 $_FILES["scormfile"]["name"],
413 $file_path
414 );
415 $this->archives->unzip(
416 $file_path,
417 $newObj->getDataDirectory(),
418 false,
419 false,
420 false
421 );
422 } else {
423 // copy uploaded file to data directory
424 $uploadedFile = $DIC->http()->wrapper()->post()->retrieve('uploaded_file', $DIC->refinery()->kindlyTo()->string());
425 $file_path = $newObj->getDataDirectory() . "/" . $uploadedFile;
426 ilUploadFiles::_copyUploadFile($uploadedFile, $file_path);
427 $this->archives->unzip(
428 $file_path,
429 $newObj->getDataDirectory(),
430 false,
431 false,
432 true
433 );
434 }
435 ilFileUtils::renameExecutables($newObj->getDataDirectory());
436
437 $title = $newObj->readObject();
438 if ($title != "") {
439 ilObject::_writeTitle($newObj->getId(), $title);
440 }
441
442 //auto set learning progress settings
443 $newObj->setLearningProgressSettingsAtUpload();
444
445 if ($importFromXml) {
446 $importer->writeData("sahs", "5.1.0", $newObj->getId());
447 }
448
449 $this->tpl->setOnScreenMessage('info', $this->lng->txt($newObj->getType() . "_added"), true);
450 ilUtil::redirect("ilias.php?baseClass=ilSAHSEditGUI&ref_id=" . $newObj->getRefId());
451 }
452
459 public function upload(): void
460 {
461 $this->uploadObject();
462 }
463
464 protected function importFile(string $file_to_import, string $path_to_uploaded_file_in_temp_dir): void
465 {
467 global $DIC;
468 $ilLog = $DIC['log'];
469
470 $lm_temp_dir = ilFileUtils::ilTempnam();
471 ilFileUtils::makeDir($lm_temp_dir);
472 $zar = new ZipArchive();
473 $zar->open($file_to_import);
474 $zar->extractTo($lm_temp_dir);
475 $zar->close();
476 ilFileUtils::renameExecutables($lm_temp_dir);
477 $importer = new ilScormAiccImporter();
478 $import_dirname = $lm_temp_dir . '/' . substr(basename($file_to_import), 0, -4);
479 $importer->importXmlRepresentation("sahs", "", $import_dirname, null);
480 $import_result = $importer->getResult();
481
482 if ($import_result->isOK()) {
483 $properties = $import_result->value();
484 if (($subType = $properties['SubType']) === 'scorm') {
485 $new_obj = new ilObjSCORMLearningModule();
486 } else {
487 $new_obj = new ilObjSCORM2004LearningModule();
488 }
489 $name = $properties['Title'];
490 $description = $properties['Description'];
491 } else {
492 ilFileUtils::delDir($lm_temp_dir, false);
493 $this->deleteUploadedImportFile($path_to_uploaded_file_in_temp_dir);
494 $ilLog->error('SCORM import of ILIAS exportfile not possible because parsing error');
495 $ilLog->error($import_result->error());
496 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("import_file_not_valid_here"), true);
497 return;
498 }
499
500 $new_obj->setTitle($name);
501 $new_obj->setSubType($subType);
502 $new_obj->setDescription($description);
503 $new_obj->create(true);
504 $this->putObjectInTree($new_obj);
505 $new_obj->setOfflineStatus(false);
506
507 // create data directory, copy file to directory
508 $new_obj->createDataDirectory();
509
510 // Handle content.zip
511 $scorm_file = "content.zip";
512 $file_path = $import_dirname . "/" . $scorm_file;
513 // Unzip content.zip before copying
514 $content_unzip_dir = $import_dirname . '/content';
515 $this->archives->unzip(
516 $file_path,
517 $content_unzip_dir,
518 false,
519 false,
520 false
521 );
522 // Handle ILIAS 9 Exports containing 'lm_x' directories
523 $source_dir_for_copy = $content_unzip_dir;
524 $content_unzip_dir_iterator = new DirectoryIterator( $content_unzip_dir );
525 foreach ( $content_unzip_dir_iterator as $fileinfo ) {
526 if ( $fileinfo->isDir() && !$fileinfo->isDot() ) {
527 if ( preg_match( '/^lm_\d+$/', $fileinfo->getFilename() ) ) {
528 $source_dir_for_copy = $source_dir_for_copy . '/' . $fileinfo->getFilename();
529 break;
530 }
531 }
532 }
533 // Move content
534 ilFileUtils::rename($source_dir_for_copy, $new_obj->getDataDirectory());
535 // Cleanup
536 ilFileUtils::delDir($lm_temp_dir, false);
537 ilFileUtils::renameExecutables($new_obj->getDataDirectory());
538
539 //auto set learning progress settings
540 $new_obj->setLearningProgressSettingsAtUpload();
541
542 $importer->writeData("sahs", "5.1.0", $new_obj->getId());
543
544 $this->tpl->setOnScreenMessage('info', $this->lng->txt($new_obj->getType() . "_added"), true);
545 $this->ctrl->setParameterByClass(self::class, 'ref_id', $new_obj->getRefId());
546 $this->ctrl->redirectByClass(self::class);
547 }
548
549
553 public function getTemplate(): void
554 {
555 global $DIC;
556 $lng = $DIC->language();
557
558 $this->tpl->loadStandardTemplate();
559 }
560
564 protected function setTabs(): void
565 {
566 global $DIC;
567 $baseClass = $refId = $DIC->http()->wrapper()->query()->retrieve('baseClass', $DIC->refinery()->kindlyTo()->string());
568 $this->tpl->setTitleIcon(ilUtil::getImagePath("standard/icon_lm.svg"));
569 $this->tpl->setTitle($this->object->getTitle());
570 $this->tpl->setDescription($this->object->getDescription());
571 if ($this->object && $this->object->getOfflineStatus()) {
572 $this->tpl->setAlertProperties(array(
573 array("alert" => true,
574 "property" => $this->lng->txt("status"),
575 "value" => $this->lng->txt("offline"))
576 ));
577 }
578 if (strtolower($baseClass) === "ilsahseditgui" || strtolower($baseClass) === "ilrepositorygui") {
579 $this->getTabs();
580 }
581 }
582
586 public function certificate(): void
587 {
588 $guiFactory = new ilCertificateGUIFactory();
589 $output_gui = $guiFactory->create($this->object);
590
591 $output_gui->certificateEditor();
592 }
593
598 protected function getTabs(): void
599 {
600 global $DIC;
601 $rbacsystem = $DIC->access();
602 $ilCtrl = $DIC->ctrl();
603 $ilHelp = $DIC->help();
604
605 if ($this->ctrl->getCmd() === "delete") {
606 return;
607 }
608
609 switch ($this->object->getSubType()) {
610 case "scorm2004":
611 $ilHelp->setScreenIdComponent("sahs13");
612 break;
613
614 case "scorm":
615 $ilHelp->setScreenIdComponent("sahs12");
616 break;
617 }
618
619 // file system gui tabs
620 // properties
621 if ($rbacsystem->checkAccess("write", "", $this->object->getRefId())) {
622 $ilCtrl->setParameterByClass("ilfilesystemgui", "resetoffset", 1);
623 $this->tabs_gui->addTarget(
624 "cont_list_files",
625 $this->ctrl->getLinkTargetByClass("ilfilesystemgui", "listFiles"),
626 "",
627 "ilfilesystemgui"
628 );
629 $ilCtrl->setParameterByClass("ilfilesystemgui", "resetoffset", "");
630 }
631 // info screen
632 $force_active = ($this->ctrl->getNextClass() === "ilinfoscreengui")
633 ? true
634 : false;
635 $this->tabs_gui->addTarget(
636 "info_short",
637 $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"),
638 "",
639 "ilinfoscreengui",
640 "",
641 $force_active
642 );
643
644 // properties
645 $this->tabs_gui->addTarget(
646 "settings",
647 $this->ctrl->getLinkTarget($this, "properties"),
648 array("", "properties"),
649 get_class($this)
650 );
651
652 // if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
653 // $this->tabs_gui->addTarget(
654 // 'learning_progress',
655 // $this->ctrl->getLinkTargetByClass(array('illearningprogressgui'), ''),
656 // '',
657 // array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui')
658 // );
659 // }
660
661 // tracking data
662 if ($rbacsystem->checkAccess("read_learning_progress", "", $this->object->getRefId()) || $rbacsystem->checkAccess("edit_learning_progress", "", $this->object->getRefId())) {
663 $ar_rights = [];
664 if ($rbacsystem->checkAccess("read_learning_progress", "", $this->object->getRefId())) {
665 $ar_rights = ['illplistofobjectsgui'];
666 }
667 if ($rbacsystem->checkAccess("edit_learning_progress", "", $this->object->getRefId())) {
668 $ar_rights[] = 'illplistofsettingsgui';
669 }
670 if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
671 $this->tabs_gui->addTarget(
672 'learning_progress',
673 $this->ctrl->getLinkTargetByClass(array('illearningprogressgui'), ''),
674 '',
675 $ar_rights
676 );
677 }
678
679 if ($this->object->getSubType() === "scorm2004" || $this->object->getSubType() === "scorm") {
681 if ($privacy->enabledSahsProtocolData()) {
682 $scormClass = "ilobjscormlearningmodulegui";
683 if ($this->object->getSubType() === "scorm2004") {
684 $scormClass = "ilobjscorm2004learningmodulegui";
685 }
686 $this->ctrl->setParameterByClass($scormClass, "ref_id", $this->object->getRefId());
687 $this->tabs_gui->addTarget(
688 "cont_tracking_data",
689 $this->ctrl->getLinkTargetByClass(['ilsahseditgui',$scormClass], "showTrackingItems"),
690 "showTrackingItems"
691 );
692 }
693 }
694 }
695
696 if ($rbacsystem->checkAccess("write", "", $this->object->getRefId())) {
697 $mdgui = new ilObjectMetaDataGUI($this->object);
698 $mdtab = $mdgui->getTab();
699 if ($mdtab) {
700 $this->tabs_gui->addTarget(
701 "meta_data",
702 $mdtab,
703 "",
704 "ilmdeditorgui"
705 );
706 }
707 }
708 // export - Jour Fixe Date for Decission not to allow for Users with Right Wirite?
709 if ($rbacsystem->checkAccess("edit", "", $this->object->getRefId())) {
710 $this->tabs_gui->addTarget(
711 "export",
712 $this->ctrl->getLinkTarget($this, "export"),
713 array("", "export"),
714 get_class($this)
715 );
716 }
717
718 // perm
719 if ($rbacsystem->checkAccess('edit_permission', "", $this->object->getRefId())) {
720 $this->tabs_gui->addTarget(
721 "perm_settings",
722 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
723 array("perm","info","owner"),
724 'ilpermissiongui'
725 );
726 }
727 }
728
729
733 public static function _goto(string $a_target): void
734 {
735 global $DIC;
736 $main_tpl = $DIC->ui()->mainTemplate();
737 $ilAccess = $DIC->access();
738 $ilErr = $DIC['ilErr'];
739 $lng = $DIC->language();
740
741 $targetParameters = explode('_', $a_target);
742 $id = (int) $targetParameters[0];
743
744 if ($id <= 0) {
745 $ilErr->raiseError($lng->txt('msg_no_perm_read'), $ilErr->FATAL);
746 }
747
748 if ($ilAccess->checkAccess("write", "", $id)) {
749 $DIC->ctrl()->setParameterByClass("ilSAHSEditGUI", "ref_id", (string) $id);
750 $DIC->ctrl()->redirectByClass("ilSAHSEditGUI", "infoScreen"); //cmd was "" in 7
751 }
752
753 if ($ilAccess->checkAccess("visible", "", $id) || $ilAccess->checkAccess("read", "", $id)) {
754 $DIC->ctrl()->setParameterByClass("ilSAHSPresentationGUI", "ref_id", (string) $id);
755 $DIC->ctrl()->redirectByClass("ilSAHSPresentationGUI", "infoScreen");
756 } else {
757 if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
758 $main_tpl->setOnScreenMessage('info', sprintf(
759 $lng->txt("msg_no_perm_read_item"),
761 ), true);
763 }
764 }
765
766 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
767 }
768
772 public function addLocatorItems(): void
773 {
774 global $DIC;
775 $ilLocator = $DIC['ilLocator'];
776
777 if (is_object($this->object)) {
778 $ilLocator->addItem(
779 $this->object->getTitle(),
780 $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"),
781 "",
782 $DIC->http()->wrapper()->query()->retrieve('ref_id', $DIC->refinery()->kindlyTo()->int())
783 );
784 }
785 }
786
787 // /**
788 // * List files
789 // *
790 // * @param
791 // * @return
792 // */
793 // public function editContent()
794 // {
795 // global $DIC;
796 // $ilCtrl = $DIC->ctrl();
797 //
801 // $ilCtrl->redirectByClass("ilobjscorm2004learningmodulegui", "editOrganization");
803 // }
804
808 public function setSettingsSubTabs(): void
809 {
810 global $DIC;
811 $lng = $DIC->language();
812 $ilTabs = $DIC->tabs();
813 $ilCtrl = $DIC->ctrl();
814
815 $ilTabs->addSubTabTarget(
816 "general",
817 $this->ctrl->getLinkTarget($this, "properties"),
818 array("edit", ""),
819 get_class($this)
820 );
821
822 $ilTabs->addSubTabTarget(
823 "cont_sc_new_version",
824 $this->ctrl->getLinkTarget($this, "newModuleVersion"),
825 array("edit", ""),
826 get_class($this)
827 );
828
829 $validator = new ilCertificateActiveValidator();
830 if (true === $validator->validate()) {
831 // // create and insert object in objecttree
832 // $ilTabs->addSubTabTarget("certificate",
833 // $this->ctrl->getLinkTarget($this, "certificate"),
834 // array("certificate", "certificateEditor", "certificateRemoveBackground", "certificateSave",
835 // "certificatePreview", "certificateDelete", "certificateUpload", "certificateImport")
836 // );
837 $ilTabs->addSubTabTarget(
838 "certificate",
839 $this->ctrl->getLinkTargetByClass([static::class, "ilcertificategui"], "certificateeditor"),
840 "",
841 "ilcertificategui"
842 );
843 }
844
845 $lti_settings = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
846 if ($lti_settings->hasSettingsAccess()) {
847 $ilTabs->addSubTabTarget(
848 'lti_provider',
849 $this->ctrl->getLinkTargetByClass(ilLTIProviderObjectSettingGUI::class)
850 );
851 }
852
853 $ilTabs->setTabActive('settings');
854 }
855
859 public function export(): mixed
860 {
861 $GLOBALS['DIC']->tabs()->setTabActive('export');
862 $exp_gui = new ilExportGUI($this);
863 // @todo: removed deprecated ilCtrl methods, this needs inspection by a maintainer.
864 // $this->ctrl->setCmd("listExportFiles");
865 $exp_gui->addFormat("xml");
866 return $this->ctrl->forwardCommand($exp_gui);
867 }
868
869 public function exportModule(): void
870 {
871 global $DIC;
872 // $ilDB = $DIC->database();
873 //
874 $moduleId = ilObject::_lookupObjectId($DIC->http()->wrapper()->query()->retrieve('ref_id', $DIC->refinery()->kindlyTo()->int()));
875 $exporter = new ilScormAiccExporter();
876 // $xml = $exporter->getXmlRepresentation("sahs", "5.1.0", $moduleId);
877 }
878
879 public function getType(): string
880 {
881 return "sahs";
882 }
883} // END class.ilObjSAHSLearningModule
error(string $a_errmsg)
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 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
setFormAction(string $a_formaction)
setTarget(string $a_target)
static _getFrame(string $a_class)
Class ilInfoScreenGUI.
GUI class for LTI provider object settings.
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
Class ilObjUserTrackingGUI.
static getLogger(string $a_component_id)
Get component logger.
importFile(string $file_to_import, string $path_to_uploaded_file_in_temp_dir)
static _goto(string $a_target)
goto target course
certificate()
Shows the certificate editor.
getTemplate()
output main header (title and locator)
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.
Class ilObjSCORM2004LearningModule.
Class ilObjSCORMLearningModule.
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.
deleteUploadedImportFile(string $path_to_uploaded_file_in_temp_dir)
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
putObjectInTree(ilObject $obj, ?int $parent_node_id=null)
Add object to tree at given position.
prepareOutput(bool $show_sub_objects=true)
ilLanguage $lng
Class ilObjectMetaDataGUI.
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)
This class represents a property form user interface.
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
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.
static _copyUploadFile(string $a_file, string $a_target, bool $a_raise_errors=true)
static _checkUploadFile(string $a_file)
static _getUploadDirectory()
static getImagePath(string $image_name, 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
$info
Definition: entry_point.php:21
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ilErr
Definition: raiseError.php:33
global $DIC
Definition: shib_login.php:26
$GLOBALS["DIC"]
Definition: wac.php:54
$refId
Definition: xapitoken.php:58