Example #1
0
<?php

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\LTIX;
headerJson();
// Sanity checks
$LTI = LTIX::requireData();
if (!$USER->instructor) {
    die("Requires instructor");
}
$p = $CFG->dbprefix;
$assn = loadAssignment($LTI);
$assn_json = null;
$assn_id = false;
if ($assn === false) {
    die("Not a peer-graded assignment");
} else {
    $assn_json = json_decode($assn['json']);
    $assn_id = $assn['assn_id'];
}
// Check how much work we have to do
$row = $PDOX->rowDie("SELECT COUNT(submit_id) AS count FROM {$p}peer_submit AS S\n    WHERE assn_id = :AID AND regrade IS NULL", array(":AID" => $assn_id));
$total = $row['count'];
echo json_encode(array("total" => $total));
Example #2
0
require_once "../../config.php";
require_once $CFG->dirroot . "/pdo.php";
require_once $CFG->dirroot . "/lib/lms_lib.php";
require_once $CFG->dirroot . "/core/blob/blob_util.php";
require_once "peer_util.php";
use Tsugi\UI\Table;
use Tsugi\Core\LTIX;
// Sanity checks
$LTI = LTIX::requireData();
if (!$USER->instructor) {
    die("Requires instructor role");
}
$p = $CFG->dbprefix;
// Load the assignment data
$row = loadAssignment($LTI);
$assn_json = json_decode($row['json']);
// Gets counts and max of the submissions
$query_parms = array(":LID" => $LINK->id);
$orderfields = array("S.user_id", "displayname", "email", "S.updated_at", "user_key", "max_score", "scores", "flagged", "min_score", "inst_points");
$searchfields = array("S.user_id", "displayname", "email", "S.updated_at", "user_key");
// Load up our data dpending on the kind of assessment we have
$inst_points = $assn_json->instructorpoints > 0 ? "inst_points, " : "";
$max_min_scores = $assn_json->peerpoints > 0 ? "MAX(points) as max_score, MIN(points) AS min_score," : "";
$count_scores = $assn_json->maxassess > 0 ? "COUNT(points) as scores," : "";
$sql = "SELECT S.user_id AS user_id, displayname, email, S.submit_id as _submit_id,\n        {$max_min_scores}\n        {$count_scores}\n        {$inst_points} \n        COUNT(DISTINCT flag_id) as flagged,\n        MAX(S.updated_at) AS updated_at, user_key\n    FROM {$p}peer_assn AS A JOIN {$p}peer_submit as S\n        ON A.assn_id = S.assn_id\n    LEFT JOIN {$p}peer_grade AS G\n        ON S.submit_id = G.submit_id\n    LEFT JOIN {$p}peer_flag AS F\n        ON S.submit_id = F.submit_id\n    JOIN {$p}lti_user AS U\n        ON S.user_id = U.user_id\n    WHERE A.link_id = :LID\n    GROUP BY S.submit_id";
// View
$OUTPUT->header();
$OUTPUT->bodyStart();
$OUTPUT->flashMessages();
$OUTPUT->welcomeUserCourse();