Exemple #1
0
// read complete students table
$students = "";
$rows = $db->query("select * from Students order by lastName");
foreach ($rows as $key => $row) {
    $student = Student::fromRow($row);
    $students[$student->email] = $student;
}
// find active Ta table
$activeTables = new ActiveTables($db);
$taTable = $activeTables->getUniqueMatchingName('Tas');
// do the query
$rows = $db->query("select Email, Fulltime, PartTime from {$taTable} order by Email");
$i = 0;
$tas = "";
foreach ($rows as $key => $row) {
    $ta = Ta::fromRow($row);
    $tas[$i] = $ta;
    $i = $i + 1;
}
$nTas = $i;
print "<article class=\"page\">\n";
print "<h1>Show Active TAs</h1>\n";
print "<p>Active assignment table: {$taTable}";
print " with {$nTas} Tas.</p>";
print "<hr>\n";
print "<table>\n";
// loop through all active TAs
$first = true;
foreach ($tas as $key => $ta) {
    if (isset($students[$ta->email])) {
        $student = $students[$ta->email];
Exemple #2
0
    $taTable = $activeTables->getUniqueMatchingName('Tas');
    // do the query
    $rows = $db->query("select Email, Fulltime, PartTime from {$taTable} order by Email");
    $i = 0;
    $tas = "";
    foreach ($rows as $key => $row) {
        $ta = Ta::fromRow($row);
        // checking whether proposed TA is in the list already
        if ($ta->email == $email) {
            $new = false;
        }
        $tas[$i] = $ta;
        $i = $i + 1;
    }
    $nTas = $i;
    print "<p>Active assignment table: {$taTable} with {$nTas} Tas.</p>";
    if ($new) {
        print "<p>New TA will be added: {$email}</p>\n";
        $ta = Ta::fresh();
        $ta->email = $email;
        $ta->fullTime = 1;
        $ta->partTime = 0;
        $ta->addToDb($db, $taTable);
    } else {
        print "<p>Proposed TA is already in our list: {$email}</p>\n";
    }
    $student->printSummary();
    print "<br>\n";
}
print '</article>' . "\n";
include "app/views/admin/footer.php";