3 include_once(
"./Services/DataSet/classes/class.ilDataSet.php");
9 $this->db_table =
"sahs_lm";
12 "Id" => [
"db_col" =>
"id",
"db_type" =>
"integer"],
14 "APIAdapterName" => [
"db_col" =>
"api_adapter",
"db_type" =>
"text"],
15 "APIFunctionsPrefix" => [
"db_col" =>
"api_func_prefix",
"db_type" =>
"text"],
16 "AssignedGlossary" => [
"db_col" =>
"glossary",
"db_type" =>
"integer"],
17 "AutoContinue" => [
"db_col" =>
"auto_continue",
"db_type" =>
"text"],
18 "AutoReviewChar" => [
"db_col" =>
"auto_review",
"db_type" =>
"text"],
19 "AutoSuspend" => [
"db_col" =>
"auto_suspend",
"db_type" =>
"text"],
20 "Auto_last_visited" => [
"db_col" =>
"auto_last_visited",
"db_type" =>
"text"],
21 "Check_values" => [
"db_col" =>
"check_values",
"db_type" =>
"text"],
22 "Comments" => [
"db_col" =>
"comments",
"db_type" =>
"text"],
23 "CreditMode" => [
"db_col" =>
"credit",
"db_type" =>
"text"],
24 "Debug" => [
"db_col" =>
"debug",
"db_type" =>
"text"],
25 "DebugPw" => [
"db_col" =>
"debugpw",
"db_type" =>
"text"],
26 "DefaultLessonMode" => [
"db_col" =>
"default_lesson_mode",
"db_type" =>
"text"],
27 "Editable" => [
"db_col" =>
"editable",
"db_type" =>
"integer"],
28 "Fourth_edition" => [
"db_col" =>
"fourth_edition",
"db_type" =>
"text"],
29 "Height" => [
"db_col" =>
"height",
"db_type" =>
"integer"],
30 "HideNavig" => [
"db_col" =>
"hide_navig",
"db_type" =>
"text"],
31 "Ie_force_render" => [
"db_col" =>
"ie_force_render",
"db_type" =>
"text"],
32 "Interactions" => [
"db_col" =>
"interactions",
"db_type" =>
"text"],
33 "Localization" => [
"db_col" =>
"localization",
"db_type" =>
"text"],
34 "MasteryScore" => [
"db_col" =>
"mastery_score",
"db_type" =>
"integer"],
35 "MaxAttempt" => [
"db_col" =>
"max_attempt",
"db_type" =>
"integer"],
36 "ModuleVersion" => [
"db_col" =>
"module_version",
"db_type" =>
"integer"],
37 "NoMenu" => [
"db_col" =>
"no_menu",
"db_type" =>
"text"],
38 "Objectives" => [
"db_col" =>
"objectives",
"db_type" =>
"text"],
39 "OfflineMode" => [
"db_col" =>
"offline_mode",
"db_type" =>
"text"],
40 "OpenMode" => [
"db_col" =>
"open_mode",
"db_type" =>
"integer"],
41 "Sequencing" => [
"db_col" =>
"sequencing",
"db_type" =>
"text"],
42 "SequencingExpertMode" => [
"db_col" =>
"seq_exp_mode",
"db_type" =>
"integer"],
43 "Session" => [
"db_col" =>
"unlimited_session",
"db_type" =>
"text"],
44 "StyleSheetId" => [
"db_col" =>
"stylesheet",
"db_type" =>
"integer"],
45 "SubType" => [
"db_col" =>
"c_type",
"db_type" =>
"text"],
46 "Time_from_lms" => [
"db_col" =>
"time_from_lms",
"db_type" =>
"text"],
47 "Tries" => [
"db_col" =>
"question_tries",
"db_type" =>
"integer"],
48 "Width" => [
"db_col" =>
"width",
"db_type" =>
"integer"],
49 "IdSetting" => [
"db_col" =>
"id_setting",
"db_type" =>
"integer"],
50 "NameSetting" => [
"db_col" =>
"name_setting",
"db_type" =>
"integer"]
53 $this->element_db_mapping = [];
54 foreach ($this->properties as
$key => $value) {
55 $this->element_db_mapping [$value[
"db_col"]] =
$key;
64 public function readData($a_entity, $a_version, $a_id, $a_field =
"")
71 foreach ($this->properties as $property) {
72 array_push(
$columns, $property[
"db_col"]);
75 $query =
"SELECT " . implode(
",",
$columns) .
" FROM " . $this->db_table;
76 $query .=
" WHERE id=" .
$ilDB->quote($obj_id,
"integer");
80 $this->
data = $dataset;
83 $query =
"SELECT title,description FROM object_data";
84 $query .=
" WHERE obj_id=" .
$ilDB->quote($obj_id,
"integer");
87 $this->
data [
"title"] = $dataset[
"title"];
88 $this->
data [
"description"] = $dataset[
"description"];
101 $ilDB = $DIC[
'ilDB'];
103 if (count(
$data) > 0) {
105 foreach ($this->properties as
$key => $value) {
106 if (
$key ==
"Id" ||
$key ==
"title" ||
$key ==
"description") {
118 if (count(
$data[$key]) > 0) {
124 $conditions [
"id"] = [
"integer", $a_id];
129 $od_table =
"object_data";
131 "Title" => [
"db_col" =>
"title",
"db_type" =>
"text"],
132 "Description" => [
"db_col" =>
"description",
"db_type" =>
"text"]
134 foreach ($od_properties as
$key => $value) {
136 if (count(
$data[$key]) > 0) {
137 $od_columns [$value[
"db_col"]] = [$value[
"db_type"],
$data[
$key][0]];
141 if (count($od_columns) > 0) {
142 $od_conditions [
"obj_id"] = [
"integer", $a_id];
143 $ilDB->update(
"object_data", $od_columns, $od_conditions);
147 $ilLog->write(
"no module properties for imported object");
155 if ($db_col_name ==
"title") {
158 if ($db_col_name ==
"description") {
159 return "Description";
161 return $this->element_db_mapping[$db_col_name];
177 $GLOBALS[
'DIC'][
"ilLog"]->write(json_encode($this->
getTypes(
"sahs",
"5.1.0"), JSON_PRETTY_PRINT));
181 $this->
readData($a_entity, $a_schema_version, $a_ids, $a_field =
"");
184 require_once(
"./Services/Export/classes/class.ilExport.php");
189 require_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
191 if (!$a_omit_header) {
192 $writer->xmlHeader();
195 $atts = array(
"InstallationId" => IL_INST_ID,
196 "InstallationUrl" => ILIAS_HTTP_PATH,
"TopEntity" => $a_entity);
198 $writer->appendXML(
"\n");
200 $writer->appendXML(
"\n");
202 foreach ($this->
data as
$key => $value) {
204 $writer->appendXML(
"\n");
208 $baseFileName =
"sahs_" .
$id;
209 $scormBasePath = $exportDir .
"/" . $baseFileName;
210 if (!file_exists($exportDir)) {
211 mkdir($exportDir, 0755,
true);
215 $scormFilePath = $scormBasePath .
".zip";
218 $writer->appendXML(
"\n");
220 $xml = $writer->xmlDumpMem(
false);
221 $baseExportName = time() .
"__" . IL_INST_ID .
"__" . $baseFileName;
222 $xmlFilePath = $exportDir .
"/" . $baseExportName .
".xml";
224 if (!file_exists($xmlFilePath)) {
225 $xmlFile =
fopen($xmlFilePath,
"w");
226 fwrite($xmlFile,
$xml);
233 $metaDataFilePath = $exportDir .
"/" . $baseExportName .
"_metadata.xml";
234 if (!file_exists($metaDataFilePath)) {
235 $metaDataFile =
fopen($metaDataFilePath,
"w");
237 fclose($metaDataFile);
242 $manWriter->xmlHeader();
243 $manWriter->appendXML(
"\n<content>\n");
246 "scormFile" =>
"content.zip",
247 "properties" =>
"properties.xml",
248 "metadata" =>
"metadata.xml" 251 $manWriter->xmlElement(
$key, null, $value,
true,
true);
252 $manWriter->appendXML(
"\n");
255 $manWriter->appendXML(
"</content>\n");
256 $manifest = $manWriter->xmlDumpMem(
false);
258 $manifestFilePath = $exportDir .
"/" . $baseExportName .
"_manifest.xml";
259 if (!file_exists($manifestFilePath)) {
260 $manifestFile =
fopen($manifestFilePath,
"w");
261 fwrite($manifestFile, $manifest);
262 fclose($manifestFile);
265 $zArchive =
new zipArchive();
266 $fileName = $exportDir .
"/" . $baseExportName .
".zip";
268 if ($zArchive->open($fileName, ZipArchive::CREATE) !==
true) {
269 exit(
"cannot open <$fileName>\n");
273 $zArchive->addFile($xmlFilePath, $baseExportName .
'/properties.xml');
274 $zArchive->addFile($scormFilePath, $baseExportName .
'/content.zip');
275 $zArchive->addFile($manifestFilePath, $baseExportName .
'/' .
"manifest.xml");
276 $zArchive->addFile($metaDataFilePath, $baseExportName .
'/' .
"metadata.xml");
279 unlink($xmlFilePath);
280 unlink($scormFilePath);
281 unlink($manifestFilePath);
282 unlink($metaDataFilePath);
289 require_once(
"Services/MetaData/classes/class.ilMD2XML.php");
291 $md2xml->startExport();
292 $xml = $md2xml->getXML();
305 if ($a_entity ==
"sahs") {
306 switch ($a_version) {
309 foreach ($this->properties as
$key => $value) {
310 $types[
$key] = $value[
"db_type"];
325 return "http://www.ilias.de/xml/Modules/ScormAicc/" . $a_entity;
readData($a_entity, $a_version, $a_id, $a_field="")
Read data.
if(!array_key_exists('StateId', $_REQUEST)) $id
getExtendedXmlRepresentation($a_entity, $a_schema_version, $a_ids, $a_field="", $a_omit_header=false, $a_omit_types=false)
own getXmlRepresentation function to embed zipfile in xml
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
writeData($a_entity, $a_version, $a_id, $data)
Write properties for imported object (actually updates !!)
getElementNameByDbColumn($db_col_name)
static _getExportDirectory($a_obj_id, $a_type="xml", $a_obj_type="", $a_entity="")
Get export directory for an repository object.
A dataset contains in data in a common structure that can be shared and transformed for different pur...
getXmlNamespace($a_entity, $a_schema_version)
Get xml namespace.
static getWebspaceDir($mode="filesystem")
get webspace directory
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
getTypes($a_entity, $a_version)
Get field types for entity.