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

Calendar data set class. More...

+ Inheritance diagram for ilCalendarDataSet:
+ Collaboration diagram for ilCalendarDataSet:

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...
 
 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

Calendar 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.ilCalendarDataSet.php.

Member Function Documentation

◆ getDependencies()

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

Determine the dependent sets of data.

Definition at line 187 of file class.ilCalendarDataSet.php.

References ilCalendarCategoryAssignments\_getAssignedAppointments(), and array.

188  {
189  switch ($a_entity) {
190  case "calendar":
191  include_once("./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php");
192  $assignmnts = ilCalendarCategoryAssignments::_getAssignedAppointments(array($a_rec["CatId"]));
193  $entries = array();
194  foreach ($assignmnts as $cal_id) {
195  $entries[$cal_id] = $cal_id;
196  }
197  return array(
198  "cal_entry" => array("ids" => $entries),
199  "cal_assignment" => array("ids" => $a_rec["CatId"])
200  );
201  case "cal_entry":
202  return array(
203  "recurrence_rule" => array("ids" => $a_rec["Id"])
204  );
205  }
206 
207  return false;
208  }
Create styles array
The data for the language used.
static _getAssignedAppointments($a_cat_id)
Get assigned apointments.
+ Here is the call graph for this function:

◆ getSupportedVersions()

ilCalendarDataSet::getSupportedVersions ( )

Get supported versions.

Parameters

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

References array.

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

◆ getTypes()

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

Get field types for entity.

Parameters

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

References array.

44  {
45  // calendar
46  if ($a_entity == "calendar") {
47  switch ($a_version) {
48  case "4.3.0":
49  return array(
50  "CatId" => "integer",
51  "ObjId" => "text",
52  "Title" => "text",
53  "Color" => "text",
54  "Type" => "integer"
55  );
56  }
57  }
58 
59  // calendar entry
60  if ($a_entity == "cal_entry") {
61  switch ($a_version) {
62  case "4.3.0":
63  return array(
64  "Id" => "integer",
65  "Title" => "text",
66  "Subtitle" => "text",
67  "Description" => "text",
68  "Location" => "text",
69  "Fullday" => "integer",
70  "Starta" => "text",
71  "Enda" => "text",
72  "Informations" => "text",
73  "AutoGenerated" => "integer",
74  "ContextId" => "integer",
75  "TranslationType" => "integer",
76  "IsMilestone" => "integer",
77  "Completion" => "integer",
78  "Notification" => "integer"
79  );
80  }
81  }
82 
83  // calendar/entry assignment
84  if ($a_entity == "cal_assignment") {
85  switch ($a_version) {
86  case "4.3.0":
87  return array(
88  "CatId" => "integer",
89  "EntryId" => "integer"
90  );
91  }
92  }
93 
94  // recurrence rule
95  if ($a_entity == "recurrence_rule") {
96  switch ($a_version) {
97  case "4.3.0":
98  return array(
99  "RuleId" => "integer",
100  "EntryId" => "integer",
101  "CalRecurrence" => "integer",
102  "FreqType" => "text",
103  "FreqUntilDate" => "text",
104  "FreqUntilCount" => "integer",
105  "Intervall" => "integer",
106  "Byday" => "text",
107  "Byweekno" => "text",
108  "Bymonth" => "text",
109  "Bymonthday" => "text",
110  "Byyearday" => "text",
111  "Bysetpos" => "text",
112  "Weekstart" => "text"
113  );
114  }
115  }
116  }
Create styles array
The data for the language used.

◆ getXmlNamespace()

ilCalendarDataSet::getXmlNamespace (   $a_entity,
  $a_schema_version 
)

Get xml namespace.

Parameters

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

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

◆ importRecord()

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

Import record.

Parameters

Definition at line 216 of file class.ilCalendarDataSet.php.

References ilObject\_lookupType(), IL_CAL_DATETIME, and ilCalendarCategory\TYPE_USR.

217  {
218  switch ($a_entity) {
219  case "calendar":
220  // please note: we currently only support private user calendars to
221  // be imported
222  if ($a_rec["Type"] == 1) {
223  $usr_id = $a_mapping->getMapping("Services/User", "usr", $a_rec["ObjId"]);
224  if ($usr_id > 0 && ilObject::_lookupType($usr_id) == "usr") {
225  include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
226  $category = new ilCalendarCategory(0);
227  $category->setTitle($a_rec["Title"]);
228  $category->setColor($a_rec["Color"]);
229  $category->setType(ilCalendarCategory::TYPE_USR);
230  $category->setObjId($usr_id);
231  $category->add();
232  $a_mapping->addMapping(
233  "Services/Calendar",
234  "calendar",
235  $a_rec["CatId"],
236  $category->getCategoryID()
237  );
238  }
239  }
240  break;
241 
242  case "cal_entry":
243  // please note: we currently only support private user calendars to
244  // be imported
245  if ((int) $a_rec["ContextId"] == 0) {
246  include_once('./Services/Calendar/classes/class.ilCalendarEntry.php');
247  $entry = new ilCalendarEntry(0);
248  $entry->setTitle($a_rec["Title"]);
249  $entry->setSubtitle($a_rec["Subtitle"]);
250  $entry->setDescription($a_rec["Description"]);
251  $entry->setLocation($a_rec["Location"]);
252  $entry->setFullday($a_rec["Fullday"]);
253  if ($a_rec["Starta"] != "") {
254  $entry->setStart(new ilDateTime($a_rec["Starta"], IL_CAL_DATETIME, 'UTC'));
255  }
256  if ($a_rec["Enda"] != "") {
257  $entry->setEnd(new ilDateTime($a_rec["Enda"], IL_CAL_DATETIME, 'UTC'));
258  }
259  $entry->setFurtherInformations($a_rec["Informations"]);
260  $entry->setAutoGenerated($a_rec["AutoGenerated"]);
261  $entry->setContextId($a_rec["ContextId"]);
262  $entry->setMilestone($a_rec["Milestone"]);
263  $entry->setCompletion($a_rec["Completion"]);
264  $entry->setTranslationType($a_rec["TranslationType"]);
265  $entry->enableNotification($a_rec["Notification"]);
266  $entry->save();
267  $a_mapping->addMapping(
268  "Services/Calendar",
269  "cal_entry",
270  $a_rec["Id"],
271  $entry->getEntryId()
272  );
273  }
274  break;
275 
276  case "cal_assignment":
277  $cat_id = $a_mapping->getMapping("Services/Calendar", "calendar", $a_rec["CatId"]);
278  $entry_id = $a_mapping->getMapping("Services/Calendar", "cal_entry", $a_rec["EntryId"]);
279  if ($cat_id > 0 && $entry_id > 0) {
280  include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
281  $ass = new ilCalendarCategoryAssignments($entry_id);
282  $ass->addAssignment($cat_id);
283  }
284  break;
285 
286  case "recurrence_rule":
287  $entry_id = $a_mapping->getMapping("Services/Calendar", "cal_entry", $a_rec["EntryId"]);
288  if ($entry_id > 0) {
289  include_once('./Services/Calendar/classes/class.ilCalendarRecurrence.php');
290  $rec = new ilCalendarRecurrence();
291  $rec->setEntryId($entry_id);
292  $rec->setRecurrence($a_rec["CalRecurrence"]);
293  $rec->setFrequenceType($a_rec["FreqType"]);
294  if ($a_rec["FreqUntilDate"] != "") {
295  $rec->setFrequenceUntilDate(new ilDateTime($a_rec["FreqUntilDate"], IL_CAL_DATETIME));
296  }
297  $rec->setFrequenceUntilCount($a_rec["FreqUntilCount"]);
298  $rec->setInterval($a_rec["Interval"]);
299  $rec->setBYDAY($a_rec["Byday"]);
300  $rec->setBYWEEKNO($a_rec["Byweekno"]);
301  $rec->setBYMONTH($a_rec["Bymonth"]);
302  $rec->setBYMONTHDAY($a_rec["Bymonthday"]);
303  $rec->setBYYEARDAY($a_rec["Byyearday"]);
304  $rec->setBYSETPOS($a_rec["Bysetpos"]);
305  $rec->setWeekstart($a_rec["Weekstart"]);
306  $rec->save();
307  $a_mapping->addMapping(
308  "Services/Calendar",
309  "recurrence_rule",
310  $a_rec["RuleId"],
311  $rec->getRecurrenceId()
312  );
313  }
314  break;
315  }
316  }
Model for a calendar entry.
const IL_CAL_DATETIME
Stores calendar categories.
Date and time handling
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:

◆ readData()

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

Read data.

Parameters

Definition at line 124 of file class.ilCalendarDataSet.php.

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

125  {
126  global $ilDB;
127 
128  if (!is_array($a_ids)) {
129  $a_ids = array($a_ids);
130  }
131 
132  // calendar
133  if ($a_entity == "calendar") {
134  switch ($a_version) {
135  case "4.3.0":
136  $this->getDirectDataFromQuery("SELECT cat_id, obj_id, title, color, type " .
137  " FROM cal_categories " .
138  " WHERE " .
139  $ilDB->in("cat_id", $a_ids, false, "integer"));
140  break;
141  }
142  }
143 
144  // cal assignments
145  if ($a_entity == "cal_assignment") {
146  switch ($a_version) {
147  case "4.3.0":
148  $this->getDirectDataFromQuery("SELECT cat_id, cal_id entry_id " .
149  " FROM cal_cat_assignments " .
150  " WHERE " .
151  $ilDB->in("cat_id", $a_ids, false, "integer"));
152  break;
153  }
154  }
155 
156  // cal entries
157  if ($a_entity == "cal_entry") {
158  switch ($a_version) {
159  case "4.3.0":
160  $this->getDirectDataFromQuery("SELECT cal_id id, title, subtitle, description, location, fullday, " .
161  " starta, enda, informations, auto_generated, context_id, translation_type, is_milestone, completion, notification " .
162  " FROM cal_entries " .
163  " WHERE " .
164  $ilDB->in("cal_id", $a_ids, false, "integer"));
165  break;
166  }
167  }
168 
169 
170  // recurrence_rule
171  if ($a_entity == "recurrence_rule") {
172  switch ($a_version) {
173  case "4.3.0":
174  $this->getDirectDataFromQuery("SELECT rule_id, cal_id entry_id, cal_recurrence, freq_type, freq_until_date, freq_until_count, " .
175  " intervall, byday, byweekno, bymonth, bymonthday, byyearday, bysetpos, weekstart " .
176  " FROM cal_recurrence_rules " .
177  " WHERE " .
178  $ilDB->in("cal_id", $a_ids, false, "integer"));
179  break;
180  }
181  }
182  }
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: