This is documentation for Kohana v2.3.x.

Table of Contents
StatusFirst Draft
TodoExpand on Start-of-week-day, add all methods

Calendar Library

Overview

Provides methods for generating and working with a calendar. The library outputs a calendar month in HTML, for use in the system view system/views/kohana_calendar.php

Loading the calendar library

The Calendar class is loaded into your controller using:

$this->calendar = new Calendar();

Access to the library is available through $this→calendar

The parameters of this constructor are:

Example

$cal = new Calendar(1,2008); // January, 2008. The default is current month and year
echo $cal->render(); // the view is automatically rendered from the library

Produces an HTML calendar

January 2008
Sun Mon Tue Wed Thu Fri Sat
28 29 1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31 1 2

Adjusting the calendar

The layout of the calendar can be adjusted by creating the following file: application/views/kohana_calendar.php The native Kohana calendar file can be copied from system/views/kohana_calendar.php to have template to start working from.

Adding events to calendar

Kohana Calendar allow us to add events.

Example

$calendar = new Calendar();
$calendar -> attach($calendar -> event() -> condition('year', '2008') -> condition('month', '5') -> condition('day', '23')  -> output(html::anchor('http://kohanaphp.com', 'Click here!')));
$calendar -> render();

Condition syntax

function condition($key, $value)

List of conditions