skeeks/yii2-widget-fullcalendar
最新稳定版本:1.0.1
Composer 安装命令:
composer require skeeks/yii2-widget-fullcalendar
包简介
Yii2 fullcalendar Widgets
README 文档
README
Installation
Package is although registered at packagist.org - so you can just add one line of code, to let it run!
add the following line to your composer.json require section:
"skeeks/yii2-widget-highcharts": "*",
And ensure, that you have the follwing plugin installed global:
php composer.phar global require "fxp/composer-asset-plugin:~1.0"
Changelog
Usage
Quickstart Looks like this:
$events = array();
//Testing
$Event = new \skeeks\widget\fullcalendar\models\Event();
$Event->id = 1;
$Event->title = 'Testing';
$Event->start = date('Y-m-d\TH:m:s\Z');
$events[] = $Event;
$Event = new \yii2fullcalendar\models\Event();
$Event->id = 2;
$Event->title = 'Testing';
$Event->start = date('Y-m-d\TH:m:s\Z',strtotime('tomorrow 6am'));
$events[] = $Event;
?>
<?= \skeeks\widget\fullcalendar\yii2fullcalendar::widget(array(
'events'=> $events,
));
Note, that this will only view the events without any detailed view or option to add a new event.. etc.
AJAX Usage
If you wanna use ajax loader, this could look like this:
<?= \skeeks\widget\fullcalendar\yii2fullcalendar::widget([
'options' => [
'language' => 'de',
//... more options to be defined here!
],
'ajaxEvents' => Url::to(['/timetrack/default/jsoncalendar'])
]);
?>
and inside your referenced controller, the action should look like this:
public function actionJsoncalendar($start=NULL,$end=NULL,$_=NULL){
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
$times = \app\modules\timetrack\models\Timetable::find()->where(array('category'=>\app\modules\timetrack\models\Timetable::CAT_TIMETRACK))->all();
$events = array();
foreach ($times AS $time){
//Testing
$Event = new \skeeks\widget\fullcalendar\models\Event();
$Event->id = $time->id;
$Event->title = $time->categoryAsString;
$Event->start = date('Y-m-d\TH:i:s\Z',strtotime($time->date_start.' '.$time->time_start));
$Event->end = date('Y-m-d\TH:i:s\Z',strtotime($time->date_end.' '.$time->time_end));
$events[] = $Event;
}
return $events;
}
Web development has never been so fun! www.skeeks.com
统计信息
- 总下载量: 20
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD
- 更新时间: 2015-04-02