123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755 |
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
- <!--
- iCalcreator, a PHP rfc2445/rfc5545 solution.
- This file is a part of iCalcreator.
- Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
- Link http://kigkonsult.se/iCalcreator/index.php
- Package iCalcreator
- Version 2.24
- License Subject matter of licence is the software iCalcreator.
- The above copyright, link, package and version notices,
- this licence notice and the [rfc5545] PRODID as implemented and
- invoked in iCalcreator shall be included in all copies or
- substantial portions of the iCalcreator.
- iCalcreator can be used either under the terms of
- a proprietary license, available at <https://kigkonsult.se/>
- or the GNU Affero General Public License, version 3:
- iCalcreator is free software: you can redistribute it and/or
- modify it under the terms of the GNU Affero General Public License
- as published by the Free Software Foundation, either version 3 of
- the License, or (at your option) any later version.
- iCalcreator 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 Affero General Public License for more details.
- You should have received a copy of the GNU Affero General Public
- License along with this program.
- If not, see <http://www.gnu.org/licenses/>.
- -->
- <html>
- <head>
- <title>iCalcreator 2.24 summary</title>
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
- <meta name="author" content="Kjell-Inge Gustafsson, kigkonsult, All rights reserved">
- <meta name="copyright" content="2017-2017 Kjell-Inge Gustafsson, kigkonsult">
- <meta name="keywords" content="ical, calendar, calender, xcal, xml, icalender, rfc2445, rfc5545, vcalender, php, create">
- <meta name="description" content="iCalcreator 2.24 summary" />
- <style type="text/css">
- * {
- FONT-FAMILY : "Bitstream Vera Sans", Helvetica, "Lucida Grande","Lucida Sans Unicode", Lucida, Arial, Geneva, sans-serif;
- BACKGROUND-COLOR: white;
- COLOR : black;
- FONT-SIZE : small;
- }
- body {
- MARGIN-LEFT : 10px;
- WIDTH : 750px;
- }
- a {
- BACKGROUND-COLOR: inherit;
- }
- a.ref {
- BACKGROUND-COLOR: inherit;
- FONT-SIZE : 8pt;
- LETTER-SPACING : 0.1em;
- }
- h1 {
- BACKGROUND-COLOR: silver;
- BORDER : thin solid black;
- FONT-SIZE : x-large;
- FONT-WEIGHT : bold;
- DISPLAY : block;
- }
- 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;
- }
- table {
- border-collapse : collapse;
- width : 100%;
- }
- .bb {
- BORDER-BOTTOM : gray dotted thin;
- }
- .blb {
- BORDER-LEFT : gray dotted thin;
- BORDER-BOTTOM : gray dotted thin;
- TEXT-ALIGN : center;
- }
- .bl {
- BORDER-LEFT : gray dotted thin;
- }
- .center {
- TEXT-ALIGN : center;
- }
- p.comment {
- FONT-FAMILY : monospace;
- FONT-SIZE : 9pt;
- FONT-WEIGHT : 500;
- 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+ */
- }
- span.comment {
- BACKGROUND-COLOR: inherit;
- FONT-FAMILY : Areal;
- FONT-SIZE : 8pt;
- LETTER-SPACING : 0.2em;
- }
- p.example {
- BACKGROUND-COLOR: #DCDCDC;
- font-family : monospace;
- FONT-SIZE : 9pt;
- 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+ */
- }
- p.format, span.format {
- BORDER : gray dotted thin;
- FONT-FAMILY : Helvetica;
- FONT-SIZE : 9pt;
- LETTER-SPACING : 0.2em;
- LINE-HEIGHT : 2em;
- 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+ */
- }
- .header {
- BACKGROUND-COLOR: silver;
- BORDER : thin solid black;
- FONT-SIZE : xx-large;
- }
- p.label {
- FONT-FAMILY : Arial;
- FONT-WEIGHT : bold;
- LETTER-SPACING : 0.1em;
- }
- p.quotes {
- BACKGROUND-COLOR: #F5F5F5;
- FONT-FAMILY : Arial;
- FONT-STYLE : italic;
- LETTER-SPACING : 0.1em;
- }
- sup {
- BACKGROUND-COLOR: transparent;
- FONT-SIZE : x-small;
- FONT-WEIGHT : bold;
- VERTICAL-ALIGN : super;
- }
- .ref {
- BACKGROUND-COLOR: transparent;
- FONT-SIZE : 8pt;
- LETTER-SPACING : 0.1em;
- }
- .top {
- VERTICAL-ALIGN : top;
- }
- </style>
- </head>
- <body>
- <h1>iCalcreator v2.24</h1>
- <p>
- iCalcreator v2.24<br>
- Copyright (c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved.<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>
- <h4>Preface</h2>
- <p>
- 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.
- </p>
- <p>
- This document is provided by kigkonsult for informational purposes
- and is provided on an "as is" basis without any warranties expressed or implied.
- </p>
- <p>
- Information in this document is subject to change without notice and does
- not represent a commitment on the part of kigkonsult.
- The software described in this document is provided under a <a href="#Copyright_and_Licence">license agreement</a>.
- The software may be used only in accordance with the terms of that <a href="#Copyright_and_Licence">license agreement</a>.
- It is against the law to copy or use the software except as specifically allowed in the <a href="#Copyright_and_Licence">license agreement</a>.
- </p>
- <p>
- It is the users responsibility to ensure the suitability of the software before using it.
- In no circumstances will kigkonsult be responsible for
- the use of the software's outcomes or results or any loss
- or damage of data or programs as a result of using the software.
- </p>
- <p>
- The use of the software implies acceptance of these terms and the <a href="#Copyright_and_Licence">license agreement</a>.
- </p>
- <p>
- This document makes previous versions obsolete.
- </p>
- <h4>The software</h2>
- <p>
- iCalcreator is a <em>PHP</em> class package managing iCal files, supporting (non-)calendar
- systems and applications to process and communicate calendar information like
- events, agendas, tasks, reports, totos and journaling information.
- </p>
- <p>
- For iCalcreator 2.24 version (and later), <em>PHP</em> version >= 5.4 is required.
- </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>
- The <strong>iCalendar</strong> format, <strong>iCal</strong>, are described in
- </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 (<strong>iCalendar</strong>)"
- <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)"<br>Scheduling Events, BusyTime, To-dos and Journal Entries
- <p class="quotes">. ..allows for the capture and exchange of information normally stored
- within a calendaring and scheduling application.</p>
- and
- <p class="quotes">. ..is an exchange format between applications or systems.</p>
- </dl>
- <p><a href="http://kigkonsult.se/downloads/dl.php?f=rfc5545" title="Download RFC5545 in text format" target="_blank">rfc5545</a> and
- <a href="http://kigkonsult.se/downloads/dl.php?f=rfc5546" title="Download RFC5546 in text format" target="_blank">rfc5546</a>
- obsoletes, respectively,
- <a href="http://kigkonsult.se/downloads/dl.php?f=rfc2445" title="Download RFC2445 in text format" target="_blank">rfc2445</a> and
- <a href="http://kigkonsult.se/downloads/dl.php?f=rfc2446" title="Download RFC2446 in text format" target="_blank">rfc2446</a>.
- </p>
- <h4>xCal</h4>
- <p>
- iCalcreator also supports xCal (iCal xml),
- <a href="http://kigkonsult.se/downloads/dl.php?f=rfc6321" title="Download RFC6321 in text format" target="_blank">rfc6321</a>,
- The XML Format for <strong>iCalendar</strong>.
- </p>
- <h4>SUPPORT</h4>
- <p>
- For previous iCalcreator releases support upon (paid) request only.
- </p>
- <p>
- 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.
- </p>
- <p>
- kigkonsult offer professional services for software support, design and new/re-development, customizations and adaptations
- of <em>PHP</em>/<em>MySQL</em> solutions with focus on software lifecycle management, including long term utility, reliability and maintainability.
- </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>Composer (https://getcomposer.org/)
- <dd>
- <dd>composer require kigkonsult/iCalcreator
- <dd>
- <dt>or
- <dd> include the (download) iCalcreator folder to your include-path<br>
- <dd> or unpack to your application-(include)-folder
- <dd>Add
- <dd><span class="format">require_once "[path/]autoload.php";</span>
- <dd>to your <em>PHP</em>-script.
- <dd>The iCalcreator invoker has changed since previous version!
- <dd>You may also need to set the default timezone.
- </dl>
- <h4>Notes</h4>
- <p>
- When creating a new calendar(/component) object instance, review config settings.
- </p>
- <p>
- You will find 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>.
- </p>
- <p>
- Note, to ease up usage, you will find convenient holders for component names,
- properties, config keys etc in top of the "util" class file (src/util/util.php).
- </p>
- <h2>CREATE</h2>
- <p class="example">
- // <span class="comment">define time zone</span>
- $tz = "Europe/Stockholm";
- // <span class="comment">set Your unique id, </span>
- // <span class="comment">required if any component UID is missing</span>
- $config = array( kigkonsult\iCalcreator\util\util::$UNIQUE_ID => "kigkonsult.se",
- // <span class="comment">opt. set "calendar" timezone</span>
- kigkonsult\iCalcreator\util\util::$TZID => $tz );
- // <span class="comment">create a new calendar object instance</span>
- $calendar= new kigkonsult\iCalcreator\vcalendar( $config );
- // <span class="comment">required of some calendar software</span>
- $calendar->setProperty( kigkonsult\iCalcreator\util\util::$METHOD,
- "PUBLISH" );
- $calendar->setProperty( "x-wr-calname",
- "Calendar Sample" );
- $calendar->setProperty( "X-WR-CALDESC",
- "Calendar Description" );
- $calendar->setProperty( "X-WR-TIMEZONE",
- $tz );
- // <span class="comment">create an calendar event component</span>
- $vevent = $calendar->newVevent();
- // <span class="comment">set event start</span>
- $vevent->setProperty( kigkonsult\iCalcreator\util\util::$DTSTART,
- array( "year" => 2017,
- "month" => 4,
- "day" => 1,
- "hour" => 19,
- "min" => 0,
- "sec" => 0 ));
- // <span class="comment">set event end</span>
- $vevent->setProperty( kigkonsult\iCalcreator\util\util::$DTEND,
- array( "year" => 2017,
- "month" => 4,
- "day" => 1,
- "hour" => 22,
- "min" => 30,
- "sec" => 0 ));
- $vevent->setProperty( kigkonsult\iCalcreator\util\util::$LOCATION,
- "Central Placa" );
- $vevent->setProperty( kigkonsult\iCalcreator\util\util::$SUMMARY,
- "PHP summit" );
- $vevent->setProperty( kigkonsult\iCalcreator\util\util::$DESCRIPTION,
- "This is a description" );
- $vevent->setProperty( kigkonsult\iCalcreator\util\util::$COMMENT,
- "This is a comment" );
- $vevent->setProperty( kigkonsult\iCalcreator\util\util::$ATTENDEE,
- "attendee1@icaldomain.net" );
- // <span class="comment">create an event alarm</span>
- $valarm = $vevent->newValarm();
- $valarm->setProperty( kigkonsult\iCalcreator\util\util::$ACTION,
- "DISPLAY" );
- // <span class="comment">reuse the event description</span>
- $valarm->setProperty( kigkonsult\iCalcreator\util\util::$DESCRIPTION,
- $vevent->getProperty(
- kigkonsult\iCalcreator\util\util::$DESCRIPTION
- )
- );
- // <span class="comment">a local date</span>
- $d = sprintf( '%04d%02d%02d %02d%02d%02d', 2017, 3, 31, 15, 0, 0 );
- // <span class="comment">create alarm trigger (in UTC datetime)</span>
- kigkonsult\iCalcreator\timezoneHandler::transformDateTime( $d,
- $tz,
- "UTC",
- "Ymd\THis\Z" );
- $valarm->setProperty( kigkonsult\iCalcreator\util\util::$TRIGGER,
- $d );
- // <span class="comment">create another calendar event component</span>
- $vevent = $calendar->newVevent();
- // <span class="comment">alt. date format, here for an all-day event</span>
- $vevent->setProperty( kigkonsult\iCalcreator\util\util::$DTSTART,
- "20170401",
- array("VALUE" => "DATE"));
- $vevent->setProperty( kigkonsult\iCalcreator\util\util::$ORGANIZER,
- "boss@icaldomain.com" );
- $vevent->setProperty( kigkonsult\iCalcreator\util\util::$SUMMARY,
- "ALL-DAY event" );
- $vevent->setProperty( kigkonsult\iCalcreator\util\util::$DESCRIPTION,
- "This is a description for an all-day event" );
- $vevent->setProperty( kigkonsult\iCalcreator\util\util::$RESOURCES,
- "Full attension" );
- // <span class="comment">weekly, four occasions</span>
- $vevent->setProperty( kigkonsult\iCalcreator\util\util::$RRULE,
- array( "FREQ" => "WEEKLY",
- "count" => 4));
- // <span class="comment">supporting parse of strict rfc5545 formatted text</span>
- $vevent->parse( "LOCATION:1CP Conference Room 4350" );
- // <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>
- // <span class="comment">create timezone component(-s)</span>
- // <span class="comment">based on all start dates in events (i.e. all dtstarts)</span>
- // <span class="comment">X-LIC-LOCATION required of some calendar software</span>
- $xprops = array( "X-LIC-LOCATION" => $tz );
- kigkonsult\iCalcreator\timezoneHandler::createTimezone( $v,
- $tz,
- $xprops );
- </p>
- <h2>PARSE</h2>
- <h4>iCal, rfc5545 / rfc2445 </h4>
- <p>How to create iCalcreator object instance</p>
- <p class="example">
- // <span class="comment">set Your unique id, </span>
- // <span class="comment">required if any component UID is missing</span>
- $config = array( kigkonsult\iCalcreator\util\util::$UNIQUE_ID => "kigkonsult.se" );
- // <span class="comment">create a new calendar object instance</span>
- $calendar= new kigkonsult\iCalcreator\vcalendar( $config );
- </p>
- <p>and then parse a local iCal file</p>
- <p class="example">
- // <span class="comment">set directory and file name</span>
- $config = array( kigkonsult\iCalcreator\util\util::$DIRECTORY => "calendars",
- kigkonsult\iCalcreator\util\util::$FILENAME => "file.ics" );
- $calendar->setConfig( $config );
- $calendar->parse();
- // <span class="comment">continue process (edit, parse, select) $calendar</span>
- </p>
- <p>or parse a remote iCal file (resource)</p>
- <p class="example">
- // <span class="comment">support parse of remote files</span>
- $calendar->setConfig( kigkonsult\iCalcreator\util\util::$URL,
- "http://www.aDomain.net/file.ics" );
- $calendar->parse();
- // <span class="comment">ensure start date order</span>
- // <span class="comment">(opt., NOT required after parse)</span>
- $calendar->sort();
- // <span class="comment">continue process (edit, parse, select) $calendar</span>
- </p>
- <dl>
- <dt>On error
- <dd>the setConfig method returns FALSE (ex. unvalid directory/filename).
- <dd>the parse method returns FALSE.
- </dl>
- <h4>xCal, rfc6321 (XML)</h4>
- <p>
- How to convert (file) XML resource to an iCalcreator object instance.
- </p>
- <p class="example">
- // <span class="comment">set Your unique id, </span>
- // <span class="comment">required if any component UID is missing</span>
- $config = array( kigkonsult\iCalcreator\util\util::$UNIQUE_ID => "kigkonsult.se" );
- // <span class="comment">use a local xCal file</span>
- $filename = "xmlfile.xml";
- // <span class="comment"> or a remote xCal resource</span>
- /* $filename = 'http://kigkonsult.se/xcal.php?a=1&b=2&c=3'; */
- if( ! ( $calendar = kigkonsult\iCalcreator\iCalXML::XMLfile2iCal( $filename, $config )))
- exit( "Error when parsing $filename" );
- // <span class="comment">continue process (edit, parse, select) $calendar</span>
- </p>
- <h2>EDIT</h2>
- <p class="example">
- // <span class="comment">create a new calendar object instance</span>
- $config = array( kigkonsult\iCalcreator\util\util::$UNIQUE_ID => "kigkonsult.se" );
- $calendar = new kigkonsult\iCalcreator\vcalendar( $config );
- // <span class="comment">parse a calendar file</span>
- $config = array( kigkonsult\iCalcreator\util\util::$DIRECTORY => "calendars",
- kigkonsult\iCalcreator\util\util::$FILENAME => "file.ics" );
- $calendar->setConfig( $config );
- $calendar->parse();
- // <span class="comment">required of some calendar software</span>
- $calendar->setProperty( kigkonsult\iCalcreator\util\util::$METHOD,
- "PUBLISH" );
- $calendar->setProperty( "x-wr-calname",
- "Calendar Sample" );
- $calendar->setProperty( "X-WR-CALDESC",
- "Calendar Description" );
- $calendar->setProperty( "X-WR-TIMEZONE",
- "Europe/Stockholm" );
- // <span class="comment">read events, one by one</span>
- while( $vevent = $calendar->getComponent( kigkonsult\iCalcreator\util\util::$LCVEVENT )) {
- // <span class="comment">uid (unique id/key for component), required, one occurrence </span>
- $uid = $vevent->getProperty( kigkonsult\iCalcreator\util\util::$UID );
- // <span class="comment">dtstart required, one occurrence</span>
- $dtstart = $vevent->getProperty( kigkonsult\iCalcreator\util\util::$DTSTART );
- // <span class="comment">opt. description</span>
- if( $description = $vevent->getProperty( kigkonsult\iCalcreator\util\util::$DESCRIPTION,
- 1 )) {
- // <span class="comment">edit the description</span>
- // <span class="comment">update/replace the description</span>
- $vevent->setProperty( kigkonsult\iCalcreator\util\util::$DESCRIPTION, $description, FALSE, 1 );
- }
- // <span class="comment">optional comments</span>
- while( $comment = $vevent->getProperty( kigkonsult\iCalcreator\util\util::$COMMENT )) {
- .. .
- }
- // <span class="comment">remove all ATTENDEE properties .. .</span>
- while( $vevent->deleteProperty( kigkonsult\iCalcreator\util\util::$ATTENDEE ))
- continue;
- // <span class="comment">update/replace event in calendar</span>
- // <span class="comment"> with UID as key</span>
- $calendar->setComponent ( $vevent, $uid );
- }
- </p>
- <br>
- <br>
- <h2>SELECT</h2>
- <p>
- (setup)
- </p>
- <p class="example">
- // <span class="comment">create a new calendar object instance</span>
- $config = array( kigkonsult\iCalcreator\util\util::$UNIQUE_ID => "kigkonsult.se" );
- $calendar = new kigkonsult\iCalcreator\vcalendar( $config );
- // <span class="comment">iCalcreator also support remote files</span>
- $calendar->setConfig( kigkonsult\iCalcreator\util\util::$URL,
- "http://www.aDomain.net/file.ics" );
- $calendar->parse();
- // <span class="comment">required of some calendar software</span>
- $calendar->setProperty( kigkonsult\iCalcreator\util\util::$METHOD,
- "PUBLISH" );
- $calendar->setProperty( "x-wr-calname",
- "Calendar Sample" );
- $calendar->setProperty( "X-WR-CALDESC",
- "Calendar Description" );
- $calendar->setProperty( "X-WR-TIMEZONE",
- "Europe/Stockholm" );
- </p>
- <h4>Ex. calendar date based select</h4>
- <p class="example">
- // <span class="comment">select components occurring today</span>
- // <span class="comment">(including components with recurrence pattern)</span>
- $eventArray = $calendar->selectComponents();
- foreach( $eventArray as $year => $yearArray) {
- foreach( $yearArray as $month => $monthArray ) {
- foreach( $monthArray as $day => $dailyEventsArray ) {
- foreach( $dailyEventsArray as $vevent ) {
- // <span class="comment">if event is a member of a recurrence set</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>
- $currddate = $event->getProperty(
- kigkonsult\iCalcreator\util\util::$X_CURRENT_DTSTART
- );
- // <span class="comment">orig. dtstart</span>
- $dtstart = $vevent->getProperty( kigkonsult\iCalcreator\util\util::$DTSTART );
- $summary = $vevent->getProperty( kigkonsult\iCalcreator\util\util::$SUMMARY );
- $description = $vevent->getProperty( kigkonsult\iCalcreator\util\util::$DESCRIPTION );
- .. .
- .. .
- }
- }
- }
- }
- </p>
- <h4>Ex. calendar select specific property values</h4>
- <p class="example">
- // <span class="comment">fetch specific property from calendar perspective</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>
- $valueOccur = $calendar->getProperty( kigkonsult\iCalcreator\util\util::$RESOURCES );
- foreach( $valueOccur as $uniqueValue => $occurCnt ) {
- echo "The RESOURCES value <b>$uniqueValue</b> occurs <b>$occurCnt</b> times<br />";
- }
- </p>
- <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>Ex. select calendar components based on specific property value</h4>
- <p class="example">
- // <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>
- $selectSpec = array( kigkonsult\iCalcreator\util\util::$CATEGORIES => "course1" );
- $specComps = $calendar->selectComponents( $selectSpec );
- foreach( $specComps as $comp ) {
- .. .
- }
- </p>
- <br>
- <br>
- <h2>OUTPUT</h2>
- <p>(setup)</p>
- <p class="example">
- // <span class="comment">create a new calendar object instance</span>
- $config = array( kigkonsult\iCalcreator\util\util::$UNIQUE_ID => "kigkonsult.se" );
- $calendar= new kigkonsult\iCalcreator\vcalendar( $config );
- // <span class="comment">required of some calendar software</span>
- $calendar->setProperty( kigkonsult\iCalcreator\util\util::$METHOD,
- "PUBLISH" );
- $calendar->setProperty( "x-wr-calname",
- "Calendar Sample" );
- $calendar->setProperty( "X-WR-CALDESC",
- "Calendar Description" );
- $calendar->setProperty( "X-WR-TIMEZONE",
- "Europe/Stockholm" );
- // <span class="comment">continue process (edit, parse, select) $calendar</span>
- </p>
- <h5>opt 1</h5>
- <p>
- Redirect calendar file to browser.
- </p>
- <p class="example">
- $calendar->returnCalendar();
- exit;
- </p>
- <h5>opt 2</h5>
- <p>
- Save calendar to file.
- </p>
- <p class="example">
- // <span class="comment">set output directory and file name</span>
- $config = array( kigkonsult\iCalcreator\util\util::$DIRECTORY => "depot",
- kigkonsult\iCalcreator\util\util::$FILENAME => "calendar.ics" );
- $calendar->setConfig( $config );
- $calendar->saveCalendar();
- </p>
- <h5>opt 3, xCal</h5>
- <p>
- Create well-formed XML, rfc6321 (as string).
- </p>
- <p class="example">
- $xmlstr = kigkonsult\iCalcreator\iCalXML::iCal2XML( $calendar);
- </p>
- <h5>opt 4, json</h5>
- <p>
- Create a json string.
- </p>
- <p class="example">
- $xmlstr = kigkonsult\iCalcreator\iCalXML::iCal2XML( $calendar);
- $json = json_encode( simplexml_load_string( $xmlstr ));
- </p>
- <br>
- <br>
- <a name="Copyright_and_Licence"></a>
- <h2>COPYRIGHT AND LICENSE</h2>
- <table>
- <tr><td>Copyright<td>(c) 2007-2017 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
- <tr><td>Link <td>http://kigkonsult.se/iCalcreator/index.php
- <tr><td>Package <td>iCalcreator
- <tr><td>Version <td>2.24
- <tr><td class="top">License <td>
- Subject matter of licence is the software iCalcreator.<br>
- The above copyright, link, package and version notices,
- this licence notice and the [rfc5545] PRODID as implemented and
- invoked in iCalcreator shall be included in all copies or
- substantial portions of the iCalcreator.<br>
- iCalcreator can be used either under the terms of
- a proprietary license, available at <a href="https://kigkonsult.se/"><https://kigkonsult.se/></a><br>
- or the GNU Affero General Public License, version 3:<br>
- iCalcreator is free software: you can redistribute it and/or
- modify it under the terms of the GNU Affero General Public License
- as published by the Free Software Foundation, either version 3 of
- the License, or (at your option) any later version.<br>
- iCalcreator 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 Affero General Public License for more details.<br>
- You should have received a copy of the GNU Affero General Public
- License along with this program.
- If not, see <a href="http://www.gnu.org/licenses/"><http://www.gnu.org/licenses/></a>.
- </table>
- <br>
- <br>
- </body>
- </html>
|