<?php
$request = new \Scortes\Calendar\CalendarRequest();
$request->dateStart = new DateTime('now - 2 month');
$request->dateEnd = null; // use max date from events
$request->events = [
"now - 1 month" => 'Day in previous month',
date('Y-n-') . 1 => 'First day in month',
date('Y-n-') . 16 => '16th day in month',
"now + 1 month" => 'Day in next month',
];
$request->addEvent(new DateTime('now + 2 months'), 'now + 2 months');
$calendar = Scortes\Calendar\createCalendar($request);
\Scortes\Calendar\HTML\monthsToTables(
$calendar,
array(
'hideMonthsWithoutEvent' => true,
'selectors' => array(
'table' => ' class=calendar',
'month' => ' id=currentMonth',
'week' => ' id=currentWeek',
'day' => ' id=today',
),
'monthName' => function (Scortes\Calendar\Month\Month $month, $monthId) {
return "<h3{$monthId}>Month {$month->monthNumber}/{$month->year}</h3>";
},
'day' => array(
'withEvent' => function ($event, $currentDay) {
return "<strong title='{$event}'>{$currentDay}</strong>";
},
'withoutEvent' => function ($currentDay) {
return "<strong>{$currentDay}</strong>";
},
'empty' => '<td class="noDay"> </td>'
)
)
);
// Events in current month
\Scortes\Calendar\HTML\eventsToList(
$calendar,
"{$calendar->today->year}-{$calendar->today->monthNumber}",
function ($event, $key) {
return "{$key} - <strong>{$event}</strong>";
}
);
Calendar
Today
Basic calendar
Month 7/2015
| | 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 | | |
Month 8/2015
| | | | | 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 | | | | | | |
Month 9/2015
| 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 | | | | |
Month 10/2015
| | | 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 | |
Timeline of events
Input event dates
now - 1 month, 2015-8-1, 2015-8-16, now + 1 month, 2015-10-24T12:17:46+02:00
All events
- Day in previous month
- First day in month
- 16th day in month
- Day in next month
- now + 2 months
Events in current month
- 2015-8 - First day in month
- 2015-8 - 16th day in month
Calendar Components