I have a list of teachers, within each teacher, I have a sublist of subjects. I need to create something like a "weekly calendar" for every time I select a teacher, I show his subjects in the weekly calendar (for me to know the day / duration of the course).
Well, I'm trying to use FullCalendar. Here is my code:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Calendario</title>
<script src='calendario/lib/moment.min.js'></script>
<script src='calendario/fullcalendar.js'></script>
<script src='calendario/lang/pt-br.js'></script>
<link rel='stylesheet' href='calendario/fullcalendar.css'/>
<script type="text/javascript">
$(document).ready(function(){
var date = new Date();
var dia = date.getDate();
var m = date.getMonth()+1; //January is 0
var mes = m < 10 ? '0' + m : '' + m;
var ano = date.getFullYear();
var data = ano + '-' + mes + '-' + dia;
//Page is now ready, initialize calenda.
$('#calendario').fullCalendar({
header: {
center: 'title',
left: '',
right: ''
},
height: 800,
defaultView: 'agendaWeek',
views: {
week: {
columnFormat: 'dddd'
}
},
firstDay: 1,
weekends: false,
events: [
{
title: 'Event1',
start: ano + '-' + mes + '-' + dia,
end: ano + '-' + mes + '-' + dia + 'T04:00'
}
],
})
});
</script>
</head>
<body>
<div class="teste">
<div id="calendario"></div>
</div>
</body>
</html>
As you can see, I'm adding events
manually inside the header. Would you like to know how I can do this dynamically? (Or else, advice from another more appropriate tool).