@@ -14,14 +14,14 @@ discard block |
||
14 | 14 | //stores the results |
15 | 15 | private $results = array(); |
16 | 16 | |
17 | - /** |
|
18 | - * Gets the results of all students (or just one student if access is limited) |
|
19 | - * @param string The document path (for HotPotatoes retrieval) |
|
20 | - * @param integer User ID. Optional. If no user ID is provided, we take all the results. Defauts to null |
|
21 | - */ |
|
22 | - public function getExercisesReporting($document_path, $hotpotato_name) |
|
17 | + /** |
|
18 | + * Gets the results of all students (or just one student if access is limited) |
|
19 | + * @param string The document path (for HotPotatoes retrieval) |
|
20 | + * @param integer User ID. Optional. If no user ID is provided, we take all the results. Defauts to null |
|
21 | + */ |
|
22 | + public function getExercisesReporting($document_path, $hotpotato_name) |
|
23 | 23 | { |
24 | - $return = array(); |
|
24 | + $return = array(); |
|
25 | 25 | $TBL_USER = Database::get_main_table(TABLE_MAIN_USER); |
26 | 26 | $TBL_TRACK_HOTPOTATOES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES); |
27 | 27 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $hotpotato_name = Database::escape_string($hotpotato_name); |
34 | 34 | |
35 | 35 | if (!empty($exercise_id)) { |
36 | - $session_id_and .= " AND exe_exo_id = $exercise_id "; |
|
36 | + $session_id_and .= " AND exe_exo_id = $exercise_id "; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | if (empty($user_id)) { |
@@ -110,25 +110,25 @@ discard block |
||
110 | 110 | $this->results = $return; |
111 | 111 | |
112 | 112 | return true; |
113 | - } |
|
113 | + } |
|
114 | 114 | |
115 | 115 | |
116 | - /** |
|
117 | - * Exports the complete report as a CSV file |
|
118 | - * @param string Document path inside the document tool |
|
119 | - * @param integer Optional user ID |
|
120 | - * @param boolean Whether to include user fields or not |
|
121 | - * @return boolean False on error |
|
122 | - */ |
|
123 | - public function exportCompleteReportCSV($document_path='', $hotpotato_name) |
|
116 | + /** |
|
117 | + * Exports the complete report as a CSV file |
|
118 | + * @param string Document path inside the document tool |
|
119 | + * @param integer Optional user ID |
|
120 | + * @param boolean Whether to include user fields or not |
|
121 | + * @return boolean False on error |
|
122 | + */ |
|
123 | + public function exportCompleteReportCSV($document_path='', $hotpotato_name) |
|
124 | 124 | { |
125 | - global $charset; |
|
126 | - $this->getExercisesReporting($document_path, $hotpotato_name); |
|
127 | - $filename = 'exercise_results_'.date('YmdGis').'.csv'; |
|
128 | - if (!empty($user_id)) { |
|
129 | - $filename = 'exercise_results_user_'.$user_id.'_'.date('YmdGis').'.csv'; |
|
130 | - } |
|
131 | - $data = ''; |
|
125 | + global $charset; |
|
126 | + $this->getExercisesReporting($document_path, $hotpotato_name); |
|
127 | + $filename = 'exercise_results_'.date('YmdGis').'.csv'; |
|
128 | + if (!empty($user_id)) { |
|
129 | + $filename = 'exercise_results_user_'.$user_id.'_'.date('YmdGis').'.csv'; |
|
130 | + } |
|
131 | + $data = ''; |
|
132 | 132 | |
133 | 133 | if (api_is_western_name_order()) { |
134 | 134 | if(!empty($this->results[0]['first_name'])) { |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | } |
148 | 148 | $data .= get_lang('Email').';'; |
149 | 149 | |
150 | - /*if ($export_user_fields) { |
|
150 | + /*if ($export_user_fields) { |
|
151 | 151 | //show user fields section with a big th colspan that spans over all fields |
152 | 152 | $extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1); |
153 | 153 | $num = count($extra_user_fields); |
@@ -156,25 +156,25 @@ discard block |
||
156 | 156 | } |
157 | 157 | }*/ |
158 | 158 | |
159 | - $data .= get_lang('Title').';'; |
|
160 | - $data .= get_lang('StartDate').';'; |
|
161 | - $data .= get_lang('Score').';'; |
|
162 | - $data .= get_lang('Total').';'; |
|
163 | - $data .= "\n"; |
|
159 | + $data .= get_lang('Title').';'; |
|
160 | + $data .= get_lang('StartDate').';'; |
|
161 | + $data .= get_lang('Score').';'; |
|
162 | + $data .= get_lang('Total').';'; |
|
163 | + $data .= "\n"; |
|
164 | 164 | |
165 | - //results |
|
166 | - foreach($this->results as $row) { |
|
165 | + //results |
|
166 | + foreach($this->results as $row) { |
|
167 | 167 | if (api_is_western_name_order()) { |
168 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
169 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
168 | + $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
169 | + $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
170 | 170 | } else { |
171 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
172 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
171 | + $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['last_name']), ENT_QUOTES, $charset)).';'; |
|
172 | + $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)).';'; |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)).';'; |
176 | 176 | |
177 | - /*if ($export_user_fields) { |
|
177 | + /*if ($export_user_fields) { |
|
178 | 178 | //show user fields data, if any, for this user |
179 | 179 | $user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true); |
180 | 180 | foreach($user_fields_values as $value) { |
@@ -182,40 +182,40 @@ discard block |
||
182 | 182 | } |
183 | 183 | }*/ |
184 | 184 | |
185 | - $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';'; |
|
186 | - $data .= str_replace("\r\n",' ',$row['exe_date']).';'; |
|
187 | - $data .= str_replace("\r\n",' ',$row['result']).';'; |
|
188 | - $data .= str_replace("\r\n",' ',$row['max']).';'; |
|
189 | - $data .= "\n"; |
|
190 | - } |
|
191 | - |
|
192 | - //output the results |
|
193 | - $len = strlen($data); |
|
194 | - header('Content-type: application/octet-stream'); |
|
195 | - header('Content-Type: application/force-download'); |
|
196 | - header('Content-length: '.$len); |
|
197 | - if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) { |
|
198 | - header('Content-Disposition: filename= '.$filename); |
|
199 | - } else { |
|
200 | - header('Content-Disposition: attachment; filename= '.$filename); |
|
201 | - } |
|
202 | - if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) { |
|
203 | - header('Pragma: '); |
|
204 | - header('Cache-Control: '); |
|
205 | - header('Cache-Control: public'); // IE cannot download from sessions without a cache |
|
206 | - } |
|
207 | - header('Content-Description: '.$filename); |
|
208 | - header('Content-transfer-encoding: binary'); |
|
209 | - // @todo add this utf-8 header for all csv files |
|
210 | - echo "\xEF\xBB\xBF"; // force utf-8 header of csv file |
|
211 | - echo $data; |
|
212 | - return true; |
|
213 | - } |
|
214 | - |
|
215 | - /** |
|
216 | - * Exports the complete report as an XLS file |
|
217 | - * @return boolean False on error |
|
218 | - */ |
|
185 | + $data .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)).';'; |
|
186 | + $data .= str_replace("\r\n",' ',$row['exe_date']).';'; |
|
187 | + $data .= str_replace("\r\n",' ',$row['result']).';'; |
|
188 | + $data .= str_replace("\r\n",' ',$row['max']).';'; |
|
189 | + $data .= "\n"; |
|
190 | + } |
|
191 | + |
|
192 | + //output the results |
|
193 | + $len = strlen($data); |
|
194 | + header('Content-type: application/octet-stream'); |
|
195 | + header('Content-Type: application/force-download'); |
|
196 | + header('Content-length: '.$len); |
|
197 | + if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) { |
|
198 | + header('Content-Disposition: filename= '.$filename); |
|
199 | + } else { |
|
200 | + header('Content-Disposition: attachment; filename= '.$filename); |
|
201 | + } |
|
202 | + if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) { |
|
203 | + header('Pragma: '); |
|
204 | + header('Cache-Control: '); |
|
205 | + header('Cache-Control: public'); // IE cannot download from sessions without a cache |
|
206 | + } |
|
207 | + header('Content-Description: '.$filename); |
|
208 | + header('Content-transfer-encoding: binary'); |
|
209 | + // @todo add this utf-8 header for all csv files |
|
210 | + echo "\xEF\xBB\xBF"; // force utf-8 header of csv file |
|
211 | + echo $data; |
|
212 | + return true; |
|
213 | + } |
|
214 | + |
|
215 | + /** |
|
216 | + * Exports the complete report as an XLS file |
|
217 | + * @return boolean False on error |
|
218 | + */ |
|
219 | 219 | public function exportCompleteReportXLS( |
220 | 220 | $document_path = '', |
221 | 221 | $user_id = null, |
@@ -224,37 +224,37 @@ discard block |
||
224 | 224 | $exercise_id = 0, |
225 | 225 | $hotpotato_name = null |
226 | 226 | ) { |
227 | - global $charset; |
|
228 | - $this->getExercisesReporting($document_path, $user_id, $export_filter, $exercise_id, $hotpotato_name); |
|
229 | - $filename = 'exercise_results_'.api_get_local_time().'.xls'; |
|
230 | - if (!empty($user_id)) { |
|
231 | - $filename = 'exercise_results_user_'.$user_id.'_'.api_get_local_time().'.xls'; |
|
232 | - } |
|
227 | + global $charset; |
|
228 | + $this->getExercisesReporting($document_path, $user_id, $export_filter, $exercise_id, $hotpotato_name); |
|
229 | + $filename = 'exercise_results_'.api_get_local_time().'.xls'; |
|
230 | + if (!empty($user_id)) { |
|
231 | + $filename = 'exercise_results_user_'.$user_id.'_'.api_get_local_time().'.xls'; |
|
232 | + } |
|
233 | 233 | |
234 | 234 | $spreadsheet = new PHPExcel(); |
235 | 235 | $spreadsheet->setActiveSheetIndex(0); |
236 | 236 | $worksheet = $spreadsheet->getActiveSheet(); |
237 | 237 | |
238 | 238 | |
239 | - $line = 0; |
|
240 | - $column = 0; //skip the first column (row titles) |
|
239 | + $line = 0; |
|
240 | + $column = 0; //skip the first column (row titles) |
|
241 | 241 | |
242 | - // check if exists column 'user' |
|
243 | - $with_column_user = false; |
|
244 | - foreach ($this->results as $result) { |
|
245 | - if (!empty($result['last_name']) && !empty($result['first_name'])) { |
|
246 | - $with_column_user = true; |
|
247 | - break; |
|
248 | - } |
|
249 | - } |
|
242 | + // check if exists column 'user' |
|
243 | + $with_column_user = false; |
|
244 | + foreach ($this->results as $result) { |
|
245 | + if (!empty($result['last_name']) && !empty($result['first_name'])) { |
|
246 | + $with_column_user = true; |
|
247 | + break; |
|
248 | + } |
|
249 | + } |
|
250 | 250 | |
251 | - if ($with_column_user) { |
|
252 | - $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('Email')); |
|
253 | - $column++; |
|
251 | + if ($with_column_user) { |
|
252 | + $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('Email')); |
|
253 | + $column++; |
|
254 | 254 | |
255 | 255 | if (api_is_western_name_order()) { |
256 | - $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName')); |
|
257 | - $column++; |
|
256 | + $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName')); |
|
257 | + $column++; |
|
258 | 258 | $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('LastName')); |
259 | 259 | $column++; |
260 | 260 | } else { |
@@ -263,36 +263,36 @@ discard block |
||
263 | 263 | $worksheet->SetCellValueByColumnAndRow($line,$column,get_lang('FirstName')); |
264 | 264 | $column++; |
265 | 265 | } |
266 | - } |
|
266 | + } |
|
267 | 267 | |
268 | - if ($export_user_fields) { |
|
269 | - //show user fields section with a big th colspan that spans over all fields |
|
270 | - $extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1); |
|
268 | + if ($export_user_fields) { |
|
269 | + //show user fields section with a big th colspan that spans over all fields |
|
270 | + $extra_user_fields = UserManager::get_extra_fields(0,1000,5,'ASC',false, 1); |
|
271 | 271 | |
272 | - //show the fields names for user fields |
|
273 | - foreach ($extra_user_fields as $field) { |
|
274 | - $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset)); |
|
275 | - $column++; |
|
276 | - } |
|
277 | - } |
|
272 | + //show the fields names for user fields |
|
273 | + foreach ($extra_user_fields as $field) { |
|
274 | + $worksheet->SetCellValueByColumnAndRow($line, $column, api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset)); |
|
275 | + $column++; |
|
276 | + } |
|
277 | + } |
|
278 | 278 | |
279 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Title')); |
|
280 | - $column++; |
|
281 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('StartDate')); |
|
279 | + $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Title')); |
|
280 | + $column++; |
|
281 | + $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('StartDate')); |
|
282 | 282 | $column++; |
283 | 283 | $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('EndDate')); |
284 | 284 | $column++; |
285 | 285 | $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Duration').' ('.get_lang('MinMinutes').')'); |
286 | - $column++; |
|
287 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Score')); |
|
288 | - $column++; |
|
289 | - $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Total')); |
|
290 | - $column++; |
|
286 | + $column++; |
|
287 | + $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Score')); |
|
288 | + $column++; |
|
289 | + $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Total')); |
|
290 | + $column++; |
|
291 | 291 | $worksheet->SetCellValueByColumnAndRow($line,$column, get_lang('Status')); |
292 | - $line++; |
|
292 | + $line++; |
|
293 | 293 | |
294 | - foreach ($this->results as $row) { |
|
295 | - $column = 0; |
|
294 | + foreach ($this->results as $row) { |
|
295 | + $column = 0; |
|
296 | 296 | |
297 | 297 | if ($with_column_user) { |
298 | 298 | $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['email']), ENT_QUOTES, $charset)); |
@@ -309,38 +309,38 @@ discard block |
||
309 | 309 | $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['first_name']), ENT_QUOTES, $charset)); |
310 | 310 | $column++; |
311 | 311 | } |
312 | - } |
|
312 | + } |
|
313 | 313 | |
314 | - if ($export_user_fields) { |
|
315 | - //show user fields data, if any, for this user |
|
316 | - $user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true); |
|
317 | - foreach($user_fields_values as $value) { |
|
318 | - $worksheet->SetCellValueByColumnAndRow($line,$column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)); |
|
319 | - $column++; |
|
320 | - } |
|
321 | - } |
|
314 | + if ($export_user_fields) { |
|
315 | + //show user fields data, if any, for this user |
|
316 | + $user_fields_values = UserManager::get_extra_user_data($row['user_id'],false,false, false, true); |
|
317 | + foreach($user_fields_values as $value) { |
|
318 | + $worksheet->SetCellValueByColumnAndRow($line,$column, api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)); |
|
319 | + $column++; |
|
320 | + } |
|
321 | + } |
|
322 | 322 | |
323 | - $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)); |
|
324 | - $column++; |
|
325 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['start_date']); |
|
323 | + $worksheet->SetCellValueByColumnAndRow($line,$column,api_html_entity_decode(strip_tags($row['title']), ENT_QUOTES, $charset)); |
|
324 | + $column++; |
|
325 | + $worksheet->SetCellValueByColumnAndRow($line,$column,$row['start_date']); |
|
326 | 326 | $column++; |
327 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['end_date']); |
|
327 | + $worksheet->SetCellValueByColumnAndRow($line,$column,$row['end_date']); |
|
328 | + $column++; |
|
329 | + $worksheet->SetCellValueByColumnAndRow($line,$column,$row['duration']); |
|
330 | + $column++; |
|
331 | + $worksheet->SetCellValueByColumnAndRow($line,$column,$row['result']); |
|
332 | + $column++; |
|
333 | + $worksheet->SetCellValueByColumnAndRow($line,$column,$row['max']); |
|
328 | 334 | $column++; |
329 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['duration']); |
|
330 | - $column++; |
|
331 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['result']); |
|
332 | - $column++; |
|
333 | - $worksheet->SetCellValueByColumnAndRow($line,$column,$row['max']); |
|
334 | - $column++; |
|
335 | 335 | $worksheet->SetCellValueByColumnAndRow($line,$column,$row['status']); |
336 | - $line++; |
|
337 | - } |
|
336 | + $line++; |
|
337 | + } |
|
338 | 338 | |
339 | 339 | $file = api_get_path(SYS_ARCHIVE_PATH).api_replace_dangerous_char($filename); |
340 | 340 | $writer = new PHPExcel_Writer_Excel2007($spreadsheet); |
341 | 341 | $writer->save($file); |
342 | 342 | DocumentManager::file_send_for_download($file, true, $filename); |
343 | 343 | |
344 | - return true; |
|
345 | - } |
|
344 | + return true; |
|
345 | + } |
|
346 | 346 | } |
@@ -98,10 +98,10 @@ |
||
98 | 98 | }*/ |
99 | 99 | } |
100 | 100 | |
101 | - // This is a good answer, count + 1 for nmbr of clicks |
|
102 | - if ($answers['weighting'][$i] > 0) { |
|
103 | - $nmbrTries++; |
|
104 | - } |
|
101 | + // This is a good answer, count + 1 for nmbr of clicks |
|
102 | + if ($answers['weighting'][$i] > 0) { |
|
103 | + $nmbrTries++; |
|
104 | + } |
|
105 | 105 | |
106 | 106 | $hotSpot['coord'] = $answers['hotspot_coordinates'][$i]; |
107 | 107 | $data['hotspots'][] = $hotSpot; |
@@ -17,13 +17,13 @@ discard block |
||
17 | 17 | $show_headers = isset($_REQUEST['show_headers']) ? intval($_REQUEST['show_headers']) : null; //exe id |
18 | 18 | |
19 | 19 | if ($origin == 'learnpath') { |
20 | - $show_headers = false; |
|
20 | + $show_headers = false; |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | api_protect_course_script($show_headers); |
24 | 24 | |
25 | 25 | if (empty($id)) { |
26 | - api_not_allowed($show_headers); |
|
26 | + api_not_allowed($show_headers); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | $is_allowedToEdit = api_is_allowed_to_edit(null,true) || $is_courseTutor; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | // Only users can see their own results |
50 | 50 | if (!$is_allowedToEdit) { |
51 | 51 | if ($student_id != $current_user_id) { |
52 | - api_not_allowed($show_headers); |
|
52 | + api_not_allowed($show_headers); |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | |
@@ -62,19 +62,19 @@ discard block |
||
62 | 62 | "name" => get_lang('Exercises'), |
63 | 63 | ); |
64 | 64 | $interbreadcrumb[] = array("url" => "#", "name" => get_lang('Result')); |
65 | - $this_section = SECTION_COURSES; |
|
66 | - Display::display_header(); |
|
65 | + $this_section = SECTION_COURSES; |
|
66 | + Display::display_header(); |
|
67 | 67 | } else { |
68 | 68 | $htmlHeadXtra[] = " |
69 | 69 | <style> |
70 | 70 | body { background: none;} |
71 | 71 | </style> |
72 | 72 | "; |
73 | - Display::display_reduced_header(); |
|
73 | + Display::display_reduced_header(); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | ExerciseLib::display_question_list_by_attempt($objExercise, $id, false); |
77 | 77 | |
78 | 78 | if ($show_headers) { |
79 | - Display::display_footer(); |
|
79 | + Display::display_footer(); |
|
80 | 80 | } |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | } |
167 | 167 | |
168 | 168 | |
169 | - /** |
|
170 | - * abstract function which creates the form to create / edit the answers of the question |
|
171 | - * @param the formvalidator instance |
|
172 | - * @param the answers number to display |
|
173 | - */ |
|
174 | - function processAnswersCreation($form) |
|
169 | + /** |
|
170 | + * abstract function which creates the form to create / edit the answers of the question |
|
171 | + * @param the formvalidator instance |
|
172 | + * @param the answers number to display |
|
173 | + */ |
|
174 | + function processAnswersCreation($form) |
|
175 | 175 | { |
176 | 176 | $questionWeighting = $nbrGoodAnswers = 0; |
177 | 177 | $objAnswer = new Answer($this->id); |
@@ -201,12 +201,12 @@ discard block |
||
201 | 201 | // sets the total weighting of the question |
202 | 202 | $this->updateWeighting($questionWeighting); |
203 | 203 | $this->save(); |
204 | - } |
|
204 | + } |
|
205 | 205 | |
206 | - function return_header($feedback_type = null, $counter = null, $score = null) |
|
206 | + function return_header($feedback_type = null, $counter = null, $score = null) |
|
207 | 207 | { |
208 | - $header = parent::return_header($feedback_type, $counter, $score); |
|
209 | - $header .= '<table class="'.$this->question_table_class .'"> |
|
208 | + $header = parent::return_header($feedback_type, $counter, $score); |
|
209 | + $header .= '<table class="'.$this->question_table_class .'"> |
|
210 | 210 | <tr> |
211 | 211 | <th>'.get_lang("Choice").'</th> |
212 | 212 | <th>'. get_lang("ExpectedChoice").'</th> |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $header .= '<th>'.get_lang("Comment").'</th>'; |
215 | 215 | $header .= '</tr>'; |
216 | 216 | return $header; |
217 | - } |
|
217 | + } |
|
218 | 218 | |
219 | 219 | |
220 | 220 | } |
@@ -28,10 +28,10 @@ |
||
28 | 28 | $content = ReadFileCont($full_file_path.$user_id.'.t.html'); |
29 | 29 | |
30 | 30 | if ($content == '') { |
31 | - $content = ReadFileCont($full_file_path); |
|
31 | + $content = ReadFileCont($full_file_path); |
|
32 | 32 | // Do not move this like: |
33 | - $mit = "function Finish(){"; |
|
34 | - $js_content = " |
|
33 | + $mit = "function Finish(){"; |
|
34 | + $js_content = " |
|
35 | 35 | // Code added - start |
36 | 36 | var SaveScoreVariable = 0; |
37 | 37 | function mySaveScore() { |
@@ -344,7 +344,7 @@ |
||
344 | 344 | if (is_dir($full_name)) { |
345 | 345 | $filelist[] = $file; |
346 | 346 | } |
347 | - } |
|
347 | + } |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 | } |
@@ -12,21 +12,21 @@ discard block |
||
12 | 12 | */ |
13 | 13 | class UniqueAnswerNoOption extends Question |
14 | 14 | { |
15 | - static $typePicture = 'mcuao.png'; |
|
16 | - static $explanationLangVar = 'UniqueAnswerNoOption'; |
|
15 | + static $typePicture = 'mcuao.png'; |
|
16 | + static $explanationLangVar = 'UniqueAnswerNoOption'; |
|
17 | 17 | |
18 | - /** |
|
19 | - * Constructor |
|
20 | - */ |
|
21 | - public function __construct() |
|
18 | + /** |
|
19 | + * Constructor |
|
20 | + */ |
|
21 | + public function __construct() |
|
22 | 22 | { |
23 | - //this is highly important |
|
24 | - parent::__construct(); |
|
25 | - $this -> type = UNIQUE_ANSWER_NO_OPTION; |
|
26 | - $this -> isContent = $this-> getIsContent(); |
|
27 | - } |
|
23 | + //this is highly important |
|
24 | + parent::__construct(); |
|
25 | + $this -> type = UNIQUE_ANSWER_NO_OPTION; |
|
26 | + $this -> isContent = $this-> getIsContent(); |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
29 | + /** |
|
30 | 30 | * function which redifines Question::createAnswersForm |
31 | 31 | * @param the formvalidator instance |
32 | 32 | * @param the answers number to display |
@@ -283,37 +283,37 @@ discard block |
||
283 | 283 | } |
284 | 284 | |
285 | 285 | /** |
286 | - * Function which creates the form to create / edit the answers of the question |
|
287 | - * @param the formvalidator instance |
|
288 | - * @param the answers number to display |
|
289 | - */ |
|
290 | - function processAnswersCreation($form) |
|
286 | + * Function which creates the form to create / edit the answers of the question |
|
287 | + * @param the formvalidator instance |
|
288 | + * @param the answers number to display |
|
289 | + */ |
|
290 | + function processAnswersCreation($form) |
|
291 | 291 | { |
292 | - $questionWeighting = $nbrGoodAnswers = 0; |
|
293 | - $correct = $form -> getSubmitValue('correct'); |
|
294 | - $objAnswer = new Answer($this->id); |
|
295 | - $nb_answers = $form -> getSubmitValue('nb_answers'); |
|
296 | - $minus = 1; |
|
297 | - if ($form -> getSubmitValue('new_question')) { |
|
298 | - $minus = 0; |
|
299 | - } |
|
300 | - |
|
301 | - for ($i=1 ; $i <= $nb_answers - $minus; $i++) { |
|
302 | - $position = trim($form -> getSubmitValue('position['.$i.']')); |
|
303 | - $answer = trim($form -> getSubmitValue('answer['.$i.']')); |
|
292 | + $questionWeighting = $nbrGoodAnswers = 0; |
|
293 | + $correct = $form -> getSubmitValue('correct'); |
|
294 | + $objAnswer = new Answer($this->id); |
|
295 | + $nb_answers = $form -> getSubmitValue('nb_answers'); |
|
296 | + $minus = 1; |
|
297 | + if ($form -> getSubmitValue('new_question')) { |
|
298 | + $minus = 0; |
|
299 | + } |
|
300 | + |
|
301 | + for ($i=1 ; $i <= $nb_answers - $minus; $i++) { |
|
302 | + $position = trim($form -> getSubmitValue('position['.$i.']')); |
|
303 | + $answer = trim($form -> getSubmitValue('answer['.$i.']')); |
|
304 | 304 | $comment = trim($form -> getSubmitValue('comment['.$i.']')); |
305 | 305 | $weighting = trim($form -> getSubmitValue('weighting['.$i.']')); |
306 | 306 | $scenario = $form -> getSubmitValue('scenario'); |
307 | 307 | |
308 | - //$list_destination = $form -> getSubmitValue('destination'.$i); |
|
309 | - //$destination_str = $form -> getSubmitValue('destination'.$i); |
|
308 | + //$list_destination = $form -> getSubmitValue('destination'.$i); |
|
309 | + //$destination_str = $form -> getSubmitValue('destination'.$i); |
|
310 | 310 | |
311 | - $try = $scenario['try'.$i]; |
|
311 | + $try = $scenario['try'.$i]; |
|
312 | 312 | $lp = $scenario['lp'.$i]; |
313 | - $destination = $scenario['destination'.$i]; |
|
314 | - $url = trim($scenario['url'.$i]); |
|
313 | + $destination = $scenario['destination'.$i]; |
|
314 | + $url = trim($scenario['url'.$i]); |
|
315 | 315 | |
316 | - /* |
|
316 | + /* |
|
317 | 317 | How we are going to parse the destination value |
318 | 318 | |
319 | 319 | here we parse the destination value which is a string |
@@ -326,41 +326,41 @@ discard block |
||
326 | 326 | selected_questions= ids of questions |
327 | 327 | url= an url |
328 | 328 | */ |
329 | - /* |
|
329 | + /* |
|
330 | 330 | $destination_str=''; |
331 | 331 | foreach ($list_destination as $destination_id) |
332 | 332 | { |
333 | 333 | $destination_str.=$destination_id.';'; |
334 | 334 | }*/ |
335 | 335 | |
336 | - $goodAnswer= ($correct == $i) ? true : false; |
|
336 | + $goodAnswer= ($correct == $i) ? true : false; |
|
337 | 337 | |
338 | - if ($goodAnswer) { |
|
339 | - $nbrGoodAnswers++; |
|
340 | - $weighting = abs($weighting); |
|
341 | - if($weighting > 0) { |
|
338 | + if ($goodAnswer) { |
|
339 | + $nbrGoodAnswers++; |
|
340 | + $weighting = abs($weighting); |
|
341 | + if($weighting > 0) { |
|
342 | 342 | $questionWeighting += $weighting; |
343 | 343 | } |
344 | - } |
|
344 | + } |
|
345 | 345 | |
346 | - if (empty($try)) |
|
347 | - $try=0; |
|
346 | + if (empty($try)) |
|
347 | + $try=0; |
|
348 | 348 | |
349 | - if (empty($lp)) { |
|
350 | - $lp=0; |
|
351 | - } |
|
349 | + if (empty($lp)) { |
|
350 | + $lp=0; |
|
351 | + } |
|
352 | 352 | |
353 | - if (empty($destination)) { |
|
354 | - $destination=0; |
|
355 | - } |
|
353 | + if (empty($destination)) { |
|
354 | + $destination=0; |
|
355 | + } |
|
356 | 356 | |
357 | - if ($url=='') { |
|
358 | - $url=0; |
|
359 | - } |
|
357 | + if ($url=='') { |
|
358 | + $url=0; |
|
359 | + } |
|
360 | 360 | |
361 | - //1@@1;2;@@2;4;4;@@http://www.chamilo.org |
|
362 | - $dest= $try.'@@'.$lp.'@@'.$destination.'@@'.$url; |
|
363 | - $objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i,NULL,NULL,$dest); |
|
361 | + //1@@1;2;@@2;4;4;@@http://www.chamilo.org |
|
362 | + $dest= $try.'@@'.$lp.'@@'.$destination.'@@'.$url; |
|
363 | + $objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i,NULL,NULL,$dest); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | //Create 666 answer |
@@ -373,18 +373,18 @@ discard block |
||
373 | 373 | |
374 | 374 | $objAnswer -> createAnswer($answer,$goodAnswer,$comment,$weighting,$i,NULL,NULL,$dest); |
375 | 375 | |
376 | - // saves the answers into the data base |
|
376 | + // saves the answers into the data base |
|
377 | 377 | $objAnswer -> save(); |
378 | 378 | |
379 | 379 | // sets the total weighting of the question |
380 | 380 | $this -> updateWeighting($questionWeighting); |
381 | 381 | $this -> save(); |
382 | - } |
|
382 | + } |
|
383 | 383 | |
384 | - function return_header($feedback_type = null, $counter = null, $score = null) |
|
384 | + function return_header($feedback_type = null, $counter = null, $score = null) |
|
385 | 385 | { |
386 | - $header = parent::return_header($feedback_type, $counter, $score); |
|
387 | - $header .= '<table class="'.$this->question_table_class .'"> |
|
386 | + $header = parent::return_header($feedback_type, $counter, $score); |
|
387 | + $header .= '<table class="'.$this->question_table_class .'"> |
|
388 | 388 | <tr> |
389 | 389 | <th>'.get_lang("Choice").'</th> |
390 | 390 | <th>'. get_lang("ExpectedChoice").'</th> |
@@ -392,5 +392,5 @@ discard block |
||
392 | 392 | $header .= '<th>'.get_lang("Comment").'</th>'; |
393 | 393 | $header .= '</tr>'; |
394 | 394 | return $header; |
395 | - } |
|
395 | + } |
|
396 | 396 | } |
@@ -172,11 +172,11 @@ discard block |
||
172 | 172 | } |
173 | 173 | |
174 | 174 | if (isset($_SESSION['gradebook'])){ |
175 | - $gradebook= $_SESSION['gradebook']; |
|
175 | + $gradebook= $_SESSION['gradebook']; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | if (!empty($gradebook) && $gradebook=='view') { |
179 | - $interbreadcrumb[]= array ('url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']),'name' => get_lang('ToolGradebook')); |
|
179 | + $interbreadcrumb[]= array ('url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']),'name' => get_lang('ToolGradebook')); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | // if admin of course |
@@ -227,8 +227,8 @@ discard block |
||
227 | 227 | echo '</div>'; |
228 | 228 | |
229 | 229 | if ($displayMessage != "") { |
230 | - Display::display_confirmation_message($displayMessage); |
|
231 | - $displayMessage = ""; |
|
230 | + Display::display_confirmation_message($displayMessage); |
|
231 | + $displayMessage = ""; |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | // Form |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | // Title |
237 | 237 | echo '<legend>'.$nameTools.' - '.$titleAdd.'</legend>'; |
238 | 238 | if (isset($type)) { |
239 | - echo '<input type="hidden" name="type" value="1">'; |
|
239 | + echo '<input type="hidden" name="type" value="1">'; |
|
240 | 240 | } |
241 | 241 | echo '<input type="hidden" name="fromExercise" value="'.$fromExercise.'">'; |
242 | 242 | |
@@ -283,11 +283,11 @@ discard block |
||
283 | 283 | foreach ($course_list as $item) { |
284 | 284 | $courseItemId = $item['real_id']; |
285 | 285 | $courseInfo = api_get_course_info_by_id($courseItemId); |
286 | - $course_select_list[$courseItemId] = ""; |
|
287 | - if ($courseItemId == api_get_course_int_id()) { |
|
288 | - $course_select_list[$courseItemId] = "> "; |
|
289 | - } |
|
290 | - $course_select_list[$courseItemId] .= $courseInfo['title']; |
|
286 | + $course_select_list[$courseItemId] = ""; |
|
287 | + if ($courseItemId == api_get_course_int_id()) { |
|
288 | + $course_select_list[$courseItemId] = "> "; |
|
289 | + } |
|
290 | + $course_select_list[$courseItemId] .= $courseInfo['title']; |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | $select_course_html = Display::select( |
@@ -304,11 +304,11 @@ discard block |
||
304 | 304 | // no course selected, reset menu test / difficult� / type de reponse |
305 | 305 | reset_menu_exo_lvl_type(); |
306 | 306 | } else { |
307 | - $course_info = api_get_course_info_by_id($selected_course); |
|
307 | + $course_info = api_get_course_info_by_id($selected_course); |
|
308 | 308 | } |
309 | 309 | // If course has changed, reset the menu default |
310 | 310 | if ($course_id_changed) { |
311 | - reset_menu_exo_lvl_type(); |
|
311 | + reset_menu_exo_lvl_type(); |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | $course_id = $course_info['real_id']; |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | } |
357 | 357 | |
358 | 358 | if ($exercise_id_changed == 1) { |
359 | - reset_menu_lvl_type(); |
|
359 | + reset_menu_lvl_type(); |
|
360 | 360 | } |
361 | 361 | $select_exercise_html = Display::select( |
362 | 362 | 'exerciseId', |
@@ -434,19 +434,19 @@ discard block |
||
434 | 434 | // if we have selected an exercise in the list-box 'Filter' |
435 | 435 | |
436 | 436 | if ($exerciseId > 0) { |
437 | - $where = ''; |
|
438 | - $from = ''; |
|
439 | - if (isset($courseCategoryId) && $courseCategoryId > 0) { |
|
440 | - $from = ", $TBL_COURSE_REL_CATEGORY crc "; |
|
441 | - $where .= " AND crc.c_id=$selected_course AND crc.question_id=qu.id AND crc.category_id=$courseCategoryId"; |
|
442 | - } |
|
443 | - if (isset($exerciseLevel) && $exerciseLevel != -1) { |
|
444 | - $where .= ' AND level='.$exerciseLevel; |
|
445 | - } |
|
446 | - if (isset($answerType) && $answerType > 0) { |
|
447 | - $where .= ' AND type='.$answerType; |
|
448 | - } |
|
449 | - $sql = "SELECT DISTINCT |
|
437 | + $where = ''; |
|
438 | + $from = ''; |
|
439 | + if (isset($courseCategoryId) && $courseCategoryId > 0) { |
|
440 | + $from = ", $TBL_COURSE_REL_CATEGORY crc "; |
|
441 | + $where .= " AND crc.c_id=$selected_course AND crc.question_id=qu.id AND crc.category_id=$courseCategoryId"; |
|
442 | + } |
|
443 | + if (isset($exerciseLevel) && $exerciseLevel != -1) { |
|
444 | + $where .= ' AND level='.$exerciseLevel; |
|
445 | + } |
|
446 | + if (isset($answerType) && $answerType > 0) { |
|
447 | + $where .= ' AND type='.$answerType; |
|
448 | + } |
|
449 | + $sql = "SELECT DISTINCT |
|
450 | 450 | id, |
451 | 451 | question, |
452 | 452 | type, |
@@ -468,22 +468,22 @@ discard block |
||
468 | 468 | $mainQuestionList[] = $row; |
469 | 469 | } |
470 | 470 | } elseif ($exerciseId == -1) { |
471 | - // If we have selected the option 'Orphan questions' in the list-box 'Filter' |
|
472 | - $level_where = ''; |
|
473 | - $from = ''; |
|
474 | - if (isset($courseCategoryId) && $courseCategoryId > 0) { |
|
475 | - $from = " INNER JOIN $TBL_COURSE_REL_CATEGORY crc ON crc.question_id=q.id AND crc.c_id= q.c_id "; |
|
476 | - $level_where .= " AND |
|
471 | + // If we have selected the option 'Orphan questions' in the list-box 'Filter' |
|
472 | + $level_where = ''; |
|
473 | + $from = ''; |
|
474 | + if (isset($courseCategoryId) && $courseCategoryId > 0) { |
|
475 | + $from = " INNER JOIN $TBL_COURSE_REL_CATEGORY crc ON crc.question_id=q.id AND crc.c_id= q.c_id "; |
|
476 | + $level_where .= " AND |
|
477 | 477 | crc.c_id = $selected_course AND |
478 | 478 | crc.category_id = $courseCategoryId"; |
479 | - } |
|
480 | - if (isset($exerciseLevel) && $exerciseLevel!= -1 ) { |
|
481 | - $level_where = ' AND level='.$exerciseLevel; |
|
482 | - } |
|
483 | - $answer_where = ''; |
|
484 | - if (isset($answerType) && $answerType >0 -1 ) { |
|
485 | - $answer_where = ' AND type='.$answerType; |
|
486 | - } |
|
479 | + } |
|
480 | + if (isset($exerciseLevel) && $exerciseLevel!= -1 ) { |
|
481 | + $level_where = ' AND level='.$exerciseLevel; |
|
482 | + } |
|
483 | + $answer_where = ''; |
|
484 | + if (isset($answerType) && $answerType >0 -1 ) { |
|
485 | + $answer_where = ' AND type='.$answerType; |
|
486 | + } |
|
487 | 487 | |
488 | 488 | // @todo fix this query with the new id field |
489 | 489 | $sql = " ( |
@@ -525,24 +525,24 @@ discard block |
||
525 | 525 | $mainQuestionList[] = $row; |
526 | 526 | } |
527 | 527 | } else { |
528 | - // All tests for selected course |
|
528 | + // All tests for selected course |
|
529 | 529 | // If we have not selected any option in the list-box 'Filter' |
530 | - $filter = ''; |
|
531 | - $from = ''; |
|
530 | + $filter = ''; |
|
531 | + $from = ''; |
|
532 | 532 | |
533 | - if (isset($courseCategoryId) && $courseCategoryId > 0) { |
|
534 | - $from = ", $TBL_COURSE_REL_CATEGORY crc "; |
|
535 | - $filter .= " AND |
|
533 | + if (isset($courseCategoryId) && $courseCategoryId > 0) { |
|
534 | + $from = ", $TBL_COURSE_REL_CATEGORY crc "; |
|
535 | + $filter .= " AND |
|
536 | 536 | crc.c_id = $selected_course AND |
537 | 537 | crc.question_id = qu.id AND |
538 | 538 | crc.category_id = $courseCategoryId"; |
539 | - } |
|
540 | - if (isset($exerciseLevel) && $exerciseLevel != -1) { |
|
541 | - $filter .= ' AND level='.$exerciseLevel.' '; |
|
542 | - } |
|
543 | - if (isset($answerType) && $answerType > 0) { |
|
544 | - $filter .= ' AND qu.type='.$answerType.' '; |
|
545 | - } |
|
539 | + } |
|
540 | + if (isset($exerciseLevel) && $exerciseLevel != -1) { |
|
541 | + $filter .= ' AND level='.$exerciseLevel.' '; |
|
542 | + } |
|
543 | + if (isset($answerType) && $answerType > 0) { |
|
544 | + $filter .= ' AND qu.type='.$answerType.' '; |
|
545 | + } |
|
546 | 546 | |
547 | 547 | if (!empty($session_id) && $session_id != '-1') { |
548 | 548 | $mainQuestionList = array(); |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | $mainQuestionList[] = $row; |
645 | 645 | } |
646 | 646 | } |
647 | - // forces the value to 0 |
|
647 | + // forces the value to 0 |
|
648 | 648 | $exerciseId = 0; |
649 | 649 | } |
650 | 650 | |
@@ -670,33 +670,33 @@ discard block |
||
670 | 670 | // |
671 | 671 | if ($fromExercise <= 0) { |
672 | 672 | // NOT IN A TEST - IN THE COURSE |
673 | - if ($selected_course == api_get_course_int_id()) { |
|
674 | - $actionLabel = get_lang('Modify'); |
|
675 | - $actionIcon1 = "edit"; |
|
676 | - $actionIcon2 = "delete"; |
|
673 | + if ($selected_course == api_get_course_int_id()) { |
|
674 | + $actionLabel = get_lang('Modify'); |
|
675 | + $actionIcon1 = "edit"; |
|
676 | + $actionIcon2 = "delete"; |
|
677 | 677 | // We are in the course, question title can be a link to the question edit page |
678 | - $questionTagA = 1; |
|
678 | + $questionTagA = 1; |
|
679 | 679 | } else { // NOT IN A TEST - NOT IN THE COURSE |
680 | - $actionLabel = get_lang('Reuse'); |
|
681 | - $actionIcon1 = get_lang('MustBeInATest'); |
|
682 | - $actionIcon2 = ""; |
|
680 | + $actionLabel = get_lang('Reuse'); |
|
681 | + $actionIcon1 = get_lang('MustBeInATest'); |
|
682 | + $actionIcon2 = ""; |
|
683 | 683 | // We are not in this course, to messy if we link to the question in another course |
684 | - $questionTagA = 0; |
|
685 | - } |
|
684 | + $questionTagA = 0; |
|
685 | + } |
|
686 | 686 | } else { |
687 | 687 | // IN A TEST - IN THE COURSE |
688 | - if ($selected_course == api_get_course_int_id()) { |
|
689 | - $actionLabel = get_lang('Reuse'); |
|
690 | - $actionIcon1 = "add"; |
|
691 | - $actionIcon2 = ""; |
|
692 | - $questionTagA = 1; |
|
688 | + if ($selected_course == api_get_course_int_id()) { |
|
689 | + $actionLabel = get_lang('Reuse'); |
|
690 | + $actionIcon1 = "add"; |
|
691 | + $actionIcon2 = ""; |
|
692 | + $questionTagA = 1; |
|
693 | 693 | } else { |
694 | 694 | // IN A TEST - NOT IN THE COURSE |
695 | - $actionLabel = get_lang('Reuse'); |
|
696 | - $actionIcon1 = "clone"; |
|
697 | - $actionIcon2 = ""; |
|
698 | - $questionTagA = 0; |
|
699 | - } |
|
695 | + $actionLabel = get_lang('Reuse'); |
|
696 | + $actionIcon1 = "clone"; |
|
697 | + $actionIcon2 = ""; |
|
698 | + $questionTagA = 0; |
|
699 | + } |
|
700 | 700 | } |
701 | 701 | // Display table |
702 | 702 | $header = array( |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | ); |
790 | 790 | |
791 | 791 | if (!$nbrQuestions) { |
792 | - echo get_lang('NoQuestion'); |
|
792 | + echo get_lang('NoQuestion'); |
|
793 | 793 | } |
794 | 794 | |
795 | 795 | Display::display_footer(); |
@@ -801,9 +801,9 @@ discard block |
||
801 | 801 | */ |
802 | 802 | function reset_menu_lvl_type() |
803 | 803 | { |
804 | - global $exerciseLevel, $answerType; |
|
805 | - $answerType = -1; |
|
806 | - $exerciseLevel = -1; |
|
804 | + global $exerciseLevel, $answerType; |
|
805 | + $answerType = -1; |
|
806 | + $exerciseLevel = -1; |
|
807 | 807 | } |
808 | 808 | |
809 | 809 | /** |
@@ -813,10 +813,10 @@ discard block |
||
813 | 813 | */ |
814 | 814 | function reset_menu_exo_lvl_type() |
815 | 815 | { |
816 | - global $exerciseId, $courseCategoryId; |
|
817 | - reset_menu_lvl_type(); |
|
818 | - $exerciseId = 0; |
|
819 | - $courseCategoryId = 0; |
|
816 | + global $exerciseId, $courseCategoryId; |
|
817 | + reset_menu_lvl_type(); |
|
818 | + $exerciseId = 0; |
|
819 | + $courseCategoryId = 0; |
|
820 | 820 | } |
821 | 821 | |
822 | 822 | /** |
@@ -838,17 +838,17 @@ discard block |
||
838 | 838 | $in_questionname, |
839 | 839 | $sessionId |
840 | 840 | ) { |
841 | - $res = $in_questionname; |
|
841 | + $res = $in_questionname; |
|
842 | 842 | $sessionIcon = null; |
843 | - if ($in_addA) { |
|
843 | + if ($in_addA) { |
|
844 | 844 | if (!empty($sessionId) && $sessionId != -1) { |
845 | 845 | $sessionIcon = ' '.Display::return_icon('star.png', get_lang('Session')); |
846 | 846 | } |
847 | - $res = "<a href='admin.php?".api_get_cidreq()."&editQuestion=$in_questionid&type=$in_questiontype&fromExercise=$in_fromex'>". |
|
847 | + $res = "<a href='admin.php?".api_get_cidreq()."&editQuestion=$in_questionid&type=$in_questiontype&fromExercise=$in_fromex'>". |
|
848 | 848 | $res.$sessionIcon. |
849 | 849 | "</a>"; |
850 | - } |
|
851 | - return $res; |
|
850 | + } |
|
851 | + return $res; |
|
852 | 852 | } |
853 | 853 | |
854 | 854 | /** |
@@ -878,16 +878,16 @@ discard block |
||
878 | 878 | $in_session_id, |
879 | 879 | $in_exercise_id |
880 | 880 | ) { |
881 | - $res = ""; |
|
882 | - $getParams = "&selected_course=$in_selected_course&courseCategoryId=$in_courseCategoryId&exerciseId=$in_exercise_id&exerciseLevel=$in_exerciseLevel&answerType=$in_answerType&session_id=$in_session_id"; |
|
883 | - switch ($in_action) { |
|
884 | - case "delete" : |
|
885 | - $res = "<a href='".api_get_self()."?".api_get_cidreq().$getParams."&delete=$in_questionid' onclick='return confirm_your_choice()'>"; |
|
886 | - $res .= Display::return_icon("delete.png", get_lang('Delete')); |
|
887 | - $res .= "</a>"; |
|
888 | - break; |
|
889 | - case "edit" : |
|
890 | - $res = get_a_tag_for_question( |
|
881 | + $res = ""; |
|
882 | + $getParams = "&selected_course=$in_selected_course&courseCategoryId=$in_courseCategoryId&exerciseId=$in_exercise_id&exerciseLevel=$in_exerciseLevel&answerType=$in_answerType&session_id=$in_session_id"; |
|
883 | + switch ($in_action) { |
|
884 | + case "delete" : |
|
885 | + $res = "<a href='".api_get_self()."?".api_get_cidreq().$getParams."&delete=$in_questionid' onclick='return confirm_your_choice()'>"; |
|
886 | + $res .= Display::return_icon("delete.png", get_lang('Delete')); |
|
887 | + $res .= "</a>"; |
|
888 | + break; |
|
889 | + case "edit" : |
|
890 | + $res = get_a_tag_for_question( |
|
891 | 891 | 1, |
892 | 892 | $from_exercise, |
893 | 893 | $in_questionid, |
@@ -895,33 +895,33 @@ discard block |
||
895 | 895 | Display::return_icon("edit.png", get_lang('Modify')), |
896 | 896 | $in_session_id |
897 | 897 | ); |
898 | - break; |
|
899 | - case "add": |
|
900 | - // add if question is not already in test |
|
901 | - $myObjEx = new Exercise(); |
|
902 | - $myObjEx->read($from_exercise); |
|
903 | - if (!$myObjEx->isInList($in_questionid)) { |
|
904 | - $res = "<a href='".api_get_self()."?".api_get_cidreq().$getParams."&recup=$in_questionid&fromExercise=$from_exercise'>"; |
|
905 | - $res .= Display::return_icon("view_more_stats.gif", get_lang('InsertALinkToThisQuestionInTheExercise')); |
|
906 | - $res .= "</a>"; |
|
898 | + break; |
|
899 | + case "add": |
|
900 | + // add if question is not already in test |
|
901 | + $myObjEx = new Exercise(); |
|
902 | + $myObjEx->read($from_exercise); |
|
903 | + if (!$myObjEx->isInList($in_questionid)) { |
|
904 | + $res = "<a href='".api_get_self()."?".api_get_cidreq().$getParams."&recup=$in_questionid&fromExercise=$from_exercise'>"; |
|
905 | + $res .= Display::return_icon("view_more_stats.gif", get_lang('InsertALinkToThisQuestionInTheExercise')); |
|
906 | + $res .= "</a>"; |
|
907 | 907 | } else { |
908 | - $res = "-"; |
|
909 | - } |
|
910 | - unset($myObjEx); |
|
911 | - break; |
|
912 | - case "clone": |
|
908 | + $res = "-"; |
|
909 | + } |
|
910 | + unset($myObjEx); |
|
911 | + break; |
|
912 | + case "clone": |
|
913 | 913 | $url = api_get_self()."?".api_get_cidreq().$getParams."&question_copy=$in_questionid&course_id=$in_selected_course&fromExercise=$from_exercise"; |
914 | 914 | $res = Display::url( |
915 | 915 | Display::return_icon('cd.gif', get_lang('ReUseACopyInCurrentTest')), |
916 | 916 | $url |
917 | 917 | ); |
918 | - break; |
|
919 | - default : |
|
920 | - $res = $in_action; |
|
921 | - break; |
|
922 | - } |
|
918 | + break; |
|
919 | + default : |
|
920 | + $res = $in_action; |
|
921 | + break; |
|
922 | + } |
|
923 | 923 | |
924 | - return $res; |
|
924 | + return $res; |
|
925 | 925 | } |
926 | 926 | |
927 | 927 | /** |
@@ -930,14 +930,14 @@ discard block |
||
930 | 930 | */ |
931 | 931 | function get_question_type_for_question($in_selectedcourse, $in_questionid) |
932 | 932 | { |
933 | - $myObjQuestion = Question::read($in_questionid, $in_selectedcourse); |
|
933 | + $myObjQuestion = Question::read($in_questionid, $in_selectedcourse); |
|
934 | 934 | $questionType = null; |
935 | 935 | if (!empty($myObjQuestion)) { |
936 | 936 | list($typeImg, $typeExpl) = $myObjQuestion->get_type_icon_html(); |
937 | 937 | $questionType = Display::tag('div', Display::return_icon($typeImg, $typeExpl, array(), 32), array()); |
938 | 938 | unset($myObjQuestion); |
939 | 939 | } |
940 | - return $questionType; |
|
940 | + return $questionType; |
|
941 | 941 | } |
942 | 942 | |
943 | 943 | /** |
@@ -946,6 +946,6 @@ discard block |
||
946 | 946 | */ |
947 | 947 | function get_question_categorie_for_question($in_courseid, $in_questionid) |
948 | 948 | { |
949 | - $cat = TestCategory::getCategoryNameForQuestion($in_questionid, $in_courseid); |
|
950 | - return $cat; |
|
949 | + $cat = TestCategory::getCategoryNameForQuestion($in_questionid, $in_courseid); |
|
950 | + return $cat; |
|
951 | 951 | } |
@@ -162,17 +162,17 @@ |
||
162 | 162 | |
163 | 163 | if ($form->validate()) { |
164 | 164 | $officialCode = $form->getSubmitValue('filter'); |
165 | - if ($officialCode == 'all') { |
|
165 | + if ($officialCode == 'all') { |
|
166 | 166 | $certificate_list = GradebookUtils::get_list_users_certificates($cat_id); |
167 | 167 | } else { |
168 | - $userList = UserManager::getUsersByOfficialCode($officialCode); |
|
169 | - if (!empty($userList)) { |
|
170 | - $certificate_list = GradebookUtils::get_list_users_certificates( |
|
171 | - $cat_id, |
|
172 | - $userList |
|
173 | - ); |
|
174 | - } |
|
175 | - } |
|
168 | + $userList = UserManager::getUsersByOfficialCode($officialCode); |
|
169 | + if (!empty($userList)) { |
|
170 | + $certificate_list = GradebookUtils::get_list_users_certificates( |
|
171 | + $cat_id, |
|
172 | + $userList |
|
173 | + ); |
|
174 | + } |
|
175 | + } |
|
176 | 176 | } else { |
177 | 177 | $certificate_list = GradebookUtils::get_list_users_certificates($cat_id); |
178 | 178 | } |