Calendar for CakePHP

I am new to CakePHP and would like to create a calendar using this structure. I'm having a hard time and I'm wondering if there is a tutorial or guide for creating a simple calendar using CakePHP?

+5
source share
3 answers

Here are two links: LINK1 (calendar assistant) and LINK2 to implement FullCalendar. I have not tried both of them ...

+4
source
0
source
    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
    }

  1. View File
    Add this to the .ctp file.

    <div class = "" id = "calendar_div">

Js code for view file

$('#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          
});
0
source

All Articles