@@ -21,7 +21,7 @@ |
||
21 | 21 | /** |
22 | 22 | * Configure course and account navigation placements |
23 | 23 | * |
24 | - * @return Generator |
|
24 | + * @return \smtech\LTI\Configuration\Generator |
|
25 | 25 | */ |
26 | 26 | public function getGenerator() |
27 | 27 | { |
@@ -3,43 +3,43 @@ |
||
3 | 3 | require_once 'common.inc.php'; |
4 | 4 | |
5 | 5 | $toolbox->cache_pushKey(basename(__FILE__, '.php')); { |
6 | - $observers = $toolbox->cache_get('observers'); |
|
7 | - if ($observers === false) { |
|
8 | - $observers = []; |
|
9 | - $enrollments = $toolbox->api_get( |
|
10 | - 'courses/' . $_SESSION[COURSE_ID] . '/enrollments', [ |
|
11 | - 'role[]' => 'ObserverEnrollment' // FIXME this shouldn't requrie the faux-array |
|
12 | - ] |
|
13 | - ); |
|
14 | - foreach ($enrollments as $enrollment) { |
|
15 | - $observers[] = $toolbox->api_get("users/{$enrollment['user']['id']}/profile"); |
|
16 | - } |
|
17 | - $toolbox->cache_set('observers', $observers); |
|
18 | - } |
|
6 | + $observers = $toolbox->cache_get('observers'); |
|
7 | + if ($observers === false) { |
|
8 | + $observers = []; |
|
9 | + $enrollments = $toolbox->api_get( |
|
10 | + 'courses/' . $_SESSION[COURSE_ID] . '/enrollments', [ |
|
11 | + 'role[]' => 'ObserverEnrollment' // FIXME this shouldn't requrie the faux-array |
|
12 | + ] |
|
13 | + ); |
|
14 | + foreach ($enrollments as $enrollment) { |
|
15 | + $observers[] = $toolbox->api_get("users/{$enrollment['user']['id']}/profile"); |
|
16 | + } |
|
17 | + $toolbox->cache_set('observers', $observers); |
|
18 | + } |
|
19 | 19 | |
20 | - $observees = $toolbox->cache_get('observees'); |
|
21 | - if ($observees === false) { |
|
22 | - $observees = []; |
|
23 | - foreach ($observers as $observer) { |
|
24 | - $response = $toolbox->api_get("users/{$observer['id']}/observees"); |
|
25 | - $observees[$observer['id']] = $response[0]; |
|
26 | - } |
|
27 | - $toolbox->cache_set('observees', $observees); |
|
28 | - } |
|
20 | + $observees = $toolbox->cache_get('observees'); |
|
21 | + if ($observees === false) { |
|
22 | + $observees = []; |
|
23 | + foreach ($observers as $observer) { |
|
24 | + $response = $toolbox->api_get("users/{$observer['id']}/observees"); |
|
25 | + $observees[$observer['id']] = $response[0]; |
|
26 | + } |
|
27 | + $toolbox->cache_set('observees', $observees); |
|
28 | + } |
|
29 | 29 | |
30 | - $passwords = []; |
|
31 | - foreach ($observers as $observer) { |
|
32 | - $response = $toolbox->mysql_query(" |
|
30 | + $passwords = []; |
|
31 | + foreach ($observers as $observer) { |
|
32 | + $response = $toolbox->mysql_query(" |
|
33 | 33 | SELECT * FROM `observers` WHERE `id` = '{$observer['id']}' LIMIT 1 |
34 | 34 | "); |
35 | - $password = $response->fetch_assoc(); |
|
36 | - $passwords[$observer['id']] = $password['password']; |
|
37 | - } |
|
35 | + $password = $response->fetch_assoc(); |
|
36 | + $passwords[$observer['id']] = $password['password']; |
|
37 | + } |
|
38 | 38 | } $toolbox->cache_popKey(); |
39 | 39 | |
40 | 40 | $toolbox->smarty_assign([ |
41 | - 'observers' => $observers, |
|
42 | - 'passwords' => $passwords, |
|
43 | - 'observees' => $observees |
|
41 | + 'observers' => $observers, |
|
42 | + 'passwords' => $passwords, |
|
43 | + 'observees' => $observees |
|
44 | 44 | ]); |
45 | 45 | $toolbox->smarty_display('observers.tpl'); |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | |
22 | 22 | $points = 0; |
23 | 23 | function normalize($numerator, $denominator = false) { |
24 | - global $points; |
|
25 | - $denominator = ($denominator !== false ? $denominator : $points); |
|
26 | - $points = $denominator; |
|
27 | - return min(100, $numerator / $denominator * 100); |
|
24 | + global $points; |
|
25 | + $denominator = ($denominator !== false ? $denominator : $points); |
|
26 | + $points = $denominator; |
|
27 | + return min(100, $numerator / $denominator * 100); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | header('Content-Type: application/javascript'); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | $analytics = $toolbox->cache_get('analytics'); |
36 | 36 | if ($analytics === false) { |
37 | - exit; |
|
37 | + exit; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | ?> |
@@ -47,29 +47,29 @@ discard block |
||
47 | 47 | |
48 | 48 | <?php |
49 | 49 | |
50 | - $labels = array(); |
|
51 | - $max_scores = array(); |
|
52 | - $min_scores = array(); |
|
53 | - $medians = array(); |
|
54 | - $first_quartiles = array(); |
|
55 | - $third_quartiles = array(); |
|
56 | - $scores = array(); |
|
57 | - foreach ($analytic as $data) { |
|
58 | - if ($data['points_possible'] > 0 && $data['max_score'] > 0) { |
|
59 | - $labels[] = ''; // htmlentities($data['title']); |
|
60 | - $max_scores[] = normalize($data['max_score'], $data['points_possible']); |
|
61 | - $min_scores[] = normalize($data['min_score']); |
|
62 | - $medians[] = normalize($data['median']); |
|
63 | - $first_quartiles[] = normalize($data['first_quartile']); |
|
64 | - $third_quartiles[] = normalize($data['third_quartile']); |
|
65 | - if (empty($data['submission'])) { |
|
66 | - $scores[] = '""'; /* some assignments may not have grades */ |
|
67 | - } else { |
|
68 | - $scores[] = normalize($data['submission']['score']); |
|
69 | - } |
|
70 | - } |
|
71 | - } |
|
72 | - ?> |
|
50 | + $labels = array(); |
|
51 | + $max_scores = array(); |
|
52 | + $min_scores = array(); |
|
53 | + $medians = array(); |
|
54 | + $first_quartiles = array(); |
|
55 | + $third_quartiles = array(); |
|
56 | + $scores = array(); |
|
57 | + foreach ($analytic as $data) { |
|
58 | + if ($data['points_possible'] > 0 && $data['max_score'] > 0) { |
|
59 | + $labels[] = ''; // htmlentities($data['title']); |
|
60 | + $max_scores[] = normalize($data['max_score'], $data['points_possible']); |
|
61 | + $min_scores[] = normalize($data['min_score']); |
|
62 | + $medians[] = normalize($data['median']); |
|
63 | + $first_quartiles[] = normalize($data['first_quartile']); |
|
64 | + $third_quartiles[] = normalize($data['third_quartile']); |
|
65 | + if (empty($data['submission'])) { |
|
66 | + $scores[] = '""'; /* some assignments may not have grades */ |
|
67 | + } else { |
|
68 | + $scores[] = normalize($data['submission']['score']); |
|
69 | + } |
|
70 | + } |
|
71 | + } |
|
72 | + ?> |
|
73 | 73 | |
74 | 74 | var data = { |
75 | 75 | labels: [<?= '"' . implode('", "', $labels) . '"' ?>], |
@@ -13,8 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | /* store any requested actions for future handling */ |
15 | 15 | $action = (empty($_REQUEST['action']) ? |
16 | - ACTION_UNSPECIFIED : |
|
17 | - strtolower($_REQUEST['action']) |
|
16 | + ACTION_UNSPECIFIED : strtolower($_REQUEST['action']) |
|
18 | 17 | ); |
19 | 18 | |
20 | 19 | /* action requests only come from outside the LTI! */ |
@@ -42,8 +41,7 @@ discard block |
||
42 | 41 | /* if not authenticated, default to showing credentials */ |
43 | 42 | } else { |
44 | 43 | $action = (empty($action) ? |
45 | - ACTION_CONFIG : |
|
46 | - $action |
|
44 | + ACTION_CONFIG : $action |
|
47 | 45 | ); |
48 | 46 | } |
49 | 47 | |
@@ -53,7 +51,7 @@ discard block |
||
53 | 51 | /* reset cached install data from config file */ |
54 | 52 | case ACTION_INSTALL: { |
55 | 53 | $_SESSION['toolbox'] = Toolbox::fromConfiguration(CONFIG_FILE, true); |
56 | - $toolbox =& $_SESSION['toolbox']; |
|
54 | + $toolbox = & $_SESSION['toolbox']; |
|
57 | 55 | |
58 | 56 | /* test to see if we can connect to the API */ |
59 | 57 | try { |