codeigniter 1.7.2 で実装する fullcalendar jQuery を使用するカレンダー イベントがあります。
そのような関数 fullcalendar を実装getEvenByCategory
すると、まったく表示されません
これは私のコントローラーです [kalender.php]
function json_kategori($id) {
header("Content-Type: application/json");
echo $this->MKalender->jsonEventsByKategori();
}
function kategori($id) {
$query = $this->db->query("
SELECT
COUNT(*) as jml from kalender
WHERE
`IDKategori` = '$id'
");
foreach ($query->result() as $row) {
$row = $row->jml;
}
$config['base_url'] = base_url() . 'kalender/kategori/' . $id . '/';
$config['total_rows'] = $row;
$config['per_page'] = '4';
$config['uri_segment'] = 4;
$config['first_link'] = 'Awal';
$config['last_link'] = 'Akhir';
$config['next_link'] = 'Selanjutnya';
$config['prev_link'] = 'Sebelumnya';
$this->pagination->initialize($config);
$data['kalender'] = $this->MKalender->getAllKalenderByKategori($id,
$config['per_page'], $this->uri->segment(4));
$data['kategori'] = $this->MKategoriKalender->getKategori($id);
$data['title'] = $data['kategori']['kategori'];
$data['main'] = 'kalender/kalender_kategori';
$this->load->vars($data);
$this->load->view('layout/template');
}
これは私のモデルです [mkalender.php]
function jsonEventsByKategori($catid) {
$sql = "
SELECT
*
FROM
kalender
WHERE
IDKategori = $catid
ORDER BY
TanggalMulai";
$query = $this->db->query($sql);
// echo $sql;
return $query->result_array();
$jsonevents = array();
foreach ($query as $entry) {
$jsonevents[] = array(
'id' => $entry->IDKalender,
'start' => $entry->TanggalMulai,
'end' => $entry->TanggalAkhir,
'title' => $entry->judul,
'body' => $entry->konten,
'multi' => 0,
'allDay' => false,
'extension_id' => 2
);
}
return json_encode($jsonevents);
}
この私の見解では [kalender/kalender_kategori.php]
<script type='text/javascript'>
$(document).ready(function() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
$('#calendar').fullCalendar({
firstDay:'1',
theme:true,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
editable: true,
events: '<?= base_url(); ?>kalender/json_kategori'
});
});</script>
<div id="main"><div id='calendar'></div></div>
私の質問は、モデル内のアプリケーション コードでカレンダー イベントをカテゴリ イベント別に表示する方法です。