3include_once(
"./Services/Export/classes/class.ilXmlImporter.php");
 
    8        require_once 
"./Modules/ScormAicc/classes/class.ilScormAiccDataSet.php";
 
   11        $this->moduleProperties = [];
 
   28        $ilLog = 
$DIC[
'ilLog'];
 
   34        if ($a_id != 
null && $new_id = $a_mapping->getMapping(
'Services/Container', 
'objs', $a_id)) {
 
   62        if (file_exists($a_import_dirname)) {
 
   63            $manifestFile = $a_import_dirname . 
"/manifest.xml";
 
   64            if (file_exists($manifestFile)) {
 
   65                $manifest = file_get_contents($manifestFile);
 
   66                if (isset($manifest)) {
 
   67                    $propertiesFile = $a_import_dirname . 
"/properties.xml";
 
   68                    $xml = file_get_contents($propertiesFile);
 
   71                        $use_internal_errors = libxml_use_internal_errors(
true);
 
   72                        $xmlRoot = simplexml_load_string(trim(
$xml));
 
   73                        libxml_use_internal_errors($use_internal_errors);
 
   74                        if (!$xmlRoot instanceof SimpleXMLElement) {
 
   75                            $ilLog->write(
'XML for SCORM Import is: ' . 
$xml . $xmlRoot);
 
   79                        foreach ($this->dataset->properties as $key => $value) {
 
   80                            $this->moduleProperties[$key] = $xmlRoot->$key;
 
   82                        $this->moduleProperties[
"Title"] = $xmlRoot->Title;
 
   83                        $this->moduleProperties[
"Description"] = $xmlRoot->Description;
 
   85                        foreach ($this->moduleProperties as $key => $xmlRoot) {
 
   86                            $xmlRootValue = $xmlRoot->__toString();
 
   87                            $filteredValue = preg_replace(
'%\s%', 
'', $xmlRootValue);
 
   91                        if ($a_id != 
null && $new_id = $a_mapping->getMapping(
'Services/Container', 
'objs', $a_id)) {
 
   92                            $this->dataset->writeData(
"sahs", 
"5.1.0", $newObj->getId(), $this->moduleProperties);
 
   94                            $newObj->createReference();
 
   96                            $scormFile = 
"content.zip";
 
   97                            $scormFilePath = $a_import_dirname . 
"/" . $scormFile;
 
   98                            $targetPath = $newObj->getDataDirectory() . 
"/" . $scormFile;
 
   99                            $file_path = $targetPath;
 
  108                            $newId = $newObj->getRefId();
 
  111                            $subType = $this->moduleProperties[
"SubType"];
 
  112                            if ($subType == 
"scorm") {
 
  113                                include_once(
"./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php");
 
  116                                include_once(
"./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
 
  119                            $title = $newObj->readObject();
 
  121                            $newObj->setLearningProgressSettingsAtUpload();
 
  127                        $ilLog->write(
"error parsing xml file for scorm import");
 
  131                    $ilLog->write(
"error reading manifest file");
 
  134                $ilLog->write(
"error no manifest file found");
 
  137            $ilLog->write(
"error file lost while importing");
 
  145        $this->dataset->writeData($a_entity, $a_version, $a_id, $this->moduleProperties);
 
  160        if (is_int(strpos($a_xml, 
"<Editable>1</Editable>"))) {
 
  162            include_once(
"./Modules/Scorm2004/classes/class.ilScorm2004DataSet.php");
 
  164            $dataset->setDSPrefix(
"ds");
 
  167            include_once(
"./Services/DataSet/classes/class.ilDataSetImportParser.php");
 
An exception for terminatinating execution or to throw for unit testing.
Manifest parser for ILIAS standard export files.
static rename($a_source, $a_target)
Rename a file.
Class ilObjSCORM2004LearningModule.
Class ilObjSCORMLearningModule.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
importXmlRepresentation($a_entity, $a_id, $a_import_dirname, $a_mapping)
Import XML.
handleEditableLmXml($a_entity, $a_id, $a_xml, $a_mapping)
Handle editable (authoring) scorm lms.
__construct()
Constructor.
writeData($a_entity, $a_version, $a_id)
static unzip(string $path_to_zip_file, bool $overwrite_existing=false, bool $unpack_flat=false)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
getSchemaVersion()
Get schema version.
getImportDirectory()
Get import directory.