예제 #1
0
    $s = explode('=', $_POST['section']);
    if (!(count($mta) == 1 || count($c) == 3 || count($s) == 1)) {
        //make a record of this matching.
        $error = force_match($_SESSION['dept'], $_SESSION['year'], $_SESSION['season'], $mta[1], $c[0], $s[3]);
        $status = array();
        if (isset($error)) {
            $status = array("error-message", $error);
        }
    }
    unset($_SESSION['course']);
    unset($_SESSION['section']);
}
if (isset($_POST['mremove'])) {
    $l = explode("|", $_POST['tamatch']);
    //remove this record from the db.
    drop_match($l[0], $l[1], $l[2], $_SESSION['dept'], $_SESSION['year'], $_SESSION['season']);
}
if (isset($_GET['course'])) {
    $_SESSION['course'] = $_GET['course'];
}
if (isset($_GET['section'])) {
    $_SESSION['section'] = $_GET['section'];
}
staffheader($_SESSION['name'], "conflicts.php", $_SESSION['year'], $_SESSION['season_name'], $_SESSION['season']);
?>


<div style="width: 100%;"> <!-- FULL DOC-->

<h5 style="margin-left:25%; margin-right:25%">If you would like to add in constraints of your own, the tools below will allow you to either force a TA to teach a course or add conflicts between TAs and professors:</h5>
<?php 
예제 #2
0
function force_checks($dept, $year, $season)
{
    //something important just happened, and we want to make the constraints are still valid.
    //the plan: take all force matches, drop them, and re-add them.
    $db = new PDO(DB_PATH, DB_LOGIN, DB_PW);
    $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    //first see if TA is in the database under your department
    $sql = "SELECT * FROM force_match  WHERE department = '{$dept}' AND quarter_year = {$year}\n                                      AND quarter_season = {$season};";
    $matches = array();
    try {
        $result = $db->query($sql);
        foreach ($result as $r) {
            array_push($matches, $r);
        }
    } catch (PDOException $e) {
        echo $e->getMessage();
    }
    foreach ($matches as $r) {
        //drop and add.
        drop_match($r['sid'], $r[course], $r[section], $r[department], $r[quarter_year], $r[quarter_season]);
        force_match($r[department], $r[quarter_year], $r[quarter_season], $r['sid'], $r[course], $r[section]);
    }
}