TimeTrex/vendor/kigkonsult/icalcreator/docs/summary.html

818 lines
30 KiB
HTML
Raw Normal View History

2022-12-13 07:10:06 +01:00
<!DOCTYPE html>
<!--
iCalcreator, the PHP class package managing iCal (rfc2445/rfc5445) calendar information.
This file is a part of iCalcreator.
author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se>
copyright 2007-2022 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
link https://kigkonsult.se
license Subject matter of licence is the software iCalcreator.
The above copyright, link, package and version notices,
this licence notice and the invariant [rfc5545] PRODID result use
as implemented and invoked in iCalcreator shall be included in
all copies or substantial portions of the iCalcreator.
iCalcreator 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 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with iCalcreator. If not, see <https://www.gnu.org/licenses/>.
-->
<html lang="en">
<head>
<title>iCalcreator 2.41.70 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="2007-2022 Kjell-Inge Gustafsson, kigkonsult">
<meta name="keywords" content="ical, calendar, calender, xcal, xml, icalender, rfc2445, rfc5545, vcalender, php, create">
<meta name="description" content="iCalcreator v2.41.70 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;
}
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;
}
.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 : -o-pre-wrap; /* Opera 7 */
}
span.comment {
BACKGROUND-COLOR: transparent;
FONT-FAMILY : Areal, sans-serif;
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 : -o-pre-wrap; /* Opera 7 */
}
p.format, span.format {
BORDER : gray dotted thin;
FONT-FAMILY : Helvetica, sans-serif;
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 : -o-pre-wrap; /* Opera 7 */
}
.header {
BACKGROUND-COLOR: silver;
BORDER : thin solid black;
FONT-SIZE : xx-large;
}
p.label {
FONT-FAMILY : Arial, sans-serif;
FONT-WEIGHT : bold;
LETTER-SPACING : 0.1em;
}
p.quotes {
BACKGROUND-COLOR: #F5F5F5;
FONT-FAMILY : Arial, sans-serif;
FONT-STYLE : italic;
LETTER-SPACING : 0.1em;
}
sup {
BACKGROUND-COLOR: transparent;
FONT-SIZE : x-small;
FONT-WEIGHT : bold;
VERTICAL-ALIGN : super;
}
.top {
VERTICAL-ALIGN : top;
}
</style>
</head>
<body>
<a name="top"></a>
<p class="header">iCalcreator v2.41.70</p>
<p>
iCalcreator v2.41.70<br>
Copyright &copy; 2007-2022 Kjell-Inge Gustafsson, kigkonsult, All rights reserved.<br>
<a href="#Copyright_and_Licence">Copyright_and_Licence</a><br>
<a href="https://kigkonsult.se" title="kigkonsult.se" target="_blank">kigkonsult.se</a><br>
Contact iCal_at_kigkonsult_dot_se
</p>
<h2>Preface</h2>
<p>
This document describes usage of iCalcreator, the <em>PHP</em> software implementation of standards
<a href="https://tools.ietf.org/html/rfc5545" title="Download rfc5545" target="_blank">rfc5545</a>/
<a href="https://tools.ietf.org/html/rfc5546" title="Download rfc5546" target="_blank">rfc5546</a>/
<a href="https://tools.ietf.org/html/rfc5870" title="Download rfc5870" target="_blank">rfc5870</a>/
<a href="https://tools.ietf.org/html/rfc6321" title="Download rfc6321" target="_blank">rfc6321</a>/
<a href="https://tools.ietf.org/html/rfc6868" title="Download rfc6868" target="_blank">rfc6868</a>/
<a href="https://tools.ietf.org/html/rfc7529" title="Download rfc7529" target="_blank">rfc7529</a>/
<a href="https://tools.ietf.org/html/rfc7808" title="Download rfc7808" target="_blank">rfc7808</a>/
<a href="https://tools.ietf.org/html/rfc7986" title="Download rfc7986" target="_blank">rfc7986</a>/
<a href="https://tools.ietf.org/html/rfc9073" title="Download rfc9073" target="_blank">rfc9073</a>/
<a href="https://tools.ietf.org/html/rfc9074" title="Download rfc9074" target="_blank"> rfc9074</a>
and other IETF rfc documents to manage calendar information.
The fc5545/rfc5546 obsoletes rfc2445/rfc2446.
</p>
<p>
This document is provided by kigkonsult for informational purposes
and is provided on an &quot;as is&quot; 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</a>.
</p>
<p>
This document makes previous versions obsolete.
</p>
<p>
iCalcreator is the <em>PHP</em> class package managing iCal calendar information,
supporting (non-)calendar
systems and applications to process and communicate calendar information like
events, agendas, tasks, reports, totos and journaling information.
</p>
<p>
iCalcreator features create, parse, edit and select <strong>calendar</strong> and <strong>calendar</strong> components.
</p>
<p>
For iCalcreator 2.40 version (and later), <em>PHP</em> version &gt;= 8.0 is required,
version v2.39 <em>PHP</em>7+.
To support the development, maintenance and test process
<a href="https://github.com/PHPCompatibility/PHPCompatibility" title="PHPCompatibility">PHPCompatibility</a>,
<a href="https://github.com/phpstan/phpstan" title="PHPStan">PHPStan</a>
and
<a href="https://github.com/DeGraciaMathieu/php-arguments-detector" title="php-arguments-detector">php-arguments-detector</a>
are included.
</p>
<h4>iCal</h4>
<h4>iCal</h4>
<p>
A short iCal description is found at <a href="https://en.wikipedia.org/wiki/ICalendar" title="iCalendar From Wikipedia, the free encyclopedia" target="_blank">Wikipedia</a>.
If You are not familiar with iCal, read this first!
</p>
<a id="IETF_rfc"></a>
<p>
The <strong>iCalendar</strong> format, <strong>iCal</strong>, are described in
</p>
<dl>
<dt><a href="https://tools.ietf.org/html/rfc5545" title="Download rfc5545" target="_blank">rfc5545</a></dt>
<dd>&quot;Internet Calendaring and Scheduling Core Object Specification (<strong>iCalendar</strong>)&quot;</dd>
<dt><a href="https://tools.ietf.org/html/rfc5546" title="Download rfc5546" target="_blank">rfc5546</a></dt>
<dd>&quot;iCalendar Transport-Independent Interoperability Protocol (iTIP)&quot;<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>
</dd>
<dt><a href="https://tools.ietf.org/html/rfc5870" title="Download rfc5870" target="_blank">rfc5870</a></dt>
<dd>A Uniform Resource Identifier for Geographic Locations ('geo' URI)</dd>
<dt><a href="https://tools.ietf.org/html/rfc6321" title="Download rfc6321" target="_blank">rfc6321</a></dt>
<dd>xCal: The XML Format for iCalendar</dd>
<dt><a href="https://tools.ietf.org/html/rfc6868" title="Download rfc6868" target="_blank">rfc6868</a></dt>
<dd>Parameter Value Encoding in iCalendar and vCard</dd>
<dt><a href="https://tools.ietf.org/html/rfc7529" title="Download rfc7529" target="_blank">rfc7529</a></dt>
<dd>Non-Gregorian Recurrence Rules in the Internet Calendaring and Scheduling Core Object Specification (iCalendar)</dd>
<dt><a href="https://tools.ietf.org/html/rfc7808" title="Download rfc7808" target="_blank">rfc7808</a></dt>
<dd>Time Zone Data Distribution Service</dd>
<dt><a href="https://tools.ietf.org/html/rfc7953" title="Download rfc7953" target="_blank">rfc7953</a></dt>
<dd>Calendar Availability</dd>
<dt><a href="https://tools.ietf.org/html/rfc7986" title="Download rfc7986" target="_blank">rfc7986</a></dt>
<dd>New Properties for iCalendar</dd>
<dt><a href="https://tools.ietf.org/html/rfc9073" title="Download rfc9073" target="_blank">rfc9073</a></dt>
<dd>Event Publishing Extensions to iCalendar</dd>
<dt><a href="https://tools.ietf.org/html/rfc9074" title="Download rfc9074" target="_blank"> rfc9074</a></dt>
<dd>VALARM Extensions for iCalendar</dd>
</dl>
<p>
<a href="https://tools.ietf.org/html/rfc5545" title="Download rfc5545" target="_blank">rfc5545</a> and
<a href="https://tools.ietf.org/html/rfc5546" title="Download rfc5546" target="_blank">rfc5546</a>
obsoletes, respectively,
<a href="https://tools.ietf.org/html/rfc2445" title="Download rfc2445" target="_blank">rfc2445</a> and
<a href="https://tools.ietf.org/html/rfc2446" title="Download rfc2446" target="_blank">rfc2446</a>.
</p>
<p>
For <a href="https://www.ietf.org/" target="_blank">IETF</a> rfc documents, copyright and licence,
see the &quot;Copyright Notice&quot; content part in top of each IETF rfc document.
</p>
<p>
A short xCal description is found at
<a href="https://en.wikipedia.org/wiki/XCal" title="xCal on Wikipedia, the free encyclopedia" target="_blank">Wikipedia</a>.
</p>
<h4>Support</h4>
<p>
For bug report or support request, use <a href="https://github.com/iCalcreator/iCalcreator/issues" title="kigkonsult.se issues" target="_blank"> github issues</a>.
</p>
<p>
For previous iCalcreator (master) releases or non-emergency issues, support upon (paid) request only.
</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 project iCalcreator
using <a href="https://paypal.me/kigkonsult" rel="nofollow" target="_blank">paypal.me/kigkonsult</a>.
For invoice, <a href="mailto:ical@kigkonsult.se">please e-mail</a>.
</p>
<h4>Downloads and usage examples</h4>
<p>
At <a href="https://github.com/iCalcreator/iCalcreator" title="kigkonsult iCalcreator" target="_blank">kigkonsult.se</a> you can download a more
complete manual and review and explore iCalcreator usage.
</p>
<h4>Install</h4>
<dl>
<dt>Composer (https://getcomposer.org/)
<dd>&nbsp;
<dd>composer require kigkonsult/icalcreator
<dd>&nbsp;
<dt>Or
<dd> include the (download) iCalcreator folder to your include-path
<dd>Add
<dd><span class="format">require_once &quot;[path/]iCalcreator-2.41.70/autoload.php&quot;;</span>
<dd>to your <em>PHP</em>-script.
</dl>
<p>
For PHP7 use 2.39.
</p>
<p>
iCalcreator 2.41.70 is using namespace &quot;Kigkonsult\Icalcreator&quot;.
</p>
<h4>Notes</h4>
<p>
When creating a new Vcalendar(/component) instance, review config settings.
</p>
<p>
Note, to ease up usage, you will find convenient constants for component names,
properties, config keys etc in (src/)IcalInterface.
</p>
<h2>CREATE</h2>
<p class="example">
&lt;?php
use Kigkonsult\Icalcreator\Vcalendar;
use DateTime;
use DateTimezone;
// <span class="comment">define time zone</span>
$tz = &quot;Europe/Stockholm&quot;;
// <span class="comment">set Your unique id, </span>
// <span class="comment">site info for the Vcalendar PRODID property</span>
$config = [
Vcalendar::UNIQUE_ID =&gt; &quot;kigkonsult.se&quot;,
];
// <span class="comment">create a new Vcalendar instance</span>
$calendar = Vcalendar::factory( $config )
// <span class="comment">required of some calendar software</span>
-&gt;setMethod( Vcalendar::PUBLISH )
-&gt;setXprop( Vcalendar::X_WR_CALNAME, &quot;Calendar Sample&quot; );
-&gt;setXprop( Vcalendar::X_WR_CALDESC, &quot;Calendar Description&quot; );
->setXprop( Vcalendar::X_WR_RELCALID,"3E26604A-50F4-4449-8B3E-E4F4932D05B5" )
-&gt;setXprop( Vcalendar::X_WR_TIMEZONE, $tz );
// <span class="comment">create an calendar event component</span>
$vevent1 = $calendar-&gt;newVevent()
// <span class="comment">set event start</span>
-&gt;setDtstart( new DateTime( '2017-04-01 19:00:00', new DateTimezone( $tz )))
// <span class="comment">set event end</span>
-&gt;setDtend( new DateTime( '2017-04-01 22:30:00', new DateTimezone( $tz )))
// <span class="comment">describe the event</span>
->setSummary( 'Scheduled meeting with six occurrences' )
->setDescription(
'Agenda for the the meeting...',
[ Vcalendar::ALTREP =>
'CID:&lt;FFFF__=0ABBE548DFE235B58f9e8a93d@coffeebean.com&gt;' ]
)
->setComment( 'It\'s going to be fun..' )
// <span class="comment">place the event</span>
->setLocation( 'Kafé Ekorren Stockholm' )
->setGeo( '59.32206', '18.12485' )
// <span class="comment">with recurrence rule</span>
->setRrule(
[
Vcalendar::FREQ => Vcalendar::WEEKLY,
Vcalendar::COUNT => 5,
]
)
// <span class="comment">and set another using a recurrence date</span>
->setRdate(
[
new DateTime( '20190609T090000', new DateTimezone( $tz )),
new DateTime( '20190609T110000', new DateTimezone( $tz )),
],
[ Vcalendar::VALUE => Vcalendar::PERIOD ]
)
// <span class="comment">revoke a recurrence date</span>
->setExdate( new DateTime( '2019-05-12 09:00:00', new DateTimezone( $tz )))
// <span class="comment">organizer, chair and some participants</span>
->setOrganizer(
'secretary@coffeebean.com',
[ Vcalendar::CN => 'Secretary CoffeeBean' ]
)
->setAttendee(
'president@coffeebean.com',
[
Vcalendar::ROLE => Vcalendar::CHAIR,
Vcalendar::PARTSTAT => Vcalendar::ACCEPTED,
Vcalendar::RSVP => Vcalendar::FALSE,
Vcalendar::CN => 'President CoffeeBean',
]
)
->setAttendee(
'participant1@coffeebean.com',
[
Vcalendar::ROLE => Vcalendar::REQ_PARTICIPANT,
Vcalendar::PARTSTAT => Vcalendar::NEEDS_ACTION,
Vcalendar::RSVP => Vcalendar::TRUE,
Vcalendar::CN => 'Participant1 CoffeeBean',
]
)
->setAttendee(
'participant2@coffeebean.com',
[
Vcalendar::ROLE => Vcalendar::REQ_PARTICIPANT,
Vcalendar::PARTSTAT => Vcalendar::NEEDS_ACTION,
Vcalendar::RSVP => Vcalendar::TRUE,
Vcalendar::CN => 'Participant2 CoffeeBean',
]
);
// <span class="comment">add an alarm for the event</span>
$alarm = $event1->newValarm()
->setAction( Vcalendar::DISPLAY )
// <span class="comment">copy description from event</span>
->setDescription( $event1->getDescription())
// <span class="comment">fire off the alarm one day before</span>
->setTrigger( '-P1D' );
// <span class="comment">alter day and time for one event in recurrence set</span>
$event2 = $vcalendar->newVevent()
->setTransp( Vcalendar::OPAQUE )
->setClass( Vcalendar::P_BLIC )
// <span class="comment">reference to one event in recurrence set</span>
->setUid( $event1->getUid())
->setSequence( 2 )
// <span class="comment">pointer to event in the recurrence set</span>
->setRecurrenceid( '20190505T090000 Europe/Stockholm' )
// <span class="comment">opt. some description</span>
->setDescription(
'Altered day and time for event 2019-05-05',
[ Vcalendar::ALTREP =>
'CID:&lt;FFFF__=0ABBE548DFE235B58f9e8a93d@coffeebean.com&gt;' ]
)
// <span class="comment">reason comment</span>
->setComment( 'working hard for two hours...' )
// <span class="comment">the altered day and time with duration</span>
->setDtstart( new DateTime( '20190504T100000', new DateTimezone( $tz )))
->setDuration( 'PT2H' )
// <span class="comment">add alarm (copy from event1)</span>
->setComponent( $event1->getComponent( Vcalendar::VALARM ));
$calendarString = $vcalendar
// <span class="comment">apply appropriate Vtimezone with Standard/DayLight components</span>
->vtimezonePopulate()
// <span class="comment">and create the (string) calendar</span>
->createCalendar();
</p>
<h2>PARSE</h2>
<h4>iCal, rfc5545 </h4>
<p>How to parse an iCal (local file) resource</p>
<p class="example 1">&lt;?php
use Kigkonsult\Icalcreator\Vcalendar;
// <span class="comment">set Your unique id, </span>
// <span class="comment">site info for the Vcalendar PRODID property</span>
$vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID =&gt; &quot;kigkonsult.se&quot;, ] );
// <span class="comment">get iCal contents from file</span>
$iCalContent = file_get_contents( &quot;calendar.ics&quot; );
// <span class="comment">parse iCal contents</span>
$vcalendar-&gt;parse( $iCalContent );
<p class="label">parse example 2</p>
<p>
Here using <a href="https://github.com/iCalcreator/UrlRsrc" target="_blank" title="download UrlRsrc">UrlRsrc</a> to download an internet (URL) resource.
</p>
<p class="example">
&lt;?php
use Kigkonsult\Icalcreator\Vcalendar;
use Kigkonsult\Http\UrlRsrc;
// <span class="comment">set Your unique id, </span>
// <span class="comment">site info for the Vcalendar PRODID property</span>
$vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID =&gt; &quot;kigkonsult.se&quot; ] );
// <span class="comment">get iCal contents from URL resource</span>
$iCalContent = UrlRsrc::getContent( &quot;http://www.ical.net/calendars/calendar.ics&quot; );
// <span class="comment">parse iCal contents</span>
$vcalendar-&gt;parse( $iCalContent );
</p>
<h4>xCal, rfc6321 (XML)</h4>
<p>
How to convert an XML resource to an Vcalendar class instance.
</p>
<p class="example">
&lt;?php
use Kigkonsult\Icalcreator\Vcalendar;
use Kigkonsult\Icalcreator\Xml\Parser as XmlParser;
// <span class="comment">set Your unique id, </span>
// <span class="comment">site info for the Vcalendar PRODID property</span>
$config = [ Vcalendar::UNIQUE_ID =&gt; &quot;kigkonsult.se&quot; ];
// <span class="comment">use a local or remote xCal file</span>
$filename = &quot;xmlfile.xml&quot;;
// <span class="comment">get string XML contents from file</span>
$iCalContent = file_get_contents( $filename );
// <span class="comment">parse the string XML contents to Vcalendar class instance</span>
try {
$calendar = XmlParser::XML2iCal( $iCalContent, $config );
}
catch( Exception $e ) {
exit( &quot;XML parse error&quot; );
}
// <span class="comment">continue process (edit, parse, select) $calendar</span>
.. .
.. .
</p>
<h2>EDIT</h2>
<p>
(setup)
</p>
<p class="example">
&lt;?php
use Kigkonsult\Icalcreator\Vcalendar;
// <span class="comment">create a new Vcalendar instance</span>
$calendar = new Vcalendar( [ Vcalendar::UNIQUE_ID =&gt; &quot;kigkonsult.se&quot; ] );
// <span class="comment">get iCal contents from file</span>
$iCalContent = file_get_contents( &quot;calendar.ics&quot; );
// <span class="comment">parse iCal contents</span>
$calendar-&gt;parse( $iCalContent )
// <span class="comment">required of some calendar software</span>
-&gt;setMethod( Vcalendar::PUBLISH )
-&gt;setXprop( Vcalendar::X_WR_CALNAME, &quot;Calendar Sample&quot; )
-&gt;setXprop( Vcalendar::X_WR_CALDESC, &quot;Calendar Description&quot; )
-&gt;setXprop( Vcalendar::X_WR_TIMEZONE, &quot;Europe/Stockholm&quot; );
</p>
<p>
Get and set values
</p>
<p class="example">
.. .
// <span class="comment">read events, one by one</span>
foreach( $calendar-&gt;getComponents( Vcalendar::VEVENT ) as $vevent ) {
// <span class="comment">get uid (unique id/key for component), required, one occurrence </span>
$uid = $vevent-&gt;getUid();
// <span class="comment">get dtstart, required, one occurrence</span>
$dtstart = $vevent-&gt;getDtstart();
// <span class="comment">opt. description</span>
if( false != ( $description = $vevent-&gt;getDescription())) {
// <span class="comment">edit the description</span>
.. .
// <span class="comment">update/replace the description</span>
$vevent-&gt;setDescription( $description );
} // end if
// <span class="comment">get optional comments, may occur multiple times</span>
foreach( $vevent-&gt;getAllComment() as $comment ) {
.. .
} // end foreach
// <span class="comment">remove all ATTENDEE properties .. .</span>
while( $vevent-&gt;deleteAttendee()) {
continue;
} // end while
// <span class="comment">update/replace event in calendar with UID as key</span>
$calendar-&gt;setComponent( $vevent, $uid );
} // end foreach
</p>
<h2>SELECT</h2>
<p>
(setup as above)
</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-&gt;selectComponents();
foreach( $eventArray as $year =&gt; $yearArray) {
foreach( $yearArray as $month =&gt; $monthArray ) {
foreach( $monthArray as $day =&gt; $dailyEventsArray ) {
foreach( $dailyEventsArray as $vevent ) {
// <span class="comment">if event is a member of a recurrence set</span>
// <span class="comment">returns [ </span>
// <span class="comment"> &quot;x-current-dtstart&quot;,</span>
// <span class="comment"> (string) date( &quot;Y-m-d [H:i:s][timezone]&quot; )</span>
// <span class="comment">]</span>
$currDate = $event-&gt;getXprop( Vcalendar::X_CURRENT_DTSTART );
// <span class="comment">orig. dtstart</span>
$dtstart = $vevent-&gt;getDtstart();
// <span class="comment">event description</span>
$summary = $vevent-&gt;getSummary();
$description = $vevent-&gt;getDescription();
.. .
.. .
} // end foreach
} // end foreach
} // end foreach
} // end foreach
</p>
<h4>Ex. calendar select specific property values</h4>
<p>
(setup as above)
</p>
<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-&gt;getProperty( Vcalendar::RESOURCES );
foreach( $valueOccur as $uniquePropertyValue =&gt; $occurCnt ) {
echo 'The RESOURCES value ' . $uniquePropertyValue .
' occurs ' . $occurCnt . ' times';
}
</p>
<p>
<sup>*</sup>) Using the non-standard directive "GEOLOCATION", iCalcreator returns output
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>
(setup as above)
</p>
<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 = [ Vcalendar::CATEGORIES =&gt; &quot;course1&quot; ];
$specComps = $calendar-&gt;selectComponents( $selectSpec );
foreach( $specComps as $component ) {
.. .
}
</p>
<h2>OUTPUT</h2>
<h5>opt 1</h5>
<p>
Get calendar as string
</p>
<p class="example">
.. .
$calendarStr = $calendar-&gt;createCalendar();
</p>
<h5>opt 2</h5>
<p>
Redirect calendar file to browser.
</p>
<p class="example">
.. .
$calendar-&gt;returnCalendar();
exit;
</p>
<h5>opt 3</h5>
<p>
Save calendar to file.
</p>
<p class="example">
.. .
// <span class="comment">Get calendar as string</span>
$calendarStr = $calendar-&gt;createCalendar();
// <span class="comment">Save string as file</span>
file_put_contents( &quot;calendar.ics&quot;, $calendarStr );
</p>
<h5>opt 4, xCal</h5>
<p>
Create well-formed XML, rfc6321 (as string) from a Vcalendar class instance.
</p>
<p class="example">
.. .
$xmlstr = Kigkonsult\Icalcreator\Xml\Formatter::iCal2XML( $calendar);
</p>
<h5>opt 5, json</h5>
<p>
Create a json string from a Vcalendar class instance.
</p>
<p>
You can export and import
(<a href="https://tools.ietf.org/html/rfc8984" title="Download rfc8984" target="_blank">rfc8984</a>)
iCal json using
<a href="https://github.com/iCalcreator/PhpJsCalendar" title="PhpJsCalendar" target="_blank">PhpJsCalendar</a>
</p>
<p>
or.. .
</p>
<p class="example">
.. .
$xmlstr = Kigkonsult\Icalcreator\Xml\Formatter::iCal2XML( $calendar);
$json = json_encode( simplexml_load_string( $xmlstr ));
</p>
<br>
<br>
<a id="Copyright_and_Licence"></a>
<h2>COPYRIGHT AND LICENSE</h2>
<p>
In this document may exist quotes and/or extracts from
<a href="https://www.ietf.org/" target="_blank">IETF</a> <a href="#IETF_rfc">rfc</a> documents,
for copyright and licence, see the &quot;Copyright Notice&quot; content part
in top of each IETF <a href="#IETF_rfc">rfc</a> document.
</p>
<table>
<tr><td>Copyright<td>(c) 2007-2022 Kjell-Inge Gustafsson, kigkonsult, All rights reserved
<tr><td>Link <td>https://kigkonsult.se
<tr><td>Package <td>iCalcreator
<tr><td>Version <td>2.41.70
<tr><td class="top">License <td>
Subject matter of licence is the software iCalcreator.<br>
The above copyright, link, package and version notices,<br>
this licence notice and the invariant [rfc5545] PRODID result use<br>
as implemented and invoked in iCalcreator shall be included in<br>
all copies or substantial portions of the iCalcreator.<br>
<br>
iCalcreator is free software: you can redistribute it and/or modify<br>
it under the terms of the GNU Lesser General Public License as published<br>
by the Free Software Foundation, either version 3 of the License,<br>
or (at your option) any later version.<br>
<br>
iCalcreator is distributed in the hope that it will be useful,<br>
but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
GNU Lesser General Public License for more details.<br>
<br>
You should have received a copy of the GNU Lesser General Public License<br>
along with iCalcreator. If not, see &lt;https://www.gnu.org/licenses/&gt;.
</table>
<br>
</body>
</html>