Documentation

CRM_Utils_ICalendar
in package

Tags
file

API for event export in iCalendar format as outlined in Internet Calendaring and Scheduling Core Object Specification

Table of Contents

Methods

createCalendarFile()  : string
createCalendarFileForEvent()  : string
formatDate()  : string
Escape date elements for safe ICalendar use.
formatText()  : string
Escape text elements for safe ICalendar use.
generate_timezones()  : array<string|int, mixed>
send()  : mixed
Send the ICalendar to the browser with the specified content type - 'text/calendar' : used for iCal formatted feed - 'text/xml' : used for gData or rss formatted feeds
unformatText()  : string
Restore iCal formatted text to normal.
format_tz_offset()  : mixed

Methods

createCalendarFile()

public static createCalendarFile(array<string|int, mixed>|null $info) : string
Parameters
$info : array<string|int, mixed>|null

Information of the events to create an iCal file for, as returned by CRM_Event_BAO_Event::getCompleteInfo().

Return values
string

The rendered contents of the iCal file.

createCalendarFileForEvent()

public static createCalendarFileForEvent(int|null $event_id) : string
Parameters
$event_id : int|null

The CiviCRM Event ID of the event to render an iCal file for.

Return values
string

formatDate()

Escape date elements for safe ICalendar use.

public static formatDate(string $date[, bool $gdata = FALSE ]) : string
Parameters
$date : string

Date to escape.

$gdata : bool = FALSE
Return values
string

Escaped date

formatText()

Escape text elements for safe ICalendar use.

public static formatText(string $text[, bool $keep_html = FALSE ][, int $position = 0 ]) : string
Parameters
$text : string

Text to escape.

$keep_html : bool = FALSE

Flag to retain HTML formatting

$position : int = 0

Column number of the start of the string in the ICal output - used to determine allowable length of the first line

Return values
string

generate_timezones()

public static generate_timezones(array<string|int, mixed> $timezones, mixed $date_min, mixed $date_max) : array<string|int, mixed>
Parameters
$timezones : array<string|int, mixed>
  • Timezone strings
$date_min : mixed
$date_max : mixed
Return values
array<string|int, mixed>

send()

Send the ICalendar to the browser with the specified content type - 'text/calendar' : used for iCal formatted feed - 'text/xml' : used for gData or rss formatted feeds

public static send(string $calendar[, string $content_type = 'text/calendar' ][, string $charset = 'us-ascii' ][, string $fileName = NULL ][, string $disposition = NULL ]) : mixed
Parameters
$calendar : string

The calendar data to be published.

$content_type : string = 'text/calendar'
$charset : string = 'us-ascii'

The character set to use, defaults to 'us-ascii'.

$fileName : string = NULL

The file name (for downloads).

$disposition : string = NULL

How the file should be sent ('attachment' for downloads).

unformatText()

Restore iCal formatted text to normal.

public static unformatText(string $text) : string
Parameters
$text : string

Text to unescape.

Return values
string

format_tz_offset()

protected static format_tz_offset(mixed $offset) : mixed
Parameters
$offset : mixed

        
On this page

Search results