Hello! I want to retrieve the events from the database and display them in the calendar. Can you help me do that? So far, I have the following codes:
Model:
Public function obter_noticias()
{
$sql = "SELECT * FROM noticias WHERE noticias.id";
return $this->db->query($sql, array($_GET['start'], $_GET['end']))->result();
}
controller
Public function obter_noticias()
{
$result=$this->Noticias_model->obter_noticias();
echo json_encode($result);
echo $this->db->last_query();
die();
}
In the .js file, I'm using the following code
var base_url='http://localhost/ci_adminlte/admin';
$(document).ready(function(){
$('#calendar').fullCalendar({
//alert('Teste de carregamento FullCalendar');
header: {
left: 'prev,next today',
center: 'title',
//right: 'month,basicWeek,basicDay'
right: 'month,agendaWeek,agendaDay,listWeek,'
},
editable: false,
navLinks: true,
//selectable: true,
selectHelper: true,
events: base_url+'noticias/obter_noticias'
});
});
Below is my table
id INT(11) NOT NULL AUTO_INCREMENT,
data DATETIME NOT NULL,
titulo TEXT NULL DEFAULT NULL,
noticia TEXT NULL DEFAULT NULL,
usuario_cadastro VARCHAR(40) NOT NULL,
usuario_alteracao VARCHAR(40) NOT NULL,
dt_cadastro DATETIME NOT NULL,
dt_alteracao DATETIME NULL DEFAULT NULL,