Exemplo n.º 1
0
include "app/views/teacher/header.php";
include_once "app/models/TeachingTask.php";
// make sure we have a registered TA
if (!(isTeacher() || isMaster())) {
    exitAccessError();
}
print '<article class="page">' . "\n";
print '<h1>Select the TA</h1>' . "\n";
print ' ' . "\n";
// connect to our database
$link = getLink();
// find the active table
$active = findActiveTable($link, 'Evaluations');
print "Active evaluations table: {$active['0']}</p>";
$term = substr($active[0], -5, 5);
$options = findTaNames($link, 'Assignments' . $term);
// start the form
print '<p>';
print '<form action="/enterEvaluation" method="post">' . "\n";
// Select TA
print 'Select the student to evaluate.';
print '  <select class="ta" name="ta">' . "\n";
print '  <option value="">Select student to evaluate</option>' . "\n";
foreach ($options as $key => $option) {
    print "<option value=\"" . $key . "\"> {$option} </option>";
}
print '  </select>' . "\n";
print '  <input type="submit" value="select this student" />' . "\n";
print '</form>' . "\n";
print '</p>' . "\n";
print '</article>' . "\n";
Exemplo n.º 2
0
}
print ' Term valid.<br>';
// find the tables
$evaluationsTable = 'Evaluations' . $term;
//print " Evaluations from $evaluationsTable.<br>";
$assignmentsTable = 'Assignments' . $term;
//print " Assignments from $assignmentsTable.<br>";
// find teacher and TA
$teachers = findTeacherNames($link);
if (!isset($teachers[$teacherEmail])) {
    // check if this is a valid teacher (Faculties table)
    print ' EXIT - teacher email is not valid.';
    exitParameterError($teacherMail);
}
print ' Teacher valid.<br>';
$tas = findTaNames($link, $assignmentsTable);
if (!isset($tas[$taEmail])) {
    print ' EXIT - ta email is not valid.';
    exitParameterError($taMail);
}
print ' TA valid.<br>';
// test whether evaluation is valid
if ($teacherEmail != "" && $taEmail != "" && $evaluation != "") {
    print '<p>Evaluation is valid.<br>';
    // do we update or is it a new entry
    $query = "select TeacherEmail,TaEmail from {$evaluationsTable} " . "where TeacherEmail='{$teacherEmail}' and TaEmail='{$taEmail}'";
    $statement = $link->prepare($query);
    $rc = $statement->execute();
    if (!$rc) {
        $errNum = mysqli_errno($link);
        $errMsg = mysqli_error($link);