-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil.php
More file actions
33 lines (29 loc) · 799 Bytes
/
util.php
File metadata and controls
33 lines (29 loc) · 799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
function getCurrentStudents($context_id, $req_instructor_role=true)
{
global $CFG, $USER, $LINK, $PDOX;
if ( ! $USER->instructor && $req_instructor_role) die("Requires instructor role");
$p = $CFG->dbprefix;
// Get basic grade data
$stmt = $PDOX->queryDie(
"SELECT u.user_id, COALESCE(displayname, 'Anonymous') as displayname, email, role
FROM lti_user AS u
JOIN lti_membership AS m ON u.user_id = m.user_id
WHERE m.context_id = :CID AND m.role = 0",
array(":CID" => $context_id)
);
$row = $stmt->fetchAll();
return $row;
}
function printJSON($json)
{
echo("<pre>\n");
echo(htmlentities(json_encode($json, JSON_PRETTY_PRINT)));
echo("\n</pre>\n");
}
function printVarDump($var)
{
echo("<pre>\n");
var_dump($var);
echo("\n</pre>\n");
}