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");
31 parent::__construct($a_data, $a_id, $a_call_by_reference,
false);
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")
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");
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);
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"));
383 $rbacsystem =
$DIC[
'rbacsystem'];
385 include_once
'Services/FileSystem/classes/class.ilUploadFiles.php';
388 if (!$rbacsystem->checkAccess(
"create",
$_GET[
"ref_id"],
"sahs")) {
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"];
436 include_once(
"./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
438 $newObj->setEditable(
$_POST[
"editable"] ==
'y');
439 $newObj->setImportSequencing(
$_POST[
"import_sequencing"]);
440 $newObj->setSequencingExpertMode(
$_POST[
"import_sequencing"]);
444 include_once(
"./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php");
449 $sFile = $_FILES[
"scormfile"];
450 $fType = $sFile[
"type"];
451 $cFileTypes = [
"application/zip",
"application/x-compressed",
"application/x-zip-compressed"];
452 if (in_array($fType, $cFileTypes)) {
454 $tempFile = $sFile[
"tmp_name"];
456 $lmTempDir = $lmDir . $timeStamp;
457 if (!file_exists($lmTempDir)) {
458 mkdir($lmTempDir, 0755,
true);
460 $zar =
new ZipArchive();
461 $zar->open($tempFile);
462 $zar->extractTo($lmTempDir);
464 require_once
"./Modules/ScormAicc/classes/class.ilScormAiccImporter.php";
466 $import_dirname = $lmTempDir .
'/' . substr($_FILES[
"scormfile"][
"name"], 0, strlen($a_filename) - 4);
467 if ($importer->importXmlRepresentation(
"sahs",
null, $import_dirname,
"") ==
true) {
468 $importFromXml =
true;
471 $mprops = $importer->moduleProperties;
472 $subType = $mprops[
"SubType"][0];
473 if ($subType ==
"scorm") {
474 include_once(
"./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php");
477 include_once(
"./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
487 $newObj->setTitle(
$name);
488 $newObj->setSubType($subType);
489 $newObj->setDescription(
"");
490 $newObj->setOfflineStatus(
true);
491 $newObj->create(
true);
492 $newObj->createReference();
493 $newObj->putInTree(
$_GET[
"ref_id"]);
494 $newObj->setPermissions(
$_GET[
"ref_id"]);
497 $newObj->createDataDirectory();
499 if ($_FILES[
"scormfile"][
"name"]) {
500 if ($importFromXml) {
501 $scormFile =
"content.zip";
502 $scormFilePath = $import_dirname .
"/" . $scormFile;
503 $file_path = $newObj->getDataDirectory() .
"/" . $scormFile;
510 $file_path = $newObj->getDataDirectory() .
"/" . $_FILES[
"scormfile"][
"name"];
511 ilUtil::moveUploadedFile(
512 $_FILES[
"scormfile"][
"tmp_name"],
513 $_FILES[
"scormfile"][
"name"],
520 $file_path = $newObj->getDataDirectory() .
"/" .
$_POST[
"uploaded_file"];
526 $title = $newObj->readObject();
532 $newObj->setLearningProgressSettingsAtUpload();
534 if ($importFromXml) {
535 $importer->writeData(
"sahs",
"5.1.0", $newObj->getId());
539 ilUtil::redirect(
"ilias.php?baseClass=ilSAHSEditGUI&ref_id=" . $newObj->getRefId());
554 if (trim(
$_POST[
"title"]) ==
"") {
555 $this->
ilias->raiseError($this->lng->txt(
"msg_no_title"), $this->ilias->error_obj->MESSAGE);
558 include_once(
"./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
561 $newObj->setSubType(
"scorm2004");
562 $newObj->setEditable(
true);
565 $newObj->createReference();
566 $newObj->putInTree(
$_GET[
"ref_id"]);
567 $newObj->setPermissions(
$_GET[
"ref_id"]);
568 $newObj->createDataDirectory();
569 $newObj->createScorm2004Tree();
573 $this->ctrl->setParameterByClass(
"ilObjSCORM2004LearningModuleGUI",
"ref_id", $newObj->getRefId());
574 $this->ctrl->redirectByClass(array(
"ilSAHSEditGUI",
"ilObjSCORM2004LearningModuleGUI"),
"showOrganization");
591 $this->ownerObject();
602 $this->tpl->getStandardTemplate();
611 $this->tpl->setTitle($this->object->getTitle());
612 if (strtolower(
$_GET[
"baseClass"]) ==
"ilsahseditgui") {
613 $this->
getTabs($this->tabs_gui);
624 $output_gui = $guiFactory->create($this->
object);
626 $output_gui->certificateEditor();
638 $ilHelp =
$DIC[
'ilHelp'];
639 $ilAccess =
$DIC->access();
641 if ($this->ctrl->getCmd() ==
"delete") {
645 switch ($this->object->getSubType()) {
647 $ilHelp->setScreenIdComponent(
"sahs13");
651 $ilHelp->setScreenIdComponent(
"sahs12");
657 $ilCtrl->setParameterByClass(
"ilfilesystemgui",
"resetoffset", 1);
658 $this->tabs_gui->addTarget(
660 $this->ctrl->getLinkTargetByClass(
"ilfilesystemgui",
"listFiles"),
664 $ilCtrl->setParameterByClass(
"ilfilesystemgui",
"resetoffset",
"");
667 $force_active = ($this->ctrl->getNextClass() ==
"ilinfoscreengui")
670 $this->tabs_gui->addTarget(
672 $this->ctrl->getLinkTargetByClass(
"ilinfoscreengui",
"showSummary"),
680 $this->tabs_gui->addTarget(
682 $this->ctrl->getLinkTarget($this,
"properties"),
683 array(
"",
"properties"),
688 include_once
'./Services/Tracking/classes/class.ilLearningProgressAccess.php';
691 if ($this->object->getSubType() ==
"scorm2004" || $this->
object->getSubType() ==
"scorm") {
692 if ($this->object->getOfflineMode() ==
true) {
693 $this->tabs_gui->addTarget(
694 "offline_mode_manager",
695 $this->ctrl->getLinkTarget($this,
"offlineModeManager"),
696 "offlineModeManager",
697 "ilobjscormlearningmodulegui"
703 $this->tabs_gui->addTarget(
705 $this->ctrl->getLinkTargetByClass(array(
'illearningprogressgui'),
''),
707 array(
'illplistofobjectsgui',
'illplistofsettingsgui',
'illearningprogressgui',
'illplistofprogressgui')
712 if ($ilAccess->checkAccess(
"read_learning_progress",
'', $this->object->getRefId()) || $ilAccess->checkAccess(
"edit_learning_progress",
'', $this->object->getRefId())) {
713 if ($this->object->getSubType() ==
"scorm2004" || $this->
object->getSubType() ==
"scorm") {
714 include_once(
'./Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
716 if ($privacy->enabledSahsProtocolData()) {
717 $this->tabs_gui->addTarget(
718 "cont_tracking_data",
719 $this->ctrl->getLinkTarget($this,
"showTrackingItems"),
728 include_once
"Services/Object/classes/class.ilObjectMetaDataGUI.php";
730 $mdtab = $mdgui->getTab();
732 $this->tabs_gui->addTarget(
741 if ($ilAccess->checkAccess(
"write",
"", $this->object->getRefId())) {
742 $this->tabs_gui->addTarget(
744 $this->ctrl->getLinkTarget($this,
"export"),
751 if ($ilAccess->checkAccess(
'edit_permission',
'', $this->object->getRefId())) {
752 $this->tabs_gui->addTarget(
754 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"),
755 array(
"perm",
"info",
"owner"),
764 public static function _goto($a_target)
767 $ilAccess =
$DIC[
'ilAccess'];
771 $parts = explode(
"_", $a_target);
773 if ($ilAccess->checkAccess(
"write",
"", $parts[0])) {
775 $_GET[
"baseClass"] =
"ilSAHSEditGUI";
776 $_GET[
"ref_id"] = $parts[0];
777 $_GET[
"obj_id"] = $parts[1];
778 include(
"ilias.php");
781 if ($ilAccess->checkAccess(
"visible",
"", $parts[0]) || $ilAccess->checkAccess(
"read",
"", $parts[0])) {
782 $_GET[
"cmd"] =
"infoScreen";
783 $_GET[
"baseClass"] =
"ilSAHSPresentationGUI";
784 $_GET[
"ref_id"] = $parts[0];
785 include(
"ilias.php");
788 if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID)) {
790 $lng->txt(
"msg_no_perm_read_item"),
803 $ilLocator =
$DIC[
'ilLocator'];
805 if (is_object($this->
object)) {
807 $this->object->getTitle(),
808 $this->ctrl->getLinkTargetByClass(
"ilinfoscreengui",
"showSummary"),
826 if (!$this->object->getEditable()) {
827 $ilCtrl->redirectByClass(
"ilfilesystemgui",
"listFiles");
829 $ilCtrl->redirectByClass(
"ilobjscorm2004learningmodulegui",
"editOrganization");
840 $ilTabs =
$DIC[
'ilTabs'];
843 $ilTabs->addSubTabTarget(
845 $this->ctrl->getLinkTarget($this,
"properties"),
850 $ilTabs->addSubTabTarget(
851 "cont_sc_new_version",
852 $this->ctrl->getLinkTarget($this,
"newModuleVersion"),
857 include_once
"Services/Certificate/classes/class.ilCertificate.php";
865 $ilTabs->addSubTabTarget(
867 $this->ctrl->getLinkTargetByClass(
"ilcertificategui",
"certificateeditor"),
874 if ($lti_settings->hasSettingsAccess()) {
875 $ilTabs->addSubTabTarget(
877 $this->ctrl->getLinkTargetByClass(ilLTIProviderObjectSettingGUI::class)
881 $ilTabs->setTabActive(
'settings');
888 $ilTabs =
$DIC[
'ilTabs'];
891 $ilTabs->activateTab(
"export");
892 include_once(
"./Services/Export/classes/class.ilExportGUI.php");
895 $exp_gui->addFormat(
"xml");
896 $ret = $this->ctrl->forwardCommand($exp_gui);
906 require_once
"./Modules/ScormAicc/classes/class.ilScormAiccExporter.php";
908 $xml = $exporter->getXmlRepresentation(
"sahs",
"5.1.0", $moduleId);
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()
list childs of current object
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 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.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
redirection script todo: (a better solution should control the processing via a xml file)
if(isset($_POST['submit'])) $form