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];