$_SESSION['error'] = $stmt->errorImplode; header('Location: ' . addSession('index.php')); } return; } // Check to see how much grading we have done $grade_count = 0; $to_grade = 0; if ($assn_json && $assn_json->maxassess > 0) { // See how much grading is left to do $to_grade = loadUngraded($LTI, $assn_id); // See how many grades I have done $grade_count = loadMyGradeCount($LTI, $assn_id); } // Retrieve our grades... $our_grades = retrieveSubmissionGrades($submit_id); // Handle the flag... if ($assn_id != false && $assn_json != null && is_array($our_grades) && isset($_POST['submit_id']) && isset($_POST['grade_id']) && isset($_POST['note']) && isset($_POST['doFlag']) && $submit_id == $_POST['submit_id']) { // Make sure we have a valid grade_id $found = false; foreach ($our_grades as $grade) { if ($grade['grade_id'] == $_POST['grade_id']) { $found = true; } } if (!$found) { $_SESSION['error'] = 'Cannot a grade that is not yours'; header('Location: ' . addSession('index.php')); return; } $grade_id = $_POST['grade_id'] + 0;
$result['grade'] = -1; $debug_log = array(); $status = LTIX::gradeSend($computed_grade, $result, $debug_log); // This is the slow bit if ($status === true) { $_SESSION['success'] = 'Grade submitted to server'; } else { error_log("Problem sending grade " . $status); $_SESSION['error'] = 'Error: ' . $status; } $_SESSION['debug_log'] = $debug_log; header('Location: ' . addSession('student.php?user_id=' . $user_id)); return; } // Retrieve our grades... $grades_received = retrieveSubmissionGrades($submit_id); // Handle incoming post to delete a grade entry if (isset($_POST['grade_id']) && isset($_POST['deleteGrade'])) { // Make sure this is deleting a legit grading entry... $found = false; if ($grades_received != false) { foreach ($grades_received as $grade) { if ($_POST['grade_id'] == $grade['grade_id']) { $found = true; } } } if (!$found) { $_SESSION['error'] = "Grade entry not found."; header('Location: ' . addSession('index.php')); return;