19 declare(strict_types=1);
45 $this->archives = $DIC->legacyArchives();
46 $lng = $DIC->language();
47 $rbacsystem = $DIC->access();
61 $ilAccess = $DIC->access();
62 $ilTabs = $DIC->tabs();
64 $navigationHistory = $DIC[
'ilNavigationHistory'];
66 $baseClass =
$refId = $DIC->http()->wrapper()->query()->retrieve(
'baseClass', $DIC->refinery()->kindlyTo()->string());
68 $ilLog->debug(
"bc:" . $baseClass .
"; nc:" . $this->
ctrl->getNextClass($this) .
"; cmd:" . $this->
ctrl->getCmd());
69 if (strtolower($baseClass) ===
"iladministrationgui" ||
70 strtolower($baseClass) ===
"ilsahspresentationgui" ||
78 $this->tpl->setTitle($this->
object->getTitle());
79 $navigationHistory->addItem(
81 ilLink::_getLink($this->
object->getRefId(), $this->
object->getType()),
86 $next_class = $this->
ctrl->getNextClass($this);
87 $cmd = $this->
ctrl->getCmd();
89 switch ($next_class) {
90 case 'illtiproviderobjectsettinggui':
92 $ilTabs->setSubTabActive(
'lti_provider');
95 $lti_gui->offerLTIRolesForSelection(
false);
96 $this->
ctrl->forwardCommand($lti_gui);
100 case 'ilobjectmetadatagui':
101 if (!$ilAccess->checkAccess(
'write',
'', $this->object->getRefId())) {
102 $ilErr->raiseError($this->
lng->txt(
'permission_denied'),
$ilErr->WARNING);
105 $this->
ctrl->forwardCommand($md_gui);
114 case 'ilpermissiongui':
116 $this->
ctrl->forwardCommand($perm_gui);
119 case "ilfilesystemgui":
122 $fs_gui->setTableId(
"sahsfs" . $this->
object->getId());
123 $this->
ctrl->forwardCommand($fs_gui);
126 case "ilcertificategui":
128 $ilTabs->setSubTabActive(
'certificate');
131 $output_gui = $guiFactory->create($this->
object);
133 $this->
ctrl->forwardCommand($output_gui);
136 case "illearningprogressgui":
138 $this->
ctrl->forwardCommand($new_gui);
142 case "ilinfoscreengui":
143 $ilTabs->setTabActive(
'info_short');
147 case "ilcommonactiondispatchergui":
150 $this->
ctrl->forwardCommand($gui);
154 case 'ilobjectcopygui':
157 $cp->setType(
'sahs');
158 $this->
ctrl->forwardCommand($cp);
163 $cmd = $this->
ctrl->getCmd(
"properties");
165 if ((strtolower($baseClass) ===
"iladministrationgui" ||
167 $cmd !==
"frameset") {
172 if ($cmd ===
"redrawHeaderAction") {
183 $this->
ctrl->setCmd(
"showSummary");
184 $this->
ctrl->setCmdClass(
"ilinfoscreengui");
191 $this->error->raiseError($this->
lng->txt(
"msg_no_perm_read"), $this->error->MESSAGE);
195 $info->enablePrivateNotes();
196 $info->enableLearningProgress();
200 $ilToolbar =
$GLOBALS[
'DIC']->toolbar();
201 $ilToolbar->addButtonInstance($this->
object->getViewButton());
204 $info->enableNewsEditing(
false);
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");
214 $info->addMetaDataSections($this->
object->getId(), 0, $this->
object->getType());
217 $this->
ctrl->forwardCommand($info);
238 $this->
ctrl->setParameterByClass(
243 $this->
ctrl->redirectByClass(ilSAHSEditGUI::class);
275 $lng = $DIC->language();
276 $ilCtrl = $DIC->ctrl();
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);
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;
302 if (count($options) > 1) {
306 $radg->addOption($op0);
307 $op1 =
new ilRadioOption($this->
lng->txt(
"cont_choose_upload_dir"),
"upload_dir");
308 $radg->addOption($op1);
317 $op1->addSubItem($si);
319 $this->
form->addItem($radg);
323 $this->
form->addItem($fi);
326 $this->
form->addCommandButton(
"upload",
$lng->
txt(
"import"));
327 $this->
form->addCommandButton(
"cancel",
$lng->
txt(
"cancel"));
330 $this->
form->setFormAction($ilCtrl->getFormAction($this,
"upload"));
345 $rbacsystem = $DIC->access();
348 $refId = $DIC->http()->wrapper()->query()->retrieve(
'ref_id', $DIC->refinery()->kindlyTo()->int());
349 $importFromXml =
false;
352 if (!$rbacsystem->checkAccess(
"create",
'',
$refId,
"sahs")) {
353 $ilErr->raiseError($this->
lng->txt(
"no_create_permission"),
$ilErr->WARNING);
354 } elseif ($_FILES[
"scormfile"][
"name"]) {
356 $source = $_FILES[
"scormfile"][
"tmp_name"];
357 if (($source ===
'none') || (!$source)) {
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);
367 case UPLOAD_ERR_PARTIAL:
368 $ilErr->raiseError($this->
lng->txt(
"err_partial_file_upload"),
$ilErr->MESSAGE);
371 case UPLOAD_ERR_NO_FILE:
372 $ilErr->raiseError($this->
lng->txt(
"err_no_file_uploaded"),
$ilErr->MESSAGE);
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());
381 $ilErr->raiseError($this->
lng->txt(
"upload_error_file_not_found"),
$ilErr->MESSAGE);
384 $file = pathinfo($uploadedFile);
389 $name = substr($file[
"basename"], 0, strlen($file[
"basename"]) - strlen($file[
"extension"]) - 1);
391 $name = $this->
lng->txt(
"no_title");
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());
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"];
425 $zar->open($tempFile);
426 $zar->extractTo($lmTempDir);
430 $import_dirname = $lmTempDir .
'/' . substr($_FILES[
"scormfile"][
"name"], 0, -4);
431 $importer->importXmlRepresentation(
"sahs",
"", $import_dirname, null);
432 $import_result = $importer->getResult();
434 $importFromXml =
true;
435 if ($import_result->isOK()) {
436 $properties = $import_result->value();
437 if (($subType = $properties[
'SubType']) ===
'scorm') {
442 $name = $properties[
'Title'];
443 $description = $properties[
'Description'];
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);
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);
465 $newObj->createDataDirectory();
467 if ($_FILES[
"scormfile"][
"name"]) {
468 if ($importFromXml) {
469 $scormFile =
"content.zip";
470 $scormFilePath = $import_dirname .
"/" . $scormFile;
471 $file_path = $newObj->getDataDirectory() .
"/" . $scormFile;
473 $this->archives->unzip(
475 $newObj->getDataDirectory(),
484 $file_path = $newObj->getDataDirectory() .
"/" . $_FILES[
"scormfile"][
"name"];
486 $_FILES[
"scormfile"][
"tmp_name"],
487 $_FILES[
"scormfile"][
"name"],
490 $this->archives->unzip(
492 $newObj->getDataDirectory(),
500 $uploadedFile = $DIC->http()->wrapper()->post()->retrieve(
'uploaded_file', $DIC->refinery()->kindlyTo()->string());
501 $file_path = $newObj->getDataDirectory() .
"/" . $uploadedFile;
503 $this->archives->unzip(
505 $newObj->getDataDirectory(),
513 $title = $newObj->readObject();
519 $newObj->setLearningProgressSettingsAtUpload();
521 if ($importFromXml) {
522 $importer->writeData(
"sahs",
"5.1.0", $newObj->getId());
525 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt($newObj->getType() .
"_added"),
true);
526 ilUtil::redirect(
"ilias.php?baseClass=ilSAHSEditGUI&ref_id=" . $newObj->getRefId());
547 $lng = $DIC->language();
549 $this->tpl->loadStandardTemplate();
558 $baseClass =
$refId = $DIC->http()->wrapper()->query()->retrieve(
'baseClass', $DIC->refinery()->kindlyTo()->string());
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"))
569 if (strtolower($baseClass) ===
"ilsahseditgui" || strtolower($baseClass) ===
"ilrepositorygui") {
580 $output_gui = $guiFactory->create($this->
object);
582 $output_gui->certificateEditor();
592 $rbacsystem = $DIC->access();
593 $ilCtrl = $DIC->ctrl();
594 $ilHelp = $DIC->help();
596 if ($this->
ctrl->getCmd() ===
"delete") {
600 switch ($this->
object->getSubType()) {
602 $ilHelp->setScreenIdComponent(
"sahs13");
606 $ilHelp->setScreenIdComponent(
"sahs12");
612 if ($rbacsystem->checkAccess(
"write",
"", $this->object->getRefId())) {
613 $ilCtrl->setParameterByClass(
"ilfilesystemgui",
"resetoffset", 1);
614 $this->tabs_gui->addTarget(
616 $this->
ctrl->getLinkTargetByClass(
"ilfilesystemgui",
"listFiles"),
620 $ilCtrl->setParameterByClass(
"ilfilesystemgui",
"resetoffset",
"");
623 $force_active = ($this->
ctrl->getNextClass() ===
"ilinfoscreengui")
626 $this->tabs_gui->addTarget(
628 $this->
ctrl->getLinkTargetByClass(
"ilinfoscreengui",
"showSummary"),
636 $this->tabs_gui->addTarget(
638 $this->
ctrl->getLinkTarget($this,
"properties"),
639 array(
"",
"properties"),
653 if ($rbacsystem->checkAccess(
"read_learning_progress",
"", $this->object->getRefId()) || $rbacsystem->checkAccess(
"edit_learning_progress",
"", $this->object->getRefId())) {
655 if ($rbacsystem->checkAccess(
"read_learning_progress",
"", $this->object->getRefId())) {
656 $ar_rights = [
'illplistofobjectsgui'];
658 if ($rbacsystem->checkAccess(
"edit_learning_progress",
"", $this->object->getRefId())) {
659 $ar_rights[] =
'illplistofsettingsgui';
662 $this->tabs_gui->addTarget(
664 $this->
ctrl->getLinkTargetByClass(array(
'illearningprogressgui'),
''),
670 if ($this->
object->getSubType() ===
"scorm2004" || $this->
object->getSubType() ===
"scorm") {
672 if ($privacy->enabledSahsProtocolData()) {
673 $scormClass =
"ilobjscormlearningmodulegui";
674 if ($this->
object->getSubType() ===
"scorm2004") {
675 $scormClass =
"ilobjscorm2004learningmodulegui";
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"),
687 if ($rbacsystem->checkAccess(
"write",
"", $this->object->getRefId())) {
689 $mdtab = $mdgui->getTab();
691 $this->tabs_gui->addTarget(
700 if ($rbacsystem->checkAccess(
"edit",
"", $this->object->getRefId())) {
701 $this->tabs_gui->addTarget(
703 $this->
ctrl->getLinkTarget($this,
"export"),
710 if ($rbacsystem->checkAccess(
'edit_permission',
"", $this->object->getRefId())) {
711 $this->tabs_gui->addTarget(
713 $this->
ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"),
714 array(
"perm",
"info",
"owner"),
724 public static function _goto(
string $a_target): void
727 $main_tpl = $DIC->ui()->mainTemplate();
728 $ilAccess = $DIC->access();
730 $lng = $DIC->language();
732 $targetParameters = explode(
'_', $a_target);
733 $id = (
int) $targetParameters[0];
739 if ($ilAccess->checkAccess(
"write",
"",
$id)) {
740 $DIC->ctrl()->setParameterByClass(
"ilSAHSEditGUI",
"ref_id", (
string)
$id);
741 $DIC->ctrl()->redirectByClass(
"ilSAHSEditGUI",
"infoScreen");
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");
749 $main_tpl->setOnScreenMessage(
'info', sprintf(
750 $lng->
txt(
"msg_no_perm_read_item"),
766 $ilLocator = $DIC[
'ilLocator'];
768 if (is_object($this->
object)) {
770 $this->
object->getTitle(),
771 $this->
ctrl->getLinkTargetByClass(
"ilinfoscreengui",
"showSummary"),
773 $DIC->http()->wrapper()->query()->retrieve(
'ref_id', $DIC->refinery()->kindlyTo()->int())
802 $lng = $DIC->language();
803 $ilTabs = $DIC->tabs();
804 $ilCtrl = $DIC->ctrl();
806 $ilTabs->addSubTabTarget(
808 $this->
ctrl->getLinkTarget($this,
"properties"),
813 $ilTabs->addSubTabTarget(
814 "cont_sc_new_version",
815 $this->
ctrl->getLinkTarget($this,
"newModuleVersion"),
821 if (
true === $validator->validate()) {
828 $ilTabs->addSubTabTarget(
830 $this->
ctrl->getLinkTargetByClass([static::class,
"ilcertificategui"],
"certificateeditor"),
837 if ($lti_settings->hasSettingsAccess()) {
838 $ilTabs->addSubTabTarget(
840 $this->
ctrl->getLinkTargetByClass(ilLTIProviderObjectSettingGUI::class)
844 $ilTabs->setTabActive(
'settings');
852 $GLOBALS[
'DIC']->tabs()->setTabActive(
'export');
854 $this->
ctrl->setCmd(
"listExportFiles");
855 $exp_gui->addFormat(
"xml");
856 return $this->
ctrl->forwardCommand($exp_gui);
864 $moduleId =
ilObject::_lookupObjectId($DIC->http()->wrapper()->query()->retrieve(
'ref_id', $DIC->refinery()->kindlyTo()->int()));
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)
static getLogger(string $a_component_id)
Get component logger.
static _copyUploadFile(string $a_file, string $a_target, bool $a_raise_errors=true)
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
prepareOutput(bool $show_sub_objects=true)
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)
static _getUploadDirectory()
loadLanguageModule(string $a_module)
Load language module.
__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
setSettingsSubTabs()
List files.
static _lookupObjId(int $ref_id)
static renameExecutables(string $a_dir)
Export User Interface Class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupTitle(int $obj_id)
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)
getTabs()
adds tabs to tab gui object
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
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="")
properties()
module properties
const LP_CONTEXT_REPOSITORY
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
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.
executeCommand()
execute command
uploadObject()
display status information or report errors messages in case of error