Hi all!
i find an anomaly in week view for yii2fullcalendar extension
in my month view is all perfect
i put this code in the index.php
` <?= \yii2fullcalendar\yii2fullcalendar::widget(array(
'options' => ['lang' => 'it',
' class' => 'fullcalendar'
],
'clientOptions' => [ 'selectable' => true,
'selectHelper' => true,
'droppable' => true,
'editable' => true,
// 'drop' => new JsExpression($JSDropEvent),
'select' => new JsExpression($JSCode),
'eventClick' => new JsExpression($JSEventClick),
'defaultDate' => date('Y-m-d')
],
'events'=> Url::to(['/agenda/jsoncalendar']),
// $events,
) );?>`
and this into controller
`
public function actionJsoncalendar($start=NULL,$end=NULL,$_=NULL){
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
$times = Agenda::find()->all();
$events = array();
foreach ($times AS $time){
//Testing
$Event = new \yii2fullcalendar\models\Event();
$Event->id = $time->id;
$Event->title = $time->elemento;
$Event->start = date('Y-m-d\TH:i:s\Z',strtotime($time->dadata));
$Event->end = date('Y-m-d\TH:i:s\Z',strtotime($time->adata));
$Event->overlap=true;
$Event->startEditable = true;
$Event->durationEditable = true;
$el = trim($time->elemento);
switch ($el) {
case 'ELE1':
$Event->color = 'green';
break;
case 'ELE2':
$Event->color = 'red';
break;
case 'ELE3':
$Event->color = 'black';
break;
case 'ELE4':
$Event->color = 'purple';
break;
case 'ELE5':
$Event->color = 'brown';
break;
case 'ELE6':
$Event->color = 'blue';
break;
}
$events[] = $Event;
}
\Yii::warning($events);
return $events;
}
`
This is the data structure,
where dadata is the start data and adata is enddata
and the data
But i dont think or better i dot kwnow if it guilty…
what can be?
tka a lot!