modify('+1 day');
$date = $dateObject->format("Y-m-d");
}
return $date;
}
}
if(count($fiches)>0) {
$js = '';
foreach ($fiches as $fiche) {
// couleur de marqueur
$color = getCustomValueForEntry($param['color'], $param['colorfield'], $fiche, null);
// icone
$icon = getCustomValueForEntry(
$param['icon'],
$param['iconfield'],
$fiche,
''
);
$titleprefix = '';
if (!empty($icon)) {
$titleprefix .= ' ';
}
if (isset($fiche['bf_date_debut_evenement']) && isset($fiche['bf_date_fin_evenement'])) {
$js .= ' {
id: "'.$fiche['id_fiche'].'",
title: "'.addslashes($titleprefix.$fiche['bf_titre']).'",
start:"'. $fiche['bf_date_debut_evenement'].'",
end:"'. formatEndDate($fiche['bf_date_fin_evenement']).'",
url:"'.$GLOBALS['wiki']->config['base_url'].$fiche['id_fiche'].'",
allDay: '.((strlen($fiche['bf_date_debut_evenement'])>10) ? 'false':'true').',
className: "bazar-entry modalbox",
backgroundColor: "'.$color.'",
htmlattributes: "'.addslashes($fiche['html_data']).'"
},';
}
}
if (!empty($js)) {
$js = substr($js, 0, -1);
}
$script = "$(document).ready(function() {
var allEvents = [".$js."];
function initCal(selector, allEvents) {
$(selector).fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
editable: false,
events: allEvents,
eventRender: function(event, element, view) {
element.find('.fc-title').html(event.title);
$.each($('
').data(), function (index, value) {
element.attr('data-'+index, value);
})
},
locale: '".$GLOBALS['wiki']->config['default_language']."',
buttonText: {
prev: ' ◄ ',
next: ' ► ',
prevYear: ' << ',
nextYear: ' >> ',
today: '"._t('BAZ_TODAY')."',
month: '"._t('BAZ_MONTH')."',
week: '"._t('BAZ_WEEK')."',
day: '"._t('BAZ_DAY')."'
},
firstDay : 1,
themeSystem: 'bootstrap3',
timeFormat: 'HH:mm',
eventLimit: true, // allow more link when too many events
})
}
initCal('#calendar".$param['nbbazarliste']."', allEvents);
$('body').on( 'updatefilters', function( event, elements ) {
//$('#calendar".$param['nbbazarliste']."').fullCalendar('removeEvents');
var newEvents = new Array();
$.each(elements, function (index, value) {
$(value).parents('.bazar-entry').show();
var idx = $.map(
allEvents,
function(item, i) {
if (item.id==$(value).data('id_fiche'))
return item;
}
)[0];
newEvents.push(idx)
});
initCal('#calendar".$param['nbbazarliste']."', newEvents);
});
});\n";
if (!empty($params['minical']) && $params['minical']==1) {
$script .= '
function init_calendar_tooltip() {
$(".fc-event-title").each(function() {
texte = $(this).html();
$(this).parents(\'.fc-event\').tooltip({\'title\':texte, \'html\':true});
});
}
setTimeout(init_calendar_tooltip,2000);';
}
$GLOBALS['wiki']->AddCSSFile('tools/bazar/libs/vendor/fullcalendar/fullcalendar.min.css');
$GLOBALS['wiki']->AddJavascriptFile('tools/bazar/libs/vendor/moment.min.js');
$GLOBALS['wiki']->AddJavascriptFile('tools/bazar/libs/vendor/fullcalendar/fullcalendar.min.js');
$GLOBALS['wiki']->AddJavascriptFile('tools/bazar/libs/vendor/fullcalendar/locale-all.js');
$GLOBALS['wiki']->AddJavascript($script);
echo '
'."\n";
}