Esempio n. 1
0
$empty = true;
$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 preference table
$activeTables = new ActiveTables($db);
$preferenceTable = $activeTables->getUniqueMatchingName('Preferences');
// do the query
$nTas = 0;
$preferences = "";
$rows = $db->query("select * from {$preferenceTable}");
foreach ($rows as $key => $row) {
    $preference = Preference::fromRow($row);
    $preferences[$preference->email] = $preference;
    $nTas = $nTas + 1;
}
// start page
print '<article class="page">' . "\n";
print '<h1>All Active TA Preferences</h1>' . "\n";
print "<p>Number of TAs with registered preferences: {$nTas}</p>\n";
print "\n";
// print table header
print "<table>\n";
print "<tr>";
print "<th>&nbsp; Name &nbsp;</th>";
print "<th>&nbsp; Email &nbsp;</th>";
print "<th>&nbsp; Preference 1 &nbsp;</th>";
print "<th>&nbsp; Preference 2 &nbsp;</th>";