ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilScorm2004DataSet Class Reference
+ Inheritance diagram for ilScorm2004DataSet:
+ Collaboration diagram for ilScorm2004DataSet:

Public Member Functions

 getSupportedVersions ()
 Note: this is currently used for SCORM authoring lms. More...
 
 getXmlNamespace ($a_entity, $a_schema_version)
 Get xml namespace. More...
 
 readData ($a_entity, $a_version, $a_ids, $a_field="")
 Read data. More...
 
 getXmlRecord ($a_entity, $a_version, $a_set)
 Get xml record. More...
 
 afterXmlRecordWriting ($a_entity, $a_schema_version, $d)
 
 importRecord ($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
 Import record. More...
 
- Public Member Functions inherited from ilDataSet
 __construct ()
 Constructor. More...
 
 init ($a_entity, $a_schema_version)
 Init. More...
 
 getSupportedVersions ()
 Get supported version. More...
 
 readData ($a_entity, $a_version, $a_ids)
 Read data from DB. More...
 
 setExportDirectories ($a_relative, $a_absolute)
 Set export directories. More...
 
 setImportDirectory ($a_val)
 Set import directory. More...
 
 getImportDirectory ()
 Get import directory. More...
 
 setDSPrefix ($a_val)
 Set XML dataset namespace prefix. More...
 
 getDSPrefix ()
 Get XML dataset namespace prefix. More...
 
 getDSPrefixString ()
 
 getDirectDataFromQuery ($a_query, $a_convert_to_leading_upper=true, $a_set=true)
 Get data from query.This is a standard procedure, all db field names are directly mapped to abstract fields. More...
 
 convertToLeadingUpper ($a_str)
 Make xyz_abc a XyzAbc string. More...
 
 getJsonRepresentation ()
 Get json representation. More...
 
 getXmlRepresentation ( $a_entity, $a_schema_version, $a_ids, $a_field="", $a_omit_header=false, $a_omit_types=false)
 Get xml representation <dataset install_id="123" install_url="..."> <types entity="table_name" version="4.0.1"> <ftype name="field_1" type="text"> <ftype name="field_2" type="date"> <ftype name="field_3" type="integer"> </types> <types ...> ... More...
 
 addRecordsXml ($a_writer, $a_prefixes, $a_entity, $a_schema_version, $a_ids, $a_field="")
 Add records xml. More...
 
 afterXmlRecordWriting ($a_entity, $a_version, $a_set)
 After xml record writing hook record. More...
 
 getNamespaces (&$namespaces, $a_entity, $a_schema_version)
 Get xml namespaces. More...
 
 getXmlRecord ($a_entity, $a_version, $a_set)
 Get xml record for version. More...
 
 getJsonRecord ($a_set)
 Get json record for version. More...
 
 getXmlTypes ($a_entity, $a_version)
 Get xml types. More...
 
 getJsonTypes ($a_entity, $a_version)
 Get json types. More...
 
 getXMLEntityName ($a_entity, $a_version)
 Get entity name for xml (may be overwritten) More...
 
 getXMLEntityTag ($a_entity, $a_schema_version)
 Get entity tag. More...
 
 getJsonEntityName ($a_entity, $a_version)
 Get entity name for json (may be overwritten) More...
 
 setImport ($a_val)
 Set import object. More...
 
 getImport ()
 Get import object. More...
 
 setCurrentInstallationId ($a_val)
 Set current installation id. More...
 
 getCurrentInstallationId ()
 Get current installation id. More...
 

Protected Member Functions

 getTypes ($a_entity, $a_version)
 Get field types for entity. More...
 
 getDependencies ($a_entity, $a_version, $a_rec, $a_ids)
 Determine the dependent sets of data. More...
 
- Protected Member Functions inherited from ilDataSet
 getTypes ($a_entity, $a_version)
 Get (abstract) types for (abstract) field names. More...
 
 getXmlNamespace ($a_entity, $a_schema_version)
 Get xml namespace. More...
 
 createObjectExportId ($a_type, $a_id)
 Build ilias export id. More...
 
 parseObjectExportId ($a_id, $a_fallback_id=null)
 Parse export id. More...
 

Protected Attributes

 $temp_dir = array()
 
- Protected Attributes inherited from ilDataSet
 $current_installation_id = ""
 
 $db
 
 $ds_log
 

Additional Inherited Members

- Data Fields inherited from ilDataSet
 $dircnt
 
const EXPORT_NO_INST_ID = 1
 
const EXPORT_ID_ILIAS_LOCAL = 2
 
const EXPORT_ID_ILIAS_LOCAL_INVALID = 3
 
const EXPORT_ID_ILIAS_REMOTE = 4
 
const EXPORT_ID_ILIAS_REMOTE_INVALID = 5
 
const EXPORT_ID = 6
 
const EXPORT_ID_INVALID = 7
 

Detailed Description

Definition at line 5 of file class.ilScorm2004DataSet.php.

Member Function Documentation

◆ afterXmlRecordWriting()

ilScorm2004DataSet::afterXmlRecordWriting (   $a_entity,
  $a_schema_version,
  $d 
)
Parameters

Definition at line 142 of file class.ilScorm2004DataSet.php.

References $d, and ilUtil\delDir().

143  {
144  if ($a_entity == "sahs") {
145  // delete our temp dir
146  if (isset($this->temp_dir[$d["Id"]]) && is_dir($this->temp_dir[$d["Id"]])) {
147  ilUtil::delDir($this->temp_dir[$d["Id"]]);
148  }
149  }
150  }
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
+ Here is the call graph for this function:

◆ getDependencies()

ilScorm2004DataSet::getDependencies (   $a_entity,
  $a_version,
  $a_rec,
  $a_ids 
)
protected

Determine the dependent sets of data.

Definition at line 94 of file class.ilScorm2004DataSet.php.

References array.

95  {
96  switch ($a_entity) {
97  case "sahs":
98  return array();
99 
100  }
101  return false;
102  }
Create styles array
The data for the language used.

◆ getSupportedVersions()

ilScorm2004DataSet::getSupportedVersions ( )

Note: this is currently used for SCORM authoring lms.

Get supported versions

Returns
string[]

Definition at line 16 of file class.ilScorm2004DataSet.php.

References array.

17  {
18  return array("5.1.0");
19  }
Create styles array
The data for the language used.

◆ getTypes()

ilScorm2004DataSet::getTypes (   $a_entity,
  $a_version 
)
protected

Get field types for entity.

Parameters

Definition at line 38 of file class.ilScorm2004DataSet.php.

References array.

39  {
40  if ($a_entity == "sahs") {
41  switch ($a_version) {
42  case "5.1.0":
43  return array(
44  "Id" => "integer",
45  "Title" => "text",
46  "Description" => "text",
47  "Editable" => "integer",
48  "Dir" => "directory",
49  "File" => "text"
50  );
51  }
52  }
53  }
Create styles array
The data for the language used.

◆ getXmlNamespace()

ilScorm2004DataSet::getXmlNamespace (   $a_entity,
  $a_schema_version 
)

Get xml namespace.

Parameters

Definition at line 27 of file class.ilScorm2004DataSet.php.

28  {
29  return "http://www.ilias.de/xml/Modules/Scorm2004/" . $a_entity;
30  }

◆ getXmlRecord()

ilScorm2004DataSet::getXmlRecord (   $a_entity,
  $a_version,
  $a_set 
)

Get xml record.

Parameters

Definition at line 110 of file class.ilScorm2004DataSet.php.

References ilUtil\ilTempnam(), ilUtil\makeDir(), and ilFileUtils\rename().

111  {
112  if ($a_entity == "sahs") {
113  // build traditional author export file
114  include_once './Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php';
115  $lm = new ilObjSCORM2004LearningModule($a_set["Id"], false);
116  $export = new ilScorm2004Export($lm, 'SCORM 2004 3rd');
117  $zip = $export->buildExportFile();
118 
119  // move it to temp dir
120  $tmpdir = ilUtil::ilTempnam();
121  ilUtil::makeDir($tmpdir);
122  $exp_temp = $tmpdir . DIRECTORY_SEPARATOR . basename($zip);
123  ilFileUtils::rename($zip, $exp_temp);
124 
125  $this->temp_dir[$a_set["Id"]] = $tmpdir;
126 
127  // include temp dir
128  $a_set["Dir"] = $tmpdir;
129  $a_set["File"] = basename($zip);
130  }
131 
132  return $a_set;
133  }
static rename($a_source, $a_target)
Rename a file.
Export class for SCORM 2004 object.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static ilTempnam($a_temp_path=null)
Create a temporary file in an ILIAS writable directory.
Class ilObjSCORM2004LearningModule.
+ Here is the call graph for this function:

◆ importRecord()

ilScorm2004DataSet::importRecord (   $a_entity,
  $a_types,
  $a_rec,
  $a_mapping,
  $a_schema_version 
)

Import record.

Parameters
$a_entity
$a_types
$a_rec
$a_mapping
$a_schema_version

Definition at line 161 of file class.ilScorm2004DataSet.php.

References $title, ilObject\_writeTitle(), ilDataSet\getImportDirectory(), ilFileUtils\rename(), ilUtil\renameExecutables(), and ilUtil\unzip().

162  {
163  switch ($a_entity) {
164  case "sahs":
165  $new_obj_id = $a_mapping->getMapping("Services/Container", "objs", $a_rec["Id"]);
166  include_once("./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
167  $lm = new ilObjSCORM2004LearningModule($new_obj_id, false);
168 
169  $lm->setEditable($a_rec["Editable"]);
170  $lm->setImportSequencing(false);
171  $lm->setSequencingExpertMode(false);
172  $lm->setSubType("scorm2004");
173 
174  $dir = str_replace("..", "", $a_rec["Dir"]);
175  if ($dir != "" && $this->getImportDirectory() != "") {
176  $source_dir = $this->getImportDirectory() . "/" . $dir;
177  $file_path = $lm->getDataDirectory() . "/" . $a_rec["File"];
178  ilFileUtils::rename($source_dir . "/" . $a_rec["File"], $file_path);
179 
180  ilUtil::unzip($file_path);
181  ilUtil::renameExecutables($lm->getDataDirectory());
182  $title = $lm->readObject();
183  if ($title != "") {
184  ilObject::_writeTitle($lm->getId(), $title);
185  }
186 
187  $lm->setLearningProgressSettingsAtUpload();
188  $lm->update();
189  }
190  break;
191 
192  }
193  }
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
static _writeTitle($a_obj_id, $a_title)
write title to db (static)
getImportDirectory()
Get import directory.
static rename($a_source, $a_target)
Rename a file.
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
Class ilObjSCORM2004LearningModule.
+ Here is the call graph for this function:

◆ readData()

ilScorm2004DataSet::readData (   $a_entity,
  $a_version,
  $a_ids,
  $a_field = "" 
)

Read data.

Parameters

Definition at line 61 of file class.ilScorm2004DataSet.php.

References ilDataSet\$db, $ilDB, ilObject\_lookupDescription(), ilObject\_lookupTitle(), ilObject\_lookupType(), array, and data.

62  {
63  $ilDB = $this->db;
64 
65  if (!is_array($a_ids)) {
66  $a_ids = array($a_ids);
67  }
68 
69  // sahs
70  if ($a_entity == "sahs") {
71  $this->data = array();
72 
73  switch ($a_version) {
74  case "5.1.0":
75  foreach ($a_ids as $sahs_id) {
76  if (ilObject::_lookupType($sahs_id) == "sahs") {
77  $this->data[] = array("Id" => $sahs_id,
78  "Title" => ilObject::_lookupTitle($sahs_id),
79  "Description" => ilObject::_lookupDescription($sahs_id),
80  "Editable" => 1
81  );
82  }
83  }
84  break;
85 
86  }
87  }
88  }
Add some data
static _lookupTitle($a_id)
lookup object title
static _lookupDescription($a_id)
lookup object description
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
global $ilDB
+ Here is the call graph for this function:

Field Documentation

◆ $temp_dir

ilScorm2004DataSet::$temp_dir = array()
protected

Definition at line 7 of file class.ilScorm2004DataSet.php.


The documentation for this class was generated from the following file: