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
    $errNum = mysqli_errno($link);
    $errMsg = mysqli_error($link);
    print " ERROR - could not register selection: ErrNo=" . $errNum . ": " . $errMsg . "\n";
    exit;
}
$statement->bind_result($Email, $pref1, $pref2, $pref3);
$empty = true;
print 'Your registered TA preferences are:';
print ' ';
while ($statement->fetch()) {
    $empty = false;
    print '</p><p>';
    $task1 = new TeachingTask($pref1);
    print '&nbsp;&nbsp; 1: ';
    $task1->printTaTask();
    // print '<br>';
    $task2 = new TeachingTask($pref2);
    print '&nbsp;&nbsp; 2: ';
    $task2->printTaTask();
    // print '<br>';
    $task3 = new TeachingTask($pref3);
    print '&nbsp;&nbsp; 3: ';
    $task3->printTaTask();
    // print '<br>';
    print '</p> ';
}
if ($empty) {
    print 'EMPTY.</p>';
}
print '</article>' . "\n";
include "app/views/ta/footer.php";
Ejemplo n.º 3
0
$db = Dbc::getReader();
$students = $db->query("select * from Students where Email = '{$email}'");
$student = '';
foreach ($students as $key => $row) {
    $student = Student::fromRow($row);
}
// connect to our database
$link = getLink();
$tables = findTables($link, 'Assignments');
print '<article class="page">' . "\n";
print "<hr>\n";
//print "<h1>TA Summary Page</h1>\n";
$student->printSummary();
print "\n";
print "<hr>\n";
// loop through all assignment tables and find our candidate
print '<ul>';
foreach ($tables as $key => $table) {
    $query = "select * from " . $table . " where Person='" . $email . "'";
    $statement = $link->prepare($query);
    $statement->execute();
    $statement->bind_result($taskId, $person);
    while ($statement->fetch()) {
        print '<li>';
        $task = new TeachingTask($taskId);
        $task->printTaskWithLink();
    }
}
print '</ul>';
print '</article>' . "\n";
include "app/views/admin/footer.php";
Ejemplo n.º 4
0
function printTeachers($link, $table, $courses)
{
    // show all assignments
    $query = "select Person,Task from {$table} where Task like '%-Lec-%' 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($email, $task);
    $list = "";
    while ($statement->fetch()) {
        $myTask = new TeachingTask($task);
        $number = $myTask->getCourse();
        foreach ($courses as $key => $course) {
            if ($course == $number) {
                print " {$course} --> {$email}<br>\n";
                if ($list == "") {
                    $list = "{$email}";
                } else {
                    $list = "{$list},{$email}";
                }
                break;
            }
            //else
            //  print " NO MATCH -- Course: $course --> $email<br>\n";
        }
    }
    print " ALL: {$list}<br>\n";
    return;
}
Ejemplo n.º 5
0
print "<th>&nbsp; Email &nbsp;</th>";
print "<th>&nbsp; Preference 1 &nbsp;</th>";
print "<th>&nbsp; Preference 2 &nbsp;</th>";
print "<th>&nbsp; Preference 3 &nbsp;</th>";
print "</tr>\n";
$empty = true;
foreach ($preferences as $email => $preference) {
    $empty = false;
    if (array_key_exists($email, $students)) {
        $student = $students[$email];
        $name = "{$student->lastName}, {$student->firstName}";
    } else {
        $name = "<b>NO NAME FOUND IN DATABASE - FIX IT!</b>";
    }
    $task1 = new TeachingTask($preference->pref1);
    $task2 = new TeachingTask($preference->pref2);
    $task3 = new TeachingTask($preference->pref3);
    print "<tr>";
    print "<td>&nbsp; {$name} &nbsp;</td>";
    print "<td>&nbsp; {$email} &nbsp;</td>";
    print "<td>&nbsp; " . $task1->getTaTask() . " &nbsp;</td>";
    print "<td>&nbsp; " . $task2->getTaTask() . " &nbsp;</td>";
    print "<td>&nbsp; " . $task3->getTaTask() . " &nbsp;</td>";
    print "</tr>\n";
}
print "</table>\n";
if ($empty) {
    print ' No preferences found in this term.';
}
print '</article>' . "\n";
include "app/views/admin/footer.php";
Ejemplo n.º 6
0
print '<article class="page">' . "\n";
print "<hr>\n";
print "<h1>Course Task Summary Page</h1>\n<h2>{$number} {$courseName}</h2>";
print "<hr>\n";
print '<table>';
foreach ($tables as $key => $table) {
    $query = "select * from " . $table . " where Task like '%-" . $number . "-Ta%'";
    $statement = $link->prepare($query);
    $statement->execute();
    $statement->bind_result($taskId, $person);
    while ($statement->fetch()) {
        $name = "";
        if (!isset($names[$person])) {
            if ($person == '') {
                $name = 'NOT ASSIGNED';
            } else {
                print " person not found: {$person}<br>\n";
            }
        } else {
            $name = $names[$person];
        }
        // print the result
        print '<tr><td>' . $name . '&nbsp;</td><td>&nbsp;' . '<a href="/showTaSummary?email=' . $person . '">' . $person . '</a>&nbsp;</td><td>';
        $task = new TeachingTask($taskId);
        $task->printTask();
        print "</td></tr>\n";
    }
}
print '</table>';
print '</article>' . "\n";
include "app/views/admin/footer.php";
Ejemplo n.º 7
0
// find the active Assignment table
$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";