"philippfrenzel/yii2fullcalendar": "dev-master",
<?= yii2fullcalendar\yii2fullcalendar::widget([
'id'=>'calendar',ru
'clientOptions' => [
'language' => 'ru',
'eventLimit'=> true,
'fixedWeekCount'=>false,
'eventLimitClick'=>new \yii\web\JsExpression('function (cellInfo, jsEvent) {showEvents(cellInfo.date, cellInfo.segs);}')
],
'header' => [
'center'=>'',
'left'=>'title',
'right'=>'prev,next today'
],
'ajaxEvents' => Url::to(['/events/json', 'type'=>'all'])
]);
/events/jsonpublic function actionJson($start=NULL,$end=NULL,$_=NULL)
{
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
$times = Event::find()->where(['between', 'date', $start,$end])->all();
$events = array();
foreach ($times AS $time) {
$Event = new \yii2fullcalendar\models\Event();
$Event->id = $time->id;
$Event->title = $time->name;
$Event->allDay = true;
if($time->club_id) { // если от клубов, то класс один, иначе другой
$Event->className = 'event-club';
} else {
$Event->className = 'event-default';
}
$Event->start = date('Y-m-d',strtotime($time->date));
$Event->url = \yii\helpers\Url::to(['/events/view', 'id'=>$time->id]);
$events[] = $Event;
}
return $events;
}