adlurfm / yii2-fullcalendar-2
Yii2 中的 FullCalendar.io 组件
dev-main
2023-01-20 08:00 UTC
Requires
- yiisoft/yii2: ~2.0.0
This package is auto-updated.
Last update: 2024-09-20 11:41:50 UTC
README
FullCalendar.io 组件用于 Yii2
安装
$ php composer.phar require adlurfm/yii2-fullcalendar-2
或者添加
"adlurfm/yii2-fullcalendar-2": "dev-main"
到你的 composer.json
文件的 require
部分。
使用
//View File <?= FullCalendar::widget([ 'id' => 'calendar', 'clientOptions' => [ 'initialDate' => date('Y-m-d'), 'timeZone'=>'Asia/Kuala_lumpur', 'weekNumbers' => true, 'selectable' => true, 'initialView' => 'timeGridWeek', 'events' =>Url::to(['site/events']), 'eventTimeFormat'=> [ // like '14:30' 'hour'=>'2-digit', 'minute'=>'2-digit', 'meridiem' => false, 'hour12'=> false ] ], ]); ?>
//Controller File - Return as JSON format public function actionEvents($start, $end) { \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; return [ [ 'title'=>'All Day Event', 'start'=>'2023-01-01' ], [ 'title'=>'Long Event', 'start'=>'2023-01-04', 'end'=>'2023-01-11' ], ]; //Read more about event at https://fullcalendar.io/docs/event-parsing }
更多信息请参阅 - fullcalendar.io