Similar questions to this have been asked (and anwsered) before in the forum.
Basicially you need to modify
functions.inc.php so as to check the date being shown against the current date and "simply" not add the link if it is previous to the current day.
In this file somewhere towards the begining of the draw_cal() function add this line to define the current timestamp:
- Code: Select all
$today_timestamp= mktime(0,0,0,date('m'),date('d'),date('Y'));
Then, down below within the loop that goes through each day of the month add this:
- Code: Select all
if(CAL_START_DAY=="sun") $date_timestamp = mktime(0,0,0, $month,$day_counter,$year);
else $date_timestamp = mktime(0,0,0, $month,($day_counter+1),$year);
(the loop in question starts like this:
for($day_counter = 1; $day_counter <= $days_in_this_month; $day_counter++){Finally you need to condition the links so that they will not be defined if the date is previous to today.
Currently in your version you have this:
- Code: Select all
// show ajax link or not
if($show_link==1){
$day_link_start ='<a href="#" onclick="ajax_mod_state(\''.$id.'\',\''.$this_date.'\',\''.$day_counter.'\',event); return false" title="'.$lang["modify_availability_for"].' '.$lang["day_".$week_day.""].' '. $date_format.'" class="cal_day">';
$day_link_end ='</a>';
}else{
$day_link_start ="";
$day_link_end ="";
}
You need to change that to this:
- Code: Select all
$day_link_start ="";
$day_link_end ="";
if( $date_timestamp>=$today_timestamp){
// show ajax link or not
if($show_link==1){
$day_link_start ='<a href="#" onclick="ajax_mod_state(\''.$id.'\',\''.$this_date.'\',\''.$day_counter.'\',event); return false" title="'.$lang["modify_availability_for"].' '.$lang["day_".$week_day.""].' '. $date_format.'" class="cal_day">';
$day_link_end ='</a>';
}
}
That should be it.
You will see from this that I haven't actually done what you requested as regards making the previous days "appear" to be all booked as I am not convinced that that is really what you want.
However, if it is, you could add a condition so that if the date is previous to current, the image to be used is always the "booked" one (or create another one especially for the ocasion), something like this (following on from the previous "if" clause):
- Code: Select all
}else{
// show all previous days as booked
$day_image='cal_on_'.$day_counter.'.png';
}
Well, I hope you can follow these steps.
Chris