ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilObjectDataSet Class Reference

Object data set class. More...

+ Inheritance diagram for ilObjectDataSet:
+ Collaboration diagram for ilObjectDataSet:

Public Member Functions

 getSupportedVersions ()
 Get supported versions. More...
 
 getXmlNamespace ($a_entity, $a_schema_version)
 Get xml namespace. More...
 
 readData ($a_entity, $a_version, $a_ids, $a_field="")
 Read data. More...
 
 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...
 

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
 
- Protected Attributes inherited from ilDataSet
 $current_installation_id = ""
 
 $db
 
 $ds_log
 

Detailed Description

Object data set class.

This class implements the following entities:

  • transl_entry: data from object_translation
  • transl: data from obj_content_master_lang
Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 17 of file class.ilObjectDataSet.php.

Member Function Documentation

◆ getDependencies()

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

Determine the dependent sets of data.

Definition at line 164 of file class.ilObjectDataSet.php.

References array.

165  {
166  switch ($a_entity) {
167  case "transl":
168  return array(
169  "transl_entry" => array("ids" => $a_rec["ObjId"])
170  );
171  }
172 
173  return false;
174  }
Create styles array
The data for the language used.

◆ getSupportedVersions()

ilObjectDataSet::getSupportedVersions ( )

Get supported versions.

Parameters

Definition at line 25 of file class.ilObjectDataSet.php.

References array.

26  {
27  return array("4.4.0", "5.1.0", "5.2.0");
28  }
Create styles array
The data for the language used.

◆ getTypes()

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

Get field types for entity.

Parameters

Definition at line 47 of file class.ilObjectDataSet.php.

References array.

48  {
49  if ($a_entity == "transl_entry") {
50  switch ($a_version) {
51  case "4.4.0":
52  case "5.1.0":
53  case "5.2.0":
54  return array(
55  "ObjId" => "integer",
56  "Title" => "text",
57  "Description" => "text",
58  "LangCode" => "text",
59  "LangDefault" => "integer");
60  }
61  }
62  if ($a_entity == "transl") {
63  switch ($a_version) {
64  case "4.4.0":
65  case "5.1.0":
66  case "5.2.0":
67  return array(
68  "ObjId" => "integer",
69  "MasterLang" => "text");
70  }
71  }
72  if ($a_entity == "service_settings") {
73  switch ($a_version) {
74  case "5.1.0":
75  case "5.2.0":
76  return array(
77  "ObjId" => "integer",
78  "Setting" => "text",
79  "Value" => "text");
80  }
81  }
82  }
Create styles array
The data for the language used.

◆ getXmlNamespace()

ilObjectDataSet::getXmlNamespace (   $a_entity,
  $a_schema_version 
)

Get xml namespace.

Parameters

Definition at line 36 of file class.ilObjectDataSet.php.

37  {
38  return "http://www.ilias.de/xml/Services/Object/" . $a_entity;
39  }

◆ importRecord()

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

Import record.

Parameters

Definition at line 183 of file class.ilObjectDataSet.php.

References ilContainer\_writeContainerSetting(), array, ilObjectServiceSettingsGUI\AUTO_RATING_NEW_OBJECTS, ilObjectServiceSettingsGUI\CALENDAR_VISIBILITY, ilObjectServiceSettingsGUI\CUSTOM_METADATA, ilObjectTranslation\getInstance(), ilObjectServiceSettingsGUI\INFO_TAB_VISIBILITY, ilObjectServiceSettingsGUI\NEWS_VISIBILITY, ilObjectServiceSettingsGUI\TAG_CLOUD, ilObjectServiceSettingsGUI\TAXONOMIES, and ilObjectServiceSettingsGUI\USE_NEWS.

184  {
185  switch ($a_entity) {
186  case "transl_entry":
187  $new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_rec['ObjId']);
188  if (!$new_id) {
189  $new_id = $a_mapping->getMapping('Services/Object', 'obj', $a_rec['ObjId']);
190  }
191  if ($new_id > 0) {
192  include_once("./Services/Object/classes/class.ilObjectTranslation.php");
193  $transl = ilObjectTranslation::getInstance($new_id);
194  $transl->addLanguage($a_rec["LangCode"], $a_rec["Title"], $a_rec["Description"], $a_rec["LangDefault"], true);
195  $transl->save();
196  }
197  break;
198 
199  case "transl":
200  $new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_rec['ObjId']);
201  if (!$new_id) {
202  $new_id = $a_mapping->getMapping('Services/Object', 'obj', $a_rec['ObjId']);
203  }
204  if ($new_id > 0) {
205  include_once("./Services/Object/classes/class.ilObjectTranslation.php");
206  $transl = ilObjectTranslation::getInstance($new_id);
207  $transl->setMasterLanguage($a_rec["MasterLang"]);
208  $transl->save();
209  }
210  break;
211 
212  case "service_settings":
213  include_once("./Services/Object/classes/class.ilObjectServiceSettingsGUI.php");
214  include_once("./Services/Container/classes/class.ilContainer.php");
215 
216  // info, news, custom metadata, tags, taxonomies, auto rating (all stored in container settings)
217  $settings = array(
226  );
227  $new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_rec['ObjId']);
228  if (!$new_id) {
229  $new_id = $a_mapping->getMapping('Services/Object', 'objs', $a_rec['ObjId']);
230  }
231  if (!$new_id) {
232  $new_id = $a_mapping->getMapping('Services/Object', 'obj', $a_rec['ObjId']);
233  }
234  if ($new_id > 0) {
235  if (in_array($a_rec["Setting"], $settings)) {
236  ilContainer::_writeContainerSetting($new_id, $a_rec["Setting"], $a_rec["Value"]);
237  }
238  }
239  break;
240  }
241  }
Create styles array
The data for the language used.
static getInstance($a_obj_id)
Get instance.
static _writeContainerSetting($a_id, $a_keyword, $a_value)
+ Here is the call graph for this function:

◆ readData()

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

Read data.

Parameters

Definition at line 90 of file class.ilObjectDataSet.php.

References ilDataSet\$db, $id, $ilDB, $s, ilContainer\_lookupContainerSetting(), array, ilObjectServiceSettingsGUI\AUTO_RATING_NEW_OBJECTS, ilObjectServiceSettingsGUI\CALENDAR_VISIBILITY, ilObjectServiceSettingsGUI\CUSTOM_METADATA, data, ilDataSet\getDirectDataFromQuery(), ilObjectServiceSettingsGUI\INFO_TAB_VISIBILITY, ilObjectServiceSettingsGUI\NEWS_VISIBILITY, ilObjectServiceSettingsGUI\TAG_CLOUD, ilObjectServiceSettingsGUI\TAXONOMIES, and ilObjectServiceSettingsGUI\USE_NEWS.

91  {
92  $ilDB = $this->db;
93 
94  if (!is_array($a_ids)) {
95  $a_ids = array($a_ids);
96  }
97 
98  if ($a_entity == "transl_entry") {
99  switch ($a_version) {
100  case "4.4.0":
101  case "5.1.0":
102  case "5.2.0":
103  $this->getDirectDataFromQuery("SELECT obj_id, title, description," .
104  " lang_code, lang_default" .
105  " FROM object_translation" .
106  " WHERE " . $ilDB->in("obj_id", $a_ids, false, "integer"));
107  break;
108  }
109  }
110 
111  if ($a_entity == "transl") {
112  switch ($a_version) {
113  case "4.4.0":
114  case "5.1.0":
115  case "5.2.0":
116  $this->getDirectDataFromQuery("SELECT obj_id, master_lang" .
117  " FROM obj_content_master_lng" .
118  " WHERE " . $ilDB->in("obj_id", $a_ids, false, "integer"));
119  break;
120  }
121  }
122 
123  if ($a_entity == "service_settings") {
124  switch ($a_version) {
125  case "5.1.0":
126  case "5.2.0":
127  include_once("./Services/Object/classes/class.ilObjectServiceSettingsGUI.php");
128  include_once("./Services/Container/classes/class.ilContainer.php");
129 
130  $this->data = array();
131  foreach ($a_ids as $id) {
132  // info, news, custom metadata, tags, taxonomies, auto rating (all stored in container settings)
133  $settings = array(
141  );
142  if ($a_version == "5.2.0") {
144  }
145  foreach ($settings as $s) {
146  $val = ilContainer::_lookupContainerSetting($id, $s);
147  if ($val) {
148  $this->data[] = array(
149  "ObjId" => $id,
150  "Setting" => $s,
151  "Value" => $val
152  );
153  }
154  }
155  }
156  break;
157  }
158  }
159  }
Add some data
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 ...
if(!array_key_exists('StateId', $_REQUEST)) $id
$s
Definition: pwgen.php:45
Create styles array
The data for the language used.
global $ilDB
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=null)
Lookup a container setting.
+ Here is the call graph for this function:

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