function submit_grades($grades_id, $grades, $email = false) { global $tool_content, $langGrades, $langWorkWrongInput, $course_id; foreach ($grades as $sid => $grade) { $sid = intval($sid); $val = Database::get()->querySingle("SELECT grade from assignment_submit WHERE id = ?d", $sid)->grade; $grade_valid = filter_var($grade, FILTER_VALIDATE_FLOAT); isset($grade) && $grade_valid !== false ? $grade = $grade_valid : ($grade = NULL); if ($val != $grade) { if (Database::get()->query("UPDATE assignment_submit\n SET grade = ?d, grade_submission_date = NOW(), grade_submission_ip = ?s\n WHERE id = ?d", $grade, $_SERVER['REMOTE_ADDR'], $sid)->affectedRows > 0) { $assign_id = Database::get()->querySingle("SELECT assignment_id FROM assignment_submit WHERE id = ?d", $sid)->assignment_id; $title = Database::get()->querySingle("SELECT title FROM assignment WHERE assignment.id = ?d", $assign_id)->title; Log::record($course_id, MODULE_ID_ASSIGN, LOG_MODIFY, array('id' => $sid, 'title' => $title, 'grade' => $grade)); //update gradebook if needed $quserid = Database::get()->querySingle("SELECT uid FROM assignment_submit WHERE id = ?d", $sid)->uid; update_gradebook_book($quserid, $assign_id, $grade, 'assignment'); if ($email) { grade_email_notify($grades_id, $sid, $grade, ''); } Session::Messages($langGrades, 'alert-success'); } } } show_assignment($grades_id); }
$pageName = $langAddGrade; $navigation[] = $works_url; $navigation[] = $work_id_url; show_submission_form($id, groups_with_no_submissions($id), true); } elseif ($choice == 'plain') { show_plain_view($id); } } else { $pageName = $work_title; $navigation[] = $works_url; if (isset($_GET['disp_results'])) { show_assignment($id, true); } elseif (isset($_GET['disp_non_submitted'])) { show_non_submitted($id); } else { show_assignment($id); } } } else { $pageName = $langWorks; show_assignments(); } } else { if (isset($_REQUEST['id'])) { $id = intval($_REQUEST['id']); if (isset($_POST['work_submit'])) { $pageName = $m['SubmissionStatusWorkInfo']; $navigation[] = $works_url; $navigation[] = array('url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&id=$id", 'name' => $langWorks); submit_work($id); } else {