function loadAssignment($LTI) { global $CFG, $PDOX; $cacheloc = 'peer_assn'; $row = Cache::check($cacheloc, $LTI['link_id']); if ($row != false) { return $row; } $stmt = $PDOX->queryDie("SELECT assn_id, json FROM {$CFG->dbprefix}peer_assn WHERE link_id = :ID", array(":ID" => $LTI['link_id'])); $row = $stmt->fetch(PDO::FETCH_ASSOC); $row['json'] = upgradeSubmission($row['json']); Cache::set($cacheloc, $LTI['link_id'], $row); return $row; }
require_once "../../config.php"; require_once $CFG->dirroot . "/pdo.php"; require_once $CFG->dirroot . "/lib/lms_lib.php"; require_once "peer_util.php"; use Tsugi\Core\Cache; use Tsugi\Core\LTIX; // Sanity checks $LTI = LTIX::requireData(); // Model $p = $CFG->dbprefix; if (isset($_POST['json'])) { $json = $_POST['json']; if (get_magic_quotes_gpc()) { $json = stripslashes($json); } $json = json_decode(upgradeSubmission($json)); if ($json === null) { $_SESSION['error'] = "Bad JSON Syntax"; header('Location: ' . addSession('configure.php')); return; } // Some sanity checking... if ($json->totalpoints < 1) { $_SESSION['error'] = "totalpoints is required and must be > 1"; header('Location: ' . addSession('configure.php')); return; } if ($json->instructorpoints + $json->peerpoints + $json->assesspoints * $json->minassess != $json->totalpoints) { $_SESSION['error'] = "instructorpoints + peerpoints + (assesspoints*minassess) != totalpoints "; header('Location: ' . addSession('configure.php')); return;