function __construct($crn, $begin_change, $end_change, $day_change = '') { // precondition check on begin and end times if (intval($begin_change) >= intval($end_change)) { throw new BadTimeSemanticException("begin time must be earlier than end time"); } // this is the change description for the section (potentially) $this->desc = array($begin_change, $end_change, $day_change); // look up the section by CRN; use the selected term code $use_term = self::$term_id; $opt = self::$term_id != '' ? "AND term_code = {$use_term}" : ""; $q = new DBQuery("SELECT id, begin_time, end_time, dow FROM banner.section WHERE crn = {$crn} {$opt};"); if ($q->is_empty()) { throw new SectionNotFoundException(); } if ($q->get_row_cnt() > 1) { // this should not occur given preconditions of the database throw new HandlerException("more than one section found given input CRN"); } // remember important attributes about the section $row = $q->get_next_row(); // the query should have only retrieved one query $this->sid = $row[0]; $this->curdesc = array($row[1], $row[2], $row[3]); // if no dow was supplied in the section change description, then use the current dow for the course // this is important as it allows a correct REGEX to be generated by 'generate_sql_where_dow_overlap' if ($day_change == '') { $this->desc[2] = $this->curdesc[2]; } }
<body> <center> <?php include_once "{$_SERVER['DOCUMENT_ROOT']}/php-bin/libquery.php"; if (!isset($_GET) || !array_key_exists('noBackLink', $_GET) || $_GET['noBackLink'] == 'false') { echo "<a style= \"margin-top:10px;margin-left:10px;\" class=\"pure-button pure-button-primary\" href=\"/index.html\">Banner Main</a></div>"; } if (!isset($_GET) || !array_key_exists('bannerid', $_GET)) { echo "<p><strong>Bad request</strong></p>\n"; } else { $bannerid = $_GET['bannerid']; if (!is_numeric($bannerid)) { echo "<p>{$bannerid} is not a valid Banner ID</p>"; exit(0); } $student = new DBQuery("SELECT last_name, first_name FROM banner.student WHERE banner.student.id = {$bannerid};"); if ($student->get_row_cnt() == 0) { echo "<p>No results for Banner ID={$bannerid}</p>"; exit(0); } $row = $student->get_next_row(); echo "<h1>Schedule listing for {$row[0]}, {$row[1]} [{$bannerid}]</h1>"; $schedule = new DBQuery("SELECT crn, subject_code, number, title, begin_time, end_time, dow FROM banner.student_section INNER JOIN\nbanner.section ON banner.section.id = banner.student_section.section_id INNER JOIN banner.course ON\nbanner.section.course_id = banner.course.id INNER JOIN banner.student ON\nbanner.student_section.student_id = banner.student.id\nWHERE banner.student_section.student_id = {$bannerid}\nORDER BY course.title;"); echo $schedule->htmlitize(); } ?> </center> </body> </html>
if ($q->get_row_cnt() == 0) { echo "<p> No results found for course {$titles[$i]} {$numbers[$i]} </p>"; exit(1); } while (true) { $row = $q->get_next_row(); if ($row === false) { break; } $cids[] = $row[0]; } } $sects = array(); foreach ($cids as $id) { $q = new DBQuery("SELECT id FROM banner.section WHERE banner.section.course_id = {$id};"); if ($q->get_row_cnt() == 0) { echo "<p> No sections found for course with id={$id} </p>"; exit(1); } while (true) { $row = $q->get_next_row(); if ($row === false) { break; } $sects[] = $row[0]; } } $results = array(); foreach ($sects as $id) { $q = new DBQuery("SELECT student_id FROM banner.student_section WHERE banner.student_section.section_id = {$id};"); while (true) {