ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilObjSAHSLearningModuleGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(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";
50  parent::__construct($data, $id, $call_by_reference, false);
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  $this->ctrl->setCmd("showSummary");
184  $this->ctrl->setCmdClass("ilinfoscreengui");
185  $this->infoScreenForward();
186  }
187 
188  protected function infoScreenForward(): void
189  {
190  if (!$this->checkPermissionBool("visible") && !$this->checkPermissionBool("read")) {
191  $this->error->raiseError($this->lng->txt("msg_no_perm_read"), $this->error->MESSAGE);
192  }
193 
194  $info = new ilInfoScreenGUI($this);
195  $info->enablePrivateNotes();
196  $info->enableLearningProgress();
197 
198  // add read / back button
199  if ($this->checkPermissionBool("read")) {
200  $ilToolbar = $GLOBALS['DIC']->toolbar();
201  $ilToolbar->addButtonInstance($this->object->getViewButton());
202  }
203 
204  $info->enableNewsEditing(false);
205  if ($this->checkPermissionBool("write")) {
206  $news_set = new ilSetting("news");
207  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
208  if ($enable_internal_rss) {
209  $info->setBlockProperty("news", "settings", "");
210  $info->setBlockProperty("news", "public_notifications_option", "true");
211  }
212  }
213  // show standard meta data section
214  $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
215 
216  // forward the command
217  $this->ctrl->forwardCommand($info);
218  }
219 
220 
221  // /**
222  // * @return void
223  // * @throws ilObjectException
224  // */
225  // public function viewObject() : void
226  // {
227  // if (strtolower($_GET["baseClass"]) == "iladministrationgui") {
228  // parent::viewObject();
229  // } else {
230  // }
231  // }
232 
236  public function properties(): void
237  {
238  $this->ctrl->setParameterByClass(
239  "ilSAHSEditGUI",
240  "ref_id",
241  $this->ref_id
242  );
243  $this->ctrl->redirectByClass(ilSAHSEditGUI::class);
244  }
245 
246  public function saveProperties(): void
247  {
248  }
249 
253 
259  protected function initCreationForms(string $a_new_type): array
260  {
261  $forms = [];
262 
263  $this->initUploadForm();
264  $forms[self::CFORM_IMPORT] = $this->form;
265 
266  return $forms;
267  }
268 
272  public function initUploadForm(): void
273  {
274  global $DIC;
275  $lng = $DIC->language();
276  $ilCtrl = $DIC->ctrl();
277  $this->form = new ilPropertyFormGUI();
278 
279  // type selection
280  $radg = new ilRadioGroupInputGUI($lng->txt("type"), "sub_type");
281  $op0 = new ilRadioOption($this->lng->txt("lm_type_scorm"), "scorm");
282  $op0->setInfo($this->lng->txt("lm_type_scorm_info"));
283  $radg->addOption($op0);
284  $op0 = new ilRadioOption($this->lng->txt("lm_type_scorm2004"), "scorm2004");
285  $op0->setInfo($this->lng->txt("lm_type_scorm2004_info"));
286  $radg->addOption($op0);
287  $op0 = new ilRadioOption($this->lng->txt("sahs_export_file"), "exportFile");
288  $op0->setInfo($this->lng->txt("sahs_export_file_info"));
289  $radg->addOption($op0);
290  $radg->setValue("scorm");
291  $this->form->addItem($radg);
292 
293  $options = array();
295  $options[""] = $this->lng->txt("cont_select_from_upload_dir");
297  foreach ($files as $file) {
298  $file = htmlspecialchars($file, ENT_QUOTES, "utf-8");
299  $options[$file] = $file;
300  }
301  }
302  if (count($options) > 1) {
303  // choose upload directory
304  $radg = new ilRadioGroupInputGUI($lng->txt("cont_choose_file_source"), "file_source");
305  $op0 = new ilRadioOption($this->lng->txt("cont_choose_local"), "local");
306  $radg->addOption($op0);
307  $op1 = new ilRadioOption($this->lng->txt("cont_choose_upload_dir"), "upload_dir");
308  $radg->addOption($op1);
309  $radg->setValue("local");
310 
311  $fi = new ilFileInputGUI($this->lng->txt("select_file"), "scormfile");
312  $fi->setRequired(true);
313  $op0->addSubItem($fi);
314 
315  $si = new ilSelectInputGUI($this->lng->txt("cont_uploaded_file"), "uploaded_file");
316  $si->setOptions($options);
317  $op1->addSubItem($si);
318 
319  $this->form->addItem($radg);
320  } else {
321  $fi = new ilFileInputGUI($this->lng->txt("select_file"), "scormfile");
322  $fi->setRequired(true);
323  $this->form->addItem($fi);
324  }
325 
326  $this->form->addCommandButton("upload", $lng->txt("import"));
327  $this->form->addCommandButton("cancel", $lng->txt("cancel"));
328 
329  $this->form->setTitle($lng->txt("import_sahs"));
330  $this->form->setFormAction($ilCtrl->getFormAction($this, "upload"));
331  $this->form->setTarget(ilFrameTargetInfo::_getFrame("MainContent"));
332  }
333 
342  public function uploadObject(): void
343  {
344  global $DIC;
345  $rbacsystem = $DIC->access();
346  $ilErr = $DIC['ilErr'];
347  $ilLog = ilLoggerFactory::getLogger('sahs');
348  $refId = $DIC->http()->wrapper()->query()->retrieve('ref_id', $DIC->refinery()->kindlyTo()->int());
349  $importFromXml = false;
350 
351  // check create permission
352  if (!$rbacsystem->checkAccess("create", '', $refId, "sahs")) {
353  $ilErr->raiseError($this->lng->txt("no_create_permission"), $ilErr->WARNING);
354  } elseif ($_FILES["scormfile"]["name"]) {
355  // check if file was uploaded
356  $source = $_FILES["scormfile"]["tmp_name"];
357  if (($source === 'none') || (!$source)) {
358  $ilErr->raiseError($this->lng->txt("msg_no_file"), $ilErr->MESSAGE);
359  }
360  // get_cfg_var("upload_max_filesize"); // get the may filesize form t he php.ini
361  switch ($_FILES["scormfile"]["error"]) {
362  case UPLOAD_ERR_INI_SIZE:
363  case UPLOAD_ERR_FORM_SIZE:
364  $ilErr->raiseError($this->lng->txt("err_max_file_size_exceeds"), $ilErr->MESSAGE);
365  break;
366 
367  case UPLOAD_ERR_PARTIAL:
368  $ilErr->raiseError($this->lng->txt("err_partial_file_upload"), $ilErr->MESSAGE);
369  break;
370 
371  case UPLOAD_ERR_NO_FILE:
372  $ilErr->raiseError($this->lng->txt("err_no_file_uploaded"), $ilErr->MESSAGE);
373  break;
374  }
375 
376  $file = pathinfo($_FILES["scormfile"]["name"]);
377  } elseif ($DIC->http()->wrapper()->post()->has('uploaded_file')) {
378  $uploadedFile = $DIC->http()->wrapper()->post()->retrieve('uploaded_file', $DIC->refinery()->kindlyTo()->string());
379  // check if the file is in the upload directory and readable
380  if (!ilUploadFiles::_checkUploadFile($uploadedFile)) {
381  $ilErr->raiseError($this->lng->txt("upload_error_file_not_found"), $ilErr->MESSAGE);
382  }
383 
384  $file = pathinfo($uploadedFile);
385  } else {
386  $ilErr->raiseError($this->lng->txt("msg_no_file"), $ilErr->MESSAGE);
387  }
388 
389  $name = substr($file["basename"], 0, strlen($file["basename"]) - strlen($file["extension"]) - 1);
390  if ($name == "") {
391  $name = $this->lng->txt("no_title");
392  }
393 
394  $description = "";
395 
396  $subType = "scorm2004";
397  if ($DIC->http()->wrapper()->post()->has('sub_type')) {
398  $subType = $DIC->http()->wrapper()->post()->retrieve('sub_type', $DIC->refinery()->kindlyTo()->string());
399  }
400 
401  // always import authoring packages as scorm2004, see bug #27801
402  // if ($_POST["editable"] == 'y') {
403  // $subType = "scorm2004";
404  // }
405 
406  // create and insert object in objecttree
407  switch ($subType) {
408  case "scorm2004":
409  $newObj = new ilObjSCORM2004LearningModule();
410  break;
411 
412  case "scorm":
413  $newObj = new ilObjSCORMLearningModule();
414  break;
415 
416  case "exportFile":
417  $sFile = $_FILES["scormfile"];
418  $fType = $sFile["type"];
419  $cFileTypes = ["application/zip", "application/x-compressed","application/x-zip-compressed"];
420  if (in_array($fType, $cFileTypes)) {
421  $tempFile = $sFile["tmp_name"];
422  $lmTempDir = ilFileUtils::ilTempnam();
423  ilFileUtils::makeDir($lmTempDir);
424  $zar = new ZipArchive();
425  $zar->open($tempFile);
426  $zar->extractTo($lmTempDir);
427  $zar->close();
428  ilFileUtils::renameExecutables($lmTempDir);
429  $importer = new ilScormAiccImporter();
430  $import_dirname = $lmTempDir . '/' . substr($_FILES["scormfile"]["name"], 0, -4);
431  $importer->importXmlRepresentation("sahs", "", $import_dirname, null);
432  $import_result = $importer->getResult();
433 
434  $importFromXml = true;
435  if ($import_result->isOK()) {
436  $properties = $import_result->value();
437  if (($subType = $properties['SubType']) === 'scorm') {
438  $newObj = new ilObjSCORMLearningModule();
439  } else {
440  $newObj = new ilObjSCORM2004LearningModule();
441  }
442  $name = $properties['Title'];
443  $description = $properties['Description'];
444  } else {
445  ilFileUtils::delDir($lmTempDir, false);
446  $ilLog->error('SCORM import of ILIAS exportfile not possible because parsing error');
447  $ilLog->error($import_result->error());
448  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("import_file_not_valid"), true);
449  return;
450  }
451  }
452  break;
453  }
454 
455  $newObj->setTitle($name);
456  $newObj->setSubType($subType);
457  $newObj->setDescription($description);
458  $newObj->create(true);
459  $newObj->createReference();
460  $newObj->putInTree($refId);
461  $newObj->setPermissions($refId);
462  $newObj->setOfflineStatus(false);
463 
464  // create data directory, copy file to directory
465  $newObj->createDataDirectory();
466 
467  if ($_FILES["scormfile"]["name"]) {
468  if ($importFromXml) {
469  $scormFile = "content.zip";
470  $scormFilePath = $import_dirname . "/" . $scormFile;
471  $file_path = $newObj->getDataDirectory() . "/" . $scormFile;
472  ilFileUtils::rename($scormFilePath, $file_path);
473  $this->archives->unzip(
474  $file_path,
475  $newObj->getDataDirectory(),
476  false,
477  false,
478  false
479  );
480  unlink($file_path);
481  ilFileUtils::delDir($lmTempDir, false);
482  } else {
483  // copy uploaded file to data directory
484  $file_path = $newObj->getDataDirectory() . "/" . $_FILES["scormfile"]["name"];
486  $_FILES["scormfile"]["tmp_name"],
487  $_FILES["scormfile"]["name"],
488  $file_path
489  );
490  $this->archives->unzip(
491  $file_path,
492  $newObj->getDataDirectory(),
493  false,
494  false,
495  false
496  );
497  }
498  } else {
499  // copy uploaded file to data directory
500  $uploadedFile = $DIC->http()->wrapper()->post()->retrieve('uploaded_file', $DIC->refinery()->kindlyTo()->string());
501  $file_path = $newObj->getDataDirectory() . "/" . $uploadedFile;
502  ilUploadFiles::_copyUploadFile($uploadedFile, $file_path);
503  $this->archives->unzip(
504  $file_path,
505  $newObj->getDataDirectory(),
506  false,
507  false,
508  false
509  );
510  }
511  ilFileUtils::renameExecutables($newObj->getDataDirectory());
512 
513  $title = $newObj->readObject();
514  if ($title != "") {
515  ilObject::_writeTitle($newObj->getId(), $title);
516  }
517 
518  //auto set learning progress settings
519  $newObj->setLearningProgressSettingsAtUpload();
520 
521  if ($importFromXml) {
522  $importer->writeData("sahs", "5.1.0", $newObj->getId());
523  }
524 
525  $this->tpl->setOnScreenMessage('info', $this->lng->txt($newObj->getType() . "_added"), true);
526  ilUtil::redirect("ilias.php?baseClass=ilSAHSEditGUI&ref_id=" . $newObj->getRefId());
527  }
528 
535  public function upload(): void
536  {
537  $this->uploadObject();
538  }
539 
540 
544  public function getTemplate(): void
545  {
546  global $DIC;
547  $lng = $DIC->language();
548 
549  $this->tpl->loadStandardTemplate();
550  }
551 
555  protected function setTabs(): void
556  {
557  global $DIC;
558  $baseClass = $refId = $DIC->http()->wrapper()->query()->retrieve('baseClass', $DIC->refinery()->kindlyTo()->string());
559  $this->tpl->setTitleIcon(ilUtil::getImagePath("standard/icon_lm.svg"));
560  $this->tpl->setTitle($this->object->getTitle());
561  $this->tpl->setDescription($this->object->getDescription());
562  if ($this->object && $this->object->getOfflineStatus()) {
563  $this->tpl->setAlertProperties(array(
564  array("alert" => true,
565  "property" => $this->lng->txt("status"),
566  "value" => $this->lng->txt("offline"))
567  ));
568  }
569  if (strtolower($baseClass) === "ilsahseditgui" || strtolower($baseClass) === "ilrepositorygui") {
570  $this->getTabs();
571  }
572  }
573 
577  public function certificate(): void
578  {
579  $guiFactory = new ilCertificateGUIFactory();
580  $output_gui = $guiFactory->create($this->object);
581 
582  $output_gui->certificateEditor();
583  }
584 
589  protected function getTabs(): void
590  {
591  global $DIC;
592  $rbacsystem = $DIC->access();
593  $ilCtrl = $DIC->ctrl();
594  $ilHelp = $DIC->help();
595 
596  if ($this->ctrl->getCmd() === "delete") {
597  return;
598  }
599 
600  switch ($this->object->getSubType()) {
601  case "scorm2004":
602  $ilHelp->setScreenIdComponent("sahs13");
603  break;
604 
605  case "scorm":
606  $ilHelp->setScreenIdComponent("sahs12");
607  break;
608  }
609 
610  // file system gui tabs
611  // properties
612  if ($rbacsystem->checkAccess("write", "", $this->object->getRefId())) {
613  $ilCtrl->setParameterByClass("ilfilesystemgui", "resetoffset", 1);
614  $this->tabs_gui->addTarget(
615  "cont_list_files",
616  $this->ctrl->getLinkTargetByClass("ilfilesystemgui", "listFiles"),
617  "",
618  "ilfilesystemgui"
619  );
620  $ilCtrl->setParameterByClass("ilfilesystemgui", "resetoffset", "");
621  }
622  // info screen
623  $force_active = ($this->ctrl->getNextClass() === "ilinfoscreengui")
624  ? true
625  : false;
626  $this->tabs_gui->addTarget(
627  "info_short",
628  $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"),
629  "",
630  "ilinfoscreengui",
631  "",
632  $force_active
633  );
634 
635  // properties
636  $this->tabs_gui->addTarget(
637  "settings",
638  $this->ctrl->getLinkTarget($this, "properties"),
639  array("", "properties"),
640  get_class($this)
641  );
642 
643  // if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
644  // $this->tabs_gui->addTarget(
645  // 'learning_progress',
646  // $this->ctrl->getLinkTargetByClass(array('illearningprogressgui'), ''),
647  // '',
648  // array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui')
649  // );
650  // }
651 
652  // tracking data
653  if ($rbacsystem->checkAccess("read_learning_progress", "", $this->object->getRefId()) || $rbacsystem->checkAccess("edit_learning_progress", "", $this->object->getRefId())) {
654  $ar_rights = [];
655  if ($rbacsystem->checkAccess("read_learning_progress", "", $this->object->getRefId())) {
656  $ar_rights = ['illplistofobjectsgui'];
657  }
658  if ($rbacsystem->checkAccess("edit_learning_progress", "", $this->object->getRefId())) {
659  $ar_rights[] = 'illplistofsettingsgui';
660  }
661  if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
662  $this->tabs_gui->addTarget(
663  'learning_progress',
664  $this->ctrl->getLinkTargetByClass(array('illearningprogressgui'), ''),
665  '',
666  $ar_rights
667  );
668  }
669 
670  if ($this->object->getSubType() === "scorm2004" || $this->object->getSubType() === "scorm") {
671  $privacy = ilPrivacySettings::getInstance();
672  if ($privacy->enabledSahsProtocolData()) {
673  $scormClass = "ilobjscormlearningmodulegui";
674  if ($this->object->getSubType() === "scorm2004") {
675  $scormClass = "ilobjscorm2004learningmodulegui";
676  }
677  $this->ctrl->setParameterByClass($scormClass, "ref_id", $this->object->getRefId());
678  $this->tabs_gui->addTarget(
679  "cont_tracking_data",
680  $this->ctrl->getLinkTargetByClass(['ilsahseditgui',$scormClass], "showTrackingItems"),
681  "showTrackingItems"
682  );
683  }
684  }
685  }
686 
687  if ($rbacsystem->checkAccess("write", "", $this->object->getRefId())) {
688  $mdgui = new ilObjectMetaDataGUI($this->object);
689  $mdtab = $mdgui->getTab();
690  if ($mdtab) {
691  $this->tabs_gui->addTarget(
692  "meta_data",
693  $mdtab,
694  "",
695  "ilmdeditorgui"
696  );
697  }
698  }
699  // export - Jour Fixe Date for Decission not to allow for Users with Right Wirite?
700  if ($rbacsystem->checkAccess("edit", "", $this->object->getRefId())) {
701  $this->tabs_gui->addTarget(
702  "export",
703  $this->ctrl->getLinkTarget($this, "export"),
704  array("", "export"),
705  get_class($this)
706  );
707  }
708 
709  // perm
710  if ($rbacsystem->checkAccess('edit_permission', "", $this->object->getRefId())) {
711  $this->tabs_gui->addTarget(
712  "perm_settings",
713  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
714  array("perm","info","owner"),
715  'ilpermissiongui'
716  );
717  }
718  }
719 
720 
724  public static function _goto(string $a_target): void
725  {
726  global $DIC;
727  $main_tpl = $DIC->ui()->mainTemplate();
728  $ilAccess = $DIC->access();
729  $ilErr = $DIC['ilErr'];
730  $lng = $DIC->language();
731 
732  $targetParameters = explode('_', $a_target);
733  $id = (int) $targetParameters[0];
734 
735  if ($id <= 0) {
736  $ilErr->raiseError($lng->txt('msg_no_perm_read'), $ilErr->FATAL);
737  }
738 
739  if ($ilAccess->checkAccess("write", "", $id)) {
740  $DIC->ctrl()->setParameterByClass("ilSAHSEditGUI", "ref_id", (string) $id);
741  $DIC->ctrl()->redirectByClass("ilSAHSEditGUI", "infoScreen"); //cmd was "" in 7
742  }
743 
744  if ($ilAccess->checkAccess("visible", "", $id) || $ilAccess->checkAccess("read", "", $id)) {
745  $DIC->ctrl()->setParameterByClass("ilSAHSPresentationGUI", "ref_id", (string) $id);
746  $DIC->ctrl()->redirectByClass("ilSAHSPresentationGUI", "infoScreen");
747  } else {
748  if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
749  $main_tpl->setOnScreenMessage('info', sprintf(
750  $lng->txt("msg_no_perm_read_item"),
752  ), true);
754  }
755  }
756 
757  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
758  }
759 
763  public function addLocatorItems(): void
764  {
765  global $DIC;
766  $ilLocator = $DIC['ilLocator'];
767 
768  if (is_object($this->object)) {
769  $ilLocator->addItem(
770  $this->object->getTitle(),
771  $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"),
772  "",
773  $DIC->http()->wrapper()->query()->retrieve('ref_id', $DIC->refinery()->kindlyTo()->int())
774  );
775  }
776  }
777 
778  // /**
779  // * List files
780  // *
781  // * @param
782  // * @return
783  // */
784  // public function editContent()
785  // {
786  // global $DIC;
787  // $ilCtrl = $DIC->ctrl();
788  //
792  // $ilCtrl->redirectByClass("ilobjscorm2004learningmodulegui", "editOrganization");
794  // }
795 
799  public function setSettingsSubTabs(): void
800  {
801  global $DIC;
802  $lng = $DIC->language();
803  $ilTabs = $DIC->tabs();
804  $ilCtrl = $DIC->ctrl();
805 
806  $ilTabs->addSubTabTarget(
807  "general",
808  $this->ctrl->getLinkTarget($this, "properties"),
809  array("edit", ""),
810  get_class($this)
811  );
812 
813  $ilTabs->addSubTabTarget(
814  "cont_sc_new_version",
815  $this->ctrl->getLinkTarget($this, "newModuleVersion"),
816  array("edit", ""),
817  get_class($this)
818  );
819 
820  $validator = new ilCertificateActiveValidator();
821  if (true === $validator->validate()) {
822  // // create and insert object in objecttree
823  // $ilTabs->addSubTabTarget("certificate",
824  // $this->ctrl->getLinkTarget($this, "certificate"),
825  // array("certificate", "certificateEditor", "certificateRemoveBackground", "certificateSave",
826  // "certificatePreview", "certificateDelete", "certificateUpload", "certificateImport")
827  // );
828  $ilTabs->addSubTabTarget(
829  "certificate",
830  $this->ctrl->getLinkTargetByClass([static::class, "ilcertificategui"], "certificateeditor"),
831  "",
832  "ilcertificategui"
833  );
834  }
835 
836  $lti_settings = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
837  if ($lti_settings->hasSettingsAccess()) {
838  $ilTabs->addSubTabTarget(
839  'lti_provider',
840  $this->ctrl->getLinkTargetByClass(ilLTIProviderObjectSettingGUI::class)
841  );
842  }
843 
844  $ilTabs->setTabActive('settings');
845  }
846 
850  public function export(): mixed
851  {
852  $GLOBALS['DIC']->tabs()->setTabActive('export');
853  $exp_gui = new ilExportGUI($this);
854  $this->ctrl->setCmd("listExportFiles");
855  $exp_gui->addFormat("xml");
856  return $this->ctrl->forwardCommand($exp_gui);
857  }
858 
859  public function exportModule(): void
860  {
861  global $DIC;
862  // $ilDB = $DIC->database();
863  //
864  $moduleId = ilObject::_lookupObjectId($DIC->http()->wrapper()->query()->retrieve('ref_id', $DIC->refinery()->kindlyTo()->int()));
865  $exporter = new ilScormAiccExporter();
866  // $xml = $exporter->getXmlRepresentation("sahs", "5.1.0", $moduleId);
867  }
868 
869  public function getType(): string
870  {
871  return "sahs";
872  }
873 } // END class.ilObjSAHSLearningModule
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...
static _writeTitle(int $obj_id, string $title)
write title to db (static)
Class ilInfoScreenGUI.
static getLogger(string $a_component_id)
Get component logger.
static _copyUploadFile(string $a_file, string $a_target, bool $a_raise_errors=true)
This class represents a selection list property in a property form.
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...
GUI class for the workflow of copying objects.
static _goto(string $a_target)
goto target course
const ROOT_FOLDER_ID
Definition: constants.php:32
prepareOutput(bool $show_sub_objects=true)
This class represents a file property in a property form.
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
certificate()
Shows the certificate editor.
getTemplate()
output main header (title and locator)
$refId
Definition: xapitoken.php:58
static _getUploadDirectory()
loadLanguageModule(string $a_module)
Load language module.
setOptions(array $a_options)
__construct($data, int $id, bool $call_by_reference, bool $prepare_output=true)
Constructor.
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress
$ilErr
Definition: raiseError.php:17
static _lookupObjId(int $ref_id)
global $DIC
Definition: feed.php:28
static renameExecutables(string $a_dir)
Export User Interface Class.
ilLanguage $lng
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a property in a property form.
__construct(VocabulariesInterface $vocabularies)
static _lookupTitle(int $obj_id)
$GLOBALS["DIC"]
Definition: wac.php:31
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilObjectGUI Basic methods of all Output classes.
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
setValue(string $a_value)
static _lookupObjectId(int $ref_id)
setUseUploadDirectory(bool $a_val)
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
setRequired(bool $a_required)
setCustomRolesForSelection(array $a_roles)
Set custom roles for mapping to LTI roles.
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
static redirect(string $a_script)
static ilTempnam(?string $a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
form( $class_path, string $cmd, string $submit_caption="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _checkUploadFile(string $a_file)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static rename(string $a_source, string $a_target)
File System Explorer GUI class.
initCreationForms(string $a_new_type)
no manual SCORM creation, only import at the time
static _getFrame(string $a_class)
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...
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
uploadObject()
display status information or report errors messages in case of error