26 "begin_calendar" => String,
30 "begin_timezone" => String,
32 "begin_standard" => String,
33 "standard_start" => String,
34 "standard_offset" => String,
35 "standard_dst_offset" => String,
36 "standard_rrule" => String,
37 "standard_name" => String,
38 "end_standard" => String,
39 "begin_daylight" => String,
40 "daylight_start" => String,
41 "daylight_offset" => String,
42 "daylight_dst_offset" => String,
43 "daylight_rrule" => String,
44 "daylight_name" => String,
45 "end_daylight" => String,
46 "end_timezone" => String,
47 "begin_event" => String,
48 "organizer" => String,
54 "event_status" => String,
55 "display_status" => String,
59 "last_modified" => String,
60 "description" => HTML,
64 "end_event" => String,
65 "end_calendar" => String,
69 "begin_calendar" =>
"BEGIN",
70 "begin_event" =>
"BEGIN",
71 "event_status" =>
"STATUS",
72 "display_status" =>
"X-MICROSOFT-CDO-INTENDEDSTATUS",
73 "last_modified" =>
"LAST-MODIFIED",
75 "end_calendar" =>
"END",
77 "begin_timezone" =>
"BEGIN",
79 "begin_standard" =>
"BEGIN",
80 "standard_start" =>
"DTSTART",
81 "standard_offset" =>
"TZOFFSETFROM",
82 "standard_dst_offset" =>
"TZOFFSETTO",
83 "standard_rrule" =>
"RRULE",
84 "standard_name" =>
"TZNAME",
85 "end_standard" =>
"END",
87 "begin_daylight" =>
"BEGIN",
88 "daylight_start" =>
"DTSTART",
89 "daylight_offset" =>
"TZOFFSETFROM",
90 "daylight_dst_offset" =>
"TZOFFSETTO",
91 "daylight_rrule" =>
"RRULE",
92 "daylight_name" =>
"TZNAME",
93 "end_daylight" =>
"END",
95 "end_timezone" =>
"END",
100 $this->primary_key =
"icalendar_uid";
101 $this->table =
"icalendar";
103 $this->DataItem(func_get_args());
163 $this->data->set(
"summary",
$title);
164 $this->data->set(
"description", $description);
165 $this->data->set(
"location", $location);
170 $this->data->set(
"uid", $uid);
172 $this->data->set(
"sequence", $sequence_id);
174 $this->data->set(
"dtstart",
$start);
175 $this->data->set(
"dtend", $end);
177 $today =
new DateTime(now());
178 $this->data->set(
"dtstamp",
$today->format(
'Ymd\THis'));
180 $this->data->filter =
new ExclusionFilter(
"last_modified",
"standard_rrule",
"daylight_rrule");
184 $this->data->set(
"priority", 5);
185 $this->data->set(
"class",
"PUBLIC");
187 $this->data->set(
"begin_calendar",
"VCALENDAR");
188 $this->data->set(
"prodid",
"-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN");
189 $this->data->set(
"version",
"2.0");
190 $this->data->set(
"begin_event",
"VEVENT");
191 $this->data->set(
"transp",
"OPAQUE");
192 $this->data->set(
"display_status",
"BUSY");
193 $this->data->set(
"end_event",
"VEVENT");
194 $this->data->set(
"end_calendar",
"VCALENDAR");
195 $this->data->set(
"method",
"REQUEST");
196 $this->data->set(
"event_status",
"CONFIRMED");
205 $aliases = $this->data->getFieldAliases();
211 $this->aliases[
$field] = $alias;
223 $startObj =
new DateTime(
$start);
224 $endObj =
new DateTime($end);
228 $start_value =
";VALUE=DATE:" . $startObj->format(
"Ymd");
229 $end_value =
";VALUE=DATE:" . $endObj->format(
"Ymd");
233 $start_value = $startObj->format(
'Ymd\THis');
234 $end_value = $endObj->format(
'Ymd\THis');
240 $this->data->set(
"dtstart",
";TZID=" . $timeZone->time_zone_name .
":". $start_value);
241 $this->data->set(
"dtend",
";TZID=" . $timeZone->time_zone_name .
":". $end_value);
246 $this->data->set(
"dtstart", $start_value);
247 $this->data->set(
"dtend", $end_value);
261 $this->data->set(
"begin_timezone",
"VTIMEZONE");
262 $this->data->set(
"begin_standard",
"STANDARD");
263 $this->data->set(
"end_standard",
"STANDARD");
264 $this->data->set(
"begin_daylight",
"DAYLIGHT");
265 $this->data->set(
"end_daylight",
"DAYLIGHT");
266 $this->data->set(
"end_timezone",
"VTIMEZONE");
268 $this->data->set(
"tzid", $timeZone->get(
"time_zone_name"));
273 $this->data->set(
"standard_name",
"EST");
274 $this->data->set(
"daylight_name",
"EDT");
275 $this->data->set(
"standard_offset", $standard_offset);
276 $this->data->set(
"standard_dst_offset", $daylight_offset);
277 $this->data->set(
"daylight_offset", $daylight_offset);
278 $this->data->set(
"daylight_dst_offset", $standard_offset);
280 $this->data->set(
"standard_start", $start_value);
281 $this->data->set(
"daylight_start", $start_value);
314 $out = str_pad($hour, 2, STR_PAD_LEFT) . $min;
330 $filter = $this->data->getFilter();
333 $filter =
new ExclusionFilter();
336 $fields = $this->data->getFields();
340 if(
$name ==
"begin_timezone")
348 if(
$name ==
"end_timezone")
357 if(preg_match(
"/00:00:00$/",
$date))
389 $this->attendeeName =
$name;
404 if($this->replyToName)
406 $organizer .=
";CN={$this->replyToName}";
409 $organizer .=
":MAILTO:{$this->replyTo}";
427 $attendee .=
";ROLE=REQ-PARTICIPANT";
430 if($this->attendeeStatus)
432 $attendee .=
";PARTSTAT={$this->attendeeStatus}";
437 $attendee .=
";RSVP=true";
440 if($this->attendeeName)
442 $attendee .=
";CN={$this->attendeeName}";
445 $attendee .=
":MAILTO:{$this->mailTo}";
489 $filter = $this->data->getFilter();
490 $fields = $this->data->getFields();
491 foreach (array_keys($fields) as
$field)
495 $label = strtoupper(
$field);
496 if(array_key_exists(
$field, $this->aliases))
498 $label = $this->aliases[
$field];
501 $value = $this->data->$field;
502 if(!preg_match(
"/^;|:/", $value))
504 $value =
":". $value;
506 $properties[] = $label . $value;
511 $out .= implode(
"\n", $properties);
Dummy datamodel to helper manage the calendar data values.
Note: we may wish to add someting like this to description:
$required
ROLE=REQ-PARTICIPANT if required to attend.
$rsvp
organizer wants reply
$attendeeStatus
PARSTAT=TENTATIVE, PARSTAT=NEEDS-ACTION.
$replyTo
organizer email set in EmailHandler
$aliases
field aliases or labels
formatOrganizer()
We wait until final formatting of the iCalendar data to set the organizer properties because values c...
setEventDates($start, $end, $timeZone)
For all day events: DTSTART;VALUE=DATE:20100101 DTEND;VALUE=DATE:20100101.
formatAttendee()
Given all the settings applied to vars, build the ATTENDEE property to be used in the calendar invita...
setOrganizer($replyTo, $replyToName="")
$invitees
optionally show others invited to event
format()
Given the icalendar data values and the var settings, format the iCalendar data into a list of proper...
$replyToName
organizer name set in EmailHandler
$mailTo
Attendee email address.
excludeTimeZoneFields()
If no time zone provided, exclude all fields between begin_timezone through end_timezone.
__construct($id, $start, $end, $title, $description="", $location="", $sequence_id=0, $timeZone=null)
The iCalendarManager obj is typically instantiated through the EventHandler for an event.
setAttendee($mailTo)
Called from EmailHandler to set the attendee email address.
$attendeeName
optionally include display name of recipient
setTimeZone($timeZone, $start_value)
If time zone is not provided, exlcude the time zone fields so they are not included in the output.
formatTimeZoneHours($offset)
Given the numeric time zone value (pos or neg), convert to hour format for iCalendar such as "-0700".