Ejemplo n.º 1
0
function getAssignments($link, $table, $divisions)
{
    // initialize data
    $semesterData = array();
    foreach ($divisions as $index => $division) {
        $semesterData[$division] = 0;
    }
    // show all assignments
    $query = "select t.Task, t.Person, s.Division from {$table} as t inner join Students as s on s.Email = t.Person order by t.Task";
    $statement = $link->prepare($query);
    $rc = $statement->execute();
    if (!$rc) {
        $errNum = mysqli_errno($link);
        $errMsg = mysqli_error($link);
        print " ERROR - could not register selection: ErrNo=" . mysqli_errno($link) . ": " . mysqli_error($link) . "\n";
        exit;
    }
    $statement->bind_result($task, $person, $division);
    while ($statement->fetch()) {
        $weight = 0;
        $myTask = new TeachingTask($task);
        if ($myTask->isTa() && $myTask->getEffort() == 'full') {
            $weight = 1.0;
        }
        if ($myTask->isTa() && $myTask->getEffort() == 'half') {
            $weight = 0.5;
        }
        $semesterData[$division] += $weight;
    }
    $statement->close();
    return $semesterData;
}
Ejemplo n.º 2
0
function showAssignment($link, $table, $option = "ALL")
{
    // show all assignments
    $query = "select * from {$table} order by Task";
    $statement = $link->prepare($query);
    $rc = $statement->execute();
    if (!$rc) {
        $errNum = mysqli_errno($link);
        $errMsg = mysqli_error($link);
        print " ERROR - could not register selection: ErrNo=" . mysqli_errno($link) . ": " . mysqli_error($link) . "\n";
        exit;
    }
    $statement->bind_result($task, $person);
    print "<table>\n";
    print "<tr><th>&nbsp; Course &nbsp;</th><th> Type &nbsp;</th><th> Effort &nbsp;</th>";
    print "<th> TA type &nbsp;</th><th> Person &nbsp;</th><th> Id &nbsp;</th></tr>\n";
    $iF = 0;
    $iP = 0;
    while ($statement->fetch()) {
        $myTask = new TeachingTask($task);
        $display = 0;
        if ($option == "ALL") {
            $display = 1;
        } else {
            if ($option == "TA" && $myTask->isTa() && $person != "" && $person != "*****@*****.**") {
                $display = 1;
            } else {
                if ($option == "Unassigned" && ($person == "" || $person == "*****@*****.**")) {
                    $display = 1;
                }
            }
        }
        if ($display) {
            print "<tr><td> " . "<a href=\"/showTaskSummary?number=" . $myTask->getCourse() . "\">" . $myTask->getCourse() . "</a>" . "&nbsp;</td><td>" . $myTask->getType() . "&nbsp;</td><td>" . $myTask->getEffort() . "&nbsp;</td><td>" . $myTask->getTaType() . "&nbsp;</td><td>" . "<a href=\"/showTaSummary?email=" . $person . "\">" . $person . "</a>" . "&nbsp;</td><td>" . $myTask->generateId() . "&nbsp;</td></tr>\n";
            if ($myTask->isTa() && $myTask->getEffort() == 'full') {
                $iF = $iF + 1;
            }
            if ($myTask->isTa() && $myTask->getEffort() == 'half') {
                $iF = $iF + 0.5;
            }
            if ($myTask->isTa() && $myTask->getEffort() == 'part') {
                $iP = $iP + 1;
            }
        }
    }
    print "</table>";
    print "<p> TA openings ({$option}): <b>{$iF}</b> (full time)  <b>{$iP}</b> (part time).</p><br> \n";
}
Ejemplo n.º 3
0
$active = findActiveTable($link, 'Assignments');
print "Active tables: {$tasTable} (TAs), {$active['0']} (Assignments)</p>";
// start the form
print '<form class="ta" action="/register" method="post">' . "\n";
// start the table
print '<p>' . "\n";
print '<table>' . "\n";
// generate the options
$options = array();
$query = "select * from {$active['0']} order by Task";
$statement = $link->prepare($query);
$statement->execute();
$statement->bind_result($task, $email);
while ($statement->fetch()) {
    $myTask = new TeachingTask($task);
    if ($myTask->isTa() && $myTask->getEffort() == 'full') {
        $option = $myTask->getTaTask();
        $find = array_search($option, $options);
        if (!$find) {
            $options[$task] = $option;
        }
    }
}
// First preference
print '<tr><td>What is your first preference?</td><td><select class="ta" name="pref1">' . "\n";
print '  <option value="">Select Preference 1</option>' . "\n";
foreach ($options as $key => $option) {
    print "<option value=\"" . $key . "\"> {$option} </option>";
}
print '</select></td></tr>' . "\n";
// Second preference