nella view:
<?php
$this->widget('application.extensions.efullcalendar.EFullCalendar', array(
'id'=>'cal-test',
'lang'=>'it',
'htmlOptions'=>array(
// you can scale it down as well, try 80%
'style'=>'width:100%'
),
// Options fullcalendar - http://arshaw.com/fullcalendar/docs/
'options'=>array(
//'defaultView'=>'basicWeek',
'defaultView'=>'agendaWeek',
'axisFormat'=>'HH:mm',
'timeFormat'=>'HH:mm{ - HH:mm}',
// 'aspectRatio'=>'5',
'columnFormat'=>array(
'week'=>'ddd, d MMM', // Mon 9/7
),
'buttonText'=>array(
'today'=>'Oggi',
'prev'=>'<i class="icon-arrow-left"></i>',
'next'=>'<i class="icon-arrow-right"></i>',
),
'header'=>array(
'left'=>'today prev,next',
'center'=>'title',
'right'=>'month,agendaWeek,agendaDay'
),
'lazyFetching'=>true,
// Carico Eventi da db.
'eventSources'=>array(
Yii::app()->createUrl('tuocontroller/tuaactionpereventidb'),
),
//Select Data - Create
'selectable'=>true,
'selectHelper'=>false,
)
));
?>
nel tuocontroller:
public function actionTuaactionpereventidb()
{
$start = $_GET['start'];
$end = $_GET['end'];
$st = date("Y-m-d", $start);
$en = date("Y-m-d", $end);
$eventi = Eventi::model()->findAll(
array('condition'=>'utente_id = :utente_id AND data >= :start AND data < :end',
'params'=>array(':utente_id'=>Yii::app()->user->id,':start'=>$st,':end'=>$en),
'order'=>'data DESC, titolo ASC'
));
if($eventi==null)
Yii::app()->end();
foreach ($eventi as $evento){
$items[]=array(
'id'=>$evento->id,
'title'=>$evento->titolo,
'start'=>$evento->data.' '.$evento->ora_inizio,
'end'=>$evento->data.' '.$disp->ora_fine,
'allDay'=>false,
);
}
echo CJSON::encode($items);
Yii::app()->end();
}