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 "Online" => [
"db_col" =>
"c_online",
"db_type" =>
"text"],
41 "OpenMode" => [
"db_col" =>
"open_mode",
"db_type" =>
"integer"],
42 "Sequencing" => [
"db_col" =>
"sequencing",
"db_type" =>
"text"],
43 "SequencingExpertMode" => [
"db_col" =>
"seq_exp_mode",
"db_type" =>
"integer"],
44 "Session" => [
"db_col" =>
"unlimited_session",
"db_type" =>
"text"],
45 "StyleSheetId" => [
"db_col" =>
"stylesheet",
"db_type" =>
"integer"],
46 "SubType" => [
"db_col" =>
"c_type",
"db_type" =>
"text"],
47 "Time_from_lms" => [
"db_col" =>
"time_from_lms",
"db_type" =>
"text"],
48 "Tries" => [
"db_col" =>
"question_tries",
"db_type" =>
"integer"],
49 "Width" => [
"db_col" =>
"width",
"db_type" =>
"integer"],
50 "IdSetting" => [
"db_col" =>
"id_setting",
"db_type" =>
"integer"],
51 "NameSetting" => [
"db_col" =>
"name_setting",
"db_type" =>
"integer"]
54 $this->element_db_mapping = [];
56 $this->element_db_mapping [$value[
"db_col"]] =
$key;
65 public function readData($a_entity, $a_version, $a_id, $a_field =
"")
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");
83 $query =
"SELECT title,description FROM object_data";
84 $query .=
" WHERE obj_id=" . $ilDB->quote($obj_id,
"integer");
101 if (count(
$data) > 0) {
104 if (
$key ==
"Id" ||
$key ==
"title"||
$key ==
"description") {
116 if (count(
$data[$key]) > 0) {
122 $conditions [
"id"] = [
"integer", $a_id];
123 $ilDB->update($this->db_table,
$columns, $conditions);
127 $od_table =
"object_data";
129 "Title" => [
"db_col" =>
"title",
"db_type" =>
"text"],
130 "Description" => [
"db_col" =>
"description",
"db_type" =>
"text"]
132 foreach ($od_properties as
$key => $value) {
134 if (count(
$data[$key]) > 0) {
135 $od_columns [$value[
"db_col"]] = [$value[
"db_type"],
$data[
$key][0]];
139 if (count($od_columns) > 0) {
140 $od_conditions [
"obj_id"] = [
"integer", $a_id];
141 $ilDB->update(
"object_data", $od_columns, $od_conditions);
145 $ilLog->write(
"no module properties for imported object");
153 if ($db_col_name ==
"title") {
156 if ($db_col_name ==
"description") {
157 return "Description";
159 return $this->element_db_mapping[$db_col_name];
175 $GLOBALS[
"ilLog"]->write(json_encode($this->
getTypes(
"sahs",
"5.1.0"), JSON_PRETTY_PRINT));
179 $this->
readData($a_entity, $a_schema_version, $a_ids, $a_field =
"");
182 require_once(
"./Services/Export/classes/class.ilExport.php");
187 require_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
189 if (!$a_omit_header) {
190 $writer->xmlHeader();
193 $atts =
array(
"InstallationId" => IL_INST_ID,
194 "InstallationUrl" => ILIAS_HTTP_PATH,
"TopEntity" => $a_entity);
196 $writer->appendXML(
"\n");
198 $writer->appendXML(
"\n");
200 foreach ($this->
data as
$key => $value) {
202 $writer->appendXML(
"\n");
206 $baseFileName =
"sahs_" .
$id;
207 $scormBasePath=$exportDir .
"/" . $baseFileName;
208 if (!file_exists($exportDir)) {
209 mkdir($exportDir, 0755,
true);
213 $scormFilePath = $scormBasePath .
".zip";
216 $writer->appendXML(
"\n");
218 $xml = $writer->xmlDumpMem(
false);
219 $baseExportName =
time() .
"__" . IL_INST_ID .
"__" . $baseFileName;
220 $xmlFilePath = $exportDir .
"/" . $baseExportName .
".xml";
222 if (!file_exists($xmlFilePath)) {
223 $xmlFile = fopen($xmlFilePath,
"w");
224 fwrite($xmlFile,
$xml);
231 $metaDataFilePath = $exportDir .
"/" . $baseExportName .
"_metadata.xml";
232 if (!file_exists($metaDataFilePath)) {
233 $metaDataFile = fopen($metaDataFilePath,
"w");
234 fwrite($metaDataFile, $metaData);
235 fclose($metaDataFile);
240 $manWriter->xmlHeader();
241 $manWriter->appendXML(
"\n<content>\n");
244 "scormFile" =>
"content.zip",
245 "properties" =>
"properties.xml",
246 "metadata" =>
"metadata.xml" 249 $manWriter->xmlElement(
$key, null, $value,
true,
true);
250 $manWriter->appendXML(
"\n");
253 $manWriter->appendXML(
"</content>\n");
254 $manifest = $manWriter->xmlDumpMem(
false);
256 $manifestFilePath = $exportDir .
"/" . $baseExportName .
"_manifest.xml";
257 if (!file_exists($manifestFilePath)) {
258 $manifestFile = fopen($manifestFilePath,
"w");
259 fwrite($manifestFile, $manifest);
260 fclose($manifestFile);
263 $zArchive =
new zipArchive();
264 $fileName = $exportDir .
"/" . $baseExportName .
".zip";
266 if ($zArchive->open($fileName, ZipArchive::CREATE)!==
true) {
267 exit(
"cannot open <$fileName>\n");
271 $zArchive->addFile($xmlFilePath, $baseExportName .
'/properties.xml');
272 $zArchive->addFile($scormFilePath, $baseExportName .
'/content.zip');
273 $zArchive->addFile($manifestFilePath, $baseExportName .
'/' .
"manifest.xml");
274 $zArchive->addFile($metaDataFilePath, $baseExportName .
'/' .
"metadata.xml");
277 unlink($xmlFilePath);
278 unlink($scormFilePath);
279 unlink($manifestFilePath);
280 unlink($metaDataFilePath);
287 require_once(
"Services/MetaData/classes/class.ilMD2XML.php");
289 $md2xml->startExport();
290 $xml = $md2xml->getXML();
303 if ($a_entity ==
"sahs") {
304 switch ($a_version) {
308 $types[
$key] = $value[
"db_type"];
323 return "http://www.ilias.de/xml/Modules/ScormAicc/" . $a_entity;
readData($a_entity, $a_version, $a_id, $a_field="")
Read data.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
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
Create styles array
The data for the language used.
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.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
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
getTypes($a_entity, $a_version)
Get field types for entity.