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

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 204 of file class.ilCalendarDataSet.php.

References ilCalendarCategoryAssignments\_getAssignedAppointments(), and array.

205  {
206  switch ($a_entity)
207  {
208  case "calendar":
209  include_once("./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php");
210  $assignmnts = ilCalendarCategoryAssignments::_getAssignedAppointments(array($a_rec["CatId"]));
211  $entries = array();
212  foreach ($assignmnts as $cal_id)
213  {
214  $entries[$cal_id] = $cal_id;
215  }
216  return array (
217  "cal_entry" => array("ids" => $entries),
218  "cal_assignment" => array("ids" => $a_rec["CatId"])
219  );
220  case "cal_entry":
221  return array (
222  "recurrence_rule" => array("ids" => $a_rec["Id"])
223  );
224  }
225 
226  return false;
227  }
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  {
48  switch ($a_version)
49  {
50  case "4.3.0":
51  return array (
52  "CatId" => "integer",
53  "ObjId" => "text",
54  "Title" => "text",
55  "Color" => "text",
56  "Type" => "integer"
57  );
58  }
59  }
60 
61  // calendar entry
62  if ($a_entity == "cal_entry")
63  {
64  switch ($a_version)
65  {
66  case "4.3.0":
67  return array (
68  "Id" => "integer",
69  "Title" => "text",
70  "Subtitle" => "text",
71  "Description" => "text",
72  "Location" => "text",
73  "Fullday" => "integer",
74  "Starta" => "text",
75  "Enda" => "text",
76  "Informations" => "text",
77  "AutoGenerated" => "integer",
78  "ContextId" => "integer",
79  "TranslationType" => "integer",
80  "IsMilestone" => "integer",
81  "Completion" => "integer",
82  "Notification" => "integer"
83  );
84  }
85  }
86 
87  // calendar/entry assignment
88  if ($a_entity == "cal_assignment")
89  {
90  switch ($a_version)
91  {
92  case "4.3.0":
93  return array (
94  "CatId" => "integer",
95  "EntryId" => "integer"
96  );
97  }
98  }
99 
100  // recurrence rule
101  if ($a_entity == "recurrence_rule")
102  {
103  switch ($a_version)
104  {
105  case "4.3.0":
106  return array (
107  "RuleId" => "integer",
108  "EntryId" => "integer",
109  "CalRecurrence" => "integer",
110  "FreqType" => "text",
111  "FreqUntilDate" => "text",
112  "FreqUntilCount" => "integer",
113  "Intervall" => "integer",
114  "Byday" => "text",
115  "Byweekno" => "text",
116  "Bymonth" => "text",
117  "Bymonthday" => "text",
118  "Byyearday" => "text",
119  "Bysetpos" => "text",
120  "Weekstart" => "text"
121  );
122  }
123  }
124  }
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 235 of file class.ilCalendarDataSet.php.

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

236  {
237  switch ($a_entity)
238  {
239  case "calendar":
240  // please note: we currently only support private user calendars to
241  // be imported
242  if ($a_rec["Type"] == 1)
243  {
244  $usr_id = $a_mapping->getMapping("Services/User", "usr", $a_rec["ObjId"]);
245  if ($usr_id > 0 && ilObject::_lookupType($usr_id) == "usr")
246  {
247  include_once('./Services/Calendar/classes/class.ilCalendarCategory.php');
248  $category = new ilCalendarCategory(0);
249  $category->setTitle($a_rec["Title"]);
250  $category->setColor($a_rec["Color"]);
251  $category->setType(ilCalendarCategory::TYPE_USR);
252  $category->setObjId($usr_id);
253  $category->add();
254  $a_mapping->addMapping("Services/Calendar", "calendar", $a_rec["CatId"],
255  $category->getCategoryID());
256  }
257  }
258  break;
259 
260  case "cal_entry":
261  // please note: we currently only support private user calendars to
262  // be imported
263  if ((int) $a_rec["ContextId"] == 0)
264  {
265  include_once('./Services/Calendar/classes/class.ilCalendarEntry.php');
266  $entry = new ilCalendarEntry(0);
267  $entry->setTitle($a_rec["Title"]);
268  $entry->setSubtitle($a_rec["Subtitle"]);
269  $entry->setDescription($a_rec["Description"]);
270  $entry->setLocation($a_rec["Location"]);
271  $entry->setFullday($a_rec["Fullday"]);
272  if ($a_rec["Starta"] != "")
273  {
274  $entry->setStart(new ilDateTime($a_rec["Starta"], IL_CAL_DATETIME, 'UTC'));
275  }
276  if ($a_rec["Enda"] != "")
277  {
278  $entry->setEnd(new ilDateTime($a_rec["Enda"], IL_CAL_DATETIME, 'UTC'));
279  }
280  $entry->setFurtherInformations($a_rec["Informations"]);
281  $entry->setAutoGenerated($a_rec["AutoGenerated"]);
282  $entry->setContextId($a_rec["ContextId"]);
283  $entry->setMilestone($a_rec["Milestone"]);
284  $entry->setCompletion($a_rec["Completion"]);
285  $entry->setTranslationType($a_rec["TranslationType"]);
286  $entry->enableNotification($a_rec["Notification"]);
287  $entry->save();
288  $a_mapping->addMapping("Services/Calendar", "cal_entry", $a_rec["Id"],
289  $entry->getEntryId());
290  }
291  break;
292 
293  case "cal_assignment":
294  $cat_id = $a_mapping->getMapping("Services/Calendar", "calendar", $a_rec["CatId"]);
295  $entry_id = $a_mapping->getMapping("Services/Calendar", "cal_entry", $a_rec["EntryId"]);
296  if ($cat_id > 0 && $entry_id > 0)
297  {
298  include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
299  $ass = new ilCalendarCategoryAssignments($entry_id);
300  $ass->addAssignment($cat_id);
301  }
302  break;
303 
304  case "recurrence_rule":
305  $entry_id = $a_mapping->getMapping("Services/Calendar", "cal_entry", $a_rec["EntryId"]);
306  if ($entry_id > 0)
307  {
308  include_once('./Services/Calendar/classes/class.ilCalendarRecurrence.php');
309  $rec = new ilCalendarRecurrence();
310  $rec->setEntryId($entry_id);
311  $rec->setRecurrence($a_rec["CalRecurrence"]);
312  $rec->setFrequenceType($a_rec["FreqType"]);
313  if ($a_rec["FreqUntilDate"] != "")
314  {
315  $rec->setFrequenceUntilDate(new ilDateTime($a_rec["FreqUntilDate"], IL_CAL_DATETIME));
316  }
317  $rec->setFrequenceUntilCount($a_rec["FreqUntilCount"]);
318  $rec->setInterval($a_rec["Interval"]);
319  $rec->setBYDAY($a_rec["Byday"]);
320  $rec->setBYWEEKNO($a_rec["Byweekno"]);
321  $rec->setBYMONTH($a_rec["Bymonth"]);
322  $rec->setBYMONTHDAY($a_rec["Bymonthday"]);
323  $rec->setBYYEARDAY($a_rec["Byyearday"]);
324  $rec->setBYSETPOS($a_rec["Bysetpos"]);
325  $rec->setWeekstart($a_rec["Weekstart"]);
326  $rec->save();
327  $a_mapping->addMapping("Services/Calendar", "recurrence_rule", $a_rec["RuleId"],
328  $rec->getRecurrenceId());
329  }
330  break;
331  }
332  }
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 132 of file class.ilCalendarDataSet.php.

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

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