我正在使用fullcalendar Sean Kenny的fork来添加资源视图。
问题是某些事件只显示在月视图下,而不是在周视图或资源视图中。
所有活动的allDay设置为false
$(document).ready(function() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,resourceDay'
},
monthNames: ["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre" ],
monthNamesShort: ['Ene','Feb','Mar','Abr','May','Jun','Jul','Ago','Sep','Oct','Nov','Dic'],
dayNames: [ 'Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
dayNamesShort: ['Dom','Lun','Mar','Mie','Jue','Vie','Sab'],
buttonText: {
today: 'hoy',
month: 'mes',
week: 'semana',
day: 'dia'
},
allDaySlot : false,
slotDuration: '00:15:00',
axisFormat: 'HH:mm',
firstDay : 1,
minTime: '09:00:00',
maxTime: '20:00:00',
defaultView: 'resourceDay',
allDayDefault: false,
editable: true,
droppable: true,
disableResizing: false,
resources: [{
'id': '1',
'name': 'Sara'
}, {
'id': '2',
'name': 'Angela'
}],
selectable: true,
selectHelper: true,
events: '\load_events.php',
select: function(start, end, ev) {
console.log(ev.resources);
var horaIni = moment(start).format("YYYY-MM-DD HH:mm:ss");
var horaFin = moment(end).format("YYYY-MM-DD HH:mm:ss");
if(isHoraMaxOver(end)){
alert(mensajeHoraMax);
}else if(isEventOverlapped(ev,horaIni,horaFin)){
alert(mensajeOverlap);
}else if(isDomingo(horaIni)){
alert("Los Domingos descansamos. Lo siento");
}else{
createEvent(horaIni,horaFin,ev);
}
},
eventClick: function(calEvent, jsEvent, view){
if(isAdmin()){
modifyEvent(calEvent);
}
},
eventDrop: function (event, delta, revertFunc) {
var start = moment(event.start).format("YYYY-MM-DD HH:mm:ss");
var end = moment(event.end).format("YYYY-MM-DD HH:mm:ss");
if(isHoraMaxOver(end)){
alert(mensajeHoraMax);
}else if(isEventOverlapped(event,start,end)){
alert(mensajeOverlap);
}else if(isDomingo(start)){
alert("Los Domingos descansamos. Lo siento");
}else{
$.ajax({
url: 'update_event.php',
data: 'fechaIni='+ start +'&fechaFin='+ end +'&id='+ event.id +'&profesional='+ event.resources,
type: "POST"
});
}
$('#calendar').fullCalendar('refresh');
location.reload(true);
},
loading: function(bool){
if(!bool){
diableforInvitados();
updateResources();
}
},
eventRender: function(event, element) {
element.find('.fc-event-title').append("<br/>" + event.description);
},
eventResize: function(event, delta, revertFunc) {
var start = moment(event.start).format("YYYY-MM-DD HH:mm:ss");
var end = moment(event.end).format("YYYY-MM-DD HH:mm:ss");
if(isHoraMaxOver(end)){
alert(mensajeHoraMax);
}else if(isEventOverlapped(event,start,end)){
alert(mensajeOverlap);
}else{
$.ajax({
url: 'update_event.php',
data: 'fechaIni='+ start +'&fechaFin='+ end +'&id='+ event.id,
type: "POST"
});
}
$('#calendar').fullCalendar('refresh');
location.reload(true);
}
});
$("#calendar").fullCalendar('rerenderEvents');
});
以下是事件的JSON Feed的示例
Object {id: "63", title: "mariana _", start: FCMoment, end: FCMoment, description: "manicura express esmalte normal 12mins 30.00 € <br/>"…}_allDay: false_end: FCMoment_d: Tue Nov 11 2014 21:12:00 GMT-0500 (Eastern Standard Time)_f: "YYYY-MM-DDTHH:mm:ssZ"_i: "2014-11-12T02:12:00-0500"_isAMomentObject: true_isUTC: true_locale: f_offset: 300_pf: Object_tzm: 300__proto__: f_id: "63"_start: FCMoment_d: Tue Nov 11 2014 21:00:00 GMT-0500 (Eastern Standard Time)_f: "YYYY-MM-DDTHH:mm:ssZ"_i: "2014-11-12T02:00:00-0500"_isAMomentObject: true_isUTC: true_locale: f_offset: 300_pf: Object_tzm: 300__proto__: fallDay: falseclassName: Array[0]color: "#00FF1E"description: "manicura express esmalte normal 12mins 30.00 € <br/>"end: FCMomentid: "63"resources: "1"source: Objectstart: FCMomenttitle: "mariana _"__proto__: Object
以下是当前网页的链接: Web page
答案 0 :(得分:1)
我找到了解决方案。问题是事件是以24H格式预订的,而我是以12H格式捕获它们。结果是在中午之后预订的那些事件未在日视图的时间范围内显示。时限:9:00-20:00。例如:开始时间:17:00->下午5点变为5点,因此没有显示。
我必须添加
timeFormat: 'H:mm'
并更改create_event.php
$fecha_inicio=date("Y-m-d H:i:s",strtotime($fecha_inicio));
$fecha_fin=date("Y-m-d H:i:s",strtotime($fecha_fin));