<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>iCalcreator 2.16 summary</title>
<meta name="author" content="Kjell-Inge Gustafsson - kigkonsult" />
<meta name="copyright" content="2007-2012 Kjell-Inge Gustafsson - kigkonsult" />
<meta name="keywords" content="ical, calendar, calender, xcal, xml, icalender, rfc2445, rfc5545, vcalender, php, create" />
<meta name="description" content="iCalcreator summary" />
<style type="text/css">
body {
FONT-FAMILY : "Lucida Grande","Lucida Sans Unicode", "Bitstream Vera Sans", Lucida, Arial, Geneva, Helvetica, sans-serif;
FONT-SIZE : small;
MARGIN : 10px;
WIDTH : 800px;
}
h1 {
FONT-SIZE : large;
FONT-WEIGHT : bold;
}
h2 {
FONT-SIZE : large;
}
h3 {
FONT-SIZE : medium;
}
h4 {
FONT-SIZE : small;
FONT-WEIGHT : bold;
}
h5 {
FONT-SIZE : small;
FONT-WEIGHT : normal;
TEXT-DECORATION : underline;
}
pre {
BACKGROUND-COLOR: #DCDCDC;
FONT-FAMILY : monospace;
FONT-SIZE : medium;
LETTER-SPACING : 0.1em;
LINE-HEIGHT : 1.5em;
WHITE-SPACE : pre-wrap; /* css-3 */
WHITE-SPACE : -moz-pre-wrap; /* Mozilla, since 1999 */
WHITE-SPACE : -pre-wrap; /* Opera 4-6 */
WHITE-SPACE : -o-pre-wrap; /* Opera 7 */
WORD-WRAP : break-word; /* Internet Explorer 5.5+ */
}
.comment {
FONT-FAMILY : arial;
FONT-SIZE : small;
FONT-STYLE : italic;
}
</style>
</head>
<body>
<h1>iCalcreator v2.16</h1>
<p>
iCalcreator v2.16<br>
copyright (c) 2007-2012 Kjell-Inge Gustafsson, kigkonsult<br>
<a href="http://kigkonsult.se/iCalcreator/index.php" title="kigkonsult.se/iCalcreator" target="_blank">kigkonsult.se iCalcreator</a><br>
<a href="http://kigkonsult.se/contact/index.php" title="kigkonsult.se/contact" target="_blank">kigkonsult.se contact</a>
</p>
<p>
iCalcreator is a <em>PHP</em> class package managing iCal files, supporting (non-)<strong>calendar</strong>
systems and applications to process and communicate <strong>calendar</strong> information like
events, agendas, tasks, reports, totos and journaling information.
</p>
<p>
This is a <b>short summary</b> how to use iCalcreator; create, parse, edit, select and output functionality.
</p>
<p>
The iCalcreator package, built of a <strong>calendar</strong> class with support of a function class and helper functions, are <strong>calendar</strong>
component property oriented. Development environment is <em>PHP</em> version 5.x but coding is done
to meet 4.x backward compatibility and may work. Some functions requires <em>PHP</em> >= 5.2.0.
</p>
<p>
The iCalcreator main class, utility class and helper functions are included in the "iCalcreator.class.php" file.
</p>
<p>
More iCalcreator supplementary, usage and "howto" information will be found at kigkonsult.se iCalcreator
<a href="http://kigkonsult.se/test/index.php" title="kigkonsult.se iCalcreator implement and test examples" target="_blank">coding and test</a> pages.
A strong recommendation is to have the document
<a href="http://kigkonsult.se/iCalcreator/docs/using.html" title="iCalcreator user's Manual" target="_blank">user's manual</a>
open in parallel when exploiting the link.
</p>
<h4>iCal</h4>
<p>
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>.
If You are not familiar with iCal, read this first!
</p>
<p>
Knowledge of <strong>calendar</strong> protocol rfc5545/rfc5546 is to recommend;
</p>
<dl>
<dt><a href="http://kigkonsult.se/downloads/dl.php?f=rfc5545" title="Download RFC5545 in text format" target="_blank">rfc5545</a>
<dd>Internet Calendaring and Scheduling Core Object Specification (iCalendar)
<dd>obsoletes <a href="http://kigkonsult.se/downloads/dl.php?f=rfc2445" title="Download RFC2445 in text format">rfc2445</a>
<dt><a href="http://kigkonsult.se/downloads/dl.php?f=rfc5546" title="Download RFC5546 in text format" target="_blank">rfc5546</a>
<dd>iCalendar Transport-Independent Interoperability Protocol (iTIP) Scheduling Events, BusyTime, To-dos and Journal Entries
<dd>obsoletes <a href="http://kigkonsult.se/downloads/dl.php?f=rfc2446" title="Download RFC2446 in text format">rfc2446</a>.
</dl>
<h4>xCal</h4>
<p>
iCalcreator also supports xCal (iCal xml).
</p>
<dl>
<dt>
<dt><a href="http://kigkonsult.se/downloads/dl.php?f=rfc6321" title="Download RFC6321 in text format" target="_blank">rfc6321</a>
<dd>xCal: The XML Format for <strong>iCalendar</strong>
</dl>
<h4>SUPPORT</h4>
<p>
The main support channel is using iCalcreator
<a title="Sourceforge" href="http://sourceforge.net/projects/icalcreator/forums/" target="_blank">Sourceforge</a> forum.
</p>
<p>
kigkonsult offer services for software support, design and development of customizations and adaptations of <em>PHP</em>/<em>MySQL</em> solutions
with a special focus on software long term utility and reliability,
supported through our agile acquire/design/transition process model.
</p>
<h4>DONATE</h4>
<p>
You can show your appreciation for our free software,
and can support future development by making a donation to the kigkonsult GPL/LGPL projects.
</p>
<p>
Make a donation of any size by clicking <a href="http://kigkonsult.se/contact/index.php#Donate" title="Donate" target="_blank">here</a>.
Thanks in advance!
</p>
<h4>Contact</h4>
<p>
Use the <a href="http://kigkonsult.se/contact/index.php" title="kigkonsult.se/contact" target="_blank">contact page</a>
for queries, improvement/development issues or professional support and development.
Please note that paid support or consulting service has the highest priority.
</p>
<h4>Downloads and usage examples</h4>
<p>
At <a href="http://kigkonsult.se/iCalcreator/index.php" title="kigkonsult iCalcreator" target="_blank">kigkonsult.se</a> you can download the
<a href="http://kigkonsult.se/downloads/index.php#iCalcreator" title="iCalcreator complete manual" target="_blank">complete manual</a>
and review and explore iCalcreator usage at the
<a href="http://kigkonsult.se/test/index.php" title="kigkonsult.se iCalcreator implement and test examples" target="_blank">coding and test</a> pages.
</p>
<h4>INSTALL</h4>
<dl>
<dt>Unpack to any folder
<dd>add this folder to your include-path
<dd>or unpack to your application-(include)-folder<br>
</dl>
<p>
Add
</p>
<pre><?php
.. .
require_once './iCalcreator.class.php';
.. .
?>
</pre>
<p>
to your php-script.
</p>
<p>
When creating a new calendar(/component) object instance, review config settings.
</p>
<p>
To really boost performance, visit kigkonsult.se contact <a href="http://kigkonsult.se/contact/index.php"><u>page</u></a> for information.
</p>
<h2>CREATE</h2>
<pre><?php
.. .
require_once( "iCalcreator.class.php" );
$tz = "Europe/Stockholm"; // <span class="comment">define time zone</span>
$config = array( "unique_id" => "kigkonsult.se", // <span class="comment">set Your unique id, </span>
// <span class="comment">required if any component UID is missing</span>
"TZID" => $tz ); // <span class="comment">opt. set "calendar" timezone</span>
$v = new vcalendar( $config ); // <span class="comment">create a new calendar object instance</span>
$v->setProperty( "method", "PUBLISH" ); // <span class="comment">required of some <strong>calendar</strong> software</span>
$v->setProperty( "x-wr-calname", "Calendar Sample" ); // <span class="comment">required of some <strong>calendar</strong> software</span>
$v->setProperty( "X-WR-CALDESC", "Calendar Description" ); // <span class="comment">required of some <strong>calendar</strong> software</span>
$v->setProperty( "X-WR-TIMEZONE", $tz ); // <span class="comment">required of some <strong>calendar</strong> software</span>
.. .
$xprops = array( "X-LIC-LOCATION" => $tz ); // <span class="comment">required of some <strong>calendar</strong> software</span>
iCalUtilityFunctions::createTimezone( $v, $tz, $xprops ); // <span class="comment">create timezone component(-s) <b>opt. 1</b></span>
.. . // <span class="comment">based on present date</span>
.. .
$vevent = & $v->newComponent( "vevent" ); // <span class="comment">create an event <strong>calendar</strong> component</span>
$vevent->setProperty( "dtstart", array( "year" => 2007
, "month" => 4
, "day" => 1
, "hour" => 19
, "min" => 0
, "sec" => 0 ));
$vevent->setProperty( "dtend", array( "year" => 2007
, "month" => 4
, "day" => 1
, "hour" => 22
, "min" => 30
, "sec" => 0 ));
$vevent->setProperty( "LOCATION", "Central Placa" ); // <span class="comment">property name - case independent</span>
$vevent->setProperty( "summary", "PHP summit" );
$vevent->setProperty( "description", "This is a description" );
$vevent->setProperty( "comment", "This is a comment" );
$vevent->setProperty( "attendee", "hide@address.com" );
.. .
$valarm = & $vevent->newComponent( "valarm" ); // <span class="comment">create an event alarm</span>
$valarm->setProperty("action", "DISPLAY" );
$valarm->setProperty("description", $vevent->getProperty( "description" );
.. . // <span class="comment">reuse the event description</span>
$d = sprintf( '%04d%02d%02d %02d%02d%02d', 2007, 3, 31, 15, 0, 0 );
iCalUtilityFunctions::transformDateTime( $d, $tz, "UTC", "Ymd\THis\Z");
$valarm->setProperty( "trigger", $d ); // <span class="comment">create alarm trigger (in UTC datetime)</span>
.. .
$vevent = & $v->newComponent( "vevent" ); // <span class="comment">create next event calendar component</span>
$vevent->setProperty( "dtstart", "20070401", array("VALUE" => "DATE"));// <span class="comment">alt. date format,</span>
// <span class="comment"> now for an all-day event</span>
$vevent->setProperty( "organizer" , "hide@address.com" );
$vevent->setProperty( "summary", "ALL-DAY event" );
$vevent->setProperty( "description", "This is a description for an all-day event" );
$vevent->setProperty( "resources", "COMPUTER PROJECTOR" );
$vevent->setProperty( "rrule", array( "FREQ" => "WEEKLY", "count" => 4));// <span class="comment">weekly, four occasions</span>
$vevent->parse( "LOCATION:1CP Conference Room 4350" ); // <span class="comment">supporting parse of</span>
// <span class="comment"> strict rfc5545 formatted text</span>
.. .
.. .// <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>
.. .// <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>
.. .
iCalUtilityFunctions::createTimezone( $v, $tz, $xprops); // <span class="comment">create timezone component(-s) <b>opt. 2</b></span>
// <span class="comment">based on all start dates in events</span>
// <span class="comment">(i.e. dtstart)</span>
.. .
?>
</pre>
<h2>PARSE</h2>
<h4>iCal, rfc5545 / rfc2445 </h4>
<h5>create iCalcreator object instance</h5>
<pre><?php
.. .
require_once( "iCalcreator.class.php" );
$config = array( "unique_id" => "kigkonsult.se" ); // <span class="comment">set Your unique id, </span>
.. . // <span class="comment">required if any component UID is missing</span>
$v = new vcalendar( $config ); // <span class="comment">create a new <strong>calendar</strong> object instance</span>
.. .
</pre>
<h5>when parse a local iCal file</h5>
<pre>.. .
$config = array( "directory" => "calendar", "filename" => "file.ics" );
$v->setConfig( $config ); // <span class="comment">set directory and file name</span>
$v->parse();
.. . // <span class="comment">continue process (edit, parse,select)</span>
.. . // <span class="comment"> the iCalcreator object instance</span>
.. .
?>
</pre>
<h5>or parse a remote iCal file (resource)</h5>
<pre>.. .
$v->setConfig( "url", "http://www.aDomain.net/file.ics" ); // <span class="comment">supporting parse of remote files</span>
$v->parse();
.. .
$v->sort(); // <span class="comment">ensure start date order (opt.)</span>
.. .
.. . // <span class="comment">continue process (edit, parse,select)</span>
.. . // <span class="comment"> the iCalcreator object instance</span>
.. .
?>
</pre>
<p>
On error, the parse method returns FALSE.
</p>
<h4>xCal, rfc6321 (XML)</h4>
<pre><?php
.. .
require_once( "iCalcreator.class.php" );
$config = array( "unique_id" => "kigkonsult.se" ); // <span class="comment">set Your unique id, </span>
.. . // <span class="comment">required if any component UID is missing</span>
.. .
$filename = 'xmlfile.xml'; // <span class="comment">use a local xCal file</span>
// $filename = 'http://kigkonsult.se/xcal.php?a=1&b=2&c=3';// <span class="comment"> or a remote xCal resource</span>
if( FALSE === ( $v = XMLfile2iCal( $filename, $config ))) // <span class="comment">convert the XML resource</span>
exit( "Error when parsing $filename" ); // <span class="comment"> to an iCalcreator object instance</span>
.. . // <span class="comment">continue process (edit, parse,select)</span>
.. . // <span class="comment"> the iCalcreator object instance</span>
.. .
?>
</pre>
<h2>EDIT</h2>
<pre><?php
.. .
require_once( "iCalcreator.class.php" );
$config = array( "unique_id" => "kigkonsult.se" // <span class="comment">set Your unique id,</span>
, "directory" => "calendar" // <span class="comment">import directory</span>
, "filename" => "file.ics" ); // <span class="comment"> and file name</span>
$v = new vcalendar( $config ); // <span class="comment">create a new calendar object instance</span>
$v->parse();
$v->setProperty( "method", "PUBLISH" ); // <span class="comment">required of some <strong>calendar</strong> software</span>
$v->setProperty( "x-wr-calname", "Calendar Sample" ); // <span class="comment">required of some <strong>calendar</strong> software</span>
$v->setProperty( "X-WR-CALDESC", "Calendar Description" ); // <span class="comment">required of some <strong>calendar</strong> software</span>
$v->setProperty( "X-WR-TIMEZONE", "Europe/Stockholm" ); // <span class="comment">required of some <strong>calendar</strong> software</span>
while( $vevent = $v->getComponent( "vevent" )) { // <span class="comment">read events, one by one</span>
$uid = $vevent->getProperty( "uid" ); // <span class="comment">uid required, one occurrence</span>
.. . // <span class="comment"> (unique id/key for component)</span>
$dtstart = $vevent->getProperty( "dtstart" ); // <span class="comment">dtstart required, one occurrence</span>
.. .
if( $description = $vevent->getProperty( "description", 1 )) { // <span class="comment">opt. description, 1st occurrence</span>
.. . // <span class="comment">edit the description</span>
$vevent->setProperty( "description", $description, FALSE, 1 ); // <span class="comment">update/replace the description</span>
}
while( $comment = $vevent->getProperty( "comment" )) { // <span class="comment">optional comments</span>
.. . // <span class="comment">manage comments</span>
}
.. .
while( $vevent->deleteProperty( "attendee" ))
continue; // <span class="comment">remove all ATTENDEE properties .. .</span>
.. .
$v->setComponent ( $vevent, $uid ); // <span class="comment">update/replace event in calendar</span>
// <span class="comment"> with <b>UID</b> as key</span>
}
.. .
.. .// <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>
.. .
?>
</pre>
<br>
<br>
<h2>SELECT</h2>
<pre><?php
.. .
require_once( "iCalcreator.class.php" );
$config = array( "unique_id" => "kigkonsult.se" ); // <span class="comment">set Your unique id</span>
$v = new vcalendar( $config ); // <span class="comment">create a new <strong>calendar</strong> object instance</span>
$v->setConfig( "url", "http://www.aDomain.net/file.ics" ); // <span class="comment">iCalcreator also support remote files</span>
$v->parse();
$v->sort(); // <span class="comment">ensure start date order</span>
$v->setProperty( "method", "PUBLISH" ); // <span class="comment">required of some <strong>calendar</strong> software</span>
$v->setProperty( "x-wr-calname", "Calendar Sample" ); // <span class="comment">required of some <strong>calendar</strong> software</span>
$v->setProperty( "X-WR-CALDESC", "Calendar Description" ); // <span class="comment">required of some <strong>calendar</strong> software</span>
$v->setProperty( "X-WR-TIMEZONE", "Europe/Stockholm" ); // <span class="comment">required of some <strong>calendar</strong> software</span>
.. .
?>
</pre>
<h4>Date based select</h4>
<pre><?php
.. .
$eventArray = $v->selectComponents(); // <span class="comment">select components occurring <b>today</b></span>
// <span class="comment">(including components</span>
// <span class="comment">with recurrence pattern)</span>
foreach( $eventArray as $year => $yearArray) {
foreach( $yearArray as $month => $monthArray ) {
foreach( $monthArray as $day => $dailyEventsArray ) {
foreach( $dailyEventsArray as $vevent ) {
$currddate = $event->getProperty( "x-current-dtstart" );
// <span class="comment">if member of a recurrence set</span>
// <span class="comment">(2nd occurrence etc)</span>
// <span class="comment">returns array( </span>
// <span class="comment"> "x-current-dtstart"</span>
// <span class="comment"> , (string) date(</span>
// <span class="comment"> "Y-m-d [H:i:s][timezone/UTC offset]"))</span>
$dtstart = $vevent->getProperty( "dtstart" ); // <span class="comment">dtstart required, one occurrence,</span>
// <span class="comment"> (orig. start date)</span>
$summary = $vevent->getProperty( "summary" );
$description = $vevent->getProperty( "description" );
.. .
.. .
}
}
}
}
.. .
?>
</pre>
<h4>Select specific property values</h4>
<pre><?php
.. .
$valueOccur = $v->getProperty( "RESOURCES" ); // <span class="comment">fetch specific property</span>
// <span class="comment">(unique) values and occurrences</span>
// <span class="comment">ATTENDEE, CATEGORIES, CONTACT,</span>
// <span class="comment">DTSTART, LOCATION, ORGANIZER,</span>
// <span class="comment">PRIORITY, RESOURCES, STATUS,</span>
// <span class="comment">SUMMARY, UID, URL,</span>
// <span class="comment">GEOLOCATION<sup>*</sup></span>
foreach( $valueOccur as $uniqueValue => $occurCnt ) {
echo "The RESOURCES value <b>$uniqueValue</b> occurs <b>$occurCnt</b> times<br />";
.. .
}
.. .
?>
</pre>
<p>
<sup>*</sup>) Using the non-standard directive "GEOLOCATION", iCalcreator returns output supporting
ISO6709 "Standard representation of geographic point location by coordinates",
by combining the "LOCATION" and "GEO" property values (only if "GEO" is set).
</p>
<h4>Select components based on specific property value</h4>
<pre><?php
.. .
$selectSpec = array( "CATEGORIES" => "course1" );
$specComps = $v->selectComponents( $selectSpec ); // <span class="comment">selects components</span>
// <span class="comment">based on specific property value(-s)</span>
// <span class="comment">ATTENDEE, CATEGORIES, CONTACT,</span>
// <span class="comment">LOCATION, ORGANIZER,</span>
// <span class="comment">PRIORITY, RESOURCES, STATUS,</span>
// <span class="comment">SUMMARY, URL, UID</span>
foreach( $specComps as $comp ) {
.. .
}
.. .
?>
</pre>
<br>
<br>
<h2>OUTPUT</h2>
<h5>create iCalcreator object instance</h5>
<pre><?php
.. .
require_once( "iCalcreator.class.php" );
$config = array( "unique_id" => "kigkonsult.se" ); // <span class="comment">set Your unique id</span>
$v = new vcalendar( $config ); // <span class="comment">create a new calendar object instance</span>
$v->setProperty( "method", "PUBLISH" ); // <span class="comment">required of some <strong>calendar</strong> software</span>
$v->setProperty( "x-wr-calname", "Calendar Sample" ); // <span class="comment">required of some <strong>calendar</strong> software</span>
$v->setProperty( "X-WR-CALDESC", "Calendar Description" ); // <span class="comment">required of some <strong>calendar</strong> software</span>
$v->setProperty( "X-WR-TIMEZONE", "Europe/Stockholm" ); // <span class="comment">required of some <strong>calendar</strong> software</span>
.. .
.. . // <span class="comment">continue process (edit, parse,select)</span>
.. . // <span class="comment"> the iCalcreator object instance</span>
.. .
?>
</pre>
<h5>opt 1</h5>
<pre><?php
.. .
$v->returnCalendar(); // <span class="comment">redirect calendar file to browser</span>
?>
</pre>
<h5>opt 2</h5>
<pre><?php
.. .
$config = array( "directory" => "depot", "filename" => "calendar.ics" );
$v->setConfig( $config ); // <span class="comment">set output directory and file name</span>
$v->saveCalendar(); // <span class="comment">save calendar to (local) file</span>
.. .
?>
</pre>
<h5>opt 3, xCal</h5>
<pre><?php
.. .
$mlstr = iCal2XML( $v ); // <span class="comment">create well-formed XML, rfc6321</span>
.. .
?>
</pre>
<br>
<br>
<h2>COPYRIGHT AND LICENSE</h2>
<h4>Copyright</h4>
<p>
iCalcreator v2.16<br>
copyright (c) 2007-2012 Kjell-Inge Gustafsson, kigkonsult<br>
<a href="http://kigkonsult.se/iCalcreator/index.php" title="kigkonsult.se/iCalcreator" target="_blank">kigkonsult.se iCalcreator</a><br>
<a href="http://kigkonsult.se/contact/index.php" title="kigkonsult.se/contact" target="_blank">kigkonsult.se contact</a><br>
</p>
<h4>License</h4>
<p>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
</p>
<p>
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
</p>
<p>
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
or download it <a href="http://kigkonsult.se/downloads/dl.php?f=LGPL" target="_blank">here</a>.
</p>
<br>
<br>
</body>
</html>