дмитриймоматот / laravel-calendar
此包已被 放弃 并不再维护。未建议替代包。
关于此包最新版本(v1.0.5)的许可证信息不可用。
Flexible Calendar for Laravel 4
v1.0.5
2014-09-21 09:44 UTC
Requires
- php: >=5.3.0
- illuminate/support: ~4
README
Laravel 4 的灵活日历,支持月视图、周视图和日视图,以及每个日期的多项事件。
要动态更改视图类型,请传递一个名为 'cv'(日历视图)的GET变量,其值为 'week' 或 'day'。日和周视图被分割成30分钟的行。
安装
在 composer.json 的 "require" 部分添加此内容
"dmitrymomot/laravel-calendar": "dev-master"
之后运行 composer update,然后在 app.php 中添加
'providers' => array(
...,
'Makzumi\Calendar\CalendarServiceProvider',
),
使用时,创建一个新的 Calendar 实例并生成它,以下是一些自定义选项
$events = array(
"2014-04-09 10:30:00" => array(
"Event 1",
"Event 2 <strong> with html</stong>",
),
"2014-04-12 14:12:23" => array(
"Event 3",
),
"2014-05-14 08:00:00" => array(
"Event 4",
"class" => "eg-important-date-class"
),
);
$cal = Calendar::make();
/**** OPTIONAL METHODS ****/
$cal->setDate(Input::get('cdate')); //Set starting date
$cal->setBasePath('/dashboard'); // Base path for navigation URLs
$cal->showNav(true); // Show or hide navigation
$cal->setView(Input::get('cv')); //'day' or 'week' or null
$cal->setStartEndHours(8,20); // Set the hour range for day and week view
$cal->setTimeClass('ctime'); //Class Name for times column on day and week views
$cal->setEventsWrap(array('<p>', '</p>')); // Set the event's content wrapper
$cal->setDayWrap(array('<div>','</div>')); //Set the day's number wrapper
$cal->setNextIcon('>>'); //Can also be html: <i class='fa fa-chevron-right'></i>
$cal->setPrevIcon('<<'); // Same as above
$cal->setDayLabels(array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat')); //Label names for week days
$cal->setStartWeekDay('sunday'); // Full, lowercase (strtotime compatible)
$cal->setMonthLabels(array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December')); //Month names
$cal->setDateWrap(array('<div>','</div>')); //Set cell inner content wrapper
$cal->setTableClass('table'); //Set the table's class name
$cal->setHeadClass('table-header'); //Set top header's class name
$cal->setNextClass('btn'); // Set next btn class name
$cal->setPrevClass('btn'); // Set Prev btn class name
$cal->setEvents($events); // Receives the events array
/**** END OPTIONAL METHODS ****/
echo $cal->generate() // Return the calendar's html;