Jump to main content
University Computer Centre
Embedding calendars
University Computer Centre 

Embedding calendars

Web authors can use PHP functions provided with TUCAL to easily include interactive calendar views in web pages. This requires JavaScript on the client side.

This functionality is specifically intended for publishing group calendars (configurable in the IdM portal) with the possible content gradations of Availability Only, Restricted Details, and Read Permissions.

To use it, the php/calendar.inc file must be included in the page header:

# Include calendar functions
require_once('php/calendar.inc');
  1. Functions
    1. calendar_init(string|array $url [, string $id, array $options])
    2. calendar_show([string $id])
  2. Examples

Functions

calendar_init(string|array $url [, string $id, array $options])

Initializes a calendar view. Must be called before seite(…) is called.

Parameters

$url
  • MS Exchange Secret calendar address (generated by IdM system) or
  • Field with multiple calendar addresses and associated options:
    array(array('source' => 'CAL1HASH', …), array('source' => 'CAL2HASH', …))
    (The possible options are marked with # in the explanation of $options.)
$id Unique identifier for the calendar initialization. Is needed for calendar_show(). Is only needed if more than one calendar is to be included on a page – or if options are set.
$options
Field with options that affect the display of the calendar:
header_left Displayed buttons and titles on the top left (left), center (center) and right (right). Possible values (separated by comma – without spacing – or space – with small spacing):
 'title' (calendar title – current month/day),
 'prev' (button to switch back to previous month/day),
 'next' (button to switch to next month/day),
 'prevYear' (button to switch back to previous year),
 'nextYear' (button to switch to next year),
 'today' (button to switch to view of current month/day) as well as
 the values for buttons to toggle the view specified in defaultView
Default: 'prev,next today' for header_left, 'title' for header_center and 'month,agendaWeek,agendaDay' for header_right
header_center
header_right
defaultDate Display date when calling the calendar (ISO-8601 date)
Default: 'Moment' (= now)
eventLimit show „more-#“ link if there are too many events
 False (no restriction) or
 True (constrain to default height of calendar cell) or
 [number] (limit to [number] events)
Default: True
defaultView Default calendar view. Possible values:
 'month' (display a whole month in table form with one week per row),
 'basicWeek' (display of a whole week in table form with the events in list form),
 'basicDay' (display of a single day with the appointments in list form),
 'agendaWeek' (display of an entire week in tabular form; multi-day/full-day appointments are displayed separately at the top),
 'agendaDay' (display of a single day in table form; full-day appointments are displayed separately on top)
 'listMonth' (display a compact list of all appointments of a month)
 'listWeek' (display a compact list of all appointments of a week)
 'listDay' (display a compact list of all appointments of a day)
Default: 'month'
slotDuration Length of a time slot (i. e. a table cell). Syntax: 'hh:mm:ss'
Default: '00:30:00' (30 min)
aspectRatio Desired aspect ratio width/height of the calendar view (decimal number with point instead of comma as separator).
Default: 1.35
minTime Start time of the calendar day view. Syntax: 'hh:mm:ss'
Default: automatic
color# (Background) color in which the calendar should be displayed (CSS color specification). If there are multiple calendars, all calendars will be displayed in this color (except if a separate color is specified for each calendar – see at $url).
Default: automatic
borderColor# Border color of the calendar entries (CSS color specification)
Default: automatic
textColor# Text color of the entries (CSS color specification)
Default: automatic
className# Specification of a CSS class name which will be set for entries of this calendar. This allows additional style definitions.
Default: not set

Return value

None.

calendar_show([string $id])

Called at the position where the calendar should be displayed.

Parameters

$id Identifier assigned during calendar initialization.

Return value

None.

Examples

calendar_init('7MNR3Z4RMXY0YB4QMBL1');    // Test calendar; restricted details
calendar_show();
Sorry. Server-side script temporarily not available.
Loading…