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

Session data set class. More...

+ Inheritance diagram for ilSessionDataSet:
+ Collaboration diagram for ilSessionDataSet:

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 = ""
 
 $db
 
 $ds_log
 

Detailed Description

Session 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.ilSessionDataSet.php.

Member Function Documentation

◆ getDependencies()

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

Determine the dependent sets of data.

Definition at line 218 of file class.ilSessionDataSet.php.

References array.

219  {
220  switch ($a_entity) {
221  case "sess":
222  return array(
223  "sess_item" => array("ids" => $a_rec["Id"])
224  );
225  }
226 
227  return false;
228  }
Create styles array
The data for the language used.

◆ getSupportedVersions()

ilSessionDataSet::getSupportedVersions ( )

Get supported versions.

Parameters

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

References array.

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

◆ getTypes()

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

Get field types for entity.

Parameters

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

References array.

44  {
45  if ($a_entity == "sess") {
46  switch ($a_version) {
47  case "4.1.0":
48  return array(
49  "Id" => "integer",
50  "Title" => "text",
51  "Description" => "text",
52  "Location" => "text",
53  "TutorName" => "text",
54  "TutorEmail" => "text",
55  "TutorPhone" => "text",
56  "Details" => "text",
57  "Registration" => "integer",
58  "EventStart" => "text",
59  "EventEnd" => "text",
60  "StartingTime" => "integer",
61  "EndingTime" => "integer",
62  "Fulltime" => "integer"
63  );
64  case "5.0.0":
65  return array(
66  "Id" => "integer",
67  "Title" => "text",
68  "Description" => "text",
69  "Location" => "text",
70  "TutorName" => "text",
71  "TutorEmail" => "text",
72  "TutorPhone" => "text",
73  "Details" => "text",
74  "Registration" => "integer",
75  "EventStart" => "text",
76  "EventEnd" => "text",
77  "StartingTime" => "integer",
78  "EndingTime" => "integer",
79  "Fulltime" => "integer",
80  "LimitedRegistration" => "integer",
81  "WaitingList" => "integer",
82  "LimitUsers" => "integer"
83  );
84  case "5.1.0":
85  return array(
86  "Id" => "integer",
87  "Title" => "text",
88  "Description" => "text",
89  "Location" => "text",
90  "TutorName" => "text",
91  "TutorEmail" => "text",
92  "TutorPhone" => "text",
93  "Details" => "text",
94  "Registration" => "integer",
95  "EventStart" => "text",
96  "EventEnd" => "text",
97  "StartingTime" => "integer",
98  "EndingTime" => "integer",
99  "Fulltime" => "integer",
100  "LimitedRegistration" => "integer",
101  "WaitingList" => "integer",
102  "AutoWait" => "integer",
103  "LimitUsers" => "integer",
104  "MinUsers" => "integer"
105  );
106  }
107  }
108 
109  if ($a_entity == "sess_item") {
110  switch ($a_version) {
111  case "4.1.0":
112  case "5.0.0":
113  case "5.1.0":
114  return array(
115  "SessionId" => "integer",
116  "ItemId" => "text",
117  );
118  }
119  }
120  }
Create styles array
The data for the language used.

◆ getXmlNamespace()

ilSessionDataSet::getXmlNamespace (   $a_entity,
  $a_schema_version 
)

Get xml namespace.

Parameters

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

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

◆ getXmlRecord()

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

Get xml record (export)

Parameters
arrayabstract data record
Returns
array xml record

Definition at line 194 of file class.ilSessionDataSet.php.

References ilObject\_lookupObjId().

195  {
196  if ($a_entity == "sess") {
197  // convert server dates to utc
198  if (!$a_set["Fulltime"]) {
199  // nothing has to be done here, since the dates are already stored in UTC
200  #$start = new ilDateTime($a_set["EventStart"], IL_CAL_DATETIME);
201  #$a_set["EventStart"] = $start->get(IL_CAL_DATETIME,'','UTC');
202  #$end = new ilDateTime($a_set["EventEnd"], IL_CAL_DATETIME);
203  #$a_set["EventEnd"] = $end->get(IL_CAL_DATETIME,'','UTC');
204  }
205  }
206  if ($a_entity == "sess_item") {
207  // make ref id an object id
208  $a_set["ItemId"] = ilObject::_lookupObjId($a_set["ItemId"]);
209  }
210  return $a_set;
211  }
static _lookupObjId($a_id)
+ Here is the call graph for this function:

◆ importRecord()

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

Import record.

Parameters

Definition at line 237 of file class.ilSessionDataSet.php.

References $end, ilObject\_getAllReferences(), ilEventItems\addItem(), ilObjectFactory\getInstanceByObjId(), IL_CAL_DATETIME, and IL_CAL_UNIX.

238  {
239  switch ($a_entity) {
240  case "sess":
241  include_once("./Modules/Session/classes/class.ilObjSession.php");
242  include_once("./Modules/Session/classes/class.ilSessionAppointment.php");
243 
244  if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_rec['Id'])) {
245  $newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
246  } else {
247  $newObj = new ilObjSession();
248  $newObj->setType("sess");
249  $newObj->create(true);
250  }
251  $newObj->setTitle($a_rec["Title"]);
252  $newObj->setDescription($a_rec["Description"]);
253  $newObj->setLocation($a_rec["Location"]);
254  $newObj->setName($a_rec["TutorName"]);
255  $newObj->setPhone($a_rec["TutorPhone"]);
256  $newObj->setEmail($a_rec["TutorEmail"]);
257  $newObj->setDetails($a_rec["Details"]);
258 
259  switch ($a_schema_version) {
260  case "5.0.0":
261  case "5.1.0":
262  $newObj->setRegistrationType($a_rec["Registration"]);
263 
264  $newObj->enableRegistrationUserLimit($a_rec["LimitedRegistration"]);
265  $newObj->setRegistrationMaxUsers($a_rec["LimitUsers"]);
266  $newObj->enableRegistrationWaitingList($a_rec["WaitingList"]);
267 
268  if (isset($a_rec["MinUsers"])) {
269  $newObj->setRegistrationMinUsers($a_rec["MinUsers"]);
270  }
271 
272  if (isset($a_rec["AutoWait"])) {
273  $newObj->setWaitingListAutoFill($a_rec["AutoWait"]);
274  }
275  break;
276  }
277 
278  $newObj->update(true);
279 
280  $start = new ilDateTime($a_rec["EventStart"], IL_CAL_DATETIME, "UTC");
281  $end = new ilDateTime($a_rec["EventEnd"], IL_CAL_DATETIME, "UTC");
282 //echo "<br>".$start->get(IL_CAL_UNIX);
283 //echo "<br>".$start->get(IL_CAL_DATETIME);
284  $app = new ilSessionAppointment();
285  $app->setStart($a_rec["EventStart"]);
286  $app->setEnd($a_rec["EventEnd"]);
287  $app->setStartingTime($start->get(IL_CAL_UNIX));
288  $app->setEndingTime($end->get(IL_CAL_UNIX));
289  $app->toggleFullTime($a_rec["Fulltime"]);
290  $app->setSessionId($newObj->getId());
291  $app->create();
292 
293  //$newObj->setAppointments(array($app));
294  //$newObj->update();
295 
296  $this->current_obj = $newObj;
297  $a_mapping->addMapping("Modules/Session", "sess", $a_rec["Id"], $newObj->getId());
298  $a_mapping->addMapping('Services/Object', 'objs', $a_rec['Id'], $newObj->getId());
299  $a_mapping->addMapping('Services/AdvancedMetaData', 'parent', $a_rec['Id'], $newObj->getId());
300  $a_mapping->addMapping(
301  "Services/MetaData",
302  "md",
303  $a_rec["Id"] . ":0:sess",
304  $newObj->getId() . ":0:sess"
305  );
306 
307 
308 //var_dump($a_mapping->mappings["Services/News"]["news_context"]);
309  break;
310 
311  case "sess_item":
312 
313  if ($obj_id = $a_mapping->getMapping('Services/Container', 'objs', $a_rec['ItemId'])) {
314  $ref_id = current(ilObject::_getAllReferences($obj_id));
315  include_once './Modules/Session/classes/class.ilEventItems.php';
316  $evi = new ilEventItems($this->current_obj->getId());
317  $evi->addItem($ref_id);
318  $evi->update();
319  }
320  break;
321  }
322  }
const IL_CAL_DATETIME
$end
Definition: saml1-acs.php:18
const IL_CAL_UNIX
static _getAllReferences($a_id)
get all reference ids of object
Date and time handling
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
addItem($a_item_ref_id)
Add one item.
class ilEvent
class ilSessionAppointment
+ Here is the call graph for this function:

◆ readData()

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

Read data.

Parameters

Definition at line 128 of file class.ilSessionDataSet.php.

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

129  {
130  global $ilDB;
131 
132  if (!is_array($a_ids)) {
133  $a_ids = array($a_ids);
134  }
135 
136  if ($a_entity == "sess") {
137  switch ($a_version) {
138  case "4.1.0":
139  $this->getDirectDataFromQuery($q = "SELECT ev.obj_id id, od.title title, od.description description, " .
140  " location, tutor_name, tutor_email, tutor_phone, details, registration, " .
141  " e_start event_start, e_end event_end, starting_time, ending_time, fulltime " .
142  " FROM event ev JOIN object_data od ON (ev.obj_id = od.obj_id) " .
143  " JOIN event_appointment ea ON (ev.obj_id = ea.event_id) " .
144  "WHERE " .
145  $ilDB->in("ev.obj_id", $a_ids, false, "integer"));
146  break;
147  case "5.0.0":
148  $this->getDirectDataFromQuery($q = "SELECT ev.obj_id id, od.title title, odes.description description, " .
149  " location, tutor_name, tutor_email, tutor_phone, details, reg_type registration, " .
150  " reg_limited limited_registration, reg_waiting_list waiting_list, " .
151  " reg_limit_users limit_users, " .
152  " e_start event_start, e_end event_end, starting_time, ending_time, fulltime " .
153  " FROM event ev JOIN object_data od ON (ev.obj_id = od.obj_id) " .
154  " JOIN event_appointment ea ON (ev.obj_id = ea.event_id) " .
155  " JOIN object_description odes ON (ev.obj_id = odes.obj_id) " .
156  "WHERE " .
157  $ilDB->in("ev.obj_id", $a_ids, false, "integer"));
158  break;
159  case "5.1.0":
160  $this->getDirectDataFromQuery($q = "SELECT ev.obj_id id, od.title title, odes.description description, " .
161  " location, tutor_name, tutor_email, tutor_phone, details, reg_type registration, " .
162  " reg_limited limited_registration, reg_waiting_list waiting_list, reg_auto_wait auto_wait, " .
163  " reg_limit_users limit_users, reg_min_users min_users, " .
164  " e_start event_start, e_end event_end, starting_time, ending_time, fulltime " .
165  " FROM event ev JOIN object_data od ON (ev.obj_id = od.obj_id) " .
166  " JOIN event_appointment ea ON (ev.obj_id = ea.event_id) " .
167  " JOIN object_description odes ON (ev.obj_id = odes.obj_id) " .
168  "WHERE " .
169  $ilDB->in("ev.obj_id", $a_ids, false, "integer"));
170  break;
171  }
172  }
173 
174  if ($a_entity == "sess_item") {
175  switch ($a_version) {
176  case "4.1.0":
177  case "5.0.0":
178  case "5.1.0":
179  $this->getDirectDataFromQuery($q = "SELECT event_id session_id, item_id " .
180  " FROM event_items " .
181  "WHERE " .
182  $ilDB->in("event_id", $a_ids, false, "integer"));
183  break;
184  }
185  }
186  }
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: