3require_once
"./Services/Object/classes/class.ilObjectGUI.php";
4require_once(
"./Services/FileSystem/classes/class.ilFileSystemGUI.php");
24 public function __construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output =
true)
29 $lng->loadLanguageModule(
"content");
40 $ilAccess =
$DIC[
'ilAccess'];
41 $ilTabs =
$DIC[
'ilTabs'];
44 $GLOBALS[
'DIC'][
"ilLog"]->write(
"bc:" .
$_GET[
"baseClass"] .
"; nc:" . $this->ctrl->getNextClass($this) .
"; cmd:" . $this->ctrl->getCmd());
45 if (strtolower(
$_GET[
"baseClass"]) ==
"iladministrationgui" ||
46 strtolower(
$_GET[
"baseClass"]) ==
"ilsahspresentationgui" ||
54 $this->tpl->setTitle($this->object->getTitle());
57 $next_class = $this->ctrl->getNextClass($this);
58 $cmd = $this->ctrl->getCmd();
60 switch ($next_class) {
61 case 'illtiproviderobjectsettinggui':
63 $ilTabs->setSubTabActive(
'lti_provider');
65 $lti_gui->setCustomRolesForSelection(
$GLOBALS[
'DIC']->rbac()->review()->getLocalRoles($this->object->getRefId()));
66 $lti_gui->offerLTIRolesForSelection(
false);
67 $this->ctrl->forwardCommand($lti_gui);
71 case 'ilobjectmetadatagui':
72 if (!$ilAccess->checkAccess(
'write',
'', $this->object->getRefId())) {
73 $ilErr->raiseError($this->lng->txt(
'permission_denied'),
$ilErr->WARNING);
75 include_once
'Services/Object/classes/class.ilObjectMetaDataGUI.php';
77 $this->ctrl->forwardCommand($md_gui);
81 case 'ilpermissiongui':
82 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
84 $ret = $this->ctrl->forwardCommand($perm_gui);
87 case "ilfilesystemgui":
89 $this->fs_gui->setUseUploadDirectory(
true);
90 $this->fs_gui->setTableId(
"sahsfs" . $this->object->getId());
91 $ret = $this->ctrl->forwardCommand($this->fs_gui);
94 case "ilcertificategui":
96 $ilTabs->setSubTabActive(
'certificate');
99 $output_gui = $guiFactory->create($this->
object);
101 $ret = $this->ctrl->forwardCommand($output_gui);
104 case "illearningprogressgui":
105 include_once
'./Services/Tracking/classes/class.ilLearningProgressGUI.php';
108 $this->ctrl->forwardCommand($new_gui);
112 case "ilinfoscreengui":
113 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
116 $info->enablePrivateNotes();
117 $info->enableLearningProgress();
120 if ($ilAccess->checkAccess(
"read",
"",
$_GET[
"ref_id"])) {
121 if (!$this->object->getEditable()) {
122 $ilToolbar =
$GLOBALS[
'DIC']->toolbar();
123 $ilToolbar->addButtonInstance($this->object->getViewButton());
128 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"])) {
129 $info->enableNewsEditing();
131 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
132 if ($enable_internal_rss) {
133 $info->setBlockProperty(
"news",
"settings",
true);
137 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
140 $this->ctrl->forwardCommand($info);
143 case "ilcommonactiondispatchergui":
144 include_once(
"Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
146 $this->ctrl->forwardCommand($gui);
149 case "ilobjstylesheetgui":
151 $this->ctrl->setReturn($this,
"properties");
152 $ilTabs->clearTargets();
153 $style_gui =
new ilObjStyleSheetGUI(
"", $this->object->getStyleSheetId(),
false,
false);
154 $style_gui->omitLocator();
155 if ($cmd ==
"create" ||
$_GET[
"new_type"] ==
"sty") {
156 $style_gui->setCreationMode(
true);
160 if ($cmd ==
"confirmedDelete") {
161 $this->
object->setStyleSheetId(0);
162 $this->
object->update();
164 $ret = $this->ctrl->forwardCommand($style_gui);
165 if ($cmd ==
"save" || $cmd ==
"copyStyle" || $cmd ==
"importStyle") {
167 $this->
object->setStyleSheetId($style_id);
168 $this->
object->update();
169 $this->ctrl->redirectByClass(
"ilobjstylesheetgui",
"edit");
174 case 'ilobjectcopygui':
176 include_once
'./Services/Object/classes/class.ilObjectCopyGUI.php';
178 $cp->setType(
'sahs');
179 $this->ctrl->forwardCommand($cp);
183 if ($this->
object && !$this->object->getEditable()) {
184 $cmd = $this->ctrl->getCmd(
"properties");
186 $cmd = $this->ctrl->getCmd(
"frameset");
188 if ((strtolower(
$_GET[
"baseClass"]) ==
"iladministrationgui" ||
190 $cmd !=
"frameset") {
195 if ($cmd ==
"redrawHeaderAction") {
199 $ret = $this->$cmd();
207 if (strtolower(
$_GET[
"baseClass"]) ==
"iladministrationgui") {
208 parent::viewObject();
258 $ilCtrl =
$DIC[
'ilCtrl'];
260 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
267 $ti->setRequired(
true);
268 $this->form->addItem($ti);
274 $this->form->addItem($ta);
277 $this->form->addCommandButton(
"save",
$lng->txt(
"sahs_add"));
278 $this->form->addCommandButton(
"cancel",
$lng->txt(
"cancel"));
280 $this->form->setTitle(
$lng->txt(
"scorm_new"));
281 $this->form->setFormAction($ilCtrl->getFormAction($this));
292 $ilCtrl =
$DIC[
'ilCtrl'];
294 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
299 "scorm2004" =>
$lng->txt(
"lm_type_scorm2004"),
300 "scorm" =>
$lng->txt(
"lm_type_scorm"),
301 "exportFile" =>
$lng->txt(
"sahs_export_file")
304 $si->setOptions($options);
305 $this->form->addItem(
$si);
311 include_once
'Services/FileSystem/classes/class.ilUploadFiles.php';
313 $options[
""] = $this->lng->txt(
"cont_select_from_upload_dir");
315 foreach ($files as $file) {
316 $file = htmlspecialchars($file, ENT_QUOTES,
"utf-8");
317 $options[$file] = $file;
320 if (count($options) > 1) {
323 $op0 =
new ilRadioOption($this->lng->txt(
"cont_choose_local"),
"local");
324 $radg->addOption($op0);
325 $op1 =
new ilRadioOption($this->lng->txt(
"cont_choose_upload_dir"),
"upload_dir");
326 $radg->addOption($op1);
327 $radg->setValue(
"local");
329 $fi =
new ilFileInputGUI($this->lng->txt(
"select_file"),
"scormfile");
330 $fi->setRequired(
true);
331 $op0->addSubItem($fi);
334 $si->setOptions($options);
335 $op1->addSubItem(
$si);
337 $this->form->addItem($radg);
339 $fi =
new ilFileInputGUI($this->lng->txt(
"select_file"),
"scormfile");
340 $fi->setRequired(
true);
341 $this->form->addItem($fi);
348 $this->form->addItem($cb);
353 $cb->setInfo($this->lng->txt(
"sahs_authoring_mode_info"));
354 $this->form->addItem($cb);
359 $op1 =
new ilRadioOption(
$lng->txt(
"sahs_std_sequencing"), 0,
$lng->txt(
"sahs_std_sequencing_info"));
360 $radg->addOption($op1);
361 $op1 =
new ilRadioOption(
$lng->txt(
"sahs_import_sequencing"), 1,
$lng->txt(
"sahs_import_sequencing_info"));
362 $radg->addOption($op1);
363 $cb->addSubItem($radg);
366 $this->form->addCommandButton(
"upload",
$lng->txt(
"import"));
367 $this->form->addCommandButton(
"cancel",
$lng->txt(
"cancel"));
369 $this->form->setTitle(
$lng->txt(
"import_sahs"));
370 $this->form->setFormAction($ilCtrl->getFormAction($this,
"upload"));
385 include_once
'Services/FileSystem/classes/class.ilUploadFiles.php';
389 $this->
ilias->raiseError($this->lng->txt(
"no_create_permission"), $this->ilias->error_obj->WARNING);
390 } elseif ($_FILES[
"scormfile"][
"name"]) {
392 $source = $_FILES[
"scormfile"][
"tmp_name"];
394 $this->
ilias->raiseError($this->lng->txt(
"msg_no_file"), $this->ilias->error_obj->MESSAGE);
397 switch ($_FILES[
"scormfile"][
"error"]) {
398 case UPLOAD_ERR_INI_SIZE:
399 $this->
ilias->raiseError($this->lng->txt(
"err_max_file_size_exceeds"), $this->ilias->error_obj->MESSAGE);
402 case UPLOAD_ERR_FORM_SIZE:
403 $this->
ilias->raiseError($this->lng->txt(
"err_max_file_size_exceeds"), $this->ilias->error_obj->MESSAGE);
406 case UPLOAD_ERR_PARTIAL:
407 $this->
ilias->raiseError($this->lng->txt(
"err_partial_file_upload"), $this->ilias->error_obj->MESSAGE);
410 case UPLOAD_ERR_NO_FILE:
411 $this->
ilias->raiseError($this->lng->txt(
"err_no_file_uploaded"), $this->ilias->error_obj->MESSAGE);
415 $file = pathinfo($_FILES[
"scormfile"][
"name"]);
416 } elseif (
$_POST[
"uploaded_file"]) {
419 $this->
ilias->raiseError($this->lng->txt(
"upload_error_file_not_found"), $this->ilias->error_obj->MESSAGE);
422 $file = pathinfo(
$_POST[
"uploaded_file"]);
424 $this->
ilias->raiseError($this->lng->txt(
"msg_no_file"), $this->ilias->error_obj->MESSAGE);
427 $name = substr($file[
"basename"], 0, strlen($file[
"basename"]) - strlen($file[
"extension"]) - 1);
429 $name = $this->lng->txt(
"no_title");
434 $subType =
$_POST[
"sub_type"];
437 if (
$_POST[
"editable"] ==
'y') {
438 $subType =
"scorm2004";
444 include_once(
"./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
446 $newObj->setEditable(
$_POST[
"editable"] ==
'y');
447 $newObj->setImportSequencing(
$_POST[
"import_sequencing"]);
448 $newObj->setSequencingExpertMode(
$_POST[
"import_sequencing"]);
452 include_once(
"./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php");
457 $sFile = $_FILES[
"scormfile"];
458 $fType = $sFile[
"type"];
459 $cFileTypes = [
"application/zip",
"application/x-compressed",
"application/x-zip-compressed"];
460 if (in_array($fType, $cFileTypes)) {
461 $tempFile = $sFile[
"tmp_name"];
464 $zar =
new ZipArchive();
465 $zar->open($tempFile);
466 $zar->extractTo($lmTempDir);
469 require_once
"./Modules/ScormAicc/classes/class.ilScormAiccImporter.php";
472 $import_dirname = $lmTempDir .
'/' . substr($_FILES[
"scormfile"][
"name"], 0, -4);
473 $importFromXml =
false;
474 if ($importer->importXmlRepresentation(
"sahs",
null, $import_dirname,
"") ==
true) {
475 $importFromXml =
true;
478 $mprops = $importer->moduleProperties;
479 if ($importFromXml && isset($mprops[
"SubType"])) {
480 $subType = $mprops[
"SubType"];
481 if ($subType ==
"scorm") {
482 include_once(
"./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php");
485 include_once(
"./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
491 $name = $mprops[
'Title'];
492 $description = $mprops[
'Description'];
502 $newObj->setTitle(
$name);
503 $newObj->setSubType($subType);
504 $newObj->setDescription($description);
505 $newObj->setOfflineStatus(
true);
506 $newObj->create(
true);
507 $newObj->createReference();
508 $newObj->putInTree(
$_GET[
"ref_id"]);
509 $newObj->setPermissions(
$_GET[
"ref_id"]);
512 $newObj->createDataDirectory();
514 if ($_FILES[
"scormfile"][
"name"]) {
515 if ($importFromXml) {
516 $scormFile =
"content.zip";
517 $scormFilePath = $import_dirname .
"/" . $scormFile;
518 $file_path = $newObj->getDataDirectory() .
"/" . $scormFile;
525 $file_path = $newObj->getDataDirectory() .
"/" . $_FILES[
"scormfile"][
"name"];
527 $_FILES[
"scormfile"][
"tmp_name"],
528 $_FILES[
"scormfile"][
"name"],
535 $file_path = $newObj->getDataDirectory() .
"/" .
$_POST[
"uploaded_file"];
541 $title = $newObj->readObject();
547 $newObj->setLearningProgressSettingsAtUpload();
549 if ($importFromXml) {
550 $importer->writeData(
"sahs",
"5.1.0", $newObj->getId());
554 ilUtil::redirect(
"ilias.php?baseClass=ilSAHSEditGUI&ref_id=" . $newObj->getRefId());
569 if (trim(
$_POST[
"title"]) ==
"") {
570 $this->
ilias->raiseError($this->lng->txt(
"msg_no_title"), $this->ilias->error_obj->MESSAGE);
573 include_once(
"./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
576 $newObj->setSubType(
"scorm2004");
577 $newObj->setEditable(
true);
580 $newObj->createReference();
581 $newObj->putInTree(
$_GET[
"ref_id"]);
582 $newObj->setPermissions(
$_GET[
"ref_id"]);
583 $newObj->createDataDirectory();
584 $newObj->createScorm2004Tree();
588 $this->ctrl->setParameterByClass(
"ilObjSCORM2004LearningModuleGUI",
"ref_id", $newObj->getRefId());
589 $this->ctrl->redirectByClass(array(
"ilSAHSEditGUI",
"ilObjSCORM2004LearningModuleGUI"),
"showOrganization");
606 $this->ownerObject();
617 $this->tpl->loadStandardTemplate();
626 $this->tpl->setTitle($this->object->getTitle());
627 if (strtolower(
$_GET[
"baseClass"]) ==
"ilsahseditgui") {
628 $this->
getTabs($this->tabs_gui);
639 $output_gui = $guiFactory->create($this->
object);
641 $output_gui->certificateEditor();
653 $ilCtrl =
$DIC[
'ilCtrl'];
654 $ilHelp =
$DIC[
'ilHelp'];
656 if ($this->ctrl->getCmd() ==
"delete") {
660 switch ($this->object->getSubType()) {
662 $ilHelp->setScreenIdComponent(
"sahs13");
666 $ilHelp->setScreenIdComponent(
"sahs12");
672 $ilCtrl->setParameterByClass(
"ilfilesystemgui",
"resetoffset", 1);
673 $this->tabs_gui->addTarget(
675 $this->ctrl->getLinkTargetByClass(
"ilfilesystemgui",
"listFiles"),
679 $ilCtrl->setParameterByClass(
"ilfilesystemgui",
"resetoffset",
"");
682 $force_active = ($this->ctrl->getNextClass() ==
"ilinfoscreengui")
685 $this->tabs_gui->addTarget(
687 $this->ctrl->getLinkTargetByClass(
"ilinfoscreengui",
"showSummary"),
695 $this->tabs_gui->addTarget(
697 $this->ctrl->getLinkTarget($this,
"properties"),
698 array(
"",
"properties"),
703 include_once
'./Services/Tracking/classes/class.ilLearningProgressAccess.php';
706 if ($this->object->getSubType() ==
"scorm2004" || $this->
object->getSubType() ==
"scorm") {
707 if ($this->object->getOfflineMode() ==
true) {
708 $this->tabs_gui->addTarget(
709 "offline_mode_manager",
710 $this->ctrl->getLinkTarget($this,
"offlineModeManager"),
711 "offlineModeManager",
712 "ilobjscormlearningmodulegui"
718 $this->tabs_gui->addTarget(
720 $this->ctrl->getLinkTargetByClass(array(
'illearningprogressgui'),
''),
722 array(
'illplistofobjectsgui',
'illplistofsettingsgui',
'illearningprogressgui',
'illplistofprogressgui')
727 if (
$rbacsystem->checkAccess(
"read_learning_progress", $this->object->getRefId()) ||
$rbacsystem->checkAccess(
"edit_learning_progress", $this->object->getRefId())) {
728 if ($this->object->getSubType() ==
"scorm2004" || $this->
object->getSubType() ==
"scorm") {
729 include_once(
'./Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
731 if ($privacy->enabledSahsProtocolData()) {
732 $this->tabs_gui->addTarget(
733 "cont_tracking_data",
734 $this->ctrl->getLinkTarget($this,
"showTrackingItems"),
743 include_once
"Services/Object/classes/class.ilObjectMetaDataGUI.php";
745 $mdtab = $mdgui->getTab();
747 $this->tabs_gui->addTarget(
756 if (
$rbacsystem->checkAccess(
"edit_permission",
"", $this->object->getRefId())) {
757 $this->tabs_gui->addTarget(
759 $this->ctrl->getLinkTarget($this,
"export"),
766 if (
$rbacsystem->checkAccess(
'edit_permission', $this->object->getRefId())) {
767 $this->tabs_gui->addTarget(
769 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"),
770 array(
"perm",
"info",
"owner"),
779 public static function _goto($a_target)
782 $ilAccess =
$DIC[
'ilAccess'];
786 $parts = explode(
"_", $a_target);
788 if ($ilAccess->checkAccess(
"write",
"", $parts[0])) {
790 $_GET[
"baseClass"] =
"ilSAHSEditGUI";
791 $_GET[
"ref_id"] = $parts[0];
792 $_GET[
"obj_id"] = $parts[1];
793 include(
"ilias.php");
796 if ($ilAccess->checkAccess(
"visible",
"", $parts[0]) || $ilAccess->checkAccess(
"read",
"", $parts[0])) {
797 $_GET[
"cmd"] =
"infoScreen";
798 $_GET[
"baseClass"] =
"ilSAHSPresentationGUI";
799 $_GET[
"ref_id"] = $parts[0];
800 include(
"ilias.php");
805 $lng->txt(
"msg_no_perm_read_item"),
818 $ilLocator =
$DIC[
'ilLocator'];
820 if (is_object($this->
object)) {
822 $this->object->getTitle(),
823 $this->ctrl->getLinkTargetByClass(
"ilinfoscreengui",
"showSummary"),
839 $ilCtrl =
$DIC[
'ilCtrl'];
841 if (!$this->object->getEditable()) {
842 $ilCtrl->redirectByClass(
"ilfilesystemgui",
"listFiles");
844 $ilCtrl->redirectByClass(
"ilobjscorm2004learningmodulegui",
"editOrganization");
855 $ilTabs =
$DIC[
'ilTabs'];
856 $ilCtrl =
$DIC[
'ilCtrl'];
858 $ilTabs->addSubTabTarget(
860 $this->ctrl->getLinkTarget($this,
"properties"),
865 $ilTabs->addSubTabTarget(
866 "cont_sc_new_version",
867 $this->ctrl->getLinkTarget($this,
"newModuleVersion"),
873 if (
true === $validator->validate()) {
880 $ilTabs->addSubTabTarget(
882 $this->ctrl->getLinkTargetByClass(
"ilcertificategui",
"certificateeditor"),
889 if ($lti_settings->hasSettingsAccess()) {
890 $ilTabs->addSubTabTarget(
892 $this->ctrl->getLinkTargetByClass(ilLTIProviderObjectSettingGUI::class)
896 $ilTabs->setTabActive(
'settings');
903 $ilTabs =
$DIC[
'ilTabs'];
904 $ilCtrl =
$DIC[
'ilCtrl'];
906 $ilTabs->activateTab(
"export");
907 include_once(
"./Services/Export/classes/class.ilExportGUI.php");
910 $exp_gui->addFormat(
"xml");
911 $ret = $this->ctrl->forwardCommand($exp_gui);
921 require_once
"./Modules/ScormAicc/classes/class.ilScormAiccExporter.php";
923 $xml = $exporter->getXmlRepresentation(
"sahs",
"5.1.0", $moduleId);
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
An exception for terminatinating execution or to throw for unit testing.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Export User Interface Class.
File System Explorer GUI class.
static rename($a_source, $a_target)
Rename a file.
GUI class for LTI provider object settings.
static checkAccess($a_ref_id, $a_allow_only_read=true)
check access to learning progress
const LP_CONTEXT_REPOSITORY
Class ilObjUserTrackingGUI.
saveProperties()
save properties
getTabs()
adds tabs to tab gui object
addLocatorItems()
should be overwritten to add object specific items (repository items are preloaded)
saveObject()
save new learning module to db
executeCommand()
execute command
static _goto($a_target)
goto target course
initUploadForm()
Init upload form.
__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
Constructor.
properties()
module properties
viewObject()
viewObject container presentation for "administration -> repository, trash, permissions"
initCreationForms($a_new_type)
no manual SCORM creation, only import at the time
certificate()
Shows the certificate editor.
setSettingsSubTabs()
set Tabs for settings
owner()
show owner of learning module
initCreationForm()
Init form.
getTemplate()
output main header (title and locator)
uploadObject()
display status information or report errors messages in case of error
Class ilObjSCORM2004LearningModule.
Class ilObjSCORMLearningModule.
Class ilObjStyleSheetGUI.
GUI class for the workflow of copying objects.
Class ilObjectGUI Basic methods of all Output classes.
prepareOutput($a_show_subobjects=true)
prepare output
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
fillCloneTemplate($a_tpl_varname, $a_type)
Fill object clone template This method can be called from any object GUI class that wants to offer ob...
getCreationMode()
get creation mode
static _lookupObjId($a_id)
const TITLE_LENGTH
max length of object title
static _lookupTitle($a_id)
lookup object title
static _lookupObjectId($a_ref_id)
lookup object id
static _writeTitle($a_obj_id, $a_title)
write title to db (static)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static _getInstance()
Get instance of ilPrivacySettings.
This class represents an option in a radio group.
This class represents a text area property in a property form.
This class represents a text property in a property form.
static _getUploadFiles()
Get a list of readable files in the upload directory.
static _copyUploadFile($a_file, $a_target, $a_raise_errors=true)
copy an uploaded file to the target directory (including virus check)
static _checkUploadFile($a_file)
Check if a file exists in the upload directory and is readable.
static _getUploadDirectory()
Get the directory with uploaded files.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static redirect($a_script)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static unzip(string $path_to_zip_file, bool $overwrite_existing=false, bool $unpack_flat=false)
static ilTempnam($a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
redirection script todo: (a better solution should control the processing via a xml file)