0

I am using fullcalendar as a booking agenda. I use recurring events to display the regulare availability of doctors.

It happens though that a doctor might not be available just for a certain date:

Example: Dr Smith works every monday from 1000 to 1800, but only next monday won't be available.

Recurring events in fullcalendar allows to show events in a specific date range. But how can it be done the opposite (always show except within specific date range)?

Does any of you had this issue already?

Thanks for any help!

2 Answers2

0

I have managed with a function using @Ryan89 JSFiddle.

//$val is doctor ID value
//adding not availabilty to repeating events
$adesso=date('Y-m-d H:i:s');
$sql_ecc="SELECT * FROM lpap_eccezioni_oneoff WHERE IDmedico=$val AND      datafine>'$adesso' AND stato='Non disponibile' ORDER BY datainizio";
$res_ecc=$wpdb->get_results($sql_ecc);
$qta=count($res_ecc);
if ($qta>0){
$eccezioni_non_disponibile=",ranges: [{start: moment().startOf('year'),";
foreach ($res_ecc as $val_ecc){
$stato=$val_ecc->stato;
if ($stato=="Disponibile"){$dispchecked="checked";$nondispchecked="";}
if ($stato=="Non disponibile"){$dispchecked="";$nondispchecked="checked";}

$datainizioecc=$val_ecc->datainizio;
$datafineecc=$val_ecc->datafine;
$IDeccezioni=$val_ecc->IDeccezioni;
$eccezioni_non_disponibile.="
end: moment('$datainizioecc','YYYY-MM-DD h:mm:ss'),
},{
start: moment('$datafineecc','YYYY-MM-DD h:mm:ss'),";           
}   
$eccezioni_non_disponibile.="end: moment('$datafineecc','YYYY-MM-DD h:mm:ss').endOf('year'),
}]";
} else {$eccezioni_non_disponibile="";}

in order to get this code:

 ranges: [{
     start: moment().startOf('year'), 
     end: moment('2016-06-13 10:00:00','YYYY-MM-DD h:mm:ss'),
    },{
     start: moment('2016-06-13 18:00:00','YYYY-MM-DD h:mm:ss'), 
     end: moment('2016-06-20 10:00:00','YYYY-MM-DD h:mm:ss'),
    },
        {
     start: moment('2016-06-20 18:00:00','YYYY-MM-DD h:mm:ss'), 
     end: moment('2016-06-20 18:00:00','YYYY-MM-DD h:mm:ss').endOf('year'),
    },] 

I have added then on repeating events the $eccezioni_non_disponibile variable. $show_time.="{ id: 'Disp_$val', resourceId: '$gruppo', title: '$cognome $nome - Presente', start: '$ora01', end: '$ora02', dow: [$key], color: '$rgba', borderColor: '$colore' $eccezioni_non_disponibile },"; }

0

I have asked Arshaw (fullcalendar' author) why JSfiddle works and not in my site and it looks that he doesn't know of any RANGES feature.

Have a look here: enter link description here