print "<th> Email </th>"; print "<th> Preference 1 </th>"; print "<th> Preference 2 </th>"; print "<th> Preference 3 </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> {$name} </td>"; print "<td> {$email} </td>"; print "<td> " . $task1->getTaTask() . " </td>"; print "<td> " . $task2->getTaTask() . " </td>"; print "<td> " . $task3->getTaTask() . " </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";
function findTaNames($link, $table) { // show all assignments $query = "select Students.FirstName, Students.LastName, {$table}.Person, {$table}.Task" . " from {$table},Students where Students.Email = {$table}.Person order by Students.LastName"; $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($firstName, $lastName, $email, $task); $i = 0; $names = ""; while ($statement->fetch()) { $myTask = new TeachingTask($task); $description = $myTask->getTaTask(); $names[$email] = $lastName . ', ' . $firstName . ' Task: ' . $description; $i = $i + 1; } return $names; }
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 $query = "select * from {$active['0']}";