Answer the question
In order to leave comments, you need to log in
How to make FullCalendar and Yii2 friends?
Has anyone used https://github.com/thiagotalma/yii2-talma-fullcale...
Made it fire events but can't seem to get it to react to clicks to fire events. I do it like this:
<?php
use \talma\widgets\FullCalendar;
?>
<?= FullCalendar::widget([
'loading' => 'Загрузка...',
'config' => [
'header' => [
'left' => 'prev,next today',
'center' => 'title',
'right' => 'month,basicWeek,basicDay'
],
'editable' => true,
'lang' => 'ru',
'events' => $events,
'dayClick' => '...' //Вот тут начинаются проблемы
]
]); ?>
Answer the question
In order to leave comments, you need to log in
"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'])
]);
public 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;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question