ILIAS  release_4-4 Revision
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 162 of file class.ilSessionDataSet.php.

163  {
164  switch ($a_entity)
165  {
166  case "sess":
167  return array (
168  "sess_item" => array("ids" => $a_rec["Id"])
169  );
170  }
171 
172  return false;
173  }

◆ getSupportedVersions()

ilSessionDataSet::getSupportedVersions ( )

Get supported versions.

Parameters

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

22  {
23  return array("4.1.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  }
67  }
68 
69  if ($a_entity == "sess_item")
70  {
71  switch ($a_version)
72  {
73  case "4.1.0":
74  return array(
75  "SessionId" => "integer",
76  "ItemId" => "text",
77  );
78  }
79  }
80 
81  }

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

References ilObject\_lookupObjId().

136  {
137  if ($a_entity == "sess")
138  {
139  // convert server dates to utc
140  if(!$a_set["Fulltime"])
141  {
142  // nothing has to be done here, since the dates are already stored in UTC
143  #$start = new ilDateTime($a_set["EventStart"], IL_CAL_DATETIME);
144  #$a_set["EventStart"] = $start->get(IL_CAL_DATETIME,'','UTC');
145  #$end = new ilDateTime($a_set["EventEnd"], IL_CAL_DATETIME);
146  #$a_set["EventEnd"] = $end->get(IL_CAL_DATETIME,'','UTC');
147  }
148  }
149  if ($a_entity == "sess_item")
150  {
151  // make ref id an object id
152  $a_set["ItemId"] = ilObject::_lookupObjId($a_set["ItemId"]);
153  }
154  return $a_set;
155  }
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 182 of file class.ilSessionDataSet.php.

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

183  {
184  switch ($a_entity)
185  {
186  case "sess":
187  include_once("./Modules/Session/classes/class.ilObjSession.php");
188  include_once("./Modules/Session/classes/class.ilSessionAppointment.php");
189 
190  if($new_id = $a_mapping->getMapping('Services/Container','objs',$a_rec['Id']))
191  {
192  $newObj = ilObjectFactory::getInstanceByObjId($new_id,false);
193  }
194  else
195  {
196  $newObj = new ilObjSession();
197  $newObj->setType("sess");
198  $newObj->create(true);
199  }
200  $newObj->setTitle($a_rec["Title"]);
201  $newObj->setDescription($a_rec["Description"]);
202  $newObj->setLocation($a_rec["Location"]);
203  $newObj->setName($a_rec["TutorName"]);
204  $newObj->setPhone($a_rec["TutorPhone"]);
205  $newObj->setEmail($a_rec["TutorEmail"]);
206  $newObj->setDetails($a_rec["Details"]);
207  $newObj->enableRegistration($a_rec["Registration"]);
208  $newObj->update();
209 
210  $start = new ilDateTime($a_rec["EventStart"], IL_CAL_DATETIME, "UTC");
211  $end = new ilDateTime($a_rec["EventEnd"], IL_CAL_DATETIME, "UTC");
212 //echo "<br>".$start->get(IL_CAL_UNIX);
213 //echo "<br>".$start->get(IL_CAL_DATETIME);
214  $app = new ilSessionAppointment();
215  $app->setStart($a_rec["EventStart"]);
216  $app->setEnd($a_rec["EventEnd"]);
217  $app->setStartingTime($start->get(IL_CAL_UNIX));
218  $app->setEndingTime($end->get(IL_CAL_UNIX));
219  $app->toggleFullTime($a_rec["Fulltime"]);
220  $app->setSessionId($newObj->getId());
221  $app->create();
222 
223  //$newObj->setAppointments(array($app));
224  //$newObj->update();
225 
226  $this->current_obj = $newObj;
227  $a_mapping->addMapping("Modules/Session", "sess", $a_rec["Id"], $newObj->getId());
228 //var_dump($a_mapping->mappings["Services/News"]["news_context"]);
229  break;
230 
231  case "sess_item":
232 
233  if($obj_id = $a_mapping->getMapping('Services/Container','objs',$a_rec['ItemId']))
234  {
235  $ref_id = current(ilObject::_getAllReferences($obj_id));
236  include_once './Modules/Session/classes/class.ilEventItems.php';
237  $evi = new ilEventItems($this->current_obj->getId());
238  $evi->addItem($ref_id);
239  $evi->update();
240  }
241  break;
242  }
243  }
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 89 of file class.ilSessionDataSet.php.

References ilDataSet\getDirectDataFromQuery().

90  {
91  global $ilDB;
92 
93  if (!is_array($a_ids))
94  {
95  $a_ids = array($a_ids);
96  }
97 
98  if ($a_entity == "sess")
99  {
100  switch ($a_version)
101  {
102  case "4.1.0":
103  $this->getDirectDataFromQuery($q = "SELECT ev.obj_id id, od.title title, od.description description, ".
104  " location, tutor_name, tutor_email, tutor_phone, details, registration, ".
105  " e_start event_start, e_end event_end, starting_time, ending_time, fulltime ".
106  " FROM event ev JOIN object_data od ON (ev.obj_id = od.obj_id) ".
107  " JOIN event_appointment ea ON (ev.obj_id = ea.event_id) ".
108  "WHERE ".
109  $ilDB->in("ev.obj_id", $a_ids, false, "integer"));
110  break;
111  }
112  }
113 
114  if ($a_entity == "sess_item")
115  {
116  switch ($a_version)
117  {
118  case "4.1.0":
119  $this->getDirectDataFromQuery($q = "SELECT event_id session_id, item_id ".
120  " FROM event_items ".
121  "WHERE ".
122  $ilDB->in("event_id", $a_ids, false, "integer"));
123  break;
124  }
125  }
126 
127  }
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 ...
+ Here is the call graph for this function:

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