Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php fullcalendar不显示带有codeigniter的事件_Php_Codeigniter_Fullcalendar - Fatal编程技术网

Php fullcalendar不显示带有codeigniter的事件

Php fullcalendar不显示带有codeigniter的事件,php,codeigniter,fullcalendar,Php,Codeigniter,Fullcalendar,我正在尝试用FullCalendar和codeigniter制作日历。我已经阅读了本页上的几个问题,但仍然不理解,因为日历没有显示事件 我有以下几条路线: $route['calendar'] = 'user/calendar/showCalendar'; $route['calendar/events'] = 'user/calendar/getEvents'; 这是控制器: public function showCal

我正在尝试用FullCalendar和codeigniter制作日历。我已经阅读了本页上的几个问题,但仍然不理解,因为日历没有显示事件

我有以下几条路线:

$route['calendar']                      = 'user/calendar/showCalendar';
$route['calendar/events']               = 'user/calendar/getEvents';
这是控制器:

public function showCalendar()
{
    $this->template->add_css(base_url() . 'assets/plugins/fullcalendar/fullcalendar.min.css');
    $this->template->add_js('https://code.jquery.com/ui/1.11.1/jquery-ui.min.js');
    $this->template->add_js('https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.7.0/moment.min.js');
    $this->template->add_js(base_url() . 'assets/plugins/fullcalendar/fullcalendar.min.js');
    $this->template->add_js(base_url() . 'assets/plugins/fullcalendar/config.js');

    $data = array();

    $this->template->write('title', 'Calendar', TRUE);
    $this->template->write_view('header',  'user/template/header');
    $this->template->write_view('sidebar', 'user/template/sidebar');
    $this->template->write_view('content', 'user/calendar/calendar', $data, TRUE);
    $this->template->render();
}

public function getEvents()
{
    if($this->input->is_ajax_request())
    {
        $events = $this->calendar_mdl->getEvents();
        echo json_encode($events);
    }
}
My config.js:

$(function () {

    /* initialize the external events
     -----------------------------------------------------------------*/
    function ini_events(ele) {
        ele.each(function () {

            // create an Event Object (http://arshaw.com/fullcalendar/docs/event_data/Event_Object/)
            // it doesn't need to have a start or end
            var eventObject = {
                title: $.trim($(this).text()) // use the element's text as the event title
            };

            // store the Event Object in the DOM element so we can get to it later
            $(this).data('eventObject', eventObject);

            // make the event draggable using jQuery UI
            $(this).draggable({
                zIndex: 1070,
                revert: true, // will cause the event to go back to its
                revertDuration: 0  //  original position after the drag
            });

        });
    }
    ini_events($('#external-events div.external-event'));

    /* initialize the calendar
     -----------------------------------------------------------------*/
    //Date for the calendar events (dummy data)
    var date = new Date();
    var d = date.getDate(),
        m = date.getMonth(),
        y = date.getFullYear();
    $('#calendar').fullCalendar({
        header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,agendaWeek,agendaDay'
        },
        buttonText: {
            today: 'hoy',
            month: 'mes',
            week: 'semana',
            day: 'dia'
        },
        //Random default events
        editable: true,
        events: "http://project.dev/calendar/events"
    });
});
我的模型是:

public function getEvents()
{
    $this->db->select('*');
    $this->db->order_by('id', 'DESC');
    $query = $this->db_get(dbCalendar); // dbCalendar is a constant

    if($query->num_rows() > 0)
    {
        return $query->result_array();
    }

    return FALSE;
}
这是我第一次尝试使用fullCalnedar,我不明白为什么它没有显示我的事件。我阅读了文档,但它并没有帮助我找出可能的错误