exit; case "GetPattern": //returns pattern of program specified in XML format $program = $_POST['program']; header("content-type: text/xml"); $pat = new Pattern(); //Select all courses within the pattern table whose program is equal to the one specified by user $getProgramPattern = "SELECT * FROM Patterns \n\t\t\t\t\t\t\t\t\tWHERE ProgramID = '{$program}';"; $rows = $db->execute($getProgramPattern); while ($row = $rows->fetch_object()) { //Add all courses found in query to list $newItem = new PatternItem($row->ProgramID, $row->CourseType, $row->YearRequired, $row->TermRequired, $row->SubjectID, $row->CourseNumber); $pat->addItem($newItem); } //Return XML of pattern to client-side echo $pat->exportXML(); exit; case "GetPrograms": //Retrieves all academic programs in database and returns them to client-side as XML string $getPrograms = "SELECT * FROM AcademicPrograms;"; $rows = $db->execute($getPrograms); $returnval = "<programs>"; while ($row = $rows->fetch_object()) { $returnval .= "<program><ProgramID>" . $row->ProgramID . "</ProgramID>\n\t\t\t\t\t\t\t <ProgramCode>" . $row->ProgramCode . "</ProgramCode></program>"; } $returnval .= "</programs>"; header("content-type: text/xml"); echo $returnval; exit; case "GetElectives": $program = $_POST['program'];