claudejanz / yii2-fullcalendar
an implementation of fullcalendar v3
Installs: 33
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- php: >=5.4.0
- bower-asset/fullcalendar: 3.*
- bower-asset/moment: >=2.9
- yiisoft/yii2: *
- yiisoft/yii2-jui: *
This package is auto-updated.
Last update: 2024-12-11 19:57:14 UTC
README
An implementation of fullcalendar v3. For more information read documentation.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist claudejanz/yii2-fullcalendar "*"
or add
"claudejanz/yii2-fullcalendar": "*"
to the require section of your composer.json
file.
Usage
Once the extension is installed, simply use it in your view by:
echo \claudejanz\yii2fullcalendar\Fullcalendar::widget([ 'clientOptions' => [ 'events' => \yii\helpers\Url::to(['site/events']), 'weekends' => false, 'defaultView' => 'agendaWeek', 'editable' => false, 'header' => [ 'left' => 'prev,next today ', 'right' => 'month,agendaWeek,agendaDay' ], ] ]);
And in your controller by:
public function actionEvents($start=NULL,$end=NULL,$timestamp=NULL){ \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; $format = \DateTime::ISO8601; $events = []; $date = new \DateTime('now'); $event = new \claudejanz\yii2fullcalendar\models\Event(); $event->title = "An event"; $event->start = $date->format($format); $date->add(new \DateInterval('PT1H')); $event->end = $date->format($format); $events[] = $event; return $events; }