3 include_once(
"./Services/Export/classes/class.ilXmlImporter.php");
8 require_once
"./Modules/ScormAicc/classes/class.ilScormAiccDataSet.php";
11 $this->moduleProperties = [];
33 if ($a_id != null && $new_id = $a_mapping->getMapping(
'Services/Container',
'objs', $a_id)) {
36 require_once(
"./Services/Export/classes/class.ilExport.php");
38 $tempFile = dirname($exportDir) .
'/export/' . basename($this->
getImportDirectory()) .
'.zip';
41 $lmTempDir = $lmDir . $timeStamp;
42 if (!file_exists($lmTempDir)) {
43 mkdir($lmTempDir, 0755,
true);
45 $zar =
new ZipArchive();
46 $zar->open($tempFile);
47 $zar->extractTo($lmTempDir);
55 if (file_exists($a_import_dirname)) {
56 $manifestFile = $a_import_dirname .
"/manifest.xml";
57 if (file_exists($manifestFile)) {
58 $manifest = file_get_contents($manifestFile);
59 if (isset($manifest)) {
60 $propertiesFile = $a_import_dirname .
"/properties.xml";
61 $xml = file_get_contents($propertiesFile);
63 $xmlRoot = simplexml_load_string(
$xml);
64 foreach ($this->dataset->properties as
$key => $value) {
65 $this->moduleProperties[
$key] = $xmlRoot->$key;
67 $this->moduleProperties[
"Title"] = $xmlRoot->Title;
68 $this->moduleProperties[
"Description"] = $xmlRoot->Description;
70 if ($a_id != null && $new_id = $a_mapping->getMapping(
'Services/Container',
'objs', $a_id)) {
71 $this->dataset->writeData(
"sahs",
"5.1.0", $newObj->getId(), $this->moduleProperties);
73 $newObj->createReference();
75 $scormFile =
"content.zip";
76 $scormFilePath = $a_import_dirname .
"/" . $scormFile;
77 $targetPath = $newObj->getDataDirectory() .
"/" . $scormFile;
78 $file_path = $targetPath;
86 $newId = $newObj->getRefId();
89 $subType = $this->moduleProperties[
"SubType"][0];
90 if ($subType ==
"scorm") {
91 include_once(
"./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php");
94 include_once(
"./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
97 $title = $newObj->readObject();
99 $newObj->setLearningProgressSettingsAtUpload();
105 $ilLog->write(
"error parsing xml file for scorm import");
109 $ilLog->write(
"error reading manifest file");
112 $ilLog->write(
"error no manifest file found");
115 $ilLog->write(
"error file lost while importing");
123 $this->dataset->writeData($a_entity, $a_version, $a_id, $this->moduleProperties);
138 if (is_int(strpos($a_xml,
"<Editable>1</Editable>"))) {
140 include_once(
"./Modules/Scorm2004/classes/class.ilScorm2004DataSet.php");
145 include_once(
"./Services/DataSet/classes/class.ilDataSetImportParser.php");
getSchemaVersion()
Get schema version.
getImportDirectory()
Get import directory.
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
Manifest parser for ILIAS standard export files.
handleEditableLmXml($a_entity, $a_id, $a_xml, $a_mapping)
Handle editable (authoring) scorm lms.
static rename($a_source, $a_target)
Rename a file.
importXmlRepresentation($a_entity, $a_id, $a_import_dirname, $a_mapping)
Import XML.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
Class ilObjSCORM2004LearningModule.
static _getExportDirectory($a_obj_id, $a_type="xml", $a_obj_type="", $a_entity="")
Get export directory for an repository object.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
writeData($a_entity, $a_version, $a_id)
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
Class ilObjSCORMLearningModule.