76 : void {
78
80
81 $xml_directory = $a_xml;
82 $new_object = null;
83
85 $this->df
86 ->ok('Parsing started')
87 ->then(
89 &$new_object,
90 &$xml_directory,
91 $a_id,
92 $a_mapping
93 ): ?\
ILIAS\Data\Result {
94 if ($a_id !== '' &&
95 $a_mapping !== null &&
96 ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id))) {
97 $new_object = ilObjectFactory::getInstanceByObjId((int) $new_id, false);
98 $xml_directory = $this->getImportDirectory();
99 }
100
101 return $this->df->ok($xml_directory);
102 }
103 )
104 ->then(
function (
string $xml_directory): ?\
ILIAS\Data\Result {
105 if (!is_dir($xml_directory)) {
106 return $this->df->error(
107 sprintf('Directory lost while importing: %s', $xml_directory)
108 );
109 }
110
111 return null;
112 })
113 ->then(
function (
string $xml_directory): ?\
ILIAS\Data\Result {
114 $manifest_file = $xml_directory . '/manifest.xml';
115 if (!file_exists($manifest_file)) {
116 return $this->df->error(
117 sprintf(
118 'No manifest file found in import directory "%s": %s',
119 $xml_directory,
120 $manifest_file
121 )
122 );
123 }
124
125 return $this->df->ok($manifest_file);
126 })
127 ->then(
function (
string $manifest_file): ?\
ILIAS\Data\Result {
128 $manifest_file_content = file_get_contents($manifest_file);
129 if (!is_string($manifest_file_content) || $manifest_file_content === '') {
130 return $this->df->error(
131 sprintf(
132 'Could not read content from manifest file: %s',
133 $manifest_file
134 )
135 );
136 }
137
138 return $this->df->ok($manifest_file_content);
139 })
140 ->then(
function (
string $manifest_file_content) use ($xml_directory): ?\
ILIAS\Data\Result {
141 $properties_file = $xml_directory . '/properties.xml';
142 $properties_file_content = file_get_contents($properties_file);
143 if (!is_string($properties_file_content) || $properties_file_content === '') {
144 return $this->df->error(
145 sprintf(
146 'Could not read file: %s',
147 $properties_file
148 )
149 );
150 }
151
152 return $this->df->ok($properties_file_content);
153 })
154 ->then(
function (
string $properties_file_content): ?\
ILIAS\Data\Result {
156 })
157 ->then(
158 function (SimpleXMLElement $properties_xml_doc): ?\
ILIAS\Data\Result {
160 foreach ($this->dataset->properties as
$key => $value) {
161 $this->module_properties[
$key] = $properties_xml_doc->{
$key};
162 }
163
164 $this->module_properties['Title'] = $properties_xml_doc->Title;
165 $this->module_properties['Description'] = $properties_xml_doc->Description;
166
167 foreach ($this->module_properties as
$key => $property_node) {
168 $property_value = $property_node->__toString();
169 $filteredValue = preg_replace('%\s%', '', $property_value);
171 }
172
173 return $this->df->ok($this->module_properties);
174 } catch (Exception $exception) {
175 return $this->df->error($exception);
176 }
177 }
179 $xml_directory,
180 $a_id,
181 $a_mapping,
182 $new_object
183 ): ?\
ILIAS\Data\Result {
185 $a_mapping !== null &&
186 ($new_id = $a_mapping->getMapping(
187 'Services/Container',
188 'objs',
189 $a_id
190 ))) {
191 $this->dataset->writeData(
192 'sahs',
193 '5.1.0',
194 $new_object->getId(),
195 $this->module_properties
196 );
197
198 $new_object->createReference();
199
200 $scormFile = 'content.zip';
201 $scormFilePath = $xml_directory . '/' . $scormFile;
202 $targetPath = $new_object->getDataDirectory() . '/' . $scormFile;
203 $file_path = $targetPath;
204
207 unlink($file_path);
209
210 $new_ref_id = $new_object->getRefId();
212 if ($subType === 'scorm') {
214 } else {
216 }
217
218 $title = $new_object->readObject();
219 $new_object->setLearningProgressSettingsAtUpload();
220 }
221
222 return null;
223 })
224 );
225 }
static unzip(string $path_to_zip_file, bool $overwrite_existing=false, bool $unpack_flat=false)
static rename(string $a_source, string $a_target)
static renameExecutables(string $a_dir)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
publishResult(\ILIAS\Data\Result $result)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
return['3gp', '7z', 'ai', 'aif', 'aifc', 'aiff', 'au', 'arw', 'avi', 'backup', 'bak', 'bas', 'bpmn', 'bpmn2', 'bmp', 'bib', 'bibtex', 'bz', 'bz2', 'c', 'c++', 'cc', 'cct', 'cdf', 'cer', 'class', 'cls', 'conf', 'cpp', 'crt', 'crs', 'crw', 'cr2', 'css', 'cst', 'csv', 'cur', 'db', 'dcr', 'des', 'dng', 'doc', 'docx', 'dot', 'dotx', 'dtd', 'dvi', 'el', 'eps', 'epub', 'f', 'f77', 'f90', 'flv', 'for', 'g3', 'gif', 'gl', 'gan', 'ggb', 'gsd', 'gsm', 'gtar', 'gz', 'gzip', 'h', 'hpp', 'htm', 'html', 'htmls', 'ibooks', 'ico', 'ics', 'ini', 'ipynb', 'java', 'jbf', 'jpeg', 'jpg', 'js', 'jsf', 'jso', 'json', 'latex', 'lang', 'less', 'log', 'lsp', 'ltx', 'm1v', 'm2a', 'm2v', 'm3u', 'm4a', 'm4v', 'markdown', 'm', 'mat', 'md', 'mdl', 'mdown', 'mid', 'min', 'midi', 'mobi', 'mod', 'mov', 'movie', 'mp2', 'mp3', 'mp4', 'mpa', 'mpeg', 'mpg', 'mph', 'mpga', 'mpp', 'mpt', 'mpv', 'mpx', 'mv', 'mw', 'mv4', 'nb', 'nbp', 'nef', 'nif', 'niff', 'obj', 'obm', 'odt', 'ods', 'odp', 'odg', 'odf', 'oga', 'ogg', 'ogv', 'old', 'p', 'pas', 'pbm', 'pcl', 'pct', 'pcx', 'pdf', 'pgm', 'pic', 'pict', 'png', 'por', 'pov', 'project', 'properties', 'ppa', 'ppm', 'pps', 'ppsx', 'ppt', 'pptx', 'ppz', 'ps', 'psd', 'pwz', 'qt', 'qtc', 'qti', 'qtif', 'r', 'ra', 'ram', 'rar', 'rast', 'rda', 'rev', 'rexx', 'ris', 'rf', 'rgb', 'rm', 'rmd', 'rmi', 'rmm', 'rmp', 'rt', 'rtf', 'rtx', 'rv', 's', 's3m', 'sav', 'sbs', 'sec', 'sdml', 'sgm', 'sgml', 'smi', 'smil', 'srt', 'sps', 'spv', 'stl', 'svg', 'swa', 'swf', 'swz', 'tar', 'tex', 'texi', 'texinfo', 'text', 'tgz', 'tif', 'tiff', 'ttf', 'txt', 'tmp', 'uvproj', 'vdf', 'vimeo', 'viv', 'vivo', 'vrml', 'vsdx', 'wav', 'webm', 'wmv', 'wmx', 'wmz', 'woff', 'wwd', 'xhtml', 'xif', 'xls', 'xlsx', 'xmind', 'xml', 'xsl', 'xsd', 'zip']
Class ChatMainBarProvider \MainMenu\Provider.