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();
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));
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");
432 $subType =
$_POST[
"sub_type"];
435 if (
$_POST[
"editable"] ==
'y') {
436 $subType =
"scorm2004";
442 include_once(
"./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
444 $newObj->setEditable(
$_POST[
"editable"] ==
'y');
445 $newObj->setImportSequencing(
$_POST[
"import_sequencing"]);
446 $newObj->setSequencingExpertMode(
$_POST[
"import_sequencing"]);
450 include_once(
"./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php");
455 $sFile = $_FILES[
"scormfile"];
456 $fType = $sFile[
"type"];
457 $cFileTypes = [
"application/zip",
"application/x-compressed",
"application/x-zip-compressed"];
458 if (in_array($fType, $cFileTypes)) {
460 $tempFile = $sFile[
"tmp_name"];
462 $lmTempDir = $lmDir . $timeStamp;
463 if (!file_exists($lmTempDir)) {
464 mkdir($lmTempDir, 0755,
true);
466 $zar =
new ZipArchive();
467 $zar->open($tempFile);
468 $zar->extractTo($lmTempDir);
470 require_once
"./Modules/ScormAicc/classes/class.ilScormAiccImporter.php";
472 $import_dirname = $lmTempDir .
'/' . substr($_FILES[
"scormfile"][
"name"], 0, strlen($a_filename) - 4);
473 if ($importer->importXmlRepresentation(
"sahs",
null, $import_dirname,
"") ==
true) {
474 $importFromXml =
true;
477 $mprops = $importer->moduleProperties;
478 $subType = $mprops[
"SubType"][0];
479 if ($subType ==
"scorm") {
480 include_once(
"./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php");
483 include_once(
"./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
493 $newObj->setTitle(
$name);
494 $newObj->setSubType($subType);
495 $newObj->setDescription(
"");
496 $newObj->setOfflineStatus(
true);
497 $newObj->create(
true);
498 $newObj->createReference();
499 $newObj->putInTree(
$_GET[
"ref_id"]);
500 $newObj->setPermissions(
$_GET[
"ref_id"]);
503 $newObj->createDataDirectory();
505 if ($_FILES[
"scormfile"][
"name"]) {
506 if ($importFromXml) {
507 $scormFile =
"content.zip";
508 $scormFilePath = $import_dirname .
"/" . $scormFile;
509 $file_path = $newObj->getDataDirectory() .
"/" . $scormFile;
516 $file_path = $newObj->getDataDirectory() .
"/" . $_FILES[
"scormfile"][
"name"];
518 $_FILES[
"scormfile"][
"tmp_name"],
519 $_FILES[
"scormfile"][
"name"],
526 $file_path = $newObj->getDataDirectory() .
"/" .
$_POST[
"uploaded_file"];
532 $title = $newObj->readObject();
538 $newObj->setLearningProgressSettingsAtUpload();
540 if ($importFromXml) {
541 $importer->writeData(
"sahs",
"5.1.0", $newObj->getId());
545 ilUtil::redirect(
"ilias.php?baseClass=ilSAHSEditGUI&ref_id=" . $newObj->getRefId());
560 if (trim(
$_POST[
"title"]) ==
"") {
561 $this->
ilias->raiseError($this->lng->txt(
"msg_no_title"), $this->ilias->error_obj->MESSAGE);
564 include_once(
"./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
567 $newObj->setSubType(
"scorm2004");
568 $newObj->setEditable(
true);
571 $newObj->createReference();
572 $newObj->putInTree(
$_GET[
"ref_id"]);
573 $newObj->setPermissions(
$_GET[
"ref_id"]);
574 $newObj->createDataDirectory();
575 $newObj->createScorm2004Tree();
579 $this->ctrl->setParameterByClass(
"ilObjSCORM2004LearningModuleGUI",
"ref_id", $newObj->getRefId());
580 $this->ctrl->redirectByClass(array(
"ilSAHSEditGUI",
"ilObjSCORM2004LearningModuleGUI"),
"showOrganization");
597 $this->ownerObject();
608 $this->tpl->loadStandardTemplate();
617 $this->tpl->setTitle($this->object->getTitle());
618 if (strtolower(
$_GET[
"baseClass"]) ==
"ilsahseditgui") {
619 $this->
getTabs($this->tabs_gui);
630 $output_gui = $guiFactory->create($this->
object);
632 $output_gui->certificateEditor();
644 $ilHelp =
$DIC[
'ilHelp'];
645 $ilAccess =
$DIC->access();
647 if ($this->ctrl->getCmd() ==
"delete") {
651 switch ($this->object->getSubType()) {
653 $ilHelp->setScreenIdComponent(
"sahs13");
657 $ilHelp->setScreenIdComponent(
"sahs12");
663 $ilCtrl->setParameterByClass(
"ilfilesystemgui",
"resetoffset", 1);
664 $this->tabs_gui->addTarget(
666 $this->ctrl->getLinkTargetByClass(
"ilfilesystemgui",
"listFiles"),
670 $ilCtrl->setParameterByClass(
"ilfilesystemgui",
"resetoffset",
"");
673 $force_active = ($this->ctrl->getNextClass() ==
"ilinfoscreengui")
676 $this->tabs_gui->addTarget(
678 $this->ctrl->getLinkTargetByClass(
"ilinfoscreengui",
"showSummary"),
686 $this->tabs_gui->addTarget(
688 $this->ctrl->getLinkTarget($this,
"properties"),
689 array(
"",
"properties"),
694 include_once
'./Services/Tracking/classes/class.ilLearningProgressAccess.php';
697 if ($this->object->getSubType() ==
"scorm2004" || $this->
object->getSubType() ==
"scorm") {
698 if ($this->object->getOfflineMode() ==
true) {
699 $this->tabs_gui->addTarget(
700 "offline_mode_manager",
701 $this->ctrl->getLinkTarget($this,
"offlineModeManager"),
702 "offlineModeManager",
703 "ilobjscormlearningmodulegui"
709 $this->tabs_gui->addTarget(
711 $this->ctrl->getLinkTargetByClass(array(
'illearningprogressgui'),
''),
713 array(
'illplistofobjectsgui',
'illplistofsettingsgui',
'illearningprogressgui',
'illplistofprogressgui')
718 if ($ilAccess->checkAccess(
"read_learning_progress",
'', $this->object->getRefId()) || $ilAccess->checkAccess(
"edit_learning_progress",
'', $this->object->getRefId())) {
719 if ($this->object->getSubType() ==
"scorm2004" || $this->
object->getSubType() ==
"scorm") {
720 include_once(
'./Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
722 if ($privacy->enabledSahsProtocolData()) {
723 $this->tabs_gui->addTarget(
724 "cont_tracking_data",
725 $this->ctrl->getLinkTarget($this,
"showTrackingItems"),
734 include_once
"Services/Object/classes/class.ilObjectMetaDataGUI.php";
736 $mdtab = $mdgui->getTab();
738 $this->tabs_gui->addTarget(
747 if ($ilAccess->checkAccess(
"write",
"", $this->object->getRefId())) {
748 $this->tabs_gui->addTarget(
750 $this->ctrl->getLinkTarget($this,
"export"),
757 if ($ilAccess->checkAccess(
'edit_permission',
'', $this->object->getRefId())) {
758 $this->tabs_gui->addTarget(
760 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"),
761 array(
"perm",
"info",
"owner"),
770 public static function _goto($a_target)
773 $ilAccess =
$DIC[
'ilAccess'];
777 $parts = explode(
"_", $a_target);
779 if ($ilAccess->checkAccess(
"write",
"", $parts[0])) {
781 $_GET[
"baseClass"] =
"ilSAHSEditGUI";
782 $_GET[
"ref_id"] = $parts[0];
783 $_GET[
"obj_id"] = $parts[1];
784 include(
"ilias.php");
787 if ($ilAccess->checkAccess(
"visible",
"", $parts[0]) || $ilAccess->checkAccess(
"read",
"", $parts[0])) {
788 $_GET[
"cmd"] =
"infoScreen";
789 $_GET[
"baseClass"] =
"ilSAHSPresentationGUI";
790 $_GET[
"ref_id"] = $parts[0];
791 include(
"ilias.php");
794 if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID)) {
796 $lng->txt(
"msg_no_perm_read_item"),
809 $ilLocator =
$DIC[
'ilLocator'];
811 if (is_object($this->
object)) {
813 $this->object->getTitle(),
814 $this->ctrl->getLinkTargetByClass(
"ilinfoscreengui",
"showSummary"),
832 if (!$this->object->getEditable()) {
833 $ilCtrl->redirectByClass(
"ilfilesystemgui",
"listFiles");
835 $ilCtrl->redirectByClass(
"ilobjscorm2004learningmodulegui",
"editOrganization");
846 $ilTabs =
$DIC[
'ilTabs'];
849 $ilTabs->addSubTabTarget(
851 $this->ctrl->getLinkTarget($this,
"properties"),
856 $ilTabs->addSubTabTarget(
857 "cont_sc_new_version",
858 $this->ctrl->getLinkTarget($this,
"newModuleVersion"),
864 if (
true === $validator->validate()) {
871 $ilTabs->addSubTabTarget(
873 $this->ctrl->getLinkTargetByClass(
"ilcertificategui",
"certificateeditor"),
880 if ($lti_settings->hasSettingsAccess()) {
881 $ilTabs->addSubTabTarget(
883 $this->ctrl->getLinkTargetByClass(ilLTIProviderObjectSettingGUI::class)
887 $ilTabs->setTabActive(
'settings');
894 $ilTabs =
$DIC[
'ilTabs'];
897 $ilTabs->activateTab(
"export");
898 include_once(
"./Services/Export/classes/class.ilExportGUI.php");
901 $exp_gui->addFormat(
"xml");
902 $ret = $this->ctrl->forwardCommand($exp_gui);
912 require_once
"./Modules/ScormAicc/classes/class.ilScormAiccExporter.php";
914 $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 getWebspaceDir($mode="filesystem")
get webspace directory
static redirect($a_script)
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
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 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)