'; include("../layout/topnav.php"); print '
'; ?> '; /* days and weeks vars now ... */ $running_day = date('w',mktime(0,0,0,$month,1,$year)); $days_in_month = date('t',mktime(0,0,0,$month,1,$year)); $days_in_this_week = 1; $day_counter = 0; $dates_array = array(); /* row for week one */ $calendar.= ''; /* print "blank" days until the first of the current week */ for($x = 0; $x < $running_day; $x++): $calendar.= ''; $days_in_this_week++; endfor; /* keep going with days.... */ for($list_day = 1; $list_day <= $days_in_month; $list_day++): /* if calendar frame number = today hard code BGCOLOR else use below NOT */ //if ( $curday == $list_day ) { if ( $curday == $list_day AND $curmonth == $month ) { $calendar.= ''; if($running_day == 6): $calendar.= ''; if(($day_counter+1) != $days_in_month): $calendar.= ''; endif; $running_day = -1; $days_in_this_week = 0; endif; $days_in_this_week++; $running_day++; $day_counter++; endfor; /* finish the rest of the days in the week */ if($days_in_this_week < 8): for($x = 1; $x <= (8 - $days_in_this_week); $x++): $calendar.= ''; endfor; endif; /* final row */ $calendar.= ''; /* end the table */ $calendar.= '
Special Events'; /* select month control */ $select_month_control = ''; /* select year control */ $year_range = 7; $select_year_control = ''; $select_sitemap_control = ''; print $select_sitemap_control; /* "next month" control */ $next_month_link = 'Next Month >>'; /* "previous month" control */ $previous_month_link = '<< Previous Month'; /* bringing the controls together */ $controls = '
'.$select_month_control.$select_year_control.$select_sitemap_control.' '.$previous_month_link.' '.$next_month_link.' '.$special_events.'
'; ?> '; /* table headings */ $calendar.= '
Sunday Monday Tuesday Wednesday Thursday Friday Saturday
.'; } else { $calendar.= ''; } /* add in the day number */ $calendar.= ''.$list_day.'
'; /** QUERY THE DATABASE FOR AN ENTRY FOR THIS DAY !! IF MATCHES FOUND, PRINT THEM !! **/ /** if closed=true write closed if sunday=true write sunday hours if not above write regular hours if special event=true add (concantonate) special event msg **/ if($running_day == 0) { $calendar.= ''; } else { $calendar.= ''; } /* if($running_day == 5) { $calendar.= '
Special Event'; } */ $monthpad = sprintf("%02d",$month); $daypad = sprintf("%02d",$list_day); // $calendar.= $year.$monthpad.$daypad; $numeve = ''; // WHERE CACTIVE='on' ORDER BY CSTART ASC CTIMESORT ASC $result=mysql_query("SELECT * FROM vbecalendar"); while($a_row=mysql_fetch_array($result)){ if( $a_row['CSTART'] == $year . $monthpad . $daypad ) { if( $a_row['CACTIVE'] != '' ) { if( $a_row['CTYPE'] == 'SIGNATURE' OR $a_row['CTYPE'] == 'SPECIAL' OR $a_row['CTYPE'] == 'CLOSED' ) { if ( $numeve != '' ) { $special.= '
' . stripslashes( $a_row['CABBREV'] ) .'
'; } else { $special.= stripslashes( $a_row['CABBREV'] ) .'
'; } $numeve = 1; if( $a_row['CTYPE'] == 'CLOSED' ) { $daytype="CLOSED"; } } } } } mysql_close ($link); if ( $daytype == 'CLOSED' ) { $calendar.= '
CLOSED:
' . $a_row['CABBREV'] . '
'; $daytype = ""; } else { $daytext = date('l',mktime(0,0,0,$month,$list_day,$year)); if ( $curday == $list_day AND $curmonth == $month ) { $calendar.= 'Today
'; /*} else if ( substr($daytext,0,1) == 'S' AND $daytype == '' ) { $calendar.= 'Closed'; } else { $calendar.= 'Open';*/ } if( $special != '' ) { $calendar.= '' . $special . ''; } } $special = ''; $calendar.= '
.
'; /* all done, return result */ return $calendar; } /* sample usages */ echo '

' . date('F',mktime(0,0,0,$month,1,$year)) .' ' . $year . '

'; Print (" Open Monday thru Friday: 7:30AM - 4:30PM

"); echo $controls; print '
'; echo draw_calendar($month,$year,$CALENDAR_DEFAULT); ?>