|
1 |
| -<?php |
| 1 | +<?php |
2 | 2 |
|
3 |
| -$reports_modules['scorm'] = array (); |
| 3 | +$reports_modules['scorm'] = array(); |
4 | 4 |
|
5 | 5 |
|
6 |
| -function reports_modules_scorm_init() { |
| 6 | +function reports_modules_scorm_init() |
| 7 | +{ |
7 | 8 | }
|
8 | 9 |
|
9 |
| -function reports_modules_scorm_init_forEachCourses($course_code, $course_id, $course_db) { |
10 |
| - global $reports_modules; |
11 |
| - |
12 |
| - $reports_modules_scorm_toolid = reports_getToolId(TOOL_LEARNPATH); |
| 10 | +function reports_modules_scorm_init_forEachCourses($course_code, $course_id, $course_db) |
| 11 | +{ |
| 12 | + global $reports_modules; |
13 | 13 |
|
14 |
| - // package level |
15 |
| - array_push($reports_modules['scorm'], |
16 |
| - array('keys_query' => |
17 |
| - 'select '.$course_id.' as course_id, '. |
18 |
| - $reports_modules_scorm_toolid.' as tool_id, '. |
19 |
| - 'lp.id as child_id, lp.name as child_name, '. |
20 |
| - "'".$course_db."'".' as course_db from '. |
21 |
| - Database::get_course_table(TABLE_LP_MAIN).' lp', |
22 |
| - 'values_query_function' => 'reports_modules_scorm_packageVal')); |
| 14 | + $reports_modules_scorm_toolid = reports_getToolId(TOOL_LEARNPATH); |
23 | 15 |
|
24 |
| - // sco level |
25 |
| - array_push($reports_modules['scorm'], |
26 |
| - array('keys_query' => |
27 |
| - 'select '.$course_id.' as course_id, '. |
28 |
| - $reports_modules_scorm_toolid.' as tool_id, '. |
29 |
| - 'lp.id as child_id, lp.name as child_name, '. |
30 |
| - 'lpi.id as subchild_id, lpi.title as subchild_name, '. |
31 |
| - "'".$course_db."'".' as course_db from '. |
32 |
| - Database::get_course_table(TABLE_LP_MAIN, $course_db). |
33 |
| - ' lp,'. |
34 |
| - Database::get_course_table(TABLE_LP_ITEM, $course_db). |
35 |
| - ' lpi where lp.id = lpi.lp_id', |
36 |
| - 'values_query_function' => 'reports_modules_scorm_scoVal')); |
| 16 | + // package level |
| 17 | + array_push($reports_modules['scorm'], |
| 18 | + array( |
| 19 | + 'keys_query' => |
| 20 | + 'select ' . $course_id . ' as course_id, ' . |
| 21 | + $reports_modules_scorm_toolid . ' as tool_id, ' . |
| 22 | + 'lp.id as child_id, lp.name as child_name, ' . |
| 23 | + "'" . $course_db . "'" . ' as course_db from ' . |
| 24 | + Database::get_course_table(TABLE_LP_MAIN) . ' lp', |
| 25 | + 'values_query_function' => 'reports_modules_scorm_packageVal' |
| 26 | + )); |
37 | 27 |
|
38 |
| - // objectives level |
39 |
| - array_push($reports_modules['scorm'], |
40 |
| - array('keys_query' => |
41 |
| - 'select distinct '.$course_id.' as course_id, '. |
42 |
| - $reports_modules_scorm_toolid.' as tool_id, '. |
43 |
| - 'lp.id as child_id, lp.name as child_name, '. |
44 |
| - 'lpi.id as subchild_id, '. |
45 |
| - 'lpi.title as subchild_name, '. |
46 |
| - 'null as subsubchild_id, '. |
47 |
| - 'lpivo.objective_id as subsubchild_name, '. |
48 |
| - "'".$course_db."'".' as course_db from '. |
49 |
| - Database::get_course_table(TABLE_LP_MAIN, $course_db). |
50 |
| - ' lp,'. |
51 |
| - Database::get_course_table(TABLE_LP_ITEM, $course_db). |
52 |
| - ' lpi, '. |
53 |
| - Database::get_course_table(TABLE_LP_ITEM_VIEW, $course_db). |
54 |
| - ' lpiv, '. |
55 |
| - Database::get_course_table(TABLE_LP_IV_OBJECTIVE, $course_db). |
56 |
| - ' lpivo '. |
57 |
| - 'where lp.id = lpi.lp_id '. |
58 |
| - 'and lpi.id = lpiv.lp_item_id '. |
59 |
| - 'and lpiv.id = lpivo.lp_iv_id ', |
60 |
| - 'values_query_function' => 'reports_modules_scorm_objVal')); |
| 28 | + // sco level |
| 29 | + array_push($reports_modules['scorm'], |
| 30 | + array( |
| 31 | + 'keys_query' => |
| 32 | + 'select ' . $course_id . ' as course_id, ' . |
| 33 | + $reports_modules_scorm_toolid . ' as tool_id, ' . |
| 34 | + 'lp.id as child_id, lp.name as child_name, ' . |
| 35 | + 'lpi.id as subchild_id, lpi.title as subchild_name, ' . |
| 36 | + "'" . $course_db . "'" . ' as course_db from ' . |
| 37 | + Database::get_course_table(TABLE_LP_MAIN, $course_db) . |
| 38 | + ' lp,' . |
| 39 | + Database::get_course_table(TABLE_LP_ITEM, $course_db) . |
| 40 | + ' lpi where lp.id = lpi.lp_id', |
| 41 | + 'values_query_function' => 'reports_modules_scorm_scoVal' |
| 42 | + )); |
| 43 | + |
| 44 | + // objectives level |
| 45 | + array_push($reports_modules['scorm'], |
| 46 | + array( |
| 47 | + 'keys_query' => |
| 48 | + 'select distinct ' . $course_id . ' as course_id, ' . |
| 49 | + $reports_modules_scorm_toolid . ' as tool_id, ' . |
| 50 | + 'lp.id as child_id, lp.name as child_name, ' . |
| 51 | + 'lpi.id as subchild_id, ' . |
| 52 | + 'lpi.title as subchild_name, ' . |
| 53 | + 'null as subsubchild_id, ' . |
| 54 | + 'lpivo.objective_id as subsubchild_name, ' . |
| 55 | + "'" . $course_db . "'" . ' as course_db from ' . |
| 56 | + Database::get_course_table(TABLE_LP_MAIN, $course_db) . |
| 57 | + ' lp,' . |
| 58 | + Database::get_course_table(TABLE_LP_ITEM, $course_db) . |
| 59 | + ' lpi, ' . |
| 60 | + Database::get_course_table(TABLE_LP_ITEM_VIEW, $course_db) . |
| 61 | + ' lpiv, ' . |
| 62 | + Database::get_course_table(TABLE_LP_IV_OBJECTIVE, $course_db) . |
| 63 | + ' lpivo ' . |
| 64 | + 'where lp.id = lpi.lp_id ' . |
| 65 | + 'and lpi.id = lpiv.lp_item_id ' . |
| 66 | + 'and lpiv.id = lpivo.lp_iv_id ', |
| 67 | + 'values_query_function' => 'reports_modules_scorm_objVal' |
| 68 | + )); |
61 | 69 | }
|
62 | 70 |
|
63 |
| -function reports_modules_scorm_packageVal($scorm, $key_id) { |
64 |
| - return array('type'=> 'sql', 'sql' => |
65 |
| - 'select '.$key_id.', user_id as uid, '. |
66 |
| - 'session_id, view_count as attempt, null as score, '. |
67 |
| - 'progress as progress, '. |
68 |
| - 'null as time, null as ts from '. |
69 |
| - Database::get_course_table(TABLE_LP_VIEW, $scorm['course_db']). |
70 |
| - ' where lp_id = '.$scorm['child_id']); |
| 71 | +function reports_modules_scorm_packageVal($scorm, $key_id) |
| 72 | +{ |
| 73 | + return array( |
| 74 | + 'type' => 'sql', |
| 75 | + 'sql' => |
| 76 | + 'select ' . $key_id . ', user_id as uid, ' . |
| 77 | + 'session_id, view_count as attempt, null as score, ' . |
| 78 | + 'progress as progress, ' . |
| 79 | + 'null as time, null as ts from ' . |
| 80 | + Database::get_course_table(TABLE_LP_VIEW, $scorm['course_db']) . |
| 81 | + ' where lp_id = ' . $scorm['child_id'] |
| 82 | + ); |
71 | 83 | }
|
72 | 84 |
|
73 |
| -function reports_modules_scorm_scoVal($scorm, $key_id) { |
74 |
| - return array('type'=> 'sql', 'sql' => |
75 |
| - 'select '.$key_id.', lpv.user_id as uid, '. |
76 |
| - 'lpv.session_id, lpiv.view_count as attempt, '. |
77 |
| - 'lpiv.score as score, '. |
78 |
| - '(case lpiv.status '. |
79 |
| - 'when "incomplete" then 0 '. |
80 |
| - 'when "completed" then 1 '. |
81 |
| - 'when "passed" then 2 '. |
82 |
| - 'when "failed" then 3 '. |
83 |
| - 'when "browsed" then 4 '. |
84 |
| - 'when "not attempted" then 5 '. |
85 |
| - 'else 6 '. |
86 |
| - 'end) as progress, '. |
87 |
| - 'lpiv.total_time as time, null as ts from '. |
88 |
| - Database::get_course_table(TABLE_LP_VIEW, $scorm['course_db']). |
89 |
| - ' lpv, '. |
90 |
| - Database::get_course_table(TABLE_LP_ITEM_VIEW, $scorm['course_db']). |
91 |
| - ' lpiv '. |
92 |
| - ' where lpv.lp_id = '.$scorm['child_id']. |
93 |
| - ' and lpiv.lp_item_id = '.$scorm['subchild_id']. |
94 |
| - ' and lpiv.lp_view_id = lpv.id'); |
| 85 | +function reports_modules_scorm_scoVal($scorm, $key_id) |
| 86 | +{ |
| 87 | + return array( |
| 88 | + 'type' => 'sql', |
| 89 | + 'sql' => |
| 90 | + 'select ' . $key_id . ', lpv.user_id as uid, ' . |
| 91 | + 'lpv.session_id, lpiv.view_count as attempt, ' . |
| 92 | + 'lpiv.score as score, ' . |
| 93 | + '(case lpiv.status ' . |
| 94 | + 'when "incomplete" then 0 ' . |
| 95 | + 'when "completed" then 1 ' . |
| 96 | + 'when "passed" then 2 ' . |
| 97 | + 'when "failed" then 3 ' . |
| 98 | + 'when "browsed" then 4 ' . |
| 99 | + 'when "not attempted" then 5 ' . |
| 100 | + 'else 6 ' . |
| 101 | + 'end) as progress, ' . |
| 102 | + 'lpiv.total_time as time, null as ts from ' . |
| 103 | + Database::get_course_table(TABLE_LP_VIEW, $scorm['course_db']) . |
| 104 | + ' lpv, ' . |
| 105 | + Database::get_course_table(TABLE_LP_ITEM_VIEW, $scorm['course_db']) . |
| 106 | + ' lpiv ' . |
| 107 | + ' where lpv.lp_id = ' . $scorm['child_id'] . |
| 108 | + ' and lpiv.lp_item_id = ' . $scorm['subchild_id'] . |
| 109 | + ' and lpiv.lp_view_id = lpv.id' |
| 110 | + ); |
95 | 111 | }
|
96 | 112 |
|
97 |
| -function reports_modules_scorm_objVal($scorm, $key_id) { |
98 |
| - return array('type'=> 'sql', 'sql' => |
99 |
| - 'select '.$key_id.', lpv.user_id as uid, '. |
100 |
| - 'lpv.session_id, lpiv.view_count as attempt, '. |
101 |
| - 'lpivo.score_raw as score, '. |
102 |
| - '(case lpivo.status '. |
103 |
| - 'when "incomplete" then 0 '. |
104 |
| - 'when "completed" then 1 '. |
105 |
| - 'when "passed" then 2 '. |
106 |
| - 'when "failed" then 3 '. |
107 |
| - 'when "browsed" then 4 '. |
108 |
| - 'when "not attempted" then 5 '. |
109 |
| - 'else 6 '. |
110 |
| - 'end) as progress, '. |
111 |
| - 'null as time, null as ts from '. |
112 |
| - Database::get_course_table(TABLE_LP_VIEW, $scorm['course_db']). |
113 |
| - ' lpv, '. |
114 |
| - Database::get_course_table(TABLE_LP_ITEM_VIEW, $scorm['course_db']). |
115 |
| - ' lpiv, '. |
116 |
| - Database::get_course_table(TABLE_LP_IV_OBJECTIVE, $scorm['course_db']). |
117 |
| - ' lpivo '. |
118 |
| - ' where lpv.lp_id = '.$scorm['child_id']. |
119 |
| - ' and lpiv.lp_item_id = '.$scorm['subchild_id']. |
120 |
| - ' and lpivo.objective_id = "'.$scorm['subsubchild_name'].'" '. |
121 |
| - ' and lpiv.lp_view_id = lpv.id'. |
122 |
| - ' and lpivo.lp_iv_id=lpiv.id'); |
| 113 | +function reports_modules_scorm_objVal($scorm, $key_id) |
| 114 | +{ |
| 115 | + return array( |
| 116 | + 'type' => 'sql', |
| 117 | + 'sql' => |
| 118 | + 'select ' . $key_id . ', lpv.user_id as uid, ' . |
| 119 | + 'lpv.session_id, lpiv.view_count as attempt, ' . |
| 120 | + 'lpivo.score_raw as score, ' . |
| 121 | + '(case lpivo.status ' . |
| 122 | + 'when "incomplete" then 0 ' . |
| 123 | + 'when "completed" then 1 ' . |
| 124 | + 'when "passed" then 2 ' . |
| 125 | + 'when "failed" then 3 ' . |
| 126 | + 'when "browsed" then 4 ' . |
| 127 | + 'when "not attempted" then 5 ' . |
| 128 | + 'else 6 ' . |
| 129 | + 'end) as progress, ' . |
| 130 | + 'null as time, null as ts from ' . |
| 131 | + Database::get_course_table(TABLE_LP_VIEW, $scorm['course_db']) . |
| 132 | + ' lpv, ' . |
| 133 | + Database::get_course_table(TABLE_LP_ITEM_VIEW, $scorm['course_db']) . |
| 134 | + ' lpiv, ' . |
| 135 | + Database::get_course_table(TABLE_LP_IV_OBJECTIVE, $scorm['course_db']) . |
| 136 | + ' lpivo ' . |
| 137 | + ' where lpv.lp_id = ' . $scorm['child_id'] . |
| 138 | + ' and lpiv.lp_item_id = ' . $scorm['subchild_id'] . |
| 139 | + ' and lpivo.objective_id = "' . $scorm['subsubchild_name'] . '" ' . |
| 140 | + ' and lpiv.lp_view_id = lpv.id' . |
| 141 | + ' and lpivo.lp_iv_id=lpiv.id' |
| 142 | + ); |
123 | 143 | }
|
0 commit comments