756 lines
30 KiB
HTML
756 lines
30 KiB
HTML
|
<!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-2018 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
|
||
|
Link http://kigkonsult.se/iCalcreator/index.php
|
||
|
Package iCalcreator
|
||
|
Version 2.24.2
|
||
|
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.2 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.2 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.2</h1>
|
||
|
<p>
|
||
|
iCalcreator v2.24.2<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.2 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.2
|
||
|
<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>
|