yii2fullcalendar
JQuery Fullcalendar Yii2 Extension JQuery from: http://arshaw.com/fullcalendar/ Version 4.0.2 License MIT
JQuery Documentation: http://arshaw.com/fullcalendar/docs/ Yii2 Extension by philipp@frenzel.net
A tiny sample can be found here: http://yii2fullcalendar.beeye.org
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:
"philippfrenzel/yii2fullcalendar":"*",
or run:
$ php composer.phar require philippfrenzel/yii2fullcalendar "*"
And ensure, that you have the following plugin installed global:
php composer.phar global require "fxp/composer-asset-plugin:~1.0"
Changelog
17-04-2019 Updated to latest 4.0.2 Stable Version of the library 19-01-2017 Updated to include non-standard fields 29-11-2014 Updated to latest 2.2.3 Version of the library
Usage
Quickstart Looks like this:
$events = array(); //Testing $Event = new yii2fullcalendarmodelsEvent(); $Event->id = 1; $Event->title = 'Testing'; $Event->start = date('Y-m-dTH:i:sZ'); $Event->nonstandard = [ 'field1' => 'Something I want to be included in object #1', 'field2' => 'Something I want to be included in object #2', ]; $events[] = $Event; $Event = new yii2fullcalendarmodelsEvent(); $Event->id = 2; $Event->title = 'Testing'; $Event->start = date('Y-m-dTH:i:sZ',strtotime('tomorrow 6am')); $events[] = $Event; ?> <?= yii2fullcalendaryii2fullcalendar::widget(array( 'events'=> $events, ));
Note, that this will only view the events without any detailed view or option to add a new event.. etc.
Non-Standard fields
You can add non-standard fields via the non-standard fields array, for which you can pass any key/value pair, as described in the Event Fields documentation.
So, using the Quick Start example above, you can read field1
and fields2
in your JavaScript using notation similar to event.nonstandard.field1
and event.nonstandard.field2
.
AJAX Usage
If you wanna use ajax loader, this could look like this:
20171023 ajaxEvents are replaced by events - pls. check fullcalendar io documentation for details
<?= yii2fullcalendaryii2fullcalendar::widget([ 'options' => [ 'lang' => 'de', //... more options to be defined here! ], 'events' => 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 = yiiwebResponse::FORMAT_JSON; $times = appmodulestimetrackmodelsTimetable::find()->where(array('category'=>appmodulestimetrackmodelsTimetable::CAT_TIMETRACK))->all(); $events = array(); foreach ($times AS $time){ //Testing $Event = new yii2fullcalendarmodelsEvent(); $Event->id = $time->id; $Event->title = $time->categoryAsString; $Event->start = date('Y-m-dTH:i:sZ',strtotime($time->date_start.' '.$time->time_start)); $Event->end = date('Y-m-dTH:i:sZ',strtotime($time->date_end.' '.$time->time_end)); $events[] = $Event; } return $events; }
版权声明:
1、该文章(资料)来源于互联网公开信息,我方只是对该内容做点评,所分享的下载地址为原作者公开地址。2、网站不提供资料下载,如需下载请到原作者页面进行下载。
3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考学习用!
4、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。