ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilItemGroupDataSet Class Reference

Item group data set class. More...

+ Inheritance diagram for ilItemGroupDataSet:
+ Collaboration diagram for ilItemGroupDataSet:

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...
 
 getXmlRecord ($a_entity, $a_version, $a_set)
 Get xml record (export) 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 = ""
 

Detailed Description

Item group data set class.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 13 of file class.ilItemGroupDataSet.php.

Member Function Documentation

◆ getDependencies()

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

Determine the dependent sets of data.

Definition at line 133 of file class.ilItemGroupDataSet.php.

References array.

134  {
135  switch ($a_entity)
136  {
137  case "itgr":
138  return array (
139  "itgr_item" => array("ids" => $a_rec["Id"])
140  );
141  }
142 
143  return false;
144  }
Create styles array
The data for the language used.

◆ getSupportedVersions()

ilItemGroupDataSet::getSupportedVersions ( )

Get supported versions.

Parameters

Definition at line 21 of file class.ilItemGroupDataSet.php.

References array.

22  {
23  return array("4.3.0");
24  }
Create styles array
The data for the language used.

◆ getTypes()

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

Get field types for entity.

Parameters

Definition at line 43 of file class.ilItemGroupDataSet.php.

References array.

44  {
45  if ($a_entity == "itgr")
46  {
47  switch ($a_version)
48  {
49  case "4.3.0":
50  return array(
51  "Id" => "integer",
52  "Title" => "text",
53  "Description" => "text");
54  }
55  }
56 
57  if ($a_entity == "itgr_item")
58  {
59  switch ($a_version)
60  {
61  case "4.3.0":
62  return array(
63  "ItemGroupId" => "integer",
64  "ItemId" => "text"
65  );
66  }
67  }
68 
69  }
Create styles array
The data for the language used.

◆ getXmlNamespace()

ilItemGroupDataSet::getXmlNamespace (   $a_entity,
  $a_schema_version 
)

Get xml namespace.

Parameters

Definition at line 32 of file class.ilItemGroupDataSet.php.

33  {
34  return "http://www.ilias.de/xml/Modules/ItemGroup/".$a_entity;
35  }

◆ getXmlRecord()

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

Get xml record (export)

Parameters
arrayabstract data record
Returns
array xml record

Definition at line 120 of file class.ilItemGroupDataSet.php.

References ilObject\_lookupObjId().

121  {
122  if ($a_entity == "itgr_item")
123  {
124  // make ref id an object id
125  $a_set["ItemId"] = ilObject::_lookupObjId($a_set["ItemId"]);
126  }
127  return $a_set;
128  }
static _lookupObjId($a_id)
+ Here is the call graph for this function:

◆ importRecord()

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

Import record.

Parameters

Definition at line 152 of file class.ilItemGroupDataSet.php.

References $ilLog, $ref_id, ilObject\_getAllReferences(), and ilObjectFactory\getInstanceByObjId().

153  {
154  global $ilLog;
155 
156 //echo $a_entity;
157 //var_dump($a_rec);
158 
159  switch ($a_entity)
160  {
161  case "itgr":
162  include_once("./Modules/ItemGroup/classes/class.ilObjItemGroup.php");
163 
164  if ($new_id = $a_mapping->getMapping('Services/Container','objs',$a_rec['Id']))
165  {
166  $newObj = ilObjectFactory::getInstanceByObjId($new_id,false);
167  }
168  else
169  {
170  $newObj = new ilObjItemGroup();
171  $newObj->setType("itgr");
172  $newObj->create(true);
173  }
174 
175  $newObj->setTitle($a_rec["Title"]);
176  $newObj->setDescription($a_rec["Description"]);
177  $newObj->update(true);
178  $this->current_obj = $newObj;
179  $a_mapping->addMapping("Modules/ItemGroup", "itgr", $a_rec["Id"], $newObj->getId());
180 
181  break;
182 
183  case "itgr_item":
184  if($obj_id = $a_mapping->getMapping('Services/Container','objs',$a_rec['ItemId']))
185  {
186  $ref_id = current(ilObject::_getAllReferences($obj_id));
187  include_once './Modules/ItemGroup/classes/class.ilItemGroupItems.php';
188  $itgri = new ilItemGroupItems();
189  $itgri->setItemGroupId($this->current_obj->getId());
190  $itgri->read();
191  $itgri->addItem($ref_id);
192 //$ilLog->write("Adding item with ref id -".$ref_id."- to group with id -".$this->current_obj->getId()."-.");
193  $itgri->update();
194  }
195  break;
196 
197  }
198  }
static _getAllReferences($a_id)
get all reference ids of object
Item group items.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Class ilObjItemGroup.
$ref_id
Definition: sahs_server.php:39
+ Here is the call graph for this function:

◆ readData()

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

Read data.

Parameters

Definition at line 77 of file class.ilItemGroupDataSet.php.

References $ilDB, array, and ilDataSet\getDirectDataFromQuery().

78  {
79  global $ilDB;
80 
81  if (!is_array($a_ids))
82  {
83  $a_ids = array($a_ids);
84  }
85 
86  if ($a_entity == "itgr")
87  {
88  switch ($a_version)
89  {
90  case "4.3.0":
91  $this->getDirectDataFromQuery("SELECT obj_id id, title, description ".
92  " FROM object_data ".
93  "WHERE ".
94  $ilDB->in("obj_id", $a_ids, false, "integer"));
95  break;
96  }
97  }
98 
99  if ($a_entity == "itgr_item")
100  {
101  switch ($a_version)
102  {
103  case "4.3.0":
104  $this->getDirectDataFromQuery($q = "SELECT item_group_id itgr_id, item_ref_id item_id".
105  " FROM item_group_item ".
106  "WHERE ".
107  $ilDB->in("item_group_id", $a_ids, false, "integer"));
108  break;
109  }
110  }
111 
112  }
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 ...
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

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