@@ -17,25 +17,25 @@ |
||
17 | 17 | $hotspotId = $_GET['hotspotId']; |
18 | 18 | $exerciseId = $objExcercise->selectId(); |
19 | 19 | if ($_GET['answerId'] == "0") { // click is NOT on a hotspot |
20 | - $hit = 0; |
|
21 | - $answerId = $hotspotId; |
|
20 | + $hit = 0; |
|
21 | + $answerId = $hotspotId; |
|
22 | 22 | |
23 | - // remove from session |
|
24 | - unset($_SESSION['exerciseResult'][$questionId][$answerId]); |
|
23 | + // remove from session |
|
24 | + unset($_SESSION['exerciseResult'][$questionId][$answerId]); |
|
25 | 25 | |
26 | - // Save clicking order |
|
27 | - //$answerOrderId = count($_SESSION['exerciseResult'][$questionId]['order'])+1; |
|
28 | - //$_SESSION['exerciseResult'][$questionId]['order'][$answerOrderId] = $answerId; |
|
26 | + // Save clicking order |
|
27 | + //$answerOrderId = count($_SESSION['exerciseResult'][$questionId]['order'])+1; |
|
28 | + //$_SESSION['exerciseResult'][$questionId]['order'][$answerOrderId] = $answerId; |
|
29 | 29 | } else { // user clicked ON a hotspot |
30 | - $hit = 1; |
|
31 | - $answerId = $hotspotId; |
|
30 | + $hit = 1; |
|
31 | + $answerId = $hotspotId; |
|
32 | 32 | |
33 | - // Save into session |
|
34 | - $_SESSION['exerciseResult'][$questionId][$answerId] = $hit; |
|
33 | + // Save into session |
|
34 | + $_SESSION['exerciseResult'][$questionId][$answerId] = $hit; |
|
35 | 35 | |
36 | - // Save clicking order |
|
37 | - //$answerOrderId = count($_SESSION['exerciseResult'][$questionId]['order'])+1; |
|
38 | - //$_SESSION['exerciseResult'][$questionId]['order'][$answerOrderId] = $answerId; |
|
36 | + // Save clicking order |
|
37 | + //$answerOrderId = count($_SESSION['exerciseResult'][$questionId]['order'])+1; |
|
38 | + //$_SESSION['exerciseResult'][$questionId]['order'][$answerOrderId] = $answerId; |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | //round-up the coordinates |
@@ -907,10 +907,10 @@ |
||
907 | 907 | <?php } else { ?> |
908 | 908 | <input class="form-control" type="text" name="weighting[<?php echo $i; ?>]" value="<?php echo (isset($weighting[$i]) ? $weighting[$i] : 10); ?>" /> |
909 | 909 | <?php |
910 | - } |
|
911 | - } |
|
912 | - if ($answerType == HOT_SPOT) { |
|
913 | - ?> |
|
910 | + } |
|
911 | + } |
|
912 | + if ($answerType == HOT_SPOT) { |
|
913 | + ?> |
|
914 | 914 | <input class="form-control" type="text" name="weighting[<?php echo $i; ?>]" value="<?php echo (isset($weighting[$i]) ? $weighting[$i] : 10); ?>" /> |
915 | 915 | <input type="hidden" name="hotspot_coordinates[<?php echo $i; ?>]" value="<?php echo (empty($hotspot_coordinates[$i]) ? '0;0|0|0' : $hotspot_coordinates[$i]); ?>" /> |
916 | 916 | <input type="hidden" name="hotspot_type[<?php echo $i; ?>]" value="<?php echo (empty($hotspot_type[$i]) ? 'square' : $hotspot_type[$i]); ?>" /> |
@@ -17,15 +17,15 @@ |
||
17 | 17 | $answerOrderId = count($_SESSION['exerciseResult'][$questionId]['ids'])+1; |
18 | 18 | if ($_GET['answerId'] == "0") // click is NOT on a hotspot |
19 | 19 | { |
20 | - $hit = 0; |
|
21 | - $answerId = NULL; |
|
20 | + $hit = 0; |
|
21 | + $answerId = NULL; |
|
22 | 22 | } |
23 | 23 | else // user clicked ON a hotspot |
24 | 24 | { |
25 | - $hit = 1; |
|
26 | - $answerId = api_substr($_GET['answerId'],22,2); |
|
27 | - // Save into session |
|
28 | - $_SESSION['exerciseResult'][$questionId][$answerId] = $hit; |
|
25 | + $hit = 1; |
|
26 | + $answerId = api_substr($_GET['answerId'],22,2); |
|
27 | + // Save into session |
|
28 | + $_SESSION['exerciseResult'][$questionId][$answerId] = $hit; |
|
29 | 29 | } |
30 | 30 | //round-up the coordinates |
31 | 31 | $coords = explode('/',$coordinates); |
@@ -155,12 +155,12 @@ discard block |
||
155 | 155 | return []; |
156 | 156 | } |
157 | 157 | |
158 | - /** |
|
159 | - * returns all answer ids from this question Id |
|
160 | - * |
|
161 | - * @author Yoselyn Castillo |
|
162 | - * @return array - $id (answer ids) |
|
163 | - */ |
|
158 | + /** |
|
159 | + * returns all answer ids from this question Id |
|
160 | + * |
|
161 | + * @author Yoselyn Castillo |
|
162 | + * @return array - $id (answer ids) |
|
163 | + */ |
|
164 | 164 | public function selectAnswerId() |
165 | 165 | { |
166 | 166 | $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER); |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | } |
181 | 181 | |
182 | 182 | return $id; |
183 | - } |
|
183 | + } |
|
184 | 184 | |
185 | 185 | /** |
186 | 186 | * Reads answer information from the data base ordered by parameter |
@@ -190,23 +190,23 @@ discard block |
||
190 | 190 | */ |
191 | 191 | public function readOrderedBy($field, $order='ASC') |
192 | 192 | { |
193 | - $field = Database::escape_string($field); |
|
194 | - if (empty($field)) { |
|
195 | - $field = 'position'; |
|
196 | - } |
|
193 | + $field = Database::escape_string($field); |
|
194 | + if (empty($field)) { |
|
195 | + $field = 'position'; |
|
196 | + } |
|
197 | 197 | |
198 | - if ($order != 'ASC' && $order!='DESC') { |
|
199 | - $order = 'ASC'; |
|
200 | - } |
|
198 | + if ($order != 'ASC' && $order!='DESC') { |
|
199 | + $order = 'ASC'; |
|
200 | + } |
|
201 | 201 | |
202 | - $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER); |
|
203 | - $TBL_QUIZ = Database::get_course_table(TABLE_QUIZ_QUESTION); |
|
204 | - $questionId = intval($this->questionId); |
|
202 | + $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER); |
|
203 | + $TBL_QUIZ = Database::get_course_table(TABLE_QUIZ_QUESTION); |
|
204 | + $questionId = intval($this->questionId); |
|
205 | 205 | |
206 | - $sql = "SELECT type FROM $TBL_QUIZ |
|
206 | + $sql = "SELECT type FROM $TBL_QUIZ |
|
207 | 207 | WHERE c_id = {$this->course_id} AND id = $questionId"; |
208 | - $result_question = Database::query($sql); |
|
209 | - $questionType = Database::fetch_array($result_question); |
|
208 | + $result_question = Database::query($sql); |
|
209 | + $questionType = Database::fetch_array($result_question); |
|
210 | 210 | |
211 | 211 | if ($questionType['type'] == DRAGGABLE) { |
212 | 212 | // Random is done by submit.js.tpl |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | return true; |
216 | 216 | } |
217 | 217 | |
218 | - $sql = "SELECT |
|
218 | + $sql = "SELECT |
|
219 | 219 | answer, |
220 | 220 | correct, |
221 | 221 | comment, |
@@ -230,16 +230,16 @@ discard block |
||
230 | 230 | c_id = {$this->course_id} AND |
231 | 231 | question_id='".$questionId."' |
232 | 232 | ORDER BY $field $order"; |
233 | - $result=Database::query($sql); |
|
234 | - |
|
235 | - $i = 1; |
|
236 | - // while a record is found |
|
237 | - $doubt_data = null; |
|
238 | - while ($object = Database::fetch_object($result)) { |
|
239 | - if ($questionType['type'] == UNIQUE_ANSWER_NO_OPTION && $object->position == 666) { |
|
240 | - $doubt_data = $object; |
|
233 | + $result=Database::query($sql); |
|
234 | + |
|
235 | + $i = 1; |
|
236 | + // while a record is found |
|
237 | + $doubt_data = null; |
|
238 | + while ($object = Database::fetch_object($result)) { |
|
239 | + if ($questionType['type'] == UNIQUE_ANSWER_NO_OPTION && $object->position == 666) { |
|
240 | + $doubt_data = $object; |
|
241 | 241 | continue; |
242 | - } |
|
242 | + } |
|
243 | 243 | $this->answer[$i] = $object->answer; |
244 | 244 | $this->correct[$i] = $object->correct; |
245 | 245 | $this->comment[$i] = $object->comment; |
@@ -248,9 +248,9 @@ discard block |
||
248 | 248 | $this->destination[$i] = $object->destination; |
249 | 249 | $this->autoId[$i] = $object->id_auto; |
250 | 250 | $i++; |
251 | - } |
|
251 | + } |
|
252 | 252 | |
253 | - if ($questionType['type'] == UNIQUE_ANSWER_NO_OPTION && !empty($doubt_data)) { |
|
253 | + if ($questionType['type'] == UNIQUE_ANSWER_NO_OPTION && !empty($doubt_data)) { |
|
254 | 254 | $this->answer[$i] = $doubt_data->answer; |
255 | 255 | $this->correct[$i] = $doubt_data->correct; |
256 | 256 | $this->comment[$i] = $doubt_data->comment; |
@@ -259,86 +259,86 @@ discard block |
||
259 | 259 | $this->destination[$i] = $doubt_data->destination; |
260 | 260 | $this->autoId[$i] = $doubt_data->id_auto; |
261 | 261 | $i++; |
262 | - } |
|
262 | + } |
|
263 | 263 | $this->nbrAnswers = $i-1; |
264 | - } |
|
265 | - |
|
266 | - /** |
|
267 | - * returns the autoincrement id identificator |
|
268 | - * |
|
269 | - * @author Juan Carlos Ra�a |
|
270 | - * @return integer - answer num |
|
271 | - */ |
|
264 | + } |
|
265 | + |
|
266 | + /** |
|
267 | + * returns the autoincrement id identificator |
|
268 | + * |
|
269 | + * @author Juan Carlos Ra�a |
|
270 | + * @return integer - answer num |
|
271 | + */ |
|
272 | 272 | public function selectAutoId($id) |
273 | 273 | { |
274 | - return isset($this->autoId[$id]) ? $this->autoId[$id] : null; |
|
275 | - } |
|
276 | - |
|
277 | - /** |
|
278 | - * returns the number of answers in this question |
|
279 | - * |
|
280 | - * @author Olivier Brouckaert |
|
281 | - * @return integer - number of answers |
|
282 | - */ |
|
283 | - public function selectNbrAnswers() |
|
274 | + return isset($this->autoId[$id]) ? $this->autoId[$id] : null; |
|
275 | + } |
|
276 | + |
|
277 | + /** |
|
278 | + * returns the number of answers in this question |
|
279 | + * |
|
280 | + * @author Olivier Brouckaert |
|
281 | + * @return integer - number of answers |
|
282 | + */ |
|
283 | + public function selectNbrAnswers() |
|
284 | 284 | { |
285 | - return $this->nbrAnswers; |
|
286 | - } |
|
287 | - |
|
288 | - /** |
|
289 | - * returns the question ID which the answers belong to |
|
290 | - * |
|
291 | - * @author Olivier Brouckaert |
|
292 | - * @return integer - the question ID |
|
293 | - */ |
|
294 | - public function selectQuestionId() |
|
285 | + return $this->nbrAnswers; |
|
286 | + } |
|
287 | + |
|
288 | + /** |
|
289 | + * returns the question ID which the answers belong to |
|
290 | + * |
|
291 | + * @author Olivier Brouckaert |
|
292 | + * @return integer - the question ID |
|
293 | + */ |
|
294 | + public function selectQuestionId() |
|
295 | 295 | { |
296 | - return $this->questionId; |
|
297 | - } |
|
298 | - |
|
299 | - /** |
|
300 | - * returns the question ID of the destination question |
|
301 | - * |
|
302 | - * @author Julio Montoya |
|
303 | - * @return integer - the question ID |
|
304 | - */ |
|
305 | - public function selectDestination($id) |
|
296 | + return $this->questionId; |
|
297 | + } |
|
298 | + |
|
299 | + /** |
|
300 | + * returns the question ID of the destination question |
|
301 | + * |
|
302 | + * @author Julio Montoya |
|
303 | + * @return integer - the question ID |
|
304 | + */ |
|
305 | + public function selectDestination($id) |
|
306 | 306 | { |
307 | - return isset($this->destination[$id]) ? $this->destination[$id] : null; |
|
308 | - } |
|
307 | + return isset($this->destination[$id]) ? $this->destination[$id] : null; |
|
308 | + } |
|
309 | 309 | |
310 | 310 | /** |
311 | - * returns the answer title |
|
312 | - * |
|
313 | - * @author Olivier Brouckaert |
|
314 | - * @param - integer $id - answer ID |
|
315 | - * @return string - answer title |
|
316 | - */ |
|
317 | - public function selectAnswer($id) |
|
318 | - { |
|
319 | - return isset($this->answer[$id]) ? $this->answer[$id] : null; |
|
320 | - } |
|
321 | - |
|
322 | - /** |
|
323 | - * return array answer by id else return a bool |
|
324 | - */ |
|
325 | - public function selectAnswerByAutoId($auto_id) |
|
326 | - { |
|
327 | - $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER); |
|
328 | - |
|
329 | - $auto_id = intval($auto_id); |
|
330 | - $sql = "SELECT id, answer, id_auto FROM $TBL_ANSWER |
|
311 | + * returns the answer title |
|
312 | + * |
|
313 | + * @author Olivier Brouckaert |
|
314 | + * @param - integer $id - answer ID |
|
315 | + * @return string - answer title |
|
316 | + */ |
|
317 | + public function selectAnswer($id) |
|
318 | + { |
|
319 | + return isset($this->answer[$id]) ? $this->answer[$id] : null; |
|
320 | + } |
|
321 | + |
|
322 | + /** |
|
323 | + * return array answer by id else return a bool |
|
324 | + */ |
|
325 | + public function selectAnswerByAutoId($auto_id) |
|
326 | + { |
|
327 | + $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER); |
|
328 | + |
|
329 | + $auto_id = intval($auto_id); |
|
330 | + $sql = "SELECT id, answer, id_auto FROM $TBL_ANSWER |
|
331 | 331 | WHERE c_id = {$this->course_id} AND id_auto='$auto_id'"; |
332 | - $rs = Database::query($sql); |
|
332 | + $rs = Database::query($sql); |
|
333 | 333 | |
334 | - if (Database::num_rows($rs) > 0) { |
|
335 | - $row = Database::fetch_array($rs, 'ASSOC'); |
|
334 | + if (Database::num_rows($rs) > 0) { |
|
335 | + $row = Database::fetch_array($rs, 'ASSOC'); |
|
336 | 336 | |
337 | - return $row; |
|
338 | - } |
|
337 | + return $row; |
|
338 | + } |
|
339 | 339 | |
340 | - return false; |
|
341 | - } |
|
340 | + return false; |
|
341 | + } |
|
342 | 342 | |
343 | 343 | /** |
344 | 344 | * returns the answer title from an answer's position |
@@ -347,18 +347,18 @@ discard block |
||
347 | 347 | * @param - integer $id - answer ID |
348 | 348 | * @return bool - answer title |
349 | 349 | */ |
350 | - public function selectAnswerIdByPosition($pos) |
|
351 | - { |
|
352 | - foreach ($this->position as $k => $v) { |
|
353 | - if ($v != $pos) { |
|
354 | - continue; |
|
355 | - } |
|
350 | + public function selectAnswerIdByPosition($pos) |
|
351 | + { |
|
352 | + foreach ($this->position as $k => $v) { |
|
353 | + if ($v != $pos) { |
|
354 | + continue; |
|
355 | + } |
|
356 | 356 | |
357 | - return $k; |
|
358 | - } |
|
357 | + return $k; |
|
358 | + } |
|
359 | 359 | |
360 | - return false; |
|
361 | - } |
|
360 | + return false; |
|
361 | + } |
|
362 | 362 | |
363 | 363 | /** |
364 | 364 | * Returns a list of answers |
@@ -367,18 +367,18 @@ discard block |
||
367 | 367 | * of (id, answer, comment, grade) and grade=weighting |
368 | 368 | */ |
369 | 369 | public function getAnswersList($decode = false) |
370 | - { |
|
371 | - $list = array(); |
|
372 | - for ($i = 1; $i <= $this->nbrAnswers; $i++) { |
|
373 | - if (!empty($this->answer[$i])) { |
|
374 | - |
|
375 | - //Avoid problems when parsing elements with accents |
|
376 | - if ($decode) { |
|
377 | - $this->answer[$i] = api_html_entity_decode($this->answer[$i], ENT_QUOTES, api_get_system_encoding()); |
|
378 | - $this->comment[$i] = api_html_entity_decode($this->comment[$i], ENT_QUOTES, api_get_system_encoding()); |
|
379 | - } |
|
380 | - |
|
381 | - $list[] = array( |
|
370 | + { |
|
371 | + $list = array(); |
|
372 | + for ($i = 1; $i <= $this->nbrAnswers; $i++) { |
|
373 | + if (!empty($this->answer[$i])) { |
|
374 | + |
|
375 | + //Avoid problems when parsing elements with accents |
|
376 | + if ($decode) { |
|
377 | + $this->answer[$i] = api_html_entity_decode($this->answer[$i], ENT_QUOTES, api_get_system_encoding()); |
|
378 | + $this->comment[$i] = api_html_entity_decode($this->comment[$i], ENT_QUOTES, api_get_system_encoding()); |
|
379 | + } |
|
380 | + |
|
381 | + $list[] = array( |
|
382 | 382 | 'id' => $i, |
383 | 383 | 'answer' => $this->answer[$i], |
384 | 384 | 'comment' => $this->comment[$i], |
@@ -387,134 +387,134 @@ discard block |
||
387 | 387 | 'hotspot_type' => $this->hotspot_type[$i], |
388 | 388 | 'correct' => $this->correct[$i], |
389 | 389 | 'destination' => $this->destination[$i] |
390 | - ); |
|
390 | + ); |
|
391 | + } |
|
391 | 392 | } |
392 | - } |
|
393 | 393 | |
394 | - return $list; |
|
395 | - } |
|
394 | + return $list; |
|
395 | + } |
|
396 | 396 | |
397 | - /** |
|
398 | - * Returns a list of grades |
|
399 | - * @author Yannick Warnier <[email protected]> |
|
400 | - * @return array List of grades where grade=weighting (?) |
|
401 | - */ |
|
397 | + /** |
|
398 | + * Returns a list of grades |
|
399 | + * @author Yannick Warnier <[email protected]> |
|
400 | + * @return array List of grades where grade=weighting (?) |
|
401 | + */ |
|
402 | 402 | public function getGradesList() |
403 | - { |
|
404 | - $list = array(); |
|
405 | - for ($i = 0; $i<$this->nbrAnswers;$i++){ |
|
406 | - if(!empty($this->answer[$i])){ |
|
407 | - $list[$i] = $this->weighting[$i]; |
|
408 | - } |
|
409 | - } |
|
410 | - return $list; |
|
411 | - } |
|
412 | - |
|
413 | - /** |
|
414 | - * Returns the question type |
|
415 | - * @author Yannick Warnier <[email protected]> |
|
416 | - * @return integer The type of the question this answer is bound to |
|
417 | - */ |
|
403 | + { |
|
404 | + $list = array(); |
|
405 | + for ($i = 0; $i<$this->nbrAnswers;$i++){ |
|
406 | + if(!empty($this->answer[$i])){ |
|
407 | + $list[$i] = $this->weighting[$i]; |
|
408 | + } |
|
409 | + } |
|
410 | + return $list; |
|
411 | + } |
|
412 | + |
|
413 | + /** |
|
414 | + * Returns the question type |
|
415 | + * @author Yannick Warnier <[email protected]> |
|
416 | + * @return integer The type of the question this answer is bound to |
|
417 | + */ |
|
418 | 418 | public function getQuestionType() |
419 | - { |
|
420 | - $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION); |
|
421 | - $sql = "SELECT type FROM $TBL_QUESTIONS |
|
419 | + { |
|
420 | + $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION); |
|
421 | + $sql = "SELECT type FROM $TBL_QUESTIONS |
|
422 | 422 | WHERE c_id = {$this->course_id} AND id = '".$this->questionId."'"; |
423 | - $res = Database::query($sql); |
|
424 | - if (Database::num_rows($res)<=0){ |
|
425 | - return null; |
|
426 | - } |
|
427 | - $row = Database::fetch_array($res); |
|
428 | - |
|
429 | - return $row['type']; |
|
430 | - } |
|
431 | - |
|
432 | - |
|
433 | - /** |
|
434 | - * tells if answer is correct or not |
|
435 | - * |
|
436 | - * @author Olivier Brouckaert |
|
437 | - * @param - integer $id - answer ID |
|
438 | - * @return integer - 0 if bad answer, not 0 if good answer |
|
439 | - */ |
|
423 | + $res = Database::query($sql); |
|
424 | + if (Database::num_rows($res)<=0){ |
|
425 | + return null; |
|
426 | + } |
|
427 | + $row = Database::fetch_array($res); |
|
428 | + |
|
429 | + return $row['type']; |
|
430 | + } |
|
431 | + |
|
432 | + |
|
433 | + /** |
|
434 | + * tells if answer is correct or not |
|
435 | + * |
|
436 | + * @author Olivier Brouckaert |
|
437 | + * @param - integer $id - answer ID |
|
438 | + * @return integer - 0 if bad answer, not 0 if good answer |
|
439 | + */ |
|
440 | 440 | public function isCorrect($id) |
441 | - { |
|
442 | - return isset($this->correct[$id]) ? $this->correct[$id] : null; |
|
443 | - } |
|
444 | - |
|
445 | - /** |
|
446 | - * returns answer comment |
|
447 | - * |
|
448 | - * @author Olivier Brouckaert |
|
449 | - * @param - integer $id - answer ID |
|
450 | - * @return string - answer comment |
|
451 | - */ |
|
441 | + { |
|
442 | + return isset($this->correct[$id]) ? $this->correct[$id] : null; |
|
443 | + } |
|
444 | + |
|
445 | + /** |
|
446 | + * returns answer comment |
|
447 | + * |
|
448 | + * @author Olivier Brouckaert |
|
449 | + * @param - integer $id - answer ID |
|
450 | + * @return string - answer comment |
|
451 | + */ |
|
452 | 452 | public function selectComment($id) |
453 | - { |
|
453 | + { |
|
454 | 454 | return isset($this->comment[$id]) ? $this->comment[$id] : null; |
455 | - } |
|
456 | - |
|
457 | - /** |
|
458 | - * returns answer weighting |
|
459 | - * |
|
460 | - * @author Olivier Brouckaert |
|
461 | - * @param - integer $id - answer ID |
|
462 | - * @return integer - answer weighting |
|
463 | - */ |
|
455 | + } |
|
456 | + |
|
457 | + /** |
|
458 | + * returns answer weighting |
|
459 | + * |
|
460 | + * @author Olivier Brouckaert |
|
461 | + * @param - integer $id - answer ID |
|
462 | + * @return integer - answer weighting |
|
463 | + */ |
|
464 | 464 | public function selectWeighting($id) |
465 | - { |
|
466 | - return isset($this->weighting[$id]) ? $this->weighting[$id] : null; |
|
467 | - } |
|
468 | - |
|
469 | - /** |
|
470 | - * returns answer position |
|
471 | - * |
|
472 | - * @author Olivier Brouckaert |
|
473 | - * @param - integer $id - answer ID |
|
474 | - * @return integer - answer position |
|
475 | - */ |
|
476 | - function selectPosition($id) |
|
477 | - { |
|
478 | - return isset($this->position[$id]) ? $this->position[$id] : null; |
|
479 | - } |
|
480 | - |
|
481 | - /** |
|
482 | - * returns answer hotspot coordinates |
|
483 | - * |
|
484 | - * @author Olivier Brouckaert |
|
485 | - * @param integer Answer ID |
|
486 | - * @return integer Answer position |
|
487 | - */ |
|
465 | + { |
|
466 | + return isset($this->weighting[$id]) ? $this->weighting[$id] : null; |
|
467 | + } |
|
468 | + |
|
469 | + /** |
|
470 | + * returns answer position |
|
471 | + * |
|
472 | + * @author Olivier Brouckaert |
|
473 | + * @param - integer $id - answer ID |
|
474 | + * @return integer - answer position |
|
475 | + */ |
|
476 | + function selectPosition($id) |
|
477 | + { |
|
478 | + return isset($this->position[$id]) ? $this->position[$id] : null; |
|
479 | + } |
|
480 | + |
|
481 | + /** |
|
482 | + * returns answer hotspot coordinates |
|
483 | + * |
|
484 | + * @author Olivier Brouckaert |
|
485 | + * @param integer Answer ID |
|
486 | + * @return integer Answer position |
|
487 | + */ |
|
488 | 488 | public function selectHotspotCoordinates($id) |
489 | - { |
|
490 | - return isset($this->hotspot_coordinates[$id]) ? $this->hotspot_coordinates[$id] : null; |
|
491 | - } |
|
492 | - |
|
493 | - /** |
|
494 | - * returns answer hotspot type |
|
495 | - * |
|
496 | - * @author Toon Keppens |
|
497 | - * @param integer Answer ID |
|
498 | - * @return integer Answer position |
|
499 | - */ |
|
489 | + { |
|
490 | + return isset($this->hotspot_coordinates[$id]) ? $this->hotspot_coordinates[$id] : null; |
|
491 | + } |
|
492 | + |
|
493 | + /** |
|
494 | + * returns answer hotspot type |
|
495 | + * |
|
496 | + * @author Toon Keppens |
|
497 | + * @param integer Answer ID |
|
498 | + * @return integer Answer position |
|
499 | + */ |
|
500 | 500 | public function selectHotspotType($id) |
501 | - { |
|
502 | - return isset($this->hotspot_type[$id]) ? $this->hotspot_type[$id] : null; |
|
503 | - } |
|
504 | - |
|
505 | - /** |
|
506 | - * Creates a new answer |
|
507 | - * |
|
508 | - * @author Olivier Brouckaert |
|
509 | - * @param string $answer answer title |
|
510 | - * @param integer $correct 0 if bad answer, not 0 if good answer |
|
511 | - * @param string $comment answer comment |
|
512 | - * @param integer $weighting answer weighting |
|
513 | - * @param integer $position answer position |
|
514 | - * @param array $new_hotspot_coordinates Coordinates for hotspot exercises (optional) |
|
515 | - * @param integer $new_hotspot_type Type for hotspot exercises (optional) |
|
501 | + { |
|
502 | + return isset($this->hotspot_type[$id]) ? $this->hotspot_type[$id] : null; |
|
503 | + } |
|
504 | + |
|
505 | + /** |
|
506 | + * Creates a new answer |
|
507 | + * |
|
508 | + * @author Olivier Brouckaert |
|
509 | + * @param string $answer answer title |
|
510 | + * @param integer $correct 0 if bad answer, not 0 if good answer |
|
511 | + * @param string $comment answer comment |
|
512 | + * @param integer $weighting answer weighting |
|
513 | + * @param integer $position answer position |
|
514 | + * @param array $new_hotspot_coordinates Coordinates for hotspot exercises (optional) |
|
515 | + * @param integer $new_hotspot_type Type for hotspot exercises (optional) |
|
516 | 516 | * @param string $destination |
517 | - */ |
|
517 | + */ |
|
518 | 518 | public function createAnswer( |
519 | 519 | $answer, |
520 | 520 | $correct, |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | $new_hotspot_type = null, |
526 | 526 | $destination = '' |
527 | 527 | ) { |
528 | - $this->new_nbrAnswers++; |
|
528 | + $this->new_nbrAnswers++; |
|
529 | 529 | $id = $this->new_nbrAnswers; |
530 | 530 | $this->new_answer[$id] = $answer; |
531 | 531 | $this->new_correct[$id] = $correct; |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | $this->new_hotspot_coordinates[$id] = $new_hotspot_coordinates; |
536 | 536 | $this->new_hotspot_type[$id] = $new_hotspot_type; |
537 | 537 | $this->new_destination[$id] = $destination; |
538 | - } |
|
538 | + } |
|
539 | 539 | |
540 | 540 | /** |
541 | 541 | * Updates an answer |
@@ -577,31 +577,31 @@ discard block |
||
577 | 577 | ]; |
578 | 578 | |
579 | 579 | Database::update($answerTable, $params, ['id_auto = ?' => $autoId]); |
580 | - } |
|
580 | + } |
|
581 | 581 | |
582 | - /** |
|
583 | - * Records answers into the data base |
|
584 | - * |
|
585 | - * @author Olivier Brouckaert |
|
586 | - */ |
|
582 | + /** |
|
583 | + * Records answers into the data base |
|
584 | + * |
|
585 | + * @author Olivier Brouckaert |
|
586 | + */ |
|
587 | 587 | public function save() |
588 | 588 | { |
589 | - $answerTable = Database::get_course_table(TABLE_QUIZ_ANSWER); |
|
590 | - $questionId = intval($this->questionId); |
|
589 | + $answerTable = Database::get_course_table(TABLE_QUIZ_ANSWER); |
|
590 | + $questionId = intval($this->questionId); |
|
591 | 591 | |
592 | - $c_id = $this->course['real_id']; |
|
592 | + $c_id = $this->course['real_id']; |
|
593 | 593 | $correctList = []; |
594 | 594 | $answerList = []; |
595 | 595 | |
596 | - for ($i=1; $i <= $this->new_nbrAnswers; $i++) { |
|
597 | - $answer = $this->new_answer[$i]; |
|
598 | - $correct = $this->new_correct[$i]; |
|
599 | - $comment = $this->new_comment[$i]; |
|
600 | - $weighting = $this->new_weighting[$i]; |
|
601 | - $position = $this->new_position[$i]; |
|
602 | - $hotspot_coordinates = $this->new_hotspot_coordinates[$i]; |
|
603 | - $hotspot_type = $this->new_hotspot_type[$i]; |
|
604 | - $destination = $this->new_destination[$i]; |
|
596 | + for ($i=1; $i <= $this->new_nbrAnswers; $i++) { |
|
597 | + $answer = $this->new_answer[$i]; |
|
598 | + $correct = $this->new_correct[$i]; |
|
599 | + $comment = $this->new_comment[$i]; |
|
600 | + $weighting = $this->new_weighting[$i]; |
|
601 | + $position = $this->new_position[$i]; |
|
602 | + $hotspot_coordinates = $this->new_hotspot_coordinates[$i]; |
|
603 | + $hotspot_type = $this->new_hotspot_type[$i]; |
|
604 | + $destination = $this->new_destination[$i]; |
|
605 | 605 | $autoId = $this->selectAutoId($i); |
606 | 606 | |
607 | 607 | if (!isset($this->position[$i])) { |
@@ -698,36 +698,36 @@ discard block |
||
698 | 698 | } |
699 | 699 | } |
700 | 700 | |
701 | - // moves $new_* arrays |
|
702 | - $this->answer = $this->new_answer; |
|
703 | - $this->correct = $this->new_correct; |
|
704 | - $this->comment = $this->new_comment; |
|
705 | - $this->weighting = $this->new_weighting; |
|
706 | - $this->position = $this->new_position; |
|
707 | - $this->hotspot_coordinates = $this->new_hotspot_coordinates; |
|
708 | - $this->hotspot_type = $this->new_hotspot_type; |
|
709 | - |
|
710 | - $this->nbrAnswers = $this->new_nbrAnswers; |
|
711 | - $this->destination = $this->new_destination; |
|
712 | - // clears $new_* arrays |
|
713 | - |
|
714 | - $this->cancel(); |
|
715 | - } |
|
716 | - |
|
717 | - /** |
|
718 | - * Duplicates answers by copying them into another question |
|
719 | - * |
|
720 | - * @author Olivier Brouckaert |
|
721 | - * @param int question id |
|
701 | + // moves $new_* arrays |
|
702 | + $this->answer = $this->new_answer; |
|
703 | + $this->correct = $this->new_correct; |
|
704 | + $this->comment = $this->new_comment; |
|
705 | + $this->weighting = $this->new_weighting; |
|
706 | + $this->position = $this->new_position; |
|
707 | + $this->hotspot_coordinates = $this->new_hotspot_coordinates; |
|
708 | + $this->hotspot_type = $this->new_hotspot_type; |
|
709 | + |
|
710 | + $this->nbrAnswers = $this->new_nbrAnswers; |
|
711 | + $this->destination = $this->new_destination; |
|
712 | + // clears $new_* arrays |
|
713 | + |
|
714 | + $this->cancel(); |
|
715 | + } |
|
716 | + |
|
717 | + /** |
|
718 | + * Duplicates answers by copying them into another question |
|
719 | + * |
|
720 | + * @author Olivier Brouckaert |
|
721 | + * @param int question id |
|
722 | 722 | * @param array destination course info (result of the function api_get_course_info() ) |
723 | - */ |
|
723 | + */ |
|
724 | 724 | public function duplicate($newQuestionId, $course_info = null) |
725 | 725 | { |
726 | 726 | if (empty($course_info)) { |
727 | 727 | $course_info = $this->course; |
728 | 728 | } |
729 | 729 | |
730 | - $TBL_REPONSES = Database :: get_course_table(TABLE_QUIZ_ANSWER); |
|
730 | + $TBL_REPONSES = Database :: get_course_table(TABLE_QUIZ_ANSWER); |
|
731 | 731 | $fixed_list = array(); |
732 | 732 | |
733 | 733 | if (self::getQuestionType() == MULTIPLE_ANSWER_TRUE_FALSE || |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | |
742 | 742 | if (!empty($origin_options)) { |
743 | 743 | foreach ($origin_options as $item) { |
744 | - $new_option_list[] = $item['id']; |
|
744 | + $new_option_list[] = $item['id']; |
|
745 | 745 | } |
746 | 746 | } |
747 | 747 | |
@@ -755,12 +755,12 @@ discard block |
||
755 | 755 | } |
756 | 756 | } |
757 | 757 | |
758 | - // if at least one answer |
|
759 | - if ($this->nbrAnswers) { |
|
760 | - // inserts new answers into data base |
|
761 | - $c_id = $course_info['real_id']; |
|
758 | + // if at least one answer |
|
759 | + if ($this->nbrAnswers) { |
|
760 | + // inserts new answers into data base |
|
761 | + $c_id = $course_info['real_id']; |
|
762 | 762 | |
763 | - for ($i=1;$i <= $this->nbrAnswers;$i++) { |
|
763 | + for ($i=1;$i <= $this->nbrAnswers;$i++) { |
|
764 | 764 | if ($this->course['id'] != $course_info['id']) { |
765 | 765 | $this->answer[$i] = DocumentManager::replace_urls_inside_content_html_from_copy_course( |
766 | 766 | $this->answer[$i], |
@@ -774,8 +774,8 @@ discard block |
||
774 | 774 | ); |
775 | 775 | } |
776 | 776 | |
777 | - $answer = $this->answer[$i]; |
|
778 | - $correct = $this->correct[$i]; |
|
777 | + $answer = $this->answer[$i]; |
|
778 | + $correct = $this->correct[$i]; |
|
779 | 779 | |
780 | 780 | if (self::getQuestionType() == MULTIPLE_ANSWER_TRUE_FALSE || |
781 | 781 | self::getQuestionType() == MULTIPLE_ANSWER_TRUE_FALSE |
@@ -783,12 +783,12 @@ discard block |
||
783 | 783 | $correct = $fixed_list[intval($correct)]; |
784 | 784 | } |
785 | 785 | |
786 | - $comment = $this->comment[$i]; |
|
787 | - $weighting = $this->weighting[$i]; |
|
788 | - $position = $this->position[$i]; |
|
789 | - $hotspot_coordinates = $this->hotspot_coordinates[$i]; |
|
790 | - $hotspot_type = $this->hotspot_type[$i]; |
|
791 | - $destination = $this->destination[$i]; |
|
786 | + $comment = $this->comment[$i]; |
|
787 | + $weighting = $this->weighting[$i]; |
|
788 | + $position = $this->position[$i]; |
|
789 | + $hotspot_coordinates = $this->hotspot_coordinates[$i]; |
|
790 | + $hotspot_type = $this->hotspot_type[$i]; |
|
791 | + $destination = $this->destination[$i]; |
|
792 | 792 | |
793 | 793 | $params = [ |
794 | 794 | 'c_id' => $c_id, |
@@ -808,9 +808,9 @@ discard block |
||
808 | 808 | $sql = "UPDATE $TBL_REPONSES SET id = iid, id_auto = iid WHERE iid = $id"; |
809 | 809 | Database::query($sql); |
810 | 810 | } |
811 | - } |
|
811 | + } |
|
812 | 812 | } |
813 | - } |
|
813 | + } |
|
814 | 814 | |
815 | 815 | /** |
816 | 816 | * Get the necessary JavaScript for some answers |
@@ -729,43 +729,43 @@ discard block |
||
729 | 729 | } |
730 | 730 | |
731 | 731 | /** |
732 | - * Return an array of student state answers for fill the blank questions |
|
733 | - * for each students that answered the question |
|
734 | - * -2 : didn't answer |
|
735 | - * -1 : student answer is wrong |
|
736 | - * 0 : student answer is correct |
|
737 | - * >0 : for fill the blank question with choice menu, is the index of the student answer (right answer indice is 0) |
|
738 | - * |
|
739 | - * @param $testId |
|
740 | - * @param $questionId |
|
741 | - * @param $studentsIdList |
|
742 | - * @param $startDate |
|
743 | - * @param $endDate |
|
744 | - * @param bool $useLastAnswerredAttempt |
|
745 | - * @return array |
|
746 | - * ( |
|
747 | - * [student_id] => Array |
|
748 | - * ( |
|
749 | - * [first fill the blank for question] => -1 |
|
750 | - * [second fill the blank for question] => 2 |
|
751 | - * [third fill the blank for question] => -1 |
|
752 | - * ) |
|
753 | - * ) |
|
754 | - */ |
|
732 | + * Return an array of student state answers for fill the blank questions |
|
733 | + * for each students that answered the question |
|
734 | + * -2 : didn't answer |
|
735 | + * -1 : student answer is wrong |
|
736 | + * 0 : student answer is correct |
|
737 | + * >0 : for fill the blank question with choice menu, is the index of the student answer (right answer indice is 0) |
|
738 | + * |
|
739 | + * @param $testId |
|
740 | + * @param $questionId |
|
741 | + * @param $studentsIdList |
|
742 | + * @param $startDate |
|
743 | + * @param $endDate |
|
744 | + * @param bool $useLastAnswerredAttempt |
|
745 | + * @return array |
|
746 | + * ( |
|
747 | + * [student_id] => Array |
|
748 | + * ( |
|
749 | + * [first fill the blank for question] => -1 |
|
750 | + * [second fill the blank for question] => 2 |
|
751 | + * [third fill the blank for question] => -1 |
|
752 | + * ) |
|
753 | + * ) |
|
754 | + */ |
|
755 | 755 | public static function getFillTheBlankTabResult($testId, $questionId, $studentsIdList, $startDate, $endDate, $useLastAnswerredAttempt = true) { |
756 | 756 | |
757 | - $tblTrackEAttempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); |
|
758 | - $tblTrackEExercise = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
759 | - $courseId = api_get_course_int_id(); |
|
757 | + $tblTrackEAttempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); |
|
758 | + $tblTrackEExercise = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); |
|
759 | + $courseId = api_get_course_int_id(); |
|
760 | 760 | |
761 | - require_once api_get_path(SYS_PATH).'main/exercice/fill_blanks.class.php'; |
|
761 | + require_once api_get_path(SYS_PATH).'main/exercice/fill_blanks.class.php'; |
|
762 | 762 | |
763 | - // request to have all the answers of student for this question |
|
764 | - // student may have doing it several time |
|
765 | - // student may have not answered the bracket id, in this case, is result of the answer is empty |
|
763 | + // request to have all the answers of student for this question |
|
764 | + // student may have doing it several time |
|
765 | + // student may have not answered the bracket id, in this case, is result of the answer is empty |
|
766 | 766 | |
767 | - // we got the less recent attempt first |
|
768 | - $sql = ' |
|
767 | + // we got the less recent attempt first |
|
768 | + $sql = ' |
|
769 | 769 | SELECT * FROM '.$tblTrackEAttempt.' tea |
770 | 770 | |
771 | 771 | LEFT JOIN '.$tblTrackEExercise.' tee |
@@ -781,49 +781,49 @@ discard block |
||
781 | 781 | ORDER BY user_id, tea.exe_id; |
782 | 782 | '; |
783 | 783 | |
784 | - $res = Database::query($sql); |
|
785 | - $tabUserResult = array(); |
|
786 | - $bracketNumber = 0; |
|
787 | - // foreach attempts for all students starting with his older attempt |
|
788 | - while ($data = Database::fetch_array($res)) { |
|
789 | - $tabAnswer = FillBlanks::getAnswerInfo($data['answer'], true); |
|
784 | + $res = Database::query($sql); |
|
785 | + $tabUserResult = array(); |
|
786 | + $bracketNumber = 0; |
|
787 | + // foreach attempts for all students starting with his older attempt |
|
788 | + while ($data = Database::fetch_array($res)) { |
|
789 | + $tabAnswer = FillBlanks::getAnswerInfo($data['answer'], true); |
|
790 | 790 | |
791 | - // for each bracket to find in this question |
|
792 | - foreach ($tabAnswer['studentanswer'] as $bracketNumber => $studentAnswer) { |
|
791 | + // for each bracket to find in this question |
|
792 | + foreach ($tabAnswer['studentanswer'] as $bracketNumber => $studentAnswer) { |
|
793 | 793 | |
794 | - if ($tabAnswer['studentanswer'][$bracketNumber] != '') { |
|
795 | - // student has answered this bracket, cool |
|
796 | - switch (FillBlanks::getFillTheBlankAnswerType($tabAnswer['tabwords'][$bracketNumber])) { |
|
797 | - case self::FILL_THE_BLANK_MENU : |
|
794 | + if ($tabAnswer['studentanswer'][$bracketNumber] != '') { |
|
795 | + // student has answered this bracket, cool |
|
796 | + switch (FillBlanks::getFillTheBlankAnswerType($tabAnswer['tabwords'][$bracketNumber])) { |
|
797 | + case self::FILL_THE_BLANK_MENU : |
|
798 | 798 | // get the indice of the choosen answer in the menu |
799 | 799 | // we know that the right answer is the first entry of the menu, ie 0 |
800 | 800 | // (remember, menu entries are shuffled when taking the test) |
801 | 801 | $tabUserResult[$data['user_id']][$bracketNumber] = FillBlanks::getFillTheBlankMenuAnswerNum($tabAnswer['tabwords'][$bracketNumber], $tabAnswer['studentanswer'][$bracketNumber]); |
802 | - break; |
|
803 | - default : |
|
802 | + break; |
|
803 | + default : |
|
804 | 804 | if (FillBlanks::isGoodStudentAnswer($tabAnswer['studentanswer'][$bracketNumber], $tabAnswer['tabwords'][$bracketNumber])) { |
805 | - $tabUserResult[$data['user_id']][$bracketNumber] = 0; // right answer |
|
806 | - } else { |
|
807 | - $tabUserResult[$data['user_id']][$bracketNumber] = -1; // wrong answer |
|
808 | - } |
|
809 | - } |
|
810 | - } else { |
|
811 | - // student didn't answer this bracket |
|
812 | - if ($useLastAnswerredAttempt) { |
|
813 | - // if we take into account the last answered attempt |
|
814 | - if (!isset($tabUserResult[$data['user_id']][$bracketNumber])) { |
|
815 | - $tabUserResult[$data['user_id']][$bracketNumber] = -2; // not answered |
|
816 | - } |
|
817 | - } else { |
|
818 | - // we take the last attempt, even if the student answer the question before |
|
819 | - $tabUserResult[$data['user_id']][$bracketNumber] = -2; // not answered |
|
820 | - } |
|
821 | - } |
|
822 | - } |
|
823 | - |
|
824 | - |
|
825 | - } |
|
826 | - return $tabUserResult; |
|
805 | + $tabUserResult[$data['user_id']][$bracketNumber] = 0; // right answer |
|
806 | + } else { |
|
807 | + $tabUserResult[$data['user_id']][$bracketNumber] = -1; // wrong answer |
|
808 | + } |
|
809 | + } |
|
810 | + } else { |
|
811 | + // student didn't answer this bracket |
|
812 | + if ($useLastAnswerredAttempt) { |
|
813 | + // if we take into account the last answered attempt |
|
814 | + if (!isset($tabUserResult[$data['user_id']][$bracketNumber])) { |
|
815 | + $tabUserResult[$data['user_id']][$bracketNumber] = -2; // not answered |
|
816 | + } |
|
817 | + } else { |
|
818 | + // we take the last attempt, even if the student answer the question before |
|
819 | + $tabUserResult[$data['user_id']][$bracketNumber] = -2; // not answered |
|
820 | + } |
|
821 | + } |
|
822 | + } |
|
823 | + |
|
824 | + |
|
825 | + } |
|
826 | + return $tabUserResult; |
|
827 | 827 | } |
828 | 828 | |
829 | 829 |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /* For licensing terms, see /license.txt */ |
3 | 3 | /** |
4 | - * Code for HotPotatoes integration. |
|
5 | - * @package chamilo.exercise |
|
6 | - * @author Istvan Mandak (original author) |
|
7 | - */ |
|
4 | + * Code for HotPotatoes integration. |
|
5 | + * @package chamilo.exercise |
|
6 | + * @author Istvan Mandak (original author) |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | require_once '../inc/global.inc.php'; |
10 | 10 | require_once 'hotpotatoes.lib.php'; |
@@ -28,11 +28,11 @@ discard block |
||
28 | 28 | $course_id = api_get_course_int_id(); |
29 | 29 | |
30 | 30 | if ($answer_type == HOT_SPOT_DELINEATION) { |
31 | - // Query db for answers |
|
32 | - $sql = "SELECT id, answer, hotspot_coordinates, hotspot_type FROM $TBL_ANSWERS |
|
31 | + // Query db for answers |
|
32 | + $sql = "SELECT id, answer, hotspot_coordinates, hotspot_type FROM $TBL_ANSWERS |
|
33 | 33 | WHERE c_id = $course_id AND question_id = ".intval($questionId)." AND hotspot_type <> 'noerror' ORDER BY id"; |
34 | 34 | } else { |
35 | - $sql = "SELECT id, answer, hotspot_coordinates, hotspot_type FROM $TBL_ANSWERS |
|
35 | + $sql = "SELECT id, answer, hotspot_coordinates, hotspot_type FROM $TBL_ANSWERS |
|
36 | 36 | WHERE c_id = $course_id AND question_id = ".intval($questionId)." ORDER BY id"; |
37 | 37 | } |
38 | 38 | $result = Database::query($sql); |
@@ -69,29 +69,29 @@ discard block |
||
69 | 69 | $hotSpot['id'] = $hotspot['id']; |
70 | 70 | $hotSpot['answer'] = $hotspot['answer']; |
71 | 71 | |
72 | - // Square or rectancle |
|
73 | - if ($hotspot['hotspot_type'] == 'square' ) { |
|
72 | + // Square or rectancle |
|
73 | + if ($hotspot['hotspot_type'] == 'square' ) { |
|
74 | 74 | $hotSpot['type'] = 'square'; |
75 | - } |
|
75 | + } |
|
76 | 76 | |
77 | - // Circle or ovale |
|
78 | - if ($hotspot['hotspot_type'] == 'circle') { |
|
77 | + // Circle or ovale |
|
78 | + if ($hotspot['hotspot_type'] == 'circle') { |
|
79 | 79 | $hotSpot['type'] = 'circle'; |
80 | - } |
|
80 | + } |
|
81 | 81 | |
82 | - // Polygon |
|
83 | - if ($hotspot['hotspot_type'] == 'poly') { |
|
82 | + // Polygon |
|
83 | + if ($hotspot['hotspot_type'] == 'poly') { |
|
84 | 84 | $hotSpot['type'] = 'poly'; |
85 | - } |
|
85 | + } |
|
86 | 86 | |
87 | - // Delineation |
|
88 | - if ($hotspot['hotspot_type'] == 'delineation') { |
|
87 | + // Delineation |
|
88 | + if ($hotspot['hotspot_type'] == 'delineation') { |
|
89 | 89 | $hotSpot['type'] = 'delineation'; |
90 | - } |
|
91 | - // oar |
|
92 | - if ($hotspot['hotspot_type'] == 'oar') { |
|
90 | + } |
|
91 | + // oar |
|
92 | + if ($hotspot['hotspot_type'] == 'oar') { |
|
93 | 93 | $hotSpot['type'] = 'delineation'; |
94 | - } |
|
94 | + } |
|
95 | 95 | |
96 | 96 | $hotSpot['coord'] = $hotspot['hotspot_coordinates']; |
97 | 97 |
@@ -223,10 +223,10 @@ |
||
223 | 223 | |
224 | 224 | $counter++; |
225 | 225 | if ($objExercise->type == ONE_PER_PAGE) { |
226 | - $question_title = Display::url($counter.'. '.cut($objQuestionTmp->selectTitle(), 40), $url); |
|
227 | - $question_title = $counter.'. '.cut($objQuestionTmp->selectTitle(), 40); |
|
226 | + $question_title = Display::url($counter.'. '.cut($objQuestionTmp->selectTitle(), 40), $url); |
|
227 | + $question_title = $counter.'. '.cut($objQuestionTmp->selectTitle(), 40); |
|
228 | 228 | } else { |
229 | - $question_title = $counter.'. '.cut($objQuestionTmp->selectTitle(), 40); |
|
229 | + $question_title = $counter.'. '.cut($objQuestionTmp->selectTitle(), 40); |
|
230 | 230 | } |
231 | 231 | //Check if the question doesn't have an answer |
232 | 232 | if (!in_array($questionId, $exercise_result)) { |
@@ -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']; |
@@ -180,19 +180,19 @@ discard block |
||
180 | 180 | Session::erase('exe_id'); |
181 | 181 | } |
182 | 182 | |
183 | - Display::display_footer(); |
|
183 | + Display::display_footer(); |
|
184 | 184 | } else { |
185 | - $lp_mode = isset($_SESSION['lp_mode']) ? $_SESSION['lp_mode'] : null; |
|
186 | - $url = '../newscorm/lp_controller.php?cidReq='.api_get_course_id().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exercise_stat_info['exe_id'].'&fb_type='.$objExercise->feedback_type; |
|
187 | - $href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'"'; |
|
185 | + $lp_mode = isset($_SESSION['lp_mode']) ? $_SESSION['lp_mode'] : null; |
|
186 | + $url = '../newscorm/lp_controller.php?cidReq='.api_get_course_id().'&action=view&lp_id='.$learnpath_id.'&lp_item_id='.$learnpath_item_id.'&exeId='.$exercise_stat_info['exe_id'].'&fb_type='.$objExercise->feedback_type; |
|
187 | + $href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'"'; |
|
188 | 188 | |
189 | 189 | if (api_is_allowed_to_session_edit()) { |
190 | 190 | Session::erase('objExercise'); |
191 | 191 | Session::erase('exe_id'); |
192 | 192 | } |
193 | 193 | |
194 | - // Record the results in the learning path, using the SCORM interface (API) |
|
195 | - echo "<script>window.parent.API.void_save_asset('$total_score', '$max_score', 0, 'completed');</script>"; |
|
194 | + // Record the results in the learning path, using the SCORM interface (API) |
|
195 | + echo "<script>window.parent.API.void_save_asset('$total_score', '$max_score', 0, 'completed');</script>"; |
|
196 | 196 | echo '<script type="text/javascript">'.$href.'</script>'; |
197 | - echo '</body></html>'; |
|
197 | + echo '</body></html>'; |
|
198 | 198 | } |