Permalink
Browse files

Merge branch 'newcoursedump'

  • Loading branch information...
2 parents 2c35474 + 8ea5792 commit 5c4a6bbb7e45c616e2154e0536a354565f807960 @benrr101 committed Apr 27, 2012
Showing with 598 additions and 362 deletions.
  1. +3 −1 browse.php
  2. +0 −5 index.php
  3. +13 −2 js/browse.js
  4. +8 −1 js/browseAjax.php
  5. +574 −0 tools/processDump.php
  6. +0 −342 tools/scrape.php
  7. +0 −11 tools/truncate20103.sql
View
@@ -80,7 +80,9 @@ function getQuarterType($quarter) {
<div class="item school">
<button>+</button>
<input type='hidden' value="<?= $school['id'] ?>" />
- <?= $school['id'] ?> - <?= $school['title'] ?>
+ <?= $school['id'] ?>
+ <?= ($quarter > 20130 ? "({$school['code']})" : "") ?>
+ - <?= $school['title'] ?>
</div>
<?
}
View
@@ -18,11 +18,6 @@
require "./inc/header.inc";
?>
-<div class='notice'>
- <span style='font-weight:bold'>Notice:</span>
- Course information for Fall 2012/2013 is not yet available. We are currently
- working hard to get this information as soon as possible.
-</div>
<div id="mainMenu">
<div class='navItem'>
<a href='generate.php'><img src='img/calendar.png' alt='Make a Schedule'></a>
View
@@ -205,6 +205,10 @@ function schoolOnExpand(obj) {
var p = obj.parent();
var input = obj.next();
+ // Snag the quarter for use in the query and determining whether to show
+ // department codes
+ var quarter = $("#quarterSelect").val().match(/=(\d{5})/)[1];
+
// If the department already exists, then don't do the post resquest
if(p.children().last().hasClass("subDivision")) {
p.children().last().slideDown();
@@ -221,7 +225,7 @@ function schoolOnExpand(obj) {
.appendTo(p);
// Do an ajax call for the departments within this school
- $.post("js/browseAjax.php", {'action': 'getDepartments', 'school': input.val()}, function(data) {
+ $.post("js/browseAjax.php", {'action': 'getDepartments', 'school': input.val(), 'quarter':quarter }, function(data) {
try {
data = eval("(" + data + ")");
} catch(e) {
@@ -239,8 +243,15 @@ function schoolOnExpand(obj) {
// No errors! Now we need to add a div for each department
for(i=0; i < data.departments.length; i++) {
+ var code;
+ if(quarter > 20130) {
+ code = (data.departments[i].code.length) ? " (" + data.departments[i].code + ")" : "";
+ } else {
+ code = "";
+ }
+
div = $("<div>").addClass("item")
- .html(" " + data.departments[i].id + " - " + data.departments[i].title);
+ .html(" " + data.departments[i].id + code + " - " + data.departments[i].title);
$("<input>").attr("type", "hidden")
.val(data.departments[i].id)
.prependTo(div);
View
@@ -60,8 +60,15 @@
die(json_encode(array("error" => "argument", "msg" => "You must provide a school")));
}
+ // Verify that we have a quarter to make sure there are
+ // courses in the department.
+ if(empty($_POST['quarter']) || !is_numeric($_POST['quarter'])) {
+ die(json_encode(array("error" => "argument", "msg" => "You must provide a quarter")));
+ }
+
// Do the query
- $query = "SELECT title, id FROM departments WHERE school = {$_POST['school']} ORDER BY id";
+ $query = "SELECT title, id, code FROM departments WHERE school = {$_POST['school']}";
+ $query .= " AND (SELECT COUNT(*) FROM courses WHERE department=departments.id AND quarter={$_POST['quarter']}) > 1 ORDER BY id";
$result = mysql_query($query);
if(!$result) {
die(json_encode(array("error" => "mysql", "msg" => mysql_error())));
Oops, something went wrong.

0 comments on commit 5c4a6bb

Please sign in to comment.