1
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
|
2
|
<html>
|
3
|
<head>
|
4
|
<title>iCalcreator 2.18 summary</title>
|
5
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
6
|
<meta name="author" content="Kjell-Inge Gustafsson, kigkonsult, All rights reserved">
|
7
|
<meta name="copyright" content="2007-2013 Kjell-Inge Gustafsson, kigkonsult">
|
8
|
<meta name="keywords" content="ical, calendar, calender, xcal, xml, icalender, rfc2445, rfc5545, vcalender, php, create">
|
9
|
<meta name="description" content="iCalcreator summary" />
|
10
|
<style type="text/css">
|
11
|
body {
|
12
|
FONT-FAMILY : "Lucida Grande","Lucida Sans Unicode", "Bitstream Vera Sans", Lucida, Arial, Geneva, Helvetica, sans-serif;
|
13
|
FONT-SIZE : small;
|
14
|
MARGIN : 10px;
|
15
|
WIDTH : 800px;
|
16
|
}
|
17
|
h1 {
|
18
|
FONT-SIZE : large;
|
19
|
FONT-WEIGHT : bold;
|
20
|
}
|
21
|
h2 {
|
22
|
FONT-SIZE : large;
|
23
|
}
|
24
|
h3 {
|
25
|
FONT-SIZE : medium;
|
26
|
}
|
27
|
h4 {
|
28
|
FONT-SIZE : small;
|
29
|
FONT-WEIGHT : bold;
|
30
|
}
|
31
|
h5 {
|
32
|
FONT-SIZE : small;
|
33
|
FONT-WEIGHT : normal;
|
34
|
TEXT-DECORATION : underline;
|
35
|
}
|
36
|
pre {
|
37
|
BACKGROUND-COLOR: #DCDCDC;
|
38
|
FONT-FAMILY : monospace;
|
39
|
FONT-SIZE : medium;
|
40
|
LETTER-SPACING : 0.1em;
|
41
|
LINE-HEIGHT : 1.5em;
|
42
|
WHITE-SPACE : pre-wrap;
|
43
|
WHITE-SPACE : -moz-pre-wrap;
|
44
|
WHITE-SPACE : -pre-wrap;
|
45
|
WHITE-SPACE : -o-pre-wrap;
|
46
|
WORD-WRAP : break-word;
|
47
|
}
|
48
|
.comment {
|
49
|
FONT-FAMILY : arial;
|
50
|
FONT-SIZE : small;
|
51
|
FONT-STYLE : italic;
|
52
|
}
|
53
|
</style>
|
54
|
</head>
|
55
|
<body>
|
56
|
|
57
|
<h1>iCalcreator v2.18</h1>
|
58
|
<p>
|
59
|
iCalcreator v2.18<br>
|
60
|
Copyright (c) 2007-2013 Kjell-Inge Gustafsson, kigkonsult, All rights reserved.<br>
|
61
|
<a href="http://kigkonsult.se/iCalcreator/index.php" title="kigkonsult.se/iCalcreator" target="_blank">kigkonsult.se iCalcreator</a><br>
|
62
|
<a href="http://kigkonsult.se/contact/index.php" title="kigkonsult.se contact" target="_blank">kigkonsult.se contact</a>
|
63
|
</p>
|
64
|
<h4>Preface</h2>
|
65
|
<p>
|
66
|
This document is provided by kigkonsult for informational purposes
|
67
|
and is provided on an "as is" basis without any warranties expressed or implied.
|
68
|
</p>
|
69
|
<p>
|
70
|
Information in this document is subject to change without notice and does
|
71
|
not represent a commitment on the part of kigkonsult.
|
72
|
The software described in this document is provided under a license agreement, <a href="http://kigkonsult.se/downloads/dl.php?f=GPL">GNU Lesser General Public License</a>.
|
73
|
The software may be used only in accordance with the terms of that license agreement.
|
74
|
It is against the law to copy or use the software except as specifically allowed in the license agreement.
|
75
|
</p>
|
76
|
<p>
|
77
|
It is the users responsibility to ensure the suitability of the software before using it.
|
78
|
In no circumstances will kigkonsult be responsible for
|
79
|
the use of the software's outcomes or results or any loss
|
80
|
or damage of data or programs as a result of using the software.
|
81
|
The use of the software implies acceptance of these terms.
|
82
|
</p>
|
83
|
<p>
|
84
|
This document makes previous versions obsolete.
|
85
|
</p>
|
86
|
<h4>The software</h2>
|
87
|
<p>
|
88
|
This document describes a <b>short summary</b> usage of iCalcreator, a <em>PHP</em> software implementation of standards rfc5545/rfc5546 (rfc2445/rfc2446) to manage iCal formatted files.
|
89
|
</p>
|
90
|
<p>
|
91
|
iCalcreator is a <em>PHP</em> class package managing iCal files, supporting (non-)<strong>calendar</strong>
|
92
|
systems and applications to process and communicate <strong>calendar</strong> information like
|
93
|
events, agendas, tasks, reports, totos and journaling information.
|
94
|
</p>
|
95
|
<p>
|
96
|
The iCalcreator package, built of a <strong>calendar</strong> class with support of a function class and helper functions, are <strong>calendar</strong>
|
97
|
component property oriented. Development environment is <em>PHP</em> version 5.x but coding is done
|
98
|
to meet 4.x backward compatibility and may work. Some functions requires <em>PHP</em> >= 5.2.0.
|
99
|
</p>
|
100
|
<p>
|
101
|
The iCalcreator main class, utility class and helper functions are included in the "iCalcreator.class.php" file.
|
102
|
</p>
|
103
|
<p>
|
104
|
More iCalcreator supplementary, usage and "howto" information will be found at kigkonsult.se iCalcreator
|
105
|
<a href="http://kigkonsult.se/test/index.php" title="kigkonsult.se iCalcreator implement and test examples" target="_blank">coding and test</a> pages.
|
106
|
A strong recommendation is to have the document
|
107
|
<a href="http://kigkonsult.se/iCalcreator/docs/using.html" title="iCalcreator user's Manual" target="_blank">user's manual</a>
|
108
|
open in parallel when exploiting the link.
|
109
|
</p>
|
110
|
|
111
|
<h4>iCal</h4>
|
112
|
<p>
|
113
|
A short iCal description is found at <a href="http://en.wikipedia.org/wiki/ICalendar#Core_object" title="iCalendar From Wikipedia, the free encyclopedia" target="_blank">Wikipedia</a>.
|
114
|
If You are not familiar with iCal, read this first!
|
115
|
</p>
|
116
|
<p>
|
117
|
Knowledge of <strong>calendar</strong> protocol rfc5545/rfc5546 is to recommend;
|
118
|
</p>
|
119
|
<dl>
|
120
|
<dt><a href="http://kigkonsult.se/downloads/dl.php?f=rfc5545" title="Download RFC5545 in text format" target="_blank">rfc5545</a>
|
121
|
<dd>Internet Calendaring and Scheduling Core Object Specification (iCalendar)
|
122
|
<dd>obsoletes <a href="http://kigkonsult.se/downloads/dl.php?f=rfc2445" title="Download RFC2445 in text format">rfc2445</a>
|
123
|
<dt><a href="http://kigkonsult.se/downloads/dl.php?f=rfc5546" title="Download RFC5546 in text format" target="_blank">rfc5546</a>
|
124
|
<dd>iCalendar Transport-Independent Interoperability Protocol (iTIP) Scheduling Events, BusyTime, To-dos and Journal Entries
|
125
|
<dd>obsoletes <a href="http://kigkonsult.se/downloads/dl.php?f=rfc2446" title="Download RFC2446 in text format">rfc2446</a>.
|
126
|
</dl>
|
127
|
|
128
|
<h4>xCal</h4>
|
129
|
<p>
|
130
|
iCalcreator also supports xCal (iCal xml).
|
131
|
</p>
|
132
|
<dl>
|
133
|
<dt>
|
134
|
<dt><a href="http://kigkonsult.se/downloads/dl.php?f=rfc6321" title="Download RFC6321 in text format" target="_blank">rfc6321</a>
|
135
|
<dd>xCal: The XML Format for <strong>iCalendar</strong>
|
136
|
</dl>
|
137
|
|
138
|
<h4>SUPPORT</h4>
|
139
|
<p>
|
140
|
The main support channel is using iCalcreator
|
141
|
<a title="Sourceforge" href="http://sourceforge.net/projects/icalcreator/forums/" target="_blank">Sourceforge</a> forum.
|
142
|
</p>
|
143
|
<p>
|
144
|
Support and development is now focused on iCalcreator (Pro) 3.x versions, which, in turn, will affect future releases
|
145
|
of iCalcreator 2.x.
|
146
|
</p>
|
147
|
<p>
|
148
|
kigkonsult offer services for software support, design and development of customizations and adaptations of <em>PHP</em>/<em>MySQL</em> solutions
|
149
|
with a special focus on software long term utility and reliability,
|
150
|
supported through our agile acquire/design/transition process model.
|
151
|
</p>
|
152
|
|
153
|
<h4>DONATE</h4>
|
154
|
<p>
|
155
|
You can show your appreciation for our free software,
|
156
|
and can support future development by making a donation to the kigkonsult GPL/LGPL projects.
|
157
|
</p>
|
158
|
<p>
|
159
|
Make a donation of any size by clicking <a href="http://kigkonsult.se/contact/index.php#Donate" title="Donate" target="_blank">here</a>.
|
160
|
Thanks in advance!
|
161
|
</p>
|
162
|
|
163
|
<h4>Contact</h4>
|
164
|
<p>
|
165
|
Use the <a href="http://kigkonsult.se/contact/index.php" title="kigkonsult.se/contact" target="_blank">contact page</a>
|
166
|
for queries, improvement/development issues or professional support and development.
|
167
|
Please note that paid support or consulting service has the highest priority.
|
168
|
</p>
|
169
|
|
170
|
<h4>Downloads and usage examples</h4>
|
171
|
<p>
|
172
|
At <a href="http://kigkonsult.se/iCalcreator/index.php" title="kigkonsult iCalcreator" target="_blank">kigkonsult.se</a> you can download the
|
173
|
<a href="http://kigkonsult.se/downloads/index.php#iCalcreator" title="iCalcreator complete manual" target="_blank">complete manual</a>
|
174
|
and review and explore iCalcreator usage at the
|
175
|
<a href="http://kigkonsult.se/test/index.php" title="kigkonsult.se iCalcreator implement and test examples" target="_blank">coding and test</a> pages.
|
176
|
</p>
|
177
|
|
178
|
<h4>INSTALL</h4>
|
179
|
<dl>
|
180
|
<dt>Unpack to any folder
|
181
|
<dd>add this folder to your include-path
|
182
|
<dd>or unpack to your application-(include)-folder<br>
|
183
|
</dl>
|
184
|
<p>
|
185
|
Add
|
186
|
</p>
|
187
|
<pre><?php
|
188
|
.. .
|
189
|
require_once './iCalcreator.class.php';
|
190
|
.. .
|
191
|
?>
|
192
|
</pre>
|
193
|
<p>
|
194
|
to your php-script.
|
195
|
</p>
|
196
|
<p>
|
197
|
When creating a new calendar(/component) object instance, review config settings.
|
198
|
</p>
|
199
|
<p>
|
200
|
To really boost performance, visit kigkonsult.se contact <a href="http://kigkonsult.se/contact/index.php"><u>page</u></a> for information.
|
201
|
</p>
|
202
|
|
203
|
|
204
|
<h2>CREATE</h2>
|
205
|
|
206
|
<pre><?php
|
207
|
.. .
|
208
|
require_once( "iCalcreator.class.php" );
|
209
|
$tz = "Europe/Stockholm"; // <span class="comment">define time zone</span>
|
210
|
$config = array( "unique_id" => "kigkonsult.se", // <span class="comment">set Your unique id, </span>
|
211
|
// <span class="comment">required if any component UID is missing</span>
|
212
|
"TZID" => $tz ); // <span class="comment">opt. set "calendar" timezone</span>
|
213
|
$v = new vcalendar( $config ); // <span class="comment">create a new calendar object instance</span>
|
214
|
|
215
|
$v->setProperty( "method", "PUBLISH" ); // <span class="comment">required of some <strong>calendar</strong> software</span>
|
216
|
$v->setProperty( "x-wr-calname", "Calendar Sample" ); // <span class="comment">required of some <strong>calendar</strong> software</span>
|
217
|
$v->setProperty( "X-WR-CALDESC", "Calendar Description" ); // <span class="comment">required of some <strong>calendar</strong> software</span>
|
218
|
$v->setProperty( "X-WR-TIMEZONE", $tz ); // <span class="comment">required of some <strong>calendar</strong> software</span>
|
219
|
.. .
|
220
|
$xprops = array( "X-LIC-LOCATION" => $tz ); // <span class="comment">required of some <strong>calendar</strong> software</span>
|
221
|
iCalUtilityFunctions::createTimezone( $v, $tz, $xprops ); // <span class="comment">create timezone component(-s) <b>opt. 1</b></span>
|
222
|
.. . // <span class="comment">based on present date</span>
|
223
|
.. .
|
224
|
$vevent = & $v->newComponent( "vevent" ); // <span class="comment">create an event <strong>calendar</strong> component</span>
|
225
|
$vevent->setProperty( "dtstart", array( "year" => 2007
|
226
|
, "month" => 4
|
227
|
, "day" => 1
|
228
|
, "hour" => 19
|
229
|
, "min" => 0
|
230
|
, "sec" => 0 ));
|
231
|
$vevent->setProperty( "dtend", array( "year" => 2007
|
232
|
, "month" => 4
|
233
|
, "day" => 1
|
234
|
, "hour" => 22
|
235
|
, "min" => 30
|
236
|
, "sec" => 0 ));
|
237
|
$vevent->setProperty( "LOCATION", "Central Placa" ); // <span class="comment">property name - case independent</span>
|
238
|
$vevent->setProperty( "summary", "PHP summit" );
|
239
|
$vevent->setProperty( "description", "This is a description" );
|
240
|
$vevent->setProperty( "comment", "This is a comment" );
|
241
|
$vevent->setProperty( "attendee", "attendee1@icaldomain.net" );
|
242
|
.. .
|
243
|
$valarm = & $vevent->newComponent( "valarm" ); // <span class="comment">create an event alarm</span>
|
244
|
$valarm->setProperty("action", "DISPLAY" );
|
245
|
$valarm->setProperty("description", $vevent->getProperty( "description" );
|
246
|
.. . // <span class="comment">reuse the event description</span>
|
247
|
$d = sprintf( '%04d%02d%02d %02d%02d%02d', 2007, 3, 31, 15, 0, 0 );
|
248
|
iCalUtilityFunctions::transformDateTime( $d, $tz, "UTC", "Ymd\THis\Z");
|
249
|
$valarm->setProperty( "trigger", $d ); // <span class="comment">create alarm trigger (in UTC datetime)</span>
|
250
|
.. .
|
251
|
$vevent = & $v->newComponent( "vevent" ); // <span class="comment">create next event calendar component</span>
|
252
|
$vevent->setProperty( "dtstart", "20070401", array("VALUE" => "DATE"));// <span class="comment">alt. date format,</span>
|
253
|
// <span class="comment"> now for an all-day event</span>
|
254
|
$vevent->setProperty( "organizer" , "boss@icaldomain.com" );
|
255
|
$vevent->setProperty( "summary", "ALL-DAY event" );
|
256
|
$vevent->setProperty( "description", "This is a description for an all-day event" );
|
257
|
$vevent->setProperty( "resources", "COMPUTER PROJECTOR" );
|
258
|
$vevent->setProperty( "rrule", array( "FREQ" => "WEEKLY", "count" => 4));// <span class="comment">weekly, four occasions</span>
|
259
|
$vevent->parse( "LOCATION:1CP Conference Room 4350" ); // <span class="comment">supporting parse of</span>
|
260
|
// <span class="comment"> strict rfc5545 formatted text</span>
|
261
|
.. .
|
262
|
.. .// <span class="comment">all calendar components are described in <a href="http://kigkonsult.se/downloads/dl.php?f=rfc5545" title="RFC5545" target="_blank">rfc5545</a></span>
|
263
|
.. .// <span class="comment">a complete iCalcreator function list (ex. setProperty) in <a href="http://kigkonsult.se/downloads/index.php#iCalcreator" title="iCalcreator complete manual" target="_blank">iCalcreator manual</a></span>
|
264
|
.. .
|
265
|
iCalUtilityFunctions::createTimezone( $v, $tz, $xprops); // <span class="comment">create timezone component(-s) <b>opt. 2</b></span>
|
266
|
// <span class="comment">based on all start dates in events</span>
|
267
|
// <span class="comment">(i.e. dtstart)</span>
|
268
|
.. .
|
269
|
?>
|
270
|
</pre>
|
271
|
|
272
|
<h2>PARSE</h2>
|
273
|
<h4>iCal, rfc5545 / rfc2445 </h4>
|
274
|
<h5>create iCalcreator object instance</h5>
|
275
|
<pre><?php
|
276
|
.. .
|
277
|
require_once( "iCalcreator.class.php" );
|
278
|
$config = array( "unique_id" => "kigkonsult.se" ); // <span class="comment">set Your unique id, </span>
|
279
|
.. . // <span class="comment">required if any component UID is missing</span>
|
280
|
$v = new vcalendar( $config ); // <span class="comment">create a new <strong>calendar</strong> object instance</span>
|
281
|
.. .
|
282
|
</pre>
|
283
|
<h5>when parse a local iCal file</h5>
|
284
|
<pre>.. .
|
285
|
$config = array( "directory" => "calendar", "filename" => "file.ics" );
|
286
|
$v->setConfig( $config ); // <span class="comment">set directory and file name</span>
|
287
|
$v->parse();
|
288
|
.. . // <span class="comment">continue process (edit, parse,select)</span>
|
289
|
.. . // <span class="comment"> the iCalcreator object instance</span>
|
290
|
.. .
|
291
|
?>
|
292
|
</pre>
|
293
|
<h5>or parse a remote iCal file (resource)</h5>
|
294
|
<pre>.. .
|
295
|
$v->setConfig( "url", "http://www.aDomain.net/file.ics" ); // <span class="comment">supporting parse of remote files</span>
|
296
|
$v->parse();
|
297
|
.. .
|
298
|
$v->sort(); // <span class="comment">ensure start date order</span>
|
299
|
.. . // <span class="comment">(opt., <b>NOT</b> required after parse)</span>
|
300
|
.. .
|
301
|
.. . // <span class="comment">continue process (edit, parse,select)</span>
|
302
|
.. . // <span class="comment"> the iCalcreator object instance</span>
|
303
|
.. .
|
304
|
?>
|
305
|
</pre>
|
306
|
<p>
|
307
|
On error, the parse method returns FALSE.
|
308
|
</p>
|
309
|
<h4>xCal, rfc6321 (XML)</h4>
|
310
|
<pre><?php
|
311
|
.. .
|
312
|
require_once( "iCalcreator.class.php" );
|
313
|
$config = array( "unique_id" => "kigkonsult.se" ); // <span class="comment">set Your unique id, </span>
|
314
|
.. . // <span class="comment">required if any component UID is missing</span>
|
315
|
.. .
|
316
|
$filename = 'xmlfile.xml'; // <span class="comment">use a local xCal file</span>
|
317
|
// $filename = 'http://kigkonsult.se/xcal.php?a=1&b=2&c=3';// <span class="comment"> or a remote xCal resource</span>
|
318
|
if( FALSE === ( $v = XMLfile2iCal( $filename, $config ))) // <span class="comment">convert the XML resource</span>
|
319
|
exit( "Error when parsing $filename" ); // <span class="comment"> to an iCalcreator object instance</span>
|
320
|
.. . // <span class="comment">continue process (edit, parse,select)</span>
|
321
|
.. . // <span class="comment"> the iCalcreator object instance</span>
|
322
|
.. .
|
323
|
?>
|
324
|
</pre>
|
325
|
|
326
|
|
327
|
<h2>EDIT</h2>
|
328
|
<pre><?php
|
329
|
.. .
|
330
|
require_once( "iCalcreator.class.php" );
|
331
|
$config = array( "unique_id" => "kigkonsult.se" // <span class="comment">set Your unique id,</span>
|
332
|
, "directory" => "calendar" // <span class="comment">import directory</span>
|
333
|
, "filename" => "file.ics" ); // <span class="comment"> and file name</span>
|
334
|
|
335
|
$v = new vcalendar( $config ); // <span class="comment">create a new calendar object instance</span>
|
336
|
|
337
|
$v->parse();
|
338
|
|
339
|
$v->setProperty( "method", "PUBLISH" ); // <span class="comment">required of some <strong>calendar</strong> software</span>
|
340
|
$v->setProperty( "x-wr-calname", "Calendar Sample" ); // <span class="comment">required of some <strong>calendar</strong> software</span>
|
341
|
$v->setProperty( "X-WR-CALDESC", "Calendar Description" ); // <span class="comment">required of some <strong>calendar</strong> software</span>
|
342
|
$v->setProperty( "X-WR-TIMEZONE", "Europe/Stockholm" ); // <span class="comment">required of some <strong>calendar</strong> software</span>
|
343
|
|
344
|
while( $vevent = $v->getComponent( "vevent" )) { // <span class="comment">read events, one by one</span>
|
345
|
$uid = $vevent->getProperty( "uid" ); // <span class="comment">uid required, one occurrence</span>
|
346
|
.. . // <span class="comment"> (unique id/key for component)</span>
|
347
|
$dtstart = $vevent->getProperty( "dtstart" ); // <span class="comment">dtstart required, one occurrence</span>
|
348
|
.. .
|
349
|
if( $description = $vevent->getProperty( "description", 1 )) { // <span class="comment">opt. description, 1st occurrence</span>
|
350
|
.. . // <span class="comment">edit the description</span>
|
351
|
$vevent->setProperty( "description", $description, FALSE, 1 ); // <span class="comment">update/replace the description</span>
|
352
|
}
|
353
|
while( $comment = $vevent->getProperty( "comment" )) { // <span class="comment">optional comments</span>
|
354
|
.. . // <span class="comment">manage comments</span>
|
355
|
}
|
356
|
.. .
|
357
|
while( $vevent->deleteProperty( "attendee" ))
|
358
|
continue; // <span class="comment">remove all ATTENDEE properties .. .</span>
|
359
|
.. .
|
360
|
$v->setComponent ( $vevent, $uid ); // <span class="comment">update/replace event in calendar</span>
|
361
|
// <span class="comment"> with <b>UID</b> as key</span>
|
362
|
}
|
363
|
.. .
|
364
|
.. .// <span class="comment">a complete iCalcreator function list (ex. getProperty, deleteProperty) in <a href="http://kigkonsult.se/downloads/index.php#iCalcreator" title="iCalcreator complete manual" target="_blank">iCalcreator manual</a></span>
|
365
|
.. .
|
366
|
?>
|
367
|
</pre>
|
368
|
<br>
|
369
|
<br>
|
370
|
|
371
|
<h2>SELECT</h2>
|
372
|
<pre><?php
|
373
|
.. .
|
374
|
require_once( "iCalcreator.class.php" );
|
375
|
$config = array( "unique_id" => "kigkonsult.se" ); // <span class="comment">set Your unique id</span>
|
376
|
$v = new vcalendar( $config ); // <span class="comment">create a new <strong>calendar</strong> object instance</span>
|
377
|
|
378
|
$v->setConfig( "url", "http://www.aDomain.net/file.ics" ); // <span class="comment">iCalcreator also support remote files</span>
|
379
|
$v->parse();
|
380
|
|
381
|
$v->setProperty( "method", "PUBLISH" ); // <span class="comment">required of some <strong>calendar</strong> software</span>
|
382
|
$v->setProperty( "x-wr-calname", "Calendar Sample" ); // <span class="comment">required of some <strong>calendar</strong> software</span>
|
383
|
$v->setProperty( "X-WR-CALDESC", "Calendar Description" ); // <span class="comment">required of some <strong>calendar</strong> software</span>
|
384
|
$v->setProperty( "X-WR-TIMEZONE", "Europe/Stockholm" ); // <span class="comment">required of some <strong>calendar</strong> software</span>
|
385
|
.. .
|
386
|
?>
|
387
|
</pre>
|
388
|
<h4>Date based select</h4>
|
389
|
<pre><?php
|
390
|
.. .
|
391
|
$eventArray = $v->selectComponents(); // <span class="comment">select components occurring <b>today</b></span>
|
392
|
// <span class="comment">(including components</span>
|
393
|
// <span class="comment">with recurrence pattern)</span>
|
394
|
foreach( $eventArray as $year => $yearArray) {
|
395
|
foreach( $yearArray as $month => $monthArray ) {
|
396
|
foreach( $monthArray as $day => $dailyEventsArray ) {
|
397
|
foreach( $dailyEventsArray as $vevent ) {
|
398
|
$currddate = $event->getProperty( "x-current-dtstart" );
|
399
|
// <span class="comment">if member of a recurrence set</span>
|
400
|
// <span class="comment">(2nd occurrence etc)</span>
|
401
|
// <span class="comment">returns array( </span>
|
402
|
// <span class="comment"> "x-current-dtstart"</span>
|
403
|
// <span class="comment"> , (string) date(</span>
|
404
|
// <span class="comment"> "Y-m-d [H:i:s][timezone/UTC offset]"))</span>
|
405
|
$dtstart = $vevent->getProperty( "dtstart" ); // <span class="comment">dtstart required, one occurrence,</span>
|
406
|
// <span class="comment"> (orig. start date)</span>
|
407
|
$summary = $vevent->getProperty( "summary" );
|
408
|
$description = $vevent->getProperty( "description" );
|
409
|
.. .
|
410
|
.. .
|
411
|
}
|
412
|
}
|
413
|
}
|
414
|
}
|
415
|
.. .
|
416
|
?>
|
417
|
</pre>
|
418
|
<h4>Select specific property values</h4>
|
419
|
<pre><?php
|
420
|
.. .
|
421
|
$valueOccur = $v->getProperty( "RESOURCES" ); // <span class="comment">fetch specific property</span>
|
422
|
// <span class="comment">(unique) values and occurrences</span>
|
423
|
// <span class="comment">ATTENDEE, CATEGORIES, CONTACT,</span>
|
424
|
// <span class="comment">DTSTART, LOCATION, ORGANIZER,</span>
|
425
|
// <span class="comment">PRIORITY, RESOURCES, STATUS,</span>
|
426
|
// <span class="comment">SUMMARY, UID, URL,</span>
|
427
|
// <span class="comment">GEOLOCATION<sup>*</sup></span>
|
428
|
foreach( $valueOccur as $uniqueValue => $occurCnt ) {
|
429
|
echo "The RESOURCES value <b>$uniqueValue</b> occurs <b>$occurCnt</b> times<br />";
|
430
|
.. .
|
431
|
}
|
432
|
.. .
|
433
|
?>
|
434
|
</pre>
|
435
|
<p>
|
436
|
<sup>*</sup>) Using the non-standard directive "GEOLOCATION", iCalcreator returns output supporting
|
437
|
ISO6709 "Standard representation of geographic point location by coordinates",
|
438
|
by combining the "LOCATION" and "GEO" property values (only if "GEO" is set).
|
439
|
</p>
|
440
|
<h4>Select components based on specific property value</h4>
|
441
|
<pre><?php
|
442
|
.. .
|
443
|
$selectSpec = array( "CATEGORIES" => "course1" );
|
444
|
$specComps = $v->selectComponents( $selectSpec ); // <span class="comment">selects components</span>
|
445
|
// <span class="comment">based on specific property value(-s)</span>
|
446
|
// <span class="comment">ATTENDEE, CATEGORIES, CONTACT,</span>
|
447
|
// <span class="comment">LOCATION, ORGANIZER,</span>
|
448
|
// <span class="comment">PRIORITY, RESOURCES, STATUS,</span>
|
449
|
// <span class="comment">SUMMARY, URL, UID</span>
|
450
|
foreach( $specComps as $comp ) {
|
451
|
.. .
|
452
|
}
|
453
|
.. .
|
454
|
?>
|
455
|
</pre>
|
456
|
<br>
|
457
|
<br>
|
458
|
|
459
|
<h2>OUTPUT</h2>
|
460
|
<h5>create iCalcreator object instance</h5>
|
461
|
<pre><?php
|
462
|
.. .
|
463
|
require_once( "iCalcreator.class.php" );
|
464
|
$config = array( "unique_id" => "kigkonsult.se" ); // <span class="comment">set Your unique id</span>
|
465
|
$v = new vcalendar( $config ); // <span class="comment">create a new calendar object instance</span>
|
466
|
|
467
|
$v->setProperty( "method", "PUBLISH" ); // <span class="comment">required of some <strong>calendar</strong> software</span>
|
468
|
$v->setProperty( "x-wr-calname", "Calendar Sample" ); // <span class="comment">required of some <strong>calendar</strong> software</span>
|
469
|
$v->setProperty( "X-WR-CALDESC", "Calendar Description" ); // <span class="comment">required of some <strong>calendar</strong> software</span>
|
470
|
$v->setProperty( "X-WR-TIMEZONE", "Europe/Stockholm" ); // <span class="comment">required of some <strong>calendar</strong> software</span>
|
471
|
.. .
|
472
|
.. . // <span class="comment">continue process (edit, parse,select)</span>
|
473
|
.. . // <span class="comment"> the iCalcreator object instance</span>
|
474
|
.. .
|
475
|
?>
|
476
|
</pre>
|
477
|
<h5>opt 1</h5>
|
478
|
<pre><?php
|
479
|
.. .
|
480
|
$v->returnCalendar(); // <span class="comment">redirect calendar file to browser</span>
|
481
|
?>
|
482
|
</pre>
|
483
|
|
484
|
<h5>opt 2</h5>
|
485
|
<pre><?php
|
486
|
.. .
|
487
|
$config = array( "directory" => "depot", "filename" => "calendar.ics" );
|
488
|
$v->setConfig( $config ); // <span class="comment">set output directory and file name</span>
|
489
|
$v->saveCalendar(); // <span class="comment">save calendar to (local) file</span>
|
490
|
.. .
|
491
|
?>
|
492
|
</pre>
|
493
|
|
494
|
<h5>opt 3, xCal</h5>
|
495
|
<pre><?php
|
496
|
.. .
|
497
|
$mlstr = iCal2XML( $v ); // <span class="comment">create well-formed XML, rfc6321</span>
|
498
|
.. .
|
499
|
?>
|
500
|
</pre>
|
501
|
<br>
|
502
|
<br>
|
503
|
|
504
|
|
505
|
<h2>COPYRIGHT AND LICENSE</h2>
|
506
|
|
507
|
<h4>Copyright</h4>
|
508
|
<p>
|
509
|
iCalcreator v2.18<br>
|
510
|
Copyright (c) 2007-2013 Kjell-Inge Gustafsson, kigkonsult, All rights reserved.<br>
|
511
|
<a href="http://kigkonsult.se/iCalcreator/index.php" title="kigkonsult.se/iCalcreator" target="_blank">kigkonsult.se iCalcreator</a><br>
|
512
|
<a href="http://kigkonsult.se/contact/index.php" title="kigkonsult.se contact" target="_blank">kigkonsult.se contact</a>
|
513
|
</p>
|
514
|
|
515
|
<h4>License</h4>
|
516
|
|
517
|
<p>
|
518
|
This library is free software; you can redistribute it and/or
|
519
|
modify it under the terms of the GNU Lesser General Public
|
520
|
License as published by the Free Software Foundation; either
|
521
|
version 2.1 of the License, or (at your option) any later version.
|
522
|
</p>
|
523
|
<p>
|
524
|
This library is distributed in the hope that it will be useful,
|
525
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
526
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
527
|
Lesser General Public License for more details.
|
528
|
</p>
|
529
|
<p>
|
530
|
You should have received a copy of the GNU Lesser General Public
|
531
|
License along with this library; if not, write to the Free Software
|
532
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
533
|
or download it <a href="http://kigkonsult.se/downloads/dl.php?f=LGPL" target="_blank">here</a>.
|
534
|
</p>
|
535
|
<br>
|
536
|
<br>
|
537
|
</body>
|
538
|
</html>
|