= 30) { $myTime+= .5; } //set current class and timeleft to nothing $cClass = ""; $timeLeft = ""; //array of day names $wd = array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"); //keyed array with keys as day names $week = array("Sunday" => array(), "Monday" => array(),"Tuesday" => array(),"Wednesday" => array(), "Thursday" => array(),"Friday" => array(), "Saturday" => array()); //set min and max hours beyond normal day $minh = 25; $maxh = -1; //read in schedule $rawsched = file('classSched.txt'); //puts class in proper array function insertClass($day,$class,$start,$len) { //declare globals global $theDay, $week, $theHour, $theMin, $myTime, $cClass, $timeLeft; //make lengh into half hours $tmplen = $len * 2; //set style to empty $cb = ""; //find out if i am currently in a class if($day == $theDay && $myTime >= $start && $myTime < ($start+$len)) { //set style $cb = "style=\"background-color: blue; font-weight: bold;\""; //set current class to the class I am in $cClass = "$class"; //find the time left in the class $timeLeft = (($start+$len-$theHour)*60)-$theMin; } //insert class cell into array keyed by the day and indexed //by start time $week["$day"]["$start"] = "
Time | \n{$wd[$i]}\n\n"; } echo "|||||||
$time$st | \n"; //look for a class for ($j = 0; $j <= 6; $j++) { //if a class exists for curent time, echo it if(array_key_exists("$minh",$week["{$wd[$j]}"])) { echo "{$week["{$wd[$j]}"]["$minh"]}\n"; } else { //if cell is current time, make it blue if ($minh == $myTime && strcmp($wd[$j],$theDay) == 0) { echo "\n"; } //echo empty cell else { echo " | \n"; } } } //end row echo " |