function getMeetings() { $xml = bbb_wrap_simplexml_load_file(getURLMeetings()); if ($xml && $xml->returncode == 'SUCCESS') { if ($xml->messageKey) return ($xml->message->asXML()); ob_start(); echo '<meetings>'; if (count($xml->meetings) && count($xml->meetings->meeting)) { foreach ($xml->meetings->meeting as $meeting) { echo '<meeting>'; echo getMeetingInfo($meeting->meetingID, $meeting->moderatorPW); echo '</meeting>'; } } echo '</meetings>'; return (ob_get_clean()); } else return (false); }
/** * Retrieves a course specified by very specific descriptors. The resulting * array will contain all the information needed for the course: title, * instructor, enrollment, times[building, room, day, start, end]. * @param int $term The quarter that the course is in * @param int $dept The department the course is in * @param int $courseNum The course number * @param int $sectNum The section number of the course * @throws Exception Thrown if a database error occurs, the course * could not reliably be determined, or the course * does not exist "type:msg" * @return array Course formatted into array as described above */ function getCourse($term, $dept, $courseNum, $sectNum) { // Build the query if ($term > 20130) { $query = "SELECT s.id,\n (CASE WHEN (s.title != '') THEN s.title ELSE c.title END) AS title,\n s.instructor, s.curenroll, s.maxenroll, s.type, d.code AS department, c.course, c.credits, s.section\n FROM sections AS s\n JOIN courses AS c ON c.id=s.course\n JOIN departments AS d ON d.id=c.department\n WHERE c.quarter = '{$term}'\n AND d.code = '{$dept}'\n AND c.course = '{$courseNum}' AND s.section = '{$sectNum}'"; } else { $query = "SELECT s.id,\n (CASE WHEN (s.title != '') THEN s.title ELSE c.title END) AS title,\n s.instructor, s.curenroll, s.maxenroll, s.type, d.number AS department, c.course, c.credits, s.section\n FROM sections AS s\n JOIN courses AS c ON c.id=s.course\n JOIN departments AS d ON d.id=c.department\n WHERE c.quarter = '{$term}'\n AND d.number = '{$dept}'\n AND c.course = '{$courseNum}' AND s.section = '{$sectNum}'"; } // Execute the query and error check $result = mysql_query($query); if (!$result) { throw new Exception("mysql:" . mysql_error()); } elseif (mysql_num_rows($result) > 1) { throw new Exception("ambiguous:{$term}-{$dept}-{$courseNum}-{$sectNum}"); } elseif (mysql_num_rows($result) == 0) { throw new Exception("objnotfound:{$term}-{$dept}-{$courseNum}-{$sectNum}"); } return getMeetingInfo(mysql_fetch_assoc($result)); }