public static function gradeTable($GRADE_DETAIL_CLASS) { global $CFG, $OUTPUT, $USER, $LINK; // Require CONTEXT, USER, and LINK $LAUNCH = LTIX::requireData(); if (!$USER->instructor) { die("Requires instructor role"); } $p = $CFG->dbprefix; // Get basic grade data $query_parms = array(":LID" => $LINK->id); $orderfields = array("R.updated_at", "displayname", "email", "grade"); $searchfields = $orderfields; $sql = "SELECT R.user_id AS user_id, displayname, email,\n grade, note, R.updated_at AS updated_at\n FROM {$p}lti_result AS R\n JOIN {$p}lti_user AS U ON R.user_id = U.user_id\n WHERE R.link_id = :LID"; // View $OUTPUT->header(); $OUTPUT->bodyStart(); $OUTPUT->flashMessages(); $OUTPUT->welcomeUserCourse(); if (isset($GRADE_DETAIL_CLASS) && is_object($GRADE_DETAIL_CLASS)) { $detail = $GRADE_DETAIL_CLASS; } else { $detail = false; } Table::pagedAuto($sql, $query_parms, $searchfields, $orderfields, "grade-detail.php"); // Since this is in a popup, put out a done button $OUTPUT->closeButton(); $OUTPUT->footer(); }
header('Location: ' . $CFG->wwwroot . '/login.php'); return; } $query_parms = false; $searchfields = array("membership_id", "context_id", "user_id", "role", "role_override", "created_at", "updated_at", "email", "displayname", "user_key"); $sql = "SELECT membership_id AS Membership, context_id AS Context, M.user_id as User, \n role, role_override, M.created_at, M.updated_at, email, displayname, user_key\n FROM {$CFG->dbprefix}lti_membership as M\n JOIN {$CFG->dbprefix}lti_user AS U ON M.user_id = U.user_id\n WHERE context_id = :CID"; $query_parms = array(":CID" => $_REQUEST['context_id']); if (!isAdmin()) { die("Fix this"); $sql .= "\nWHERE R.user_id = :UID"; $query_parms = array(":UID" => $_SESSION['id']); } $newsql = Table::pagedQuery($sql, $query_parms, $searchfields); // echo("<pre>\n$newsql\n</pre>\n"); $rows = $PDOX->allRowsDie($newsql, $query_parms); $newrows = array(); foreach ($rows as $row) { $newrow = $row; $newrows[] = $newrow; } $OUTPUT->header(); $OUTPUT->bodyStart(); $OUTPUT->topNav(); $OUTPUT->flashMessages(); ?> <p> <a href="index.php" class="btn btn-default">View Contexts</a> </p> <?php Table::pagedTable($newrows, $searchfields); $OUTPUT->footer();
error_log("Patching server grade: " . session_id() . " result_id=" . $row['result_id'] . "\n" . "grade=" . $row['grade'] . " updated=" . $row['updated_at'] . "\n" . "server_grade=" . $row['server_grade'] . " retrieved=" . $row['retrieved_at']); $debug_log = array(); $status = LTIX::gradeSend($row['grade'], $row, $debug_log); if ($status === true) { $newrow['note'] .= " Server grade updated."; } else { echo '<pre class="alert alert-danger">' . "\n"; $msg = "result_id=" . $row['result_id'] . "\n" . "grade=" . $row['grade'] . " updated=" . $row['updated_at'] . "\n" . "server_grade=" . $row['server_grade'] . " retrieved=" . $row['retrieved_at'] . "\n" . "error=" . $server_grade; echo "Problem Updating Grade: " . session_safe_id() . " " . $msg; error_log("Problem Updating Grade: " . session_id() . "\n" . $msg . "\n" . "service=" . $row['service'] . " sourcedid=" . $row['sourcedid']); echo "\nProblem Retrieving Grade - Please take a screen shot of this page.\n"; echo "</pre>\n"; $newrow['note'] .= " Problem Updating Server Grade"; } } $newrows[] = $newrow; } Table::pagedTable($newrows, $searchfields); } if ($summary_sql !== false) { Table::pagedAuto($summary_sql, $query_parms, $searchfields, $orderfields); } if ($class_sql !== false) { if ($link_info !== false) { echo "<p>Results for " . $link_info['title']; echo ' (<a href="maint.php?link_id=' . $link_id . '" target="_new">Maintenance tasks</a>)' . "</p>\n"; } Table::pagedAuto($class_sql, $query_parms, $searchfields); } $OUTPUT->footer();
// 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(); // Make us a paged table and by default sort by flagged descending $parm = $_GET; if (!isset($parm['order_by'])) { $parm['order_by'] = 'flagged'; $parm['desc'] = '1'; } Table::pagedAuto($sql, $query_parms, $searchfields, $orderfields, "student.php", $parm); ?> <form method="post"> <br/> <input type="submit" name="doExit" onclick="location='<?php echo addSession('index.php'); ?> '; return false;" value="Exit" class="btn btn-success"> </form> <?php $OUTPUT->footer();
public static function pagedAuto($sql, $query_parms, $searchfields, $orderfields = false, $view = false, $params = false) { global $PDOX; $newsql = Table::pagedQuery($sql, $query_parms, $searchfields, $orderfields, $params); //echo("<pre>\n$newsql\n</pre>\n"); $rows = $PDOX->allRowsDie($newsql, $query_parms); Table::pagedTable($rows, $searchfields, $orderfields, $view, $params); }
require_once "../../config.php"; require_once $CFG->dirroot . "/pdo.php"; require_once $CFG->dirroot . "/lib/lms_lib.php"; require_once "lib.php"; use Tsugi\UI\Table; use Tsugi\Core\LTIX; // Require CONTEXT, USER, and LINK $LTI = LTIX::requireData(); if (!$USER->instructor) { die("Requires instructor role"); } $p = $CFG->dbprefix; // Get basic grade data $query_parms = array(":LID" => $LINK->id); $orderfields = array("R.updated_at", "displayname", "email", "grade"); $searchfields = $orderfields; $sql = "SELECT R.user_id AS user_id, displayname, email,\n grade, note, R.updated_at AS updated_at\n FROM {$p}lti_result AS R\n JOIN {$p}lti_user AS U ON R.user_id = U.user_id\n WHERE R.link_id = :LID"; // View $OUTPUT->header(); $OUTPUT->bodyStart(); $OUTPUT->flashMessages(); $OUTPUT->welcomeUserCourse(); if (isset($GRADE_DETAIL_CLASS) && is_object($GRADE_DETAIL_CLASS)) { $detail = $GRADE_DETAIL_CLASS; } else { $detail = false; } Table::pagedAuto($sql, $query_parms, $searchfields, $orderfields, "grade-detail.php"); // Since this is in a popup, put out a done button $OUTPUT->closeButton(); $OUTPUT->footer();
// In the top frame, we use cookies for session. define('COOKIE_SESSION', true); require_once "../../config.php"; require_once $CFG->dirroot . "/pdo.php"; require_once $CFG->dirroot . "/lib/lms_lib.php"; use Tsugi\UI\Table; header('Content-Type: text/html; charset=utf-8'); session_start(); if (!isAdmin()) { $_SESSION['login_return'] = getUrlFull(__FILE__) . "/index.php"; header('Location: ' . $CFG->wwwroot . '/login.php'); return; } $query_parms = false; $searchfields = array("context_id", "key_id", "title", "created_at", "updated_at"); $sql = "SELECT context_id, title, key_id AS key_value, created_at, updated_at\n FROM {$CFG->dbprefix}lti_context"; $newsql = Table::pagedQuery($sql, $query_parms, $searchfields); // echo("<pre>\n$newsql\n</pre>\n"); $rows = $PDOX->allRowsDie($newsql, $query_parms); $newrows = array(); foreach ($rows as $row) { $newrow = $row; $newrows[] = $newrow; } $OUTPUT->header(); $OUTPUT->bodyStart(); $OUTPUT->topNav(); $OUTPUT->flashMessages(); Table::pagedTable($newrows, $searchfields, false, "membership.php"); $OUTPUT->footer();
} $OUTPUT->header(); $OUTPUT->bodyStart(); $OUTPUT->topNav(); $OUTPUT->flashMessages(); ?> <h1>LTI Keys</h1> <p> <a href="index.php" class="btn btn-default">View Key Requests</a> </p> <?php if (count($newrows) < 1) { ?> <p> You have no IMS LTI 1.1 Keys for this system. </p> <?php } else { Table::pagedTable($newrows, $searchfields, false, "key-detail.php"); } if (isAdmin()) { ?> <p> <a href="key-add.php" class="btn btn-default">Add Key</a> </p> <?php } ?> <?php $OUTPUT->footer();
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> <input type="submit" id="request_save" class="btn btn-primary" value="Submit Request"> </div> </form> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> <?php } if (count($newrows) < 1) { ?> <p> This server hosts various tools that can be integrated into a learning system using the IMS Learning Tools Interoperability standard. You can use this page to request access to this service. </p> <?php } else { Table::pagedTable($newrows, $searchfields, false, "request-detail.php"); } if ($goodsession) { ?> <p> <button type="button" class="btn btn-default" onclick="$('#request').modal();return false;">New Key Request</button> </p> <?php } ?> <?php $OUTPUT->footer();
foreach ($rows as $row) { $newrow = $row; $newrow['secret'] = '****'; $newrows[] = $newrow; } $OUTPUT->header(); $OUTPUT->bodyStart(); $OUTPUT->topNav(); $OUTPUT->flashMessages(); ?> <h1>LTI Keys</h1> <p> <a href="index.php" class="btn btn-default">View Key Requests</a> </p> <?php if (count($newrows) < 1) { ?> <p> You have no IMS LTI 1.1 Keys for this system. </p> <?php } else { $extra_buttons = array("Insert New Key" => "key-add.php"); Table::pagedTable($newrows, $searchfields, false, "key-detail.php", false, $extra_buttons); } if (isAdmin()) { } ?> <?php $OUTPUT->footer();