iCalcreator v2.39
iCalcreator v2.39
Copyright © 2007-2021 Kjell-Inge Gustafsson, kigkonsult, All rights reserved.
Copyright_and_Licence
kigkonsult.se
Contact iCal_at_kigkonsult_dot_se
This document describes usage of iCalcreator, the PHP software implementation of standards rfc5545/ rfc5546 rfc6321 rfc7986 to manage calendar information. The fc5545/rfc5546 obsoletes rfc2445/rfc2446.
This document is provided by kigkonsult for informational purposes and is provided on an "as is" basis without any warranties expressed or implied.
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 license agreement. The software may be used only in accordance with the terms of that license agreement. It is against the law to copy or use the software except as specifically allowed in the license agreement.
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.
The use of the software implies acceptance of these terms and the license.
This document makes previous versions obsolete.
[index]iCalcreator is the PHP 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.
iCalcreator features create, parse, edit and select calendar and calendar components.
For iCalcreator 2.39 version (and later), PHP version >= 7.0 is required. v2.29.25 and later asserts PHP 7+ compability using PHPCompatibility and (v2.39+) PHPStan.
A short iCal description is found at Wikipedia. If You are not familiar with iCal, read this first!
The iCalendar format, iCal, are described in
. ..allows for the capture and exchange of information normally stored within a calendaring and scheduling application.
and. ..is an exchange format between applications or systems.
rfc5545 and rfc5546 obsoletes, respectively, rfc2445 and rfc2446.
A short xCal description is found at Wikipedia.
This style is used for text.
This style is used for formats.
This style is used for PHP coding examples. // this style is used for coding comments.
This style is used for content details.
This style is used for RFC2445/5545 quotes.
The release numbering convention used is major.minor(.micro / suffix).
The release plan is based on yearly releases with exception of emergency releases.
For bug report or support request, use github issues.
For previous iCalcreator (master) releases or non-emergency issues, support upon (paid) request only.
kigkonsult offer professional services for software support, design and new/re-development and unit tests of PHP/MySQL solutions with focus on software lifecycle management, including long term utility, reliability and maintainability.
You can show your appreciation for our free software, and can support future development by making a donation to the kigkonsult project iCalcreator using paypal.me/kigkonsult. For invoice, please e-mail.
iCalcreator 2.39 is using namespace "Kigkonsult\Icalcreator".
Here are update headlines in this version.
Some properties (ex. as described in wikipedia:iCal) may be required when importing iCal formatted data into some calendaring software (MS etc). Also X-properties may appear in exports. Below are examples
* Created automatically in iCalcreator, if not set.
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::METHOD,
- Kigkonsult\Icalcreator\Vcalendar::X_WR_CALNAME,
- Kigkonsult\Icalcreator\Vcalendar::X_WR_CALDESC,
- Kigkonsult\Icalcreator\Vcalendar::X_WR_RELCALID,
- Kigkonsult\Icalcreator\Vcalendar::X_WR_TIMEZONE,
- Kigkonsult\Icalcreator\Vcalendar::X_LIC_LOCATION
are available.
Example
A strong recommendation is also to set config unique_id when creating a new Vcalendar instance, to ensure accurate setting of PRODID property. Also setting "X-WR-TIMEZONE" (below) is to recommend.
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $vcalendar->setMethod( Vcalendar::PUBLISH ) ->setXprop( Vcalendar::X_WR_CALNAME, "Calendar Sample" ) ->setXprop( Vcalendar::X_WR_CALDESC, "Calendar Description" ) ->setXProp( Vcalendar::X_WR_RELCALID, "3E26604A-50F4-4449-8B3E-E4F4932D05B5" ) ->setXprop( Vcalendar::X_WR_TIMEZONE, "Europe/Stockholm" );
Note, to ease up usage, you will find convenient constants for component names, properties, config keys etc in (src/)IcalInterface.
Note, properties suffixed by "*", described in rfc7986 iCalendar Property Extensions, may NOT be supported by all calendaring software.
icalobject = 1*("BEGIN" ":" "VCALENDAR" CRLF
icalbody
"END" ":" "VCALENDAR" CRLF)
icalbody = calprops component
calprops = 2*(
REQUIRED, MUST NOT occur more than once
prodid / version /
optional, MUST NOT occur more than once
uid* / last-mod* / url* / refresh* / source* / color*
optional and MAY occur more than once
name* / description* / categories* / image*
)
component = 1*(eventc / todoc / journalc / freebusyc / timezonec / iana-comp* / x-comp*)
iana-comp = "BEGIN" ":" iana-token CRLF
1*contentline
"END" ":" iana-token CRLF
x-comp = "BEGIN" ":" x-name CRLF
1*contentline
"END" ":" x-name CRLF
*) not supported by iCalcreator
[index] [top] [up]"BEGIN" ":" "VEVENT" CRLF
eventprop *alarmc
"END" ":" "VEVENT" CRLF
eventprop = *(
optional, MUST NOT occur more than once
class / created / description / dtstart /
geo / last-mod / location / organizer / priority /
dtstamp / seq / status / summary /
transp / uid / url / recurid /
either "dtend" or "duration" may appear in a "eventprop",
but "dtend" and "duration" MUST NOT occur in the same "eventprop"
optional and MAY occur more than once
attach / attendee / categories / comment /
contact / exdate / exrule / rstatus /
related / resources / rdate / rrule / x-prop
)
[index] [top] [up]"BEGIN" ":" "VTODO" CRLF
todoprop *alarmc
"END" ":" "VTODO" CRLF
todoprop = *(
optional, MUST NOT occur more than once
class / completed / created / description / dtstamp / dtstart /
geo / last-mod / location / organizer / percent / priority /
recurid / seq / status / summary /uid / url /
either "due" or "duration" may appear in a "todoprop",
but "due" and "duration" MUST NOT occur in the same "todoprop"
optional and MAY occur more than once
attach / attendee / categories / comment /
contact / exdate / exrule / rstatus /
related / resources / rdate / rrule / x-prop
)
[index] [top] [up]journalc = "BEGIN" ":" "VJOURNAL" CRLF
jourprop
"END" ":" "VJOURNAL" CRLF
jourprop = *(
optional, MUST NOT occur more than once
class / created / description / dtstart /
dtstamp / last-mod / organizer / recurid /
seq / status / summary /uid / url /
optional, MAY occur more than once
attach / attendee / categories / comment /
contact / exdate / exrule / related /
rdate / rrule / rstatus / x-prop
)
[index] [top] [up]"BEGIN" ":" "VFREEBUSY" CRLF
fbprop
"END" ":" "VFREEBUSY" CRLF
fbprop = *(
optional, MUST NOT occur more than once
contact / dtstart / dtend / duration /
dtstamp / organizer / uid / url /
optional, MAY occur more than once
attendee / comment / freebusy / rstatus / x-prop
)
[index] [top] [up]"BEGIN" ":" "VALARM" CRLF
(audioprop / dispprop / emailprop / procprop)
"END" ":" "VALARM" CRLF
audioprop = 2*(
"action" and "trigger" are both REQUIRED, but MUST NOT occur more than once
"duration" and "repeat" are both optional,and MUST NOT occur more than once each,
but if one occurs, so MUST the other
optional, MUST NOT occur more than once
attach /
optional, MAY occur more than once
)
dispprop = 3*(
REQUIRED, MUST NOT occur more than once
action / description / trigger /
"duration" and "repeat" are both optional,and MUST NOT occur more than once each,
but if one occurs, so MUST the other
optional, MAY occur more than once
)
emailprop = 5*(
REQUIRED, MUST NOT occur more than once
action / description / trigger / summary
REQUIRED, MAY occur more than once
attendee /
"duration" and "repeat" are both optional, and MUST NOT occur more than once each,
but if one occurs, so MUST the other
optional, MAY occur more than once
)
procprop = 3*(
REQUIRED, MUST NOT occur more than once
"duration" and "repeat" are both optional, and MUST NOT occur more than once each,
but if one occurs, so MUST the other
"description" is optional, and MUST NOT occur more than once
optional, MAY occur more than once
)
[index] [top] [up]"BEGIN" ":" "VTIMEZONE" CRLF
2*(
"tzid" is required, but MUST NOT occur more than once
tzid /
"last-mod" and "tzurl" are optional, but MUST NOT occur more than once
one of "standardc" or "daylightc" MUST occur and each MAY occur more than once.
standardc / daylightc /
optional, MAY occur more than once
)
"END" ":" "VTIMEZONE" CRLF
standardc = "BEGIN" ":" "STANDARD" CRLF
tzprop
"END" ":" "STANDARD" CRLF
daylightc = "BEGIN" ":" "DAYLIGHT" CRLF
tzprop
"END" ":" "DAYLIGHT" CRLF
tzprop = 3*(
REQUIRED, MUST NOT occur more than once
dtstart / tzoffsetto / tzoffsetfrom /
optional, MAY occur more than once
comment /rdate / rrule / tzname / x-prop
)
[index] [top] [up]A comprehensive table showing relation between calendar components and properties. vtimezone properties are not included.
0-1 | OPTIONAL property, MUST NOT occur more than once. | ||||||||
0-m | OPTIONAL property, MAY occur more than once. | ||||||||
0 / 1=1 | A pair of OPTIONAL properties, MUST NOT occur more than once each. If one occurs, so MUST the other |
||||||||
0*1 | A pair of OPTIONAL properties, MUST NOT occur more than once each. If one occurs, so MUST NOT the other |
||||||||
1-m | REQUIRED property, MAY occur more than once. | ||||||||
1 | REQUIRED property, MUST NOT occur more than once. | ||||||||
Note, property table values suffixed by "*", described in rfc7986 iCalendar Property Extensions, may NOT be supported by all calendaring software. | |||||||||
v c a l e n d a r |
v e v e n t |
v t o d o |
v j o u r n a l |
v f r e e b u s y |
v a l a r m | ||||
a u d i o |
d i s p l a y |
e m a i l |
p r o c e d u r e |
||||||
action | 1 | 1 | 1 | 1 | |||||
attach | 0-m | 0-m | 0-m | 0-1 | 0-m | 1 | |||
attendee | 0-m | 0-m | 0-m | 0-m | 1-m | ||||
categories | 0-m* | 0-m | 0-m | 0-m | |||||
class | 0-1 | 0-1 | 0-1 | ||||||
color | 0-1* | 0-1* | 0-1* | 0-1* | |||||
comment | 0-m | 0-m | 0-m | 0-m | |||||
completed | 0-1 | ||||||||
conference | 0-m* | 0-m* | |||||||
contact | 0-m | 0-m | 0-m | 0-1 | |||||
created | 0-1 | 0-1 | 0-1 | ||||||
description | 0-m* | 0-1 | 0-1 | 0-m | 1 | 1 | 0-1 | ||
dtend | 0*1 | 0-1 | |||||||
dtstamp | 0-1 | 0-1 | 0-1 | 0-1 | |||||
dtstart | 0-1 | 0-1 | 0-1 | 0-1 | |||||
due | 0*1 | ||||||||
duration | 0*1 | 0*1 | 0-1 | 0 / 1=1 | 0 / 1=1 | 0 / 1=1 | 0 / 1=1 | ||
exdate | 0-m | 0-m | 0-m | ||||||
exrule | 0-m | 0-m | 0-m | ||||||
freebusy | 0-m | ||||||||
geo | 0-1 | 0-1 | |||||||
image | 0-m* | 0-m* | |||||||
last-mod | 0-1* | 0-1 | 0-1 | 0-1 | |||||
name | 0-m* | ||||||||
location | 0-1 | 0-1 | |||||||
organizer | 0-1 | 0-1 | 0-1 | 0-1 | |||||
percent | 0-1 | ||||||||
priority | 0-1 | 0-1 | |||||||
rdate | 0-m | 0-m | 0-m | ||||||
recurid | 0-1 | 0-1 | 0-1 | ||||||
refresh | 0-1* | ||||||||
related | 0-m | 0-m | 0-m | ||||||
repeat | 0 / 1=1 | 0 / 1=1 | 0 / 1=1 | 0 / 1=1 | |||||
resources | 0-m | 0-m | |||||||
rrule | 0-m | 0-m | 0-m | ||||||
rstatus | 0-m | 0-m | 0-m | 0-m | |||||
sequence | 0-1 | 0-1 | 0-1 | ||||||
source | 0-1* | ||||||||
status | 0-1 | 0-1 | 0-1 | ||||||
summary | 0-1 | 0-1 | 0-1 | 1 | |||||
transp | 0-1 | ||||||||
trigger | 1 | 1 | 1 | 1 | |||||
uid | 1* | 0-1 | 0-1 | 0-1 | 0-1 | ||||
url | 0-1* | 0-1 | 0-1 | 0-1 | 0-1 | ||||
x-prop | 0-m | 0-m | 0-m | 0-m | 0-m | 0-m | 0-m | 0-m |
If not set, the DTSTAMP and UID properties
are automatically created by iCalcreator
for vcalendar (UID only),
vevent,
vtodo,
vjournal and
vfreebusy components
when using Vcalendar method returnCalendar
or using component::getDtstamp() (DTSTAMP)
or component::getUid() (UID) methods.
Create a new VCALENDAR object instance.
Throws InvalidArgumentException on (set)config error.
Format
Vcalendar::__construct( [ config ] )
config = array, review configuration options.
Example
use Kigkonsult\Icalcreator\Vcalendar; $config = [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ]; $vcalendar = new Vcalendar( $config );
The calendar PRODID property (based on the configuration unique_id) and the calendar/component UID property are AUTOMATICALLY generated in iCalcreator.
Example 2
use Kigkonsult\Icalcreator\Vcalendar; $tz = "Europe/Stockholm" $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $vcalendar->setXProp( Vcalendar::X_WR_TIMEZONE, $tz ); // insert components or parse an iCal string calendar (and edit components) .. .
Some calendar software may also require calendar property X-WR-TIMEZONE and vtimezone component with property X-LIC-LOCATION, review Vcalendar populate or Util/VtimezonePopulateFactory::process methods.
Create a new Vcalendar object instance using a factory-method.
Throws InvalidArgumentException on (set)config error.
Format
Vcalendar::factory( [ config ] )
config = array, review configuration options.
Example
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = Vcalendar::factory( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ) ->setMethod( "PUBLIC" );
To ease up usage, constant Kigkonsult\Icalcreator\Vcalendar::VEVENT is available.
Format 1
Create a new VEVENT object instance using an Vcalendar component factory-method.
Throws InvalidArgumentException on (set)config error.
Vcalendar::newVevent()
Example
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $vevent = $vcalendar->newVevent() ->setDtstart( ...
Format 2
Create a new VEVENT object instance.
Throws InvalidArgumentException on (set)config error.
vevent::__construct( [ config ] )
config = array, review configuration options.
Example
use Kigkonsult\Icalcreator\Vcalendar; use Kigkonsult\Icalcreator\Vevent; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $config = $vcalendar->getConfig(); $vevent = new Vevent( $config ); .. . $vcalendar->setComponent( $vevent );
To ease up usage, constant Kigkonsult\Icalcreator\Vcalendar::VTODO is available.
Format 1
Create a new VTODO object instance using an Vcalendar component factory-method.
Throws InvalidArgumentException on (set)config error.
Vcalendar::newVtodo()
Example
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $vtodo = $vcalendar->newVtodo() ->setDtstart( ...
Format 2
Create a new VTODO object instance.
Throws InvalidArgumentException on (set)config error.
vtodo::__construct( [ config ] )
config = array, review configuration options.
Example
use Kigkonsult\Icalcreator\Vcalendar; use Kigkonsult\Icalcreator\Vtodo; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $vtodo = new Vtodo( $vcalendar->getConfig()); .. . $vcalendar->setComponent( $vtodo );
To ease up usage, constant Kigkonsult\Icalcreator\Vcalendar::VJOURNAL is available.
Format 1
Create a new VJOURNAL object instance using an Vcalendar factory-method.
Throws InvalidArgumentException on (set)config error.
Vcalendar::newVjournal()
Example
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $vjournal = $vcalendar->newVjournal() ->setDtstart( .. .
Format 2
Create a new VJOURNAL object instance.
Throws InvalidArgumentException on (set)config error.
vjournal::__construct( [ config ] )
config = array, review configuration options.
Example
use Kigkonsult\Icalcreator\Vcalendar; use Kigkonsult\Icalcreator\Vjournal; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $vjournal = new Vjournal( $vcalendar->getConfig()); .. . $vcalendar->setComponent( $vjournal );
To ease up usage, constant Kigkonsult\Icalcreator\Vcalendar::VFREEBUSY is available.
Format 1
Create a new VFREEBUSY object instance using an Vcalendar factory-method, returning a reference to the new component.
Throws InvalidArgumentException on (set)config error.
Vcalendar::newVfreebusy()
Example
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $vfreebusy = $vcalendar->newVfreebusy() ->setFreebusy(...
Format 2
Create a new VFREEBUSY object instance.
Throws InvalidArgumentException on (set)config error.
vfreebusy::__construct( [ config ] )
config = array, review configuration options.
Example
use Kigkonsult\Icalcreator\Vcalendar; use Kigkonsult\Icalcreator\Vfreebusy; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $vfreebusy = new Vfreebusy( $vcalendar->getConfig()); .. . $vcalendar->setComponent( $vfreebusy );
Format 1
Create a new VALARM object instance using an Vcalendar component factory-method. The VALARM calendar component MUST only appear (one or more) in either a VEVENT or VTODO calendar component.
To ease up usage, constant Kigkonsult\Icalcreator\Vcalendar::VALARM is available.
calendarComponent::newValarm()
Example
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $vevent = $vcalendar->newVevent() ->setDtstart( .. . $valarm = $vevent->newValarm() ->setTrigger( .. . $vtodo = $vcalendar->newVtodo() ->setDtstart( .. . $valarm = $vtodo->newValarm() ->setTrigger( .. .
Format 2
Create a new VALARM object instance.
Throws InvalidArgumentException on (set)config error.
valarm::__construct( [ config ] )
config = array, review configuration options.
Example
use Kigkonsult\Icalcreator\Vcalendar; use Kigkonsult\Icalcreator\Vevent; use Kigkonsult\Icalcreator\Valarm; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $vevent = new Vevent( $vcalendar->getConfig()); .. . $valarm = new Valarm( $vevent->getConfig()); .. . $vevent->setComponent( $valarm ); $vcalendar->setComponent( $vevent );
The vtimezone component describe, at a minimum, the base offset from UTC for the time zone. For dates with UTC DATE-TIME, read this!
To ease up usage, constant Kigkonsult\Icalcreator\Vcalendar::VTIMEZONE is available.
Throws InvalidArgumentException on (set)config error.
Format 1
Vcalendar::newVtimezone()
Example
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $vtimezone = $vcalendar->newVtimezone() ->setTzname(...
Format 2
Create a new VTIMEZONE object instance.
Throws InvalidArgumentException on (set)config error.
vtimezone::__construct( [ config ] )
config = array, review configuration options.
Example
use Kigkonsult\Icalcreator\Vcalendar; use Kigkonsult\Icalcreator\Vtimezone; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $vtimezone = new Vtimezone( $vcalendar->getConfig()); .. . $vcalendar->setComponent( $vtimezone );
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::STANDARD
- Kigkonsult\Icalcreator\Vcalendar::DAYLIGHT
are available.
Format 1
Create a new VTIMEZONE standard / daylight object instances using an VTIMEZONE component factory-method.
vtimezone::newStandard()
vtimezone::newDaylight()
Example
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $vtimezone = $vcalendar->newVtimezone(); .. . $standard = $vtimezone->newStandard(); .. . $daylight = $vtimezone->newDaylight(); .. .
Format 2
Create a new VTIMEZONE STANDARD object.
vtimezone::__construct( "standard" [, config ] )
config = array, review configuration options.
Example
use Kigkonsult\Icalcreator\Vcalendar; use Kigkonsult\Icalcreator\Vtimezone; use Kigkonsult\Icalcreator\Standard; use Kigkonsult\Icalcreator\Daylight; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $vtimezone = new Vtimezone( $vcalendar->getConfig()); .. . $standard = new Standard( $vtimezone->getConfig()); .. . $vtimezone->setComponent( $standard ); $daylight = new Daylight( $vtimezone->getConfig()); .. . $vtimezone->setComponent( $daylight ); $vcalendar->setComponent( $vtimezone );
This property defines the calendar scale used for the calendar information specified in the iCalendar object.
The default (pre-set) value is "GREGORIAN".
To ease up usage, constant Kigkonsult\Icalcreator\Vcalendar::CALSCALE is available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
Vcalendar::createCalscale()
Example
$str = $vcalendar->createCalscale();
Remove CALSCALE from calendar.
Format
Vcalendar::deleteCalscale()
Example
$vcalendar->deleteCalscale();
If set, returns property value, otherwise bool false.
Format
Vcalendar::getCalscale()
Example
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $iCalContent = file_get_contents( "calendar.ics" ); $vcalendar->parse( $iCalContent ); $calscale = $vcalendar->getCalscale();
Set property value. The default value is "GREGORIAN", it is pre-set.
The method returns the class instance (static).
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true).
Format
Vcalendar::setCalscale()
value = (string) calscale value
Example
use Kigkonsult\Icalcreator\Vcalendar; $config = ; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $vcalendar->setCalscale( "GREGORIAN" );
This property defines the iCalendar object method associated with the calendar object.
METHOD property (value PUBLISH etc.) may be required when importing iCal formatted information into some calendaring software (MS etc.), as well as x-properties "X-WR-CALNAME", "X-WR-CALDESC" and "X-WR-TIMEZONE" and the (automatically created) DTSTAMP and UID properties.
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::METHOD
- Kigkonsult\Icalcreator\Vcalendar::PUBLISH
- Kigkonsult\Icalcreator\Vcalendar::REQUEST
- Kigkonsult\Icalcreator\Vcalendar::REPLY
- Kigkonsult\Icalcreator\Vcalendar::ADD
- Kigkonsult\Icalcreator\Vcalendar::CANCEL
- Kigkonsult\Icalcreator\Vcalendar::REFRESH
- Kigkonsult\Icalcreator\Vcalendar::COUNTER
- Kigkonsult\Icalcreator\Vcalendar::DECLINECOUNTER
are available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
Vcalendar::createMethod()
Example
$str = $vcalendar->createMethod();
Remove METHOD from calendar.
Format
Vcalendar::deleteMethod()
Example
$vcalendar->deleteMethod();
If set, returns property value, otherwise bool false.
Format
Vcalendar::getMethod();
Example
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $vcalendar->parse(); $method = $vcalendar->getMethod();
Set property value.
The method returns the class instance (static).
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true).
Format
Vcalendar::setMethod( value )
value = (string) method value
Example
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $vcalendar->setMethod( Vcalendar::PUBLISH );
This property specifies the identifier corresponding to the version number of the iCalendar specification. This property is always placed first in the formatted calendar.
To ease up usage, constant Kigkonsult\Icalcreator\Vcalendar::VERSION is available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
Vcalendar::createVersion()
Example
$str = $vcalendar->createVersion();
Fetch property value.
Format
Vcalendar::getVersion()
Example
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $iCalContent = file_get_contents( "calendar.ics" ); $vcalendar->parse( $iCalContent ); $version = $vcalendar->getVersion()
Set property value. Only version 2.0 valid, version is AUTO generated at calendar creation.
The method returns the class instance (static).
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true).
Format
Vcalendar::setVersion( version )
version = (string) iCal version
Example
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se", ] ); $vcalendar->setVersion("2.0" );
A calendar, non-standard property with a TEXT value and a name with an "X-" prefix. In a calendar, an x-property, with an unique name, can occur only once but the number of x-properties are unlimited.
X-properties "X-WR-CALNAME", "X-WR-CALDESC" and "X-WR-TIMEZONE" may be required when importing iCal formatted information into some calendaring software (MS etc.), as well as METHOD property (value PUBLISH etc.) and the (automatically created) DTSTAMP and UID properties.
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::X_WR_CALNAME
- Kigkonsult\Icalcreator\Vcalendar::X_WR_CALDESC
- Kigkonsult\Icalcreator\Vcalendar::X_WR_RELCALID
- Kigkonsult\Icalcreator\Vcalendar::X_WR_TIMEZONE
- Kigkonsult\Icalcreator\Vcalendar::X_LIC_LOCATION
are available.
The value type is TEXT.
If set, returns [RFC5545] formatted string, otherwise null.
Format
Vcalendar::createXprop()
Example
$str = $vcalendar->createXprop();
Remove X-PROPERTY from calendar.
Format
Vcalendar::deleteXprop( "X-PROPERTY" )
Example 1
Delete the x-property named "X-PROPERTY".
$vcalendar->deleteCprop( "X-PROPERTY" );
Example 2
Delete all x-properties.
while( $vcalendar->deleteXprop()) continue;
If set, returns property (name and) value, bool otherwise false.
Format
Vcalendar::getXprop()
Vcalendar::getXprop( "X-PROPERTY" )
output = array( propertyName1, value2 )
Vcalendar::getXprop( null, propOrderNo/null, true )
propOrderNo = (int) specific property value
output = array( propertyName1 , array( "value" => value2 ) , "params" => params3))
propertyName1, value2 and params3 specs below.
Example 1
Read all x-prop values in a loop. Output in detail below.
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $iCalContent = file_get_contents( "calendar.ics" ); $vcalendar->parse( $iCalContent ); while( $xprop = $vcalendar->getXprop()) { // $xprop = array( propertyName1, value2 ) .. .
Example 2
If exists, read the X-WR-TIMEZONE x-prop
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $iCalContent = file_get_contents( "calendar.ics" ); $vcalendar->parse( $iCalContent ); if( $xprop = $vcalendar->getXprop( Vcalendar::X_WR_TIMEZONE )) { // $xprop = [ Vcalendar::X_WR_TIMEZONE, value2 ] .. .
Example 3
Read all x-prop values/parameters in a loop.
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $iCalContent = file_get_contents( "calendar.ics" ); $vcalendar->parse( $iCalContent ); while( $xprop = $vcalendar->getXprop( null, null, true )) { /* $xprop = [ propertyName1, [ "value" => value2, "params" => params3 ] ] */ .. .
Insert property name and value. If an x-prop with the same name already exists, it will be replaced. PropertyNames are always stored upperCase, ex. x-wr-calname => X-WR-CALNAME.
The method returns the class instance (static).
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true).
Format
Vcalendar::setXprop( propertyName, propertyData [, params ] )
propertyName1 = (string) Any property name with a "X-" prefix value2 = (string) Value type TEXT params3 = (array) ( [Vcalendar::LANGUAGE => (string) "lang*"] *[, xparams] ) xparams = (string) key => (string) value // key prefix "X-" propOrderNo = (int) order number // 1=1st, 2=2nd etc lang* = as defined in [RFC5546]
Example
use Kigkonsult\Icalcreator\Vcalendar; $config = [ Vcalendar::UNIQUE_ID => "kigkonsult.se", ]; $vcalendar = Vcalendar:::factory( $config ) // initiate new CALENDAR // set some X-properties ->setXprop( Vcalendar::X_WR_CALNAME, "Calendar Sample" ) ->setXprop( Vcalendar::X-WR-CALDESC, "Calendar Description" ) ->setXprop( Vcalendar::X-WR-TIMEZONE, "Europe/Stockholm" );
For information about rfc7986 and properties, download here.
Optional calendar properties, MUST NOT occur more than once :
Optional calendar properties, MAY occur more than once :
Remove component from the Vcalendar instance.
Bool false is returned if no component exists or at end-of-components invoking the method consecutive.
format 1
Remove component with order number (1st=1, 2nd=2).Vcalendar::deleteComponent( orderNumber )
orderNumber = (int) order number
format 2
Remove component with component type (e.g. "vevent") and order 1 alt. suborder number.
Vcalendar::deleteComponent( componentType [, componentSuborderNumber])
componentType = (string) component type componentSuborderNumber = (int) order number
format 3
Remove component with UID. N.B UID is NOT set for ALARM / TIMEZONE components.
Vcalendar::deleteComponent( UID )
Example 1
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $iCalContent = file_get_contents( "calendar.ics" ); $vcalendar->parse( $iCalContent ); $vcalendar->deleteComponent( 1 ); $vcalendar->deleteComponent( Kigkonsult\Icalcreator\Vcalendar::VTODO, 2 ); $vcalendar->deleteComponent( "20070803T194810CEST-0123U3PXiX@kigkonsult.se");
Example 2
Deleting all components, using format 2 without order number.
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $iCalContent = file_get_contents( "calendar.ics" ); $vcalendar->parse( $iCalContent ); while( $vcalendar->deleteComponent( Vcalendar::VEVENT)) { continue; } $vtodo = $vcalendar->getComponent( Vcalendar::VTODO ); while( $vtodo->deleteComponent( Vcalendar::VALARM)) { continue; }
Get (next) component from the Vcalendar instance.
Bool false is returned if no component exists or at end-of-components invoking the method consecutive.
format 1
Get next component, until end-of-components.
Vcalendar::getComponent()
Example
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $iCalContent = file_get_contents( "calendar.ics" ); $vcalendar->parse( $iCalContent ); while( $comp = $vcalendar->getComponent()) { .. . }
format 2
Get specific component with order number (1st=1, 2nd=2).
Vcalendar::getComponent( orderNumber )
orderNumber = (int) order number
Example
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $iCalContent = file_get_contents( "calendar.ics" ); $vcalendar->parse( $iCalContent ); if( $comp = $vcalendar->getComponent( 1 )) { .. . }
format 3
Get (first/next) component with component type (until end-of-components) alt. get specific component with component type and suborder number (1st=1, 2nd=2).
Vcalendar::getComponent( componentType [, componentSuborderNumber])
componentType = (string) component type componentSuborderNumber = (int) order number
Example
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $iCalContent = file_get_contents( "calendar.ics" ); $vcalendar->parse( $iCalContent ); if( $comp = $vcalendar->getComponent( Kigkonsult\Icalcreator\Vcalendar::VTODO, 2 )) { .. . }
format 4
Get (first/next) component with UID as key. (UID is NOT set for ALARM / TIMEZONE components.) May be used when trying to find (base) component and corresponding RECURRENCE-ID components.
Vcalendar::getComponent( UID )
Example
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $iCalContent = file_get_contents( "calendar.ics" ); $vcalendar->parse( $iCalContent ); $uid = "20070803T194810CEST-0123U3PXiX@kigkonsult.se"; if( $comp = $vcalendar->getComponent( $uid )) { .. . }
format 5
Get (first/next) component based on specific property contents:
Note, to ease up usage, you will find convenient constants for component names, properties, config keys etc in (src/)IcalInterface.
For the property "SUMMARY" ,if a search value (any case) exists within property value, a hit exists. For the other, non-date, properties an exact (strict case) match is required.
To select components based on property values, use selectComponents (Format 2).
To retrieve specific Vcalendar instance property values, searching ALL components, use getProperty (Format 2).
Vcalendar::getComponent( search )
search = (array) ( *[ propertyName => uniqueValue ]), multiple array elements are combined by "OR" propertyName = (string) property name, above propertyData = (string) unique property value (strict case), date format "YYYYMMDD" (if any side is DATE, only dates are used), datetime format "YYYYMMDDTHHMMSS"
Example
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $iCalContent = file_get_contents( "calendar.ics" ); $vcalendar->parse( $iCalContent ); while( $comp = $vcalendar->getComponent( [ Vcalendar::RESOURCES => "PC" ]) { .. . }
Replace calendar component in vcalendar based on component property UID (EVENT / VTODO / VJOURNAL / VFREEBUSY). If not found, inserted last in component chain.
In case of multiple components sharing the same UID (ex. a RECURRENCE-ID property altering a recurrence pattern), the first found is replaced and it may lead to unpredictable result, to use with care.
For a VTIMEZONE component, a TZID match is required.
A successfull replace returns bool true otherwise bool false.
Throws InvalidArgumentException/UnexpectedValueException on unknown or not-found component error.
Format
Vcalendar::replaceComponent( component )
component = (object) component instance
Example
$vcalendar->replaceComponent( $component );
Format 1
Selects EVENT / VTODO / VJOURNAL / VFREEBUSY components from the Vcalendar instance on based on dates (notice date restraints), based on the initial DTSTART property along with the RRULE, RDATE, EXDATE and EXRULE properties in the component and UID-matched component(s) with RECURRENCE-ID.
Requirement:
Limitations:
Returns an array with components (events) or bool false is returned if no found component(s) exists. Replacing (RECURRENCE-ID) components has (if missing) updated COMMENT, DESCRIPTION and COMMENTs properties.
Added X-properties in recurrent instances of a calendar component:
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::X_CURRENT_DTSTART,
- Kigkonsult\Icalcreator\Vcalendar::X_CURRENT_DTEND,
- Kigkonsult\Icalcreator\Vcalendar::X_CURRENT_DUE,
- Kigkonsult\Icalcreator\Vcalendar::X_RECURRENCE,
- Kigkonsult\Icalcreator\Vcalendar::X_OCCURENCE
are available.
Throws InvalidArgumentException on argument error, Exception on DateTime/DateInterval error.
The following recur rule sets has improved base selects :
Vcalendar::selectComponents([ startYear, startMonth, startDay [, endYear, endMonth, endDay [, cType [, flat [, any [, split]]]]]])
startYear : (int) start year (4*digit), default current year (object) DateTimeInterface instance, start date* startMonth : (int) start month (1-2*digit), default current month (object) DateTimeInterface instance, end date* startDay : (int) start day (1-2*digit), default current day endYear : (int) end year (4*digit), default startYear endMonth : (int) end month (1-2*digit), default startMonth endDay : (int) end day (1-2*digit), default startDay cType : (mixed) calendar component type(-s), (string/array) ("vevent", "vtodo", "vjournal", "vfreebusy") (bool) false (default) => all flat : (bool) true => output : array[] (ignores split) component where recurrence pattern exists within period false (default) => output : array[Year][Month][Day][] any : (bool) true (default) => select components with recurrence within period false => only components that starts (DTSTART) within period split : (bool) true (default) => one component copy for every day it occurs within the period false => one occurrence of component in output array, start date/recurrence (start) date *When using DateTimeInterface instances, other start/end arguments are ignored. valid flat any split combinations (defaults in upper case) 1 false true true 2 false true false 3 false false [false] (split set to false if flat=false and any=false) 4 true true [false] (split set to false if flat=true) 5 true false [false] (split set to false if flat=true) If flat is set to false, output array is sorted in 'Y-m-d h-i-s' asc. order.
Example
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se", ] ); $iCalContent = file_get_contents( "calendar.ics" ); $vcalendar->parse( $iCalContent ); $events_arr = $vcalendar->selectComponents( 2007, 11, 1, 2007, 11, 30, Vcalendar::VEVENT ); // select all events occurring 1-30 nov. 2007 foreach( $events_arr as $year => $year_arr ) { foreach( $year_arr as $month => $month_arr ) { foreach( $month_arr as $day => $day_arr ) { foreach( $day_arr as $event ) { $currddate = $event->getDtstart(); // if member of a recurrence set, returns // array(" x-current-dtstart", // <(string) date("Y-m-d [H:i:s][timezone/UTC offset]")>) $startDate = $event->getDtstart(; $summary = $event->getSummary(); $description = $event->getDescription(); .. .
format 2
Using this format, the Vcalendar method selects components based on specific property value(-s).
Note, to ease up usage, you will find convenient constants for component names, properties, config keys etc in (src/)IcalInterface.
For the property SUMMARY, if a search value (any case) exists within property value, a hit is found. For the other properties an exact (strict case) match is required. Multiple search properties may coexist.
To retrieve specific Vcalendar instance property values, searching ALL components, use getProperty (Format 2).
To get components based on property values, use getComponent (Format 5).
Vcalendar::selectComponents( searchArray )
Outputs an array of matched (unique) components in UID order.
searchArray : (array) *( propertyName => propertyValue ) propertyName : (string) above (any case) propertyValue : (string) value / (array) ( *[ (string) value] )
Example
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $iCalContent = file_get_contents( "calendar.ics" ); $vcalendar->parse( $iCalContent ); $searchArray = [ Vcalendar::PRIORITY => [ 1, 2, 3, 4 ]]; $highPrioArr = $vcalendar->selectComponents( $searchArray ); // select all components with PRIORITY set to high (1-4) if( ! empty( $highPrioArr )) { $highPrioCal = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $highPrioCal->setXProp( Vcalendar::X_WR_CALDESC, "High priority events" ); foreach( $highPrioArr as $highPrioComponent ) { $highPrioCal->setComponent( $highPrioComponent ); } $highPrioCal->returnCalendar(); } exit;
Replace or update component in the Vcalendar instance. Also add a calendar component to the Vcalendar instance when calendar component is created with the procedural (non-factory) method, see example VEVENT, format 2.
A successful update returns true.
The method throws InvalidArgumentException on unknown component.
format 1
Insert last in component chain.
Vcalendar::setComponent( component ) Vcalendar::addComponent( component ) // alias
component = (object) Vcalendar component instance
addComponent, may be removed in future versions.
format 2
Insert/replace component with order number (1st=1, 2nd=2). If replace and orderNumber is not found, component is inserted last in chain.
Vcalendar::setComponent( component, orderNumber )
component = (object) Vcalendar component instance int = (int) order numder
format 3
Replace component with component type and 1st alt. component order number. If orderNumber is not found, component is inserted last in chain.
Vcalendar::setComponent( component, componentType [, componentSuborderNo])
component = (object) Vcalendar component instance componentType = (string) component type componentSuborderNo = (int) component Suborder Number
format 4
Replace component with UID. N.B UID is NOT set for ALARM / TIMEZONE components. If UID is not found, component is inserted last in chain.
Vcalendar::setComponent( component, UID )
component = (object) Vcalendar component instance
Example
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $iCalContent = file_get_contents( "calendar.ics" ); $vcalendar->parse( $iCalContent ); $vevent = vcalendar->getComponent( 1 ); // fetch first EVENT $vevent->setDtstart( new DateTime( "2006-12-24 19:30:00" ) ); // update DTSTART property $vcalendar->setComponent( $vevent, 1 ); // replace first component
Parse string calendar content (or iCal file(-s)) into a single Vcalendar instance (components, properties and parameters), including multiple vcalendars (within a single iCal calendar) parse, e.g. Oracle Calendar exports.
If missing, component property UID is created when parsing.
Minor errors like non-standard line-endings, initial and trailing empty lines as well as files without proper end line(-s) (i.e. missing component end and/or "END:CALENDAR" iCal directives) are managed.
Throws InvalidArgumentException on argument error, UnexpectedValueException on parse error.
Note, parsing an empty calendar (ie without EVENTs etc) will NOT lead to error.
To count components, before and after parse, use countComponents method.
Non-standard iCal properties (except the X-properties) are ignored.
For parsing an internet URL resource, UrlRsrc can be used.
Format
The method returns the class instance (static).
Vcalendar::parse( [ textToParse ] )
textToParse = (string) calendarContent ex. result from - file_get_contents( "filename") (array) calendarContent ex. result from - file( "filename", FILE_IGNORE_NEW_LINES )
parse example 1
use Kigkonsult\Icalcreator\Vcalendar; // set Your unique id, // site info for the Vcalendar PRODID property $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se", ] ); // get iCal contents from file $iCalContent = file_get_contents( "calendar.ics" ); // parse iCal contents $vcalendar->parse( $iCalContent );
parse example 2
PHP file_get_contents may work on external resources.
use Kigkonsult\Icalcreator\Vcalendar; // set Your unique id, // site info for the Vcalendar PRODID property $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); // get iCal contents from external resource $iCalContent = file_get_contents( "http://www.ical.net/calendars/calendar.ics" ); // parse iCal contents $vcalendar->parse( $iCalContent );
parse example 3
Here using UrlRsrc to download an internet (URL) resource.
use Kigkonsult\Icalcreator\Vcalendar; use Kigkonsult\Http\UrlRsrc; // set Your unique id, // site info for the Vcalendar PRODID property $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); // get iCal contents from external resource $iCalContent = UrlRsrc::getContent( "http://www.ical.net/calendars/calendar.ics" ); // parse iCal contents $vcalendar->parse( $iCalContent );
parse example 4
Parse an array with iCal formatted rows.
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $str = [ "BEGIN:VCALENDAR", "PRODID:-//kigkonsult.se//NONSGML kigkonsult.se iCalcreator 2.39//", "VERSION:2.0", "BEGIN:VEVENT", "DTSTART:20101224T190000Z", "DTEND:20101224T200000Z", "DTSTAMP:20101020T103827Z", "UID:20101020T113827-1234GkdhFR@test.org", "DESCRIPTION:example", "END:VEVENT", "END:VCALENDAR" ]; $vcalendar->parse( $str );
merge example
Parse two iCal files into one.
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $iCalContent = file_get_contents( "file1.ics" ); $vcalendar->parse( $iCalContent ); $iCalContent = file_get_contents( "file2.ics" ); $vcalendar->parse( $iCalContent ); file_put_contents( "icalmerge.ics", $vcalendar->createCalendar(), LOCK_EX );
Format
Vcalendar::createCalendar()
Example
$str = $vcalendar->createCalendar(); echo $str;
Redirect the Vcalendar instance content to user browser.
Filename, addressed to browser, is automatically generated if missing or not set,
the filename will look like it is set using
$filename = date( "YmdHis" ).".ics"
The method do not stop PHP script (exit), returns (bool) true on success.
Format
Vcalendar::returnCalendar( [ utf8Encode [, gzip [, cdType [, fileName ]]]] )
utf8Encode = (bool) true: utf8 encoded output, false: (default) no encoding gzip = (bool) true: gzip compressed output Header "Content-Length" only sent when gzip=true false: (default) no compressing cdType = (bool) true: (default) Content-Disposition: attachment false: Content-Disposition: inline fileName = (string) returned file Name
Example 1
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $vevent = $vcalendar->newVevent() ->setDtstart( new DateTime( "2007-04-01 19:00:00", new DateTimezone( "Europe/Stockholm" ) ) ) ->setDuration( new DateInterval( "PT1H" )) ->setLocation( "Central Plaza" ) ->setSummary( "PHP summit" ); $vcalendar->returnCalendar(); exit;
Example 2
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $iCalContent = file_get_contents( "calendar.ics" ); $vcalendar->parse( $iCalContent ); $utf8Encode = true; if( isset( $_SERVER["HTTP_ACCEPT_ENCODING"] ) && ( false !== strpos( strtolower( $_SERVER["HTTP_ACCEPT_ENCODING"] ), "gzip" ))) { $gzip = true; } else { $gzip = false; } $vcalendar->returnCalendar( $utf8Encode, $gzip ); exit;
Format 1
Sort created/parsed calendar components on the following (prioritized) keys:
1 - X-CURRENT-DTSTART - X-CURRENT-DTEND/X-CURRENT-DUE
(if created in Vcalendar method selectComponents)
1 - DTSTART - DTEND alt. DURATION (VEVENT and VFREEBUSY components)
1 - DTSTART - DUE alt. DURATION (VTODO components)
1 - DTSTART (VJOURNAL components)
2 - CREATED / DTSTAMP
3 - UID
A date value, like "DTSTART;VALUE=DATE:20120717", are sorted before a datetime value.
VTIMEZONE component(-s) is always placed first (ordered by TZID). The
STANDARD / DAYLIGHT sub-components are sorted (on asc. key DTSTART) when using
createCalendar method (or returnCalendar).
ALARM sub-components, if exists, are not sorted.
Vcalendar::sort()
Example
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $iCalContent = file_get_contents( "calendar.ics" ); $vcalendar->parse( $iCalContent ); $vcalendar->sort(); $vcalendar->returnCalendar(); exit;
Format 2
Sort created/parsed calendar components based on specific property values and ascending order. If a property is not set in component, an empty sort key is used (i.e. sorted first).
Vcalendar::sort( sortArgument )
sortArgument: (string) "ATTENDEE" * / "CATEGORIES" * / "CONTACT" * / "DTSTAMP" / "LOCATION"" / "ORGANIZER" / "PRIORITY" / "RESOURCES" * / "STATUS" / "SUMMARY" / "URL" / "UID" **.
*) For a property where multiple occurrence may exist (ATTENDEE, CATEGORIES, CONTACT, RESOURCES) lowest (alphabetic) value is used as sort key.
**) For multiple components with the same UID, components with RECURRENCE-ID / SEQUENCE set are sorted first (on asc. values) and components without RECURRENCE-ID last.
Note, to ease up usage, you will find convenient constants for component names, properties, config keys etc in (src/)IcalInterface.
The method returns (int) number of components in valendar. Ex. usage counting components, before and after parse.
Format
Vcalendar::countComponents()
This static class method returns the iCalcreator class version number.
To ease up usage, constant Kigkonsult\Icalcreator\Vcalendar::ICALCREATOR_VERSION is available.
Format
Vcalendar::iCalcreatorVersion()
Adds populated Vtimezone to calendar with base from arguments or calendar data.
A shortcut using Util/VtimezonePopulateFactory::process method.
Return Vcalendar instance.
Throws Exception on invalid (PHP) timezone.
Format
Vcalendar::vtimezonePopulate( [ timezone [, xprops, [ start [, end ]]]] )
timezone = (string) valid timezone, acceptable by PHP DateTimeZone xprops = (array) ( *[ x-propName => value ] ), timezone non-standard properties from = DateTimeInterface | (int) timestamp, period start date* to = DateTimeInterface | (int) timestamp, period end date*
Note, to ease up usage, you will find convenient constants for config keys etc in (src/)IcalInterface.
key | calendar | component | remark |
allowEmpty | * | * | |
Compsinfo | * | * | getConfig only |
Language | * | * | |
setPropertyNames | * | getConfig only | |
Unique_id | * | * |
Vcalendar::getConfig( [ key ] )
key = (string) config key
Example 1
use Kigkonsult\Icalcreator\Vcalendar; .. . $uniqueId = $vcalendar->getConfig( Vcalendar::UNIQUE_ID ); .. .
Example 2
.. . $config = $vcalendar->getConfig(); .. .
Output= array( string key => mixed value *[, string key => mixed value] )
Format
Create a new Vcalendar instance.
Vcalendar::vcalendar( [ config ] )
config = (array) ( *[, key => value] ) key = (string) config key value = (mixed) config value
Example 1
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] );
Create a new calendar component.
Vcalendar::component( [ config ] )
config = (array) ( key => value *[, key => value] ) key = (string) config key value = (mixed) config value
Example 2
use Kigkonsult\Icalcreator\Vcalendar; use Kigkonsult\Icalcreator\Vevent; $config = [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ]; $vevent = new Kigkonsult\Icalcreator\Vevent( $config );
Example 3
$config = $vcalendar->getConfig(); $vevent = new Kigkonsult\Icalcreator\Vevent( $config );
Only component relevant configuration are set. If using a component factory method, configuration is set automatically.
A successful "setConfig" returns true.
Format 1
Vcalendar::setConfig( [ config ] )
config = (array) ( key => value *[, key => value] ) key = (string) config key value = (mixed) config value
Example 1
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar(); $config = [ Vcalendar::UNIQUE_ID => "kigkonsult.se", ]; $vcalendar->setConfig( $config );
Format 2
Vcalendar::setConfig( key, value )
key = (string) config key value = (mixed) config value
Example
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar(); $vcalendar->setConfig( Vcalendar::UNIQUE_ID, "kigkonsult.se" );
Allow or reject empty calendar properties. Used in createCalendar, returnCalendar or create<Property> methods, creating [RFC5545] formats.
Default true (allow).
There is a convenient config key constant available: Vcalendar::ALLOWEMPTY.
Only to use with Vcalendar method getConfig.
Get information about the Vcalendar instance components. Returns array with basic information about all components (in array format) within the Vcalendar instance.
Output = array ( *compinfo ) compinfo = array ( "ordno" => int ordno, // order number (1st=1, 2nd=2..) , "type" => string type // component type (vevent, vtodo , "uid" => string uid // component UID (not for ALARM / TIMEZONE) , "props" => array( *[ propertyName => Property count ]) // for every set property , "sub" => array( *compinfo )) // if subcomponents exists, an array for each subcomponent
There is a convenient config key constant available: Vcalendar::COMPSINFO.
Example
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $iCalContent = file_get_contents( "calendar.ics" ); $vcalendar->parse( $iCalContent ); $compsinfo = $vcalendar->getConfig( Vcalendar::COMPSINFO ); foreach( $compsinfo as compinfo) { echo " order number : " . $compinfo["ordno"]."<br/>"; echo " type : " . $compinfo["type"]."<br/>"; echo " UID : " . $compinfo["uid"]."<br/>"; foreach( $compinfo["props"] as $propertyName => $propertyCount ) { echo " $propertyName = $propertyCount"; if( is_array( $compinfo["sub"] )) { foreach( $compinfo["sub"] as $subcompinfo ) { echo " order number : " . $subcompinfo["ordno"]."<br/>"; /* .. dito if subcomponents exists */ } } // end foreach } // end foreach
Language for the Vcalendar instance and component TEXT value properties as defined in [RFC5546].
Default empty.
If NOT set in TEXT property parameters, language from component instance "setConfig( "language", ..)" method will be used, if set, otherwise language from calendar method "setConfig( "language", ..)" will be used, if set.
The calendar property PRODID is always recreated when setting (calendar) language (, note Unique_id, below).
There is a convenient config key constant available: Vcalendar::LANGUAGE.
Returns array of property names for all set properties in component. "X-PROP" will be used when X-properties are set.
"Unique_id" is used in calendar property PRODID, created automatically.
PRODID The identifier is RECOMMENDED to be the identical syntax to the [RFC 822] addr-spec. A good method to assure uniqueness is to put the domain name or a domain literal IP address of the host on which
Default AUTOMATICALLY generated by using PHP function gethostbyname( $_SERVER["SERVER_NAME"] ) when running in a web server environment or "localhost" when using command line interface. Used when setting other (domain) name than server name.
The calendar property PRODID is always recreated when setting unique_id.
There is a convenient config key constant available: Vcalendar::UNIQUE_ID.
All iCalcreator component object property methods for get/set data.
For property format in detail, see
RFC5545 - Internet Calendaring and Scheduling Core Object Specification (iCalendar).
Notice for properties and VALUE=DATE-TIME in UTC timezone.
RFC5545: The date with UTC time, or absolute time, is identified by a LATIN CAPITAL LETTER Z suffix character (US-ASCII decimal 90), the UTC designator, appended to the time value. For example, the following represents January 19, 1998, at 0700 UTC:
DTSTART:19980119T070000Z
The TZID property parameter MUST NOT be applied to DATE-TIME properties whose time values are specified in UTC timezone.
Due to a limitation in PHP date functions (on 32 bit systems), a date (ex. while setting DTSTART property) before 1970 or after GMT may force a PHP date function to generate an error or set date to "January 1 1970". Timezones need to be PHP complient!
Recommended string date(time) formats: "20110625", "2011-06-25", "2011/06/26" "20110625051015", "20110625 051015" "20110625T051015", "20110625t051015" "2011-06-25 05:10:15", "2011-06-25T05:10:15", "2011-06-25t05:10:15" "2011/06/25 05:10:15", "2011/06/25T05:10:15", "2011/06/25t05:10:15" Any trailing characters (digits), if exists, will be interpreted as offset/timezone. Other string formats, acceptable by PHP strtotime function, may work.
Parse iCal component property text from a string or an array. Each string/array row must be strict RFC5545 formatted, i.e. begin with a property name.
Uou can also parse complete ALARMs, all properties included, in array format and first array row as "BEGIN:VALARM", last as "END:VALARM" as well as TIMEZONE and standard/daylight subcomponents. Empty lines in a text property must be replaced by "\n".
Minor errors like non-standard line-endings, initial and trailing empty lines as well as files without proper end line(-s) (i.e. missing component end iCal directives) are managed.
Throws InvalidArgumentException, UnexpectedValueException on parse error.
Except for the X-properties, non-standard properties are ignored.
Format
calendarComponent::parse( propertyText )
propertyText = (string) [RFC5545] formatted property, (array) [RFC5545] formatted properties, property name must start string / rows(-s) // For a property array MUST all, but first row, be prefixed by space.
example
$e = $vcalendar->newVevent(); $e->parse( "DTSTAMP:19970324T1200Z" ); $e->parse( "SEQUENCE:0" ); $e->parse( "ORGANIZER:MAILTO:jdoe@host1.com" ); $e->parse( [ "ATTENDEE;RSVP=TRUE:MAILTO:jsmith@host1.com", "ATTENDEE;RSVP=TRUE:MAILTO:jsmith@host2.com", "ATTENDEE;RSVP=TRUE:MAILTO:jsmith@host3.com", "ATTENDEE;RSVP=TRUE:MAILTO:jsmith@host4.com" ]); $e->parse( "DTSTART:19970324T123000Z" ); $e->parse( "DTEND:19970324T210000Z" ); $e->parse( "CATEGORIES:MEETING,PROJECT" ); $e->parse( "CLASS:PUBLIC" ); $e->parse( "SUMMARY:Calendaring Interoperability Planning Meeting" ); $e->parse( "STATUS:DRAFT" ); $e->parse( "DESCRIPTION:Project xyz Review Meeting Minutes\\n " . "Agenda\\n " . "1. Review of project version 1.0 requirements.\\n " . "2. Definition of project processes.\\n " . "3. Review of project schedule.\\n " . "Participants: John Smith, Jane Doe, Jim Dandy\\n " . "- It was decided that the requirements need to be signed off by \\n " . "product marketing.\\n " . "- Project processes were accepted.\\n " . "- Project schedule needs to account for scheduled holidays and employee\\n " . " vacation time. Check with HR for specific dates.\\n " . "- New schedule will be distributed by Friday.\\n " . "- Next weeks meeting is cancelled. No meeting until 3/23." ); $e->parse( "LOCATION:LDB Lobby" ); $e->parse( "ATTACH;FMTTYPE=application/postscript:ftp://xyz.com/pub/conf/bkgrnd.ps" ); $e->parse( [ "BEGIN:VALARM", "ACTION:AUDIO", "TRIGGER;VALUE=DATE-TIME:19970224T070000Z", "ATTACH;FMTTYPE=audio/basic:http://host.com/pub/audio-files/ssbanner.aud", "REPEAT:4", "DURATION:PT1H", "X-alarm:non-standard ALARM property", "END:VALARM" ]); $e->parse( "X-xomment:non-standard property will be displayed, comma escaped");
This property defines the action to be invoked when an VALARM is triggered,
"AUDIO" / "DISPLAY" / "EMAIL" / "PROCEDURE".
This property is REQUIRED and MUST NOT occur more than once. ("PROCEDURE" is deprecated in [RFC5545].)
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::ACTION
- Kigkonsult\Icalcreator\Vcalendar::AUDIO
- Kigkonsult\Icalcreator\Vcalendar::DISPLAY
- Kigkonsult\Icalcreator\Vcalendar::EMAIL
- Kigkonsult\Icalcreator\Vcalendar::PROCEDURE // Deprecated in rfc5545
are available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
calendarComponent::createAction()
Example
$str = $component->createAction();
Remove ACTION from component.
Format
calendarComponent::deleteAction()
Example
$valarm->deleteAction();
If set, returns property value, otherwise bool false.
Format 1
calendarComponent::getAction()
output = actionValue1
Format 2
calendarComponent::getAction( true )
output = array( "value" => actionValue1 , "params" => xparams2 )
Example
$action = $valarm->getAction();
Set property value.
The method returns the class instance (static).
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true).
Format
calendarComponent::setAction( actionValue [, xparams ] )
actionValue1 = (string) one of Vcalendar::AUDIO / Vcalendar::DISPLAY / Vcalendar::EMAIL / Vcalendar::PROCEDURE xparams2 = (array) ( *[ (string) key => (string) value ] ) // key prefix "X-"
Example
$valarm->setAction( "DISPLAY" );
The property provides the capability to associate a document object with a calendar component. The property is is REQUIRED and MUST NOT occur more than once in an "ALARM" ("ACTION" "procedure"), OPTIONAL and MUST NOT occur more than once in an "ALARM" ("ACTION" "audio") and OPTIONAL and MAY occur more than once in VEVENT, VTODO, VJOURNAL and VALARM ("ACTION" "email") components.
The default value type for ATTACH is URI. The value type can also be set to BINARY to indicate inline binary encoded content (params2).
If using other parameters than the recommended "FMTTYPE" and the mandatory "ENCODING" (="BASE64")and "VALUE" (="BINARY") for an inline binary encoded attachment, please use only characters within the ASCII character set in parameter name and content, to ensure proper line folding when using createCalendar and/or returnCalendar.
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::ATTACH
- Kigkonsult\Icalcreator\Vcalendar::ENCODING
- Kigkonsult\Icalcreator\Vcalendar::FMTTYPE
- Kigkonsult\Icalcreator\Vcalendar::EIGHTBIT // e.i 8BIT
- Kigkonsult\Icalcreator\Vcalendar::BASE64
are available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
calendarComponent::createAttach()
Example
$str = $component->createAttach();
Remove ATTACH from component.
Format
calendarComponent::deleteAttach()
Example 1
$valarm->deleteAttach();
Example 2
Delete ATTACH property no 2.$valarm->deleteAttach( 2 );
Example 3
Deleting all ATTACH properties.while( $valarm->deleteAttach()) { continue; }
If set, returns property value(-s), otherwise bool false.
Format 1
calendarComponent::getAttach()
output = attachValue1
Format 2
calendarComponent::getAttach( propOrderNo/null , true )
propOrderNo = (int) specific property value,
output = array( "value" => attachValue1 , "params" => params2 )
Format 3
calendarComponent::getAttach( propOrderNo )
propOrderNo = (int) specific property value
Get propOrderNo ATTACH
Example
$attach = $valarm->getAttach();
Set property value. Parameters will be ordered as prescribed in [RFC5545].
The method returns the class instance (static).
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true).
Format
calendarComponent::setAttach( attachValue1 [, params [, propOrderNo ]] )
attachValue1 = (string) URI / inline binary encoded content params2 = (array ) ( [ "ENCODING" => "BASE64", "VALUE" => "BINARY" ] [, "FMTTYPE" => contentType ] *[, xparams ] ) contentType = (string) The parameter value MUST be the TEXT for either an IANA registered content type or a non-standard content type. xparams = (string) key => (string) value // key prefix "X-" propOrderNo = (int) order number // 1=1st, 2=2nd etc
Example
$vevent->setAttach( "ftp://domain.com/pub/docs/agenda.doc", [ Vcalendar::FMTTYPE => "application/binary" ] );
The property defines an "Attendee" within a calendar component and is OPTIONAL and MUST NOT occur more than once in a VALARM ("ACTION" "email"), OPTIONAL and MAY occur more than once in VEVENT, VTODO, VJOURNAL and VFREEBUSY components.
This value type for ATTENDEE is URI, a calendar user address.
You can SORT calendar (components) on (asc) ATTENDEE values.
You can export calendar ATTENDEE values as vCards.
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::ATTENDEE
- Kigkonsult\Icalcreator\Vcalendar::CUTYPE
- Kigkonsult\Icalcreator\Vcalendar::MEMBER
- Kigkonsult\Icalcreator\Vcalendar::ROLE
- Kigkonsult\Icalcreator\Vcalendar::PARTSTAT
- Kigkonsult\Icalcreator\Vcalendar::RSVP
- Kigkonsult\Icalcreator\Vcalendar::DELEGATED_TO
- Kigkonsult\Icalcreator\Vcalendar::DELEGATED_FROM
- Kigkonsult\Icalcreator\Vcalendar::SENT_BY
- Kigkonsult\Icalcreator\Vcalendar::CN
- Kigkonsult\Icalcreator\Vcalendar::LANGUAGE
- Kigkonsult\Icalcreator\Vcalendar::DIR
- Kigkonsult\Icalcreator\Vcalendar::GROUP
- Kigkonsult\Icalcreator\Vcalendar::INDIVIDUAL
- Kigkonsult\Icalcreator\Vcalendar::RESOURCE
- Kigkonsult\Icalcreator\Vcalendar::ROOM
- Kigkonsult\Icalcreator\Vcalendar::UNKNOWN
- Kigkonsult\Icalcreator\Vcalendar::COMPLETED
- Kigkonsult\Icalcreator\Vcalendar::NEEDS_ACTION
- Kigkonsult\Icalcreator\Vcalendar::ACCEPTED
- Kigkonsult\Icalcreator\Vcalendar::DECLINED
- Kigkonsult\Icalcreator\Vcalendar::TENTATIVE
- Kigkonsult\Icalcreator\Vcalendar::DELEGATED
- Kigkonsult\Icalcreator\Vcalendar::IN_PROCESS
- Kigkonsult\Icalcreator\Vcalendar::CHAIR
- Kigkonsult\Icalcreator\Vcalendar::REQ_PARTICIPANT
- Kigkonsult\Icalcreator\Vcalendar::OPT_PARTICIPANT
- Kigkonsult\Icalcreator\Vcalendar::NON_PARTICIPANT
- Kigkonsult\Icalcreator\Vcalendar::FALSE
- Kigkonsult\Icalcreator\Vcalendar::TRUE
are available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
calendarComponent::createAttendee()
Example
$str = $component->createAttendee();
Remove ATTENDEE from component.
Format
calendarComponent::deleteAttendee()
Example 1
Delete (single/first) ATTENDEE property
$valarm->deleteAttendee();
Example 2
Delete ATTENDEE property no 2.
$valarm->deleteAttendee();
Example 3
Deleting all ATTENDEE properties.while( $valarm->deleteAttendee()) { continue; }
If set, returns property value(-s), otherwise bool false.
Format 1
calendarComponent::getAttendee()
output = attendeeValue1
Format 2
calendarComponent::getAttendee( propOrderNo/null , true )
propOrderNo = (int) specific property value
output = array( "value" => attendeeValue1 , "params" => array( params2 ))
Format 3
calendarComponent::getAttendee( propOrderNo )
propOrderNo = (int) specific property value
output = attendeeValue1
Example
$attendee = $valarm->getAttendee();
Set property value. If exist, default parameter values are removed after input (params2). Property value must be prefixed by protocol (ftp://, http://,mailto:, file:// ref. rfc 1738 ), if missing, "mailto:" is set (indicating an internet mail address). Also MEMBER and DIR parameters must be prefixed by protocol. DELEGATED-TO, DELEGATED-FROM, SENT-BY parameters must use protocol "mailto:", prefixed if missing (indicating an internet mail address).
The method returns the class instance (static).
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true).
The CN, ROLE, PARTSTAT, RSVP, CUTYPE, MEMBER, DELEGATED-TO,DELEGATED-FROM, SENT-BY and DIR properties are not accepted (i.e. removed) in a "VFREEBUSY" or "VALARM" "ATTENDEE" property content.
Parameters will be ordered as prescribed in [RFC5545].
Format
calendarComponent::setAttendee( attendeeValue [, params [, propOrderNo ]] )
attendeeValue1 = (string) a calendar user address, a URI as defined by [RFC 1738] or any other IANA registered form for a URI. params2 = (array) ( [CUTYPE] [,MEMBER] [,ROLE] [,PARTSTAT] [,RVSP] [,DELEGATED-TO] [,DELEGATED-FROM] [,SENT-BY] [,CN] [,DIR] [,LANGUAGE] *[,xparams] ) CUTYPE = "CUTYPE" => "INDIVIDUAL" (An individual, Default) / "GROUP" (A group of individuals) / "RESOURCE" (A physical resource) / "ROOM" (A room resource) / "UNKNOWN" (Otherwise not known) / (string) x-name (Experimental type) / iana-token (string) (Other IANA registered type) MEMBER = "MEMBER" => array( *[ (string) "single member of the group or list membership"]) ROLE = "ROLE" => "CHAIR" (Indicates chair of the calendar entity) / "REQ-PARTICIPANT" (required participation, Default) / "OPT-PARTICIPANT" (optional participation) / "NON-PARTICIPANT" (information purposes only) / (string) x-name (Experimental role) / (string) iana-token (Other IANA role) PARTSTAT = Vcalendar::PARTSTAT => "NEEDS-ACTION" (Event needs action, Default) / "ACCEPTED" (Event accepted) / "DECLINED" (Event declined) / "TENTATIVE" (Event tentatively accepted) / "DELEGATED" (Event delegated) / "NEEDS-ACTION" (To-do needs action, Default) / "ACCEPTED" (To-do accepted) / "DECLINED" (To-do declined) / "TENTATIVE" (To-do tentatively accepted) / "DELEGATED" (To-do delegated) / "COMPLETED" (To-do completed. COMPLETED property has date/time completed) / "IN-PROCESS" (To-do in process of being completed) / "NEEDS-ACTION" (Journal needs action, Default) / "ACCEPTED" (Journal accepted) / "DECLINED" (Journal declined) / (string) x-name (Experimental status) / (string) iana-token (Other IANA registered status) RSVP = Vcalendar::RSVP => (string) "TRUE" / "FALSE", Default (reply expectation) DELEGATED-TO = "DELEGATED-TO" => array(*[(string) "single calendar user to specified by the property has delegated participation"]) DELEGATED-FROM = "DELEGATED-FROM" => array( *[ (string) "single calendar user that have delegated their participation to the calendar user specified by the property" ] ) SENT-BY = Vcalendar::SENT_BY => (string) single calendar user that is acting on behalf of the calendar user specified by the property" LANGUAGE = Vcalendar::LANGUAGE => (string) "lang*" (applies to the CN parameter value) CN = Vcalendar::CN => (string) "common name to be associated with the calendar user specified by the property" DIR = Vcalendar::DIR => (string) "reference to a directory entry associated with the calendar user specified by the property" xparams = (string) key => (string) value // key prefix "X-" propOrderNo = (int) order number // 1=1st, 2=2nd etc lang* = as defined in [RFC5546]
See rules in detail in RFC5545 - Internet Calendaring and Scheduling Core Object Specification (iCalendar).
Example
$vevent->setAttendee( "attendee1@ical.net" ); $vevent->setAttendee( "attendee2@ical.net", [ Vcalendar::CUTYPE => "INDIVIDUAL", Vcalendar::MEMBER => [ "member1@ical.net", "member2@ical.net", "member3@ical.net" ], Vcalendar::ROLE => "CHAIR", Vcalendar::PARTSTAT => "ACCEPTED", Vcalendar::RSVP => "TRUE", Vcalendar::DELEGATED_TO => [ "part1@ical.net", "part2@ical.net", "part3@ical.net" ], Vcalendar::DELEGATED_FROM => [ "cio@ical.net", "vice.cio@ical.net" ], Vcalendar::SENT_BY => "secretary@ical.net", Vcalendar::LANGUAGE => "us-EN", Vcalendar::CN => "John Doe", Vcalendar::DIR => "http://www.ical.net/info.doc", "x-agenda" => "status reports", // xparam "x-time" => "15 min" // xparam ] );
This property defines the categories for a calendar component and is OPTIONAL and MAY occur more than once in VEVENT, VTODO and VJOURNAL components.
Note, as described in rfc7986 iCalendar Property Extensions, CATEGORIES may occur more than once in VCALENDAR and may NOT be supported by all calendaring software. Usage and examples, below, corresponds to vcalendar usage.
The value type for CATEGORIES is TEXT.
You can SORT calendar (components) on (asc) CATEGORIES values.
To ease up usage, constant Kigkonsult\Icalcreator\Vcalendar::CATEGORIES is available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
calendarComponent::createCategories()
Example
$str = $component->createCategories();
Remove CATEGORIES from component.
Format
calendarComponent::deleteCategories()
Example 1
Delete (single/first) CATEGORIES property
$vevent->deleteCategories();
Example 2
Delete CATEGORIES property no 2.
$vevent->deleteCategories();
Example 3
Deleting all CATEGORIES properties.
while( $vevent->deleteCategories()) { continue; }
If set, returns property value(-s), otherwise bool false.
Format 1
calendarComponent::getCategories()
output = categoryValue1
Format 2
calendarComponent::getCategories( propOrderNo/null , true )
propOrderNo = (int) specific property value
output = array( "value" => categories1 , "params" => params2 )
Format 3
calendarComponent::getCategories( propOrderNo )
propOrderNo = (int) specific property value
Get propOrderNo CATEGORIES
Example
$categories = $valarm->getCategories();
Set property value.
In spite of the fact that CATEGORIES may contain a (comma separated) list of values, a strong recommendation is to split a CATEGORIES "list" into multiple single CATEGORIES entries.
The method returns the class instance (static).
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true).
Parameters will be ordered as prescribed in [RFC5545].
Format
calendarComponent::setCategories( categories [, params [, propOrderNo ]] )
categories1 = (string) textual categories or subtypes of the calendar component, can be specified as a list of categories separated by the COMMA character params2 = (array) ( [Vcalendar::LANGUAGE => (string) "<lang*>"] *[, xparams] ) xparams = (string) key => (string) value // key prefix "X-" propOrderNo = (int) order number // 1=1st, 2=2nd etc lang* = as defined in [RFC5546]
Example
$vevent->setCategories( "project_x" );
This property defines the access classification for a calendar component and is OPTIONAL and MUST NOT occur more than once in VEVENT, VTODO and VJOURNAL components.
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::KLASS // note CLASS
- Kigkonsult\Icalcreator\Vcalendar::P_BLIC // note PUBLIC
- Kigkonsult\Icalcreator\Vcalendar::P_IVATE // note PRIVATE
- Kigkonsult\Icalcreator\Vcalendar::CONFIDENTIAL
are available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
calendarComponent::createClass()
Example
$str = $component->createClass();
Remove CLASS from component.
Format
calendarComponent::deleteClass()
Example
$vjournal->deleteClass();
If set, returns property value, otherwise bool false.
Format 1
calendarComponent::getClass()
output = classValue1
Format 2
calendarComponent::getClass( true )
output = array "value" => classValue1 , "params" => xparams2 )
Example
$class = $valarm->getClass();
Set property value.
The method returns the class instance (static).
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true).
Format
calendarComponent::setClass( classvalue [, xparams ] )
classvalue1 = "PUBLIC" / "PRIVATE" / "CONFIDENTIAL" / (string) iana-token / (string) x-name xparams2 = (array) ( *[ (string) key => (string) value ] ) // key prefix "X-"
Example
$vevent->setClass( Vcalendar::CONFIDENTIAL );
This property specifies non-processing information intended to provide a comment to the calendar user and is OPTIONAL and MAY occur more than once in VEVENT, VTODO, VJOURNAL, VFREEBUSY, STANDARD and DAYLIGHT components.
The value type for COMMENT is TEXT.
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::COMMENT
- Kigkonsult\Icalcreator\Vcalendar::ALTREP
- Kigkonsult\Icalcreator\Vcalendar::LANGUAGE
are available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
calendarComponent::createComment()
Example
$str = $component->createComment();
Remove COMMENT from component.
Format
calendarComponent::deleteComment()
Example 1
Delete (single/first) COMMENT property
$vevent->deleteComment();
Example 2
Delete COMMENT property no 2.
$vevent->deleteComment( 2 );
Example 3
Deleting all COMMENT properties.
while( $vevent->deleteComment()) { continue; }
If set, returns property value, otherwise bool false.
Format 1
calendarComponent::getComment()
output = commentValue1
Format 2
calendarComponent::getComment( propOrderNo/null , true )
propOrderNo = (int) specific property value
output = array( "value" => commentValue1 , "params" => params2 )
Format 3
calendarComponent::getComment( propOrderNo )
propOrderNo = (int) specific property value
Get propOrderNo COMMENT
Example
$comment = $vevent->getComment();
Set property value.
The method returns the class instance (static).
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true).
Parameters will be ordered as prescribed in [RFC5545].
Format
calendarComponent::setComment( commentValue [, params [, propOrderNo ]] )
commentValue1 = (string) Value type Text params2 = array( Vcalendar::ALTREP => (string) "<an alternate text representation, URI>"], Vcalendar::LANGUAGE => (string) "lang*"] *(xparams ) ) xparams = (string) key => (string) value // key prefix "X-" propOrderNo = (int) order number // 1=1st, 2=2nd etc lang* = as defined in [RFC5546]
Example
$vevent->setComment( "this is a comment" );
This property defines the date and time that a VTODO was actually completed and is OPTIONAL and MUST NOT occur more than once.
The value type for COMPLETED is UTC timezone DATE-TIME.
For methods and formatting, explore the CREATED property.
To ease up usage, constant Kigkonsult\Icalcreator\Vcalendar::CREATED is available.
The property is used to represent textual contact information or alternately a reference to textual contact information associated with the calendar component. The property is OPTIONAL and MUST NOT occur more than once in a VFREEBUSY or MAY occur more than once in VEVENT, VTODO and VJOURNAL components.
The value type for CONTACT is TEXT.
You can SORT calendar (components) on (asc) CONTACT values.
You can export calendar CONTACT values as vCards.
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::CONTACT
- Kigkonsult\Icalcreator\Vcalendar::ALTREP
- Kigkonsult\Icalcreator\Vcalendar::LANGUAGE
are available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
calendarComponent::createContact()
Example
$str = $component->createContact();
Remove CONTACT from component.
Format
calendarComponent::deleteContact()
Example 1
Delete (single/first) CONTACT property
$vevent->deleteContact();
Example 2
Delete CONTACT property no 2.
$vevent->deleteContact( 2 );
Example 3
Deleting all CONTACT properties.
while( $vevent->deleteContact()) { continue; }
If set, returns property value, otherwise bool false.
Format 1
calendarComponent::getContact()
output = contactValue1
Format 2
calendarComponent::getContact( propOrderNo/null , true )
propOrderNo = (int) specific property value
output = array( "value" => contactValue1 , "params" => params2 )
Format 3
calendarComponent::getContact( propOrderNo )
propOrderNo = (int) specific property value
Get propOrderNo CONTACT
Example
$contact = $vevent->getContact();
Set property value.
The method returns the class instance (static).
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true).
Parameters will be ordered as prescribed in [RFC5545].
Format
calendarComponent::setContact( contactValue [, params [, propOrderNo ]] )
contactValue1 = (string) Value type TEXT params2 = array( Vcalendar::ALTREP => (string) "<an alternate text representation, URI>"], Vcalendar::LANGUAGE => (string) "lang*"] *(xparams ) ) xparams = (string) key => (string) value // key prefix "X-" propOrderNo = (int) order number // 1=1st, 2=2nd etc lang* = as defined in [RFC5546]
Example
$c->setContact( "tel 012-34 56 789" )
This property specifies the date and time that the calendar information was created by the calendar user agent in the calendar store. Note: This is analogous to the creation date and time for a file in the file system. The property is OPTIONAL and MUST NOT occur more than once in VEVENT, VTODO and VJOURNAL components.
The value type for CREATED is UTC timezone DATE-TIME.
To ease up usage, constant Kigkonsult\Icalcreator\Vcalendar::CREATED is available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
calendarComponent::createCreated()
Example
$str = $component->createCreated();
Remove CREATED from component.
Format
calendarComponent::deleteCreated()
Example
$vevent->deleteCreated();
If set, returns property value, otherwise bool false.
Format 1
calendarComponent::getCreated()
output = createdDate1
Format 2
calendarComponent::getCreated( true )
output = array( "value" => createdDate1 , "params" => xparams2 )
Example
$created = $vevent->getCreated();
Set property value. Input date is always a UTC timezone DATE-TIME or, if "offset" parameter is used, timezone is set to first found matching timezone.
The current UTC date-time is set if invoked without or empty value.
The method returns the class instance (static).
The method throws Exception on DateTime error.
Format
calendarComponent::setCreated( [ createdDate [, xparams ]] )
createdDate = (object) DateTimeInterface instance, will be set to UTC if not UTC timezone
createdDate = (string) date/datetime string*
xparams2 = array( *[ (string) key => (string) value ] )
date/datetime string* please notice date restraints.
Example 1
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ calendar::UNIQUE_ID => "kigkonsult.se" ] ); $vtodo = $vcalendar->newVtodo(); try { $vtodo->setCreated( new DateTime( "2006-08-11 14:30:35 UTC" )); // 11 august 2006 14.30.35 UTC } catch( Exception $e ) { die( $e->getMessage()); }
This property provides a more complete textual description of the calendar component, than that provided by the SUMMARY property (, analogous to a mail BODY). The property is OPTIONAL, MUST NOT occur more than once within VEVENT, VTODO or VALARM (PROCEDURE) but can be specified multiple times within a VJOURNAL calendar component. The property is REQUIRED in VALARM (DISPLAY, EMAIL) component.
Note, as described in rfc7986 iCalendar Property Extensions, DESCRIPTION may occur more than once in VCALENDAR (with different "LANGUAGE" parameter values on each) and may NOT be supported by all calendaring software. Usage and examples, below, corresponds to vcalendar usage.
The value type for DESCRIPTION is TEXT.
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::DESCRIPTION
- Kigkonsult\Icalcreator\Vcalendar::ALTREP
- Kigkonsult\Icalcreator\Vcalendar::LANGUAGE
are available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
calendarComponent::createDescription()
Example
$str = $component->createDescription();
Remove DESCRIPTION from component.
Format
calendarComponent::deleteDescription()
Example 1
Delete (single/first) DESCRIPTION property.
$vevent->deleteDescription();
Example 2
Delete DESCRIPTION property no 2.
$vjournal->deleteDescription( 2 );
Example 3
Deleting all DESCRIPTION properties.
while( $vjournal->deleteDescription()) { continue; }
If set, returns property value(-s), otherwise bool false.
Format 1
calendarComponent::getDescription()
output = descriptionValue1
Format 2
calendarComponent::getDescription( null , true )
output = array( "value" => descriptionValue1 , "params" => params2 )
Example
$description = $vevent->getDescription();
Set property value.
The method returns the class instance (static).
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true).
Parameters will be ordered as prescribed in [RFC5545].
Format
calendarComponent::setDescription( descriptionValue [, params [, propOrderNo ]] )
descriptionValue1 = (string) Value type TEXT params2 = array( Vcalendar::ALTREP => (string) "<an alternate text representation, URI>"], Vcalendar::LANGUAGE => (string) "lang*"] *(xparams ) ) xparams = (string) key => (string) value // key prefix "X-" propOrderNo = (int) order number // 1=1st, 2=2nd etc lang* = as defined in [RFC5546]
Example
$vevent->setDescription( "This is a description" );
This property specifies the date and time that a calendar component ends. The property is OPTIONAL and MUST NOT occur more than once in VFREEBUSY and VEVENT. In VEVENT, it only occurs if DURATION NOT occurs.
The default value type for DTEND is DATE-TIME, can be set to a DATE value type.
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::DTEND
- Kigkonsult\Icalcreator\Vcalendar::VALUE
- Kigkonsult\Icalcreator\Vcalendar::DATE
- Kigkonsult\Icalcreator\Vcalendar::DATE_TIME
- Kigkonsult\Icalcreator\Vcalendar::TZID
are available.
The value type of the "DTEND" or "DUE" properties MUST match the value type of "DTSTART" property as defined in [RFC5545])
Notice that an end date without a time is in effect midnight of the day before the date,
so for timeless dates, use the date following the event date for it to be correct.
For an "all-day event" and using timeless dates, the DTEND is equal DTSTART plus one day,
example all-day event (2007-12-01)
DTSTART;VALUE=DATE:20071201
DTEND;VALUE=DATE:20071202.
If set, returns [RFC5545] formatted string, otherwise null.
Format
calendarComponent::createDtend()
Example
$str = $component->createDtend();
Remove DTEND from component.
Format
calendarComponent::deleteDtend()
Example
$vevent->deleteDtend();
If set, returns property value, otherwise bool false.
Format 1
calendarComponent::getDtend()
output = dtendDate1
Format 2
calendarComponent::getDtend( true )
output = array( "value" => dtendDate1 , "params" => params2 )
Example
$dtend = $vevent->getDtend();
Set property value. If DATE value type is expected, "VALUE" = "DATE" must be set (in params2) otherwise DATE-TIME (default) value type is set.
Within the "VFREEBUSY" calendar component, the time MUST be specified in the UTC datetime zone.
The method returns the class instance (static).
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true), Exception on DateTime error.
Parameters will be ordered as prescribed in [RFC5545].
Format
calendarComponent::setDtend( dtendDate [, params2 ] )
dtendDate = (object) DateTimeInterface instance
dtendDate = (string) date/datetime string*
params2 = (array) ([ tzidparam/datetimeparam/dateparam ] *[,xparams])
tzidparam = Vcalendar::TZID => (string) <timezone identifier>
// output as local date-time with timezone identifier
// if tzidparam is "UTC" then output date-time is suffixed by 'Z'
datetimeparam = Vcalendar::VALUE => Vcalendar::DATE_TIME // default, output as date-time
dateparam = Vcalendar::VALUE => Vcalendar::DATE // output as DATE, ex. all-day event
xparams = (string) key => (string) value // key prefix "X-"
* please notice date restraints.
Example 1
try { $vevent->setDtend( new DateTime( '2006-08-11 16:30:00' )); // 11 august 2006 16.30.00 local date } catch( Exception $e ) { die( $e->getMessage()); }
Example 2
End of an all-day event.
use Kigkonsult\Icalcreator\Vcalendar; try { $vevent->setDtend( '20060811', [ Vcalendar::VALUE => Vcalendar::DATE ] ); } catch( Exception $e ) { die( $e->getMessage()); }
Example 3
Will output: DTEND;TZID=Europe/Stockholm:20060811T093000
try { $vevent->setDtend( new DateTime( '2006-08-11 09:30:00', new DateTImeZone( 'Europe/Stockholm' )); } catch( Exception $e ) { die( $e->getMessage()); }
The property indicates the date/time the Vcalendar instance was created and is OPTIONAL and MUST NOT occur more than once in VEVENT, VTODO, VJOURNAL and VFREEBUSY components. However, DTSTAMP is AUTOMATICALL§Y GENERATED in iCalcreator when creating a component.
DTSTAMP may be required when importing iCal formatted information into some calendar software
(MS etc.),
as well as (calendar) x-properties "X-WR-CALNAME", "X-WR-CALDESC" and
"X-WR-TIMEZONE",
METHOD property (value PUBLISH etc.) and the (also auto created) UID property.
The value type for DTSTAMP is UTC timezone DATE-TIME.
For methods and formatting, explore the CREATED property.
You can SORT calendar (components) on (asc) DTSTAMP values.
To ease up usage, constant Kigkonsult\Icalcreator\Vcalendar::DTSTAMP is available.
This property specifies when the calendar component begins. The property is OPTIONAL and MUST NOT occur more than once in VEVENT, VTODO, VJOURNAL and VFREEBUSY components. The property is REQUIRED, but MUST NOT occur more than once in STANDARD and DAYLIGHT components.
The default value type for DTSTART is DATE-TIME, can be set to a DATE value type.
For an "all-day event" and using timeless dates, example (2007-12-01)
DTSTART;VALUE=DATE:20071201
DTEND;VALUE=DATE:20071202. // opt., in effect midnight of the day before the date!!
For methods and formatting, explore the DTEND property.
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::DTSTART
- Kigkonsult\Icalcreator\Vcalendar::VALUE
- Kigkonsult\Icalcreator\Vcalendar::DATE
- Kigkonsult\Icalcreator\Vcalendar::DATE_TIME
- Kigkonsult\Icalcreator\Vcalendar::TZID
are available.
This property defines the date and time when a VTODO is expected to be completed and is OPTIONAL and MUST NOT occur more than once and only if DURATION NOT occurs.
The default value type for DUE is DATE-TIME, can be set to a DATE value type.
The value type of the "DTEND" or "DUE" properties MUST match the value type of "DTSTART" property as defined in [RFC5545])
For methods and formatting, explore the DTEND property.
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::DUE
- Kigkonsult\Icalcreator\Vcalendar::VALUE
- Kigkonsult\Icalcreator\Vcalendar::DATE
- Kigkonsult\Icalcreator\Vcalendar::DATE_TIME
- Kigkonsult\Icalcreator\Vcalendar::TZID
are available.
The property specifies a positive duration of time.
To ease up usage, constant Kigkonsult\Icalcreator\Vcalendar::DURATION is available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
calendarComponent::createDuration()
Example
$str = $component->createDuration();
Remove DURATION from component.
Format
calendarComponent::deleteDuration()
Example
$valarm->deleteDuration();
If set, returns property value, otherwise bool false.
Format 1
calendarComponent::getDuration()
output = duration1
Format 2
calendarComponent::getDuration( true )
output = array( "value" => duration1 , "params" => xparams2 )
Example
$duration = $vtodo->getDuration();
option
If (1st) argument is true and a 2nd is used and set to true, returned output is in a DATE-TIME output format (like DTEND / DUE), based on DTSTART value with the added DURATION value (incl. opt. timezone).
Set property value.
The method returns the class instance (static).
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true), Exception on DateInterval error.
Format
calendarComponent::setDuration( duration [, xparams ] )
duration = (object) DateInterval class instance duration = (string) dur-value = ["+"] "P" (dur-date/dur-time/dur-week) like "P15DT5H0M20S" dur-date = dur-day [dur-time] dur-time = "T" (dur-hour / dur-minute / dur-second) dur-week = 1*DIGIT "W" dur-hour = 1*DIGIT "H" [dur-minute] dur-minute = 1*DIGIT "M" [dur-second] dur-second = 1*DIGIT "S" dur-day = 1*DIGIT "D" xparams2 = (array) ( *[ (string) key => (string) value ] ) // key prefix "X-"
Example 1
One day duration.
try { $vtodo->setDuration( new DateInterval( "P1D" )); } catch( Exception $e ) { die( $e->getMessage()); }
Example 2
Four hours duration.
try { $vtodo->setDuration( "PT4H" ); } catch( Exception $e ) { die( $e->getMessage()); }
This property defines the list of date/time exceptions for a recurring calendar component and is OPTIONAL and MAY occur more than once in VEVENT, VTODO, VJOURNAL components.
The default value type for EXDATE is DATE-TIME, can be set to a DATE value type.
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::EXDATE
- Kigkonsult\Icalcreator\Vcalendar::VALUE
- Kigkonsult\Icalcreator\Vcalendar::DATE
- Kigkonsult\Icalcreator\Vcalendar::DATE_TIME
are available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
calendarComponent::createExdate()
Example
$str = $component->createExdate();
Remove EXDATE from component.
Format
calendarComponent::deleteExdate()
Example 1
$vtodo->deleteExdate();
Example 2
Delete EXDATE property no 2.
$vjournal->deleteExdate( 2 );
Example 3
Deleting all EXDATE properties.
while( $vjournal->deleteExdate()) { continue; }
If set, returns property value, otherwise bool false.
Format 1
calendarComponent::getExdate()
output = exdates1 (with date1)
Format 2
calendarComponent::getExdate( propOrderNo/null, true )
propOrderNo = (int) specific property value
output = array( "value" => exdates1 (with date1) , "params" => xparams2 )
Example
$exdate = $vtodo->getExdate();
Set property value.
The value type for EXDATE should match the DTSTART value type.
If no "VALUE" value type is set, DATE-TIME (default) value type is set.
If timezone in 1st date, all remaining dates are within this timezone and param "TZID" is set.
EXDATEs are automatically sorted in ascending order (Y-m-d[-H-i-s]).
In spite of the fact that EXDATE may contain a (comma separated) list of values, a strong recommendation is to split an EXDATE "list" into multiple single EXDATE entries. (But if you do, don't mix timezones, may result in incorrect date values.)
The method returns the class instance (static).
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true), Exception on DateTime error.
Parameters will be ordered as prescribed in [RFC5545].
Format
calendarComponent::setExdate( exdates [, params [, propOrderNo ]] )
exdates1 = date / (array) ( date *[, date ] )
date = (object) DateTimeInterface instance
date = (string) date/datetime string*
params2 = (array) ([(datetimeparam/dateparam) / tzidparam] *[,xparams])
// default, output as date-time
datetimeparam = Vcalendar::VALUE => Vcalendar::DATE_TIME
// output as DATE
dateparam = Vcalendar::VALUE => Vcalendar::DATE
tzidparam = Vcalendar::TZID => (string) <timezone identifier>
// key prefix "X-"
xparams = (string) key => (string) value
// 1=1st, 2=2nd etc
propOrderNo = (int) order number
* please notice date restraints.
Example
Exclude 2006-08-11 from the recurrence pattern.
use Kigkonsult\Icalcreator\Vcalendar; try { $vevent->setExdate( [ new DateTime( '2006-08-11' ) ], [ Vcalendar::VALUE => Vcalendar::DATE ] ); } catch( Exception $e ) { die( $e->getMessage()); }
This property defines a rule or repeating pattern for an exception to a recurrence set and is OPTIONAL and MAY occur more than once in VEVENT, VTODO, VJOURNAL components.
EXRULE is deprecated in [RFC5545]!
Uses the methods and formats as RRULE.
The property defines one or more free or busy time intervals in a VFREEBUSY calendar component.
The value type for FREEBUSY is PERIOD. A PERIOD is DATE-TIME/DATE-TIME or DATE-TIME/duration and in the UTC timezone
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::FREEBUSY
- Kigkonsult\Icalcreator\Vcalendar::FBTYPE
- Kigkonsult\Icalcreator\Vcalendar::FREE
- Kigkonsult\Icalcreator\Vcalendar::BUSY
- Kigkonsult\Icalcreator\Vcalendar::BUSY_UNAVAILABLE
- Kigkonsult\Icalcreator\Vcalendar::BUSY_TENTATIVE
are available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
calendarComponent::createFreebusy()
Example
$str = $component->createfreebusy();
Remove FREEBUSY from component.
Format
calendarComponent::deleteFreebusy()
Example 1
Delete (single/first) FREEBUSY property
$vfreebusy->deleteFreebusy();
Example 2
Delete FREEBUSY property no 2.
$vfreebusy->deleteFreebusy( 2 );
Example 3
Deleting all FREEBUSY properties.
while( $vfreebusy->deleteFreebusy()) { continue; }
If set, returns property value, otherwise bool false.
Format 1
calendarComponent::getFreebusy()
output = array( "fbtype" => freebusytype1 , periods ) periods = periods2 with startdate/enddate2 below
Format 3
calendarComponent::getFreebusy( propOrderNo/null , true )
propOrderNo = (int) specific property value
output = array( "value" => array("fbtype" => freebusytype1 ,periods) , "params" => xparams3 ) periods = periods2 with startdate/enddate2 below
Example
$freebusy = $vfreebusy->getFreebusy();
Set property value. FREEBUSY date is always a UTC timezone DATE-TIME in pair with another UTC timezone DATE-TIME or a DateInteval. Set dates within the same timezone, otherwise it may lead to unpredictable result;
In spite of the fact that FREEBUSYs may contain a (comma separated) list of values, a strong recommendation is to split a FREEBUSYs "list" into multiple single FREEBUSY entries.
The method returns the class instance (static).
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true), Exception on DateTime/DateInterval error.
Format
calendarComponent::setFreebusy( freebusytype,fbperiods [,xparams [,propOrderNo ]] )
freebusytype1 = one of Vcalendar::FREE
/ Vcalendar::BUSY Default
/ Vcalendar::BUSY-UNAVAILABLE
/ Vcalendar::BUSY-TENTATIVE
/ x-name
fbperiods = (array) ( periods2 )
periods2 = (array) ( startdate, enddate/duration ) /
(array) ( *[, (array) ( startdate, enddate/duration )] )
startdate/enddate = (object) DateTimeInterface instance, will be set to UTC if not UTC timezone
startdate/enddate = (string) datetime string*
duration = (object) DateInterval class instance
duration = (string) dur-value = ("+")"P"(dur-date/dur-time/dur-week) like "P15DT5H0M20S"
dur-date = dur-day [dur-time]
dur-time = "T" (dur-hour / dur-minute / dur-second)
dur-week = 1*DIGIT "W"
dur-hour = 1*DIGIT "H" [dur-minute]
dur-minute = 1*DIGIT "M" [dur-second]
dur-second = 1*DIGIT "S"
dur-day = 1*DIGIT "D"
xparams3 = (array) ( *[ (string) key => (string) value ] ) // key prefix "X-"
propOrderNo = (int) order number // 1=1st, 2=2nd etc
* please notice date restraints.
Example 1
See rules in detail in RFC5545 - Internet Calendaring and Scheduling Core Object Specification (iCalendar). The recommended way.try { $freebusy->setFreebusy( Vcalendar::FREE, [ new DateTime( "2001-01-01 01:01:01 UTC" ), new DateTime( "2002-02-02 02:02:02 UTC" ) [ ) $freebusy->setFreebusy( Vcalendar::FREE, [ new DateTime( "2003-03-03 03:03:03 UTC" ), new DateInterval( "P5DT5H5M5S" ) ], ) $freebusy->setFreebusy( Vcalendar::FREE, [ "4 April 2005 4:4:4 UTC", "P2D" ] ) ->setFreebusy( Vcalendar::BUSY, [ new DateTime( "2001-01-01 01:01:01 UTC" ), new DateTime( "2002-02-02 02:02:02 UTC" ) ], ) ->setFreebusy( Vcalendar::BUSY, [ new DateTime( "2003-03-03 03:03:03 UTC" ), "P2D" ], ) ->setFreebusy( Vcalendar::BUSY, [ "4 April 2005 4:4:4 UTC", new DateInterval( "PT5H" ) ], ) ->setFreebusy( Vcalendar::BUSY, [ new DateTime( "2001-01-01 01:01:01 UTC" ), new DateTime( "2003-03-03 03:03:03 UTC" ) ] ); } catch( Exception $e ) { die( $e->getMessage()); }
Example 1
Works, but...try { $freebusy->setFreebusy( Vcalendar::FREE, [ [ new DateTime( "2001-01-01 01:01:01 UTC" ), new DateTime( "2002-02-02 02:02:02 UTC" ) ], [ new DateTime( "2003-03-03 03:03:03 UTC" ), new DateInterval( "P5DT5H5M5S" ) ], [ "4 April 2005 4:4:4 UTC", "P2D" ] ] ) ->setFreebusy( Vcalendar::BUSY, [ [ new DateTime( "2001-01-01 01:01:01 UTC" ), new DateTime( "2002-02-02 02:02:02 UTC" ) ], [ new DateTime( "2003-03-03 03:03:03 UTC" ), "P2D" ], [ "4 April 2005 4:4:4 UTC", new DateInterval( "PT5H" ) ], [ new DateTime( "2001-01-01 01:01:01 UTC" ), new DateTime( "2003-03-03 03:03:03 UTC" ) ] ] ); } catch( Exception $e ) { die( $e->getMessage()); }
This property specifies information related to the global position for the activity specified by VEVENT and VTODO components and is OPTIONAL and MUST NOT occur more than once.
Value type for latitude and longitude is FLOAT.
Values for latitude and longitude shall be expressed as decimal fractions of degrees. Whole degrees of latitude shall be represented by a two-digit decimal number ranging from 0 through 90. Whole degrees of longitude shall be represented by a decimal number ranging from 0 through 180. When a decimal fraction of a degree is specified, it shall be separated from the whole number of degrees by a decimal point.
The output (float) latitude and longitude values are presented up to six decimals.
Using the non-standard directive "GEOLOCATION", iCalcreator returns output by combining the LOCATION and GEO property values, (separated by "/") and only if GEO is set).
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::GEO
- Kigkonsult\Icalcreator\Vcalendar::LATITUDE
- Kigkonsult\Icalcreator\Vcalendar::LONGITUDE
are available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
calendarComponent::createGeo()
Example
$str = $component->createGeo();
Remove GEO from component.
Format
calendarComponent::deleteGeo()
Example
$vevent->deleteGeo();
If set, returns GEO property value (latitude/longitude) as prescribed in [RFC5545], otherwise bool false.
Format 1
calendarComponent::getGeo()
output = array( "latitude" => <latitude> , "longitude" => <longitude>))
Format 2
calendarComponent::getGeo( true )
output = array( "value" => array ( "latitude" => <latitude> , "longitude" => <longitude>)) , "params" => xparams1 )
Example
$geo = $vevent->getGeo();
Set property value.
The method returns the class instance (static).
The method throws InvalidArgumentException on empty values and config ALLOWEMPTY is set to false (default true).
Format
calendarComponent::setGeo( latitude, longitude [, xparams ] )
latitude = (float) latitude longitude = (float) longitude xparams1 = (array) ( *[ (string) key => (string) value ] ) // key prefix "X-"
Example
$vevent->setGeo( 11.23456, -23.45678 );
The property specifies the date and time that the information associated with the calendar component was last revised in the calendar store. The property is OPTIONAL and MUST NOT occur more than once in VEVENT, VTODO, VJOURNAL and VTIMEZONE components.
Note, as described in rfc7986 iCalendar Property Extensions, LAST-MODIFIED may occur once in VCALENDAR and may NOT be supported by all calendaring software. Usage and examples corresponds to vcalendar usage.
The value type for LAST-MODIFIED is UTC timezone DATE-TIME.
For methods and formatting, explore the CREATED property.
To ease up usage, constant Kigkonsult\Icalcreator\Vcalendar::LAST_MODIFIED is available.
The property defines the intended venue for the activity defined by a calendar component. The property is OPTIONAL and MUST NOT occur more than once in VEVENT and VTODO components.
The value type for LOCATION is TEXT.
You can SORT calendar (components) on (asc) LOCATION values.
Using the non-standard directive "GEOLOCATION", iCalcreator returns output by combining the LOCATION and GEO property values, (separated by "/") and only if GEO is set).
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::LOCATION
- Kigkonsult\Icalcreator\Vcalendar::ALTREP
- Kigkonsult\Icalcreator\Vcalendar::LANGUAGE
are available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
calendarComponent::createLocation()
Example
$str = $component->createLocation();
Remove LOCATION from component.
Format
calendarComponent::deleteLocation()
Example
$vevent->deleteLocation();
If set, returns property value, otherwise bool false.
Format 1
calendarComponent::getLocation()
output = location1
Format 2
calendarComponent::getLocation( true )
output = array( "value" => location1 , "params" => param2 )
Example
$location = $vevent->getLocation();
Set property value.
The method returns the class instance (static).
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true).
Parameters will be ordered as prescribed in [RFC5545].
Format
calendarComponent::setLocation( location [, param] )
location1 = (string) Value type TEXT params2 = (array) ( [ Vcalendar::ALTREP => (string) "<an alternate text representation, URI>"] [, Vcalendar::LANGUAGE => (string) "lang*"] *[, xparams ] ) xparams = (string) key => (string) value // key prefix "X-" lang* = as defined in [RFC5546]
Example
$vevent->setLocation( "Buckingham Palace" );
The property defines the organizer for a calendar component and is OPTIONAL and MUST NOT occur more than once in VEVENT, VTODO, VJOURNAL and VFREEBUSY components.
This value type for ORGANIZER is URI, a calendar user address.
You can SORT calendar (components) on (asc) ORGANIZER values.
You can export calendar ORGANIZER values as vCards.
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::ORGANIZER
- Kigkonsult\Icalcreator\Vcalendar::CN
- Kigkonsult\Icalcreator\Vcalendar::DIR
- Kigkonsult\Icalcreator\Vcalendar::SENT_BY
- Kigkonsult\Icalcreator\Vcalendar::LANGUAGE
If set, returns [RFC5545] formatted string, otherwise null.
Format
calendarComponent::createOrganizer()
Example
$str = $component->createOrganizer();
Remove ORGANIZER from component.
Format
calendarComponent::deleteOrganizer()
Example
$vevent->deleteOrganizer();
If set, returns property value, otherwise bool false.
Format 1
calendarComponent::getOrganizer()
output = organizer1
Format 2
calendarComponent::getOrganizer( true )
output = array( "value" => organizer1 , "params" => params2 )
Example
$organizer = $vevent->getOrganizer();
Set property value. Property value must be prefixed by protocol ("ftp://", "http://, mailto:", "file://" etc, ref. rfc 1738), "mailto:" is prefixed if missing. Also DIR parameter must be prefixed by protocol. SENT-BY parameter must use protocol "mailto:", prefixed if missing.
The method returns the class instance (static).
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true).
Parameters will be ordered as prescribed in [RFC5545].
Format
calendarComponent::setOrganizer( organizer [, params] )
organizer1 = (string) a calendar user address (cal-address), a URI as defined by [RFC 1738] or any other IANA registered form for a URI. params2 = (array) Vcalendar::LANGUAGE => (string) "lang*", // applies to the CN parameter value Vcalendar::CN => (string) "common name to be associated with the calendar user specified by the property", Vcalendar::DIR => (string) "reference to a directory entry associated with the calendar user specified by the property", Vcalendar::SENT_BY => (string) (cal-address, above) "single calendar user that is acting on behalf of the calendar user specified by the property", *xparams xparams = (string) key => (string) value // key prefix "X-" lang* = as defined in [RFC5546]
Example
$dir = "ldap://domain.com:6666/o=3DDC%20Comp,c=3DUS??(cn=3DJohn%20Doe)"; $vevent->setOrganizer( "ical@domain.com", [ Vcalendar::CN => "John Doe", Vcalendar::DIR => $dir, Vcalendar::SENT_BY => "secretary@domain.com", "X-Key1" => "X-Value1", "X-Key2" => "X-Value2" ] );
This property is used by an assignee or delegatee of a VTODO to convey the percent completion of a VTODO to the Organizer and is OPTIONAL and MUST NOT occur more than once.
The property value is a positive integer between zero and one hundred. A value of "0" indicates the VTODO has not yet been started. A value of "100" indicates that the VTODO has been completed. Integer values in between indicate the percent partially complete.
To ease up usage, constant Kigkonsult\Icalcreator\Vcalendar::PERCENT_COMPLETE is available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
calendarComponent::createPercentComplete()
Example
$str = $component->createPercentComplete();
Remove PERCENT-COMPLETE from component.
Format
calendarComponent::deletePercentcomplete()
Example
$vtodo->deletePercentcomplete()
If set, returns property value, otherwise bool false.
Format 1
calendarComponent::getPercentcomplete()
output = percent1
Format 2
calendarComponent::getPercentcomplete( true )
output = array( "value" => percent1 , "params" => xparams2 )
Example
$percent = $vtodo->getPercentcomplete();
Set property value.
The method returns the class instance (static).
The method throws InvalidArgumentException on empty (non-zero) value and config ALLOWEMPTY is set to false (default true).
Format
calendarComponent::setPercentcomplete( percent [, xparams ] )
percent1 = (int) Value type INTEGER xparams2 = (array) ( *[ (string) key => (string) value ] ) // key prefix "X-"
Example
$vtodo->setPercentcomplete( 90 );
The property defines the relative priority for a calendar component and is OPTIONAL and MUST NOT occur more than once in VEVENT and VTODO components.
The priority is specified as an integer in the range zero to nine.
A value of zero (US-ASCII decimal 48) specifies an undefined priority.
A value of one (US-ASCII decimal 49) is the highest priority.
A value of two (US-ASCII decimal 50) is the second highest priority.
Subsequent numbers specify a decreasing ordinal priority.
A value of nine (US-ASCII decimal 58) is the lowest priority.
You can SORT calendar (components) on (asc) PRIORITY values.
To ease up usage, constant Kigkonsult\Icalcreator\Vcalendar::PRIORITY is available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
calendarComponent::createPriority()
Example
$str = $component->createPriority();
Remove PRIORITY from component.
Format
calendarComponent::deletePriority()
Example
$vevent->deletePriority();
If set, returns property value, otherwise bool false.
Format 1
calendarComponent::getPriority()
output = priority1
Format 2
calendarComponent::getPriority( true )
output = array( "value" => priority1 , "params" => xparams2 )
Example
$priority = $vevent->getPriority();
Set property value.
The method returns the class instance (static).
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true) and if value is not an integer.
Format
calendarComponent::setPriority( priority [, xparams ] )
priority1 = (int) Value type INTEGER xparams2 = (array) ( *[ (string) key => (string) value ] ) // key prefix "X-"
Example
$vevent->setPriority( 3 );
This property defines the list of date/times for a recurrence set and is OPTIONAL and MAY occur more than once in VEVENT, VTODO, VJOURNAL, STANDARD and DAYLIGHT components.
The default value type for RDATE is DATE-TIME, can be set to DATE or PERIOD (params2). In STANDARD and DAYLIGHT components, RDATE MUST be specified as a date-time value type with local time value.
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::RDATE
- Kigkonsult\Icalcreator\Vcalendar::VALUE
- Kigkonsult\Icalcreator\Vcalendar::DATE
- Kigkonsult\Icalcreator\Vcalendar::DATE_TIME
- Kigkonsult\Icalcreator\Vcalendar::PERIOD
are available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
calendarComponent::createRdate()
Example
$str = $component->createRdate();
Remove RDATE from component.
Format
calendarComponent::deleteRdate()
Example 1
Delete (single/first) RDATE property.
$vtodo->deleteRdate();
Example 2
Delete RDATE property no 2.
$vjournal->deleteRdate( 2 );
Example 3
Delete all RDATE properties.
while( $vjournal->deleteRdate()) { continue; }
If set, returns property value, otherwise bool false.
Format 1
calendarComponent::getRdate()
output = dates1
Format 2
calendarComponent::getRdate( propOrderNo/null , true )
propOrderNo = (int) specific property value
output = array( "value" => dates1 , "params" => params2 )
Format 3
calendarComponent::getRdate( propOrderNo )
propOrderNo = (int) specific property value
Get propOrderNo RDATE
Example
$rdates = $vevent->getRdate();
Set property value.
The value type for RDATE should match the DTSTART value type.
If no "VALUE" value type is set, DATE-TIME (default) value type is set.
If no "TZID" is set in params and timezone in 1st date, all remaining dates are within this timezone and param "TZID" is set.
RDATEs are automatically sorted in ascending order (Y-m-d[-H-i-s]).
A RDATE may contain a (comma separated) list of date values, BUT, a strong recommendation is to split a RDATE "list" into multiple single RDATE entries. (But if you do, don't mix timezones, may result in incorrect date values.)
The method returns the class instance (static).
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true), Exception on DateTime/DateInterval error.
Parameters will be ordered as prescribed in [RFC5545].
Format
calendarComponent::setRdate( dates [, params [, propOrderNo ]] )
dates1 = singledate / (array) ( *singledate ) / (array) ( date2 *[, date2 ] )
date2 = (array) ( startdate, enddate/duration )
singledate = date
startdate = date
enddate = date
date = (object) DateTimeInterface instance
date = (string) date/datetime string*
duration = (object) DateInterval class instance
duration = (string) dur-value = ("+")"P"(dur-date/dur-time/dur-week) like "P15DT5H0M20S"
dur-date = dur-day [dur-time]
dur-time = "T" (dur-hour / dur-minute / dur-second)
dur-week = 1*DIGIT "W"
dur-day = 1*DIGIT "D"
dur-hour = 1*DIGIT "H" [dur-minute]
dur-minute = 1*DIGIT "M" [dur-second]
dur-second = 1*DIGIT "S"
params2 = ([tzidparam ( / datetimeparam / dateparam / periodparam )] *[, xparams ] )
tzidparam = Vcalendar::TZID => (string) <timezone identifier>
// output as local DATE-TIME with timezone identifier
// if tzidparam="GMT"/"UTC" then
// output date-time is suffixed by 'Z'
datetimeparam = Vcalendar::VALUE => Vcalendar::DATE_TIME // default, DATE-TIME
dateparam = Vcalendar::VALUE => Vcalendar::DATE // required if DATE
periodparam = Vcalendar::VALUE => Vcalendar::PERIOD
// required if PERIOD (datetime - datetime/duration)
xparams = (string) key => (string) value // key prefix "X-"
propOrderNo = (int) order number // 1=1st, 2=2nd etc
* please notice date restraints.
Example
See rules in detail in RFC5545 - Internet Calendaring and Scheduling Core Object Specification (iCalendar).use Kigkonsult\Icalcreator\Vcalendar; try { $vevent = $vcalendar->newVevent() // one recurrence date, if param VALUE is missing, DATE-TIME default ->setRdate( new DateTime( "2001-01-01 01:01:01 UTC" ) ) // two or more recurrence dates ->setRdate( [ new DateTime( "2001-01-01 01:01:01 UTC" ) new DateTime( "2002-02-02 02:02:02 UTC" ) ] [ Vcalendar::VALUE => Vcalendar::DATE_TIME ] ) // one PERIOD, startdate-duration, VALUE "PERIOD" required ->setRdate( [ [ new DateTime( "2002-02-02 02:02:02 UTC" ), new DateInterval( "PT5H5M5S" ) ] ], [ Vcalendar::VALUE => Vcalendar::PERIOD ] ) // one PERIOD, start- and endDate (accepted format for ONE period) ->setRdate( [ new DateTime( "2001-01-01 01:01:01 UTC" ), new DateTime( "2002-02-02 02:02:02 UTC" ) ], [ Vcalendar::VALUE => Vcalendar::PERIOD ] ) // PERIOD, pairs of start- and endDates ->setRdate( [ [ new DateTime( "2001-01-01 01:01:01 UTC" ), new DateTime( "2002-02-02 02:02:02 UTC" ) ], [ "3 March 2003 03.03.03 UTC", new DateTime( "2004-04-04 04:04:04 UTC" ) ] ], [ Vcalendar::VALUE => Vcalendar::PERIOD ] ) // PERIOD, pairs of start-/enddate and startdate-duration ->setRdate( [ [ new DateTime( "2001-01-01 01:01:01 UTC" ), new DateTime( "2002-02-02 02:02:02 UTC" ) ], [ "3 March 2003 03.03.03 UTC", new DateInterval( "PT7H" ) ] ], [ Vcalendar::VALUE => Vcalendar::PERIOD ] ) // start- and enddate as DATE ->setRdate( [ [ new DateTime( "2005-10-05 05:05:05 UTC" ), "2008-08-08 08:08:08 UTC" ) ] ], [ Vcalendar::VALUE => Vcalendar::DATE ] ); } catch( Exception $e ) { die( $e->getMessage()); }
This property is used in conjunction with the UID and SEQUENCE property to identify a specific instance of a recurring VEVENT, VTODO or VJOURNAL calendar component and is OPTIONAL and MAY NOT occur more than once.
The property value is the effective value of the DTSTART property of the recurrence instance. The default value type is DATE-TIME, can be set to DATE (params2).
For methods and formatting, explore the DTEND property.
The calendar method SORT with argument UID also use RECURRENCE-ID / SEQUENCE as sort parameters.
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::RECURRENCE_ID
- Kigkonsult\Icalcreator\Vcalendar::VALUE
- Kigkonsult\Icalcreator\Vcalendar::DATE
- Kigkonsult\Icalcreator\Vcalendar::DATE_TIME
- Kigkonsult\Icalcreator\Vcalendar::TZID
are available.
The property is used to represent a relationship or reference between one calendar component and another and is OPTIONAL and MAY occur more than once in VEVENT, VTODO, VJOURNAL components.
The property value consists of the persistent, globally unique identifier of another calendar component. This value would be represented in a calendar component by the UID property.
The value type for RELATED-TO is TEXT.
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::RELATED_TO
- Kigkonsult\Icalcreator\Vcalendar::RELTYPE
- Kigkonsult\Icalcreator\Vcalendar::PARENT
- Kigkonsult\Icalcreator\Vcalendar::CHILD
- Kigkonsult\Icalcreator\Vcalendar::SIBLING
- available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
calendarComponent::createRelatedTo()
Example
$str = $component->createRelatedTo();
Remove RELATED-TO from component.
Format
calendarComponent::deleteRelatedto()
Example 1
Delete /single/first) RELATED-TO property
$vtodo->deleteRelatedto()
Example 2
Delete RELATED-TO property no 2.
$vjournal->deleteRelatedto( 2 );
Example 3
Deleting all RELATED-TO properties.
while( $vjournal->deleteRelatedto()) { continue; }
If set, returns property value, otherwise bool false.
Format 1
calendarComponent::getRelatedto()
output = relid1
Format 2
calendarComponent::getRelatedto( propOrderNo/null , true )
propOrderNo = (int) specific property value
output = array( "value" => relid1 , "params" => params2 )
Format 3
calendarComponent::getRelatedto(propOrderNo )
propOrderNo = (int) specific property value
Get propOrderNo RELATED-TO
Example
$relatedId = $vtodo->getRelatedto();
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true).
Set property value.
The method returns the class instance (static).
Format
calendarComponent::setRelatedto( relid [, params [, propOrderNo ]] )
relid1 = (string) Value type TEXT. params2 = (array) ( [ reltype ] *[, xparams] ) reltype = Vcalendar::RELTYPE => Vcalendar::PARENT (Default) / Vcalendar::CHILD / Vcalendar::SIBLING / (string) iana-token / (string) x-name xparams = (string) key => (string) value // key prefix "X-" propOrderNo = (int) order number // 1=1st, 2=2nd etc
Example
$vtodo->setRelatedto( "19960401-080045-4000F192713@host.com" );
This property defines the number of time the ALARM should be repeated, after the initial trigger. If the ALARM triggers more than once, then this property MUST be specified along with the DURATION property.
The value type for REPEAT is INTEGER.
To ease up usage, constant Kigkonsult\Icalcreator\Vcalendar::REPEAT is available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
calendarComponent::createRepeat()
Example
$str = $component->createRepeat();
Remove REPEAT from component.
Format
calendarComponent::deleteRepeat()
Example
$valarm->deleteRepeat();
If set, returns property value, otherwise bool false.
Format 1
calendarComponent::getRepeat()
output = repeatTimes1
Format 2
calendarComponent::getRepeat( true )
output = array( "value" => repeatTimes1 , "params" => xparams2 )
Example
$repeat = $valarm->getRepeat();
Set property value.
The method returns the class instance (static).
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true) and if value is not an integer.
Format
calendarComponent::setRepeat( , repeatTimes [, xparams ] )
repeatTimes1 = (int) Value type INTEGER xparams2 = (array) ( *[ (string) key => (string) value ] ) // key prefix "X-"
Example
$valarm->setRepeat( 2 );
This property defines the status code returned for a scheduling request and is OPTIONAL and MAY occur more than once in VEVENT, VTODO, VJOURNAL and VFREEBUSY components.
The value type for REQUEST-STATUS is TEXT and consists of
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::REQUEST_STATUS
- Kigkonsult\Icalcreator\Vcalendar::STATCODE
- Kigkonsult\Icalcreator\Vcalendar::STATDESC
- Kigkonsult\Icalcreator\Vcalendar::EXTDATA
- Kigkonsult\Icalcreator\Vcalendar::LANGUAGE
are available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
calendarComponent::createRequestStatus()
Example
$str = $component->createRequestStatus();
Remove REQUEST-STATUS from component.
Format
calendarComponent::deleteRequeststatus()
Example 1
Delete (single/first) REQUEST-STATUS property.
$vtodo->deleteRequeststatus();
Example 2
Delete REQUEST-STATUS property no 2.
$vjournal->deleteRequeststatus( 2 );
Example 3
Deleting all REQUEST-STATUS properties.
while( $vjournal->deleteRequeststatus()) { continue; }
If set, returns property value, otherwise bool false.
Format 1
calendarComponent::getRequeststatus()
output = array( Vcalendar::STATCODE => statcode1, , Vcalendar::STATDESC => statdesc2 [ , Vcalendar::EXTDATA => extdata3 ] )
Format 2
calendarComponent::getRequeststatus( propOrderNo/null, true )
propOrderNo = (int) specific property value
output = array( "value" => array( Vcalendar::STATDESC => statcode1, Vcalendar::STATDESC => errtext2, [ Vcalendar::EXTDATA => extdata3 ] ), "params" => params4 )
Format 3
calendarComponent::getRequeststatus( propOrderNo )
propOrderNo = (int) specific property value
Get propOrderNo REQUEST-STATUS
Example
$requestStatus = $vtodo->getRequeststatus();
Set property value.
The method returns the class instance (static).
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true).
Format
calendarComponent::setRequeststatus( statcode, statdesc [,extdata/false [,params [,propOrderNo]]] )
statcode1 = Hierarchical, numeric return status code (1*DIGIT "." 1*DIGIT 1*DIGIT) statdesc2 = (string) Textual status description extdata3 = (string) Textual exception data. For example, the offending property name and value or complete property line. params4 = (array) ( Vcalendar::LANGUAGE => (string) "lang*"] *xparams ) xparams = (string) key => (string) value // key prefix "X-" propOrderNo = (int) order number // 1=1st, 2=2nd etc lang* = as defined in [RFC5546]
Example
$vfreebusy->setRequeststatus( 2.00, "Invalid property value", "DTSTART:96-Apr-31" );
This property defines the equipment or resources anticipated for an activity specified by a calendar entity and is OPTIONAL and MAY occur more than once in VEVENT and VTODO components.
The value type for RESOURCES is TEXT.
You can SORT calendar (components) on (asc) RESOURCES values.
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::RESOURCES
- Kigkonsult\Icalcreator\Vcalendar::ALTREP
- Kigkonsult\Icalcreator\Vcalendar::LANGUAGE
are available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
calendarComponent::createResources()
Example
$str = $component->createResources();
Remove RESOURCES from component.
Format
calendarComponent::deleteResources()
Example 1
Delete (single/first) RESOURCES property.
$vevent->deleteResources();
Example 2
Delete RESOURCES property no 2.
$vevent->deleteResources( 2 );
Example 3
Delete all RESOURCES properties.
while( $vevent->deleteResources()) { continue; }
If set, returns property value, otherwise bool false.
Format 1
calendarComponent::getResources()
output = resources1
Format 2
calendarComponent::getResources( propOrderNo/null, true )
propOrderNo = (int) specific property value
output = array( "value" => resources1 , "params" => params2 )
Format 3
calendarComponent::getResources( propOrderNo )
propOrderNo = (int) specific property value
Get propOrderNo RESOURCES
Example
$resources = $vtodo->getResources();
Set property value.
In spite of the fact that RESOURCES may contain a (comma separated) list of values, a strong recommendation is to split a RESOURCES "list" into multiple single RESOURCES entries.
The method returns the class instance (static).
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true).
Parameters will be ordered as prescribed in [RFC5545].
Format
calendarComponent::setResources( resources [, params [, propOrderNo ]] )
resources1 = (string) textual resources or subtypes of the calendar component, can be specified as a list of resources separated by the COMMA character. params2 = (array) ( Vcalendar::ALTREP => (string) "<an alternate text representation, URI>", Vcalendar::LANGUAGE => (string) "lang*", *xparams ) xparams = (string) key => (string) value // key prefix "X-" propOrderNo = (int) order number // 1=1st, 2=2nd etc lang* = as defined in [RFC5546]
Example
$vevent->setResources( "COMPUTER PROJECTOR" );
This property defines a rule or repeating pattern for recurring EVENTs, TODOs, STANDARD or DAYLIGHT definitions and is OPTIONAL and MAY occur more than once ([RFC2445]), SHOULD NOT occur more than once ([RFC5545]). iCalcreator allows only one in component.
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::RRULE
- Kigkonsult\Icalcreator\Vcalendar::EXRULE
- Kigkonsult\Icalcreator\Vcalendar::FREQ
- Kigkonsult\Icalcreator\Vcalendar::UNTIL
- Kigkonsult\Icalcreator\Vcalendar::COUNT
- Kigkonsult\Icalcreator\Vcalendar::INTERVAL
- Kigkonsult\Icalcreator\Vcalendar::BYSECOND
- Kigkonsult\Icalcreator\Vcalendar::BYMINUTE
- Kigkonsult\Icalcreator\Vcalendar::BYHOUR
- Kigkonsult\Icalcreator\Vcalendar::BYDAY
- Kigkonsult\Icalcreator\Vcalendar::BYMONTHDAY
- Kigkonsult\Icalcreator\Vcalendar::BYYEARDAY
- Kigkonsult\Icalcreator\Vcalendar::BYWEEKNO
- Kigkonsult\Icalcreator\Vcalendar::BYMONTH
- Kigkonsult\Icalcreator\Vcalendar::BYSETPOS
- Kigkonsult\Icalcreator\Vcalendar::WKST
- Kigkonsult\Icalcreator\Vcalendar::SECONDLY
- Kigkonsult\Icalcreator\Vcalendar::MINUTELY
- Kigkonsult\Icalcreator\Vcalendar::HOURLY
- Kigkonsult\Icalcreator\Vcalendar::DAILY
- Kigkonsult\Icalcreator\Vcalendar::WEEKLY
- Kigkonsult\Icalcreator\Vcalendar::MONTHLY
- Kigkonsult\Icalcreator\Vcalendar::YEARLY
- Kigkonsult\Icalcreator\Vcalendar::DAY
- Kigkonsult\Icalcreator\Vcalendar::SU
- Kigkonsult\Icalcreator\Vcalendar::MO
- Kigkonsult\Icalcreator\Vcalendar::TU
- Kigkonsult\Icalcreator\Vcalendar::WE
- Kigkonsult\Icalcreator\Vcalendar::TH
- Kigkonsult\Icalcreator\Vcalendar::FR
- Kigkonsult\Icalcreator\Vcalendar::SA
are available.
If set, returns iCal formatted string, otherwise null.
Format
calendarComponent::createRrule()
Example
$str = $component->createRrule();
Remove RRULE from component.
Format
calendarComponent::deleteRrule()
Example 1
Delete (single/first) RRULE property.
$vevent->deleteRrule();
Example 2
Delete RRULE property no 2.
$vevent->deleteRrule( 2 );
Example 3
Delete all RRULE properties.
while( $vevent->deleteRrule()) { continue; }
If set, returns property value, otherwise bool false.
Format 1
calendarComponent::getRrule()
output = recur1
Format 2
calendarComponent::getRrule( true )
output = array( "value" => recur1 , "params" => xparams2 )
Example
$rrules = $vtodo->getRrule();
Set property single value, "RECUR", multiple values not allowed.
The "RECUR" property SHOULD NOT occur more than once in a component.
The method returns the class instance (static).
The method throws
Parameters will be ordered as prescribed in [RFC5545].
Format
calendarComponent::setRrule( recur [, xparams [, propOrderNo ]] )
See rules in detail in RFC5545 - Internet Calendaring and Scheduling Core Object Specification (iCalendar).recur1 = (array) (
Vcalendar::FREQ => freq,
// either UNTIL or COUNT may appear in a "recur",
but UNTIL and COUNT MUST NOT occur in the same "recur"
Vcalendar::UNTIL "=>" >enddate,
Vcalendar::COUNT "=>" 1*DIGIT,
// the rest of these keywords are optional,
but MUST NOT occur more than once
Vcalendar::INTERVAL "=>" 1*DIGIT,
Vcalendar::BYSECOND "=>" byseclist,
Vcalendar::BYMINUTE "=>" byminlist,
Vcalendar::BYHOUR "=>" byhrlist,
Vcalendar::BYDAY "=>" bywdaylist,
Vcalendar::BYMONTHDAY "=>" bymodaylist,
Vcalendar::BYYEARDAY "=>" byyrdaylist,
Vcalendar::BYWEEKNO "=>" bywknolist,
Vcalendar::BYMONTH "=>" bymolist,
Vcalendar::BYSETPOS "=>" bysplist,
Vcalendar::WKST "=>" weekday ]
x-name "=>" (string) text ]
)
freq =
Vcalendar::SECONDLY" /
Vcalendar::MINUTELY /
Vcalendar::HOURLY /
Vcalendar::DAILY /
Vcalendar::WEEKLY /
Vcalendar::MONTHLY /
Vcalendar::YEARLY
enddate = date // a DATE value or a UTC timezone DATE-TIME value
date = (object) DateTimeInterface instance, will be set to UTC if not UTC timezone
date = (string) date/datetime string*
byseclist = seconds
byseclist = (array) (seconds *(, seconds ))
seconds = 1DIGIT / 2DIGIT ;0 to 59
byminlist = minutes
byminlist = (array) ( minutes *(, minutes ))
minutes = 1DIGIT / 2DIGIT ;0 to 59
byhrlist = hour
byhrlist = (array) ( hour *(, hour ))
hour = 1DIGIT / 2DIGIT ;0 to 23
bywdaylist = weekdaynum
bywdaylist = (array) ( weekdaynum *("," weekdaynum ))
weekdaynum = (array) ( [([plus] ordwk / minus ordwk)], "DAY" => weekday )
plus = "+"
minus = "-"
ordwk = 1DIGIT / 2DIGIT ;1 to 53
// Vcalander::SU etc available
weekday = "SU" / "MO" / "TU" / "WE" / "TH" / "FR" / "SA"
; Corresponding to
; SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY,
; FRIDAY and SATURDAY days of the week.
bymodaylist = monthdaynum
bymodaylist = (array) ( monthdaynum *(, monthdaynum ))
monthdaynum = ( [plus] ordmoday ) / ( minus ordmoday )
ordmoday = 1DIGIT / 2DIGIT ;1 to 31
byyrdaylist = yeardaynum
byyrdaylist = (array) ( yeardaynum *(, yeardaynum ))
yeardaynum = ( [plus] ordyrday ) / ( minus ordyrday )
ordyrday = 1DIGIT / 2DIGIT / 3DIGIT ;1 to 366
bywknolist = weeknum
bywknolist = (array) ( weeknum *(, weeknum ))
weeknum = ( [plus] ordwk ) / ( minus ordwk )
bymolist = monthnum
bymolist = (array) ( monthnum *(, monthnum ))
monthnum = 1DIGIT / 2DIGIT ;1 to 12
bysplist = setposday
bysplist = (array) ( setposday *(, setposday ))
setposday = yeardaynum
xparams2 = (array) ( *[ (string) key => (string) value ] ) // key prefix "X-"
propOrderNo = (int) order number // 1=1st, 2=2nd etc
* please notice date restraints.
Example
try { $vevent->setRrule( [ Vcalendar::FREQ => Vcalendar::MONTHLY, Vcalendar::UNTIL => new DateTime( "20060831" ), // DATE, if DATE-TIME, UTC timezone Vcalendar::INTERVAL => 2, Vcalendar::WKST => Vcalendar::SU, Vcalendar::BYSECOND => 2, Vcalendar::BYMINUTE => [ 2, -4, 6 ], // (*) Vcalendar::BYHOUR => [ 2, 4, -6 ], // (*) Vcalendar::BYMONTHDAY => -2, // (*) Vcalendar::BYYEARDAY => 2, // (*) Vcalendar::BYWEEKNO => [ 2, -4, 6 ], // (*) Vcalendar::BYMONTH => 2, // (*) Vcalendar::BYSETPOS => [ 2, -4, 6 [, // (*) Vcalendar::BYDAY => [ // [ -1, Vcalendar::DAY => Vcalendar::WE ], // last WE [ 3, Vcalendar::DAY => Vcalendar::TH ], // third TH [ 5, Vcalendar::DAY => Vcalendar::FR ], // fifth FR [ Vcalendar::DAY => Vcalendar::MO ] // every MO ], [ "x-key" => "xparamValue" ] ); } catch( Exception $e ) { die( $e->getMessage()); } $vtodo->setRrule( [ Vcalendar::FREQ => Vcalendar::WEEKLY, Vcalendar::COUNT => 2, Vcalendar::INTERVAL => 2, Vcalendar::WKST => Vcalendar::SU, Vcalendar::BYSECOND => [ -2, 4, 6 ], // (*) Vcalendar::BYMINUTE => -2, // (*) Vcalendar::BYHOUR => 2, // (*) Vcalendar::BYMONTHDAY => [ 2, -4, 6 ], // (*) Vcalendar::BYYEARDAY => [ -2, 4, 6 ], // (*) Vcalendar::BYWEEKNO => -2, // (*) Vcalendar::BYMONTH => [ 2, 4, -6 ], // (*) Vcalendar::BYSETPOS => -2, // (*) // Vcalendar::BYday => Vcalendar::WE // one day // Vcalendar::BYday => [ Vcalendar::WE, Vcalendar::TH ], // days Vcalendar::BYday => [ 5, Vcalendar::DAY => Vcalendar::WE ], // pos. day ], [ "x-key" => "xparamValue" ] ); // (*) single value/array of values
This property defines the revision sequence number of the calendar component within a sequence of revisions. The property is OPTIONAL and MUST NOT occur more than once in VEVENT, VTODO and VJOURNAL components.
It is monotonically incremented by the ORGANIZER's CUA (Calendar
User Agent) each time the ORGANIZER makes a significant revision
to the calendar component.
When the ORGANIZER makes changes to one of the following
properties, the sequence number MUST be incremented: DTSTART,
DTEND, DUE, RDATE, RRULE,
EXDATE, EXRULE, STATUS. In addition,
changes made by the ORGANIZER to other properties can also force
the sequence number to be incremented. The ORGANIZER CUA MUST
increment the sequence number when ever it makes changes to
properties in the calendar component that the ORGANIZER
deems will jeopardize the validity of the participation status of the
Attendees. For example, changing the location
of a meeting from one locale to another distant locale could
effectively impact the participation status of the Attendees.
The value type of SEQUENCE is INTEGER.
The calendar method SORT with argument UID also use RECURRENCE-ID / SEQUENCE as sort parameters.
To ease up usage, constant Kigkonsult\Icalcreator\Vcalendar::SEQUENCE is available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
calendarComponent::createSequence()
Example
$str = $component->createSequence();
Remove SEQUENCE from component.
Format
calendarComponent::deleteSequence()
Example
$vtodo->deleteSequence();
If set, returns property value, otherwise bool false.
Format 1
calendarComponent::getSequence()
output = sequence1
Format 2
calendarComponent::getSequence( true )
output = array( "value" => sequence1 , "params" => xparams2 )
Example
$sequence = $vtodo->getSequence();
Set property value.
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true) and if value is not an integer.
Format
calendarComponent::setSequence( [, sequence [, xparams ]] )
sequence1 = (int) Value type INTEGER xparams2 = (array) ( *[ (string) key => (string) value ] ) // key prefix "X-"
Example 1
$vevent->setSequence( 2 ); // set sequence number to 2
Example 2
$vevent->setSequence(); // force sequence number to be set to 0 // or, if sequence exists, incremented by 1
This property defines the overall status or confirmation for the calendar component. The property is OPTIONAL and MUST NOT occur more than once in VEVENT, VTODO and VJOURNAL components.
You can SORT calendar (components) on (asc) STATUS values.
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::STATUS
- Kigkonsult\Icalcreator\Vcalendar::COMPLETED
- Kigkonsult\Icalcreator\Vcalendar::CANCELLED
- Kigkonsult\Icalcreator\Vcalendar::CONFIRMED
- Kigkonsult\Icalcreator\Vcalendar::DRAFT
- Kigkonsult\Icalcreator\Vcalendar::F_NAL // note FINAL
- Kigkonsult\Icalcreator\Vcalendar::IN_PROCESS
- Kigkonsult\Icalcreator\Vcalendar::NEEDS_ACTION
- Kigkonsult\Icalcreator\Vcalendar::TENTATIVE
are available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
calendarComponent::createStatus()
Example
$str = $component->createStatus();
Remove STATUS from component.
Format
calendarComponent::deleteStatus()
Example
$vtodo->deleteStatus();
If set, returns property value, otherwise bool false.
Format 1
calendarComponent::getStatus()
output = status1
Format 2
calendarComponent::getStatus( true )
output = array( "value" => status1 , "params" => xparams2 )
Example
$status = $vtodo->getStatus();
Set property value.
The method throws InvalidArgumentException on
- empty value and config ALLOWEMPTY is set to false (default true),
- invalid value (below).
Format
calendarComponent::setStatus( status [, xparams ] )
// Status values for a VEVENT status1 = Vcalendar::TENTATIVE // Indicates event is tentative / Vcalendar::CONFIRMED // Indicates event is definite / Vcalendar::CANCELLED // Indicates event was cancelled // Status values for VTODO status1 = Vcalendar::NEEDS_ACTION // Indicates to-do needs action / Vcalendar::COMPLETED // Indicates to-do completed / Vcalendar::IN_PROCESS // Indicates to-do in process of / Vcalendar::CANCELLED // Indicates to-do was cancelled // Status values for VJOURNAL status1 = Vcalendar::DRAFT // Indicates journal is draft / Vcalendar::F_NAL; // Indicates journal is final / Vcalendar::CANCELLED // Indicates journal is removed xparams2 = (array) ( *[ (string) key => (string) value ] ) // key prefix "X-"
Example
$vevent->setStatus( "COMPLETED" );
This property defines a short ("one line") summary or subject for the calendar component. (In "[RFC5545], Recommended Practices", up to 255 characters) (, analogous to a mail SUBJECT). The property is OPTIONAL and MUST NOT occur more than once in VEVENT, VTODO and VJOURNAL components. The property is REQUIRED and MUST occur once in VALARM (EMAIL) calendar component.
The value type for SUMMARY is TEXT.
You can SORT calendar (components) on (asc) SUMMARY values.
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::SUMMARY
- Kigkonsult\Icalcreator\Vcalendar::ALTREP
- Kigkonsult\Icalcreator\Vcalendar::LANGUAGE
are available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
calendarComponent::createSummary()
Example
$str = $component->createSummary();
Remove SUMMARY from component.
Format
calendarComponent::deleteSummary()
Example
$vevent->deleteSummar();
If set, returns property value, otherwise bool false.
Format 1
calendarComponent::getSummary()
output = summary1
Format 2
calendarComponent::getSummary( true )
output = array( "value" => summary1 , "params" => params2 )
Example
$summary = $vtodo->getSummary();
Set property value.
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true).
Parameters will be ordered as prescribed in [RFC5545].
Format
calendarComponent::setSummary( summary [, params ] )
summary1 = (string) Value type TEXT, a short, one line summary about the activity or journal entry. params2 = array( Vcalendar::ALTREP => (string) "<an alternate text representation, URI>", Vcalendar::LANGUAGE => (string) "lang*", *xparams ) xparams = (string) key => (string) value // key prefix "X-" lang* = as defined in [RFC5546]
Example
$vevent->setSummary( "This is a summary" );
This property defines whether an EVENT is transparent or not to busy time searches and is OPTIONAL and MUST NOT occur more than once.
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::TRANSP
- Kigkonsult\Icalcreator\Vcalendar::OPAQUE
- Kigkonsult\Icalcreator\Vcalendar::TRANSPARENT
are available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
calendarComponent::createTransp()
Example
$str = $component->createTransp();
Remove TRANSP from component.
Format
calendarComponent::deleteTransp()
Example
$vevent->deleteTransp();
If set, returns property value, otherwise bool false.
Format 1
calendarComponent::getTransp( )
output = transp1
Format 2
calendarComponent::getTransp( true )
output = array( "value" => transp1 , "params" => xparams2 )
Example
$transp = $vtodo->getTransp();
Set property value.
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true).
Format
calendarComponent::setTransp( transp [, xparams ] )
transp1 = Vcalendar::OPAQUE / Vcalendar::TRANSPARENT xparams2 = (array) *( (string) key => (string) value ) // key prefix "X-"
Example
$vevent->setTransp( "TRANSPARENT" );
This property specifies when an ALARM will trigger and is REQUIRED and MUST NOT occur more than once.
The default value type is DURATION. The value type can be set to a DATE-TIME value type, in which case the value MUST specify an UTC timezone DATE-TIME value.
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::TRIGGER
- Kigkonsult\Icalcreator\Vcalendar::VALUE
- Kigkonsult\Icalcreator\Vcalendar::DURATION
- Kigkonsult\Icalcreator\Vcalendar::DATE_TIME
- Kigkonsult\Icalcreator\Vcalendar::RELATED
- Kigkonsult\Icalcreator\Vcalendar::START
- Kigkonsult\Icalcreator\Vcalendar::END
are available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
valarm::createTrigger()
Example
$str = $component->createTrigger();
Remove TRIGGER from component.
Format
valarm::deleteTrigger()
Example
$valarm->deleteTrigger();
If set, returns property value, otherwise bool false.
Format 1
valarm::getTrigger()
output = duration1/date3
Format 2
valarm::getTrigger( true )
output = array( "value" => duration1/date3 ) , "params" => params4 )
Example
$trigger = $valarm->getTrigger();
Set property value.
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true) and on DateTime/DateInterval error.
Format 1
valarm::setTrigger( duration1 [, params4 ] )
Format 2
valarm::setTrigger( duration2 [, params4 ] )
Format 3
valarm::setTrigger( date3 [, params4 ] )
duration1 = (object) DateInterval class instance
duration1 = (string) dur-value = (["+"]/"-")"P"(dur-date/dur-time/dur-week) like "P1DT2H3M4S"
dur-date = dur-day [dur-time]
dur-time = "T" (dur-hour / dur-minute / dur-second)
dur-week = 1*DIGIT "W"
dur-day = 1*DIGIT "D"
dur-hour = 1*DIGIT "H" [dur-minute]
dur-minute = 1*DIGIT "M" [dur-second]
dur-second = 1*DIGIT "S"
date3 = (object) DateTimeInterface instance, will be set to UTC if not UTC timezone
date3 = (string) datetime string*
params4 = (array) ( [[ reltype [, trigRelparam ]] / datetimeparam ] *[, xparams ] )
reltyp = Vcalendar::RELATED => Vcalendar::START / Vcalendar::END
// default Vcalendar::START
trigRelparam = Vcalendar::VALUE => Vcalendar::DURATION // default Vcalendar::DURATION
datetimeparam = Vcalendar::VALUE => Vcalendar::DATE_TIME // mandatory if DATE-TIME
xparams = (string) key => (string) value // key prefix "X-"
* please notice date restraints.
Example 1
A fix date duration
try { $valarm->setTrigger( new DateTime( '2007-06-05 02:02:03 UTC' )); } catch( Exception $e ) { die( $e->getMessage()); }
Example 2
A duration, 1 hour 2 min 3 sec, before start (before default)
try { $dateInterval = new DateInterval( "PT1H2M3S" ); $dateInterval->invert = 1; $valarm->setTrigger( $dateInterval ); } catch( Exception $e ) { die( $e->getMessage()); }
Example 3
A duration, 1 week after end.
try { $valarm->setTrigger( "P1W", [ Vcalendar::RELATED => Vcalendar::END ] ); } catch( Exception $e ) { die( $e->getMessage()); }
Example 4
A duration, 1 hour 2 min 3 sec, before start (before default)
try { $valarm->setTrigger( "-PT1H2M3S" ); } catch( Exception $e ) { die( $e->getMessage()); }
Example 5
A duration, 1 hour 2 min 3 sec, before start (before default).
Subject for removal in future versions.
try { $valarm->setTrigger( null, null, null, null, 1, 2, 3 ); } catch( Exception $e ) { die( $e->getMessage()); }
Example 6
A duration, 1 hour 2 min 3 sec, before start (before default).
Subject for removal in future versions.
try { $valarm->setTrigger( [ "hour"=> 1, "min"=> 2, "sec"=> 3 ] ); } catch( Exception $e ) { die( $e->getMessage()); }
Example 7
A duration, 1 week before start (before default).
Subject for removal in future versions.
try { $valarm->setTrigger( null, null, null, 1 ); } catch( Exception $e ) { die( $e->getMessage()); }
This property specifies the text value that uniquely identifies the VTIMEZONE calendar component and is REQUIRED, but MUST NOT occur more than once.
The value type for TZID is TEXT.
To ease up usage, constant Vcalendar::TZID is available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
vtimezone::createTzid()
Example
$str = $component->createTzid();
Remove TZID from component.
Format
vtimezone::deleteTzid()
Example
$vtimezone->deleteTzid();
If set, returns property value, otherwise bool false.
Format 1
vtimezone::getTzid()
output = tzid1
Format 2
vtimezone::getTzid( true )
output = array( "value" => tzid1 , "params" => xparams2 )
Example
$tzid = $vtimezone->getTzid();
Set property value.
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true).
Format
vtimezone::setTzid( tzid [, xparams ] )
tzid1 = (string) Value type TEXT xparams2 = (array)( *[ (string) key => (string) value ] ) // key prefix "X-"
Example
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $vtimezone = $vcalendar->newVtimezone() ->setTzid( "US-Eastern" );
This property specifies the customary designation for a STANDARD or DAYLIGHT description and is OPTIONAL and MAY occur more than once.
The value type for TZNAME is TEXT.
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::TZNAME
- Kigkonsult\Icalcreator\Vcalendar::LANGUAGE
are available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
vtimezone::createTzname()
Example
$str = $component->createTzname();
Remove TZNAME from component.
Format
vtimezone::deleteTzname()
Example 1
Delete (single/first) TZNAME property.
$vtimezonestd->deleteTzname();
Example 2
Delete TZNAME property no 2.
$vtimezonestd->deleteTzname( 2 );
Example 3
Deleting all TZNAME properties.
while( $vtimezonestd->deleteTzname()) { continue; }
If set, returns property value, otherwise bool false.
Format 1
vtimezone::getTzname()
output = tzname1
Format 2
vtimezone::getTzname( propOrderNo/null, true )
propOrderNo = (int) specific property value
output = array( "value" => tzname1 , "params" => params2 )
Format 3
vtimezone::getTzname( propOrderNo )
propOrderNo = (int) specific property value
Get propOrderNo TZNAME
Example
$tzname = $timezonestandard->getTzname();
Set property value.
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true) or invalid offset value;.
Format
vtimezone::setTzname( tzname [, params [, propOrderNo ]] )
tzname1 = (string) Value type TEXT params2 = (array) ( Vcalendar::LANGUAGE => (string) "lang*", *xparams ) xparams = (string) key => (string) value // key prefix "X-" propOrderNo = (int) order number // 1=1st, 2=2nd etc lang* = as defined in [RFC5546]
Example
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $vtimezone = $vcalendar->newVtimezone() ->setTzid( "AKST" ); $standard = $vtimezone->newStandard() ->setTzname( "AKST" ); $daylight = $vtimezone->newDaylight() ->setTzname( "AKDT" );
This property specifies the offset which is in use prior to this TIMEZONE observance. The property is REQUIRED, but MUST NOT occur more than once in STANDARD and DAYLIGHT components.
The value type is UTC-OFFSET, "+" / "-" time-hour (2*DIGIT) time-minute (2*DIGIT) [time-second (2*DIGIT)].
To ease up usage, constant Kigkonsult\Icalcreator\Vcalendar::TZOFFSETFROM is available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
vtimezone::createTzoffsetfrom()
Example
$str = $component->createTzoffsetfrom();
Remove TZOFFSETFROM from component.
Format
vtimezone::deleteTzoffsetfrom()
Example
$vtimezonestd->deleteTzoffsetfrom();
If set, returns property value, otherwise bool false.
Format 1
vtimezone::getTzoffsetfrom()
output = tzoffsetfrom1
Format 2
vtimezone::getTzoffsetfrom( true )
output = array( "value" => tzoffsetfrom1 , "params" => xparams2 )
Example
$tzoffsetfrom = $tzstandard->getTzoffsetfrom();
Set property value.
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true) and on invalid offset value.
Format
vtimezone::setTzoffsetfrom( tzoffsetfrom [, xparams ] )
tzoffsetfrom1 = (int) (+/-)HHmm[ss] // UTC offset xparams2 = (array) ( *[ /string) key => (string) value ] ) // key prefix "X-"
Example
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $vtimezone = $vcalendar->newVtinezone() ->setTzid( "US-Eastern" ) ->setLastmodified( "19870101" ); $standard = $vtimezone->newStandard() ->setTzname( "EST" ) ->setTzoffsetfrom( "-0500" );
This property specifies the offset which is in use in this TIMEZONE observance. The property is REQUIRED, but MUST NOT occur more than once in STANDARD and DAYLIGHT components.
The value type is UTC-OFFSET, "+" / "-" time-hour (2*DIGIT) time-minute (2*DIGIT) [time-second (2*DIGIT)].
To ease up usage, constant Kigkonsult\Icalcreator\Vcalendar::TZOFFSETTO is available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
vtimezone::createTzoffsetto()
Example
$str = $component->createTzoffsetto();
Remove TZOFFSETTO from component.
Format
vtimezone::deleteTzoffsetto()
Example
$daylight->deleteTzoffsetto();
If set, returns property value, otherwise bool false.
Format 1
vtimezone::getTzoffsetto()
output = tzoffsetto1
Format 2
vtimezone::getTzoffsetto( true )
output = array( "value" => tzoffsetto1 , "params" => xparams2 )
Example
$tzoffsetto = $tztandard->getTzoffsetto();
Set property value.
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true) and on invalid offset value.
Format
vtimezone::setTzoffsetto(tzoffsetto [, xparams ] )
tzoffsetto1 = (int) (+/-)HHmm[ss] // UTC offset xparams2 = array( *[ (string) key => (string) value ] ) // key prefix "X-"
Example
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $vtimezone = $vcalendar->newVtimezone() ->setTzid( "US-Eastern" ) ->setLastmodified( "19870101" ); $standard = $vtimezone->newStandard(); .. . $daylight = $vtimezone->newDaylight() ->setTzoffsetto( "1345" );
The TZURL provides a means for a VTIMEZONE component to point to a network location that can be used to retrieve an up-to-date version of itself. The property is OPTIONAL and MUST NOT occur more than once.
The value type is URI.
To ease up usage, constant Kigkonsult\Icalcreator\Vcalendar::TZURL is available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
vtimezone::createTzurl()
Example
$str = $component->createTzurl();
Remove TZURL from component.
Format
vtimezone::deleteTzurl()
Example
$vtimezone->deleteTzurl();
If set, returns property value, otherwise bool false.
.Format 1
vtimezone::getTzurl()
output = tzurl1
Format 2
vtimezone::getTzurl( true )
output = array( "value" => tzurl1 , "params" => xparams2 )
Example
$tzurl = $timezonestandard->getTzurl();
Set property value.
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true).
The method throws InvalidArgumentException on url error.
Format
vtimezone::setTzurl(tzurl [, xparams ] )
tzurl1 = (string) Value type URI xparams2 = array( *[ (string) key => (string) value ] ) // key prefix "X-"
Example
use Kigkonsult\Icalcreator\Vcalendar; $tz = "http://zones.stds_r_us.net/tz/US-Eastern" ); $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $vtimezone = $vcalendar->newVtimezone() ->setTzid( "US-Eastern" ); try { $vtimezone->setLastmodified( "19870101T000000" ) } catch( Exception $e ) { die( $e->getMessage(); } try { $vtimezone->setTzurl( $tz ); } catch( InvalidArgumentException $e ) { die( $e->getMessage(); }
The persistent, globally Unique IDentifier for the calendar / component.
The property (is OPTIONAL and) MUST NOT occur more than once in
VEVENT, VTODO,
VJOURNAL and VFREEBUSY components.
However, UID is automatically generated in iCalcreator when creating component.
Note, as described in rfc7986 iCalendar Property Extensions, UID (may) occur once in VCALENDAR and may NOT be supported by all calendaring software. Calendar UID is automatically generated at instance creation. Usage and examples, below, corresponds to vcalendar usage.
UID is a hex-encoded random Universally Unique Identifier (UUID) value as defined in Sections 4.4 and 4.5 of rfc4122.
Example
UID:5FC53010-1267-4F8E-BC28-1D7AE55A7C99
UID may be required when importing iCal formatted information into some calendar software (MS etc.), as well as (calendar) properties x-properties "X-WR-CALNAME", "X-WR-CALDESC" and "X-WR-TIMEZONE", METHOD (value PUBLISH etc.) and the (also automatically created) DTSTAMP property.
The value type for UID is TEXT.
To ease up usage, constant Kigkonsult\Icalcreator\Vcalendar::UID is available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
calendarComponent::createUid()
Example
$str = $component->createUid();
If UID is remove from a component, UID will automatically be recreated when Vcalendar output methods like createCalendar and returnCalendarare used.
Format
calendarComponent::deleteUid()
Example
$vevent->deleteUid();
If set, returns property, otherwise bool false.
Format 1
calendarComponent::getUid()
output = uid1
Format 2
calendarComponent::getUid( true )
output = array( "value" => uid1 , "params" => xparams2 )
Example
$uid = $vevent->getUid();
Insert property value, overrides any previously set or auto-created UID.
Do NOT use an integer UID or only a component name as UID (ex. "vevent"), this may cause malfunction in Vcalendar method setComponent with index or UID argument.
The method throws InvalidArgumentException on empty (non-zero) value.
Format
calendarComponent::setUid( uid [, xparams ] )
uid1 = (string) Value type TEXT xparams2 = array( *[ (string) key => (string) value ] ) // key prefix "X-"
Example
$vevent->setUid( "20070803T194810CEST-0123U3PXiX@kigkonsult.se" );
BUT, due to poorly created iCal formatted information, a numeric UID is accepted in the setUid() and parse() methods. Do check for component digit UIDs and remove it (will force a (auto) UID recreation) or (re-)set it manually.
if( ctype_digit( $vevent->getUid())) { $vevent->deleteUid(); }
This property defines a Uniform Resource Locator (URL) associated with the iCalendar object. The property is OPTIONAL and MUST NOT occur more than once in VEVENT, VTODO, VJOURNAL and VFREEBUSY components.
Note, as described in rfc7986 iCalendar Property Extensions, URL may occur once in VCALENDAR and may NOT be supported by all calendaring software. Usage and examples, below, corresponds to vcalendar usage.
The value type is URI.
You can SORT calendar (components) on (asc) URL values.
To ease up usage, constant Kigkonsult\Icalcreator\Vcalendar::URL is available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
calendarComponent::createUrl()
Example
$str = $component->createUrl();
Remove URL from component.
Format
calendarComponent::deleteUrl()
Example
$vevent->deleteUrl();
If set, returns property value, otherwise bool false.
Format 1
calendarComponent::getUrl()
output = url1
Format 2
calendarComponent::getUrl( true )
output = array "value" => url1 , "params" => xparams2 )
Example
$url = $vevent->getUrl();
Set property value.
The non-rfc (opt urlencoded) value prefix/suffix "<>" (and parameter valuetype) is supported.
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true), InvalidArgumentException on url error.
Format
calendarComponent::setUrl( url [, xparams ] )
url1 = (string) Value type URI xparams2 = (array) ( *[ (string) key => (string) value ] ) // key prefix "X-"
Example
try { $vtodo->setUrl( "http://www.icaldomain.net" ); } catch( InvalidArgumentException $e ) { die( $e->getMessage()); }
A component, non-standard property with a TEXT value and a name with an "X-" prefix. In a component, an x-property, with an unique name, can occur only once but the number of x-properties are unlimited.
The value type is TEXT.
If set, returns [RFC5545] formatted string, otherwise null.
Format
calendarComponent::createXprop()
Example
$str = $component->createxProp();
Remove X-PROPERTY from component.
Format
calendarComponent::deleteXprop( "<X-PROPERTY>" )
Example 1
Deleting x-property named "X-PROPERTY".
$vevent->deleteXprop( "X-PROPERTY" );
Example 2
Deleting all x-properties.
while( $vevent->deleteXprop()) { continue; }
If set, returns property value, otherwise bool false.
Format 1
Get specific x-propery value.
calendarComponent::getXprop( "<X-PROPERTY-NANE>" )
output = array( propertyName1 , value2 )
Format 2
Get (next) x-property value.
calendarComponent::getXprop()
output = array( propertyName1 , value2 )
Format 3
calendarComponent::getXprop( null, propOrderNo/null, true )
propOrderNo = (int) specific property value
output = array( propertyName1 , array ( "value" => value2 ) , "params" => params3))
Format 4
calendarComponent::getXprop( null, propOrderNo )
propOrderNo = (int) specific property value
Get propOrderNo X-property
Example 1
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $iCalContent = file_get_contents( "calendar.ics" ); $vcalendar->parse( $iCalContent ); if( false !== ( $d = $vcalendar->getXprop( Vcalendar::X_WR_TIMEZONE ))) { echo $d[1]; // $d = array( "X-WR-TIMEZONE", value2 ) }
Example 2
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $iCalContent = file_get_contents( "calendar.ics" ); $vcalendar->parse( $iCalContent ); while( $xprop = $vcalendar->getXprop )) { // $xprop = array( propertyName1, value2 ) .. .
Example 3
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $iCalContent = file_get_contents( "calendar.ics" ); $vcalendar->parse( $iCalContent ); while( $xprop = $vcalendar->getXprop( "X-ABC-MMSUBJ" )) { // $xprop = array( "X-ABC-MMSUBJ", value2 ) .. . }
Example 4
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $iCalContent = file_get_contents( "calendar.ics" ); $vcalendar->parse( $iCalContent ); while( $xprop = $vcalendar->getXprop( null, null, true )) { /* $xprop = [ propertyName1, [ "value" => value2, "params" => params3 ] */
Insert property name and value. If an x-prop with the same name already exists, it will be replaced.
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true).
Format
calendarComponent::setXprop( propertyName, propertyData [, params ] )
propertyName1 = (string) Any property name with a "X-" prefix value2 = (string) Value type TEXT params3 = (array) ( [Vcalendar::LANGUAGE => (string) "lang*"] *[, xparams] ) xparam = (string) key => (string) value // key prefix "X-" lang* = as defined in [RFC5546]
Example
$component->setXprop("X-ABC-MMSUBJ","http://load.noise.org/mysubj.wav");
This property specifies a color used for displaying the VCALENDAR VEVENT, VTODO, VJOURNAL data. The value is a case-insensitive color name taken from the CSS3 set of names, defined in Section 4.3 of [W3C.REC-css3-color-20110607].
Note, as described in rfc7986 iCalendar Property Extensions, COLOR may occur once and may NOT be supported by all calendaring software.
The value type is TEXT.
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::COLOR
is available.
If set, returns [RFC7986] formatted string, otherwise null.
Format
calendarComponent::createColor()
Example
$str = $component->createColor();
Remove COLOR from component.
Format
calendarComponent::deleteColor()
Example
$vevent->deleteColor();
If set, returns property value, otherwise bool false.
Format 1
calendarComponent::getColor( )
output = color1
Format 2
calendarComponent::getColor( true )
output = array( "value" => color1, "params" => xparams2 )
Example
$transp = $vtodo->getColor();
Set property value.
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true).
Format
calendarComponent::setColor( color [, xparams ] )
transp1 = <color> xparams2 = (array) *( (string) key => (string) value ) // key prefix "X-"
Example
$vevent->setColor( "Blue" );
CONFERENCE specifies information for accessing a telephone-based number dial-in conferencing system for attendees of a meeting or task.
Note, as described in rfc7986 iCalendar Property Extensions, CONFERENCE may be specified multiple times in a VEVENT and VTODO and may NOT be supported by all calendaring software.
The value type is URI.
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::CONFERENCE
- Kigkonsult\Icalcreator\Vcalendar::URI
- Kigkonsult\Icalcreator\Vcalendar::FEATURE
- Kigkonsult\Icalcreator\Vcalendar::LABEL
- Kigkonsult\Icalcreator\Vcalendar::URI
- Kigkonsult\Icalcreator\Vcalendar::LABEL
- Kigkonsult\Icalcreator\Vcalendar::LANGUAGE
are available.
If set, returns [RFC7986] formatted string, otherwise null.
Format
calendarComponent::createConference()
Example
$str = $component->createConference();
Remove CONFERENCE from component.
Format
calendarComponent::deleteConference()
Example
$vevent->deleteConference();
If set, returns property value, otherwise bool false.
Format 1
calendarComponent::getConference()
output = url1
Format 2
calendarComponent::getConference( true )
output = array "value" => conference1, "params" => params2 )
Example
$conference = $vevent->getConference();
Set property value.
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true), InvalidArgumentException on url error.
Format
calendarComponent::setConference( conference [, params ] )
conference1 = (string) Value type URI params2 = [ Vcalendar::VALUE => Vcalendar::URI, Vcalendar::FEATURE => featureValue, Vcalendar::LABEL => human-readable data, Vcalendar::LANGUAGE => (string) "lang" // opt. if LABEL is set xparams ] featureValue = one or more (comma separated) Vcalendar::AUDIO // Audio capability Vcalendar::CHAT // Chat or instant messaging Vcalendar::FEED // Blog or Atom feed Vcalendar::MODERATOR // Moderator dial-in code Vcalendar::PHONE // Phone conference Vcalendar::SCREEN // Screen sharing Vcalendar::VIDEO // Video capability x-name // Experimental type iana-token // Other IANA-registered type lang = as defined in [RFC5546] xparams = *[ (string) key => (string) value ] // key prefix "X-"
Note, as described in rfc7986 iCalendar Property Extensions, IMAGE may be specified multiple times in VCALENDAR and in VEVENT, VTODO, VJOURNAL and may NOT be supported by all calendaring software.
The value type is URI.
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::IMAGE
- Kigkonsult\Icalcreator\Vcalendar::ALTREP
- Kigkonsult\Icalcreator\Vcalendar::DISPLAY
- Kigkonsult\Icalcreator\Vcalendar::URI
- Kigkonsult\Icalcreator\Vcalendar::BINERY
- Kigkonsult\Icalcreator\Vcalendar::ENCODING
- Kigkonsult\Icalcreator\Vcalendar::FMTTYPE
- Kigkonsult\Icalcreator\Vcalendar::BASE64
are available.
Methods and usage, below, applies also to Vcalendar instance.
If set, returns [RFC7986] formatted string, otherwise null.
Format
calendarComponent::createImage()
Example
$str = $component->createImage();
Remove IMAGE from component.
Format
calendarComponent::deleteImage()
Example 1
$vevent->deleteImage();
Example 2
Delete IMAGE property no 2.$vevent->deleteImage( 2 );
Example 3
Deleting all IMAGE properties.while( $vevent->deleteImage()) { continue; }
If set, returns property value(-s), otherwise bool false.
Format 1
calendarComponent::getImage()
output = imageValue1
Format 2
calendarComponent::getImage( propOrderNo/null , true )
propOrderNo = (int) specific property value,
output = array( "value" => imageValue1, "params" => params2 )
Format 3
calendarComponent::getImage( propOrderNo )
propOrderNo = (int) specific property value order number
Get propOrderNo IMAGE
Example
$image = $valarm->getImage();
Set property value. Parameters will be ordered as prescribed in [RFC7986].
The method returns the class instance (static).
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true).
Format
calendarComponent::setImage( imageValue1 [, params [, propOrderNo ]] )
imageValue1 = (string) URI / inline binary encoded content params2 1 = [ // value is URI Vcalendar::VALUE => Vcalendar::URI ], imageParams ] params2 2 = [ // value is binary Vcalendar::ENCODING => Vcalendar::BASE64, Vcalendar::VALUE => Vcalendar::BINARY, imageParams ] imageParams = [ Vcalendar::FMTTYPE => contentType, Vcalendar::ALTREP => (string) "<an alternate text representation, URI>", Vcalendar::DISPLAY => displayVal, xparams ] contentType = (string) The parameter value MUST be the TEXT for either an IANA registered content type or a non-standard content type. displayval = one or more (comma separated) Vcalendar::BADGE // image inline with the title of the event, DEFAULT Vcalendar::GRAPHIC // a full image replacement for the event itself Vcalendar::FULLSIZE // an image that is used to enhance the event Vcalendar::THUMBNAIL // a smaller variant of "FULLSIZE" to be used // when space for the image is constrained x-name // Experimental type iana-token // Other IANA-registered type xparams = (string) key => (string) value // key prefix "X-" propOrderNo = (int) order number // 1=1st, 2=2nd etc
Example
$vevent->setImage( "ftp://domain.com/pub/docs/agenda.doc", [ Vcalendar::FMTTYPE => "application/binary" ] );
NAME specifies the name of the calendar.
Note, as described in rfc7986 iCalendar Property Extensions, NAME may occur once in VCALENDAR and may NOT be supported by all calendaring software.
The value type is TEXT.
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::NAME
- Kigkonsult\Icalcreator\Vcalendar::ALTREP
- Kigkonsult\Icalcreator\Vcalendar::LANGUAGE
are available.
If set, returns [RFC7986] formatted string, otherwise null.
Format
Vcalendar::createDescription()
Example
$str = $calendar->createName();
Remove NAME from calendar.
Format
Vcalendar::deleteName()
Example 1
Delete (single/first) NAME property.
$calendar->deleteName();
Example 2
Delete NAME property no 2.
$calendar->deletename( 2 );
Example 3
Deleting all NAME properties.
while( $calendar->deleteName()) { continue; }
If set, returns property value(-s), otherwise bool false.
Format 1
Vcalendar::getName()
output = nameValue1
Format 2
Vcalendar::getName( null , true )
output = array( "value" => nameValue1, "params" => params2 )
Example
$name = $calendar->getName();
Set property value.
The method returns the class instance (static).
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true).
Parameters will be ordered as prescribed in [RFC7986].
Format
Vcalendar::setDescription( nameValue [, params [, propOrderNo ]] )
nameValue1 = (string) Value type TEXT params2 = [ Vcalendar::ALTREP => (string) "<an alternate text representation, URI>", Vcalendar::LANGUAGE => (string) "lang*" ], *xparams ] xparams = (string) key => (string) value // key prefix "X-" propOrderNo = (int) order number // 1=1st, 2=2nd etc lang* = as defined in [RFC5546]
Example
$calendar->setName( "This is a name" );
REFRESH-INTERVAL specifies a suggested minimum interval for polling for changes of the calendar data from the original source of that data.
Note, as described in rfc7986 iCalendar Property Extensions, REFRESH-INTERVAL may occur once in VCALENDAR and may NOT be supported by all calendaring software.
The value type is DURATION.
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::REFRESH_INTERVAL
is available.
For methods and usage, see 3.2.19 DURATION but applied on a Vcalendar instance.
Note, as described in rfc7986 iCalendar Property Extensions, SOURCE may occur once in VCALENDAR and may NOT be supported by all calendaring software.
The value type is URI.
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::SOURCE
is available.
If set, returns [RFC5545] formatted string, otherwise null.
Format
Vcalendar::createSource()
Example
$str = $component->createSource();
Remove URL from Vcalendar.
Format
Vcalendar::deleteSource()
Example
$calendar->deleteSource();
If set, returns property value, otherwise bool false.
Format 1
Vcalendar::getSource()
output = url1
Format 2
Vcalendar::getSource( true )
output = array "value" => source1, "params" => xparams2 )
Example
$url = $calendar->getSource();
Set property value.
The method throws InvalidArgumentException on empty value and config ALLOWEMPTY is set to false (default true), InvalidArgumentException on url error.
Format
Vcalendar::setSource( source [, xparams ] )
source1 = (string) Value type URI xparams2 = (array) ( *[ (string) key => (string) value ] ) // key prefix "X-"
Example
try { $calendar->setSource( "http://www.icaldomain.net&q=1" ); } catch( InvalidArgumentException $e ) { die( $e->getMessage()); }
Language for specific calendar component as defined in [RFC5546].
Language set at component level can be overridden by specific component property parameter.
A successful "setConfig" returns bool true.
There is a convenient config key constant available: Vcalendar::LANGUAGE.
Format
calendarComponent::getConfig( "language" )
Example
$lang = $vevent->getConfig( Vcalendar::LANGUAGE );
Format
calendarComponent::setConfig( "language", lang )
lang = (string) language
Example
$vevent->setConfig( Vcalendar::LANGUAGE, "en" );
Calendar component subcomponent functions.
Format
calendarComponent::deleteComponent( orderNumber )
orderNumber = (int) component order Number
Remove component with order number (1st=1, 2nd=2).
calendarComponent::deleteComponent( componentType [, componentSuborderNumber])
componentType = (string) component type componentSuborderNumber = (int) component suborder number
Remove component with component type (ex. "vevent") and order 1 alt. suborder number.
calendarComponent::deleteComponent( UID )
Remove component with UID. N.B UID is NOT set for ALARM / timezone components.
Example 1
Delete first subcomponent.
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $iCalContent = file_get_contents( "calendar.ics" ); $vcalendar->parse( $iCalContent ); $comp1 = $vcalendar->getComponent(); $comp1->deleteComponent( 1 );
Example 2
Delete all subcomponents.
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se", ] ); $iCalContent = file_get_contents( "calendar.ics" ); $vcalendar->parse( $iCalContent ); $comp1 = $vcalendar->getComponent(); while( $comp1->deleteComponent( Vcalendar::VALARM ) { continue; }
Format 1
calendarComponent::getComponent()
Get next component until end-of-components.
Format 2
calendarComponent::getComponent( int orderNumber )
orderNumber = (int) component order number
Get component with order number (1st=1, 2nd=2).
Format 3
calendarComponent::getComponent( string componentType [, int componentSuborderNumber])
componentType = (string) component type componentSuborderNumber = (int) component suborder number
Get (next) component with component type (until end-of-components) alt. component with component type and suborder number (1st=1, 2nd=2..).
Format 4
calendarComponent::getComponent( UID )
Get component with UID. N.B UID is NOT set for ALARM / timezone components.
Example
use Kigkonsult\Icalcreator\Vcalendar; $vcalendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $iCalContent = file_get_contents( "calendar.ics" ); $vcalendar->parse( $iCalContent ); $comp1 = $vcalendar->getComponent()); while( $subComp = $comp1->getComponent()) { ...
Format 1
calendarComponent::setComponent( component ) addSubComponent( component ) // alias
Insert last in component chain.
Format 2
calendarComponent::setComponent( component, int orderNumber )
orderNumber = (int) component order number
Replace component with order number(1st=1, 2nd=2). If orderNumber is not found, component is inserted last in chain.
Format 3
calendarComponent::setComponent( component, componentType [,componentSuborderNumber])
componentType = (string) component type componentSuborderNumber = (int) component suborder number
Replace component with component type and component order number. if orderNumber is not found, component is inserted last in chain.
Example
use Kigkonsult\Icalcreator\Vcalendar; use Kigkonsult\Icalcreator\Vevent; use Kigkonsult\Icalcreator\Valarm; $config = [ Vcalendar::UNIQUE_ID => "kigkonsult.se", ]; $vcalendar = new Vcalendar( $config ); // initiate new CALENDAR $vevent = new Vevent( $config ); // add some EVENT properties $vevent->setDtstart( new DateTime( "2006-12-24 19:30:00" ); $vevent->set...( ... ... $valarm = new Valarm( $config ); $valarm->setTrigger( ... $vevent->setComponent( $valarm ); $vcalendar->setComponent( $vevent );
The Util/VtimezonePopulateFactory::process (static) method, applied on a Vcalendar instance, return the Vcalendar instance with Vtimezone, Standard and Daylight components, using on PHP DateTimeZone class and time zone transition (UTC) timestamps. If Vtimezone exists in calendar, it is replaced.
Recommendation is to call the method after editing components (and without (period) from/to arguments).
To ease up usage, constants
- Kigkonsult\Icalcreator\Vcalendar::X_WR_TIMEZONE
- Kigkonsult\Icalcreator\Vcalendar::X_LIC_LOCATION
are available.
Throws Exception on invalid (PHP) timezone.
Format
Vtimezone::populate( calendar, [ timezone [, xprops, [, from [, to ]]]] )
calendar = (object) Vcalendar instance timezone = (string) valid timezone, acceptable by PHP DateTimeZone* xprops = (array) ( *[ x-propName => value ] ), timezone non-standard properties from = DateTimeInterface | (int) timestamp, period start date** to = DateTimeInterface | (int) timestamp, period end date** * If no argument timezone, the argument xProps is searched for "X-WR-TIMEZONE" and "X-LIC-LOCATION" keys. If not found then calendar are searched for the X-properties. If still none found, "UTC" is used. ** If empty "from" and "to" arguments, the calendar components "DTSTART" values are used to get the lowest (modified, minus 12 month) and highest (modified, plus 18 month) dates.
Example
Using the Util/VtimezonePopulateFactory::process (static) method.use Kigkonsult\Icalcreator\Vcalendar; $calendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $timezone = 'Europe/Stockholm'; .. . // insert components or parse an iCal string .. . $calendar = VtimezonePopulateFactory::process( $calendar, $timezone );
Example 2
Using the shortcut The Vcalendar::vtimezonePopulate() method.use Kigkonsult\Icalcreator\Vcalendar; $calendar = new Vcalendar( [ Vcalendar::UNIQUE_ID => "kigkonsult.se" ] ); $timezone = 'Europe/Stockholm'; .. . // insert components or parse an iCal string .. . $calendar->VtimezonePopulate( $timezone );
Output example (when using Vcalendar createCalendar or returnCalendar methods):
BEGIN:VTIMEZONE TZID:Europe/Stockholm X-LIC-LOCATION:Europe/Stockholm BEGIN:STANDARD DTSTART:20111030T003000 TZOFFSETFROM:+0200 TZOFFSETTO:+0100 TZNAME:CET END:STANDARD BEGIN:DAYLIGHT DTSTART:20110327T002000 TZOFFSETFROM:+0100 TZOFFSETTO:+0200 TZNAME:CEST END:DAYLIGHT END:VTIMEZONE
The Vcalendar::parse or component::parse will throw exception when the input data contains PHP unknown timezones, ex MS listed at https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones.
To support other (MS) timezones mapping to PHP timezones (ie timezones with the same or nearby UTC offset), the RegulateTimezoneFactory::process method can be used before parse. The factory review the Vtimezone property TZID and component date properties DTSTART, DTEND, DUE, RECURRENCE-ID, EXDATE and RDATE and parameter "TZID".
The method throws Exception when unknown timezone not can be mapped.
Return rfc5545 formatted calendar string.
Format
RegulateTimezoneFactory::process( iCalData )
iCalData = string|array $iCal strict rfc5545 formatted calendar
use Kigkonsult\Icalcreator\Util\RegulateTimezoneFactory; $iCalStringToParse = RegulateTimezoneFactory::process( $iCalInput );
Any unknown timezone (ex MS "Customized Time Zone"), if used in VTIMEZONE, will map to a PHP timezone (using TZOFFZETTO values) with nearby offsets.
To specify a "direct" map for a PHP unknown timezone, use (in static style format)
RegulateTimezoneFactory::process( icalInput, [ *( <otherTimezone> => <phpTimezone> ) ] )
or (as object oriented style example)
use Kigkonsult\Icalcreator\Util\RegulateTimezoneFactory; $iCalStringToParse = RegulateTimezoneFactory::factory( $iCalInput ) ->addOtherTzPhpRelation( $otherTimezone, $phpTimezone ) ->processCalendar() ->getOutputiCal();
The IcalXMLFactory class methods converts iCal into XML and parses XML into iCal. XML is defined by [RFC6321], "xCal: The XML Format for iCalendar".
The (static) iCal2XML method converts an Vcalendar instance to XML.
The iCal2XML method uses the SimpleXML extension (and "libxml" PHP extension).
An rfc6321 XML string is returned.
Format
IcalXMLFactory::iCal2XML( iCalobj )
iCalobj = (object) Vcalendar instance
$xmlString = Kigkonsult\Icalcreator\Util\IcalXMLFactory::iCal2XML( $vcalendar );
The (static) method accepts a well-formed (rfc6321) XML string as argument.
On success, an Vcalendar instance is returned, on error false.
Format
IcalXMLFactory::XML2iCal( xmlstr [, config] )
xmlstr = (string) rfc6321 XML config = (array) iCalcreator config array (opt)
You can export iCal (XML) as json using a Vcalendar instance, IcalXMLFactory::iCal2XML() (above), simplexml_load_string and json_encode as follows:
$xml = Kigkonsult\Icalcreator\Util\IcalXMLFactory::iCal2XML( $vcalendar ); $json = json_encode( simplexml_load_string( $xml ));
The Kigkonsult\Icalcreator\Util\IcalvCardFactory class has two methods to produce vCard string output.
The (static) method converts a single email (iCal "cal-address") into (string) vCard.
Returns vCard string.
Format
IcalvCard::iCal2vCard( email [, version ] )
email = (string) email, ATTENDEE, ORGANIZER and opt CONTACT "cal-address" version = (string) vCard version, "2.1" (default), "3.0", "4.0"
The (static) method collects and converts all ATTENDEEs and ORGANIZERs
values (iCal "cal-address") and CONTACTs
into simplified vCard (string) output using
Format
IcalvCard::iCal2vCards( vcalendar [, version [, inclParams [, count ]]] )
vcalendar = (object) Vcalendar instance version = (string) vCard version, "2.1" (default), "3.0", "4.0" inclParams = (bool) default true: search property values and parameters, false: values only count = (int) number of vCards in output
Return vCard(s) string.
Copyright | (c) 2007-2021 Kjell-Inge Gustafsson, kigkonsult, All rights reserved |
Link | https://kigkonsult.se |
Package | iCalcreator |
Version | 2.39 |
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/>. |