<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> <html> <head> <title>iCalcreator 2.12 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-FAMILY : "Lucida Grande","Lucida Sans Unicode", "Bitstream Vera Sans", Lucida, Arial, Geneva, Helvetica, sans-serif; FONT-SIZE : large; } h2 { FONT-FAMILY : "Lucida Grande","Lucida Sans Unicode", "Bitstream Vera Sans", Lucida, Arial, Geneva, Helvetica, sans-serif; FONT-SIZE : large; } h4 { FONT-FAMILY : "Lucida Grande","Lucida Sans Unicode", "Bitstream Vera Sans", Lucida, Arial, Geneva, Helvetica, sans-serif; FONT-SIZE : small; FONT-WEIGHT : bold; } .code { FONT-FAMILY : monospace; FONT-SIZE : medium; WHITE-SPACE : pre; } .comment { FONT-FAMILY : arial; FONT-SIZE : small; FONT-STYLE : italic; } </style> </head> <body> <h1>iCalcreator v2.12</h1> iCalcreator v2.12<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> <br /> 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. <br /><br /> This is a <b>short summary</b> how to use iCalcreator; create, parse, edit, select and output functionality. <br /><br /> 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. <br /><br /> The iCalcreator main class, utility class and helper functions are included in the "iCalcreator.class.php" file. <br /><br /> More iCalcreator supplementary and "howto" information will be found at kigkonsult.se iCalcreator implement examples and test <a href="http://kigkonsult.se/test/index.php" title="kigkonsult.se iCalcreator implement and test examples" target="_blank">pages</a>. 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 parallell when exploiting the link. <h4>iCal</h4> 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!<br /> Knowledge of <strong>calendar</strong> protocol rfc5545/rfc5546 is to recommend;<br /> <a href="http://kigkonsult.se/downloads/dl.php?f=rfc5545" title="RFC5545" target="_blank">rfc5545</a> - Internet Calendaring and Scheduling Core Object Specification (iCalendar)<br /> <a href="http://kigkonsult.se/downloads/dl.php?f=rfc5546" title="RFC5546" target="_blank">rfc5546</a> - iCalendar Transport-Independent Interoperability Protocol (iTIP) Scheduling Events, BusyTime, To-dos and Journal Entries <br /> <a href="http://kigkonsult.se/downloads/dl.php?f=rfc5545" title="Download RFC5545 in text format">rfc5545</a> and <a href="http://kigkonsult.se/downloads/dl.php?f=rfc5546" title="Download RFC5546 in text format">rfc5546</a> obsoletes, respectively, <a href="http://kigkonsult.se/downloads/dl.php?f=rfc2445" title="Download RFC2445 in text format">rfc2445</a> and <a href="http://kigkonsult.se/downloads/dl.php?f=rfc2446" title="Download RFC2446 in text format">rfc2446</a>. <br /> <h4>xCal</h4> iCalcreator also supports xCal (iCal xml)<br /> <a href="http://kigkonsult.se/downloads/dl.php?f=rfc6321" title="Download RFC6321 in text format" target="_blank">rfc6321</a> - "xCal: The XML Format for <strong>iCalendar</strong>" <br /> <h4>SUPPORT</h4> The main support channel is using iCalcreator <a title="Sourceforge" href="http://sourceforge.net/projects/icalcreator/forums/" target="_blank">Sourceforge</a> forum. <br /> <br /> 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. <br /> <h4>DONATE</h4> You can show your appreciation for our free software, and can support future development by making a donation to the kigkonsult GPL/LGPL projects. <br /> <br /> 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! <br /> <h4>Contact</h4> Use the contact <a href="http://kigkonsult.se/contact/index.php" title="kigkonsult.se/contact" target="_blank">page</a> for queries, improvement/development issues or professional support and development. Please note that paid support or consulting service has the highest priority. <br /> <h4>Downloads and usage examples</h4> On <a href="http://kigkonsult.se/iCalcreator/index.php" title="kigkonsult iCalcreator" target="_blank">kigkonsult.se</a> can you download the <a href="http://kigkonsult.se/downloads/index.php#iCalcreator" title="iCalcreator complete manual" target="_blank"><b>complete manual</b></a> and review <a href="http://kigkonsult.se/test/index.php" title="kigkonsult.se iCalcreator implement and test examples" target="_blank">coding and test examples</b></a>. <br /> <h4>INSTALL</h4> Unpack to any folder<br /> - add this folder to your include-path<br /> - or unpack to your application-(include)-folder<br /> Add "require_once '[folder/]iCalcreator.class.php';" to your php-script. <br /> <br /> If using <em>PHP</em> version 5.1 or higher, the default timezone need to be set/altered, now "Europe/Stockholm", line 50 in the iCalcreator.class.php file. <br /> When creating a new calendar/component instance, review config settings. <br /> <br /> To really boost performance, visit kigkonsult.se contact <a href="http://kigkonsult.se/contact/index.php"><u>page</u></a> for information. <br /> <br /> <h2>CREATE</h2> <p class="code">require_once( "iCalcreator.class.php" ); $config = array( "unique_id" => "kigkonsult.se" ); // <span class="comment">set a (site) unique id</span> $v = new vcalendar( $config ); // <span class="comment">create a new calendar instance</span> $tz = "Europe/Stockholm"; // <span class="comment">define time zone</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", "attendee1@icaldomain.net" ); .. . $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, now for an all-day event</span> $vevent->setProperty( "organizer" , "boss@icaldomain.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 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 (i.e. dtstart)</span> .. . .. . </p> <br /> <br /> <h2>PARSE</h2> <h4>iCal, rfc5545 / rfc2445 </h4> <p class="code">require_once( "iCalcreator.class.php" ); $config = array( "unique_id" => "kigkonsult.se" ); // <span class="comment">set a (site) unique id, required if any component UID is missing</span> $v = new vcalendar( $config ); // <span class="comment">create a new <strong>calendar</strong> instance</span> /* start parse of local iCal file */ $config = array( "directory" => "calendar", "filename" => "file.ics" ); $v->setConfig( $config ); // <span class="comment">set directory and file name</span> $v->parse(); /* start parse of remote iCal file */ $v->setConfig( "url", "http://www.aDomain.net/file.ics" ); // <span class="comment">iCalcreator also support parse of remote files</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> .. . $v->sort(); // <span class="comment">ensure start date order</span> .. . .. . // <span class="comment">continue process (edit, parse,select) the iCalcreator instance</span> .. . </p> <h4>xCal, rfc6321 (XML)</h4> <p class="code">require_once( "iCalcreator.class.php" ); $config = array( "unique_id" => "kigkonsult.se" ); // <span class="comment">set a (site) unique id, 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 to an iCalcreator instance</span> exit( "Error when parsing $filename" ); .. . .. . // <span class="comment">continue process (edit, parse,select) the iCalcreator instance</span> .. . </p> <br /> <h2>EDIT</h2> <p class="code">require_once( "iCalcreator.class.php" ); $config = array( "unique_id" => "kigkonsult.se", "directory" => "calendar", "filename" => "file.ics" ); // <span class="comment">set the (site) unique id, the import directory and file name</span> $v = new vcalendar( $config ); // <span class="comment">create a new calendar 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 (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">description optional, first 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">comment optional, may occur more than once </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 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> .. . </p> <br /> <br /> <h2>SELECT</h2> <p class="code">require_once( "iCalcreator.class.php" ); $config = array( "unique_id" => "kigkonsult.se" ); // <span class="comment">set a (site) unique id</span> $v = new vcalendar( $config ); // <span class="comment">create a new <strong>calendar</strong> 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> </p> <h4>Select components based on specific date period</h4> <p class="code">$eventArray = $v->selectComponents(); // <span class="comment">select components occurring <b>today</b></span> // <span class="comment">(including components 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 (2nd occurrence etc)</span> // <span class="comment">returns array( "x-current-dtstart"</span> // <span class="comment"> , <(string) date("Y-m-d [H:i:s][timezone/UTC offset]")>)</span> $dtstart = $vevent->getProperty( "dtstart" ); // <span class="comment">dtstart required, one occurrence, (orig. start date)</span> $summary = $vevent->getProperty( "summary" ); $description = $vevent->getProperty( "description" ); .. . .. . } } } } </p> <h4>Select specific property values</h4> <p class="code">$valueOccur = $v->getProperty( "RESOURCES" ); // <span class="comment">fetch specific property (unique) values and occurrences</span> // <span class="comment">ATTENDEE, CATEGORIES, DTSTART, LOCATION,</span> // <span class="comment">ORGANIZER, PRIORITY, RESOURCES, STATUS,</span> // <span class="comment">SUMMARY, UID</span> foreach( $valueOccur as $uniqueValue => $occurCnt ) { echo "The RESOURCES value <b>$uniqueValue</b> occurs <b>$occurCnt</b> times<br />"; .. . } </p> <h4>Select components based on specific property value</h4> <p class="code">$selectSpec = array( "CATEGORIES" => "course1" ); $specComps = $v->selectComponents( $selectSpec ); // <span class="comment">selects components based on specific property value(-s)</span> // <span class="comment">ATTENDEE, CATEGORIES, LOCATION, ORGANIZER,</span> // <span class="comment">PRIORITY, RESOURCES, STATUS, SUMMARY, UID</span> foreach( $specComps as $comp ) { .. . } </p> <br /> <br /> <h2>OUTPUT</h2> <p class="code">require_once( "iCalcreator.class.php" ); $config = array( "unique_id" => "kigkonsult.se" ); // <span class="comment">set a (site) unique id</span> $v = new vcalendar( $config ); // <span class="comment">create a new calendar 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) the iCalcreator instance</span> .. . </p> <h4>opt 1</h4> <p class="code">.. . $v->returnCalendar(); // <span class="comment">redirect calendar file to browser</span> </p> <h4>opt 2</h4> <p class="code">.. . $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> .. . </p> <h4>opt 3, xCal</h4> <p class="code">.. . $xmlstr = iCal2XML( $v ); // <span class="comment">create well-formed XML, rfc6321</span> ... </p> <br /> <br /> <h2>COPYRIGHT AND LICENSE</h2> <h4>Copyright</h4> iCalcreator v2.12<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> <br /> <h4>License</h4> 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. <br /><br /> 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. <br /><br /> 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>. </body> </html>