ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 = ""
 

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 232 of file class.ilSessionDataSet.php.

References array.

233  {
234  switch ($a_entity)
235  {
236  case "sess":
237  return array (
238  "sess_item" => array("ids" => $a_rec["Id"])
239  );
240  }
241 
242  return false;
243  }
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  {
47  switch ($a_version)
48  {
49  case "4.1.0":
50  return array(
51  "Id" => "integer",
52  "Title" => "text",
53  "Description" => "text",
54  "Location" => "text",
55  "TutorName" => "text",
56  "TutorEmail" => "text",
57  "TutorPhone" => "text",
58  "Details" => "text",
59  "Registration" => "integer",
60  "EventStart" => "text",
61  "EventEnd" => "text",
62  "StartingTime" => "integer",
63  "EndingTime" => "integer",
64  "Fulltime" => "integer"
65  );
66  case "5.0.0":
67  return array(
68  "Id" => "integer",
69  "Title" => "text",
70  "Description" => "text",
71  "Location" => "text",
72  "TutorName" => "text",
73  "TutorEmail" => "text",
74  "TutorPhone" => "text",
75  "Details" => "text",
76  "Registration" => "integer",
77  "EventStart" => "text",
78  "EventEnd" => "text",
79  "StartingTime" => "integer",
80  "EndingTime" => "integer",
81  "Fulltime" => "integer",
82  "LimitedRegistration" => "integer",
83  "WaitingList" => "integer",
84  "LimitUsers" => "integer"
85  );
86  case "5.1.0":
87  return array(
88  "Id" => "integer",
89  "Title" => "text",
90  "Description" => "text",
91  "Location" => "text",
92  "TutorName" => "text",
93  "TutorEmail" => "text",
94  "TutorPhone" => "text",
95  "Details" => "text",
96  "Registration" => "integer",
97  "EventStart" => "text",
98  "EventEnd" => "text",
99  "StartingTime" => "integer",
100  "EndingTime" => "integer",
101  "Fulltime" => "integer",
102  "LimitedRegistration" => "integer",
103  "WaitingList" => "integer",
104  "AutoWait" => "integer",
105  "LimitUsers" => "integer",
106  "MinUsers" => "integer"
107  );
108  }
109  }
110 
111  if ($a_entity == "sess_item")
112  {
113  switch ($a_version)
114  {
115  case "4.1.0":
116  case "5.0.0":
117  case "5.1.0":
118  return array(
119  "SessionId" => "integer",
120  "ItemId" => "text",
121  );
122  }
123  }
124 
125  }
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 205 of file class.ilSessionDataSet.php.

References ilObject\_lookupObjId().

206  {
207  if ($a_entity == "sess")
208  {
209  // convert server dates to utc
210  if(!$a_set["Fulltime"])
211  {
212  // nothing has to be done here, since the dates are already stored in UTC
213  #$start = new ilDateTime($a_set["EventStart"], IL_CAL_DATETIME);
214  #$a_set["EventStart"] = $start->get(IL_CAL_DATETIME,'','UTC');
215  #$end = new ilDateTime($a_set["EventEnd"], IL_CAL_DATETIME);
216  #$a_set["EventEnd"] = $end->get(IL_CAL_DATETIME,'','UTC');
217  }
218  }
219  if ($a_entity == "sess_item")
220  {
221  // make ref id an object id
222  $a_set["ItemId"] = ilObject::_lookupObjId($a_set["ItemId"]);
223  }
224  return $a_set;
225  }
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 252 of file class.ilSessionDataSet.php.

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

253  {
254  switch ($a_entity)
255  {
256  case "sess":
257  include_once("./Modules/Session/classes/class.ilObjSession.php");
258  include_once("./Modules/Session/classes/class.ilSessionAppointment.php");
259 
260  if($new_id = $a_mapping->getMapping('Services/Container','objs',$a_rec['Id']))
261  {
262  $newObj = ilObjectFactory::getInstanceByObjId($new_id,false);
263  }
264  else
265  {
266  $newObj = new ilObjSession();
267  $newObj->setType("sess");
268  $newObj->create(true);
269  }
270  $newObj->setTitle($a_rec["Title"]);
271  $newObj->setDescription($a_rec["Description"]);
272  $newObj->setLocation($a_rec["Location"]);
273  $newObj->setName($a_rec["TutorName"]);
274  $newObj->setPhone($a_rec["TutorPhone"]);
275  $newObj->setEmail($a_rec["TutorEmail"]);
276  $newObj->setDetails($a_rec["Details"]);
277 
278  switch ($a_schema_version)
279  {
280  case "5.0.0":
281  case "5.1.0":
282  $newObj->setRegistrationType($a_rec["Registration"]);
283 
284  $newObj->enableRegistrationUserLimit($a_rec["LimitedRegistration"]);
285  $newObj->setRegistrationMaxUsers($a_rec["LimitUsers"]);
286  $newObj->enableRegistrationWaitingList($a_rec["WaitingList"]);
287 
288  if(isset($a_rec["MinUsers"])) {
289  $newObj->setRegistrationMinUsers($a_rec["MinUsers"]);
290  }
291 
292  if(isset($a_rec["AutoWait"])) {
293  $newObj->setWaitingListAutoFill($a_rec["AutoWait"]);
294  }
295  break;
296  }
297 
298  $newObj->update();
299 
300  $start = new ilDateTime($a_rec["EventStart"], IL_CAL_DATETIME, "UTC");
301  $end = new ilDateTime($a_rec["EventEnd"], IL_CAL_DATETIME, "UTC");
302 //echo "<br>".$start->get(IL_CAL_UNIX);
303 //echo "<br>".$start->get(IL_CAL_DATETIME);
304  $app = new ilSessionAppointment();
305  $app->setStart($a_rec["EventStart"]);
306  $app->setEnd($a_rec["EventEnd"]);
307  $app->setStartingTime($start->get(IL_CAL_UNIX));
308  $app->setEndingTime($end->get(IL_CAL_UNIX));
309  $app->toggleFullTime($a_rec["Fulltime"]);
310  $app->setSessionId($newObj->getId());
311  $app->create();
312 
313  //$newObj->setAppointments(array($app));
314  //$newObj->update();
315 
316  $this->current_obj = $newObj;
317  $a_mapping->addMapping("Modules/Session", "sess", $a_rec["Id"], $newObj->getId());
318 //var_dump($a_mapping->mappings["Services/News"]["news_context"]);
319  break;
320 
321  case "sess_item":
322 
323  if($obj_id = $a_mapping->getMapping('Services/Container','objs',$a_rec['ItemId']))
324  {
325  $ref_id = current(ilObject::_getAllReferences($obj_id));
326  include_once './Modules/Session/classes/class.ilEventItems.php';
327  $evi = new ilEventItems($this->current_obj->getId());
328  $evi->addItem($ref_id);
329  $evi->update();
330  }
331  break;
332  }
333  }
const IL_CAL_DATETIME
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
$ref_id
Definition: sahs_server.php:39
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 133 of file class.ilSessionDataSet.php.

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

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