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]; } }
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('crn', $_GET)) { echo "<p><strong>Bad request</strong></p>\n"; exit(0); } $crn = $_GET['crn']; if (!is_numeric($crn)) { echo "<p>{$crn} is not a valid CRN value</p>"; exit(0); } // get the course title information $q1 = new DBQuery("SELECT subject_code, number, title, begin_time, end_time, dow, first_name, last_name FROM banner.course\nINNER JOIN banner.section ON section.course_id = course.id AND crn={$crn}\nINNER JOIN banner.professor ON professor.id = professor_id;"); if ($q1->is_empty()) { echo "<p>No results for CRN={$crn}</p>"; exit(0); } $heading = $q1->get_next_row(); $q2 = new DBQuery("SELECT student.id, first_name, middle_name, last_name, classification FROM banner.section\nINNER JOIN banner.student_section ON crn={$crn} AND section.id = section_id\nINNER JOIN banner.student ON student_id = student.id\nORDER BY student.classification, last_name;"); if ($q2->is_empty()) { // section shouldn't be empty echo "<p>No students where associated with the specified section</p>"; exit(0); } echo "<h1>Section listing for {$heading[0]} {$heading[1]} {$heading[2]} [CRN={$crn}]</h1>" . "<h2>Start Time: {$heading[3]}<br />End Time: {$heading[4]}<br />Meeting Days: {$heading[5]}<br />Professor: {$heading[6]} {$heading[7]}</h2>" . $q2->htmlitize(); ?> </center></body> </html>