@@ -308,11 +308,11 @@ |
||
308 | 308 | //$_SESSION['addedresourceid']=null; |
309 | 309 | // cleaning up the session once again |
310 | 310 | $_SESSION['addedresource'] = null; |
311 | - $_SESSION['addedresourceid'] = null; |
|
312 | - $_SESSION['addedresourceassigned'] = null; |
|
313 | - unset ($_SESSION['addedresource']); |
|
314 | - unset ($_SESSION['addedresourceid']); |
|
315 | - unset ($_SESSION['addedresourceassigned']); |
|
311 | + $_SESSION['addedresourceid'] = null; |
|
312 | + $_SESSION['addedresourceassigned'] = null; |
|
313 | + unset ($_SESSION['addedresource']); |
|
314 | + unset ($_SESSION['addedresourceid']); |
|
315 | + unset ($_SESSION['addedresourceassigned']); |
|
316 | 316 | } |
317 | 317 | } |
318 | 318 |
@@ -36,7 +36,7 @@ |
||
36 | 36 | api_get_group_id() |
37 | 37 | ); |
38 | 38 | if (!api_is_allowed_to_edit(null, true) && intval($visibility) == 0 ) { |
39 | - api_not_allowed(); |
|
39 | + api_not_allowed(); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | if (empty($_SESSION['oLP'])) { |
@@ -24,7 +24,7 @@ |
||
24 | 24 | |
25 | 25 | // Using the resource linker as a tool for adding resources to the learning path. |
26 | 26 | if ($action == 'add' && $type == 'learnpathitem') { |
27 | - $htmlHeadXtra[] = "<script> |
|
27 | + $htmlHeadXtra[] = "<script> |
|
28 | 28 | window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; |
29 | 29 | </script>"; |
30 | 30 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | // Create the directory |
50 | 50 | $result = $this->generate_lp_folder($_course, $this->file_name); |
51 | 51 | |
52 | - // Create the directory |
|
52 | + // Create the directory |
|
53 | 53 | $this->base_work_dir = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; |
54 | 54 | ///learning_path/ppt_dirname directory |
55 | 55 | $this->created_dir = substr($result['dir'], 0, strlen($result['dir']) -1); |
@@ -9,261 +9,261 @@ |
||
9 | 9 | */ |
10 | 10 | class LearnpathLink extends AbstractLink |
11 | 11 | { |
12 | - private $course_info = null; |
|
13 | - private $learnpath_table = null; |
|
14 | - private $learnpath_data = null; |
|
15 | - |
|
16 | - /** |
|
17 | - * Constructor |
|
18 | - */ |
|
19 | - public function __construct() |
|
20 | - { |
|
21 | - parent::__construct(); |
|
22 | - $this->set_type(LINK_LEARNPATH); |
|
23 | - } |
|
24 | - |
|
25 | - /** |
|
26 | - * Generate an array of learnpaths that a teacher hasn't created a link for. |
|
27 | - * @return array 2-dimensional array - every element contains 2 subelements (id, name) |
|
28 | - */ |
|
29 | - public function get_not_created_links() |
|
30 | - { |
|
31 | - return false; |
|
32 | - if (empty($this->course_code)) |
|
33 | - die('Error in get_not_created_links() : course code not set'); |
|
34 | - |
|
35 | - $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
|
36 | - |
|
37 | - $sql = 'SELECT id, name from '.$this->get_learnpath_table().' lp |
|
12 | + private $course_info = null; |
|
13 | + private $learnpath_table = null; |
|
14 | + private $learnpath_data = null; |
|
15 | + |
|
16 | + /** |
|
17 | + * Constructor |
|
18 | + */ |
|
19 | + public function __construct() |
|
20 | + { |
|
21 | + parent::__construct(); |
|
22 | + $this->set_type(LINK_LEARNPATH); |
|
23 | + } |
|
24 | + |
|
25 | + /** |
|
26 | + * Generate an array of learnpaths that a teacher hasn't created a link for. |
|
27 | + * @return array 2-dimensional array - every element contains 2 subelements (id, name) |
|
28 | + */ |
|
29 | + public function get_not_created_links() |
|
30 | + { |
|
31 | + return false; |
|
32 | + if (empty($this->course_code)) |
|
33 | + die('Error in get_not_created_links() : course code not set'); |
|
34 | + |
|
35 | + $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
|
36 | + |
|
37 | + $sql = 'SELECT id, name from '.$this->get_learnpath_table().' lp |
|
38 | 38 | WHERE c_id = '.$this->course_id.' AND id NOT IN ' |
39 | - .' (SELECT ref_id FROM '.$tbl_grade_links |
|
40 | - .' WHERE type = '.LINK_LEARNPATH |
|
41 | - ." AND course_code = '".$this->get_course_code()."'" |
|
42 | - .') AND lp.session_id='.api_get_session_id().''; |
|
43 | - |
|
44 | - $result = Database::query($sql); |
|
45 | - |
|
46 | - $cats=array(); |
|
47 | - while ($data=Database::fetch_array($result)) { |
|
48 | - $cats[] = array ($data['id'], $data['name']); |
|
49 | - } |
|
50 | - |
|
51 | - return $cats; |
|
52 | - } |
|
53 | - |
|
54 | - /** |
|
55 | - * Generate an array of all learnpaths available. |
|
56 | - * @return array 2-dimensional array - every element contains 2 subelements (id, name) |
|
57 | - */ |
|
58 | - public function get_all_links() |
|
59 | - { |
|
60 | - if (empty($this->course_code)) |
|
61 | - die('Error in get_not_created_links() : course code not set'); |
|
62 | - |
|
63 | - $session_id = api_get_session_id(); |
|
64 | - if (empty($session_id)) { |
|
65 | - $session_condition = api_get_session_condition(0, true); |
|
66 | - } else { |
|
67 | - $session_condition = api_get_session_condition($session_id, true, true); |
|
68 | - } |
|
69 | - |
|
70 | - $sql = 'SELECT id, name FROM '.$this->get_learnpath_table().' |
|
39 | + .' (SELECT ref_id FROM '.$tbl_grade_links |
|
40 | + .' WHERE type = '.LINK_LEARNPATH |
|
41 | + ." AND course_code = '".$this->get_course_code()."'" |
|
42 | + .') AND lp.session_id='.api_get_session_id().''; |
|
43 | + |
|
44 | + $result = Database::query($sql); |
|
45 | + |
|
46 | + $cats=array(); |
|
47 | + while ($data=Database::fetch_array($result)) { |
|
48 | + $cats[] = array ($data['id'], $data['name']); |
|
49 | + } |
|
50 | + |
|
51 | + return $cats; |
|
52 | + } |
|
53 | + |
|
54 | + /** |
|
55 | + * Generate an array of all learnpaths available. |
|
56 | + * @return array 2-dimensional array - every element contains 2 subelements (id, name) |
|
57 | + */ |
|
58 | + public function get_all_links() |
|
59 | + { |
|
60 | + if (empty($this->course_code)) |
|
61 | + die('Error in get_not_created_links() : course code not set'); |
|
62 | + |
|
63 | + $session_id = api_get_session_id(); |
|
64 | + if (empty($session_id)) { |
|
65 | + $session_condition = api_get_session_condition(0, true); |
|
66 | + } else { |
|
67 | + $session_condition = api_get_session_condition($session_id, true, true); |
|
68 | + } |
|
69 | + |
|
70 | + $sql = 'SELECT id, name FROM '.$this->get_learnpath_table().' |
|
71 | 71 | WHERE c_id = '.$this->course_id.' '.$session_condition.' '; |
72 | - $result = Database::query($sql); |
|
72 | + $result = Database::query($sql); |
|
73 | 73 | |
74 | - $cats = array(); |
|
75 | - while ($data=Database::fetch_array($result)) { |
|
76 | - $cats[] = array ($data['id'], $data['name']); |
|
77 | - } |
|
74 | + $cats = array(); |
|
75 | + while ($data=Database::fetch_array($result)) { |
|
76 | + $cats[] = array ($data['id'], $data['name']); |
|
77 | + } |
|
78 | 78 | |
79 | - return $cats; |
|
80 | - } |
|
79 | + return $cats; |
|
80 | + } |
|
81 | 81 | |
82 | 82 | |
83 | - /** |
|
84 | - * Has anyone used this learnpath yet ? |
|
85 | - */ |
|
86 | - public function has_results() |
|
87 | - { |
|
88 | - $tbl_stats = Database::get_course_table(TABLE_LP_VIEW); |
|
89 | - $sql = "SELECT count(id) AS number FROM $tbl_stats |
|
83 | + /** |
|
84 | + * Has anyone used this learnpath yet ? |
|
85 | + */ |
|
86 | + public function has_results() |
|
87 | + { |
|
88 | + $tbl_stats = Database::get_course_table(TABLE_LP_VIEW); |
|
89 | + $sql = "SELECT count(id) AS number FROM $tbl_stats |
|
90 | 90 | WHERE c_id = ".$this->course_id." AND lp_id = ".$this->get_ref_id(); |
91 | - $result = Database::query($sql); |
|
92 | - $number = Database::fetch_array($result,'NUM'); |
|
93 | - return ($number[0] != 0); |
|
94 | - } |
|
95 | - |
|
96 | - /** |
|
97 | - * Get the progress of this learnpath. Only the last attempt are taken into account. |
|
98 | - * @param $stud_id student id (default: all students who have results - then the average is returned) |
|
99 | - * @return array (score, max) if student is given |
|
100 | - * array (sum of scores, number of scores) otherwise |
|
101 | - * or null if no scores available |
|
102 | - */ |
|
103 | - public function calc_score($stud_id = null, $type = null) |
|
104 | - { |
|
105 | - $tbl_stats = Database::get_course_table(TABLE_LP_VIEW); |
|
106 | - $session_id = api_get_session_id(); |
|
107 | - |
|
108 | - $sql = "SELECT * FROM $tbl_stats |
|
91 | + $result = Database::query($sql); |
|
92 | + $number = Database::fetch_array($result,'NUM'); |
|
93 | + return ($number[0] != 0); |
|
94 | + } |
|
95 | + |
|
96 | + /** |
|
97 | + * Get the progress of this learnpath. Only the last attempt are taken into account. |
|
98 | + * @param $stud_id student id (default: all students who have results - then the average is returned) |
|
99 | + * @return array (score, max) if student is given |
|
100 | + * array (sum of scores, number of scores) otherwise |
|
101 | + * or null if no scores available |
|
102 | + */ |
|
103 | + public function calc_score($stud_id = null, $type = null) |
|
104 | + { |
|
105 | + $tbl_stats = Database::get_course_table(TABLE_LP_VIEW); |
|
106 | + $session_id = api_get_session_id(); |
|
107 | + |
|
108 | + $sql = "SELECT * FROM $tbl_stats |
|
109 | 109 | WHERE |
110 | 110 | c_id = ".$this->course_id." AND |
111 | 111 | lp_id = ".$this->get_ref_id()." AND |
112 | 112 | session_id = $session_id "; |
113 | 113 | |
114 | - if (isset($stud_id)) |
|
115 | - $sql .= ' AND user_id = '.intval($stud_id); |
|
116 | - |
|
117 | - // order by id, that way the student's first attempt is accessed first |
|
118 | - $sql .= ' ORDER BY view_count DESC'; |
|
119 | - |
|
120 | - $scores = Database::query($sql); |
|
121 | - // for 1 student |
|
122 | - if (isset($stud_id)) { |
|
123 | - if ($data = Database::fetch_assoc($scores)) { |
|
124 | - return array ($data['progress'], 100); |
|
125 | - } else |
|
126 | - return null; |
|
127 | - } else { |
|
128 | - // all students -> get average |
|
129 | - $students = array(); // user list, needed to make sure we only |
|
130 | - // take first attempts into account |
|
131 | - $rescount = 0; |
|
132 | - $sum = 0; |
|
133 | - $bestResult = 0; |
|
134 | - $sumResult = 0; |
|
135 | - while ($data = Database::fetch_array($scores)) { |
|
136 | - if (!(array_key_exists($data['user_id'], $students))) { |
|
137 | - $students[$data['user_id']] = $data['progress']; |
|
138 | - $rescount++; |
|
139 | - $sum += $data['progress'] / 100; |
|
140 | - $sumResult += $data['progress']; |
|
141 | - |
|
142 | - if ($data['progress'] > $bestResult) { |
|
143 | - $bestResult = $data['progress']; |
|
144 | - } |
|
145 | - } |
|
146 | - } |
|
147 | - |
|
148 | - if ($rescount == 0) { |
|
149 | - return null; |
|
150 | - } else { |
|
151 | - |
|
152 | - switch ($type) { |
|
153 | - case 'best': |
|
154 | - return array($bestResult, 100); |
|
155 | - break; |
|
156 | - case 'average': |
|
157 | - return array($sumResult/$rescount, 100); |
|
158 | - break; |
|
159 | - case 'ranking': |
|
160 | - return AbstractLink::getCurrentUserRanking($stud_id, $students); |
|
161 | - break; |
|
162 | - default: |
|
163 | - return array($sum, $rescount); |
|
164 | - break; |
|
165 | - } |
|
166 | - } |
|
167 | - } |
|
168 | - } |
|
169 | - |
|
170 | - /** |
|
171 | - * Get URL where to go to if the user clicks on the link. |
|
172 | - */ |
|
173 | - public function get_link() |
|
174 | - { |
|
175 | - $session_id = api_get_session_id(); |
|
176 | - $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq_params($this->get_course_code(), $session_id).'&gradebook=view'; |
|
177 | - |
|
178 | - if (!api_is_allowed_to_edit() || $this->calc_score(api_get_user_id()) == null) { |
|
179 | - $url .= '&action=view&lp_id='.$this->get_ref_id(); |
|
180 | - } else { |
|
181 | - $url .= '&action=build&lp_id='.$this->get_ref_id(); |
|
182 | - } |
|
183 | - return $url; |
|
184 | - } |
|
185 | - |
|
186 | - /** |
|
187 | - * Get name to display: same as learnpath title |
|
188 | - */ |
|
189 | - public function get_name() |
|
190 | - { |
|
191 | - $data = $this->get_learnpath_data(); |
|
192 | - return $data['name']; |
|
193 | - } |
|
194 | - |
|
195 | - /** |
|
196 | - * Get description to display: same as learnpath description |
|
197 | - */ |
|
198 | - public function get_description() |
|
199 | - { |
|
200 | - $data = $this->get_learnpath_data(); |
|
201 | - return $data['description']; |
|
202 | - } |
|
203 | - |
|
204 | - /** |
|
205 | - * Check if this still links to a learnpath |
|
206 | - */ |
|
207 | - public function is_valid_link() { |
|
208 | - $sql = 'SELECT count(id) FROM '.$this->get_learnpath_table().' |
|
114 | + if (isset($stud_id)) |
|
115 | + $sql .= ' AND user_id = '.intval($stud_id); |
|
116 | + |
|
117 | + // order by id, that way the student's first attempt is accessed first |
|
118 | + $sql .= ' ORDER BY view_count DESC'; |
|
119 | + |
|
120 | + $scores = Database::query($sql); |
|
121 | + // for 1 student |
|
122 | + if (isset($stud_id)) { |
|
123 | + if ($data = Database::fetch_assoc($scores)) { |
|
124 | + return array ($data['progress'], 100); |
|
125 | + } else |
|
126 | + return null; |
|
127 | + } else { |
|
128 | + // all students -> get average |
|
129 | + $students = array(); // user list, needed to make sure we only |
|
130 | + // take first attempts into account |
|
131 | + $rescount = 0; |
|
132 | + $sum = 0; |
|
133 | + $bestResult = 0; |
|
134 | + $sumResult = 0; |
|
135 | + while ($data = Database::fetch_array($scores)) { |
|
136 | + if (!(array_key_exists($data['user_id'], $students))) { |
|
137 | + $students[$data['user_id']] = $data['progress']; |
|
138 | + $rescount++; |
|
139 | + $sum += $data['progress'] / 100; |
|
140 | + $sumResult += $data['progress']; |
|
141 | + |
|
142 | + if ($data['progress'] > $bestResult) { |
|
143 | + $bestResult = $data['progress']; |
|
144 | + } |
|
145 | + } |
|
146 | + } |
|
147 | + |
|
148 | + if ($rescount == 0) { |
|
149 | + return null; |
|
150 | + } else { |
|
151 | + |
|
152 | + switch ($type) { |
|
153 | + case 'best': |
|
154 | + return array($bestResult, 100); |
|
155 | + break; |
|
156 | + case 'average': |
|
157 | + return array($sumResult/$rescount, 100); |
|
158 | + break; |
|
159 | + case 'ranking': |
|
160 | + return AbstractLink::getCurrentUserRanking($stud_id, $students); |
|
161 | + break; |
|
162 | + default: |
|
163 | + return array($sum, $rescount); |
|
164 | + break; |
|
165 | + } |
|
166 | + } |
|
167 | + } |
|
168 | + } |
|
169 | + |
|
170 | + /** |
|
171 | + * Get URL where to go to if the user clicks on the link. |
|
172 | + */ |
|
173 | + public function get_link() |
|
174 | + { |
|
175 | + $session_id = api_get_session_id(); |
|
176 | + $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq_params($this->get_course_code(), $session_id).'&gradebook=view'; |
|
177 | + |
|
178 | + if (!api_is_allowed_to_edit() || $this->calc_score(api_get_user_id()) == null) { |
|
179 | + $url .= '&action=view&lp_id='.$this->get_ref_id(); |
|
180 | + } else { |
|
181 | + $url .= '&action=build&lp_id='.$this->get_ref_id(); |
|
182 | + } |
|
183 | + return $url; |
|
184 | + } |
|
185 | + |
|
186 | + /** |
|
187 | + * Get name to display: same as learnpath title |
|
188 | + */ |
|
189 | + public function get_name() |
|
190 | + { |
|
191 | + $data = $this->get_learnpath_data(); |
|
192 | + return $data['name']; |
|
193 | + } |
|
194 | + |
|
195 | + /** |
|
196 | + * Get description to display: same as learnpath description |
|
197 | + */ |
|
198 | + public function get_description() |
|
199 | + { |
|
200 | + $data = $this->get_learnpath_data(); |
|
201 | + return $data['description']; |
|
202 | + } |
|
203 | + |
|
204 | + /** |
|
205 | + * Check if this still links to a learnpath |
|
206 | + */ |
|
207 | + public function is_valid_link() { |
|
208 | + $sql = 'SELECT count(id) FROM '.$this->get_learnpath_table().' |
|
209 | 209 | WHERE c_id = '.$this->course_id.' AND id = '.$this->get_ref_id().' '; |
210 | - $result = Database::query($sql); |
|
211 | - $number = Database::fetch_row($result,'NUM'); |
|
212 | - return ($number[0] != 0); |
|
213 | - } |
|
214 | - |
|
215 | - public function get_type_name() |
|
216 | - { |
|
217 | - return get_lang('LearningPaths'); |
|
218 | - } |
|
219 | - |
|
220 | - public function needs_name_and_description() |
|
221 | - { |
|
222 | - return false; |
|
223 | - } |
|
224 | - |
|
225 | - public function needs_max() |
|
226 | - { |
|
227 | - return false; |
|
228 | - } |
|
229 | - |
|
230 | - public function needs_results() |
|
231 | - { |
|
232 | - return false; |
|
233 | - } |
|
234 | - |
|
235 | - public function is_allowed_to_change_name() |
|
236 | - { |
|
237 | - return false; |
|
238 | - } |
|
239 | - |
|
240 | - // INTERNAL FUNCTIONS |
|
241 | - |
|
242 | - /** |
|
243 | - * Lazy load function to get the database table of the learnpath |
|
244 | - */ |
|
245 | - private function get_learnpath_table() |
|
246 | - { |
|
247 | - $this->learnpath_table = Database :: get_course_table(TABLE_LP_MAIN); |
|
248 | - return $this->learnpath_table; |
|
249 | - } |
|
250 | - |
|
251 | - /** |
|
252 | - * Lazy load function to get the database contents of this learnpath |
|
253 | - */ |
|
254 | - private function get_learnpath_data() |
|
255 | - { |
|
256 | - if (!isset($this->learnpath_data)) { |
|
257 | - $sql = 'SELECT * FROM '.$this->get_learnpath_table().' |
|
210 | + $result = Database::query($sql); |
|
211 | + $number = Database::fetch_row($result,'NUM'); |
|
212 | + return ($number[0] != 0); |
|
213 | + } |
|
214 | + |
|
215 | + public function get_type_name() |
|
216 | + { |
|
217 | + return get_lang('LearningPaths'); |
|
218 | + } |
|
219 | + |
|
220 | + public function needs_name_and_description() |
|
221 | + { |
|
222 | + return false; |
|
223 | + } |
|
224 | + |
|
225 | + public function needs_max() |
|
226 | + { |
|
227 | + return false; |
|
228 | + } |
|
229 | + |
|
230 | + public function needs_results() |
|
231 | + { |
|
232 | + return false; |
|
233 | + } |
|
234 | + |
|
235 | + public function is_allowed_to_change_name() |
|
236 | + { |
|
237 | + return false; |
|
238 | + } |
|
239 | + |
|
240 | + // INTERNAL FUNCTIONS |
|
241 | + |
|
242 | + /** |
|
243 | + * Lazy load function to get the database table of the learnpath |
|
244 | + */ |
|
245 | + private function get_learnpath_table() |
|
246 | + { |
|
247 | + $this->learnpath_table = Database :: get_course_table(TABLE_LP_MAIN); |
|
248 | + return $this->learnpath_table; |
|
249 | + } |
|
250 | + |
|
251 | + /** |
|
252 | + * Lazy load function to get the database contents of this learnpath |
|
253 | + */ |
|
254 | + private function get_learnpath_data() |
|
255 | + { |
|
256 | + if (!isset($this->learnpath_data)) { |
|
257 | + $sql = 'SELECT * FROM '.$this->get_learnpath_table().' |
|
258 | 258 | WHERE c_id = '.$this->course_id.' AND id = '.$this->get_ref_id().' '; |
259 | - $result = Database::query($sql); |
|
260 | - $this->learnpath_data = Database::fetch_array($result); |
|
261 | - } |
|
262 | - return $this->learnpath_data; |
|
263 | - } |
|
264 | - |
|
265 | - public function get_icon_name() |
|
266 | - { |
|
267 | - return 'learnpath'; |
|
268 | - } |
|
259 | + $result = Database::query($sql); |
|
260 | + $this->learnpath_data = Database::fetch_array($result); |
|
261 | + } |
|
262 | + return $this->learnpath_data; |
|
263 | + } |
|
264 | + |
|
265 | + public function get_icon_name() |
|
266 | + { |
|
267 | + return 'learnpath'; |
|
268 | + } |
|
269 | 269 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | $gradebook = ''; |
61 | 61 | if (isset($_SESSION['gradebook'])) { |
62 | - $gradebook= $_SESSION['gradebook']; |
|
62 | + $gradebook= $_SESSION['gradebook']; |
|
63 | 63 | } |
64 | 64 | if (!empty($gradebook) && $gradebook=='view') { |
65 | 65 | $interbreadcrumb[] = array( |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | $htmlHeadXtra[] = '<link rel="stylesheet" href="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'hotspot/css/hotspot.css">'; |
80 | 80 | |
81 | 81 | if ($origin != 'learnpath') { |
82 | - // So we are not in learnpath tool |
|
83 | - Display::display_header($nameTools, get_lang('Exercise')); |
|
82 | + // So we are not in learnpath tool |
|
83 | + Display::display_header($nameTools, get_lang('Exercise')); |
|
84 | 84 | } else { |
85 | 85 | $htmlHeadXtra[] = " |
86 | 86 | <style> |
@@ -94,19 +94,19 @@ discard block |
||
94 | 94 | |
95 | 95 | // I'm in a preview mode as course admin. Display the action menu. |
96 | 96 | if (api_is_course_admin() && $origin != 'learnpath') { |
97 | - echo '<div class="actions">'; |
|
98 | - echo '<a href="admin.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'">'. |
|
97 | + echo '<div class="actions">'; |
|
98 | + echo '<a href="admin.php?'.api_get_cidreq().'&exerciseId='.$objExercise->id.'">'. |
|
99 | 99 | Display::return_icon('back.png', get_lang('GoBackToQuestionList'), array(), 32).'</a>'; |
100 | - echo '<a href="exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$objExercise->id.'">'. |
|
100 | + echo '<a href="exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$objExercise->id.'">'. |
|
101 | 101 | Display::return_icon('edit.png', get_lang('ModifyExercise'), array(), 32).'</a>'; |
102 | - echo '</div>'; |
|
102 | + echo '</div>'; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | $feedback_type = $objExercise->feedback_type; |
106 | 106 | $exercise_stat_info = $objExercise->get_stat_track_exercise_info_by_exe_id($exe_id); |
107 | 107 | |
108 | 108 | if (!empty($exercise_stat_info['data_tracking'])) { |
109 | - $question_list = explode(',', $exercise_stat_info['data_tracking']); |
|
109 | + $question_list = explode(',', $exercise_stat_info['data_tracking']); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | $learnpath_id = $exercise_stat_info['orig_lp_id']; |
@@ -201,19 +201,19 @@ discard block |
||
201 | 201 | Session::erase('objExercise'); |
202 | 202 | Session::erase('exe_id'); |
203 | 203 | } |
204 | - Display::display_footer(); |
|
204 | + Display::display_footer(); |
|
205 | 205 | } else { |
206 | - $lp_mode = isset($_SESSION['lp_mode']) ? $_SESSION['lp_mode'] : null; |
|
207 | - $url = '../lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exercise_stat_info['exe_id'].'&fb_type='.$objExercise->feedback_type; |
|
208 | - $href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'"'; |
|
206 | + $lp_mode = isset($_SESSION['lp_mode']) ? $_SESSION['lp_mode'] : null; |
|
207 | + $url = '../lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exercise_stat_info['exe_id'].'&fb_type='.$objExercise->feedback_type; |
|
208 | + $href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'"'; |
|
209 | 209 | |
210 | 210 | if (api_is_allowed_to_session_edit()) { |
211 | 211 | Session::erase('objExercise'); |
212 | 212 | Session::erase('exe_id'); |
213 | 213 | } |
214 | 214 | |
215 | - // Record the results in the learning path, using the SCORM interface (API) |
|
216 | - echo "<script>window.parent.API.void_save_asset('$total_score', '$max_score', 0, 'completed');</script>"; |
|
215 | + // Record the results in the learning path, using the SCORM interface (API) |
|
216 | + echo "<script>window.parent.API.void_save_asset('$total_score', '$max_score', 0, 'completed');</script>"; |
|
217 | 217 | echo '<script type="text/javascript">'.$href.'</script>'; |
218 | - echo '</body></html>'; |
|
218 | + echo '</body></html>'; |
|
219 | 219 | } |
@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | $learnpath_id = 0; |
44 | 44 | |
45 | 45 | if (isset($_REQUEST['learnpath_id'])) { |
46 | - $learnpath_id = intval($_REQUEST['learnpath_id']); |
|
46 | + $learnpath_id = intval($_REQUEST['learnpath_id']); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | $learnpath_item_id = 0; |
50 | 50 | |
51 | 51 | if (isset($_REQUEST['learnpath_item_id'])) { |
52 | - $learnpath_item_id = intval($_REQUEST['learnpath_item_id']); |
|
52 | + $learnpath_item_id = intval($_REQUEST['learnpath_item_id']); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | $_SESSION['hotspot_coord']=array(); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | // Getting the options by js |
94 | 94 | if (empty($choice_value)) { |
95 | 95 | |
96 | - echo "<script> |
|
96 | + echo "<script> |
|
97 | 97 | // this works for only radio buttons |
98 | 98 | var f = self.parent.window.document.frm_exercise; |
99 | 99 | var choice_js=''; |
@@ -122,12 +122,12 @@ discard block |
||
122 | 122 | } |
123 | 123 | |
124 | 124 | "; |
125 | - // IMPORTANT |
|
126 | - //this is the real redirect function |
|
127 | - //echo 'window.location.href = "exercise_submit_modal.php?learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&hotspotcoord="+ hotspotcoord + "&hotspot="+ hotspot + "&choice="+ choice_js + "&exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'&gradebook='.$gradebook.'";'; |
|
125 | + // IMPORTANT |
|
126 | + //this is the real redirect function |
|
127 | + //echo 'window.location.href = "exercise_submit_modal.php?learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&hotspotcoord="+ hotspotcoord + "&hotspot="+ hotspot + "&choice="+ choice_js + "&exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'&gradebook='.$gradebook.'";'; |
|
128 | 128 | echo ' url = "exercise_submit_modal.php?learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&hotspotcoord="+ hotspotcoord + "&hotspot="+ hotspot + "&choice="+ choice_js + "&exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'&gradebook='.$gradebook.'";'; |
129 | 129 | echo "$('#global-modal .modal-body').load(url);"; |
130 | - echo '</script>'; |
|
130 | + echo '</script>'; |
|
131 | 131 | |
132 | 132 | exit; |
133 | 133 | } |
@@ -180,12 +180,12 @@ discard block |
||
180 | 180 | |
181 | 181 | // creates a temporary Question object |
182 | 182 | if (in_array($questionid, $questionList)) { |
183 | - $objQuestionTmp = Question :: read($questionid); |
|
184 | - $questionName =$objQuestionTmp->selectTitle(); |
|
185 | - $questionDescription=$objQuestionTmp->selectDescription(); |
|
186 | - $questionWeighting =$objQuestionTmp->selectWeighting(); |
|
187 | - $answerType =$objQuestionTmp->selectType(); |
|
188 | - $quesId =$objQuestionTmp->selectId(); //added by priya saini |
|
183 | + $objQuestionTmp = Question :: read($questionid); |
|
184 | + $questionName =$objQuestionTmp->selectTitle(); |
|
185 | + $questionDescription=$objQuestionTmp->selectDescription(); |
|
186 | + $questionWeighting =$objQuestionTmp->selectWeighting(); |
|
187 | + $answerType =$objQuestionTmp->selectType(); |
|
188 | + $quesId =$objQuestionTmp->selectId(); //added by priya saini |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | $objAnswerTmp=new Answer($questionid); |
@@ -208,43 +208,43 @@ discard block |
||
208 | 208 | $totalScore = 0; |
209 | 209 | |
210 | 210 | if (!empty($choice_value)) { |
211 | - for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) { |
|
212 | - $answer = $objAnswerTmp->selectAnswer($answerId); |
|
213 | - $answerComment = $objAnswerTmp->selectComment($answerId); |
|
214 | - $answerDestination = $objAnswerTmp->selectDestination($answerId); |
|
215 | - |
|
216 | - $answerCorrect = $objAnswerTmp->isCorrect($answerId); |
|
217 | - $answerWeighting = $objAnswerTmp->selectWeighting($answerId); |
|
218 | - $numAnswer = $objAnswerTmp->selectAutoId($answerId); |
|
219 | - |
|
220 | - //delineation |
|
221 | - $delineation_cord = $objAnswerTmp->selectHotspotCoordinates(1); |
|
222 | - $answer_delineation_destination=$objAnswerTmp->selectDestination(1); |
|
211 | + for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) { |
|
212 | + $answer = $objAnswerTmp->selectAnswer($answerId); |
|
213 | + $answerComment = $objAnswerTmp->selectComment($answerId); |
|
214 | + $answerDestination = $objAnswerTmp->selectDestination($answerId); |
|
215 | + |
|
216 | + $answerCorrect = $objAnswerTmp->isCorrect($answerId); |
|
217 | + $answerWeighting = $objAnswerTmp->selectWeighting($answerId); |
|
218 | + $numAnswer = $objAnswerTmp->selectAutoId($answerId); |
|
219 | + |
|
220 | + //delineation |
|
221 | + $delineation_cord = $objAnswerTmp->selectHotspotCoordinates(1); |
|
222 | + $answer_delineation_destination=$objAnswerTmp->selectDestination(1); |
|
223 | 223 | if ($dbg_local>0) { error_log(__LINE__.' answerId: '.$answerId.'('.$answerType.') - user delineation_cord: '.$delineation_cord.' - $answer_delineation_destination: '.$answer_delineation_destination,0);} |
224 | 224 | |
225 | - switch($answerType) { |
|
226 | - // for unique answer |
|
227 | - case UNIQUE_ANSWER : |
|
228 | - $studentChoice = ($choice_value == $numAnswer)?1:0; |
|
229 | - if ($studentChoice) { |
|
230 | - $questionScore +=$answerWeighting; |
|
231 | - $totalScore +=$answerWeighting; |
|
232 | - $newquestionList[]=$questionid; |
|
233 | - } |
|
234 | - break; |
|
235 | - case HOT_SPOT_DELINEATION : |
|
236 | - $studentChoice=$choice[$answerId]; |
|
237 | - if ($studentChoice) { |
|
238 | - $newquestionList[]=$questionid; |
|
239 | - } |
|
240 | - if ($answerId===1) { |
|
241 | - $questionScore +=$answerWeighting; |
|
242 | - $totalScore +=$answerWeighting; |
|
243 | - $_SESSION['hotspot_coord'][1] =$delineation_cord; |
|
244 | - $_SESSION['hotspot_dest'][1] =$answer_delineation_destination; |
|
245 | - } |
|
246 | - break; |
|
247 | - } |
|
225 | + switch($answerType) { |
|
226 | + // for unique answer |
|
227 | + case UNIQUE_ANSWER : |
|
228 | + $studentChoice = ($choice_value == $numAnswer)?1:0; |
|
229 | + if ($studentChoice) { |
|
230 | + $questionScore +=$answerWeighting; |
|
231 | + $totalScore +=$answerWeighting; |
|
232 | + $newquestionList[]=$questionid; |
|
233 | + } |
|
234 | + break; |
|
235 | + case HOT_SPOT_DELINEATION : |
|
236 | + $studentChoice=$choice[$answerId]; |
|
237 | + if ($studentChoice) { |
|
238 | + $newquestionList[]=$questionid; |
|
239 | + } |
|
240 | + if ($answerId===1) { |
|
241 | + $questionScore +=$answerWeighting; |
|
242 | + $totalScore +=$answerWeighting; |
|
243 | + $_SESSION['hotspot_coord'][1] =$delineation_cord; |
|
244 | + $_SESSION['hotspot_dest'][1] =$answer_delineation_destination; |
|
245 | + } |
|
246 | + break; |
|
247 | + } |
|
248 | 248 | |
249 | 249 | |
250 | 250 | if ($answerType == UNIQUE_ANSWER || $answerType == MULTIPLE_ANSWER) { |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | $lp_hotspot=$destination_items[2]; |
342 | 342 | $select_question_hotspot=$destination_items[3]; |
343 | 343 | $url_hotspot=$destination_items[4]; |
344 | - //echo 'show the feedback'; |
|
344 | + //echo 'show the feedback'; |
|
345 | 345 | } |
346 | 346 | } elseif($answerId>1) { |
347 | 347 | if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') { |
@@ -398,41 +398,41 @@ discard block |
||
398 | 398 | //we send the error |
399 | 399 | } |
400 | 400 | } |
401 | - } |
|
401 | + } |
|
402 | 402 | |
403 | - if ($overlap_color) { |
|
404 | - $overlap_color='green'; |
|
403 | + if ($overlap_color) { |
|
404 | + $overlap_color='green'; |
|
405 | 405 | } else { |
406 | - $overlap_color='red'; |
|
406 | + $overlap_color='red'; |
|
407 | 407 | } |
408 | - if ($missing_color) { |
|
409 | - $missing_color='green'; |
|
408 | + if ($missing_color) { |
|
409 | + $missing_color='green'; |
|
410 | 410 | } else { |
411 | - $missing_color='red'; |
|
411 | + $missing_color='red'; |
|
412 | 412 | } |
413 | - if ($excess_color) { |
|
414 | - $excess_color='green'; |
|
413 | + if ($excess_color) { |
|
414 | + $excess_color='green'; |
|
415 | 415 | } else { |
416 | - $excess_color='red'; |
|
416 | + $excess_color='red'; |
|
417 | 417 | } |
418 | 418 | |
419 | 419 | if (!is_numeric($final_overlap)) { |
420 | - $final_overlap = 0; |
|
420 | + $final_overlap = 0; |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | if (!is_numeric($final_missing)) { |
424 | - $final_missing = 0; |
|
424 | + $final_missing = 0; |
|
425 | 425 | } |
426 | 426 | if (!is_numeric($final_excess)) { |
427 | - $final_excess = 0; |
|
427 | + $final_excess = 0; |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | if ($final_excess>100) { |
431 | - $final_excess = 100; |
|
431 | + $final_excess = 100; |
|
432 | 432 | } |
433 | 433 | |
434 | 434 | |
435 | - $table_resume = '<table class="data_table" > |
|
435 | + $table_resume = '<table class="data_table" > |
|
436 | 436 | <tr class="row_odd" > |
437 | 437 | <td></td> |
438 | 438 | <td ><b>'.get_lang('Requirements').'</b></td> |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | <td><div style="color:'.$missing_color.'">'.(($final_missing < 0)?0:intval($final_missing)).'</div></td> |
458 | 458 | </tr> |
459 | 459 | </table>'; |
460 | - //var_dump($final_overlap, $threadhold1 , $final_missing, $threadhold2 , $final_excess, $threadhold3); |
|
460 | + //var_dump($final_overlap, $threadhold1 , $final_missing, $threadhold2 , $final_excess, $threadhold3); |
|
461 | 461 | } |
462 | 462 | $_SESSION['newquestionList'] = $newquestionList; |
463 | 463 | |
@@ -474,68 +474,68 @@ discard block |
||
474 | 474 | if ($answerType != HOT_SPOT_DELINEATION) { |
475 | 475 | if (!empty($destination)) { |
476 | 476 | $item_list = explode('@@',$destination); |
477 | - //print_R($item_list); |
|
478 | - $try = $item_list[0]; |
|
479 | - $lp = $item_list[1]; |
|
480 | - $destinationid= $item_list[2]; |
|
481 | - $url=$item_list[3]; |
|
477 | + //print_R($item_list); |
|
478 | + $try = $item_list[0]; |
|
479 | + $lp = $item_list[1]; |
|
480 | + $destinationid= $item_list[2]; |
|
481 | + $url=$item_list[3]; |
|
482 | 482 | } |
483 | - $table_resume=''; |
|
483 | + $table_resume=''; |
|
484 | 484 | } else { |
485 | - $try = $try_hotspot; |
|
486 | - $lp = $lp_hotspot; |
|
487 | - $destinationid= $select_question_hotspot; |
|
488 | - $url=$url_hotspot; |
|
489 | - if ($organs_at_risk_hit==0 && $wrong_results==false ) { |
|
490 | - // no error = no oar and no wrong result for delineation |
|
491 | - //show if no error |
|
492 | - //echo 'no error'; |
|
493 | - $comment= $answerComment = $objAnswerTmp->selectComment($nbrAnswers); |
|
494 | - $answerDestination = $objAnswerTmp->selectDestination($nbrAnswers); |
|
495 | - |
|
496 | - //we send the error |
|
497 | - $destination_items= explode('@@', $answerDestination); |
|
498 | - $try=$destination_items[1]; |
|
499 | - $lp=$destination_items[2]; |
|
500 | - $destinationid=$destination_items[3]; |
|
501 | - $url=$destination_items[4]; |
|
502 | - $exerciseResult[$questionid] = 1; |
|
503 | - } else { |
|
504 | - $exerciseResult[$questionid] = 0; |
|
505 | - } |
|
485 | + $try = $try_hotspot; |
|
486 | + $lp = $lp_hotspot; |
|
487 | + $destinationid= $select_question_hotspot; |
|
488 | + $url=$url_hotspot; |
|
489 | + if ($organs_at_risk_hit==0 && $wrong_results==false ) { |
|
490 | + // no error = no oar and no wrong result for delineation |
|
491 | + //show if no error |
|
492 | + //echo 'no error'; |
|
493 | + $comment= $answerComment = $objAnswerTmp->selectComment($nbrAnswers); |
|
494 | + $answerDestination = $objAnswerTmp->selectDestination($nbrAnswers); |
|
495 | + |
|
496 | + //we send the error |
|
497 | + $destination_items= explode('@@', $answerDestination); |
|
498 | + $try=$destination_items[1]; |
|
499 | + $lp=$destination_items[2]; |
|
500 | + $destinationid=$destination_items[3]; |
|
501 | + $url=$destination_items[4]; |
|
502 | + $exerciseResult[$questionid] = 1; |
|
503 | + } else { |
|
504 | + $exerciseResult[$questionid] = 0; |
|
505 | + } |
|
506 | 506 | } |
507 | 507 | |
508 | 508 | // the link to retry the question |
509 | 509 | if (isset($try) && $try==1) { |
510 | - $num_value_array= (array_keys($questionList, $questionid)); |
|
511 | - $links.= Display :: return_icon('reload.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('TryAgain').'</a><br /><br />'; |
|
510 | + $num_value_array= (array_keys($questionList, $questionid)); |
|
511 | + $links.= Display :: return_icon('reload.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('TryAgain').'</a><br /><br />'; |
|
512 | 512 | } |
513 | 513 | |
514 | 514 | // the link to theory (a learning path) |
515 | 515 | if (!empty($lp)) { |
516 | - $lp_url= api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp; |
|
517 | - $list = new LearnpathList(api_get_user_id()); |
|
518 | - $flat_list = $list->get_flat_list(); |
|
519 | - $links.= Display :: return_icon('theory.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$lp_url.'">'.get_lang('SeeTheory').'</a><br />'; |
|
516 | + $lp_url= api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp; |
|
517 | + $list = new LearnpathList(api_get_user_id()); |
|
518 | + $flat_list = $list->get_flat_list(); |
|
519 | + $links.= Display :: return_icon('theory.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$lp_url.'">'.get_lang('SeeTheory').'</a><br />'; |
|
520 | 520 | } |
521 | 521 | $links.='<br />'; |
522 | 522 | |
523 | 523 | // the link to an external website or link |
524 | 524 | if (!empty($url)) { |
525 | - $links.= Display :: return_icon('link.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$url.'">'.get_lang('VisitUrl').'</a><br /><br />'; |
|
525 | + $links.= Display :: return_icon('link.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$url.'">'.get_lang('VisitUrl').'</a><br /><br />'; |
|
526 | 526 | } |
527 | 527 | |
528 | 528 | // the link to finish the test |
529 | 529 | if ($destinationid==-1) { |
530 | - $links.= Display :: return_icon('finish.gif', '', array ('style' => 'width:22px; height:22px; padding-left:0px;padding-right:5px;')).'<a onclick="SendEx(-1);" href="#">'.get_lang('EndActivity').'</a><br /><br />'; |
|
530 | + $links.= Display :: return_icon('finish.gif', '', array ('style' => 'width:22px; height:22px; padding-left:0px;padding-right:5px;')).'<a onclick="SendEx(-1);" href="#">'.get_lang('EndActivity').'</a><br /><br />'; |
|
531 | 531 | } else { |
532 | - // the link to other question |
|
533 | - if (in_array($destinationid,$questionList)) { |
|
534 | - $objQuestionTmp = Question :: read($destinationid); |
|
535 | - $questionName=$objQuestionTmp->selectTitle(); |
|
536 | - $num_value_array= (array_keys($questionList, $destinationid)); |
|
537 | - $links.= Display :: return_icon('quiz.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('GoToQuestion').' '.$num_value_array[0].'</a><br /><br />'; |
|
538 | - } |
|
532 | + // the link to other question |
|
533 | + if (in_array($destinationid,$questionList)) { |
|
534 | + $objQuestionTmp = Question :: read($destinationid); |
|
535 | + $questionName=$objQuestionTmp->selectTitle(); |
|
536 | + $num_value_array= (array_keys($questionList, $destinationid)); |
|
537 | + $links.= Display :: return_icon('quiz.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('GoToQuestion').' '.$num_value_array[0].'</a><br /><br />'; |
|
538 | + } |
|
539 | 539 | } |
540 | 540 | |
541 | 541 | echo '<script> |
@@ -552,43 +552,43 @@ discard block |
||
552 | 552 | </script>'; |
553 | 553 | |
554 | 554 | if ($links!='') { |
555 | - /*echo '<div id="ModalContent" style="padding-bottom:30px;padding-top:10px;padding-left:20px;padding-right:20px;"> |
|
555 | + /*echo '<div id="ModalContent" style="padding-bottom:30px;padding-top:10px;padding-left:20px;padding-right:20px;"> |
|
556 | 556 | <a onclick="self.parent.tb_remove();" href="#" style="float:right; margin-top:-10px;">'.api_ucfirst(get_lang('Close')).'</a>';*/ |
557 | - echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>'; |
|
558 | - |
|
559 | - if ($answerType == HOT_SPOT_DELINEATION) { |
|
560 | - if ($organs_at_risk_hit > 0) { |
|
561 | - //$message='<p>'.get_lang('YourDelineation').'</p>'; |
|
562 | - //$message.=$table_resume; |
|
563 | - $message.='<br />'.get_lang('ResultIs').' <b>'.get_lang('Unacceptable').'</b><br />'; |
|
564 | - //if ($wrong_results) { } |
|
565 | - $message.='<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>'; |
|
566 | - $message.='<p>'.$comment.'</p>'; |
|
567 | - } else { |
|
568 | - $message='<p>'.get_lang('YourDelineation').'</p>'; |
|
569 | - $message.=$table_resume; |
|
570 | - $message.='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />'; |
|
571 | - $message.='<p>'.$comment.'</p>'; |
|
572 | - } |
|
573 | - echo $message; |
|
574 | - } else { |
|
575 | - echo '<p>'.$comment.'</p>'; |
|
576 | - } |
|
577 | - echo '<h3>'.$links.'</h3>'; |
|
578 | - echo '</div>'; |
|
579 | - |
|
580 | - $_SESSION['hot_spot_result']=$message; |
|
581 | - $_SESSION['hotspot_delineation_result'][$exerciseId][$questionid] = array($message, $exerciseResult[$questionid]); |
|
582 | - //reseting the exerciseResult variable |
|
583 | - Session::write('exerciseResult',$exerciseResult); |
|
584 | - |
|
585 | - //save this variables just in case the exercise loads an LP with other exercise |
|
586 | - $_SESSION['objExerciseExtra'.$exerciseId] = $_SESSION['objExercise']; |
|
587 | - $_SESSION['exerciseResultExtra'.$exerciseId] = $_SESSION['exerciseResult']; |
|
588 | - $_SESSION['questionListExtra'.$exerciseId] = $_SESSION['questionList']; |
|
557 | + echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>'; |
|
558 | + |
|
559 | + if ($answerType == HOT_SPOT_DELINEATION) { |
|
560 | + if ($organs_at_risk_hit > 0) { |
|
561 | + //$message='<p>'.get_lang('YourDelineation').'</p>'; |
|
562 | + //$message.=$table_resume; |
|
563 | + $message.='<br />'.get_lang('ResultIs').' <b>'.get_lang('Unacceptable').'</b><br />'; |
|
564 | + //if ($wrong_results) { } |
|
565 | + $message.='<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>'; |
|
566 | + $message.='<p>'.$comment.'</p>'; |
|
567 | + } else { |
|
568 | + $message='<p>'.get_lang('YourDelineation').'</p>'; |
|
569 | + $message.=$table_resume; |
|
570 | + $message.='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />'; |
|
571 | + $message.='<p>'.$comment.'</p>'; |
|
572 | + } |
|
573 | + echo $message; |
|
574 | + } else { |
|
575 | + echo '<p>'.$comment.'</p>'; |
|
576 | + } |
|
577 | + echo '<h3>'.$links.'</h3>'; |
|
578 | + echo '</div>'; |
|
579 | + |
|
580 | + $_SESSION['hot_spot_result']=$message; |
|
581 | + $_SESSION['hotspot_delineation_result'][$exerciseId][$questionid] = array($message, $exerciseResult[$questionid]); |
|
582 | + //reseting the exerciseResult variable |
|
583 | + Session::write('exerciseResult',$exerciseResult); |
|
584 | + |
|
585 | + //save this variables just in case the exercise loads an LP with other exercise |
|
586 | + $_SESSION['objExerciseExtra'.$exerciseId] = $_SESSION['objExercise']; |
|
587 | + $_SESSION['exerciseResultExtra'.$exerciseId] = $_SESSION['exerciseResult']; |
|
588 | + $_SESSION['questionListExtra'.$exerciseId] = $_SESSION['questionList']; |
|
589 | 589 | } else { |
590 | - $questionNum++; |
|
591 | - echo '<script> |
|
590 | + $questionNum++; |
|
591 | + echo '<script> |
|
592 | 592 | self.parent.window.location.href = "exercise_submit.php?exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'"; |
593 | 593 | //self.parent.tb_remove(); |
594 | 594 | </script>'; |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | $filename = 'reporting.xls'; |
13 | 13 | |
14 | 14 | if (!api_is_allowed_to_create_course()) { |
15 | - api_not_allowed(true); |
|
15 | + api_not_allowed(true); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | $user_id = api_get_user_id(); |
@@ -23,222 +23,222 @@ discard block |
||
23 | 23 | $session_id = 0; |
24 | 24 | |
25 | 25 | if (!empty($my_courses)) { |
26 | - foreach ($my_courses as $course) { |
|
27 | - $course_code = $course['code']; |
|
28 | - $course_id = $course['real_id']; |
|
29 | - $course_info = api_get_course_info($course_code); |
|
30 | - |
|
31 | - //Only show open courses |
|
32 | - if ($course_info['visibility'] == 0) { |
|
33 | - continue; |
|
34 | - } |
|
35 | - |
|
36 | - $teachers = CourseManager::get_teacher_list_from_course_code($course_code); |
|
37 | - $teacher_list = array(); |
|
38 | - |
|
39 | - if (!empty($teachers)) { |
|
40 | - foreach($teachers as $teacher) { |
|
41 | - $teacher_list[]= $teacher['firstname'].' '.$teacher['lastname']; |
|
42 | - } |
|
43 | - } |
|
44 | - |
|
45 | - $tmp_students = CourseManager :: get_student_list_from_course_code($course_code, false); |
|
46 | - |
|
47 | - //Cleaning students only REAL students |
|
48 | - $students = array(); |
|
49 | - foreach ($tmp_students as $student) { |
|
50 | - $user_info = api_get_user_info($student['user_id']); |
|
51 | - if ($user_info['status'] != STUDENT) { |
|
52 | - continue; |
|
53 | - } |
|
54 | - $students[] = $student['user_id']; |
|
55 | - } |
|
56 | - |
|
57 | - $t_lp = Database :: get_course_table(TABLE_LP_MAIN); |
|
58 | - $sql_lp = "SELECT lp.name, lp.id FROM $t_lp lp |
|
26 | + foreach ($my_courses as $course) { |
|
27 | + $course_code = $course['code']; |
|
28 | + $course_id = $course['real_id']; |
|
29 | + $course_info = api_get_course_info($course_code); |
|
30 | + |
|
31 | + //Only show open courses |
|
32 | + if ($course_info['visibility'] == 0) { |
|
33 | + continue; |
|
34 | + } |
|
35 | + |
|
36 | + $teachers = CourseManager::get_teacher_list_from_course_code($course_code); |
|
37 | + $teacher_list = array(); |
|
38 | + |
|
39 | + if (!empty($teachers)) { |
|
40 | + foreach($teachers as $teacher) { |
|
41 | + $teacher_list[]= $teacher['firstname'].' '.$teacher['lastname']; |
|
42 | + } |
|
43 | + } |
|
44 | + |
|
45 | + $tmp_students = CourseManager :: get_student_list_from_course_code($course_code, false); |
|
46 | + |
|
47 | + //Cleaning students only REAL students |
|
48 | + $students = array(); |
|
49 | + foreach ($tmp_students as $student) { |
|
50 | + $user_info = api_get_user_info($student['user_id']); |
|
51 | + if ($user_info['status'] != STUDENT) { |
|
52 | + continue; |
|
53 | + } |
|
54 | + $students[] = $student['user_id']; |
|
55 | + } |
|
56 | + |
|
57 | + $t_lp = Database :: get_course_table(TABLE_LP_MAIN); |
|
58 | + $sql_lp = "SELECT lp.name, lp.id FROM $t_lp lp |
|
59 | 59 | WHERE c_id = $course_id AND lp.session_id = 0"; |
60 | - $rs_lp = Database::query($sql_lp); |
|
61 | - $t_lpi = Database :: get_course_table(TABLE_LP_ITEM); |
|
62 | - $t_news = Database :: get_course_table(TABLE_ANNOUNCEMENT); |
|
63 | - |
|
64 | - $total_tools_list = Tracking::get_tools_most_used_by_course( |
|
65 | - $course_id, |
|
66 | - $session_id |
|
67 | - ); |
|
68 | - |
|
69 | - $total_tools = 0; |
|
70 | - foreach($total_tools_list as $tool) { |
|
71 | - $total_tools += $tool['count_access_tool']; |
|
72 | - } |
|
73 | - |
|
74 | - if (Database :: num_rows($rs_lp) > 0) { |
|
75 | - while ($learnpath = Database :: fetch_array($rs_lp)) { |
|
76 | - $lp_id = $learnpath['id']; |
|
77 | - |
|
78 | - $lp_items = |
|
79 | - $array[$i]['lp'] = '<a href="'.api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?cidReq='.$course_code.'&action=view&lp_id='.$lp_id.'" target="_blank">'.$learnpath['name'].'</a>'; |
|
80 | - |
|
81 | - $array[$i]['teachers'] = ''; |
|
82 | - if (!empty($teacher_list)) { |
|
83 | - $array[$i]['teachers'] = implode(', ', $teacher_list); |
|
84 | - } |
|
85 | - |
|
86 | - $array[$i]['course_name'] = $course['title']; |
|
87 | - $count_students_accessing = 0; |
|
88 | - $count_students_complete_all_activities = 0; |
|
89 | - $count_students_complete_all_activities_at_50 = 0; |
|
90 | - $total_time_spent = 0; |
|
91 | - $total_average_progress = 0; |
|
92 | - |
|
93 | - if (!empty($students)) { |
|
94 | - foreach ($students as $student_id) { |
|
95 | - $avg_student_progress = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id); |
|
96 | - $myavg_temp = Tracking::get_avg_student_score($student_id, $course_code, array($lp_id), $session_id); |
|
97 | - $avg_progress_in_course = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id); |
|
98 | - |
|
99 | - if (intval($avg_progress_in_course) == 100) { |
|
100 | - $count_students_complete_all_activities++; |
|
101 | - } |
|
102 | - if (intval($avg_progress_in_course) > 0 && intval($avg_progress_in_course) <= 50) { |
|
103 | - $count_students_complete_all_activities_at_50 ++; |
|
104 | - } |
|
105 | - $total_average_progress +=$avg_progress_in_course; |
|
106 | - |
|
107 | - $time_spent = Tracking::get_time_spent_on_the_course($student_id, $course_id, $session_id); |
|
108 | - $total_time_spent += $time_spent; |
|
109 | - if (!empty($time_spent)) { |
|
110 | - $count_students_accessing++; |
|
111 | - } |
|
112 | - } |
|
113 | - //$total_tools += $nb_assignments + $messages + $links + $chat_last_connection + $documents; |
|
114 | - } |
|
115 | - |
|
116 | - $student_count = count($students); |
|
117 | - |
|
118 | - $array[$i]['count_students'] = $student_count; |
|
119 | - $array[$i]['count_students_accessing'] = 0; |
|
120 | - $array[$i]['count_students_accessing_percentage'] = 0; |
|
121 | - $array[$i]['count_students_complete_all_activities_at_50'] = 0; |
|
122 | - $array[$i]['count_students_complete_all_activities'] = 0; |
|
123 | - $array[$i]['average_percentage_activities_completed_per_student'] = 0; |
|
124 | - $array[$i]['total_time_spent'] = 0; |
|
125 | - $array[$i]['average_time_spent_per_student'] = 0; |
|
126 | - $array[$i]['total_time_spent'] = 0; |
|
127 | - $array[$i]['average_time_spent_per_student'] = 0; |
|
128 | - //$array[$i]['tools_used'] = 0; |
|
129 | - $array[$i]['learnpath_docs'] = 0; |
|
130 | - $array[$i]['learnpath_exercises'] = 0; |
|
131 | - $array[$i]['learnpath_links'] = 0; |
|
132 | - $array[$i]['learnpath_forums'] = 0; |
|
133 | - $array[$i]['learnpath_assignments'] = 0; |
|
134 | - |
|
135 | - //registering the number of each category of |
|
136 | - //items in learning path |
|
137 | - $sql_lpi = "SELECT lpi.item_type FROM $t_lpi lpi |
|
60 | + $rs_lp = Database::query($sql_lp); |
|
61 | + $t_lpi = Database :: get_course_table(TABLE_LP_ITEM); |
|
62 | + $t_news = Database :: get_course_table(TABLE_ANNOUNCEMENT); |
|
63 | + |
|
64 | + $total_tools_list = Tracking::get_tools_most_used_by_course( |
|
65 | + $course_id, |
|
66 | + $session_id |
|
67 | + ); |
|
68 | + |
|
69 | + $total_tools = 0; |
|
70 | + foreach($total_tools_list as $tool) { |
|
71 | + $total_tools += $tool['count_access_tool']; |
|
72 | + } |
|
73 | + |
|
74 | + if (Database :: num_rows($rs_lp) > 0) { |
|
75 | + while ($learnpath = Database :: fetch_array($rs_lp)) { |
|
76 | + $lp_id = $learnpath['id']; |
|
77 | + |
|
78 | + $lp_items = |
|
79 | + $array[$i]['lp'] = '<a href="'.api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?cidReq='.$course_code.'&action=view&lp_id='.$lp_id.'" target="_blank">'.$learnpath['name'].'</a>'; |
|
80 | + |
|
81 | + $array[$i]['teachers'] = ''; |
|
82 | + if (!empty($teacher_list)) { |
|
83 | + $array[$i]['teachers'] = implode(', ', $teacher_list); |
|
84 | + } |
|
85 | + |
|
86 | + $array[$i]['course_name'] = $course['title']; |
|
87 | + $count_students_accessing = 0; |
|
88 | + $count_students_complete_all_activities = 0; |
|
89 | + $count_students_complete_all_activities_at_50 = 0; |
|
90 | + $total_time_spent = 0; |
|
91 | + $total_average_progress = 0; |
|
92 | + |
|
93 | + if (!empty($students)) { |
|
94 | + foreach ($students as $student_id) { |
|
95 | + $avg_student_progress = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id); |
|
96 | + $myavg_temp = Tracking::get_avg_student_score($student_id, $course_code, array($lp_id), $session_id); |
|
97 | + $avg_progress_in_course = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id); |
|
98 | + |
|
99 | + if (intval($avg_progress_in_course) == 100) { |
|
100 | + $count_students_complete_all_activities++; |
|
101 | + } |
|
102 | + if (intval($avg_progress_in_course) > 0 && intval($avg_progress_in_course) <= 50) { |
|
103 | + $count_students_complete_all_activities_at_50 ++; |
|
104 | + } |
|
105 | + $total_average_progress +=$avg_progress_in_course; |
|
106 | + |
|
107 | + $time_spent = Tracking::get_time_spent_on_the_course($student_id, $course_id, $session_id); |
|
108 | + $total_time_spent += $time_spent; |
|
109 | + if (!empty($time_spent)) { |
|
110 | + $count_students_accessing++; |
|
111 | + } |
|
112 | + } |
|
113 | + //$total_tools += $nb_assignments + $messages + $links + $chat_last_connection + $documents; |
|
114 | + } |
|
115 | + |
|
116 | + $student_count = count($students); |
|
117 | + |
|
118 | + $array[$i]['count_students'] = $student_count; |
|
119 | + $array[$i]['count_students_accessing'] = 0; |
|
120 | + $array[$i]['count_students_accessing_percentage'] = 0; |
|
121 | + $array[$i]['count_students_complete_all_activities_at_50'] = 0; |
|
122 | + $array[$i]['count_students_complete_all_activities'] = 0; |
|
123 | + $array[$i]['average_percentage_activities_completed_per_student'] = 0; |
|
124 | + $array[$i]['total_time_spent'] = 0; |
|
125 | + $array[$i]['average_time_spent_per_student'] = 0; |
|
126 | + $array[$i]['total_time_spent'] = 0; |
|
127 | + $array[$i]['average_time_spent_per_student'] = 0; |
|
128 | + //$array[$i]['tools_used'] = 0; |
|
129 | + $array[$i]['learnpath_docs'] = 0; |
|
130 | + $array[$i]['learnpath_exercises'] = 0; |
|
131 | + $array[$i]['learnpath_links'] = 0; |
|
132 | + $array[$i]['learnpath_forums'] = 0; |
|
133 | + $array[$i]['learnpath_assignments'] = 0; |
|
134 | + |
|
135 | + //registering the number of each category of |
|
136 | + //items in learning path |
|
137 | + $sql_lpi = "SELECT lpi.item_type FROM $t_lpi lpi |
|
138 | 138 | WHERE c_id = $course_id AND lpi.lp_id = $lp_id |
139 | 139 | ORDER BY item_type"; |
140 | - $res_lpi = Database::query($sql_lpi); |
|
141 | - while ($row_lpi = Database::fetch_array($res_lpi)) { |
|
142 | - switch($row_lpi['item_type']) { |
|
143 | - case 'document': |
|
144 | - $array[$i]['learnpath_docs']++; |
|
145 | - break; |
|
146 | - case 'quiz': |
|
147 | - $array[$i]['learnpath_exercises']++; |
|
148 | - break; |
|
149 | - case 'link': |
|
150 | - $array[$i]['learnpath_links']++; |
|
151 | - break; |
|
152 | - case 'forum': |
|
153 | - case 'thread': |
|
154 | - $array[$i]['learnpath_forums']++; |
|
155 | - break; |
|
156 | - case 'student_publication': |
|
157 | - $array[$i]['learnpath_assignments']++; |
|
158 | - break; |
|
159 | - } |
|
160 | - } |
|
161 | - // Count announcements |
|
162 | - $array[$i]['total_announcements'] = 0; |
|
163 | - $sql_news = "SELECT count(id) FROM $t_news WHERE c_id = $course_id "; |
|
164 | - $res_news = Database::query($sql_news); |
|
165 | - while ($row_news = Database::fetch_array($res_news)) { |
|
166 | - $array[$i]['total_announcements'] = $row_news[0]; |
|
167 | - } |
|
168 | - |
|
169 | - //@todo don't know what means this value |
|
170 | - $count_students_complete_all_activities_at_50 = 0; |
|
171 | - |
|
172 | - if (!empty($student_count)) { |
|
173 | - $array[$i]['count_students_accessing'] = $count_students_accessing; |
|
174 | - $array[$i]['count_students_accessing_percentage'] = round($count_students_accessing / $student_count *100 , 0); |
|
175 | - $array[$i]['count_students_complete_all_activities_at_50'] = $count_students_complete_all_activities; |
|
176 | - $array[$i]['count_students_complete_all_activities'] = round($count_students_complete_all_activities / $student_count *100 , 0);; |
|
177 | - $array[$i]['average_percentage_activities_completed_per_student'] = round($count_students_complete_all_activities/$student_count*100,2); |
|
178 | - $array[$i]['total_time_spent'] = 0; |
|
179 | - $array[$i]['average_time_spent_per_student'] = 0; |
|
180 | - |
|
181 | - if (!empty($total_time_spent)) { |
|
182 | - $array[$i]['total_time_spent'] = api_time_to_hms($total_time_spent); |
|
183 | - $array[$i]['average_time_spent_per_student'] = api_time_to_hms($total_time_spent / $student_count); |
|
184 | - } |
|
185 | - //$array[$i]['tools_used'] = $total_tools; |
|
186 | - } |
|
187 | - $i++; |
|
188 | - } |
|
189 | - } |
|
190 | - } |
|
140 | + $res_lpi = Database::query($sql_lpi); |
|
141 | + while ($row_lpi = Database::fetch_array($res_lpi)) { |
|
142 | + switch($row_lpi['item_type']) { |
|
143 | + case 'document': |
|
144 | + $array[$i]['learnpath_docs']++; |
|
145 | + break; |
|
146 | + case 'quiz': |
|
147 | + $array[$i]['learnpath_exercises']++; |
|
148 | + break; |
|
149 | + case 'link': |
|
150 | + $array[$i]['learnpath_links']++; |
|
151 | + break; |
|
152 | + case 'forum': |
|
153 | + case 'thread': |
|
154 | + $array[$i]['learnpath_forums']++; |
|
155 | + break; |
|
156 | + case 'student_publication': |
|
157 | + $array[$i]['learnpath_assignments']++; |
|
158 | + break; |
|
159 | + } |
|
160 | + } |
|
161 | + // Count announcements |
|
162 | + $array[$i]['total_announcements'] = 0; |
|
163 | + $sql_news = "SELECT count(id) FROM $t_news WHERE c_id = $course_id "; |
|
164 | + $res_news = Database::query($sql_news); |
|
165 | + while ($row_news = Database::fetch_array($res_news)) { |
|
166 | + $array[$i]['total_announcements'] = $row_news[0]; |
|
167 | + } |
|
168 | + |
|
169 | + //@todo don't know what means this value |
|
170 | + $count_students_complete_all_activities_at_50 = 0; |
|
171 | + |
|
172 | + if (!empty($student_count)) { |
|
173 | + $array[$i]['count_students_accessing'] = $count_students_accessing; |
|
174 | + $array[$i]['count_students_accessing_percentage'] = round($count_students_accessing / $student_count *100 , 0); |
|
175 | + $array[$i]['count_students_complete_all_activities_at_50'] = $count_students_complete_all_activities; |
|
176 | + $array[$i]['count_students_complete_all_activities'] = round($count_students_complete_all_activities / $student_count *100 , 0);; |
|
177 | + $array[$i]['average_percentage_activities_completed_per_student'] = round($count_students_complete_all_activities/$student_count*100,2); |
|
178 | + $array[$i]['total_time_spent'] = 0; |
|
179 | + $array[$i]['average_time_spent_per_student'] = 0; |
|
180 | + |
|
181 | + if (!empty($total_time_spent)) { |
|
182 | + $array[$i]['total_time_spent'] = api_time_to_hms($total_time_spent); |
|
183 | + $array[$i]['average_time_spent_per_student'] = api_time_to_hms($total_time_spent / $student_count); |
|
184 | + } |
|
185 | + //$array[$i]['tools_used'] = $total_tools; |
|
186 | + } |
|
187 | + $i++; |
|
188 | + } |
|
189 | + } |
|
190 | + } |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | $headers = array( |
194 | - get_lang('LearningPath'), |
|
195 | - get_lang('Teachers'), |
|
196 | - get_lang('Courses'), |
|
197 | - get_lang('NumberOfStudents'), |
|
198 | - get_lang('NumberStudentsAccessingCourse'), |
|
199 | - get_lang('PercentageStudentsAccessingCourse'), |
|
200 | - get_lang('NumberStudentsCompleteAllActivities'), |
|
201 | - get_lang('PercentageStudentsCompleteAllActivities'), |
|
202 | - get_lang('AverageOfActivitiesCompletedPerStudent'), |
|
203 | - get_lang('TotalTimeSpentInTheCourse'), |
|
204 | - get_lang('AverageTimePerStudentInCourse'), |
|
205 | - get_lang('NumberOfDocumentsInLearnpath'), |
|
206 | - get_lang('NumberOfExercisesInLearnpath'), |
|
207 | - get_lang('NumberOfLinksInLearnpath'), |
|
208 | - get_lang('NumberOfForumsInLearnpath'), |
|
209 | - get_lang('NumberOfAssignmentsInLearnpath'), |
|
210 | - get_lang('NumberOfAnnouncementsInCourse'), |
|
194 | + get_lang('LearningPath'), |
|
195 | + get_lang('Teachers'), |
|
196 | + get_lang('Courses'), |
|
197 | + get_lang('NumberOfStudents'), |
|
198 | + get_lang('NumberStudentsAccessingCourse'), |
|
199 | + get_lang('PercentageStudentsAccessingCourse'), |
|
200 | + get_lang('NumberStudentsCompleteAllActivities'), |
|
201 | + get_lang('PercentageStudentsCompleteAllActivities'), |
|
202 | + get_lang('AverageOfActivitiesCompletedPerStudent'), |
|
203 | + get_lang('TotalTimeSpentInTheCourse'), |
|
204 | + get_lang('AverageTimePerStudentInCourse'), |
|
205 | + get_lang('NumberOfDocumentsInLearnpath'), |
|
206 | + get_lang('NumberOfExercisesInLearnpath'), |
|
207 | + get_lang('NumberOfLinksInLearnpath'), |
|
208 | + get_lang('NumberOfForumsInLearnpath'), |
|
209 | + get_lang('NumberOfAssignmentsInLearnpath'), |
|
210 | + get_lang('NumberOfAnnouncementsInCourse'), |
|
211 | 211 | ); |
212 | 212 | |
213 | 213 | if (isset($_GET['export'])) { |
214 | - global $charset; |
|
214 | + global $charset; |
|
215 | 215 | $spreadsheet = new PHPExcel(); |
216 | 216 | $spreadsheet->setActiveSheetIndex(0); |
217 | 217 | $worksheet = $spreadsheet->getActiveSheet(); |
218 | 218 | |
219 | - $line = 0; |
|
220 | - $column = 0; //skip the first column (row titles) |
|
221 | - |
|
222 | - foreach ($headers as $header) { |
|
223 | - $worksheet->SetCellValueByColumnAndRow($line, $column, $header); |
|
224 | - $column++; |
|
225 | - } |
|
226 | - $line++; |
|
227 | - foreach ($array as $row) { |
|
228 | - $column = 0; |
|
229 | - foreach ($row as $item) { |
|
230 | - $worksheet->SetCellValueByColumnAndRow($line, $column, html_entity_decode(strip_tags($item))); |
|
231 | - $column++; |
|
232 | - } |
|
233 | - $line++; |
|
234 | - } |
|
235 | - $line++; |
|
219 | + $line = 0; |
|
220 | + $column = 0; //skip the first column (row titles) |
|
221 | + |
|
222 | + foreach ($headers as $header) { |
|
223 | + $worksheet->SetCellValueByColumnAndRow($line, $column, $header); |
|
224 | + $column++; |
|
225 | + } |
|
226 | + $line++; |
|
227 | + foreach ($array as $row) { |
|
228 | + $column = 0; |
|
229 | + foreach ($row as $item) { |
|
230 | + $worksheet->SetCellValueByColumnAndRow($line, $column, html_entity_decode(strip_tags($item))); |
|
231 | + $column++; |
|
232 | + } |
|
233 | + $line++; |
|
234 | + } |
|
235 | + $line++; |
|
236 | 236 | |
237 | 237 | $file = api_get_path(SYS_ARCHIVE_PATH).api_replace_dangerous_char($filename); |
238 | 238 | $writer = new PHPExcel_Writer_Excel2007($spreadsheet); |
239 | 239 | $writer->save($file); |
240 | 240 | DocumentManager::file_send_for_download($file, true, $filename); |
241 | - exit; |
|
241 | + exit; |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | $interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('MySpace')); |
@@ -249,20 +249,20 @@ discard block |
||
249 | 249 | $row = 0; |
250 | 250 | $column = 0; |
251 | 251 | foreach ($headers as $header) { |
252 | - $table->setHeaderContents($row, $column, $header); |
|
253 | - $column++; |
|
252 | + $table->setHeaderContents($row, $column, $header); |
|
253 | + $column++; |
|
254 | 254 | } |
255 | 255 | $row++; |
256 | 256 | |
257 | 257 | foreach ($array as $row_table) { |
258 | - $column = 0; |
|
259 | - foreach ($row_table as $cell) { |
|
260 | - $table->setCellContents($row, $column, $cell); |
|
261 | - //$table->updateCellAttributes($row, $column, 'align="center"'); |
|
262 | - $column++; |
|
263 | - } |
|
264 | - $table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true); |
|
265 | - $row++; |
|
258 | + $column = 0; |
|
259 | + foreach ($row_table as $cell) { |
|
260 | + $table->setCellContents($row, $column, $cell); |
|
261 | + //$table->updateCellAttributes($row, $column, 'align="center"'); |
|
262 | + $column++; |
|
263 | + } |
|
264 | + $table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true); |
|
265 | + $row++; |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | echo '<div class="actions">'; |
@@ -311,8 +311,8 @@ discard block |
||
311 | 311 | $extend_link = ''; |
312 | 312 | if (!empty($inter_num)) { |
313 | 313 | $extend_link = Display::url( |
314 | - Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
|
315 | - api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix |
|
314 | + Display::return_icon('visible.gif', get_lang('HideAttemptView')), |
|
315 | + api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix |
|
316 | 316 | ); |
317 | 317 | } |
318 | 318 | $title = $row['mytitle']; |
@@ -1365,7 +1365,7 @@ discard block |
||
1365 | 1365 | case 'last_30_days': |
1366 | 1366 | $new_date = date('Y-m-d H:i:s', strtotime('-30 day')); |
1367 | 1367 | $condition_time = ' AND (login_date >= "'.$new_date.'" AND logout_date <= "'.$today.'") '; |
1368 | - break; |
|
1368 | + break; |
|
1369 | 1369 | case 'custom': |
1370 | 1370 | if (!empty($start_date) && !empty($end_date)) { |
1371 | 1371 | $start_date = Database::escape_string($start_date); |
@@ -1375,10 +1375,10 @@ discard block |
||
1375 | 1375 | break; |
1376 | 1376 | } |
1377 | 1377 | |
1378 | - $sql = 'SELECT SUM(TIMESTAMPDIFF(SECOND, login_date, logout_date)) diff |
|
1378 | + $sql = 'SELECT SUM(TIMESTAMPDIFF(SECOND, login_date, logout_date)) diff |
|
1379 | 1379 | FROM '.$tbl_track_login.' |
1380 | 1380 | WHERE '.$userCondition.$condition_time; |
1381 | - $rs = Database::query($sql); |
|
1381 | + $rs = Database::query($sql); |
|
1382 | 1382 | $row = Database::fetch_array($rs, 'ASSOC'); |
1383 | 1383 | $diff = $row['diff']; |
1384 | 1384 | |
@@ -1400,18 +1400,18 @@ discard block |
||
1400 | 1400 | public static function get_time_spent_on_the_course($user_id, $courseId, $session_id = 0) |
1401 | 1401 | { |
1402 | 1402 | $courseId = intval($courseId); |
1403 | - $session_id = intval($session_id); |
|
1404 | - |
|
1405 | - $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1406 | - if (is_array($user_id)) { |
|
1407 | - $user_id = array_map('intval', $user_id); |
|
1408 | - $condition_user = " AND user_id IN (".implode(',',$user_id).") "; |
|
1409 | - } else { |
|
1410 | - $user_id = intval($user_id); |
|
1411 | - $condition_user = " AND user_id = $user_id "; |
|
1412 | - } |
|
1413 | - |
|
1414 | - $sql = "SELECT |
|
1403 | + $session_id = intval($session_id); |
|
1404 | + |
|
1405 | + $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1406 | + if (is_array($user_id)) { |
|
1407 | + $user_id = array_map('intval', $user_id); |
|
1408 | + $condition_user = " AND user_id IN (".implode(',',$user_id).") "; |
|
1409 | + } else { |
|
1410 | + $user_id = intval($user_id); |
|
1411 | + $condition_user = " AND user_id = $user_id "; |
|
1412 | + } |
|
1413 | + |
|
1414 | + $sql = "SELECT |
|
1415 | 1415 | SUM(UNIX_TIMESTAMP(logout_course_date) - UNIX_TIMESTAMP(login_course_date)) as nb_seconds |
1416 | 1416 | FROM $tbl_track_course |
1417 | 1417 | WHERE UNIX_TIMESTAMP(logout_course_date) > UNIX_TIMESTAMP(login_course_date) "; |
@@ -1426,9 +1426,9 @@ discard block |
||
1426 | 1426 | |
1427 | 1427 | $sql .= $condition_user; |
1428 | 1428 | $rs = Database::query($sql); |
1429 | - $row = Database::fetch_array($rs); |
|
1429 | + $row = Database::fetch_array($rs); |
|
1430 | 1430 | |
1431 | - return $row['nb_seconds']; |
|
1431 | + return $row['nb_seconds']; |
|
1432 | 1432 | } |
1433 | 1433 | |
1434 | 1434 | /** |
@@ -1439,25 +1439,25 @@ discard block |
||
1439 | 1439 | */ |
1440 | 1440 | public static function get_first_connection_date($student_id) |
1441 | 1441 | { |
1442 | - $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
1443 | - $sql = 'SELECT login_date |
|
1442 | + $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
1443 | + $sql = 'SELECT login_date |
|
1444 | 1444 | FROM ' . $tbl_track_login . ' |
1445 | 1445 | WHERE login_user_id = ' . intval($student_id) . ' |
1446 | 1446 | ORDER BY login_date ASC |
1447 | 1447 | LIMIT 0,1'; |
1448 | 1448 | |
1449 | - $rs = Database::query($sql); |
|
1450 | - if (Database::num_rows($rs)>0) { |
|
1451 | - if ($first_login_date = Database::result($rs, 0, 0)) { |
|
1449 | + $rs = Database::query($sql); |
|
1450 | + if (Database::num_rows($rs)>0) { |
|
1451 | + if ($first_login_date = Database::result($rs, 0, 0)) { |
|
1452 | 1452 | return api_convert_and_format_date( |
1453 | 1453 | $first_login_date, |
1454 | 1454 | DATE_FORMAT_SHORT, |
1455 | 1455 | date_default_timezone_get() |
1456 | 1456 | ); |
1457 | - } |
|
1458 | - } |
|
1457 | + } |
|
1458 | + } |
|
1459 | 1459 | |
1460 | - return false; |
|
1460 | + return false; |
|
1461 | 1461 | } |
1462 | 1462 | |
1463 | 1463 | /** |
@@ -1470,38 +1470,38 @@ discard block |
||
1470 | 1470 | */ |
1471 | 1471 | public static function get_last_connection_date($student_id, $warning_message = false, $return_timestamp = false) |
1472 | 1472 | { |
1473 | - $table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
1474 | - $sql = 'SELECT login_date |
|
1473 | + $table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
1474 | + $sql = 'SELECT login_date |
|
1475 | 1475 | FROM ' . $table . ' |
1476 | 1476 | WHERE login_user_id = ' . intval($student_id) . ' |
1477 | 1477 | ORDER BY login_date |
1478 | 1478 | DESC LIMIT 0,1'; |
1479 | 1479 | |
1480 | - $rs = Database::query($sql); |
|
1481 | - if (Database::num_rows($rs) > 0) { |
|
1482 | - if ($last_login_date = Database::result($rs, 0, 0)) { |
|
1483 | - $last_login_date = api_get_local_time($last_login_date); |
|
1484 | - if ($return_timestamp) { |
|
1485 | - return api_strtotime($last_login_date,'UTC'); |
|
1486 | - } else { |
|
1487 | - if (!$warning_message) { |
|
1488 | - return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1489 | - } else { |
|
1490 | - $timestamp = api_strtotime($last_login_date,'UTC'); |
|
1491 | - $currentTimestamp = time(); |
|
1492 | - |
|
1493 | - //If the last connection is > than 7 days, the text is red |
|
1494 | - //345600 = 7 days in seconds |
|
1495 | - if ($currentTimestamp - $timestamp > 604800) { |
|
1496 | - return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>'; |
|
1497 | - } else { |
|
1498 | - return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1499 | - } |
|
1500 | - } |
|
1501 | - } |
|
1502 | - } |
|
1503 | - } |
|
1504 | - return false; |
|
1480 | + $rs = Database::query($sql); |
|
1481 | + if (Database::num_rows($rs) > 0) { |
|
1482 | + if ($last_login_date = Database::result($rs, 0, 0)) { |
|
1483 | + $last_login_date = api_get_local_time($last_login_date); |
|
1484 | + if ($return_timestamp) { |
|
1485 | + return api_strtotime($last_login_date,'UTC'); |
|
1486 | + } else { |
|
1487 | + if (!$warning_message) { |
|
1488 | + return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1489 | + } else { |
|
1490 | + $timestamp = api_strtotime($last_login_date,'UTC'); |
|
1491 | + $currentTimestamp = time(); |
|
1492 | + |
|
1493 | + //If the last connection is > than 7 days, the text is red |
|
1494 | + //345600 = 7 days in seconds |
|
1495 | + if ($currentTimestamp - $timestamp > 604800) { |
|
1496 | + return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>'; |
|
1497 | + } else { |
|
1498 | + return api_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1499 | + } |
|
1500 | + } |
|
1501 | + } |
|
1502 | + } |
|
1503 | + } |
|
1504 | + return false; |
|
1505 | 1505 | } |
1506 | 1506 | |
1507 | 1507 | /** |
@@ -1555,30 +1555,30 @@ discard block |
||
1555 | 1555 | $session_id = 0, |
1556 | 1556 | $convert_date = true |
1557 | 1557 | ) { |
1558 | - $student_id = intval($student_id); |
|
1558 | + $student_id = intval($student_id); |
|
1559 | 1559 | $courseId = intval($courseId); |
1560 | - $session_id = intval($session_id); |
|
1560 | + $session_id = intval($session_id); |
|
1561 | 1561 | |
1562 | - $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1563 | - $sql = 'SELECT login_course_date |
|
1562 | + $tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1563 | + $sql = 'SELECT login_course_date |
|
1564 | 1564 | FROM '.$tbl_track_login.' |
1565 | 1565 | WHERE |
1566 | 1566 | user_id = '.$student_id.' AND |
1567 | 1567 | c_id = '.$courseId.' AND |
1568 | 1568 | session_id = '.$session_id.' |
1569 | 1569 | ORDER BY login_course_date ASC LIMIT 0,1'; |
1570 | - $rs = Database::query($sql); |
|
1571 | - if (Database::num_rows($rs) > 0) { |
|
1572 | - if ($first_login_date = Database::result($rs, 0, 0)) { |
|
1573 | - if ($convert_date) { |
|
1574 | - return api_convert_and_format_date($first_login_date, DATE_FORMAT_SHORT); |
|
1575 | - } else { |
|
1576 | - return $first_login_date; |
|
1577 | - } |
|
1578 | - } |
|
1579 | - } |
|
1580 | - |
|
1581 | - return false; |
|
1570 | + $rs = Database::query($sql); |
|
1571 | + if (Database::num_rows($rs) > 0) { |
|
1572 | + if ($first_login_date = Database::result($rs, 0, 0)) { |
|
1573 | + if ($convert_date) { |
|
1574 | + return api_convert_and_format_date($first_login_date, DATE_FORMAT_SHORT); |
|
1575 | + } else { |
|
1576 | + return $first_login_date; |
|
1577 | + } |
|
1578 | + } |
|
1579 | + } |
|
1580 | + |
|
1581 | + return false; |
|
1582 | 1582 | } |
1583 | 1583 | |
1584 | 1584 | /** |
@@ -1594,13 +1594,13 @@ discard block |
||
1594 | 1594 | $session_id = 0, |
1595 | 1595 | $convert_date = true |
1596 | 1596 | ) { |
1597 | - // protect data |
|
1598 | - $student_id = intval($student_id); |
|
1597 | + // protect data |
|
1598 | + $student_id = intval($student_id); |
|
1599 | 1599 | $courseId = $courseInfo['real_id']; |
1600 | - $session_id = intval($session_id); |
|
1600 | + $session_id = intval($session_id); |
|
1601 | 1601 | |
1602 | - $tbl_track_e_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
1603 | - $sql = 'SELECT access_date |
|
1602 | + $tbl_track_e_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
1603 | + $sql = 'SELECT access_date |
|
1604 | 1604 | FROM '.$tbl_track_e_access.' |
1605 | 1605 | WHERE access_user_id = '.$student_id.' AND |
1606 | 1606 | c_id = "'.$courseId.'" AND |
@@ -1608,39 +1608,39 @@ discard block |
||
1608 | 1608 | ORDER BY access_date DESC |
1609 | 1609 | LIMIT 0,1'; |
1610 | 1610 | |
1611 | - $rs = Database::query($sql); |
|
1612 | - if (Database::num_rows($rs) > 0) { |
|
1613 | - if ($last_login_date = Database::result($rs, 0, 0)) { |
|
1611 | + $rs = Database::query($sql); |
|
1612 | + if (Database::num_rows($rs) > 0) { |
|
1613 | + if ($last_login_date = Database::result($rs, 0, 0)) { |
|
1614 | 1614 | if (empty($last_login_date)) { |
1615 | 1615 | return false; |
1616 | 1616 | } |
1617 | 1617 | //see #5736 |
1618 | 1618 | $last_login_date_timestamp = api_strtotime($last_login_date); |
1619 | - $now = time(); |
|
1620 | - //If the last connection is > than 7 days, the text is red |
|
1621 | - //345600 = 7 days in seconds |
|
1622 | - if ($now - $last_login_date_timestamp > 604800) { |
|
1623 | - if ($convert_date) { |
|
1619 | + $now = time(); |
|
1620 | + //If the last connection is > than 7 days, the text is red |
|
1621 | + //345600 = 7 days in seconds |
|
1622 | + if ($now - $last_login_date_timestamp > 604800) { |
|
1623 | + if ($convert_date) { |
|
1624 | 1624 | $last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT); |
1625 | 1625 | $icon = api_is_allowed_to_edit() ? |
1626 | 1626 | '<a href="'.api_get_path(WEB_CODE_PATH).'announcements/announcements.php?action=add&remind_inactive='.$student_id.'&cidReq='.$courseInfo['code'].'" title="'.get_lang('RemindInactiveUser').'"> |
1627 | 1627 | '.Display::return_icon('messagebox_warning.gif').' |
1628 | 1628 | </a>' |
1629 | 1629 | : null; |
1630 | - return $icon. Display::label($last_login_date, 'warning'); |
|
1631 | - } else { |
|
1632 | - return $last_login_date; |
|
1633 | - } |
|
1634 | - } else { |
|
1635 | - if ($convert_date) { |
|
1636 | - return api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1637 | - } else { |
|
1638 | - return $last_login_date; |
|
1639 | - } |
|
1640 | - } |
|
1641 | - } |
|
1642 | - } |
|
1643 | - return false; |
|
1630 | + return $icon. Display::label($last_login_date, 'warning'); |
|
1631 | + } else { |
|
1632 | + return $last_login_date; |
|
1633 | + } |
|
1634 | + } else { |
|
1635 | + if ($convert_date) { |
|
1636 | + return api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT); |
|
1637 | + } else { |
|
1638 | + return $last_login_date; |
|
1639 | + } |
|
1640 | + } |
|
1641 | + } |
|
1642 | + } |
|
1643 | + return false; |
|
1644 | 1644 | } |
1645 | 1645 | |
1646 | 1646 | /** |
@@ -1653,36 +1653,36 @@ discard block |
||
1653 | 1653 | */ |
1654 | 1654 | public static function get_course_connections_count($courseId, $session_id = 0, $start = 0, $stop = null) |
1655 | 1655 | { |
1656 | - if ($start < 0) { |
|
1657 | - $start = 0; |
|
1658 | - } |
|
1659 | - if (!isset($stop) or ($stop < 0)) { |
|
1660 | - $stop = api_get_utc_datetime(); |
|
1661 | - } |
|
1656 | + if ($start < 0) { |
|
1657 | + $start = 0; |
|
1658 | + } |
|
1659 | + if (!isset($stop) or ($stop < 0)) { |
|
1660 | + $stop = api_get_utc_datetime(); |
|
1661 | + } |
|
1662 | 1662 | |
1663 | 1663 | $start = Database::escape_string($start); |
1664 | 1664 | $stop = Database::escape_string($stop); |
1665 | 1665 | |
1666 | - $month_filter = " AND login_course_date > '$start' AND login_course_date < '$stop' "; |
|
1666 | + $month_filter = " AND login_course_date > '$start' AND login_course_date < '$stop' "; |
|
1667 | 1667 | |
1668 | 1668 | $courseId = intval($courseId); |
1669 | - $session_id = intval($session_id); |
|
1670 | - $count = 0; |
|
1669 | + $session_id = intval($session_id); |
|
1670 | + $count = 0; |
|
1671 | 1671 | |
1672 | - $tbl_track_e_course_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1673 | - $sql = "SELECT count(*) as count_connections |
|
1672 | + $tbl_track_e_course_access = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); |
|
1673 | + $sql = "SELECT count(*) as count_connections |
|
1674 | 1674 | FROM $tbl_track_e_course_access |
1675 | 1675 | WHERE |
1676 | 1676 | c_id = $courseId AND |
1677 | 1677 | session_id = $session_id |
1678 | 1678 | $month_filter"; |
1679 | - $rs = Database::query($sql); |
|
1680 | - if (Database::num_rows($rs)>0) { |
|
1681 | - $row = Database::fetch_object($rs); |
|
1682 | - $count = $row->count_connections; |
|
1683 | - } |
|
1679 | + $rs = Database::query($sql); |
|
1680 | + if (Database::num_rows($rs)>0) { |
|
1681 | + $row = Database::fetch_object($rs); |
|
1682 | + $count = $row->count_connections; |
|
1683 | + } |
|
1684 | 1684 | |
1685 | - return $count; |
|
1685 | + return $count; |
|
1686 | 1686 | } |
1687 | 1687 | |
1688 | 1688 | /** |
@@ -1693,25 +1693,25 @@ discard block |
||
1693 | 1693 | */ |
1694 | 1694 | public static function count_course_per_student($user_id, $include_sessions = true) |
1695 | 1695 | { |
1696 | - $user_id = intval($user_id); |
|
1697 | - $tbl_course_rel_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); |
|
1698 | - $tbl_session_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
1696 | + $user_id = intval($user_id); |
|
1697 | + $tbl_course_rel_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); |
|
1698 | + $tbl_session_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); |
|
1699 | 1699 | |
1700 | - $sql = 'SELECT DISTINCT c_id |
|
1700 | + $sql = 'SELECT DISTINCT c_id |
|
1701 | 1701 | FROM ' . $tbl_course_rel_user . ' |
1702 | 1702 | WHERE user_id = ' . $user_id.' AND relation_type<>'.COURSE_RELATION_TYPE_RRHH; |
1703 | - $rs = Database::query($sql); |
|
1704 | - $nb_courses = Database::num_rows($rs); |
|
1703 | + $rs = Database::query($sql); |
|
1704 | + $nb_courses = Database::num_rows($rs); |
|
1705 | 1705 | |
1706 | - if ($include_sessions) { |
|
1707 | - $sql = 'SELECT DISTINCT c_id |
|
1706 | + if ($include_sessions) { |
|
1707 | + $sql = 'SELECT DISTINCT c_id |
|
1708 | 1708 | FROM ' . $tbl_session_course_rel_user . ' |
1709 | 1709 | WHERE user_id = ' . $user_id; |
1710 | - $rs = Database::query($sql); |
|
1711 | - $nb_courses += Database::num_rows($rs); |
|
1712 | - } |
|
1710 | + $rs = Database::query($sql); |
|
1711 | + $nb_courses += Database::num_rows($rs); |
|
1712 | + } |
|
1713 | 1713 | |
1714 | - return $nb_courses; |
|
1714 | + return $nb_courses; |
|
1715 | 1715 | } |
1716 | 1716 | |
1717 | 1717 | /** |
@@ -1742,25 +1742,25 @@ discard block |
||
1742 | 1742 | $into_lp = 0 |
1743 | 1743 | ) { |
1744 | 1744 | $course_code = Database::escape_string($course_code); |
1745 | - $course_info = api_get_course_info($course_code); |
|
1746 | - if (!empty($course_info)) { |
|
1747 | - // table definition |
|
1748 | - $tbl_course_quiz = Database::get_course_table(TABLE_QUIZ_TEST); |
|
1749 | - $tbl_stats_exercise = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
1750 | - |
|
1751 | - // Compose a filter based on optional exercise given |
|
1752 | - $condition_quiz = ""; |
|
1753 | - if (!empty($exercise_id)) { |
|
1754 | - $exercise_id = intval($exercise_id); |
|
1755 | - $condition_quiz =" AND id = $exercise_id "; |
|
1756 | - } |
|
1757 | - |
|
1758 | - // Compose a filter based on optional session id given |
|
1759 | - $condition_session = ""; |
|
1760 | - if (isset($session_id)) { |
|
1761 | - $session_id = intval($session_id); |
|
1762 | - $condition_session = " AND session_id = $session_id "; |
|
1763 | - } |
|
1745 | + $course_info = api_get_course_info($course_code); |
|
1746 | + if (!empty($course_info)) { |
|
1747 | + // table definition |
|
1748 | + $tbl_course_quiz = Database::get_course_table(TABLE_QUIZ_TEST); |
|
1749 | + $tbl_stats_exercise = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
1750 | + |
|
1751 | + // Compose a filter based on optional exercise given |
|
1752 | + $condition_quiz = ""; |
|
1753 | + if (!empty($exercise_id)) { |
|
1754 | + $exercise_id = intval($exercise_id); |
|
1755 | + $condition_quiz =" AND id = $exercise_id "; |
|
1756 | + } |
|
1757 | + |
|
1758 | + // Compose a filter based on optional session id given |
|
1759 | + $condition_session = ""; |
|
1760 | + if (isset($session_id)) { |
|
1761 | + $session_id = intval($session_id); |
|
1762 | + $condition_session = " AND session_id = $session_id "; |
|
1763 | + } |
|
1764 | 1764 | if ($active_filter == 1) { |
1765 | 1765 | $condition_active = 'AND active <> -1'; |
1766 | 1766 | } elseif ($active_filter == 0) { |
@@ -1776,7 +1776,7 @@ discard block |
||
1776 | 1776 | $select_lp_id = ', orig_lp_id as lp_id '; |
1777 | 1777 | } |
1778 | 1778 | |
1779 | - $sql = "SELECT count(id) FROM $tbl_course_quiz |
|
1779 | + $sql = "SELECT count(id) FROM $tbl_course_quiz |
|
1780 | 1780 | WHERE c_id = {$course_info['real_id']} $condition_active $condition_quiz "; |
1781 | 1781 | $count_quiz = 0; |
1782 | 1782 | $countQuizResult = Database::query($sql); |
@@ -1784,21 +1784,21 @@ discard block |
||
1784 | 1784 | $count_quiz = Database::fetch_row($countQuizResult); |
1785 | 1785 | } |
1786 | 1786 | |
1787 | - if (!empty($count_quiz[0]) && !empty($student_id)) { |
|
1788 | - if (is_array($student_id)) { |
|
1787 | + if (!empty($count_quiz[0]) && !empty($student_id)) { |
|
1788 | + if (is_array($student_id)) { |
|
1789 | 1789 | $student_id = array_map('intval', $student_id); |
1790 | - $condition_user = " AND exe_user_id IN (".implode(',', $student_id).") "; |
|
1791 | - } else { |
|
1790 | + $condition_user = " AND exe_user_id IN (".implode(',', $student_id).") "; |
|
1791 | + } else { |
|
1792 | 1792 | $student_id = intval($student_id); |
1793 | - $condition_user = " AND exe_user_id = '$student_id' "; |
|
1794 | - } |
|
1793 | + $condition_user = " AND exe_user_id = '$student_id' "; |
|
1794 | + } |
|
1795 | 1795 | |
1796 | - if (empty($exercise_id)) { |
|
1797 | - $sql = "SELECT id FROM $tbl_course_quiz |
|
1796 | + if (empty($exercise_id)) { |
|
1797 | + $sql = "SELECT id FROM $tbl_course_quiz |
|
1798 | 1798 | WHERE c_id = {$course_info['real_id']} $condition_active $condition_quiz"; |
1799 | 1799 | $result = Database::query($sql); |
1800 | 1800 | $exercise_list = array(); |
1801 | - $exercise_id = null; |
|
1801 | + $exercise_id = null; |
|
1802 | 1802 | if (!empty($result) && Database::num_rows($result)) { |
1803 | 1803 | while ($row = Database::fetch_array($result)) { |
1804 | 1804 | $exercise_list[] = $row['id']; |
@@ -1807,11 +1807,11 @@ discard block |
||
1807 | 1807 | if (!empty($exercise_list)) { |
1808 | 1808 | $exercise_id = implode("','",$exercise_list); |
1809 | 1809 | } |
1810 | - } |
|
1810 | + } |
|
1811 | 1811 | |
1812 | - $count_quiz = Database::fetch_row(Database::query($sql)); |
|
1812 | + $count_quiz = Database::fetch_row(Database::query($sql)); |
|
1813 | 1813 | |
1814 | - $sql = "SELECT |
|
1814 | + $sql = "SELECT |
|
1815 | 1815 | SUM(exe_result/exe_weighting*100) as avg_score, |
1816 | 1816 | COUNT(*) as num_attempts |
1817 | 1817 | $select_lp_id |
@@ -1825,20 +1825,20 @@ discard block |
||
1825 | 1825 | $condition_into_lp |
1826 | 1826 | ORDER BY exe_date DESC"; |
1827 | 1827 | |
1828 | - $res = Database::query($sql); |
|
1829 | - $row = Database::fetch_array($res); |
|
1830 | - $quiz_avg_score = null; |
|
1828 | + $res = Database::query($sql); |
|
1829 | + $row = Database::fetch_array($res); |
|
1830 | + $quiz_avg_score = null; |
|
1831 | 1831 | |
1832 | - if (!empty($row['avg_score'])) { |
|
1833 | - $quiz_avg_score = round($row['avg_score'],2); |
|
1834 | - } |
|
1832 | + if (!empty($row['avg_score'])) { |
|
1833 | + $quiz_avg_score = round($row['avg_score'],2); |
|
1834 | + } |
|
1835 | 1835 | |
1836 | - if(!empty($row['num_attempts'])) { |
|
1837 | - $quiz_avg_score = round($quiz_avg_score / $row['num_attempts'], 2); |
|
1838 | - } |
|
1839 | - if (is_array($student_id)) { |
|
1840 | - $quiz_avg_score = round($quiz_avg_score / count($student_id), 2); |
|
1841 | - } |
|
1836 | + if(!empty($row['num_attempts'])) { |
|
1837 | + $quiz_avg_score = round($quiz_avg_score / $row['num_attempts'], 2); |
|
1838 | + } |
|
1839 | + if (is_array($student_id)) { |
|
1840 | + $quiz_avg_score = round($quiz_avg_score / count($student_id), 2); |
|
1841 | + } |
|
1842 | 1842 | if ($into_lp == 0) { |
1843 | 1843 | return $quiz_avg_score; |
1844 | 1844 | } else { |
@@ -1861,9 +1861,9 @@ discard block |
||
1861 | 1861 | return array($quiz_avg_score, null); |
1862 | 1862 | } |
1863 | 1863 | } |
1864 | - } |
|
1865 | - } |
|
1866 | - return null; |
|
1864 | + } |
|
1865 | + } |
|
1866 | + return null; |
|
1867 | 1867 | } |
1868 | 1868 | |
1869 | 1869 | /** |
@@ -1896,15 +1896,15 @@ discard block |
||
1896 | 1896 | $find_all_lp = 0 |
1897 | 1897 | ) { |
1898 | 1898 | $courseId = intval($courseId); |
1899 | - $student_id = intval($student_id); |
|
1900 | - $exercise_id = intval($exercise_id); |
|
1901 | - $session_id = intval($session_id); |
|
1899 | + $student_id = intval($student_id); |
|
1900 | + $exercise_id = intval($exercise_id); |
|
1901 | + $session_id = intval($session_id); |
|
1902 | 1902 | |
1903 | - $lp_id = intval($lp_id); |
|
1903 | + $lp_id = intval($lp_id); |
|
1904 | 1904 | $lp_item_id = intval($lp_item_id); |
1905 | - $tbl_stats_exercises = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
1905 | + $tbl_stats_exercises = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
1906 | 1906 | |
1907 | - $sql = "SELECT COUNT(ex.exe_id) as essais FROM $tbl_stats_exercises AS ex |
|
1907 | + $sql = "SELECT COUNT(ex.exe_id) as essais FROM $tbl_stats_exercises AS ex |
|
1908 | 1908 | WHERE ex.c_id = $courseId |
1909 | 1909 | AND ex.exe_exo_id = $exercise_id |
1910 | 1910 | AND status = '' |
@@ -1919,11 +1919,11 @@ discard block |
||
1919 | 1919 | AND orig_lp_item_id = $lp_item_id"; |
1920 | 1920 | } |
1921 | 1921 | |
1922 | - $rs = Database::query($sql); |
|
1923 | - $row = Database::fetch_row($rs); |
|
1924 | - $count_attempts = $row[0]; |
|
1922 | + $rs = Database::query($sql); |
|
1923 | + $row = Database::fetch_row($rs); |
|
1924 | + $count_attempts = $row[0]; |
|
1925 | 1925 | |
1926 | - return $count_attempts; |
|
1926 | + return $count_attempts; |
|
1927 | 1927 | } |
1928 | 1928 | |
1929 | 1929 | /** |
@@ -1933,7 +1933,7 @@ discard block |
||
1933 | 1933 | * @param int $user_id |
1934 | 1934 | * @param int $courseId |
1935 | 1935 | * @param int $session_id |
1936 | - */ |
|
1936 | + */ |
|
1937 | 1937 | public static function get_exercise_student_progress($exercise_list, $user_id, $courseId, $session_id) |
1938 | 1938 | { |
1939 | 1939 | $courseId = intval($courseId); |
@@ -3597,8 +3597,8 @@ discard block |
||
3597 | 3597 | |
3598 | 3598 | $condition_session = ''; |
3599 | 3599 | if (isset($session_id)) { |
3600 | - $session_id = intval($session_id); |
|
3601 | - $condition_session = ' AND f.session_id = '. $session_id; |
|
3600 | + $session_id = intval($session_id); |
|
3601 | + $condition_session = ' AND f.session_id = '. $session_id; |
|
3602 | 3602 | } |
3603 | 3603 | |
3604 | 3604 | $groupId = intval($groupId); |
@@ -5503,9 +5503,9 @@ discard block |
||
5503 | 5503 | } |
5504 | 5504 | |
5505 | 5505 | /** |
5506 | - * @param FormValidator $form |
|
5507 | - * @return mixed |
|
5508 | - */ |
|
5506 | + * @param FormValidator $form |
|
5507 | + * @return mixed |
|
5508 | + */ |
|
5509 | 5509 | public static function setUserSearchForm($form) |
5510 | 5510 | { |
5511 | 5511 | global $_configuration; |
@@ -5785,26 +5785,26 @@ discard block |
||
5785 | 5785 | $session_id = api_get_session_id(); |
5786 | 5786 | $course_id = api_get_course_int_id(); |
5787 | 5787 | |
5788 | - $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
5789 | - $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
5788 | + $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
5789 | + $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
5790 | 5790 | |
5791 | - $sql = "SELECT count(tool) AS total_number_of_items |
|
5791 | + $sql = "SELECT count(tool) AS total_number_of_items |
|
5792 | 5792 | FROM $table_item_property track_resource, $table_user user |
5793 | 5793 | WHERE |
5794 | 5794 | track_resource.c_id = $course_id AND |
5795 | 5795 | track_resource.insert_user_id = user.user_id AND |
5796 | 5796 | session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
5797 | 5797 | |
5798 | - if (isset($_GET['keyword'])) { |
|
5799 | - $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
5800 | - $sql .= " AND ( |
|
5798 | + if (isset($_GET['keyword'])) { |
|
5799 | + $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
5800 | + $sql .= " AND ( |
|
5801 | 5801 | user.username LIKE '%".$keyword."%' OR |
5802 | 5802 | lastedit_type LIKE '%".$keyword."%' OR |
5803 | 5803 | tool LIKE '%".$keyword."%' |
5804 | 5804 | )"; |
5805 | - } |
|
5805 | + } |
|
5806 | 5806 | |
5807 | - $sql .= " AND tool IN ( |
|
5807 | + $sql .= " AND tool IN ( |
|
5808 | 5808 | 'document', |
5809 | 5809 | 'learnpath', |
5810 | 5810 | 'quiz', |
@@ -5816,10 +5816,10 @@ discard block |
||
5816 | 5816 | 'thematic_advance', |
5817 | 5817 | 'thematic_plan' |
5818 | 5818 | )"; |
5819 | - $res = Database::query($sql); |
|
5820 | - $obj = Database::fetch_object($res); |
|
5819 | + $res = Database::query($sql); |
|
5820 | + $obj = Database::fetch_object($res); |
|
5821 | 5821 | |
5822 | - return $obj->total_number_of_items; |
|
5822 | + return $obj->total_number_of_items; |
|
5823 | 5823 | } |
5824 | 5824 | |
5825 | 5825 | /** |
@@ -5834,12 +5834,12 @@ discard block |
||
5834 | 5834 | $session_id = api_get_session_id(); |
5835 | 5835 | $course_id = api_get_course_int_id(); |
5836 | 5836 | |
5837 | - $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
5838 | - $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
5839 | - $table_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
|
5840 | - $session_id = intval($session_id); |
|
5837 | + $table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
5838 | + $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
5839 | + $table_session = Database :: get_main_table(TABLE_MAIN_SESSION); |
|
5840 | + $session_id = intval($session_id); |
|
5841 | 5841 | |
5842 | - $sql = "SELECT |
|
5842 | + $sql = "SELECT |
|
5843 | 5843 | tool as col0, |
5844 | 5844 | lastedit_type as col1, |
5845 | 5845 | ref as ref, |
@@ -5853,16 +5853,16 @@ discard block |
||
5853 | 5853 | track_resource.insert_user_id = user.user_id AND |
5854 | 5854 | session_id " .(empty($session_id) ? ' IS NULL ' : " = $session_id "); |
5855 | 5855 | |
5856 | - if (isset($_GET['keyword'])) { |
|
5857 | - $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
5858 | - $sql .= " AND ( |
|
5856 | + if (isset($_GET['keyword'])) { |
|
5857 | + $keyword = Database::escape_string(trim($_GET['keyword'])); |
|
5858 | + $sql .= " AND ( |
|
5859 | 5859 | user.username LIKE '%".$keyword."%' OR |
5860 | 5860 | lastedit_type LIKE '%".$keyword."%' OR |
5861 | 5861 | tool LIKE '%".$keyword."%' |
5862 | 5862 | ) "; |
5863 | - } |
|
5863 | + } |
|
5864 | 5864 | |
5865 | - $sql .= " AND tool IN ( |
|
5865 | + $sql .= " AND tool IN ( |
|
5866 | 5866 | 'document', |
5867 | 5867 | 'learnpath', |
5868 | 5868 | 'quiz', |
@@ -5875,41 +5875,41 @@ discard block |
||
5875 | 5875 | 'thematic_plan' |
5876 | 5876 | )"; |
5877 | 5877 | |
5878 | - if ($column == 0) { |
|
5879 | - $column = '0'; |
|
5880 | - } |
|
5881 | - if ($column != '' && $direction != '') { |
|
5882 | - if ($column != 2 && $column != 4) { |
|
5883 | - $sql .= " ORDER BY col$column $direction"; |
|
5884 | - } |
|
5885 | - } else { |
|
5886 | - $sql .= " ORDER BY col5 DESC "; |
|
5887 | - } |
|
5878 | + if ($column == 0) { |
|
5879 | + $column = '0'; |
|
5880 | + } |
|
5881 | + if ($column != '' && $direction != '') { |
|
5882 | + if ($column != 2 && $column != 4) { |
|
5883 | + $sql .= " ORDER BY col$column $direction"; |
|
5884 | + } |
|
5885 | + } else { |
|
5886 | + $sql .= " ORDER BY col5 DESC "; |
|
5887 | + } |
|
5888 | 5888 | |
5889 | 5889 | $from = intval($from); |
5890 | 5890 | $number_of_items = intval($number_of_items); |
5891 | 5891 | |
5892 | - $sql .= " LIMIT $from, $number_of_items "; |
|
5893 | - |
|
5894 | - $res = Database::query($sql); |
|
5895 | - $resources = array(); |
|
5896 | - $thematic_tools = array('thematic', 'thematic_advance', 'thematic_plan'); |
|
5897 | - while ($row = Database::fetch_array($res)) { |
|
5898 | - $ref = $row['ref']; |
|
5899 | - $table_name = TrackingCourseLog::get_tool_name_table($row['col0']); |
|
5900 | - $table_tool = Database :: get_course_table($table_name['table_name']); |
|
5901 | - |
|
5902 | - $id = $table_name['id_tool']; |
|
5903 | - $recorset = false; |
|
5892 | + $sql .= " LIMIT $from, $number_of_items "; |
|
5904 | 5893 | |
5905 | - if (in_array($row['col0'], array('thematic_plan', 'thematic_advance'))) { |
|
5906 | - $tbl_thematic = Database :: get_course_table(TABLE_THEMATIC); |
|
5907 | - $sql = "SELECT thematic_id FROM $table_tool |
|
5894 | + $res = Database::query($sql); |
|
5895 | + $resources = array(); |
|
5896 | + $thematic_tools = array('thematic', 'thematic_advance', 'thematic_plan'); |
|
5897 | + while ($row = Database::fetch_array($res)) { |
|
5898 | + $ref = $row['ref']; |
|
5899 | + $table_name = TrackingCourseLog::get_tool_name_table($row['col0']); |
|
5900 | + $table_tool = Database :: get_course_table($table_name['table_name']); |
|
5901 | + |
|
5902 | + $id = $table_name['id_tool']; |
|
5903 | + $recorset = false; |
|
5904 | + |
|
5905 | + if (in_array($row['col0'], array('thematic_plan', 'thematic_advance'))) { |
|
5906 | + $tbl_thematic = Database :: get_course_table(TABLE_THEMATIC); |
|
5907 | + $sql = "SELECT thematic_id FROM $table_tool |
|
5908 | 5908 | WHERE c_id = $course_id AND id = $ref"; |
5909 | - $rs_thematic = Database::query($sql); |
|
5910 | - if (Database::num_rows($rs_thematic)) { |
|
5911 | - $row_thematic = Database::fetch_array($rs_thematic); |
|
5912 | - $thematic_id = $row_thematic['thematic_id']; |
|
5909 | + $rs_thematic = Database::query($sql); |
|
5910 | + if (Database::num_rows($rs_thematic)) { |
|
5911 | + $row_thematic = Database::fetch_array($rs_thematic); |
|
5912 | + $thematic_id = $row_thematic['thematic_id']; |
|
5913 | 5913 | |
5914 | 5914 | $sql = "SELECT session.id, session.name, user.username |
5915 | 5915 | FROM $tbl_thematic t, $table_session session, $table_user user |
@@ -5918,9 +5918,9 @@ discard block |
||
5918 | 5918 | t.session_id = session.id AND |
5919 | 5919 | session.id_coach = user.user_id AND |
5920 | 5920 | t.id = $thematic_id"; |
5921 | - $recorset = Database::query($sql); |
|
5922 | - } |
|
5923 | - } else { |
|
5921 | + $recorset = Database::query($sql); |
|
5922 | + } |
|
5923 | + } else { |
|
5924 | 5924 | $sql = "SELECT session.id, session.name, user.username |
5925 | 5925 | FROM $table_tool tool, $table_session session, $table_user user |
5926 | 5926 | WHERE |
@@ -5928,127 +5928,127 @@ discard block |
||
5928 | 5928 | tool.session_id = session.id AND |
5929 | 5929 | session.id_coach = user.user_id AND |
5930 | 5930 | tool.$id = $ref"; |
5931 | - $recorset = Database::query($sql); |
|
5932 | - } |
|
5933 | - |
|
5934 | - if (!empty($recorset)) { |
|
5935 | - $obj = Database::fetch_object($recorset); |
|
5936 | - |
|
5937 | - $name_session = ''; |
|
5938 | - $coach_name = ''; |
|
5939 | - if (!empty($obj)) { |
|
5940 | - $name_session = $obj->name; |
|
5941 | - $coach_name = $obj->username; |
|
5942 | - } |
|
5943 | - |
|
5944 | - $url_tool = api_get_path(WEB_CODE_PATH).$table_name['link_tool']; |
|
5945 | - $row[0] = ''; |
|
5946 | - if ($row['col6'] != 2) { |
|
5947 | - if (in_array($row['col0'], $thematic_tools)) { |
|
5948 | - |
|
5949 | - $exp_thematic_tool = explode('_', $row['col0']); |
|
5950 | - $thematic_tool_title = ''; |
|
5951 | - if (is_array($exp_thematic_tool)) { |
|
5952 | - foreach ($exp_thematic_tool as $exp) { |
|
5953 | - $thematic_tool_title .= api_ucfirst($exp); |
|
5954 | - } |
|
5955 | - } else { |
|
5956 | - $thematic_tool_title = api_ucfirst($row['col0']); |
|
5957 | - } |
|
5958 | - |
|
5959 | - $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'&action=thematic_details">'.get_lang($thematic_tool_title).'</a>'; |
|
5960 | - } else { |
|
5961 | - $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'">'.get_lang('Tool'.api_ucfirst($row['col0'])).'</a>'; |
|
5962 | - } |
|
5963 | - } else { |
|
5964 | - $row[0] = api_ucfirst($row['col0']); |
|
5965 | - } |
|
5966 | - $row[1] = get_lang($row[1]); |
|
5967 | - $row[6] = api_convert_and_format_date($row['col5'], null, date_default_timezone_get()); |
|
5968 | - $row[5] = ''; |
|
5969 | - //@todo Improve this code please |
|
5970 | - switch ($table_name['table_name']) { |
|
5971 | - case 'document' : |
|
5972 | - $sql = "SELECT tool.title as title FROM $table_tool tool |
|
5931 | + $recorset = Database::query($sql); |
|
5932 | + } |
|
5933 | + |
|
5934 | + if (!empty($recorset)) { |
|
5935 | + $obj = Database::fetch_object($recorset); |
|
5936 | + |
|
5937 | + $name_session = ''; |
|
5938 | + $coach_name = ''; |
|
5939 | + if (!empty($obj)) { |
|
5940 | + $name_session = $obj->name; |
|
5941 | + $coach_name = $obj->username; |
|
5942 | + } |
|
5943 | + |
|
5944 | + $url_tool = api_get_path(WEB_CODE_PATH).$table_name['link_tool']; |
|
5945 | + $row[0] = ''; |
|
5946 | + if ($row['col6'] != 2) { |
|
5947 | + if (in_array($row['col0'], $thematic_tools)) { |
|
5948 | + |
|
5949 | + $exp_thematic_tool = explode('_', $row['col0']); |
|
5950 | + $thematic_tool_title = ''; |
|
5951 | + if (is_array($exp_thematic_tool)) { |
|
5952 | + foreach ($exp_thematic_tool as $exp) { |
|
5953 | + $thematic_tool_title .= api_ucfirst($exp); |
|
5954 | + } |
|
5955 | + } else { |
|
5956 | + $thematic_tool_title = api_ucfirst($row['col0']); |
|
5957 | + } |
|
5958 | + |
|
5959 | + $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'&action=thematic_details">'.get_lang($thematic_tool_title).'</a>'; |
|
5960 | + } else { |
|
5961 | + $row[0] = '<a href="'.$url_tool.'?'.api_get_cidreq().'">'.get_lang('Tool'.api_ucfirst($row['col0'])).'</a>'; |
|
5962 | + } |
|
5963 | + } else { |
|
5964 | + $row[0] = api_ucfirst($row['col0']); |
|
5965 | + } |
|
5966 | + $row[1] = get_lang($row[1]); |
|
5967 | + $row[6] = api_convert_and_format_date($row['col5'], null, date_default_timezone_get()); |
|
5968 | + $row[5] = ''; |
|
5969 | + //@todo Improve this code please |
|
5970 | + switch ($table_name['table_name']) { |
|
5971 | + case 'document' : |
|
5972 | + $sql = "SELECT tool.title as title FROM $table_tool tool |
|
5973 | 5973 | WHERE c_id = $course_id AND id = $ref"; |
5974 | - $rs_document = Database::query($sql); |
|
5975 | - $obj_document = Database::fetch_object($rs_document); |
|
5976 | - $row[5] = $obj_document->title; |
|
5974 | + $rs_document = Database::query($sql); |
|
5975 | + $obj_document = Database::fetch_object($rs_document); |
|
5976 | + $row[5] = $obj_document->title; |
|
5977 | 5977 | |
5978 | - break; |
|
5979 | - case 'announcement': |
|
5978 | + break; |
|
5979 | + case 'announcement': |
|
5980 | 5980 | $sql = "SELECT title FROM $table_tool |
5981 | 5981 | WHERE c_id = $course_id AND id = $ref"; |
5982 | - $rs_document = Database::query($sql); |
|
5983 | - $obj_document = Database::fetch_object($rs_document); |
|
5982 | + $rs_document = Database::query($sql); |
|
5983 | + $obj_document = Database::fetch_object($rs_document); |
|
5984 | 5984 | if ($obj_document) { |
5985 | 5985 | $row[5] = $obj_document->title; |
5986 | 5986 | } |
5987 | - break; |
|
5988 | - case 'glossary': |
|
5987 | + break; |
|
5988 | + case 'glossary': |
|
5989 | 5989 | $sql = "SELECT name FROM $table_tool |
5990 | 5990 | WHERE c_id = $course_id AND glossary_id = $ref"; |
5991 | - $rs_document = Database::query($sql); |
|
5992 | - $obj_document = Database::fetch_object($rs_document); |
|
5991 | + $rs_document = Database::query($sql); |
|
5992 | + $obj_document = Database::fetch_object($rs_document); |
|
5993 | 5993 | if ($obj_document) { |
5994 | 5994 | $row[5] = $obj_document->name; |
5995 | 5995 | } |
5996 | - break; |
|
5997 | - case 'lp': |
|
5996 | + break; |
|
5997 | + case 'lp': |
|
5998 | 5998 | $sql = "SELECT name |
5999 | 5999 | FROM $table_tool WHERE c_id = $course_id AND id = $ref"; |
6000 | - $rs_document = Database::query($sql); |
|
6001 | - $obj_document = Database::fetch_object($rs_document); |
|
6002 | - $row[5] = $obj_document->name; |
|
6003 | - break; |
|
6004 | - case 'quiz': |
|
6000 | + $rs_document = Database::query($sql); |
|
6001 | + $obj_document = Database::fetch_object($rs_document); |
|
6002 | + $row[5] = $obj_document->name; |
|
6003 | + break; |
|
6004 | + case 'quiz': |
|
6005 | 6005 | $sql = "SELECT title FROM $table_tool |
6006 | 6006 | WHERE c_id = $course_id AND id = $ref"; |
6007 | - $rs_document = Database::query($sql); |
|
6008 | - $obj_document = Database::fetch_object($rs_document); |
|
6007 | + $rs_document = Database::query($sql); |
|
6008 | + $obj_document = Database::fetch_object($rs_document); |
|
6009 | 6009 | if ($obj_document) { |
6010 | 6010 | $row[5] = $obj_document->title; |
6011 | 6011 | } |
6012 | - break; |
|
6013 | - case 'course_description': |
|
6012 | + break; |
|
6013 | + case 'course_description': |
|
6014 | 6014 | $sql = "SELECT title FROM $table_tool |
6015 | 6015 | WHERE c_id = $course_id AND id = $ref"; |
6016 | - $rs_document = Database::query($sql); |
|
6017 | - $obj_document = Database::fetch_object($rs_document); |
|
6016 | + $rs_document = Database::query($sql); |
|
6017 | + $obj_document = Database::fetch_object($rs_document); |
|
6018 | 6018 | if ($obj_document) { |
6019 | 6019 | $row[5] = $obj_document->title; |
6020 | 6020 | } |
6021 | - break; |
|
6022 | - case 'thematic': |
|
6023 | - $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
6024 | - if (Database::num_rows($rs) > 0) { |
|
6025 | - $obj = Database::fetch_object($rs); |
|
6026 | - $row[5] = $obj->title; |
|
6027 | - } |
|
6028 | - break; |
|
6029 | - case 'thematic_advance': |
|
6030 | - $rs = Database::query("SELECT content FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
6031 | - if (Database::num_rows($rs) > 0) { |
|
6032 | - $obj = Database::fetch_object($rs); |
|
6033 | - $row[5] = $obj->content; |
|
6034 | - } |
|
6035 | - break; |
|
6036 | - case 'thematic_plan': |
|
6037 | - $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
6038 | - if (Database::num_rows($rs) > 0) { |
|
6039 | - $obj = Database::fetch_object($rs); |
|
6040 | - $row[5] = $obj->title; |
|
6041 | - } |
|
6042 | - break; |
|
6043 | - default: |
|
6044 | - break; |
|
6045 | - } |
|
6046 | - |
|
6047 | - $row2 = $name_session; |
|
6048 | - if (!empty($coach_name)) { |
|
6049 | - $row2 .= '<br />'.get_lang('Coach').': '.$coach_name; |
|
6050 | - } |
|
6051 | - $row[2] = $row2; |
|
6021 | + break; |
|
6022 | + case 'thematic': |
|
6023 | + $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
6024 | + if (Database::num_rows($rs) > 0) { |
|
6025 | + $obj = Database::fetch_object($rs); |
|
6026 | + $row[5] = $obj->title; |
|
6027 | + } |
|
6028 | + break; |
|
6029 | + case 'thematic_advance': |
|
6030 | + $rs = Database::query("SELECT content FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
6031 | + if (Database::num_rows($rs) > 0) { |
|
6032 | + $obj = Database::fetch_object($rs); |
|
6033 | + $row[5] = $obj->content; |
|
6034 | + } |
|
6035 | + break; |
|
6036 | + case 'thematic_plan': |
|
6037 | + $rs = Database::query("SELECT title FROM $table_tool WHERE c_id = $course_id AND id = $ref"); |
|
6038 | + if (Database::num_rows($rs) > 0) { |
|
6039 | + $obj = Database::fetch_object($rs); |
|
6040 | + $row[5] = $obj->title; |
|
6041 | + } |
|
6042 | + break; |
|
6043 | + default: |
|
6044 | + break; |
|
6045 | + } |
|
6046 | + |
|
6047 | + $row2 = $name_session; |
|
6048 | + if (!empty($coach_name)) { |
|
6049 | + $row2 .= '<br />'.get_lang('Coach').': '.$coach_name; |
|
6050 | + } |
|
6051 | + $row[2] = $row2; |
|
6052 | 6052 | if (!empty($row['col3'])) { |
6053 | 6053 | $userInfo = api_get_user_info($row['user_id']); |
6054 | 6054 | |
@@ -6065,11 +6065,11 @@ discard block |
||
6065 | 6065 | $row[4] = $ip; |
6066 | 6066 | } |
6067 | 6067 | |
6068 | - $resources[] = $row; |
|
6069 | - } |
|
6070 | - } |
|
6068 | + $resources[] = $row; |
|
6069 | + } |
|
6070 | + } |
|
6071 | 6071 | |
6072 | - return $resources; |
|
6072 | + return $resources; |
|
6073 | 6073 | } |
6074 | 6074 | |
6075 | 6075 | /** |
@@ -6079,63 +6079,63 @@ discard block |
||
6079 | 6079 | */ |
6080 | 6080 | public static function get_tool_name_table($tool) |
6081 | 6081 | { |
6082 | - switch ($tool) { |
|
6083 | - case 'document': |
|
6084 | - $table_name = TABLE_DOCUMENT; |
|
6085 | - $link_tool = 'document/document.php'; |
|
6086 | - $id_tool = 'id'; |
|
6087 | - break; |
|
6088 | - case 'learnpath': |
|
6089 | - $table_name = TABLE_LP_MAIN; |
|
6090 | - $link_tool = 'lp/lp_controller.php'; |
|
6091 | - $id_tool = 'id'; |
|
6092 | - break; |
|
6093 | - case 'quiz': |
|
6094 | - $table_name = TABLE_QUIZ_TEST; |
|
6095 | - $link_tool = 'exercise/exercise.php'; |
|
6096 | - $id_tool = 'id'; |
|
6097 | - break; |
|
6098 | - case 'glossary': |
|
6099 | - $table_name = TABLE_GLOSSARY; |
|
6100 | - $link_tool = 'glossary/index.php'; |
|
6101 | - $id_tool = 'glossary_id'; |
|
6102 | - break; |
|
6103 | - case 'link': |
|
6104 | - $table_name = TABLE_LINK; |
|
6105 | - $link_tool = 'link/link.php'; |
|
6106 | - $id_tool = 'id'; |
|
6107 | - break; |
|
6108 | - case 'course_description': |
|
6109 | - $table_name = TABLE_COURSE_DESCRIPTION; |
|
6110 | - $link_tool = 'course_description/'; |
|
6111 | - $id_tool = 'id'; |
|
6112 | - break; |
|
6113 | - case 'announcement': |
|
6114 | - $table_name = TABLE_ANNOUNCEMENT; |
|
6115 | - $link_tool = 'announcements/announcements.php'; |
|
6116 | - $id_tool = 'id'; |
|
6117 | - break; |
|
6118 | - case 'thematic': |
|
6119 | - $table_name = TABLE_THEMATIC; |
|
6120 | - $link_tool = 'course_progress/index.php'; |
|
6121 | - $id_tool = 'id'; |
|
6122 | - break; |
|
6123 | - case 'thematic_advance': |
|
6124 | - $table_name = TABLE_THEMATIC_ADVANCE; |
|
6125 | - $link_tool = 'course_progress/index.php'; |
|
6126 | - $id_tool = 'id'; |
|
6127 | - break; |
|
6128 | - case 'thematic_plan': |
|
6129 | - $table_name = TABLE_THEMATIC_PLAN; |
|
6130 | - $link_tool = 'course_progress/index.php'; |
|
6131 | - $id_tool = 'id'; |
|
6132 | - break; |
|
6133 | - default: |
|
6134 | - $table_name = $tool; |
|
6135 | - break; |
|
6136 | - } |
|
6137 | - |
|
6138 | - return array( |
|
6082 | + switch ($tool) { |
|
6083 | + case 'document': |
|
6084 | + $table_name = TABLE_DOCUMENT; |
|
6085 | + $link_tool = 'document/document.php'; |
|
6086 | + $id_tool = 'id'; |
|
6087 | + break; |
|
6088 | + case 'learnpath': |
|
6089 | + $table_name = TABLE_LP_MAIN; |
|
6090 | + $link_tool = 'lp/lp_controller.php'; |
|
6091 | + $id_tool = 'id'; |
|
6092 | + break; |
|
6093 | + case 'quiz': |
|
6094 | + $table_name = TABLE_QUIZ_TEST; |
|
6095 | + $link_tool = 'exercise/exercise.php'; |
|
6096 | + $id_tool = 'id'; |
|
6097 | + break; |
|
6098 | + case 'glossary': |
|
6099 | + $table_name = TABLE_GLOSSARY; |
|
6100 | + $link_tool = 'glossary/index.php'; |
|
6101 | + $id_tool = 'glossary_id'; |
|
6102 | + break; |
|
6103 | + case 'link': |
|
6104 | + $table_name = TABLE_LINK; |
|
6105 | + $link_tool = 'link/link.php'; |
|
6106 | + $id_tool = 'id'; |
|
6107 | + break; |
|
6108 | + case 'course_description': |
|
6109 | + $table_name = TABLE_COURSE_DESCRIPTION; |
|
6110 | + $link_tool = 'course_description/'; |
|
6111 | + $id_tool = 'id'; |
|
6112 | + break; |
|
6113 | + case 'announcement': |
|
6114 | + $table_name = TABLE_ANNOUNCEMENT; |
|
6115 | + $link_tool = 'announcements/announcements.php'; |
|
6116 | + $id_tool = 'id'; |
|
6117 | + break; |
|
6118 | + case 'thematic': |
|
6119 | + $table_name = TABLE_THEMATIC; |
|
6120 | + $link_tool = 'course_progress/index.php'; |
|
6121 | + $id_tool = 'id'; |
|
6122 | + break; |
|
6123 | + case 'thematic_advance': |
|
6124 | + $table_name = TABLE_THEMATIC_ADVANCE; |
|
6125 | + $link_tool = 'course_progress/index.php'; |
|
6126 | + $id_tool = 'id'; |
|
6127 | + break; |
|
6128 | + case 'thematic_plan': |
|
6129 | + $table_name = TABLE_THEMATIC_PLAN; |
|
6130 | + $link_tool = 'course_progress/index.php'; |
|
6131 | + $id_tool = 'id'; |
|
6132 | + break; |
|
6133 | + default: |
|
6134 | + $table_name = $tool; |
|
6135 | + break; |
|
6136 | + } |
|
6137 | + |
|
6138 | + return array( |
|
6139 | 6139 | 'table_name' => $table_name, |
6140 | 6140 | 'link_tool' => $link_tool, |
6141 | 6141 | 'id_tool' => $id_tool |
@@ -6144,45 +6144,45 @@ discard block |
||
6144 | 6144 | |
6145 | 6145 | public static function display_additional_profile_fields() |
6146 | 6146 | { |
6147 | - // getting all the extra profile fields that are defined by the platform administrator |
|
6148 | - $extra_fields = UserManager :: get_extra_fields(0,50,5,'ASC'); |
|
6149 | - |
|
6150 | - // creating the form |
|
6151 | - $return = '<form action="courseLog.php" method="get" name="additional_profile_field_form" id="additional_profile_field_form">'; |
|
6152 | - |
|
6153 | - // the select field with the additional user profile fields (= this is where we select the field of which we want to see |
|
6154 | - // the information the users have entered or selected. |
|
6155 | - $return .= '<select name="additional_profile_field">'; |
|
6156 | - $return .= '<option value="-">'.get_lang('SelectFieldToAdd').'</option>'; |
|
6157 | - $extra_fields_to_show = 0; |
|
6158 | - foreach ($extra_fields as $key=>$field) { |
|
6159 | - // show only extra fields that are visible + and can be filtered, added by J.Montoya |
|
6160 | - if ($field[6]==1 && $field[8] == 1) { |
|
6161 | - if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field'] ) { |
|
6162 | - $selected = 'selected="selected"'; |
|
6163 | - } else { |
|
6164 | - $selected = ''; |
|
6165 | - } |
|
6166 | - $extra_fields_to_show++; |
|
6167 | - $return .= '<option value="'.$field[0].'" '.$selected.'>'.$field[3].'</option>'; |
|
6168 | - } |
|
6169 | - } |
|
6170 | - $return .= '</select>'; |
|
6171 | - |
|
6172 | - // the form elements for the $_GET parameters (because the form is passed through GET |
|
6173 | - foreach ($_GET as $key=>$value){ |
|
6174 | - if ($key <> 'additional_profile_field') { |
|
6175 | - $return .= '<input type="hidden" name="'.Security::remove_XSS($key).'" value="'.Security::remove_XSS($value).'" />'; |
|
6176 | - } |
|
6177 | - } |
|
6178 | - // the submit button |
|
6179 | - $return .= '<button class="save" type="submit">'.get_lang('AddAdditionalProfileField').'</button>'; |
|
6180 | - $return .= '</form>'; |
|
6181 | - if ($extra_fields_to_show > 0) { |
|
6182 | - return $return; |
|
6183 | - } else { |
|
6184 | - return ''; |
|
6185 | - } |
|
6147 | + // getting all the extra profile fields that are defined by the platform administrator |
|
6148 | + $extra_fields = UserManager :: get_extra_fields(0,50,5,'ASC'); |
|
6149 | + |
|
6150 | + // creating the form |
|
6151 | + $return = '<form action="courseLog.php" method="get" name="additional_profile_field_form" id="additional_profile_field_form">'; |
|
6152 | + |
|
6153 | + // the select field with the additional user profile fields (= this is where we select the field of which we want to see |
|
6154 | + // the information the users have entered or selected. |
|
6155 | + $return .= '<select name="additional_profile_field">'; |
|
6156 | + $return .= '<option value="-">'.get_lang('SelectFieldToAdd').'</option>'; |
|
6157 | + $extra_fields_to_show = 0; |
|
6158 | + foreach ($extra_fields as $key=>$field) { |
|
6159 | + // show only extra fields that are visible + and can be filtered, added by J.Montoya |
|
6160 | + if ($field[6]==1 && $field[8] == 1) { |
|
6161 | + if (isset($_GET['additional_profile_field']) && $field[0] == $_GET['additional_profile_field'] ) { |
|
6162 | + $selected = 'selected="selected"'; |
|
6163 | + } else { |
|
6164 | + $selected = ''; |
|
6165 | + } |
|
6166 | + $extra_fields_to_show++; |
|
6167 | + $return .= '<option value="'.$field[0].'" '.$selected.'>'.$field[3].'</option>'; |
|
6168 | + } |
|
6169 | + } |
|
6170 | + $return .= '</select>'; |
|
6171 | + |
|
6172 | + // the form elements for the $_GET parameters (because the form is passed through GET |
|
6173 | + foreach ($_GET as $key=>$value){ |
|
6174 | + if ($key <> 'additional_profile_field') { |
|
6175 | + $return .= '<input type="hidden" name="'.Security::remove_XSS($key).'" value="'.Security::remove_XSS($value).'" />'; |
|
6176 | + } |
|
6177 | + } |
|
6178 | + // the submit button |
|
6179 | + $return .= '<button class="save" type="submit">'.get_lang('AddAdditionalProfileField').'</button>'; |
|
6180 | + $return .= '</form>'; |
|
6181 | + if ($extra_fields_to_show > 0) { |
|
6182 | + return $return; |
|
6183 | + } else { |
|
6184 | + return ''; |
|
6185 | + } |
|
6186 | 6186 | } |
6187 | 6187 | |
6188 | 6188 | /** |
@@ -6201,31 +6201,31 @@ discard block |
||
6201 | 6201 | */ |
6202 | 6202 | public static function get_addtional_profile_information_of_field_by_user($field_id, $users) |
6203 | 6203 | { |
6204 | - // Database table definition |
|
6205 | - $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
6206 | - $table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES); |
|
6204 | + // Database table definition |
|
6205 | + $table_user = Database::get_main_table(TABLE_MAIN_USER); |
|
6206 | + $table_user_field_values = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES); |
|
6207 | 6207 | $extraField = Database::get_main_table(TABLE_EXTRA_FIELD); |
6208 | - $result_extra_field = UserManager::get_extra_field_information($field_id); |
|
6209 | - |
|
6210 | - if (!empty($users)) { |
|
6211 | - if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG ) { |
|
6212 | - foreach($users as $user_id) { |
|
6213 | - $user_result = UserManager::get_user_tags($user_id, $field_id); |
|
6214 | - $tag_list = array(); |
|
6215 | - foreach($user_result as $item) { |
|
6216 | - $tag_list[] = $item['tag']; |
|
6217 | - } |
|
6218 | - $return[$user_id][] = implode(', ',$tag_list); |
|
6219 | - } |
|
6220 | - } else { |
|
6221 | - $new_user_array = array(); |
|
6222 | - foreach ($users as $user_id) { |
|
6223 | - $new_user_array[]= "'".$user_id."'"; |
|
6224 | - } |
|
6225 | - $users = implode(',',$new_user_array); |
|
6208 | + $result_extra_field = UserManager::get_extra_field_information($field_id); |
|
6209 | + |
|
6210 | + if (!empty($users)) { |
|
6211 | + if ($result_extra_field['field_type'] == UserManager::USER_FIELD_TYPE_TAG ) { |
|
6212 | + foreach($users as $user_id) { |
|
6213 | + $user_result = UserManager::get_user_tags($user_id, $field_id); |
|
6214 | + $tag_list = array(); |
|
6215 | + foreach($user_result as $item) { |
|
6216 | + $tag_list[] = $item['tag']; |
|
6217 | + } |
|
6218 | + $return[$user_id][] = implode(', ',$tag_list); |
|
6219 | + } |
|
6220 | + } else { |
|
6221 | + $new_user_array = array(); |
|
6222 | + foreach ($users as $user_id) { |
|
6223 | + $new_user_array[]= "'".$user_id."'"; |
|
6224 | + } |
|
6225 | + $users = implode(',',$new_user_array); |
|
6226 | 6226 | $extraFieldType = EntityExtraField::USER_FIELD_TYPE; |
6227 | - // Selecting only the necessary information NOT ALL the user list |
|
6228 | - $sql = "SELECT user.user_id, v.value |
|
6227 | + // Selecting only the necessary information NOT ALL the user list |
|
6228 | + $sql = "SELECT user.user_id, v.value |
|
6229 | 6229 | FROM $table_user user |
6230 | 6230 | INNER JOIN $table_user_field_values v |
6231 | 6231 | ON (user.user_id = v.item_id) |
@@ -6236,27 +6236,27 @@ discard block |
||
6236 | 6236 | v.field_id=".intval($field_id)." AND |
6237 | 6237 | user.user_id IN ($users)"; |
6238 | 6238 | |
6239 | - $result = Database::query($sql); |
|
6240 | - while($row = Database::fetch_array($result)) { |
|
6241 | - // get option value for field type double select by id |
|
6242 | - if (!empty($row['value'])) { |
|
6243 | - if ($result_extra_field['field_type'] == |
|
6239 | + $result = Database::query($sql); |
|
6240 | + while($row = Database::fetch_array($result)) { |
|
6241 | + // get option value for field type double select by id |
|
6242 | + if (!empty($row['value'])) { |
|
6243 | + if ($result_extra_field['field_type'] == |
|
6244 | 6244 | ExtraField::FIELD_TYPE_DOUBLE_SELECT |
6245 | 6245 | ) { |
6246 | - $id_double_select = explode(';', $row['value']); |
|
6247 | - if (is_array($id_double_select)) { |
|
6248 | - $value1 = $result_extra_field['options'][$id_double_select[0]]['option_value']; |
|
6249 | - $value2 = $result_extra_field['options'][$id_double_select[1]]['option_value']; |
|
6250 | - $row['value'] = ($value1.';'.$value2); |
|
6251 | - } |
|
6252 | - } |
|
6253 | - } |
|
6254 | - // get other value from extra field |
|
6255 | - $return[$row['user_id']][] = $row['value']; |
|
6256 | - } |
|
6257 | - } |
|
6258 | - } |
|
6259 | - return $return; |
|
6246 | + $id_double_select = explode(';', $row['value']); |
|
6247 | + if (is_array($id_double_select)) { |
|
6248 | + $value1 = $result_extra_field['options'][$id_double_select[0]]['option_value']; |
|
6249 | + $value2 = $result_extra_field['options'][$id_double_select[1]]['option_value']; |
|
6250 | + $row['value'] = ($value1.';'.$value2); |
|
6251 | + } |
|
6252 | + } |
|
6253 | + } |
|
6254 | + // get other value from extra field |
|
6255 | + $return[$row['user_id']][] = $row['value']; |
|
6256 | + } |
|
6257 | + } |
|
6258 | + } |
|
6259 | + return $return; |
|
6260 | 6260 | } |
6261 | 6261 | |
6262 | 6262 | /** |
@@ -6265,18 +6265,18 @@ discard block |
||
6265 | 6265 | */ |
6266 | 6266 | public function count_student_in_course() |
6267 | 6267 | { |
6268 | - global $nbStudents; |
|
6269 | - return $nbStudents; |
|
6268 | + global $nbStudents; |
|
6269 | + return $nbStudents; |
|
6270 | 6270 | } |
6271 | 6271 | |
6272 | 6272 | public function sort_users($a, $b) |
6273 | 6273 | { |
6274 | - return strcmp(trim(api_strtolower($a[$_SESSION['tracking_column']])), trim(api_strtolower($b[$_SESSION['tracking_column']]))); |
|
6274 | + return strcmp(trim(api_strtolower($a[$_SESSION['tracking_column']])), trim(api_strtolower($b[$_SESSION['tracking_column']]))); |
|
6275 | 6275 | } |
6276 | 6276 | |
6277 | 6277 | public function sort_users_desc($a, $b) |
6278 | 6278 | { |
6279 | - return strcmp( trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); |
|
6279 | + return strcmp( trim(api_strtolower($b[$_SESSION['tracking_column']])), trim(api_strtolower($a[$_SESSION['tracking_column']]))); |
|
6280 | 6280 | } |
6281 | 6281 | |
6282 | 6282 | /** |
@@ -6285,8 +6285,8 @@ discard block |
||
6285 | 6285 | */ |
6286 | 6286 | public static function get_number_of_users() |
6287 | 6287 | { |
6288 | - global $user_ids; |
|
6289 | - return count($user_ids); |
|
6288 | + global $user_ids; |
|
6289 | + return count($user_ids); |
|
6290 | 6290 | } |
6291 | 6291 | |
6292 | 6292 | /** |
@@ -6302,37 +6302,37 @@ discard block |
||
6302 | 6302 | { |
6303 | 6303 | global $user_ids, $course_code, $additional_user_profile_info, $export_csv, $is_western_name_order, $csv_content, $session_id; |
6304 | 6304 | |
6305 | - $course_code = Database::escape_string($course_code); |
|
6306 | - $tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
|
6307 | - $tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
6305 | + $course_code = Database::escape_string($course_code); |
|
6306 | + $tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
|
6307 | + $tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
6308 | 6308 | |
6309 | - $access_url_id = api_get_current_access_url_id(); |
|
6309 | + $access_url_id = api_get_current_access_url_id(); |
|
6310 | 6310 | |
6311 | - // get all users data from a course for sortable with limit |
|
6312 | - if (is_array($user_ids)) { |
|
6313 | - $user_ids = array_map('intval', $user_ids); |
|
6314 | - $condition_user = " WHERE user.user_id IN (".implode(',',$user_ids).") "; |
|
6315 | - } else { |
|
6316 | - $user_ids = intval($user_ids); |
|
6317 | - $condition_user = " WHERE user.user_id = $user_ids "; |
|
6318 | - } |
|
6311 | + // get all users data from a course for sortable with limit |
|
6312 | + if (is_array($user_ids)) { |
|
6313 | + $user_ids = array_map('intval', $user_ids); |
|
6314 | + $condition_user = " WHERE user.user_id IN (".implode(',',$user_ids).") "; |
|
6315 | + } else { |
|
6316 | + $user_ids = intval($user_ids); |
|
6317 | + $condition_user = " WHERE user.user_id = $user_ids "; |
|
6318 | + } |
|
6319 | 6319 | |
6320 | - if (!empty($_GET['user_keyword'])) { |
|
6321 | - $keyword = trim(Database::escape_string($_GET['user_keyword'])); |
|
6322 | - $condition_user .= " AND ( |
|
6320 | + if (!empty($_GET['user_keyword'])) { |
|
6321 | + $keyword = trim(Database::escape_string($_GET['user_keyword'])); |
|
6322 | + $condition_user .= " AND ( |
|
6323 | 6323 | user.firstname LIKE '%".$keyword."%' OR |
6324 | 6324 | user.lastname LIKE '%".$keyword."%' OR |
6325 | 6325 | user.username LIKE '%".$keyword."%' OR |
6326 | 6326 | user.email LIKE '%".$keyword."%' |
6327 | 6327 | ) "; |
6328 | - } |
|
6328 | + } |
|
6329 | 6329 | |
6330 | 6330 | $url_table = null; |
6331 | 6331 | $url_condition = null; |
6332 | - if (api_is_multiple_url_enabled()) { |
|
6333 | - $url_table = ", ".$tbl_url_rel_user." as url_users"; |
|
6334 | - $url_condition = " AND user.user_id = url_users.user_id AND access_url_id='$access_url_id'"; |
|
6335 | - } |
|
6332 | + if (api_is_multiple_url_enabled()) { |
|
6333 | + $url_table = ", ".$tbl_url_rel_user." as url_users"; |
|
6334 | + $url_condition = " AND user.user_id = url_users.user_id AND access_url_id='$access_url_id'"; |
|
6335 | + } |
|
6336 | 6336 | |
6337 | 6337 | $invitedUsersCondition = ''; |
6338 | 6338 | |
@@ -6340,7 +6340,7 @@ discard block |
||
6340 | 6340 | $invitedUsersCondition = " AND user.status != " . INVITEE; |
6341 | 6341 | } |
6342 | 6342 | |
6343 | - $sql = "SELECT user.user_id as user_id, |
|
6343 | + $sql = "SELECT user.user_id as user_id, |
|
6344 | 6344 | user.official_code as col0, |
6345 | 6345 | user.lastname as col1, |
6346 | 6346 | user.firstname as col2, |
@@ -6348,17 +6348,17 @@ discard block |
||
6348 | 6348 | FROM $tbl_user as user $url_table |
6349 | 6349 | $condition_user $url_condition $invitedUsersCondition"; |
6350 | 6350 | |
6351 | - if (!in_array($direction, array('ASC','DESC'))) { |
|
6352 | - $direction = 'ASC'; |
|
6353 | - } |
|
6351 | + if (!in_array($direction, array('ASC','DESC'))) { |
|
6352 | + $direction = 'ASC'; |
|
6353 | + } |
|
6354 | 6354 | |
6355 | - $column = intval($column); |
|
6355 | + $column = intval($column); |
|
6356 | 6356 | |
6357 | - $from = intval($from); |
|
6358 | - $number_of_items = intval($number_of_items); |
|
6357 | + $from = intval($from); |
|
6358 | + $number_of_items = intval($number_of_items); |
|
6359 | 6359 | |
6360 | - $sql .= " ORDER BY col$column $direction "; |
|
6361 | - $sql .= " LIMIT $from,$number_of_items"; |
|
6360 | + $sql .= " ORDER BY col$column $direction "; |
|
6361 | + $sql .= " LIMIT $from,$number_of_items"; |
|
6362 | 6362 | |
6363 | 6363 | $res = Database::query($sql); |
6364 | 6364 | $users = array(); |
@@ -6392,7 +6392,7 @@ discard block |
||
6392 | 6392 | } |
6393 | 6393 | } |
6394 | 6394 | |
6395 | - while ($user = Database::fetch_array($res, 'ASSOC')) { |
|
6395 | + while ($user = Database::fetch_array($res, 'ASSOC')) { |
|
6396 | 6396 | $courseInfo = api_get_course_info($course_code); |
6397 | 6397 | $courseId = $courseInfo['real_id']; |
6398 | 6398 | |
@@ -6423,10 +6423,10 @@ discard block |
||
6423 | 6423 | $session_id |
6424 | 6424 | ); |
6425 | 6425 | |
6426 | - if (empty($avg_student_progress)) { |
|
6426 | + if (empty($avg_student_progress)) { |
|
6427 | 6427 | $avg_student_progress = 0; |
6428 | - } |
|
6429 | - $user['average_progress'] = $avg_student_progress.'%'; |
|
6428 | + } |
|
6429 | + $user['average_progress'] = $avg_student_progress.'%'; |
|
6430 | 6430 | |
6431 | 6431 | $total_user_exercise = Tracking::get_exercise_student_progress( |
6432 | 6432 | $total_exercises, |
@@ -6446,11 +6446,11 @@ discard block |
||
6446 | 6446 | |
6447 | 6447 | $user['exercise_average_best_attempt'] = $total_user_exercise; |
6448 | 6448 | |
6449 | - if (is_numeric($avg_student_score)) { |
|
6450 | - $user['student_score'] = $avg_student_score.'%'; |
|
6451 | - } else { |
|
6452 | - $user['student_score'] = $avg_student_score; |
|
6453 | - } |
|
6449 | + if (is_numeric($avg_student_score)) { |
|
6450 | + $user['student_score'] = $avg_student_score.'%'; |
|
6451 | + } else { |
|
6452 | + $user['student_score'] = $avg_student_score; |
|
6453 | + } |
|
6454 | 6454 | |
6455 | 6455 | $user['count_assignments'] = Tracking::count_student_assignments( |
6456 | 6456 | $user['user_id'], |
@@ -6473,29 +6473,29 @@ discard block |
||
6473 | 6473 | $session_id |
6474 | 6474 | ); |
6475 | 6475 | |
6476 | - // we need to display an additional profile field |
|
6477 | - $user['additional'] = ''; |
|
6476 | + // we need to display an additional profile field |
|
6477 | + $user['additional'] = ''; |
|
6478 | 6478 | |
6479 | - if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) { |
|
6480 | - if (isset($additional_user_profile_info[$user['user_id']]) && |
|
6479 | + if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_profile_field'])) { |
|
6480 | + if (isset($additional_user_profile_info[$user['user_id']]) && |
|
6481 | 6481 | is_array($additional_user_profile_info[$user['user_id']]) |
6482 | 6482 | ) { |
6483 | - $user['additional'] = implode(', ', $additional_user_profile_info[$user['user_id']]); |
|
6484 | - } |
|
6485 | - } |
|
6483 | + $user['additional'] = implode(', ', $additional_user_profile_info[$user['user_id']]); |
|
6484 | + } |
|
6485 | + } |
|
6486 | 6486 | |
6487 | 6487 | if (empty($session_id)) { |
6488 | 6488 | $user['survey'] = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0) .' / '.$total_surveys; |
6489 | 6489 | } |
6490 | 6490 | |
6491 | - $user['link'] = '<center> |
|
6491 | + $user['link'] = '<center> |
|
6492 | 6492 | <a href="../mySpace/myStudents.php?student='.$user['user_id'].'&details=true&course='.$course_code.'&origin=tracking_course&id_session='.$session_id.'"> |
6493 | 6493 | '.Display::return_icon('2rightarrow.png').' |
6494 | 6494 | </a> |
6495 | 6495 | </center>'; |
6496 | 6496 | |
6497 | - // store columns in array $users |
|
6498 | - $is_western_name_order = api_is_western_name_order(); |
|
6497 | + // store columns in array $users |
|
6498 | + $is_western_name_order = api_is_western_name_order(); |
|
6499 | 6499 | $user_row = array(); |
6500 | 6500 | $user_row[]= $user['official_code']; //0 |
6501 | 6501 | if ($is_western_name_order) { |
@@ -6531,21 +6531,21 @@ discard block |
||
6531 | 6531 | |
6532 | 6532 | $users[] = $user_row; |
6533 | 6533 | |
6534 | - if ($export_csv) { |
|
6535 | - if (empty($session_id)) { |
|
6534 | + if ($export_csv) { |
|
6535 | + if (empty($session_id)) { |
|
6536 | 6536 | $user_row = array_map('strip_tags', $user_row); |
6537 | - unset($user_row[14]); |
|
6538 | - unset($user_row[15]); |
|
6537 | + unset($user_row[14]); |
|
6538 | + unset($user_row[15]); |
|
6539 | 6539 | } else { |
6540 | 6540 | $user_row = array_map('strip_tags', $user_row); |
6541 | 6541 | unset($user_row[13]); |
6542 | 6542 | unset($user_row[14]); |
6543 | 6543 | } |
6544 | 6544 | |
6545 | - $csv_content[] = $user_row; |
|
6546 | - } |
|
6547 | - } |
|
6548 | - return $users; |
|
6545 | + $csv_content[] = $user_row; |
|
6546 | + } |
|
6547 | + } |
|
6548 | + return $users; |
|
6549 | 6549 | } |
6550 | 6550 | } |
6551 | 6551 | |
@@ -6563,18 +6563,18 @@ discard block |
||
6563 | 6563 | */ |
6564 | 6564 | public function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0) |
6565 | 6565 | { |
6566 | - $MonthsLong = $GLOBALS['MonthsLong']; |
|
6567 | - |
|
6568 | - // protected data |
|
6569 | - $user_id = intval($user_id); |
|
6570 | - $session_id = intval($session_id); |
|
6571 | - $course_id = Database::escape_string($course_id); |
|
6572 | - |
|
6573 | - $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
6574 | - $tempView = $view; |
|
6575 | - if(substr($view,0,1) == '1') { |
|
6576 | - $new_view = substr_replace($view,'0',0,1); |
|
6577 | - echo " |
|
6566 | + $MonthsLong = $GLOBALS['MonthsLong']; |
|
6567 | + |
|
6568 | + // protected data |
|
6569 | + $user_id = intval($user_id); |
|
6570 | + $session_id = intval($session_id); |
|
6571 | + $course_id = Database::escape_string($course_id); |
|
6572 | + |
|
6573 | + $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
6574 | + $tempView = $view; |
|
6575 | + if(substr($view,0,1) == '1') { |
|
6576 | + $new_view = substr_replace($view,'0',0,1); |
|
6577 | + echo " |
|
6578 | 6578 | <tr> |
6579 | 6579 | <td valign='top'> |
6580 | 6580 | <font color='#0000FF'>- </font>" . |
@@ -6582,9 +6582,9 @@ discard block |
||
6582 | 6582 | </td> |
6583 | 6583 | </tr> |
6584 | 6584 | "; |
6585 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LoginsDetails')."<br>"; |
|
6585 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LoginsDetails')."<br>"; |
|
6586 | 6586 | |
6587 | - $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
6587 | + $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
6588 | 6588 | FROM $track_access_table |
6589 | 6589 | WHERE access_user_id = $user_id |
6590 | 6590 | AND c_id = $course_id |
@@ -6592,11 +6592,11 @@ discard block |
||
6592 | 6592 | GROUP BY YEAR(access_date),MONTH(access_date) |
6593 | 6593 | ORDER BY YEAR(access_date),MONTH(access_date) ASC"; |
6594 | 6594 | |
6595 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6596 | - $results = getManyResults3Col($sql); |
|
6595 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6596 | + $results = getManyResults3Col($sql); |
|
6597 | 6597 | |
6598 | - echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6599 | - echo "<tr> |
|
6598 | + echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6599 | + echo "<tr> |
|
6600 | 6600 | <td class='secLine'> |
6601 | 6601 | ".get_lang('LoginsTitleMonthColumn')." |
6602 | 6602 | </td> |
@@ -6604,36 +6604,36 @@ discard block |
||
6604 | 6604 | ".get_lang('LoginsTitleCountColumn')." |
6605 | 6605 | </td> |
6606 | 6606 | </tr>"; |
6607 | - $total = 0; |
|
6608 | - if (is_array($results)) { |
|
6609 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6610 | - echo "<tr>"; |
|
6611 | - echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0])-1].' '.date('Y', $results[$j][0])."</a></td>"; |
|
6612 | - echo "<td valign='top' align='right' class='content'>".$results[$j][1]."</td>"; |
|
6613 | - echo"</tr>"; |
|
6614 | - $total = $total + $results[$j][1]; |
|
6615 | - } |
|
6616 | - echo "<tr>"; |
|
6617 | - echo "<td>".get_lang('Total')."</td>"; |
|
6618 | - echo "<td align='right' class='content'>".$total."</td>"; |
|
6619 | - echo"</tr>"; |
|
6620 | - } else { |
|
6621 | - echo "<tr>"; |
|
6622 | - echo "<td colspan='2'><center>".get_lang('NoResult')."</center></td>"; |
|
6623 | - echo"</tr>"; |
|
6624 | - } |
|
6625 | - echo "</table>"; |
|
6626 | - echo "</td></tr>"; |
|
6627 | - } else { |
|
6628 | - $new_view = substr_replace($view,'1',0,1); |
|
6629 | - echo " |
|
6607 | + $total = 0; |
|
6608 | + if (is_array($results)) { |
|
6609 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
6610 | + echo "<tr>"; |
|
6611 | + echo "<td class='content'><a href='logins_details.php?uInfo=".$user_id."&reqdate=".$results[$j][0]."&view=".Security::remove_XSS($view)."'>".$MonthsLong[date('n', $results[$j][0])-1].' '.date('Y', $results[$j][0])."</a></td>"; |
|
6612 | + echo "<td valign='top' align='right' class='content'>".$results[$j][1]."</td>"; |
|
6613 | + echo"</tr>"; |
|
6614 | + $total = $total + $results[$j][1]; |
|
6615 | + } |
|
6616 | + echo "<tr>"; |
|
6617 | + echo "<td>".get_lang('Total')."</td>"; |
|
6618 | + echo "<td align='right' class='content'>".$total."</td>"; |
|
6619 | + echo"</tr>"; |
|
6620 | + } else { |
|
6621 | + echo "<tr>"; |
|
6622 | + echo "<td colspan='2'><center>".get_lang('NoResult')."</center></td>"; |
|
6623 | + echo"</tr>"; |
|
6624 | + } |
|
6625 | + echo "</table>"; |
|
6626 | + echo "</td></tr>"; |
|
6627 | + } else { |
|
6628 | + $new_view = substr_replace($view,'1',0,1); |
|
6629 | + echo " |
|
6630 | 6630 | <tr> |
6631 | 6631 | <td valign='top'> |
6632 | 6632 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=".$user_id."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('LoginsAndAccessTools')."</a> |
6633 | 6633 | </td> |
6634 | 6634 | </tr> |
6635 | 6635 | "; |
6636 | - } |
|
6636 | + } |
|
6637 | 6637 | } |
6638 | 6638 | |
6639 | 6639 | /** |
@@ -6646,38 +6646,38 @@ discard block |
||
6646 | 6646 | */ |
6647 | 6647 | public function display_exercise_tracking_info($view, $user_id, $courseCode) |
6648 | 6648 | { |
6649 | - global $TBL_TRACK_HOTPOTATOES, $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong; |
|
6649 | + global $TBL_TRACK_HOTPOTATOES, $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $dateTimeFormatLong; |
|
6650 | 6650 | $courseId = api_get_course_int_id($courseCode); |
6651 | - if(substr($view,1,1) == '1') { |
|
6652 | - $new_view = substr_replace($view,'0',1,1); |
|
6653 | - echo "<tr> |
|
6651 | + if(substr($view,1,1) == '1') { |
|
6652 | + $new_view = substr_replace($view,'0',1,1); |
|
6653 | + echo "<tr> |
|
6654 | 6654 | <td valign='top'> |
6655 | 6655 | <font color='#0000FF'>- </font><b>".get_lang('ExercicesResults')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=01000'>".get_lang('ExportAsCSV')."</a>] |
6656 | 6656 | </td> |
6657 | 6657 | </tr>"; |
6658 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('ExercicesDetails')."<br />"; |
|
6658 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('ExercicesDetails')."<br />"; |
|
6659 | 6659 | |
6660 | - $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
6660 | + $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
6661 | 6661 | FROM $TABLECOURSE_EXERCICES AS ce , $TABLETRACK_EXERCICES AS te |
6662 | 6662 | WHERE te.c_id = $courseId |
6663 | 6663 | AND te.exe_user_id = ".intval($user_id)." |
6664 | 6664 | AND te.exe_exo_id = ce.id |
6665 | 6665 | ORDER BY ce.title ASC, te.exe_date ASC"; |
6666 | 6666 | |
6667 | - $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
6667 | + $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
6668 | 6668 | FROM $TBL_TRACK_HOTPOTATOES AS te |
6669 | 6669 | WHERE te.exe_user_id = '".intval($user_id)."' AND te.c_id = $courseId |
6670 | 6670 | ORDER BY te.c_id ASC, te.exe_date ASC"; |
6671 | 6671 | |
6672 | - $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
6672 | + $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
6673 | 6673 | |
6674 | - $NoTestRes = 0; |
|
6675 | - $NoHPTestRes = 0; |
|
6674 | + $NoTestRes = 0; |
|
6675 | + $NoHPTestRes = 0; |
|
6676 | 6676 | |
6677 | - echo "<tr>\n<td style='padding-left : 40px;padding-right : 40px;'>\n"; |
|
6678 | - $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
6679 | - echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>\n"; |
|
6680 | - echo " |
|
6677 | + echo "<tr>\n<td style='padding-left : 40px;padding-right : 40px;'>\n"; |
|
6678 | + $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
6679 | + echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>\n"; |
|
6680 | + echo " |
|
6681 | 6681 | <tr bgcolor='#E6E6E6'> |
6682 | 6682 | <td> |
6683 | 6683 | ".get_lang('ExercicesTitleExerciceColumn')." |
@@ -6690,28 +6690,28 @@ discard block |
||
6690 | 6690 | </td> |
6691 | 6691 | </tr>"; |
6692 | 6692 | |
6693 | - if (is_array($results)) { |
|
6694 | - for($i = 0; $i < sizeof($results); $i++) { |
|
6695 | - $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
6696 | - echo "<tr>\n"; |
|
6697 | - echo "<td class='content'>".$results[$i][0]."</td>\n"; |
|
6698 | - echo "<td class='content'>".$display_date."</td>\n"; |
|
6699 | - echo "<td valign='top' align='right' class='content'>".$results[$i][1]." / ".$results[$i][2]."</td>\n"; |
|
6700 | - echo "</tr>\n"; |
|
6701 | - } |
|
6702 | - } else { |
|
6703 | - // istvan begin |
|
6704 | - $NoTestRes = 1; |
|
6705 | - } |
|
6706 | - |
|
6707 | - // The Result of Tests |
|
6708 | - if (is_array($hpresults)) { |
|
6709 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
6710 | - $title = GetQuizName($hpresults[$i][0],''); |
|
6711 | - if ($title == '') |
|
6712 | - $title = basename($hpresults[$i][0]); |
|
6713 | - $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
6714 | - ?> |
|
6693 | + if (is_array($results)) { |
|
6694 | + for($i = 0; $i < sizeof($results); $i++) { |
|
6695 | + $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
6696 | + echo "<tr>\n"; |
|
6697 | + echo "<td class='content'>".$results[$i][0]."</td>\n"; |
|
6698 | + echo "<td class='content'>".$display_date."</td>\n"; |
|
6699 | + echo "<td valign='top' align='right' class='content'>".$results[$i][1]." / ".$results[$i][2]."</td>\n"; |
|
6700 | + echo "</tr>\n"; |
|
6701 | + } |
|
6702 | + } else { |
|
6703 | + // istvan begin |
|
6704 | + $NoTestRes = 1; |
|
6705 | + } |
|
6706 | + |
|
6707 | + // The Result of Tests |
|
6708 | + if (is_array($hpresults)) { |
|
6709 | + for($i = 0; $i < sizeof($hpresults); $i++) { |
|
6710 | + $title = GetQuizName($hpresults[$i][0],''); |
|
6711 | + if ($title == '') |
|
6712 | + $title = basename($hpresults[$i][0]); |
|
6713 | + $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
6714 | + ?> |
|
6715 | 6715 | <tr> |
6716 | 6716 | <td class="content"><?php echo $title; ?></td> |
6717 | 6717 | <td class="content" align="center"><?php echo $display_date; ?></td> |
@@ -6721,26 +6721,26 @@ discard block |
||
6721 | 6721 | |
6722 | 6722 | <?php |
6723 | 6723 | } |
6724 | - } else { |
|
6725 | - $NoHPTestRes = 1; |
|
6726 | - } |
|
6727 | - |
|
6728 | - if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
6729 | - echo "<tr>\n"; |
|
6730 | - echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>\n"; |
|
6731 | - echo "</tr>\n"; |
|
6732 | - } |
|
6733 | - echo "</table>"; |
|
6734 | - echo "</td>\n</tr>\n"; |
|
6735 | - } else { |
|
6736 | - $new_view = substr_replace($view,'1',1,1); |
|
6737 | - echo " |
|
6724 | + } else { |
|
6725 | + $NoHPTestRes = 1; |
|
6726 | + } |
|
6727 | + |
|
6728 | + if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
6729 | + echo "<tr>\n"; |
|
6730 | + echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>\n"; |
|
6731 | + echo "</tr>\n"; |
|
6732 | + } |
|
6733 | + echo "</table>"; |
|
6734 | + echo "</td>\n</tr>\n"; |
|
6735 | + } else { |
|
6736 | + $new_view = substr_replace($view,'1',1,1); |
|
6737 | + echo " |
|
6738 | 6738 | <tr> |
6739 | 6739 | <td valign='top'> |
6740 | 6740 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=$user_id&view=".$new_view."' class='specialLink'>".get_lang('ExercicesResults')."</a> |
6741 | 6741 | </td> |
6742 | 6742 | </tr>"; |
6743 | - } |
|
6743 | + } |
|
6744 | 6744 | } |
6745 | 6745 | |
6746 | 6746 | /** |
@@ -6749,27 +6749,27 @@ discard block |
||
6749 | 6749 | */ |
6750 | 6750 | public function display_student_publications_tracking_info($view, $user_id, $course_id) |
6751 | 6751 | { |
6752 | - global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
6752 | + global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
6753 | 6753 | $_course = api_get_course_info_by_id($course_id); |
6754 | 6754 | |
6755 | - if (substr($view,2,1) == '1') { |
|
6756 | - $new_view = substr_replace($view,'0',2,1); |
|
6757 | - echo "<tr> |
|
6755 | + if (substr($view,2,1) == '1') { |
|
6756 | + $new_view = substr_replace($view,'0',2,1); |
|
6757 | + echo "<tr> |
|
6758 | 6758 | <td valign='top'> |
6759 | 6759 | <font color='#0000FF'>- </font><b>".get_lang('WorkUploads')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00100'>".get_lang('ExportAsCSV')."</a>] |
6760 | 6760 | </td> |
6761 | 6761 | </tr>"; |
6762 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('WorksDetails')."<br>"; |
|
6763 | - $sql = "SELECT u.upload_date, w.title, w.author,w.url |
|
6762 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('WorksDetails')."<br>"; |
|
6763 | + $sql = "SELECT u.upload_date, w.title, w.author,w.url |
|
6764 | 6764 | FROM $TABLETRACK_UPLOADS u , $TABLECOURSE_WORK w |
6765 | 6765 | WHERE u.upload_work_id = w.id |
6766 | 6766 | AND u.upload_user_id = '".intval($user_id)."' |
6767 | 6767 | AND u.c_id = '".intval($course_id)."' |
6768 | 6768 | ORDER BY u.upload_date DESC"; |
6769 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6770 | - $results = StatsUtils::getManyResultsXCol($sql,4); |
|
6771 | - echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6772 | - echo "<tr> |
|
6769 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6770 | + $results = StatsUtils::getManyResultsXCol($sql,4); |
|
6771 | + echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6772 | + echo "<tr> |
|
6773 | 6773 | <td class='secLine' width='40%'> |
6774 | 6774 | ".get_lang('WorkTitle')." |
6775 | 6775 | </td> |
@@ -6780,35 +6780,35 @@ discard block |
||
6780 | 6780 | ".get_lang('Date')." |
6781 | 6781 | </td> |
6782 | 6782 | </tr>"; |
6783 | - if (is_array($results)) { |
|
6784 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6785 | - $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
6786 | - $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
6787 | - echo "<tr>"; |
|
6788 | - echo "<td class='content'>" |
|
6789 | - ."<a href ='".$pathToFile."'>".$results[$j][1]."</a>" |
|
6790 | - ."</td>"; |
|
6791 | - echo "<td class='content'>".$results[$j][2]."</td>"; |
|
6792 | - echo "<td class='content'>".$beautifulDate."</td>"; |
|
6793 | - echo"</tr>"; |
|
6794 | - } |
|
6795 | - } else { |
|
6796 | - echo "<tr>"; |
|
6797 | - echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>"; |
|
6798 | - echo"</tr>"; |
|
6799 | - } |
|
6800 | - echo "</table>"; |
|
6801 | - echo "</td></tr>"; |
|
6802 | - } else { |
|
6803 | - $new_view = substr_replace($view,'1',2,1); |
|
6804 | - echo " |
|
6783 | + if (is_array($results)) { |
|
6784 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
6785 | + $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
6786 | + $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
6787 | + echo "<tr>"; |
|
6788 | + echo "<td class='content'>" |
|
6789 | + ."<a href ='".$pathToFile."'>".$results[$j][1]."</a>" |
|
6790 | + ."</td>"; |
|
6791 | + echo "<td class='content'>".$results[$j][2]."</td>"; |
|
6792 | + echo "<td class='content'>".$beautifulDate."</td>"; |
|
6793 | + echo"</tr>"; |
|
6794 | + } |
|
6795 | + } else { |
|
6796 | + echo "<tr>"; |
|
6797 | + echo "<td colspan='3'><center>".get_lang('NoResult')."</center></td>"; |
|
6798 | + echo"</tr>"; |
|
6799 | + } |
|
6800 | + echo "</table>"; |
|
6801 | + echo "</td></tr>"; |
|
6802 | + } else { |
|
6803 | + $new_view = substr_replace($view,'1',2,1); |
|
6804 | + echo " |
|
6805 | 6805 | <tr> |
6806 | 6806 | <td valign='top'> |
6807 | 6807 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('WorkUploads')."</a> |
6808 | 6808 | </td> |
6809 | 6809 | </tr> |
6810 | 6810 | "; |
6811 | - } |
|
6811 | + } |
|
6812 | 6812 | } |
6813 | 6813 | |
6814 | 6814 | /** |
@@ -6817,55 +6817,55 @@ discard block |
||
6817 | 6817 | */ |
6818 | 6818 | public function display_links_tracking_info($view, $user_id, $courseCode) |
6819 | 6819 | { |
6820 | - global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
6820 | + global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
6821 | 6821 | $courseId = api_get_course_int_id($courseCode); |
6822 | - if (substr($view,3,1) == '1') { |
|
6823 | - $new_view = substr_replace($view,'0',3,1); |
|
6824 | - echo " |
|
6822 | + if (substr($view,3,1) == '1') { |
|
6823 | + $new_view = substr_replace($view,'0',3,1); |
|
6824 | + echo " |
|
6825 | 6825 | <tr> |
6826 | 6826 | <td valign='top'> |
6827 | 6827 | <font color='#0000FF'>- </font><b>".get_lang('LinksAccess')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00010'>".get_lang('ExportAsCSV')."</a>] |
6828 | 6828 | </td> |
6829 | 6829 | </tr> |
6830 | 6830 | "; |
6831 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LinksDetails')."<br>"; |
|
6832 | - $sql = "SELECT cl.title, cl.url |
|
6831 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LinksDetails')."<br>"; |
|
6832 | + $sql = "SELECT cl.title, cl.url |
|
6833 | 6833 | FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl |
6834 | 6834 | WHERE sl.links_link_id = cl.id |
6835 | 6835 | AND sl.c_id = $courseId |
6836 | 6836 | AND sl.links_user_id = ".intval($user_id)." |
6837 | 6837 | GROUP BY cl.title, cl.url"; |
6838 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6839 | - $results = StatsUtils::getManyResults2Col($sql); |
|
6840 | - echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6841 | - echo "<tr> |
|
6838 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6839 | + $results = StatsUtils::getManyResults2Col($sql); |
|
6840 | + echo "<table cellpadding='2' cellspacing='1' border='0' align=center>"; |
|
6841 | + echo "<tr> |
|
6842 | 6842 | <td class='secLine'> |
6843 | 6843 | ".get_lang('LinksTitleLinkColumn')." |
6844 | 6844 | </td> |
6845 | 6845 | </tr>"; |
6846 | - if (is_array($results)) { |
|
6847 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6848 | - echo "<tr>"; |
|
6849 | - echo "<td class='content'><a href='".$results[$j][1]."'>".$results[$j][0]."</a></td>"; |
|
6850 | - echo"</tr>"; |
|
6851 | - } |
|
6852 | - } else { |
|
6853 | - echo "<tr>"; |
|
6854 | - echo "<td ><center>".get_lang('NoResult')."</center></td>"; |
|
6855 | - echo"</tr>"; |
|
6856 | - } |
|
6857 | - echo "</table>"; |
|
6858 | - echo "</td></tr>"; |
|
6859 | - } else { |
|
6860 | - $new_view = substr_replace($view,'1',3,1); |
|
6861 | - echo " |
|
6846 | + if (is_array($results)) { |
|
6847 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
6848 | + echo "<tr>"; |
|
6849 | + echo "<td class='content'><a href='".$results[$j][1]."'>".$results[$j][0]."</a></td>"; |
|
6850 | + echo"</tr>"; |
|
6851 | + } |
|
6852 | + } else { |
|
6853 | + echo "<tr>"; |
|
6854 | + echo "<td ><center>".get_lang('NoResult')."</center></td>"; |
|
6855 | + echo"</tr>"; |
|
6856 | + } |
|
6857 | + echo "</table>"; |
|
6858 | + echo "</td></tr>"; |
|
6859 | + } else { |
|
6860 | + $new_view = substr_replace($view,'1',3,1); |
|
6861 | + echo " |
|
6862 | 6862 | <tr> |
6863 | 6863 | <td valign='top'> |
6864 | 6864 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('LinksAccess')."</a> |
6865 | 6865 | </td> |
6866 | 6866 | </tr> |
6867 | 6867 | "; |
6868 | - } |
|
6868 | + } |
|
6869 | 6869 | } |
6870 | 6870 | |
6871 | 6871 | /** |
@@ -6878,61 +6878,61 @@ discard block |
||
6878 | 6878 | */ |
6879 | 6879 | public static function display_document_tracking_info($view, $user_id, $course_code, $session_id = 0) |
6880 | 6880 | { |
6881 | - // protect data |
|
6881 | + // protect data |
|
6882 | 6882 | $user_id = intval($user_id); |
6883 | 6883 | $courseId = api_get_course_int_id($course_code); |
6884 | - $session_id = intval($session_id); |
|
6884 | + $session_id = intval($session_id); |
|
6885 | 6885 | |
6886 | - $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
6887 | - if(substr($view,4,1) == '1') { |
|
6888 | - $new_view = substr_replace($view,'0',4,1); |
|
6889 | - echo " |
|
6886 | + $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
6887 | + if(substr($view,4,1) == '1') { |
|
6888 | + $new_view = substr_replace($view,'0',4,1); |
|
6889 | + echo " |
|
6890 | 6890 | <tr> |
6891 | 6891 | <td valign='top'> |
6892 | 6892 | <font color='#0000FF'>- </font><b>".get_lang('DocumentsAccess')."</b> [<a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."'>".get_lang('Close')."</a>] [<a href='userLogCSV.php?".api_get_cidreq()."&uInfo=".Security::remove_XSS($_GET['uInfo'])."&view=00001'>".get_lang('ExportAsCSV')."</a>] |
6893 | 6893 | </td> |
6894 | 6894 | </tr> |
6895 | 6895 | "; |
6896 | - echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('DocumentsDetails')."<br>"; |
|
6896 | + echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('DocumentsDetails')."<br>"; |
|
6897 | 6897 | |
6898 | - $sql = "SELECT down_doc_path |
|
6898 | + $sql = "SELECT down_doc_path |
|
6899 | 6899 | FROM $downloads_table |
6900 | 6900 | WHERE c_id = $courseId |
6901 | 6901 | AND down_user_id = $user_id |
6902 | 6902 | AND down_session_id = $session_id |
6903 | 6903 | GROUP BY down_doc_path"; |
6904 | 6904 | |
6905 | - echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6906 | - $results = StatsUtils::getManyResults1Col($sql); |
|
6907 | - echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>"; |
|
6908 | - echo "<tr> |
|
6905 | + echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>"; |
|
6906 | + $results = StatsUtils::getManyResults1Col($sql); |
|
6907 | + echo "<table cellpadding='2' cellspacing='1' border='0' align='center'>"; |
|
6908 | + echo "<tr> |
|
6909 | 6909 | <td class='secLine'> |
6910 | 6910 | ".get_lang('DocumentsTitleDocumentColumn')." |
6911 | 6911 | </td> |
6912 | 6912 | </tr>"; |
6913 | - if (is_array($results)) { |
|
6914 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
6915 | - echo "<tr>"; |
|
6916 | - echo "<td class='content'>".$results[$j]."</td>"; |
|
6917 | - echo"</tr>"; |
|
6918 | - } |
|
6919 | - } else { |
|
6920 | - echo "<tr>"; |
|
6921 | - echo "<td><center>".get_lang('NoResult')."</center></td>"; |
|
6922 | - echo"</tr>"; |
|
6923 | - } |
|
6924 | - echo "</table>"; |
|
6925 | - echo "</td></tr>"; |
|
6926 | - } else { |
|
6927 | - $new_view = substr_replace($view,'1',4,1); |
|
6928 | - echo " |
|
6913 | + if (is_array($results)) { |
|
6914 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
6915 | + echo "<tr>"; |
|
6916 | + echo "<td class='content'>".$results[$j]."</td>"; |
|
6917 | + echo"</tr>"; |
|
6918 | + } |
|
6919 | + } else { |
|
6920 | + echo "<tr>"; |
|
6921 | + echo "<td><center>".get_lang('NoResult')."</center></td>"; |
|
6922 | + echo"</tr>"; |
|
6923 | + } |
|
6924 | + echo "</table>"; |
|
6925 | + echo "</td></tr>"; |
|
6926 | + } else { |
|
6927 | + $new_view = substr_replace($view,'1',4,1); |
|
6928 | + echo " |
|
6929 | 6929 | <tr> |
6930 | 6930 | <td valign='top'> |
6931 | 6931 | +<font color='#0000FF'> </font><a href='".api_get_self()."?uInfo=".Security::remove_XSS($user_id)."&view=".Security::remove_XSS($new_view)."' class='specialLink'>".get_lang('DocumentsAccess')."</a> |
6932 | 6932 | </td> |
6933 | 6933 | </tr> |
6934 | 6934 | "; |
6935 | - } |
|
6935 | + } |
|
6936 | 6936 | } |
6937 | 6937 | |
6938 | 6938 | /** |
@@ -6989,43 +6989,43 @@ discard block |
||
6989 | 6989 | */ |
6990 | 6990 | public function display_login_tracking_info($view, $user_id, $course_id, $session_id = 0) |
6991 | 6991 | { |
6992 | - $MonthsLong = $GLOBALS['MonthsLong']; |
|
6993 | - $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
6994 | - |
|
6995 | - // protected data |
|
6996 | - $user_id = intval($user_id); |
|
6997 | - $session_id = intval($session_id); |
|
6998 | - $course_id = intval($course_id); |
|
6999 | - |
|
7000 | - $tempView = $view; |
|
7001 | - if (substr($view,0,1) == '1') { |
|
7002 | - $new_view = substr_replace($view,'0',0,1); |
|
7003 | - $title[1]= get_lang('LoginsAndAccessTools').get_lang('LoginsDetails'); |
|
7004 | - $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
6992 | + $MonthsLong = $GLOBALS['MonthsLong']; |
|
6993 | + $track_access_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS); |
|
6994 | + |
|
6995 | + // protected data |
|
6996 | + $user_id = intval($user_id); |
|
6997 | + $session_id = intval($session_id); |
|
6998 | + $course_id = intval($course_id); |
|
6999 | + |
|
7000 | + $tempView = $view; |
|
7001 | + if (substr($view,0,1) == '1') { |
|
7002 | + $new_view = substr_replace($view,'0',0,1); |
|
7003 | + $title[1]= get_lang('LoginsAndAccessTools').get_lang('LoginsDetails'); |
|
7004 | + $sql = "SELECT UNIX_TIMESTAMP(access_date), count(access_date) |
|
7005 | 7005 | FROM $track_access_table |
7006 | 7006 | WHERE access_user_id = $user_id |
7007 | 7007 | AND c_id = $course_id |
7008 | 7008 | AND access_session_id = $session_id |
7009 | 7009 | GROUP BY YEAR(access_date),MONTH(access_date) |
7010 | 7010 | ORDER BY YEAR(access_date),MONTH(access_date) ASC"; |
7011 | - //$results = getManyResults2Col($sql); |
|
7012 | - $results = getManyResults3Col($sql); |
|
7013 | - $title_line= get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n"; |
|
7014 | - $line=''; |
|
7015 | - $total = 0; |
|
7016 | - if (is_array($results)) { |
|
7017 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
7018 | - $line .= $results[$j][0].';'.$results[$j][1]."\n"; |
|
7019 | - $total = $total + $results[$j][1]; |
|
7020 | - } |
|
7021 | - $line .= get_lang('Total').";".$total."\n"; |
|
7022 | - } else { |
|
7023 | - $line= get_lang('NoResult')."</center></td>"; |
|
7024 | - } |
|
7025 | - } else { |
|
7026 | - $new_view = substr_replace($view,'1',0,1); |
|
7027 | - } |
|
7028 | - return array($title_line, $line); |
|
7011 | + //$results = getManyResults2Col($sql); |
|
7012 | + $results = getManyResults3Col($sql); |
|
7013 | + $title_line= get_lang('LoginsTitleMonthColumn').';'.get_lang('LoginsTitleCountColumn')."\n"; |
|
7014 | + $line=''; |
|
7015 | + $total = 0; |
|
7016 | + if (is_array($results)) { |
|
7017 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
7018 | + $line .= $results[$j][0].';'.$results[$j][1]."\n"; |
|
7019 | + $total = $total + $results[$j][1]; |
|
7020 | + } |
|
7021 | + $line .= get_lang('Total').";".$total."\n"; |
|
7022 | + } else { |
|
7023 | + $line= get_lang('NoResult')."</center></td>"; |
|
7024 | + } |
|
7025 | + } else { |
|
7026 | + $new_view = substr_replace($view,'1',0,1); |
|
7027 | + } |
|
7028 | + return array($title_line, $line); |
|
7029 | 7029 | } |
7030 | 7030 | |
7031 | 7031 | /** |
@@ -7038,67 +7038,67 @@ discard block |
||
7038 | 7038 | */ |
7039 | 7039 | public function display_exercise_tracking_info($view, $userId, $courseCode) |
7040 | 7040 | { |
7041 | - global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong; |
|
7041 | + global $TABLECOURSE_EXERCICES, $TABLETRACK_EXERCICES, $TABLETRACK_HOTPOTATOES, $dateTimeFormatLong; |
|
7042 | 7042 | $courseId = api_get_course_int_id($courseCode); |
7043 | 7043 | $userId = intval($userId); |
7044 | - if (substr($view,1,1) == '1') { |
|
7045 | - $new_view = substr_replace($view,'0',1,1); |
|
7046 | - $title[1] = get_lang('ExercicesDetails'); |
|
7047 | - $line = ''; |
|
7048 | - $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
7044 | + if (substr($view,1,1) == '1') { |
|
7045 | + $new_view = substr_replace($view,'0',1,1); |
|
7046 | + $title[1] = get_lang('ExercicesDetails'); |
|
7047 | + $line = ''; |
|
7048 | + $sql = "SELECT ce.title, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
7049 | 7049 | FROM $TABLECOURSE_EXERCICES AS ce , $TABLETRACK_EXERCICES AS te |
7050 | 7050 | WHERE te.c_id = $courseId |
7051 | 7051 | AND te.exe_user_id = $userId |
7052 | 7052 | AND te.exe_exo_id = ce.id |
7053 | 7053 | ORDER BY ce.title ASC, te.exe_date ASC"; |
7054 | 7054 | |
7055 | - $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
7055 | + $hpsql = "SELECT te.exe_name, te.exe_result , te.exe_weighting, UNIX_TIMESTAMP(te.exe_date) |
|
7056 | 7056 | FROM $TABLETRACK_HOTPOTATOES AS te |
7057 | 7057 | WHERE te.exe_user_id = '$userId' AND te.c_id = $courseId |
7058 | 7058 | ORDER BY te.c_id ASC, te.exe_date ASC"; |
7059 | 7059 | |
7060 | - $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
7060 | + $hpresults = StatsUtils::getManyResultsXCol($hpsql, 4); |
|
7061 | 7061 | |
7062 | - $NoTestRes = 0; |
|
7063 | - $NoHPTestRes = 0; |
|
7062 | + $NoTestRes = 0; |
|
7063 | + $NoHPTestRes = 0; |
|
7064 | 7064 | |
7065 | - $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
7066 | - $title_line = get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n"; |
|
7065 | + $results = StatsUtils::getManyResultsXCol($sql, 4); |
|
7066 | + $title_line = get_lang('ExercicesTitleExerciceColumn').";".get_lang('Date').';'.get_lang('ExercicesTitleScoreColumn')."\n"; |
|
7067 | 7067 | |
7068 | - if (is_array($results)) { |
|
7069 | - for($i = 0; $i < sizeof($results); $i++) |
|
7070 | - { |
|
7071 | - $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
7072 | - $line .= $results[$i][0].";".$display_date.";".$results[$i][1]." / ".$results[$i][2]."\n"; |
|
7073 | - } |
|
7074 | - } else { |
|
7068 | + if (is_array($results)) { |
|
7069 | + for($i = 0; $i < sizeof($results); $i++) |
|
7070 | + { |
|
7071 | + $display_date = api_convert_and_format_date($results[$i][3], null, date_default_timezone_get()); |
|
7072 | + $line .= $results[$i][0].";".$display_date.";".$results[$i][1]." / ".$results[$i][2]."\n"; |
|
7073 | + } |
|
7074 | + } else { |
|
7075 | 7075 | // istvan begin |
7076 | - $NoTestRes = 1; |
|
7077 | - } |
|
7078 | - |
|
7079 | - // The Result of Tests |
|
7080 | - if (is_array($hpresults)) { |
|
7081 | - for($i = 0; $i < sizeof($hpresults); $i++) { |
|
7082 | - $title = GetQuizName($hpresults[$i][0],''); |
|
7083 | - |
|
7084 | - if ($title == '') |
|
7085 | - $title = basename($hpresults[$i][0]); |
|
7086 | - |
|
7087 | - $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
7088 | - |
|
7089 | - $line .= $title.';'.$display_date.';'.$hpresults[$i][1].'/'.$hpresults[$i][2]."\n"; |
|
7090 | - } |
|
7091 | - } else { |
|
7092 | - $NoHPTestRes = 1; |
|
7093 | - } |
|
7094 | - |
|
7095 | - if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
7096 | - $line=get_lang('NoResult'); |
|
7097 | - } |
|
7098 | - } else { |
|
7099 | - $new_view = substr_replace($view,'1',1,1); |
|
7100 | - } |
|
7101 | - return array($title_line, $line); |
|
7076 | + $NoTestRes = 1; |
|
7077 | + } |
|
7078 | + |
|
7079 | + // The Result of Tests |
|
7080 | + if (is_array($hpresults)) { |
|
7081 | + for($i = 0; $i < sizeof($hpresults); $i++) { |
|
7082 | + $title = GetQuizName($hpresults[$i][0],''); |
|
7083 | + |
|
7084 | + if ($title == '') |
|
7085 | + $title = basename($hpresults[$i][0]); |
|
7086 | + |
|
7087 | + $display_date = api_convert_and_format_date($hpresults[$i][3], null, date_default_timezone_get()); |
|
7088 | + |
|
7089 | + $line .= $title.';'.$display_date.';'.$hpresults[$i][1].'/'.$hpresults[$i][2]."\n"; |
|
7090 | + } |
|
7091 | + } else { |
|
7092 | + $NoHPTestRes = 1; |
|
7093 | + } |
|
7094 | + |
|
7095 | + if ($NoTestRes == 1 && $NoHPTestRes == 1) { |
|
7096 | + $line=get_lang('NoResult'); |
|
7097 | + } |
|
7098 | + } else { |
|
7099 | + $new_view = substr_replace($view,'1',1,1); |
|
7100 | + } |
|
7101 | + return array($title_line, $line); |
|
7102 | 7102 | } |
7103 | 7103 | |
7104 | 7104 | /** |
@@ -7107,37 +7107,37 @@ discard block |
||
7107 | 7107 | */ |
7108 | 7108 | public function display_student_publications_tracking_info($view, $user_id, $course_id) |
7109 | 7109 | { |
7110 | - global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
7110 | + global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK; |
|
7111 | 7111 | $_course = api_get_course_info(); |
7112 | 7112 | $user_id = intval($user_id); |
7113 | 7113 | $course_id = intval($course_id); |
7114 | 7114 | |
7115 | - if (substr($view,2,1) == '1') { |
|
7116 | - $sql = "SELECT u.upload_date, w.title, w.author, w.url |
|
7115 | + if (substr($view,2,1) == '1') { |
|
7116 | + $sql = "SELECT u.upload_date, w.title, w.author, w.url |
|
7117 | 7117 | FROM $TABLETRACK_UPLOADS u , $TABLECOURSE_WORK w |
7118 | 7118 | WHERE |
7119 | 7119 | u.upload_work_id = w.id AND |
7120 | 7120 | u.upload_user_id = '$user_id' AND |
7121 | 7121 | u.c_id = '$course_id' |
7122 | 7122 | ORDER BY u.upload_date DESC"; |
7123 | - $results = StatsUtils::getManyResultsXCol($sql,4); |
|
7124 | - |
|
7125 | - $title[1]=get_lang('WorksDetails'); |
|
7126 | - $line=''; |
|
7127 | - $title_line=get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n"; |
|
7128 | - |
|
7129 | - if (is_array($results)) { |
|
7130 | - for($j = 0 ; $j < count($results) ; $j++) { |
|
7131 | - $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
7132 | - $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
7133 | - $line .= $results[$j][1].";".$results[$j][2].";".$beautifulDate."\n"; |
|
7134 | - } |
|
7135 | - |
|
7136 | - } else { |
|
7137 | - $line= get_lang('NoResult'); |
|
7138 | - } |
|
7139 | - } |
|
7140 | - return array($title_line, $line); |
|
7123 | + $results = StatsUtils::getManyResultsXCol($sql,4); |
|
7124 | + |
|
7125 | + $title[1]=get_lang('WorksDetails'); |
|
7126 | + $line=''; |
|
7127 | + $title_line=get_lang('WorkTitle').";".get_lang('WorkAuthors').";".get_lang('Date')."\n"; |
|
7128 | + |
|
7129 | + if (is_array($results)) { |
|
7130 | + for($j = 0 ; $j < count($results) ; $j++) { |
|
7131 | + $pathToFile = api_get_path(WEB_COURSE_PATH).$_course['path']."/".$results[$j][3]; |
|
7132 | + $beautifulDate = api_convert_and_format_date($results[$j][0], null, date_default_timezone_get()); |
|
7133 | + $line .= $results[$j][1].";".$results[$j][2].";".$beautifulDate."\n"; |
|
7134 | + } |
|
7135 | + |
|
7136 | + } else { |
|
7137 | + $line= get_lang('NoResult'); |
|
7138 | + } |
|
7139 | + } |
|
7140 | + return array($title_line, $line); |
|
7141 | 7141 | } |
7142 | 7142 | |
7143 | 7143 | /** |
@@ -7146,32 +7146,32 @@ discard block |
||
7146 | 7146 | */ |
7147 | 7147 | public function display_links_tracking_info($view, $userId, $courseCode) |
7148 | 7148 | { |
7149 | - global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
7149 | + global $TABLETRACK_LINKS, $TABLECOURSE_LINKS; |
|
7150 | 7150 | $courseId = api_get_course_int_id($courseCode); |
7151 | 7151 | $userId = intval($userId); |
7152 | 7152 | $line = null; |
7153 | - if (substr($view,3,1) == '1') { |
|
7154 | - $new_view = substr_replace($view,'0',3,1); |
|
7155 | - $title[1]=get_lang('LinksDetails'); |
|
7156 | - $sql = "SELECT cl.title, cl.url |
|
7153 | + if (substr($view,3,1) == '1') { |
|
7154 | + $new_view = substr_replace($view,'0',3,1); |
|
7155 | + $title[1]=get_lang('LinksDetails'); |
|
7156 | + $sql = "SELECT cl.title, cl.url |
|
7157 | 7157 | FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl |
7158 | 7158 | WHERE sl.links_link_id = cl.id |
7159 | 7159 | AND sl.c_id = $courseId |
7160 | 7160 | AND sl.links_user_id = $userId |
7161 | 7161 | GROUP BY cl.title, cl.url"; |
7162 | - $results = StatsUtils::getManyResults2Col($sql); |
|
7163 | - $title_line= get_lang('LinksTitleLinkColumn')."\n"; |
|
7164 | - if (is_array($results)) { |
|
7165 | - for ($j = 0 ; $j < count($results) ; $j++) { |
|
7166 | - $line .= $results[$j][0]."\n"; |
|
7167 | - } |
|
7168 | - } else { |
|
7169 | - $line=get_lang('NoResult'); |
|
7170 | - } |
|
7171 | - } else { |
|
7172 | - $new_view = substr_replace($view,'1',3,1); |
|
7173 | - } |
|
7174 | - return array($title_line, $line); |
|
7162 | + $results = StatsUtils::getManyResults2Col($sql); |
|
7163 | + $title_line= get_lang('LinksTitleLinkColumn')."\n"; |
|
7164 | + if (is_array($results)) { |
|
7165 | + for ($j = 0 ; $j < count($results) ; $j++) { |
|
7166 | + $line .= $results[$j][0]."\n"; |
|
7167 | + } |
|
7168 | + } else { |
|
7169 | + $line=get_lang('NoResult'); |
|
7170 | + } |
|
7171 | + } else { |
|
7172 | + $new_view = substr_replace($view,'1',3,1); |
|
7173 | + } |
|
7174 | + return array($title_line, $line); |
|
7175 | 7175 | } |
7176 | 7176 | |
7177 | 7177 | /** |
@@ -7184,38 +7184,38 @@ discard block |
||
7184 | 7184 | */ |
7185 | 7185 | public function display_document_tracking_info($view, $user_id, $courseCode, $session_id = 0) |
7186 | 7186 | { |
7187 | - // protect data |
|
7188 | - $user_id = intval($user_id); |
|
7187 | + // protect data |
|
7188 | + $user_id = intval($user_id); |
|
7189 | 7189 | $courseId = api_get_course_int_id($courseCode); |
7190 | - $session_id = intval($session_id); |
|
7190 | + $session_id = intval($session_id); |
|
7191 | 7191 | |
7192 | - $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
7192 | + $downloads_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS); |
|
7193 | 7193 | |
7194 | - if (substr($view,4,1) == '1') { |
|
7195 | - $new_view = substr_replace($view,'0',4,1); |
|
7196 | - $title[1]= get_lang('DocumentsDetails'); |
|
7194 | + if (substr($view,4,1) == '1') { |
|
7195 | + $new_view = substr_replace($view,'0',4,1); |
|
7196 | + $title[1]= get_lang('DocumentsDetails'); |
|
7197 | 7197 | |
7198 | - $sql = "SELECT down_doc_path |
|
7198 | + $sql = "SELECT down_doc_path |
|
7199 | 7199 | FROM $downloads_table |
7200 | 7200 | WHERE c_id = $courseId |
7201 | 7201 | AND down_user_id = $user_id |
7202 | 7202 | AND down_session_id = $session_id |
7203 | 7203 | GROUP BY down_doc_path"; |
7204 | 7204 | |
7205 | - $results = StatsUtils::getManyResults1Col($sql); |
|
7206 | - $title_line = get_lang('DocumentsTitleDocumentColumn')."\n"; |
|
7205 | + $results = StatsUtils::getManyResults1Col($sql); |
|
7206 | + $title_line = get_lang('DocumentsTitleDocumentColumn')."\n"; |
|
7207 | 7207 | $line = null; |
7208 | - if (is_array($results)) { |
|
7209 | - for ($j = 0 ; $j < count($results) ; $j++) { |
|
7210 | - $line .= $results[$j]."\n"; |
|
7211 | - } |
|
7212 | - } else { |
|
7213 | - $line = get_lang('NoResult'); |
|
7214 | - } |
|
7215 | - } else { |
|
7216 | - $new_view = substr_replace($view,'1',4,1); |
|
7217 | - } |
|
7218 | - return array($title_line, $line); |
|
7208 | + if (is_array($results)) { |
|
7209 | + for ($j = 0 ; $j < count($results) ; $j++) { |
|
7210 | + $line .= $results[$j]."\n"; |
|
7211 | + } |
|
7212 | + } else { |
|
7213 | + $line = get_lang('NoResult'); |
|
7214 | + } |
|
7215 | + } else { |
|
7216 | + $new_view = substr_replace($view,'1',4,1); |
|
7217 | + } |
|
7218 | + return array($title_line, $line); |
|
7219 | 7219 | } |
7220 | 7220 | |
7221 | 7221 | /** |