ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
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)
 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...
 

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
 

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

197  {
198  switch ($a_entity)
199  {
200  case "sess":
201  return array (
202  "sess_item" => array("ids" => $a_rec["Id"])
203  );
204  }
205 
206  return false;
207  }

◆ getSupportedVersions()

ilSessionDataSet::getSupportedVersions ( )

Get supported versions.

Parameters

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

22  {
23  return array("4.1.0", "5.0.0");
24  }

◆ getTypes()

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

Get field types for entity.

Parameters

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

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  }
87  }
88 
89  if ($a_entity == "sess_item")
90  {
91  switch ($a_version)
92  {
93  case "4.1.0":
94  case "5.0.0":
95  return array(
96  "SessionId" => "integer",
97  "ItemId" => "text",
98  );
99  }
100  }
101 
102  }

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

References ilObject\_lookupObjId().

170  {
171  if ($a_entity == "sess")
172  {
173  // convert server dates to utc
174  if(!$a_set["Fulltime"])
175  {
176  // nothing has to be done here, since the dates are already stored in UTC
177  #$start = new ilDateTime($a_set["EventStart"], IL_CAL_DATETIME);
178  #$a_set["EventStart"] = $start->get(IL_CAL_DATETIME,'','UTC');
179  #$end = new ilDateTime($a_set["EventEnd"], IL_CAL_DATETIME);
180  #$a_set["EventEnd"] = $end->get(IL_CAL_DATETIME,'','UTC');
181  }
182  }
183  if ($a_entity == "sess_item")
184  {
185  // make ref id an object id
186  $a_set["ItemId"] = ilObject::_lookupObjId($a_set["ItemId"]);
187  }
188  return $a_set;
189  }
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 216 of file class.ilSessionDataSet.php.

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

217  {
218  switch ($a_entity)
219  {
220  case "sess":
221  include_once("./Modules/Session/classes/class.ilObjSession.php");
222  include_once("./Modules/Session/classes/class.ilSessionAppointment.php");
223 
224  if($new_id = $a_mapping->getMapping('Services/Container','objs',$a_rec['Id']))
225  {
226  $newObj = ilObjectFactory::getInstanceByObjId($new_id,false);
227  }
228  else
229  {
230  $newObj = new ilObjSession();
231  $newObj->setType("sess");
232  $newObj->create(true);
233  }
234  $newObj->setTitle($a_rec["Title"]);
235  $newObj->setDescription($a_rec["Description"]);
236  $newObj->setLocation($a_rec["Location"]);
237  $newObj->setName($a_rec["TutorName"]);
238  $newObj->setPhone($a_rec["TutorPhone"]);
239  $newObj->setEmail($a_rec["TutorEmail"]);
240  $newObj->setDetails($a_rec["Details"]);
241 
242  if($a_schema_version == "5.0.0")
243  {
244  $newObj->setRegistrationType($a_rec["Registration"]);
245 
246  $newObj->enableRegistrationUserLimit($a_rec["LimitedRegistration"]);
247  $newObj->setRegistrationMaxUsers($a_rec["LimitUsers"]);
248  $newObj->enableRegistrationWaitingList($a_rec["WaitingList"]);
249  }
250 
251  $newObj->update();
252 
253  $start = new ilDateTime($a_rec["EventStart"], IL_CAL_DATETIME, "UTC");
254  $end = new ilDateTime($a_rec["EventEnd"], IL_CAL_DATETIME, "UTC");
255 //echo "<br>".$start->get(IL_CAL_UNIX);
256 //echo "<br>".$start->get(IL_CAL_DATETIME);
257  $app = new ilSessionAppointment();
258  $app->setStart($a_rec["EventStart"]);
259  $app->setEnd($a_rec["EventEnd"]);
260  $app->setStartingTime($start->get(IL_CAL_UNIX));
261  $app->setEndingTime($end->get(IL_CAL_UNIX));
262  $app->toggleFullTime($a_rec["Fulltime"]);
263  $app->setSessionId($newObj->getId());
264  $app->create();
265 
266  //$newObj->setAppointments(array($app));
267  //$newObj->update();
268 
269  $this->current_obj = $newObj;
270  $a_mapping->addMapping("Modules/Session", "sess", $a_rec["Id"], $newObj->getId());
271 //var_dump($a_mapping->mappings["Services/News"]["news_context"]);
272  break;
273 
274  case "sess_item":
275 
276  if($obj_id = $a_mapping->getMapping('Services/Container','objs',$a_rec['ItemId']))
277  {
278  $ref_id = current(ilObject::_getAllReferences($obj_id));
279  include_once './Modules/Session/classes/class.ilEventItems.php';
280  $evi = new ilEventItems($this->current_obj->getId());
281  $evi->addItem($ref_id);
282  $evi->update();
283  }
284  break;
285  }
286  }
const IL_CAL_DATETIME
const IL_CAL_UNIX
static _getAllReferences($a_id)
get all reference ids of object
Date and time handling
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 110 of file class.ilSessionDataSet.php.

References $ilDB, and ilDataSet\getDirectDataFromQuery().

111  {
112  global $ilDB;
113 
114  if (!is_array($a_ids))
115  {
116  $a_ids = array($a_ids);
117  }
118 
119  if ($a_entity == "sess")
120  {
121  switch ($a_version)
122  {
123  case "4.1.0":
124  $this->getDirectDataFromQuery($q = "SELECT ev.obj_id id, od.title title, od.description description, ".
125  " location, tutor_name, tutor_email, tutor_phone, details, registration, ".
126  " e_start event_start, e_end event_end, starting_time, ending_time, fulltime ".
127  " FROM event ev JOIN object_data od ON (ev.obj_id = od.obj_id) ".
128  " JOIN event_appointment ea ON (ev.obj_id = ea.event_id) ".
129  "WHERE ".
130  $ilDB->in("ev.obj_id", $a_ids, false, "integer"));
131  break;
132  case "5.0.0":
133  $this->getDirectDataFromQuery($q = "SELECT ev.obj_id id, od.title title, odes.description description, ".
134  " location, tutor_name, tutor_email, tutor_phone, details, reg_type registration, ".
135  " reg_limited limited_registration, reg_waiting_list waiting_list, ".
136  " reg_limit_users limit_users, ".
137  " e_start event_start, e_end event_end, starting_time, ending_time, fulltime ".
138  " FROM event ev JOIN object_data od ON (ev.obj_id = od.obj_id) ".
139  " JOIN event_appointment ea ON (ev.obj_id = ea.event_id) ".
140  " JOIN object_description odes ON (ev.obj_id = odes.obj_id) ".
141  "WHERE ".
142  $ilDB->in("ev.obj_id", $a_ids, false, "integer"));
143  break;
144  }
145  }
146 
147  if ($a_entity == "sess_item")
148  {
149  switch ($a_version)
150  {
151  case "4.1.0":
152  case "5.0.0":
153  $this->getDirectDataFromQuery($q = "SELECT event_id session_id, item_id ".
154  " FROM event_items ".
155  "WHERE ".
156  $ilDB->in("event_id", $a_ids, false, "integer"));
157  break;
158  }
159  }
160 
161  }
getDirectDataFromQuery($a_query, $a_convert_to_leading_upper=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
global $ilDB
+ Here is the call graph for this function:

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