END; if($month < 12){ $month = $month + 1; $year = $year; } elseif($month == 12){ $month = 1; $year = $year + 1; } $i++; } print <<
END; } else { print <<My Account | Change Password | Sign Out END; } print << Language Learning Center Reservation List
$Semester Semester
END; list ($semester, $syear) = split (' ', $Semester); $query = "SELECT StartDate, EndDate from SR_semester WHERE Year = '$syear' AND Semester = '$semester'"; $result = mysql_query($query, $connection) or die ("Error in query: $query. " . mysql_error()); $row = mysql_fetch_row($result); $startdate = $row[0]; $enddate = $row[1]; list ($startyear, $startmonth, $startday) = split ('-', $startdate); list ($endyear, $endmonth, $endday) = split ('-', $enddate); print <<
Open from $row[0] to $row[1]
END; if ($manage == 1) { print <<Change room selection =>
"; } ?> ='$startdate' and Date<='$enddate' and (Status='1' or Status='2') order by Date"; $result = mysql_query($query, $connection) or die ("Error in query: $query. " . mysql_error()); $n_rows = mysql_num_rows($result); $nr = 0; if ($nr < $n_rows){$row = mysql_fetch_row($result); $rday=$row[0]; $nr++;} // print "$query"; $month = $startmonth; $year = $startyear; $num_of_month = ($endyear - $startyear)*12 + ($endmonth - $startmonth) + 1; $i = 1; while ($i <= $num_of_month) { $first_of_month = mktime (0,0,0, $month, 1, $year); $maxdays = date('t', $first_of_month); $date_info = getdate($first_of_month); $weekday = $date_info['wday']; $monthtext = $date_info['month']; print <<
END; $j = 0; while ($j < $weekday) { $j++; print << END; } $firstday = mktime (0,0,0, $startmonth, $startday, $startyear); $lastday = mktime (0,0,0, $endmonth, $endday, $endyear); $today = mktime (0,0,0, date("m"), date("d"), date("Y")); $tdy = date("d")+0; /* if ($semester == "Fall" or $Semester == "Spring") {$twoweeks = mktime (0,0,0, $startmonth, $startday+14, $startyear);} else {$twoweeks = $firstday;} $p4dayslater = mktime (0,0,0, date("m"), date("d")+4, date("Y")); $p18dayslater = mktime (0,0,0, date("m"), date("d")+18, date("Y")); */ $r = 0; // must create 6 rows for a month $day = 1; while ($day <= $maxdays) { $day_of_month = mktime (0,0,0, $month, $day, $year); $date_info = getdate($day_of_month); $weekday = $date_info['wday']; $thisdate = sprintf ("%d-%02d-%02d", $year, $month, $day); // print "$thisdate $rday"; if ($nr >0 and $nr <= $n_rows and $thisdate == $rday) {//1 if ($day_of_month > $today) { print <<$day END; } else if ($day_of_month < $today) { print <<$day END; } else { print <<$day END; } if ($nr < $n_rows){$row = mysql_fetch_row($result); $rday=$row[0]; $nr++;}else{$nr++;} }//1 else {//1 if ($day_of_month == $today) {//2 print <<$day END; }//2 else {//2 print <<$day END; }//2 }//1 if ($weekday == 6 and $day < $maxdays) { print << END; $r++; // } $day++; } $j = 0; while ($j < 6-$weekday) { $j++; print << END; } while ($r < 5) // if less than 5 rows, add blank rows { print << END; $r++; } print <<
$monthtext $year
S M T W T F S
 

Legend: 13 - No reservation 14 - Past reservation(s) $tdy - Today $tdy - You have reservation(s) on today 23 - Future reservation(s)

END; if ($manage == 1) { print <<Welcome, $FirstName. Please select a date. For reservations, please click >>here. END; } else { print <<Welcome, Professor $LastName. Please select a date. For regular reservation, please click >>here. END; if ($Room == 'LLC263') { print <<

For Oral Assessment/Pairing, please click >>here.

END; } } if ($Date <> '') { list ($selectyear, $selectmonth, $selectday) = split ('-', $Date); $selectdate = mktime (0,0,0, $selectmonth, $selectday, $selectyear); $date_info = getdate($selectdate); $weekday = $date_info['wday']; $query = "SELECT OpenTime, CloseTime from SR_opentime WHERE Year = '$syear' AND Semester = '$semester' and Weekday = '$weekday'"; $result = mysql_query($query, $connection) or die ("Error in query: $query. " . mysql_error()); $row = mysql_fetch_row($result); list ($openhour, $openminute, $opensec) = split (':', $row[0]); list ($closehour, $closeminute, $closesec) = split (':', $row[1]); print << $selectmonth/$selectday $day_headings[$weekday] END; for ($i=(integer)$openhour; $i<=$closehour; $i++) { print <<$i END; } print << END; if ($openminute=='30') { print <<  END; } (integer)$j=($closehour-$openhour)*4 + ($closeminute - $openminute)/15; for ($i=0;$i<$j;$i++) { $timeslot[$i] = '0'; } // $query = "SELECT StartTime, EndTime, Status from SR_reservation WHERE RoomNo = '$Room' and Date = '$Date'"; $query = "SELECT StartTime, EndTime, Status from SR_reservation WHERE Date = '$Date' and (Status='1' or Status='2')"; // $query = "SELECT StartTime, EndTime, Status from SR_reservation WHERE RoomNo = 'LLC263' and Date = '$Date'"; if ($manage==0){$query .= " and InstructorID='$ID'";} if ($manage==1){$query .= " and RoomNo='$Room'";} $result = mysql_query($query, $connection) or die ("Error in query: $query. " . mysql_error()); while ($row = mysql_fetch_row($result)) { // print "$row[0],$row[1],$row[2],"; list ($starthour, $startminute, $startsec) = split (':', $row[0]); list ($endhour, $endminute, $endsec) = split (':', $row[1]); if ($starthour>$openhour or ($starthour=$openhour and $startminute>=$openminute)) { (integer)$m=($starthour-$openhour)*4 + ($startminute - $openminute)/15; (integer)$n=($endhour-$starthour)*4 + ($endminute - $startminute)/15; } else { $m=0; (integer)$n=($endhour-$openhour)*4 + ($endminute - $openminute)/15; } // print "$m,$n"; for ($i=$m;$i<$m+$n;$i++) { $timeslot[$i] = $row[2]; } } for ($i=0;$i<$j;$i++) { if ($timeslot[$i] == '1' or $timeslot[$i] == '2') { print <<  END; } else { print <<  END; } } print <<
Open time: $openhour:$openminute - $closehour:$closeminute
END; if ($Type == 'c') { $ID = $_GET['id']; $query = "SELECT Title, Date, StartTime, SR_reservation.EndTime, CourseID, FirstName, LastName, SR_reservation.ClassID, SR_reservation.RoomNo, Home, Cell, Extension, Email, SR_reservation.StudentNum, Tasks, SpecialNeeds, CourseTitle, Days, SR_course.BeginTime, SR_course.EndTime, SR_reservation.InstructorID, SR_reservation.Memo from SR_reservation, SR_instructor, SR_course, SR_room WHERE Date = '$Date' and "; $query .= "SR_reservation.InstructorID='$ID' AND "; $query .= "SR_reservation.Status='3' and SR_reservation.RoomNo=SR_room.RoomNo and SR_reservation.ClassID=SR_course.ClassID and SR_reservation.InstructorID=SR_instructor.InstructorID and CONCAT(SR_course.Semester, ' ', SR_course.Year) = '$Semester' order by StartTime"; print <<Cancelled Reservation END; } else if ($Type == 'a') { $ID = $_GET['id']; $query = "SELECT Title, Date, StartTime, SR_reservation.EndTime, CourseID, FirstName, LastName, SR_reservation.ClassID, SR_reservation.RoomNo, Home, Cell, Extension, Email, SR_reservation.StudentNum, Tasks, SpecialNeeds, CourseTitle, Days, SR_course.BeginTime, SR_course.EndTime, SR_reservation.InstructorID, SR_reservation.Memo from SR_reservation, SR_instructor, SR_course, SR_room WHERE Date = '$Date' and"; $query .= "SR_reservation.InstructorID='$ID' AND "; $query .= "SR_reservation.Status='4' and SR_reservation.RoomNo=SR_room.RoomNo and SR_reservation.ClassID=SR_course.ClassID and SR_reservation.InstructorID=SR_instructor.InstructorID and CONCAT(SR_course.Semester, ' ', SR_course.Year) = '$Semester' order by StartTime"; print <<Absent Reservation END; } else { $query = "SELECT Title, Date, StartTime, SR_reservation.EndTime, CourseID, FirstName, LastName, SR_reservation.ClassID, SR_reservation.RoomNo, Home, Cell, Extension, Email, SR_reservation.StudentNum, Tasks, SpecialNeeds, CourseTitle, Days, SR_course.BeginTime, SR_course.EndTime, SR_reservation.InstructorID, SR_reservation.Memo from SR_reservation, SR_instructor, SR_course, SR_room WHERE Date = '$Date' and "; if ($manage==0){$query .= "SR_reservation.InstructorID='$ID' AND ";} if ($manage==1){$query .= "SR_reservation.RoomNo='$Room' and ";} $query .= "(SR_reservation.Status='1' or SR_reservation.Status='2') and SR_reservation.RoomNo=SR_room.RoomNo and SR_reservation.ClassID=SR_course.ClassID and SR_reservation.InstructorID=SR_instructor.InstructorID and CONCAT(SR_course.Semester, ' ', SR_course.Year) = '$Semester' order by StartTime"; } $result = mysql_query($query, $connection) or die ("Error in query: $query. " . mysql_error()); while ($row = mysql_fetch_row($result)) { list ($year, $month, $day) = split ('-', $row[1]); list ($sh, $sm, $ss) = split (':', $row[2]); list ($eh, $em, $es) = split (':', $row[3]); $HTMLtasks = str_replace("\n","
",$row[14]); $HTMLneeds = str_replace("\n","
",$row[15]); $HTMLmemo = str_replace("\n","
",$row[21]); print << END; } else { print << END; } print <<
Number of Students:
END; if ($Type != 'c') { print << END; } print <<
END; /* Cancel this reservation
Date:
$month/$day/$year
Room:
$row[0] - $row[8]
Start:
$sh:$sm
End:
$eh:$em
Class:
$row[7] - $row[4] -- $row[16]   $row[17]   From $row[18] to $row[19]
Instructor:
END; if ($manage == 1) { print <<$row[5] $row[6]$row[13]
Email:
$row[12]
Extension:
$row[11]
Home Phone:
$row[9]
Cell Phone:
$row[10]
Tasks:
$HTMLtasks
Brief Lesson Plan:
$HTMLneeds
Memo:
$HTMLmemo
Cancel this reservation Edit this reservation
Edit this reservation */ } } print <<
END; ?>
dired link