PHP Класс ICal\ICal

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$cal array The parsed calendar
$defaultSpan integer The value in years to use for indefinite, recurring events
$defaultWeekStart
$eventCount integer How many events are in this iCal?
$freebusyCount integer How many freebusy are in this iCal?
$todoCount integer How many ToDos are in this iCal?

Защищенные свойства (Protected)

Свойство Тип Описание
$alteredRecurrenceInstances array Event recurrence instances that have been altered
$dayOrdinals
$frequencyConversion
$monthNames
$weekdays

Открытые методы

Метод Описание
__construct ( mixed $filename = false, mixed $weekStart = false ) : void Creates the iCal Object
calendarDescription ( ) : calendar Returns the calendar description
calendarName ( ) : string Returns the calendar name
calendarTimeZone ( ) : calendar Returns the calendar timezone
events ( ) : array Returns an array of EventObjects. Every event is a class with the event details being properties within it.
eventsFromInterval ( string $interval ) : array Returns a sorted array of the events following a given string, or false if no events exist in the range.
eventsFromRange ( string $rangeStart = false, string $rangeEnd = false ) : array Returns a sorted array of the events in a given range, or false if no events exist in the range.
freeBusyEvents ( ) : array Returns an array of arrays with all free/busy events. Every event is an associative array and each property is an element it.
hasEvents ( ) : boolean Returns a boolean value whether the current calendar has events or not
iCalDateToUnixTimestamp ( string $icalDate ) : integer Return Unix timestamp from iCal date time format
iCalDateWithTimeZone ( array $event, string $key ) : string Return a date adapted to the calendar timezone depending on the event TZID
initLines ( array $lines ) : ICal Initialises lines from file
initString ( string $contents ) : ICal Initialises lines from a string
initURL ( string $url ) : ICal Initialises lines from a URL
isValidTimeZoneId ( string $timezone ) : boolean Check if a timezone is valid
processDateConversions ( ) : void Processes date conversions using the timezone
processEvents ( ) : void Performs some admin tasks on all events as taken straight from the ics file.
processRecurrences ( ) : void Processes recurrence rules
sortEventsWithOrder ( array $events, integer $sortOrder = SORT_ASC ) : sorted Sort events based on a given sort order

Защищенные методы

Метод Описание
addCalendarComponentWithKeyAndValue ( string $component, string | boolean $keyword, string $value ) : void Add to $this->ical array one value and key.
keyValueFromString ( string $text ) : array Get a key-value pair of a string.

Описание методов

__construct() публичный Метод

Creates the iCal Object
public __construct ( mixed $filename = false, mixed $weekStart = false ) : void
$filename mixed The path to the iCal-file or an array of lines from an iCal file
$weekStart mixed The default first day of the week (SU or MO, etc.)
Результат void or false if no filename is provided

addCalendarComponentWithKeyAndValue() защищенный Метод

Add to $this->ical array one value and key.
protected addCalendarComponentWithKeyAndValue ( string $component, string | boolean $keyword, string $value ) : void
$component string This could be VTODO, VEVENT, VCALENDAR, ...
$keyword string | boolean The keyword, for example DTSTART
$value string The value, for example 20110105T090000Z
Результат void

calendarDescription() публичный Метод

Returns the calendar description
public calendarDescription ( ) : calendar
Результат calendar description

calendarName() публичный Метод

Returns the calendar name
public calendarName ( ) : string
Результат string

calendarTimeZone() публичный Метод

Returns the calendar timezone
public calendarTimeZone ( ) : calendar
Результат calendar timezone

events() публичный Метод

Returns an array of EventObjects. Every event is a class with the event details being properties within it.
public events ( ) : array
Результат array of EventObjects

eventsFromInterval() публичный Метод

Returns a sorted array of the events following a given string, or false if no events exist in the range.
public eventsFromInterval ( string $interval ) : array
$interval string
Результат array of EventObjects

eventsFromRange() публичный Метод

Events will be returned if the start or end date is contained within the range (inclusive), or if the event starts before and end after the range. If a start date is not specified or of a valid format, then the start of the range will default to the current time and date of the server. If an end date is not specified or of a valid format, the the end of the range will default to the current time and date of the server, plus 20 years. Note that this function makes use of UNIX timestamps. This might be a problem for events on, during, or after January the 29th, 2038. See http://en.wikipedia.org/wiki/Unix_time#Representing_the_number
public eventsFromRange ( string $rangeStart = false, string $rangeEnd = false ) : array
$rangeStart string Start date of the search range.
$rangeEnd string End date of the search range.
Результат array of EventObjects

freeBusyEvents() публичный Метод

Returns an array of arrays with all free/busy events. Every event is an associative array and each property is an element it.
public freeBusyEvents ( ) : array
Результат array

hasEvents() публичный Метод

Returns a boolean value whether the current calendar has events or not
public hasEvents ( ) : boolean
Результат boolean

iCalDateToUnixTimestamp() публичный Метод

Return Unix timestamp from iCal date time format
public iCalDateToUnixTimestamp ( string $icalDate ) : integer
$icalDate string A Date in the format YYYYMMDD[T]HHMMSS[Z] or YYYYMMDD[T]HHMMSS or TZID=Timezone:YYYYMMDD[T]HHMMSS
Результат integer

iCalDateWithTimeZone() публичный Метод

Return a date adapted to the calendar timezone depending on the event TZID
public iCalDateWithTimeZone ( array $event, string $key ) : string
$event array an event
$key string an event parameter (DTSTART or DTEND)
Результат string Ymd\THis date

initLines() публичный Метод

Initialises lines from file
public initLines ( array $lines ) : ICal
$lines array The lines to initialise
Результат ICal

initString() публичный Метод

Initialises lines from a string
public initString ( string $contents ) : ICal
$contents string The contents of the ical file to initialise
Результат ICal

initURL() публичный Метод

Initialises lines from a URL
public initURL ( string $url ) : ICal
$url string The url of the ical file to download and initialise
Результат ICal

isValidTimeZoneId() публичный Метод

Check if a timezone is valid
public isValidTimeZoneId ( string $timezone ) : boolean
$timezone string A timezone
Результат boolean

keyValueFromString() защищенный Метод

Get a key-value pair of a string.
protected keyValueFromString ( string $text ) : array
$text string which is like "VCALENDAR:Begin" or "LOCATION:"
Результат array

processDateConversions() публичный Метод

Add fields DTSTART_tz and DTEND_tz to each event These fields contain dates adapted to the calendar timezone depending on the event TZID
public processDateConversions ( ) : void
Результат void or false if no Events exist

processEvents() публичный Метод

Adds a unix timestamp to all DT{START|END|RECURRENCE-ID}_array arrays Makes a note of modified recurrence-instances
public processEvents ( ) : void
Результат void or false if no Events exist

processRecurrences() публичный Метод

Processes recurrence rules
public processRecurrences ( ) : void
Результат void or false if no Events exist

sortEventsWithOrder() публичный Метод

Sort events based on a given sort order
public sortEventsWithOrder ( array $events, integer $sortOrder = SORT_ASC ) : sorted
$events array An array of EventObjects
$sortOrder integer Either SORT_ASC, SORT_DESC, SORT_REGULAR, SORT_NUMERIC, SORT_STRING
Результат sorted array of EventObjects

Описание свойств

$alteredRecurrenceInstances защищенное свойство

Event recurrence instances that have been altered
protected array $alteredRecurrenceInstances
Результат array

$cal публичное свойство

The parsed calendar
public array $cal
Результат array

$dayOrdinals защищенное свойство

protected $dayOrdinals

$defaultSpan публичное свойство

The value in years to use for indefinite, recurring events
public int $defaultSpan
Результат integer

$defaultWeekStart публичное свойство

public $defaultWeekStart

$eventCount публичное свойство

How many events are in this iCal?
public int $eventCount
Результат integer

$freebusyCount публичное свойство

How many freebusy are in this iCal?
public int $freebusyCount
Результат integer

$frequencyConversion защищенное свойство

protected $frequencyConversion

$monthNames защищенное свойство

protected $monthNames

$todoCount публичное свойство

How many ToDos are in this iCal?
public int $todoCount
Результат integer

$weekdays защищенное свойство

protected $weekdays