Calendar week view option - change date header to name of the day

Hi there,

this code used to work to go to a day of the week and change the date header to a day name

Blockquote
/**

  • Selecting a field from another table
    */

// Check for record
$check_sql = “SELECT ev_datum_start”
. " FROM ILP_master_page"
. " WHERE ev_id = ‘" . [ev_id] . "’";
sc_lookup(rs, $check_sql);

if (isset({rs[0][0]})) // Row found
{
{datum_start_event} = {rs[0][0]};

}
else // No row found
{
{datum_start_event} = ‘’;

}

$datum= {datum_start_event};

echo ’';

Blockquote>

the last line

$("#calendar").fullCalendar(“option”, “columnFormat”, “dddd”);

always worked, but in the last version it does nothing. i know their is a new code (args.date) but i can’t get it to work. any suggestions?

I use the following code in onCalendarScriptInit to get full control of the calendar

You can put ‘dddd’ the columnFormat of the week instead of ‘ddd M/D’

?>
<script>
window.addEventListener(‘DOMContentLoaded’, function () {
$(’#calendar’).fullCalendar({
height: ($( document ).height()-10),
monthNames: ["<?php echo({lang_mnth_janu}); ?>","<?php echo({lang_mnth_febr}); ?>","<?php echo({lang_mnth_marc}); ?>","<?php echo({lang_mnth_apri}); ?>","<?php echo({lang_mnth_mayy}); ?>","<?php echo({lang_mnth_june}); ?>","<?php echo({lang_mnth_july}); ?>","<?php echo({lang_mnth_augu}); ?>","<?php echo({lang_mnth_sept}); ?>","<?php echo({lang_mnth_octo}); ?>","<?php echo({lang_mnth_nove}); ?>","<?php echo({lang_mnth_dece}); ?>"],
monthNamesShort: ["<?php echo({lang_shrt_mnth_janu}); ?>","<?php echo({lang_shrt_mnth_febr}); ?>","<?php echo({lang_shrt_mnth_marc}); ?>","<?php echo({lang_shrt_mnth_apri}); ?>","<?php echo({lang_shrt_mnth_mayy}); ?>","<?php echo({lang_shrt_mnth_june}); ?>","<?php echo({lang_shrt_mnth_july}); ?>","<?php echo({lang_shrt_mnth_augu}); ?>","<?php echo({lang_shrt_mnth_sept}); ?>","<?php echo({lang_shrt_mnth_octo}); ?>","<?php echo({lang_shrt_mnth_nove}); ?>","<?php echo({lang_shrt_mnth_dece}); ?>"],
dayNames: ["<?php echo({lang_days_sund}); ?>","<?php echo({lang_days_mond}); ?>","<?php echo({lang_days_tued}); ?>","<?php echo({lang_days_wend}); ?>","<?php echo({lang_days_thud}); ?>","<?php echo({lang_days_frid}); ?>","<?php echo({lang_days_satd}); ?>"],
dayNamesShort: ["<?php echo({lang_shrt_days_sund}); ?>","<?php echo({lang_shrt_days_mond}); ?>","<?php echo({lang_shrt_days_tued}); ?>","<?php echo({lang_shrt_days_wend}); ?>","<?php echo({lang_shrt_days_thud}); ?>","<?php echo({lang_shrt_days_frid}); ?>","<?php echo({lang_shrt_days_satd}); ?>"],
allDayText: “<?php echo({lang_per_allday}); ?>”,
allDayHtml: “<?php echo({lang_per_allday}); ?>”,
buttonText: {
today: “<?php echo({lang_per_today}); ?>”,
month: “<?php echo({lang_srch_mnth}); ?>”,
week: “<?php echo({lang_per_week}); ?>”,
day: “<?php echo({lang_per_day}); ?>”,
agenda: “<?php echo({lang_calendar_agenda}); ?>”,
print: “<?php echo({lang_calendar_print}); ?>”,
listMonth: “<?php echo({lang_calendar_agenda}); ?>”,
},
views: {
month: {titleFormat: ‘MMMM YYYY’, columnFormat: ‘ddd’, timeFormat: ‘H:mm’,slotLabelFormat: [‘ddd’,‘H:mm’],},
week: {titleFormat: ‘MMM D YYYY’, columnFormat: ‘ddd M/D’, timeFormat: ‘H:mm’,slotLabelFormat: [‘ddd M/D’,‘H:mm’],},
day: {titleFormat: ‘<?php echo($sDateFormat); ?>’, columnFormat: ‘dddd M/D’, timeFormat: ‘H:mm’,slotLabelFormat: [‘dddd M/D’,‘H:mm’],},
},
firstDay: 0,
header: {
left: ‘prev,next today print’,
center: ‘title’,
right: ‘month,agendaWeek,agendaDay,listMonth’
},
customButtons: {
goBack: {
text: “<?php echo({lang_btns_back}); ?>”,
click: function() {
calendarGoBack();
}
},
print: {
text: “<?php echo({lang_calendar_print}); ?>”,
click: function() {
calendar_print();
}
}
},
editable: true,
slotDuration: “00:30:00”,
snapDuration: “00:15:00”,
weekends: true,
nextDayThreshold: “00:00:00”,
eventStartEditable: true,
allDaySlot: true,
minTime: “07:00:00”,
noEventsMessage: “<?php echo({lang_calendar_no_events}); ?>”,
events: ‘<?php echo($this->Ini->nm_cod_apl); ?>.php?script_case_init=<?php echo($this->Ini->sc_page); ?>&nmgp_opcao=calendar_fetch’ + getCategory(false),
eventRender: function (event, element, view) {
if(event.hasOwnProperty(‘description’) && event.description != ‘’)
{
element.find(’.fc-title’).append(’

’+event.description+’’);
}
},
dayClick: function(date, jsEvent, view) {
var sDate = date.format(), sTime = ‘00:00:00’, allDay = false;
if (sDate.indexOf(‘T’) > 0)
{
dateParts = date.format().split(‘T’);
sDate = dateParts[0], sTime = dateParts[1];
}
else if (‘month’ == view.type)
{
sTime = ‘07:00:00’;
}
else
{
allDay = true;
}
tb_show(’’, ‘<?php echo($this->Ini->nm_cod_apl); ?>.php?nmgp_opcao=edit_novo&sc_cal_click_date=’ + sDate + ‘&sc_cal_click_time=’ + sTime + ‘&sc_cal_click_allday=’ + allDay + ‘&script_case_init=<?php echo $this->Ini->sc_page ?>&nmgp_outra_jan=true&nmgp_url_saida=modal&TB_iframe=true&modal=true&height=700&width=1400’, ‘’);
},
eventClick: function(calEvent, jsEvent, view) {
tb_show(’’, ‘<?php echo($this->Ini->nm_cod_apl); ?>.php?nmgp_opcao=igual_calendar&calendarid=’ + calEvent.id + ‘&__orig_calendarid=’ + calEvent.id + ‘&script_case_init=<?php echo $this->Ini->sc_page ?>&nmgp_outra_jan=true&nmgp_url_saida=modal&TB_iframe=true&modal=true&height=700&width=1400’, ‘’);
},
eventDrop: function(event, delta, revertFunc) {
$.ajax({
url: ‘<?php echo($this->Ini->nm_cod_apl); ?>.php’,
type: ‘POST’,
dataType: ‘json’,
data: { ‘script_case_init’: ‘<?php echo $this->Ini->sc_page ?>’, ‘nmgp_opcao’: ‘calendar_drop’, ‘sc_event_id’: event.id, ‘sc_day_delta’: delta._data.days, ‘sc_time_delta’: (delta._data.hours * 60) + delta._data.minutes, ‘sc_all_day’: event.allDay, ‘sc_fullcal_start’: (event._start && event._start._d ? event._start._d.toISOString() : ‘’), ‘sc_fullcal_end’: (event._end && event._end._d ? event._end._d.toISOString() : ‘’) },
originalEvent: event,
success: function(data) {
var bChanged = false;
if (typeof data[‘status’] !== “undefined” && false == data[‘status’]) {
revertFunc();
}
else {
if (typeof data[‘backgroundColor’] !== “undefined” && ‘’ != data[‘backgroundColor’]) {
if (this.originalEvent.backgroundColor != data[‘backgroundColor’]) {
bChanged = true;
}
this.originalEvent.backgroundColor = data[‘backgroundColor’];
}
if (typeof data[‘borderColor’] !== “undefined” && ‘’ != data[‘borderColor’]) {
if (this.originalEvent.borderColor != data[‘borderColor’]) {
bChanged = true;
}
this.originalEvent.borderColor = data[‘borderColor’];
}
if (this.originalEvent.allDay || this.originalEvent.originalAllDay || bChanged) {
$(’#calendar’).fullCalendar(‘refetchEvents’);
}
else {
$(’#calendar’).fullCalendar(‘updateEvent’, this.originalEvent);
}
}
if (typeof data[‘message’] !== “undefined” && ‘’ != data[‘message’]) {
alert(data[‘message’]);
}
}
});
},
eventResize: function(event, delta, revertFunc) {
$.post(
‘<?php echo($this->Ini->nm_cod_apl); ?>.php’,
{ ‘script_case_init’: ‘<?php echo $this->Ini->sc_page ?>’, ‘nmgp_opcao’: ‘calendar_resize’, ‘sc_event_id’: event.id, ‘sc_day_delta’: delta._data.days, ‘sc_time_delta’: (delta._data.hours * 60) + delta._data.minutes, ‘sc_fullcal_start’: (event._start && event._start._d ? event._start._d.toISOString() : ‘’), ‘sc_fullcal_end’: (event._end && event._end._d ? event._end._d.toISOString() : ‘’) },
function(data) {
if (false == data[‘status’]) {
revertFunc();
}
if (typeof data[‘message’] !== “undefined” && ‘’ != data[‘message’]) {
alert(data[‘message’]);
}
},
‘json’
);
},
defaultView: ‘agendaWeek’,
});
});
</script> <?php
1 Like

I know i’m not good in using scripts but i get this

any suggestions

Sorry there must be a typo in the code, try this one

fullCalendar.txt (8.1 KB)

almost there. that did the trick! little problem with the onclick function

eventClick: function(calEvent, jsEvent, view) {
tb_show(’’, ‘<?php echo($this->Ini->nm_cod_apl); ?>.php?nmgp_opcao=igual_calendar&calendarid=’ + calEvent.id + ‘&__orig_calendarid=’ + calEvent.id + ‘&script_case_init=<?php echo $this->Ini->sc_page ?>&nmgp_outra_jan=true&nmgp_url_saida=modal&TB_iframe=true&modal=true&height=700&width=1400’, ‘’);
},

this gives an error says:

Notice: Undefined variable: __orig_wk_id in /Applications/Scriptcase/v9-php73/wwwroot/scriptcase/app/Brixx_projecten_backup/test_2calendar_ILP_rooster/index.php on line 2166

i use wk_id as the unique key is that the problem?

Yes, sorry about that

I use calendarID in my table instead of the default id so you should replace all occurrence of calendarid to id

oh thanx jboutin60 you’re a lifesaver! everything works now

one question. does, with this script , the print work for you or is their some lib i miss

I am not using Print, but I just check and it doesn’t work

well i goy a sollotuion for you :wink:

change

print: {
text: “<?php echo({lang_calendar_print}); ?>”,
click: function() {
calendar.print();

in

print: {
text: “<?php echo({lang_calendar_print}); ?>”,
click: function() {
windows.print();

1 Like

It work thank you, but it need to be window.print();, whithout the s

yep!
again, thanks for the answers. much appreciated

@jlboutin60 . after a last update to 9.10.009 (13) the above script in the calendar app doesn’t work anymore. Any suggestions?