This is documentation for Kohana v2.3.x.
Status | First Draft |
---|---|
Todo | Expand on Start-of-week-day, add all methods |
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
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:
$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
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 |
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.
Kohana Calendar allow us to add events.
$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();
function condition($key, $value)