1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
| <html>
<head>
<link href="{{ asset('css/stylecalendar.css')}}" rel="stylesheet" type="text/css">
<link href="{{ asset('css/fullcalendar.css')}}" rel="stylesheet" type="text/css">
<script src="{{ asset('js/jquery.min.js')}}" type="text/javascript"></script>
<script src="{{ asset('js/jquery-ui.custom.min.js')}}" type="text/javascript"></script>
<script src="{{ asset('js/fullcalendar.min.js')}}" type="text/javascript"></script>
</head>
<body>
<div id="calendar"></div>
<script>
$(document).ready(function() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
$('#calendar').fullCalendar({
selectable: true,
selectHelper: true,
select: function(start, end, allDay) {
var title = prompt('Event Title:');
start = $.fullCalendar.formatDate(start, "yyyy-MM-dd HH:mm:ss");
end = $.fullCalendar.formatDate(end, "yyyy-MM-dd HH:mm:ss");
calendar.fullCalendar('unselect');
$.ajax({
url: "{{ path('insertevent') }}",
data: 'title='+ title+'&start='+ start +'&end='+ end ,
type: "POST",
success: function() {
alert('OK');
}
});
},
editable: true,
events: [
{% for item in tab %}
{
id: {{ item.id }},
title: '{{ item.title }}',
start: new Date({{ item.startY }}, {{ item.startM }}, {{ item.startD }}),
end: new Date({{ item.endY }}, {{ item.endM }}, {{ item.endD }})
}
{% if loop.last %}{% else %},{% endif %}{% endfor %}
]
});
});
</script>
</body>
</html> |
Partager