Functions

Add a calendar event.

add_calendar_event(\AUTO_LINK $type, \SHORT_TEXT $recurrence, \?integer $recurrences, \BINARY $seg_recurrences, \SHORT_TEXT $title, \LONG_TEXT $content, integer $priority, integer $start_year, integer $start_month, integer $start_day, \ID_TEXT $start_monthly_spec_type, integer $start_hour, integer $start_minute, \?integer $end_year = null, \?integer $end_month = null, \?integer $end_day = null, \ID_TEXT $end_monthly_spec_type = 'day_of_month', \?integer $end_hour = null, \?integer $end_minute = null, \?ID_TEXT $timezone = null, \BINARY $do_timezone_conv = 1, \?MEMBER $member_calendar = null, \BINARY $validated = 1, \BINARY $allow_rating = 1, \SHORT_INTEGER $allow_comments = 1, \BINARY $allow_trackbacks = 1, \LONG_TEXT $notes = '', \?MEMBER $submitter = null, integer $views = 0, \?TIME $add_time = null, \?TIME $edit_time = null, \?AUTO_LINK $id = null, \?SHORT_TEXT $meta_keywords = '', \?LONG_TEXT $meta_description = '') : \AUTO_LINK
package calendar
range 1 5
set day_of_month day_of_month_backwards dow_of_month dow_of_month_backwards
set day_of_month day_of_month_backwards dow_of_month dow_of_month_backwards

Parameters

$type

\AUTO_LINK

The event type

$recurrence

\SHORT_TEXT

The recurrence code (set to 'none' for no recurrences: blank means infinite and will basically time-out Composr)

$recurrences

\?integer

The number of recurrences (null: none/infinite)

$seg_recurrences

\BINARY

Whether to segregate the comment-topics/rating/trackbacks per-recurrence

$title

\SHORT_TEXT

The title of the event

$content

\LONG_TEXT

The full text describing the event

$priority

integer

The priority

$start_year

integer

The year the event starts at

$start_month

integer

The month the event starts at

$start_day

integer

The day the event starts at

$start_monthly_spec_type

\ID_TEXT

In-month specification type for start date

$start_hour

integer

The hour the event starts at

$start_minute

integer

The minute the event starts at

$end_year

\?integer

The year the event ends at (null: not a multi day event)

$end_month

\?integer

The month the event ends at (null: not a multi day event)

$end_day

\?integer

The day the event ends at (null: not a multi day event)

$end_monthly_spec_type

\ID_TEXT

In-month specification type for end date

$end_hour

\?integer

The hour the event ends at (null: not a multi day event)

$end_minute

\?integer

The minute the event ends at (null: not a multi day event)

$timezone

\?ID_TEXT

The timezone for the event (null: current user's timezone)

$do_timezone_conv

\BINARY

Whether the time should be presented in the viewer's own timezone

$member_calendar

\?MEMBER

The member's calendar it will be on (null: not on a specific member's calendar)

$validated

\BINARY

Whether the event has been validated

$allow_rating

\BINARY

Whether the event may be rated

$allow_comments

\SHORT_INTEGER

Whether comments are allowed (0=no, 1=yes, 2=review style)

$allow_trackbacks

\BINARY

Whether the event may be trackbacked

$notes

\LONG_TEXT

Hidden notes pertaining to the event

$submitter

\?MEMBER

The event submitter (null: current member)

$views

integer

The number of views so far

$add_time

\?TIME

The add time (null: now)

$edit_time

\?TIME

The edit time (null: never)

$id

\?AUTO_LINK

Force an ID (null: don't force an ID)

$meta_keywords

\?SHORT_TEXT

Meta keywords for this resource (null: do not edit) (blank: implicit)

$meta_description

\?LONG_TEXT

Meta description for this resource (null: do not edit) (blank: implicit)

Returns

\AUTO_LINKThe ID of the event

Add a calendar event type.

add_event_type(\SHORT_TEXT $title, \ID_TEXT $logo, \URLPATH $external_feed = '') : \AUTO_LINK
package calendar

Parameters

$title

\SHORT_TEXT

The title of the event type

$logo

\ID_TEXT

The theme image code

$external_feed

\URLPATH

URL to external feed to associate with this event type

Returns

\AUTO_LINKThe ID of the event type

Adjust an event row to match a recurrence on a specific day.

adjust_event_dates_for_a_recurrence(string $day, array $event, string $timezone) : array
package calendar

Parameters

$day

string

A day (Y-m-d)

$event

array

The event row

$timezone

string

Timezone of the viewer

Returns

arrayAdjusted event row

Get the UTC end time for a specified UTC time event.

cal_get_end_utctime_for_event(\ID_TEXT $timezone, integer $year, integer $month, integer $day, \ID_TEXT $monthly_spec_type, \?integer $hour, \?integer $minute, boolean $show_in_users_timezone) : \TIME
package calendar
set day_of_month day_of_month_backwards dow_of_month dow_of_month_backwards

Parameters

$timezone

\ID_TEXT

Timezone

$year

integer

Year

$month

integer

Month

$day

integer

Day

$monthly_spec_type

\ID_TEXT

In-month specification type

$hour

\?integer

Hour (null: end hour of day in the timezone expressed as UTC, for whatever day the given midnight day/month/year shifts to after timezone conversion)

$minute

\?integer

Minute (null: end minute of day in the timezone expressed as UTC, for whatever day the given midnight day/month/year shifts to after timezone conversion)

$show_in_users_timezone

boolean

Whether the time should be converted to the viewer's own timezone instead.

Returns

\TIMETimestamp

Get the UTC start time for a specified UTC time event.

cal_get_start_utctime_for_event(\ID_TEXT $timezone, integer $year, integer $month, integer $day, \ID_TEXT $monthly_spec_type, \?integer $hour, \?integer $minute, boolean $show_in_users_timezone) : \TIME
package calendar
set day_of_month day_of_month_backwards dow_of_month dow_of_month_backwards

Parameters

$timezone

\ID_TEXT

The timezone it is in; used to derive $hour and $minute if those are NULL, such that they start the day correctly for this timezone

$year

integer

Year

$month

integer

Month

$day

integer

Day

$monthly_spec_type

\ID_TEXT

In-month specification type

$hour

\?integer

Hour (null: start hour of day in the timezone expressed as UTC, for whatever day the given midnight day/month/year shifts to after timezone conversion)

$minute

\?integer

Minute (null: start minute of day in the timezone expressed as UTC, for whatever day the given midnight day/month/year shifts to after timezone conversion)

$show_in_users_timezone

boolean

Whether the time will be converted to the $timezone instead of UTC later. If not then the "UTC time" returned is actually guaged for $timezone, as that's how it was opted to be displayed.

Returns

\TIMETimestamp

Put a timestamp into the correct timezone for being reported onto the calendar.

cal_utctime_to_usertime(\TIME $utc_timestamp, \ID_TEXT $default_timezone, boolean $show_in_users_timezone) : \TIME
package calendar

Parameters

$utc_timestamp

\TIME

Timestamp (proper UTC timestamp, not in user time)

$default_timezone

\ID_TEXT

The timezone associated with the event (the passed $utc_timestamp should NOT be relative to this timezone, that must be UTC) THIS PARAMETER IS NOT ACTUALLY USED.

$show_in_users_timezone

boolean

Whether the time should be converted to the viewer's own timezone instead

Returns

\TIMEAltered timestamp

Detect calendar matches in a time period, in user-time.

calendar_matches(\MEMBER $auth_member_id, \MEMBER $member_id, boolean $restrict, \?TIME $period_start, \?TIME $period_end, \?array $filter = null, boolean $do_rss = true, \?BINARY $private = null) : array
package calendar

Parameters

$auth_member_id

\MEMBER

The member we are running authentication against

$member_id

\MEMBER

The member to detect matches for

$restrict

boolean

Whether to restrict only to viewable events for the current member (rarely pass this as false!)

$period_start

\?TIME

The timestamp that found times must exceed. In user-time (null: use find_periods_recurrence default)

$period_end

\?TIME

The timestamp that found times must not exceed. In user-time (null: use find_periods_recurrence default)

$filter

\?array

The type filter (null: none)

$do_rss

boolean

Whether to include RSS/iCal events in the results

$private

\?BINARY

Whether to show private events (1) or public events (0) (null: both public and private)

Returns

arrayA list of events happening, with time details

Get a list of event types, taking security into account against the current member.

create_selection_list_event_types(\?AUTO_LINK $it = null, \?TIME $updated_since = null) : \Tempcode
package calendar

Parameters

$it

\?AUTO_LINK

The event type to select by default (null: none)

$updated_since

\?TIME

Time from which content must be updated (null: no limit).

Returns

\TempcodeThe list

Get a list of events to edit.

create_selection_list_events(\?MEMBER $only_owned, \?AUTO_LINK $it, boolean $edit_viewable_events = true) : \Tempcode
package calendar

Parameters

$only_owned

\?MEMBER

Only show events owned by this member (null: no such limitation)

$it

\?AUTO_LINK

Event to select by default (null: no specific default)

$edit_viewable_events

boolean

Whether owned public events should be shown

Returns

\TempcodeThe list

Converts year+week to year+month+day. This is really complex. The first week of a year may actually start in December. The first day of the first week is a Monday or a Sunday, depending on configuration.

date_from_week_of_year(integer $year, integer $week) : array
package calendar

Parameters

$year

integer

Year #

$week

integer

Week #

Returns

arrayMonth #,Day #,Year #

Create a neatly human-readable date range, using various user-friendly readability tricks.

date_range(\TIME $from, \?TIME $to, boolean $do_time = true, boolean $force_absolute = false, string $timezone = '') : string
package calendar

Parameters

$from

\TIME

From time in user time

$to

\?TIME

To time in user time (null: no actual to time)

$do_time

boolean

Whether time is included in this date range

$force_absolute

boolean

Whether to force absolute display

$timezone

string

Display timezone

Returns

stringTextual specially-formatted range

Delete a calendar event.

delete_calendar_event(\AUTO_LINK $id) 
package calendar

Parameters

$id

\AUTO_LINK

The ID of the event

Delete a calendar event type.

delete_event_type(\AUTO_LINK $id) 
package calendar

Parameters

$id

\AUTO_LINK

The ID of the event type

Detect conflicts with an event at a certain time.

detect_conflicts(\MEMBER $member_id, \?AUTO_LINK $skip_id, \?integer $start_year, \?integer $start_month, \?integer $start_day, \ID_TEXT $start_monthly_spec_type, \?integer $start_hour, \?integer $start_minute, \?integer $end_year, \?integer $end_month, \?integer $end_day, \ID_TEXT $end_monthly_spec_type, \?integer $end_hour, \?integer $end_minute, string $recurrence, \?integer $recurrences, \AUTO_LINK $type, \?MEMBER $member_calendar, integer $scope_type) : \?Tempcode

NB: Only detects future conflicts, not conflicts on past scheduling.

package calendar
set day_of_month day_of_month_backwards dow_of_month dow_of_month_backwards
set day_of_month day_of_month_backwards dow_of_month dow_of_month_backwards

Parameters

$member_id

\MEMBER

The member to detect conflicts for

$skip_id

\?AUTO_LINK

The event ID that we are detecting conflicts with (we need this so we don't think we conflict with ourself) (null: not added yet)

$start_year

\?integer

The year the event starts at. This and the below are in server time (null: default)

$start_month

\?integer

The month the event starts at (null: default)

$start_day

\?integer

The day the event starts at (null: default)

$start_monthly_spec_type

\ID_TEXT

In-month specification type for start date

$start_hour

\?integer

The hour the event starts at (null: default)

$start_minute

\?integer

The minute the event starts at (null: default)

$end_year

\?integer

The year the event ends at (null: not a multi day event)

$end_month

\?integer

The month the event ends at (null: not a multi day event)

$end_day

\?integer

The day the event ends at (null: not a multi day event)

$end_monthly_spec_type

\ID_TEXT

In-month specification type for end date

$end_hour

\?integer

The hour the event ends at (null: not a multi day event)

$end_minute

\?integer

The minute the event ends at (null: not a multi day event)

$recurrence

string

The event recurrence

$recurrences

\?integer

The number of recurrences (null: none/infinite)

$type

\AUTO_LINK

The event type

$member_calendar

\?MEMBER

The member calendar (null: none)

$scope_type

integer

The scope type, DETECT_CONFLICTSCOPE*

Returns

\?TempcodeInformation about conflicts (null: none)

Detect conflicts with an event in certain time periods.

detect_happening_at(\MEMBER $member_id, \?AUTO_LINK $skip_id, array $our_times, boolean $restrict = true, \?TIME $period_start = null, \?TIME $period_end = null) : array
package calendar

Parameters

$member_id

\MEMBER

The member to detect conflicts for

$skip_id

\?AUTO_LINK

The event ID that we are detecting conflicts with (we need this so we don't think we conflict with ourself) (null: not added yet)

$our_times

array

List of pairs specifying our happening time (in time order)

$restrict

boolean

Whether to restrict only to viewable events for the current member

$period_start

\?TIME

The timestamp that found times must exceed. In user-time (null: use find_periods_recurrence default)

$period_end

\?TIME

The timestamp that found times must not exceed. In user-time (null: use find_periods_recurrence default)

Returns

arrayA list of events happening, with time details

An event moved from 'a' to 'b' may have an hour/minute shift due to a DST.

dst_boundary_difference_for_recurrence(integer $a_year, integer $a_month, integer $a_day, integer $b_year, integer $b_month, integer $b_day, \ID_TEXT $timezone) : array
package calendar

Parameters

$a_year

integer

'A' year

$a_month

integer

'A' month

$a_day

integer

'A' day

$b_year

integer

'B' year

$b_month

integer

'B' month

$b_day

integer

'B' day

$timezone

\ID_TEXT

The timezone

Returns

arrayA pair: shift in hours, shift in minutes

Edit a calendar event.

edit_calendar_event(\AUTO_LINK $id, \?AUTO_LINK $type, \SHORT_TEXT $recurrence, \?integer $recurrences, \BINARY $seg_recurrences, \SHORT_TEXT $title, \LONG_TEXT $content, integer $priority, integer $start_year, integer $start_month, integer $start_day, \ID_TEXT $start_monthly_spec_type, integer $start_hour, integer $start_minute, \?integer $end_year, \?integer $end_month, \?integer $end_day, \ID_TEXT $end_monthly_spec_type, \?integer $end_hour, \?integer $end_minute, \?ID_TEXT $timezone, \BINARY $do_timezone_conv, \?MEMBER $member_calendar, \SHORT_TEXT $meta_keywords, \LONG_TEXT $meta_description, \?BINARY $validated, \BINARY $allow_rating, \SHORT_INTEGER $allow_comments, \BINARY $allow_trackbacks, \LONG_TEXT $notes, \?TIME $edit_time = null, \?TIME $add_time = null, \?integer $views = null, \?MEMBER $submitter = null, boolean $null_is_literal = false
package calendar
range 1 5
set day_of_month day_of_month_backwards dow_of_month dow_of_month_backwards
set day_of_month day_of_month_backwards dow_of_month dow_of_month_backwards

Parameters

$id

\AUTO_LINK

The ID of the event

$type

\?AUTO_LINK

The event type (null: default)

$recurrence

\SHORT_TEXT

The recurrence code

$recurrences

\?integer

The number of recurrences (null: none/infinite)

$seg_recurrences

\BINARY

Whether to segregate the comment-topics/rating/trackbacks per-recurrence

$title

\SHORT_TEXT

The title of the event

$content

\LONG_TEXT

The full text describing the event

$priority

integer

The priority

$start_year

integer

The year the event starts at

$start_month

integer

The month the event starts at

$start_day

integer

The day the event starts at

$start_monthly_spec_type

\ID_TEXT

In-month specification type for start date

$start_hour

integer

The hour the event starts at

$start_minute

integer

The minute the event starts at

$end_year

\?integer

The year the event ends at (null: not a multi day event)

$end_month

\?integer

The month the event ends at (null: not a multi day event)

$end_day

\?integer

The day the event ends at (null: not a multi day event)

$end_monthly_spec_type

\ID_TEXT

In-month specification type for end date

$end_hour

\?integer

The hour the event ends at (null: not a multi day event)

$end_minute

\?integer

The minute the event ends at (null: not a multi day event)

$timezone

\?ID_TEXT

The timezone for the event (null: current user's timezone)

$do_timezone_conv

\BINARY

Whether the time should be presented in the viewer's own timezone

$member_calendar

\?MEMBER

The member's calendar it will be on (null: not on a specific member's calendar)

$meta_keywords

\SHORT_TEXT

Meta keywords

$meta_description

\LONG_TEXT

Meta description

$validated

\?BINARY

Whether the event has been validated (null: don't change)

$allow_rating

\BINARY

Whether the event may be rated

$allow_comments

\SHORT_INTEGER

Whether comments are allowed (0=no, 1=yes, 2=review style)

$allow_trackbacks

\BINARY

Whether the event may be trackbacked

$notes

\LONG_TEXT

Hidden notes pertaining to the event

$edit_time

\?TIME

Edit time (null: either means current time, or if $null_is_literal, means reset to to NULL)

$add_time

\?TIME

Add time (null: do not change)

$views

\?integer

Number of views (null: do not change)

$submitter

\?MEMBER

Submitter (null: do not change)

$null_is_literal

boolean

Determines whether some NULLs passed mean 'use a default' or literally mean 'set to NULL'

Edit a calendar event type.

edit_event_type(\AUTO_LINK $id, \SHORT_TEXT $title, \ID_TEXT $logo, \URLPATH $external_feed) 
package calendar

Parameters

$id

\AUTO_LINK

The ID of the event type

$title

\SHORT_TEXT

The title of the event type

$logo

\ID_TEXT

The theme image code

$external_feed

\URLPATH

URL to external feed to associate with this event type

Find the concrete end day of a month for an event row.

end_find_concrete_day_of_month_wrap(array $event) : integer
package calendar

Parameters

$event

array

Event row

Returns

integerConcrete day

Given a calendar day of month, work out the day of the month within the specified encoding.

find_abstract_day(integer $year, integer $month, integer $day_of_month, \ID_TEXT $monthly_spec_type) : integer
package calendar
set day_of_month day_of_month_backwards dow_of_month dow_of_month_backwards

Parameters

$year

integer

The concrete year

$month

integer

The concrete month

$day_of_month

integer

The concrete day of month

$monthly_spec_type

\ID_TEXT

In-month specification type

Returns

integerConcrete day

Given a specially encoded day of month, work out the real day of the month.

find_concrete_day_of_month(integer $year, integer $month, integer $day, \ID_TEXT $monthly_spec_type, integer $hour, integer $minute, \ID_TEXT $timezone, boolean $show_in_users_timezone) : integer
package calendar
set day_of_month day_of_month_backwards dow_of_month dow_of_month_backwards

Parameters

$year

integer

The concrete year

$month

integer

The concrete month

$day

integer

The encoded day of month

$monthly_spec_type

\ID_TEXT

In-month specification type

$hour

integer

The concrete hour

$minute

integer

The concrete minute

$timezone

\ID_TEXT

The timezone

$show_in_users_timezone

boolean

Whether to do a timezone conversion (NB: unused, as this is before conversion to what dates users see - we are only using timezones here to push the nth weekday appropriately to the correct timezone, due to alignment problems)

Returns

integerConcrete day

Find the timestamp of an event's end.

find_event_end_timestamp(array $event) : array
package calendar

Parameters

$event

array

Event row

Returns

arrayA pair: timestamp, timestamp considering the viewing users timezone

Find the timestamp of an event's start.

find_event_start_timestamp(array $event) : array
package calendar

Parameters

$event

array

Event row

Returns

arrayA pair: timestamp, timestamp considering the viewing users timezone

Find a list of pairs specifying the times the event occurs, for 20 years into the future, in user-time.

find_periods_recurrence(\ID_TEXT $timezone, \BINARY $do_timezone_conv, integer $start_year, integer $start_month, integer $start_day, \ID_TEXT $start_monthly_spec_type, \?integer $start_hour, \?integer $start_minute, \?integer $end_year, \?integer $end_month, \?integer $end_day, \ID_TEXT $end_monthly_spec_type, \?integer $end_hour, \?integer $end_minute, string $recurrence, \?integer $recurrences, \?TIME $period_start = null, \?TIME $period_end = null) : array
package calendar
set day_of_month day_of_month_backwards dow_of_month dow_of_month_backwards
set day_of_month day_of_month_backwards dow_of_month dow_of_month_backwards

Parameters

$timezone

\ID_TEXT

The timezone for the event (null: current user's timezone)

$do_timezone_conv

\BINARY

Whether the time should be converted to the viewer's own timezone

$start_year

integer

The year the event starts at. This and the below are in server time

$start_month

integer

The month the event starts at

$start_day

integer

The day the event starts at

$start_monthly_spec_type

\ID_TEXT

In-month specification type for start date

$start_hour

\?integer

The hour the event starts at (null: full day event)

$start_minute

\?integer

The minute the event starts at (null: full day event)

$end_year

\?integer

The year the event ends at (null: not a multi day event)

$end_month

\?integer

The month the event ends at (null: not a multi day event)

$end_day

\?integer

The day the event ends at (null: not a multi day event)

$end_monthly_spec_type

\ID_TEXT

In-month specification type for end date

$end_hour

\?integer

The hour the event ends at (null: not a multi day event / all day event)

$end_minute

\?integer

The minute the event ends at (null: not a multi day event / all day event)

$recurrence

string

The event recurrence

$recurrences

\?integer

The number of recurrences (null: none/infinite)

$period_start

\?TIME

The timestamp that found times must exceed. In user-time (null: now)

$period_end

\?TIME

The timestamp that found times must not exceed. In user-time (null: 20 years time)

Returns

arrayA list of pairs for period times (timestamps, in user-time). Actually a series of pairs, 'window-bound timestamps' is first pair, then 'true coverage timestamps', then 'true coverage timestamps without timezone conversions'

Find last hour in day for a timezone.

find_timezone_end_hour_in_utc(\ID_TEXT $timezone, integer $year, integer $month, integer $day, \ID_TEXT $monthly_spec_type) : integer
package calendar
set day_of_month day_of_month_backwards dow_of_month dow_of_month_backwards

Parameters

$timezone

\ID_TEXT

Timezone

$year

integer

Year

$month

integer

Month

$day

integer

Day

$monthly_spec_type

\ID_TEXT

In-month specification type

Returns

integerHour

Find last minute in day for a timezone. Usually 59, but some timezones have 30 min offsets.

find_timezone_end_minute_in_utc(\ID_TEXT $timezone, integer $year, integer $month, integer $day, \ID_TEXT $monthly_spec_type) : integer
package calendar
set day_of_month day_of_month_backwards dow_of_month dow_of_month_backwards

Parameters

$timezone

\ID_TEXT

Timezone

$year

integer

Year

$month

integer

Month

$day

integer

Day

$monthly_spec_type

\ID_TEXT

In-month specification type

Returns

integerHour

Find first hour in day for a timezone.

find_timezone_start_hour_in_utc(\ID_TEXT $timezone, integer $year, integer $month, integer $day, \ID_TEXT $monthly_spec_type) : integer
package calendar
set day_of_month day_of_month_backwards dow_of_month dow_of_month_backwards

Parameters

$timezone

\ID_TEXT

Timezone

$year

integer

Year

$month

integer

Month

$day

integer

Day

$monthly_spec_type

\ID_TEXT

In-month specification type

Returns

integerHour

Find first minute in day for a timezone. Usually 0, but some timezones have 30 min offsets.

find_timezone_start_minute_in_utc(\ID_TEXT $timezone, integer $year, integer $month, integer $day, \ID_TEXT $monthly_spec_type) : integer
package calendar
set day_of_month day_of_month_backwards dow_of_month dow_of_month_backwards

Parameters

$timezone

\ID_TEXT

Timezone

$year

integer

Year

$month

integer

Month

$day

integer

Day

$monthly_spec_type

\ID_TEXT

In-month specification type

Returns

integerHour

Find details of when an event happens. Preferably the next recurrence, but if it is in the past, the first.

get_calendar_event_first_date(\ID_TEXT $timezone, \BINARY $do_timezone_conv, integer $start_year, integer $start_month, integer $start_day, \ID_TEXT $start_monthly_spec_type, integer $start_hour, integer $start_minute, \?integer $end_year, \?integer $end_month, \?integer $end_day, \ID_TEXT $end_monthly_spec_type, \?integer $end_hour, \?integer $end_minute, string $recurrence, \?integer $recurrences, boolean $force_first = false) : array
package calendar
set day_of_month day_of_month_backwards dow_of_month dow_of_month_backwards
set day_of_month day_of_month_backwards dow_of_month dow_of_month_backwards

Parameters

$timezone

\ID_TEXT

The timezone for the event (null: current user's timezone)

$do_timezone_conv

\BINARY

Whether the time should be converted to the viewer's own timezone

$start_year

integer

The year the event starts at. This and the below are in server time

$start_month

integer

The month the event starts at

$start_day

integer

The day the event starts at

$start_monthly_spec_type

\ID_TEXT

In-month specification type for start date

$start_hour

integer

The hour the event starts at

$start_minute

integer

The minute the event starts at

$end_year

\?integer

The year the event ends at (null: not a multi day event)

$end_month

\?integer

The month the event ends at (null: not a multi day event)

$end_day

\?integer

The day the event ends at (null: not a multi day event)

$end_monthly_spec_type

\ID_TEXT

In-month specification type for end date

$end_hour

\?integer

The hour the event ends at (null: not a multi day event / all day event)

$end_minute

\?integer

The minute the event ends at (null: not a multi day event / all day event)

$recurrence

string

The event recurrence

$recurrences

\?integer

The number of recurrences (null: none/infinite)

$force_first

boolean

Whether to forcibly get the first recurrence, not a future one

Returns

arrayA tuple: Written date [range], from timestamp, to timestamp

Get the number of days between two dates (so first+dif=second).

get_days_between(integer $initial_start_month, integer $initial_start_day, integer $initial_start_year, integer $initial_end_month, integer $initial_end_day, integer $initial_end_year) : integer
package calendar

Parameters

$initial_start_month

integer

Start month

$initial_start_day

integer

Start day

$initial_start_year

integer

Start year

$initial_end_month

integer

End month

$initial_end_day

integer

End day

$initial_end_year

integer

End year

Returns

integerThe number of days

Get array of an events from node of an imported ical file

get_event_data_ical(array $calendar_nodes) : array
package calendar

Parameters

$calendar_nodes

array

Array of given event details

Returns

arrayReturns array of event details for mapping

Get the week number for a time.

get_week_number_for(\TIME $timestamp, boolean $no_year = false) : string
package calendar

Parameters

$timestamp

\TIME

The week timestamp

$no_year

boolean

Whether to do it contextually to the year, rather than including the year

Returns

stringThe week number

Escapes a string as per the ical format.

ical_escape(string $in) : string
package calendar

Parameters

$in

string

Input

Returns

stringOutput

Import ical events to members's event calendar.

ical_import(\PATH $file_name) 
package calendar

Parameters

$file_name

\PATH

File path

Standard code module init function.

init__calendar() 
package calendar

Choose how a recurring monthly event should be encoded.

monthly_spec_type_chooser(integer $day_of_month, integer $month, integer $year, \ID_TEXT $default_monthly_spec_type = 'day_of_month') : \Tempcode

This function is timezone-agnostic.

package calendar
set day_of_month day_of_month_backwards dow_of_month dow_of_month_backwards

Parameters

$day_of_month

integer

The concrete day

$month

integer

The concrete month

$year

integer

The concrete year

$default_monthly_spec_type

\ID_TEXT

Current in-month specification type

Returns

\TempcodeChooser

Outputs the logged-in member's calendar view to ical.

output_ical() 
package calendar

Regenerate all the calendar jobs for reminders for next occurance of an event (because the event was added or edited).

regenerate_event_reminder_jobs(\AUTO_LINK $id, boolean $force = false
package calendar

Parameters

$id

\AUTO_LINK

The ID of the event

$force

boolean

Force evaluation even if it's in the past. Only valid for code events

Get Tempcode for a calendar type 'feature box' for the given row

render_calendar_type_box(array $row, \ID_TEXT $zone = '_SEARCH', boolean $give_context = true, \ID_TEXT $guid = '') : \Tempcode
package calendar

Parameters

$row

array

The database field row of it

$zone

\ID_TEXT

The zone to use

$give_context

boolean

Whether to include context (i.e. say WHAT this is, not just show the actual content)

$guid

\ID_TEXT

Overridden GUID to send to templates (blank: none)

Returns

\TempcodeA box for it, linking to the full page

Render an event box.

render_event_box(array $row, \ID_TEXT $zone = '_SEARCH', boolean $give_context = true, \ID_TEXT $guid = '') : \Tempcode
package calendar

Parameters

$row

array

Event row

$zone

\ID_TEXT

Zone to link through to

$give_context

boolean

Whether to include context (i.e. say WHAT this is, not just show the actual content)

$guid

\ID_TEXT

Overridden GUID to send to templates (blank: none)

Returns

\TempcodeThe event box

An event may have a complex end date (e.g. 4th Friday).

resolve_complex_event_end_date(array $event) : array

We want to fix it to a calendar day for the recurrence (which we assume is already fixed into the event row). We also want to define it (trick it) to be stated in the same month of the start date, even if that means the days will exceed the number of days in a month. This will allow us to do shifts around in calendar-space.

package calendar

Parameters

$event

array

Event row

Returns

arrayEvent row

Find the concrete start day of a month for an event row.

start_find_concrete_day_of_month_wrap(array $event) : integer
package calendar

Parameters

$event

array

Event row

Returns

integerConcrete day

Constants

 

DETECT_CONFLICT_SCOPE_ALL

DETECT_CONFLICT_SCOPE_ALL = 3 
package calendar
 

DETECT_CONFLICT_SCOPE_NONE

DETECT_CONFLICT_SCOPE_NONE = 0 
package calendar
 

DETECT_CONFLICT_SCOPE_SAME_MEMBER

DETECT_CONFLICT_SCOPE_SAME_MEMBER = 1 
package calendar
 

DETECT_CONFLICT_SCOPE_SAME_MEMBER_OR_SAME_TYPE

DETECT_CONFLICT_SCOPE_SAME_MEMBER_OR_SAME_TYPE = 2 
package calendar
 

DETECT_CONFLICT_SCOPE_SAME_MEMBER_OR_SAME_TYPE_IF_GLOBAL

DETECT_CONFLICT_SCOPE_SAME_MEMBER_OR_SAME_TYPE_IF_GLOBAL = 2 
package calendar