dev-master
9999999-devMonthly Event Calendar
MIT
The Development Requires
by Zdenek Drahos
calendar events trie months
v1.0.0
1.0.0.0Monthly Event Calendar
MIT
The Development Requires
by Zdenek Drahos
calendar events trie months
Wallogit.com
2017 © Pedro Peláez
Monthly Event Calendar
composer require scortes/calendar
dateStart/dateEnd. Otherwise they are automatically calculated.\Scortes\Calendar\HTML\monthsToTables for classic calendar.// configure calendar
$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');
// build calendar
$calendar = Scortes\Calendar\createCalendar($request);
// display calendar
\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>'
)
)
);
Calendar consist of two independent components:, (*2)
$dateStart = new DateTime('now - 1 month');
$dateEnd = new DateTime('now + 2 months');
$months = \Scortes\Calendar\createMonthsInterval($dateStart, $dateEnd);
| Year | Month | Days Count | Weeks Count | First Day of Week | First Week Number |
|---|---|---|---|---|---|
| 2015 | 7 | 31 | 5 | 3 | 27 |
| 2015 | 8 | 31 | 6 | 6 | 31 |
| 2015 | 9 | 30 | 5 | 2 | 36 |
| 2015 | 10 | 31 | 5 | 4 | 40 |
$events = new \Scortes\Calendar\Events\Events(' ');
$events->set('John', 'John');
$events->set('John Doe', 'John Doe');
$events->set('John Black', 'John Black');
$events->set('John Black', 'Another John Black');
$events->set('Paul Carter', 'Paul Carter');
$events->get('John Doe'); // John Doe
$events->get('John Black'); // [John Black, Another John Black]
$events->iterate('John'); // [John, John Doe, [John Black, Another John Black]]
Contributions from others would be very much appreciated! Send pull request/issue. Thanks!, (*3)
Copyright (c) 2015 Scortes. MIT Licensed, see LICENSE for details., (*4)
Monthly Event Calendar
MIT
calendar events trie months
Monthly Event Calendar
MIT
calendar events trie months