AddPage(); $pdf->SetAuthor("Michael Sheldon's Timetable Generator -- http://www.mikeasoft.com/timetable"); $pdf->SetTitle("Aberystwyth Computer Science Timetable"); $pdf->SetFont('Arial', 'B', 12); $pdf->Cell(25, 7, "", 1, 0, "C"); $pdf->Cell(28, 7, "9.00 - 9.50", 1, 0, "C"); $pdf->Cell(28, 7, "10.00 - 10.50", 1, 0, "C"); $pdf->Cell(28, 7, "11.10 - 12.00", 1, 0, "C"); $pdf->Cell(28, 7, "12.10 - 13.00", 1, 0, "C"); $pdf->Cell(28, 7, "13.10 - 14.00", 1, 0, "C"); $pdf->Cell(28, 7, "14.10 - 15.00", 1, 0, "C"); $pdf->Cell(28, 7, "15.10 - 16.00", 1, 0, "C"); $pdf->Cell(28, 7, "16.10 - 17.00", 1, 0, "C"); $pdf->Cell(28, 7, "17.10 - 18.00", 1, 0, "C"); for($day = 1; $day <= 5; $day++) { $pdf->Ln(); $pdf->SetFont('Arial', 'B', 12); $pdf->Cell(25, 14, getdaystr($day), 1, 0, "C", 0); for($time = 1; $time <= 9; $time++) { $pdf->SetFont('Arial', '', 12); $query = mysql_query("SELECT * FROM times WHERE day = $day AND time = $time"); $outstr = ""; $lectures = 0; for($i = 0; $i < mysql_num_rows($query); $i++) { $id = mysql_result($query, $i, 0); if($_POST[$id]) { if(substr($id, 5, 1) != "P") { //Remove last 2 digits from all excepts practicals $id = substr($id, 0, 5); } $room = mysql_result($query, $i, 3); $outstr .= "$id $room "; $lectures += 1; } } if($lectures > 1) // Vague attempt to fit clashes in $pdf->SetFont('Arial', '', 9); $pdf->Cell(28, 14, $outstr, 1, 0, "C", 0); } } $pdf->Ln(); $pdf->Ln(); $pdf->Cell(150, 7, "P = Practicals"); $pdf->Cell(150, 7, "G4 is located in the Cledwyn Building"); $pdf->Ln(); $pdf->Cell(150, 7, "B34 (Biology Main), B46 & G22 are lcoated in the Edward Llwyd Building"); $pdf->Cell(150, 7, "B23, B57, C56 & C57 are labs located in the Llandinam Building"); $pdf->Ln(); $pdf->Cell(150, 7, "A6, B20, B22 & G3 are located in the Llandinham Building"); $pdf->Cell(150, 7, "Digital Systems Lab (DSL) is located in Physics"); $pdf->Ln(); $pdf->Cell(300, 7, "PM (Physics Main), PA (Physics A), PB (Physics B), 317, 318, 319 & 320 are located in the Physical Sciences Building"); $pdf->Ln(); $pdf->Cell(300, 7, "A12, A14, C4, C22, C43, C165, D5, D54 & D59 are located in the Hugh Owen Building"); $pdf->Output(); die(); } ?> Aberystwyth CompSci Timetable Generator

Aber CompSci Timetable Generator

Michael Sheldon (mike at mikeasoft dot com)

"; for($time = 1; $time <= 9; $time++) { echo ""; } echo ""; } ?>
9.00 - 9.5010.00 - 10.5011.10 - 12.0012.10 - 1.001.10 - 2.002.10 - 3.003.10 - 4.004.10 - 5.005.10 - 6.00
" . getdaystr($day) . ""; $query = mysql_query("SELECT * FROM times WHERE day = $day AND time = $time"); $lectures = 0; for($i = 0; $i < mysql_num_rows($query); $i++) { $id = mysql_result($query, $i, 0); if($_POST[$id]) { $query2 = mysql_query("SELECT name FROM modules WHERE id = '$id'"); $name = mysql_result($query2, 0, 0); if(substr($id, 5, 1) != "P") { //Remove last 2 digits from all except Practicals $id = substr($id, 0, 5); } $room = mysql_result($query, $i, 3); $lectures++; if($lectures > 1) { echo "$id $room
"; $clashes = true; } else echo "$id $room
"; } } echo "
One or more clashes were detected, they have been marked in italics.

"; ?>

All data is currently for Semester 2 2006. Select your modules to generate your timetable:

"; for($year = 1; $year <= 4; $year++) { $query = mysql_query("SELECT * FROM modules WHERE year = $year ORDER BY id") or die("Could not get data."); if(mysql_num_rows($query) > 0) { echo "

Year $year

"; } for($i = 0; $i < mysql_num_rows($query); $i++) { $id = mysql_result($query, $i, 0); $name = mysql_result($query, $i, 1); echo "$id - $name
"; } } ?>
Language:
English
Welsh

I can't guarantee this will be 100% correct or up to date so anyone using it might want to double check their results (and feel free to email me any corrections).