Iβm trying to create a laptop system where you can see if a laptop is booked out already, I have a MySQL table with the columns approved_start_date (as datetime) and approved_end_date (as datetime) and laptop_id (1,2,3,4). I have the booking system all working but would like to be able to show the availability of the laptops on the days. The calendar is literally just for display purposes to show availbility not to actually do anything else.
I have this calendar -
/* draws a calendar */
function draw_calendar($month,$year,$events = array()){
/* draw table */
$calendar = β
β.implode(β | β,$headings).β |
'; | β; / add in the day number */ $calendar.= β β.$list_day.β β;
$calendar.= β | β;
β; |
/** DEBUG **/
$calendar = str_replace(ββ,ββ."\n",$calendar);
$calendar = str_replace(ββ,ββ."\n",$calendar);
/* all done, return result */
return $calendar;
}
function random_number() {
srand(time());
return (rand() % 7);
}
// Create date object to store the DateTime format
$dateObj = DateTime::createFromFormat(β!mβ, $month);
// Store the month name to variable
$monthName = $dateObj->format(βFβ);
/* sample usages */
echo β
β. $monthName . β β . $year . β
β;// echo β
β.date(βFβ,mktime(0,0,0,$month,1,$year)).β β.$year.β
β;echo draw_calendar($month,$year,$events);
I basically want to show if all 4 laptops are booked out for the days to be a different colour, if all 3 a different colour and so on.
Any help would be really appreciated!!