function update_gradebook($gradebook_test_id, $member_id) { $sql = "SELECT id, grade_scale_id FROM %sgradebook_tests WHERE gradebook_test_id = %d"; $row = queryDB($sql, array(TABLE_PREFIX, $gradebook_test_id), TRUE); $test_id = $row["id"]; $grade_scale_id = $row["grade_scale_id"]; // get grade $grade = get_member_grade($test_id, $member_id, $grade_scale_id); if ($grade != "") { $sql = "REPLACE INTO %sgradebook_detail(gradebook_test_id, member_id, grade) VALUES (%d, %d, '%s')"; $result = queryDB($sql, array(TABLE_PREFIX, $gradebook_test_id, $member_id, $grade)); } }
function update_gradebook($gradebook_test_id, $member_id) { global $db; $sql = "SELECT id, grade_scale_id FROM " . TABLE_PREFIX . "gradebook_tests WHERE gradebook_test_id = " . $gradebook_test_id; $result = mysql_query($sql, $db) or die(mysql_error()); $row = mysql_fetch_assoc($result); $test_id = $row["id"]; $grade_scale_id = $row["grade_scale_id"]; // get grade $grade = get_member_grade($test_id, $member_id, $grade_scale_id); if ($grade != "") { $sql = "REPLACE INTO " . TABLE_PREFIX . "gradebook_detail(gradebook_test_id, member_id, grade) VALUES (" . $gradebook_test_id . ", " . $member_id . ", '" . $grade . "')"; $result = mysql_query($sql, $db) or die(mysql_error()); } }
$no_error = false; } $error_msg .= get_display_name($member_id) . ": " . $num . " times<br>"; } if (!$no_error) { $error = array('COMBINE_TESTS', $row["title"], $error_msg); $msg->addError($error); } if (!$msg->containsErrors()) { $sql = "SELECT id, grade_scale_id FROM %sgradebook_tests WHERE gradebook_test_id = %d"; $row = queryDB($sql, array(TABLE_PREFIX, $_POST["gradebook_test_id"]), TRUE); $grade_scale_id = $row["grade_scale_id"]; $sql = "SELECT m.first_name, m.last_name, m.email, e.member_id FROM %smembers m, %scourse_enrollment e WHERE m.member_id = e.member_id AND e.course_id=%d AND e.approved='y' AND e.role<>'Instructor' ORDER BY m.first_name,m.last_name"; $rows_enrolled = queryDB($sql, array(TABLE_PREFIX, TABLE_PREFIX, $_SESSION["course_id"])); foreach ($rows_enrolled as $row) { $grade = get_member_grade($_POST["test_id"], $row["member_id"], $grade_scale_id); if ($grade != "") { $students[] = check_user_info(array('member_id' => $row["member_id"], 'fname' => $row["first_name"], 'lname' => $row["last_name"], 'email' => $row["email"], 'grade' => $grade, 'gradebook_test_id' => $_POST['gradebook_test_id'])); } } if (count($students) == 0) { $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY'); header('Location: update_gradebook.php'); exit; } } else { header('Location: update_gradebook.php'); exit; } } }