19 declare(strict_types=1);
33 return array(
"4.3.0");
39 protected function getXmlNamespace(
string $a_entity,
string $a_schema_version): string
41 return "http://www.ilias.de/xml/Services/Calendar/" . $a_entity;
47 protected function getTypes(
string $a_entity,
string $a_version): array
50 if ($a_entity ==
"calendar") {
64 if ($a_entity ==
"cal_entry") {
71 "Description" =>
"text",
73 "Fullday" =>
"integer",
76 "Informations" =>
"text",
77 "AutoGenerated" =>
"integer",
78 "ContextId" =>
"integer",
79 "TranslationType" =>
"integer",
80 "Notification" =>
"integer" 86 if ($a_entity ==
"cal_assignment") {
91 "EntryId" =>
"integer" 97 if ($a_entity ==
"recurrence_rule") {
101 "RuleId" =>
"integer",
102 "EntryId" =>
"integer",
103 "CalRecurrence" =>
"integer",
104 "FreqType" =>
"text",
105 "FreqUntilDate" =>
"text",
106 "FreqUntilCount" =>
"integer",
107 "Intervall" =>
"integer",
109 "Byweekno" =>
"text",
111 "Bymonthday" =>
"text",
112 "Byyearday" =>
"text",
113 "Bysetpos" =>
"text",
114 "Weekstart" =>
"text" 124 public function readData(
string $a_entity,
string $a_version, array $a_ids): void
126 if (!is_array($a_ids)) {
127 $a_ids = array($a_ids);
131 if ($a_entity ==
"calendar") {
132 switch ($a_version) {
135 " FROM cal_categories " .
137 $this->db->in(
"cat_id", $a_ids,
false,
"integer"));
143 if ($a_entity ==
"cal_assignment") {
144 switch ($a_version) {
147 " FROM cal_cat_assignments " .
149 $this->db->in(
"cat_id", $a_ids,
false,
"integer"));
155 if ($a_entity ==
"cal_entry") {
156 switch ($a_version) {
159 " starta, enda, informations, auto_generated, context_id, translation_type, notification " .
160 " FROM cal_entries " .
162 $this->db->in(
"cal_id", $a_ids,
false,
"integer"));
168 if ($a_entity ==
"recurrence_rule") {
169 switch ($a_version) {
171 $this->
getDirectDataFromQuery(
"SELECT rule_id, cal_id entry_id, cal_recurrence, freq_type, freq_until_date, freq_until_count, " .
172 " intervall, byday, byweekno, bymonth, bymonthday, byyearday, bysetpos, weekstart " .
173 " FROM cal_recurrence_rules " .
175 $this->db->in(
"cal_id", $a_ids,
false,
"integer"));
187 ?array $a_rec =
null,
194 foreach ($assignmnts as $cal_id) {
195 $entries[$cal_id] = $cal_id;
198 "cal_entry" => array(
"ids" => $entries),
199 "cal_assignment" => array(
"ids" => $a_rec[
"CatId"] ??
null)
203 "recurrence_rule" => array(
"ids" => $a_rec[
"Id"] ?? null)
218 string $a_schema_version
224 if (($a_rec[
"Type"] ?? 0) == 1) {
225 $usr_id = (
int) $a_mapping->
getMapping(
"components/ILIAS/User",
"usr", $a_rec[
"ObjId"]);
228 $category->setTitle((
string) $a_rec[
"Title"]);
229 $category->setColor((
string) $a_rec[
"Color"]);
231 $category->setObjId((
int) $usr_id);
234 "components/ILIAS/Calendar",
237 (
string) $category->getCategoryID()
246 if ((
int) ($a_rec[
"ContextId"] ?? 0) == 0) {
248 $entry->setTitle((
string) $a_rec[
"Title"]);
249 $entry->setSubtitle((
string) $a_rec[
"Subtitle"]);
250 $entry->setDescription((
string) $a_rec[
"Description"]);
251 $entry->setLocation((
string) $a_rec[
"Location"]);
252 $entry->setFullday((
bool) $a_rec[
"Fullday"]);
253 if ($a_rec[
"Starta"] !=
"") {
256 if (($a_rec[
"Enda"] ??
'') !=
"") {
259 $entry->setFurtherInformations((
string) ($a_rec[
"Informations"] ??
''));
260 $entry->setAutoGenerated((
bool) ($a_rec[
"AutoGenerated"] ??
false));
261 $entry->setContextId((
int) ($a_rec[
"ContextId"] ?? 0));
262 $entry->setTranslationType((
int) ($a_rec[
"TranslationType"] ?? 0));
263 $entry->enableNotification((
bool) ($a_rec[
"Notification"] ??
false));
266 "components/ILIAS/Calendar",
269 (
string) $entry->getEntryId()
274 case "cal_assignment":
275 $cat_id = (
int) $a_mapping->
getMapping(
"components/ILIAS/Calendar",
"calendar", $a_rec[
"CatId"]);
276 $entry_id = (
int) $a_mapping->
getMapping(
"components/ILIAS/Calendar",
"cal_entry", $a_rec[
"EntryId"]);
277 if ($cat_id > 0 && $entry_id > 0) {
279 $ass->addAssignment($cat_id);
283 case "recurrence_rule":
284 $entry_id = $a_mapping->
getMapping(
"components/ILIAS/Calendar",
"cal_entry", $a_rec[
"EntryId"]);
287 $rec->setEntryId((
int) $entry_id);
288 $rec->setRecurrence((
int) $a_rec[
"CalRecurrence"]);
289 $rec->setFrequenceType((
string) $a_rec[
"FreqType"]);
290 if ($a_rec[
"FreqUntilDate"] !=
"") {
293 $rec->setFrequenceUntilCount((
int) $a_rec[
"FreqUntilCount"]);
294 $rec->setInterval((
int) ($a_rec[
"Interval"] ?? 0));
295 $rec->setBYDAY((
string) ($a_rec[
"Byday"] ??
''));
296 $rec->setBYWEEKNO((
string) ($a_rec[
"Byweekno"] ??
''));
297 $rec->setBYMONTH((
string) ($a_rec[
"Bymonth"] ??
''));
298 $rec->setBYMONTHDAY((
string) ($a_rec[
"Bymonthday"] ??
''));
299 $rec->setBYYEARDAY((
string) ($a_rec[
"Byyearday"] ??
''));
300 $rec->setBYSETPOS((
string) ($a_rec[
"Bysetpos"] ??
''));
301 $rec->setWeekstart((
string) ($a_rec[
"Weekstart"] ??
''));
304 "components/ILIAS/Calendar",
307 (
string) $rec->getRecurrenceId()
getXmlNamespace(string $a_entity, string $a_schema_version)
getTypes(string $a_entity, string $a_version)
readData(string $a_entity, string $a_version, array $a_ids)
Stores calendar categories.
addMapping(string $a_comp, string $a_entity, string $a_old_id, string $a_new_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getMapping(string $a_comp, string $a_entity, string $a_old_id)
importRecord(string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
getDirectDataFromQuery(string $a_query, bool $a_convert_to_leading_upper=true, bool $a_set=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
static _getAssignedAppointments(array $a_cat_id)
Get assigned apointments.
static _lookupType(int $id, bool $reference=false)
getDependencies(string $a_entity, string $a_version, ?array $a_rec=null, ?array $a_ids=null)