} $PDOX->queryDie("\n INSERT INTO {$p}peer_text\n (assn_id, user_id, data, created_at, updated_at)\n VALUES ( :AID, :UID, :DATA, NOW(), NOW() )", array(':AID' => $assn_id, ':DATA' => $code, ':UID' => $USER->id)); $code_ids[] = $PDOX->lastInsertId(); } } } $partno++; } $submission = new stdClass(); $submission->notes = $_POST['notes']; $submission->blob_ids = $blob_ids; $submission->urls = $urls; $submission->codes = $code_ids; $json = json_encode($submission); $stmt = $PDOX->queryReturnError("INSERT INTO {$p}peer_submit\n (assn_id, user_id, json, created_at, updated_at)\n VALUES ( :AID, :UID, :JSON, NOW(), NOW())\n ON DUPLICATE KEY UPDATE json = :JSON, updated_at = NOW()", array(':AID' => $assn_id, ':JSON' => $json, ':UID' => $USER->id)); Cache::clear('peer_submit'); if ($stmt->success) { $_SESSION['success'] = 'Assignment submitted'; header('Location: ' . addSession('index.php')); } else { $_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);
// Model $p = $CFG->dbprefix; if (isset($_POST['json'])) { $json = $_POST['json']; if (get_magic_quotes_gpc()) { $json = stripslashes($json); } $json = json_decode($json); if ($json === null) { $_SESSION['error'] = "Bad JSON Syntax"; header('Location: ' . addSession('configure.php')); return; } $json = json_encode($json); $stmt = $PDOX->queryReturnError("INSERT INTO {$p}peer_assn\n (link_id, json, created_at, updated_at)\n VALUES ( :ID, :JSON, NOW(), NOW())\n ON DUPLICATE KEY UPDATE json = :JSON, updated_at = NOW()", array(':JSON' => $json, ':ID' => $LINK->id)); Cache::clear("peer_assn"); if ($stmt->success) { $_SESSION['success'] = 'Assignment updated'; header('Location: ' . addSession('index.php')); } else { $_SESSION['error'] = $stmt->errorImplode; header('Location: ' . addSession('configure.php')); } return; } // Load up the assignment $row = loadAssignment($LTI); $json = ""; if ($row !== false) { $json = $row['json']; }
$found = false; if ($our_flags != false) { foreach ($our_flags as $flag) { if ($_POST['flag_id'] == $flag['flag_id']) { $found = true; } } } if (!$found) { $_SESSION['error'] = "Flag entry not found."; header('Location: ' . addSession('index.php')); return; } $stmt = $PDOX->queryDie("DELETE FROM {$p}peer_flag\n WHERE flag_id = :FID", array(':FID' => $_POST['flag_id'])); Cache::clear('peer_flag'); Cache::clear('peer_grade'); error_log("Instructor deleted flag=" . $_POST['flag_id'] . " for " . $user_id); $_SESSION['success'] = "Flag entry deleted."; header('Location: ' . addSession('student.php?user_id=' . $user_id)); return; } // Retrieve the grades that we have given $grades_given = retrieveGradesGiven($assn_id, $user_id); // Retrieve the next and previous users for paging $sql = "(SELECT user_id, inst_points FROM {$p}peer_submit \n WHERE user_id < :UID AND assn_id = :AID ORDER BY user_id DESC LIMIT 1)\n UNION (SELECT user_id, inst_points FROM {$p}peer_submit \n WHERE user_id > :UID AND assn_id = :AID ORDER BY user_id ASC LIMIT 1)"; $rows = $PDOX->allRowsDie($sql, array(":UID" => $user_id, ":AID" => $assn_id)); // Retrieve ungraded rows in a circular manner $ungraded_rows = false; if ($assn_json->instructorpoints > 0) { $ungraded_sql = "(SELECT user_id, inst_points FROM {$p}peer_submit \n WHERE user_id > :UID AND assn_id = :AID AND inst_points IS NULL ORDER BY user_id ASC LIMIT 1)\n UNION (SELECT user_id, inst_points FROM {$p}peer_submit \n WHERE user_id != :UID AND assn_id = :AID AND inst_points IS NULL ORDER BY user_id ASC LIMIT 1)\n "; $ungraded_rows = $PDOX->allRowsDie($ungraded_sql, array(":UID" => $user_id, ":AID" => $assn_id));