- Скачать файл js или css http://fullcalendar.io/download/
- Код контроллера
function feeds(){
$this->layout = 'ajax';
if(isset($this->params->query['start'])){
$start = $this->params->query['start'];
}
if(isset($this->params->query['end'])){
$end = $this->params->query['end'];
}
$events = $this->{$this->modelClass}->find('all',array('conditions' => array('startdate >=' => $start,'enddate $end)));
$data = '';
foreach($events as $res ){
$data[] = array(
'id' => $res[$this->modelClass]['id'],
'title'=> $res[$this->modelClass]['title'],
'start'=> Date('Y-m-d H:m',$res[$this->modelClass]['startdate']),
'end' => Date('Y-m-d H:m',$res[$this->modelClass]['enddate']),
'start_time' => Date('h:ia',$res[$this->modelClass]['startdate']),
'end_time' => Date('h:ia',$res[$this->modelClass]['enddate'])
);
}
echo json_encode($data);
exit;
}
Просмотр файлаДобавьте это в .ctp файл
<div class="" id="calendar_div">
JS код для просмотра файла
$('#calendar_div').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'agendaDay,agendaWeek,month'
},
defaultView: 'month',
events: '<?php echo $this->Html->url(array('action' => 'feeds')); ?>',
selectable: true,
selectHelper: true
});