Location: PHPKode > scripts > iCalcreator > ical-creator/summary.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
   "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>iCalcreator 2.4.3 summary</title>
<meta name="author"      content="Kjell-Inge Gustafsson - kigkonsult" />
<meta name="copyright"   content="2007-2008 Kjell-Inge Gustafsson - kigkonsult" />
<meta name="keywords"    content="ical, calendar, calender, xcal, xml, icalender, rfc2445, vcalender, php, create" />
<meta name="description" content="iCalcreator" />
<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;
}
.comment {
  FONT-FAMILY     : arial;
  FONT-SIZE       : small;
  FONT-STYLE      : italic;
}
</style>
</head>
<body>
<h1>iCalcreator 2.4.3</h1>
iCalcreator class v2.4.3<br />
copyright (c) 2007-2008 Kjell-Inge Gustafsson, kigkonsult<br />
<a href="http://www.kigkonsult.se/iCalcreator/index.php" title="www.kigkonsult.se/iCalcreator" target="_blank">www.kigkonsult.se/iCalcreator</a><br />
hide@address.com<br />
<br />
iCalcreator is a PHP class managing iCal formatted files for non-calendar
systems like CMS, project management systems and other applications able
to process calendar information like agendas, tasks, reports, totos,
journaling data and for communication with calendar systems and applications.
<br /><br />
This is a <b>short summary</b> how to use iCalcreator; create, parse, edit, select and output functionality.
<br /><br />
iCalcreator is built of a single class file with a simple interface and are calendar component property oriented. 
Development environment is PHP version 5.x but coding is done to meet 4.x backward compability.
<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 calendar protocol rfc2445/rfc2446  is to recommend;<br />
<a href="http://www.kigkonsult.se/downloads/dl.php?f=rfc2445" title="RFC2445" target="_blank">rfc2445</a>
 - Internet Calendaring and Scheduling Core Object Specification (iCalendar)<br />
<a href="http://www.kigkonsult.se/downloads/dl.php?f=rfc2446" title="RFC2446" target="_blank">rfc2446</a>
 - iCalendar Transport-Independent Interoperability Protocol (iTIP) Scheduling Events, BusyTime, To-dos and Journal Entries <br />
All functions calls are made as simple as possible BUT (, !!!,) read these rfc's properly!<br />
<h4>Downloads</h4>
Download 
<a href="http://www.kigkonsult.se/downloads/index.php" title="iCalcreator complete manual" target="_blank"><b>complete manual</b></a>
and
<a href="http://www.kigkonsult.se/downloads/index.php" title="iCalcreator coding samples" target="_blank"><b>coding samples</b></a>.
from <a href="http://www.kigkonsult.se/iCalcreator/index.php" title="iCalcreator" target="_blank">www.kigkonsult.se/iCalcreator</a>.
<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 &quot;require_once [folder/]iCalcreator.class.php;&quot; to your php-script.

<h2>CREATE</h2>

require_once( 'iCalcreator.class.php' ); <br />
$v = new vcalendar(); <span class="comment">// create a new calendar instance</span><br />
$v->setConfig( 'unique_id', 'icaldomain.com' ); <span class="comment">// set Your unique id</span><br />
$v->setProperty( 'method', 'PUBLISH' ); <span class="comment">// required of some calendar software</span><br />
.. .<br />
$vevent = new vevent(); <span class="comment">// create an event calendar component</span><br />
$vevent->setProperty( 'dtstart', array( 'year'=>2007, 'month'=>4, 'day'=>1, 'hour'=>19, 'min'=>0,&nbsp;&nbsp;'sec'=>0 ));<br />
$vevent->setProperty( 'dtend',&nbsp;&nbsp;array( 'year'=>2007, 'month'=>4, 'day'=>1, 'hour'=>22, 'min'=>30, 'sec'=>0 ));<br />
$vevent->setProperty( 'LOCATION', 'Central Placa' ); <span class="comment">// property name - case independent</span><br />
$vevent->setProperty( 'summary', 'PHP summit' );<br />
$vevent->setProperty( 'description', 'This is a description' );<br />
$vevent->setProperty( 'comment', 'This is a comment' );<br />
$vevent->setProperty( 'attendee', 'hide@address.com' );<br />
$v->setComponent ( $vevent ); <span class="comment">// add event to calendar</span><br />
.. .<br />
$vevent = new vevent();<br />
$vevent->setProperty( 'dtstart', '20070401', array('VALUE' => 'DATE'));<span class="comment">// alt. date format, now for an all-day event</span><br />
$vevent->setProperty( "organizer" , 'hide@address.com'<br />
$vevent->setProperty( 'summary', 'ALL-DAY event' );<br />
$vevent->setProperty( 'description', 'This is a description for an all-day event' );<br />
$vevent->setProperty( 'resources', 'COMPUTER PROJECTOR' );<br />
$vevent->setProperty( 'rrule', array( 'FREQ' => 'WEEKLY', 'count' => 4));<span class="comment">// occurs also four next weeks</span><br />
$vevent->parse( 'LOCATION:1CP Conference Room 4350' );<span class="comment">// supporting parse of strict rfc2445 formatted text</span><br />
$v->setComponent ( $vevent ); <span class="comment">// add event to calendar</span><br />
.. .<br />
.. .// <span class="comment">all calendar components are described in <a href="http://www.kigkonsult.se/downloads/dl.php?f=rfc2445" title="RFC2445" target="_blank">rfc2445</a></span><br />
.. .// <span class="comment">a complete iCalcreator function list (ex. setProperty) in <a href="http://www.kigkonsult.se/downloads/index.php" title="iCalcreator complete manual" target="_blank">iCalcreator manual</a></span><br />
.. .<br />
$v->returnCalendar(); <span class="comment">// redirect calendar file to browser</span><br />

<h2>PARSE</h2>

require_once( 'iCalcreator.class.php' ); <br />
$v = new vcalendar(); <span class="comment">// create a new calendar instance</span><br />
$v->setConfig( 'unique_id', 'icaldomain.com' ); <span class="comment">// set Your unique id, required if any component property UID is missing</span><br />
$v->setProperty( 'method', 'PUBLISH' ); <span class="comment">// required of some calendar software</span><br />
<br />
 /* start parse of local file */<br />
$v->setConfig( 'directory', 'calendar' ); <span class="comment">// identify directory</span><br />
$v->setConfig( 'filename', 'file.ics' ); <span class="comment">// identify file name</span><br />
$v->parse();<br />
<br />
 /* start parse of remote file */<br />
$v->setConfig( 'url', 'http://www.someOtherDomain.net/docs/file.ics' ); <span class="comment">// iCalcreator also support remote files</span><br />
$v->parse();<br />
<br />
.. .<br />
$v->sort(); <span class="comment">// ensure start date order</span><br />
.. .<br />

<h2>EDIT</h2>

require_once( 'iCalcreator.class.php' ); <br />
$v = new vcalendar(); <span class="comment">// create a new calendar instance</span><br />
$v->setConfig( 'unique_id', 'icaldomain.com' ); <span class="comment">// set Your unique id</span><br />
$v->setProperty( 'method', 'PUBLISH' ); <span class="comment">// required of some calendar software</span><br />
$v->setConfig( 'directory', 'calendar' ); <span class="comment">// identify directory</span><br />
$v->setConfig( 'filename', 'file.ics' ); <span class="comment">// identify file name</span><br />
$v->parse();<br />
while( $vevent = $v->getComponent( 'vevent' )) { <span class="comment">// read events, one by one</span><br />
&nbsp;&nbsp;$uid = $vevent->getProperty( 'uid' ); <span class="comment">// required, one occurence</span><br />
&nbsp;&nbsp;.. .<br />
&nbsp;&nbsp;$dtstart = $vevent->getProperty( 'dtstart' ); <span class="comment">// required, one occurence</span><br />
&nbsp;&nbsp;.. .<br />
&nbsp;&nbsp;if( $description = $vevent->getProperty( 'description' )) { <span class="comment">// optional, one occurence</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;.. .<br />
&nbsp;&nbsp;&nbsp;&nbsp;$vevent->setProperty( 'description', $description )) { <span class="comment">// update/replace</span><br />
&nbsp;&nbsp;}<br />
&nbsp;while( $comment = $vevent->getProperty( 'comment' )) { <span class="comment">// optional, may occur more than once </span><br />
&nbsp;&nbsp;&nbsp;&nbsp;.. .<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;.. .<br />
&nbsp;&nbsp;while( FALSE !== $vevent->deleteProperty( 'attendee' ))<br />
&nbsp;&nbsp;&nbsp;&nbsp;continue; <span class="comment">// remove all ATTENDEE properties .. .</span><br />
&nbsp;&nbsp;.. .<br />
&nbsp;&nbsp;$v->setComponent ( $vevent, $uid ); <span class="comment">// update/replace event in calendar</span><br />
}<br />
.. .<br />
.. .// <span class="comment">a complete iCalcreator function list (ex. getProperty, deleteProperty) in <a href="http://www.kigkonsult.se/downloads/index.php" title="iCalcreator complete manual" target="_blank">iCalcreator manual</a></span><br />
.. .<br />

<h2>SELECT</h2>

require_once( 'iCalcreator.class.php' ); <br />
$v = new vcalendar(); <span class="comment">// create a new calendar instance</span><br />
$v->setConfig( 'unique_id', 'icaldomain.com' ); <span class="comment">// set Your unique id</span><br />
$v->setProperty( 'method', 'PUBLISH' ); <span class="comment">// required of some calendar software</span><br />
$v->setConfig( 'url', 'http://www.someOtherDomain.net/docs/file.ics' ); <span class="comment">// iCalcreator also support remote files</span><br />
$v->parse();<br />
$v->sort(); <span class="comment">// ensure start date order</span><br />
&nbsp;&nbsp;&nbsp;&nbsp; <span class="comment">// select components occuring today (including components with recurrence pattern)</span><br />
$eventArray = $v->selectComponents();<br />
foreach( $eventArray as $year => $yearArray) {<br />
&nbsp;foreach( $yearArray as $month => $monthArray ) {<br />
&nbsp;&nbsp;foreach( $monthArray as $day => $dailyEventsArray ) {<br />
&nbsp;&nbsp;&nbsp;foreach( $dailyEventsArray as $vevent ) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;$currddate = $event->getProperty( 'x-current-dtstart' );<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// <span class="comment">if member of a recurrence set, returns array('x-current-dtstart', &lt;(string) date(&quot;Y-m-d&nbsp;[H:i:s][timezone/GMT&nbsp;offset]&quot;)&gt;)</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;$dtstart = $vevent->getProperty( 'dtstart' ); <span class="comment">// required, one occurence</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;$summary = $vevent->getProperty( 'summary' );<br />
&nbsp;&nbsp;&nbsp;&nbsp;$description = $vevent->getProperty( 'description' );<br />
&nbsp;&nbsp;&nbsp;&nbsp;.. .<br />
&nbsp;&nbsp;&nbsp;&nbsp;.. .<br />


<h2>OUTPUT</h2>

require_once( 'iCalcreator.class.php' ); <br />
$v = new vcalendar(); <span class="comment">// create a new calendar instance</span><br />
$v->setConfig( 'unique_id', 'icaldomain.com' );<br />
$v->setProperty( 'method', 'PUBLISH' ); <span class="comment">// required of some calendar software</span><br />
.. .<span class="comment">// parse calendar file(s) and/or create calendar components.. .</span><br />
.. .<br />
<h4> // opt 1</h4>
.. .<br />
$v->returnCalendar(); <span class="comment">// redirect calendar file to browser</span><br />
<br />
<h4> // opt 2</h4>
.. .<br />
$v->setConfig( 'directory', 'depot' ); <span class="comment">// set directory</span><br />
$v->setConfig( 'filename', 'calendar.ics' ); <span class="comment">// set file name</span><br />
$v->saveCalendar(); <span class="comment">// save calendar to file</span><br />
<br />

<h2>COPYRIGHT AND LICENSE</h2>

<h4>Copyright</h4>
iCalcreator class <br />
copyright (c) 2007-2008 Kjell-Inge Gustafsson, kigkonsult<br />
www.kigkonsult.se/iCalcreator/index.php<br />
hide@address.com<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://www.kigkonsult.se/downloads/dl.php?f=LGPL" target="_blank">here</a>.
</body>
</html>
Return current item: iCalcreator