Пример #1
0
<html>

  <head>
    <title> Banner - View Courses </title>
    <link rel="stylesheet" type="text/css" href="style.css">
    <link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.5.0/pure-min.css">
  </head>

  <body><center>
    <p>
<?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;margin-bottom:10px;\" class=\"pure-button pure-button-primary\" href=\"/index.html\">Banner Main</a>";
}
$query = new DBQuery("SELECT * FROM banner.course");
echo $query->htmlitize();
?>
    </p>
  </center></body>
</html>
Пример #2
0
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>
  <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>
Пример #4
0
        $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) {
        $row = $q->get_next_row();
        if ($row === false) {
            break;
        }
        if (!array_key_exists($row[0], $results)) {
            $results[$row[0]] = 1;
        } else {
            ++$results[$row[0]];
        }
    }
}
foreach (array_keys($results) as $k) {
    if ($results[$k] != count($cids)) {
        unset($results[$k]);
    }
}
$clause = "WHERE banner.student.id = ";
$clause .= implode(" OR banner.student.id = ", array_keys($results));
$q = new DBQuery("SELECT * FROM banner.student {$clause};");
echo $q->htmlitize();
?>
    </body>
</html>