@@ -51,17 +51,17 @@ |
||
51 | 51 | $result = Database::query($sql); |
52 | 52 | $exercises['-'] = '-'.get_lang('SelectExercise').'-'; |
53 | 53 | while ($row = Database :: fetch_array($result)) { |
54 | - $exercises[$row['id']] = cut($row['title'], EXERCISE_MAX_NAME_SIZE); |
|
54 | + $exercises[$row['id']] = cut($row['title'], EXERCISE_MAX_NAME_SIZE); |
|
55 | 55 | } |
56 | 56 | $form->addElement('select', 'exercise', get_lang('Exercise'), $exercises); |
57 | 57 | |
58 | 58 | // generate default content |
59 | 59 | $form->addElement( |
60 | - 'checkbox', |
|
61 | - 'is_content', |
|
62 | - null, |
|
63 | - get_lang('GenerateDefaultContent'), |
|
64 | - array('checked' => true) |
|
60 | + 'checkbox', |
|
61 | + 'is_content', |
|
62 | + null, |
|
63 | + get_lang('GenerateDefaultContent'), |
|
64 | + array('checked' => true) |
|
65 | 65 | ); |
66 | 66 | |
67 | 67 | // the submit button |
@@ -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); |
@@ -41,13 +41,13 @@ discard block |
||
41 | 41 | $learnpath_id = 0; |
42 | 42 | |
43 | 43 | if (empty($learnpath_id)) { |
44 | - $learnpath_id = Security::remove_XSS($_REQUEST['learnpath_id']); |
|
44 | + $learnpath_id = Security::remove_XSS($_REQUEST['learnpath_id']); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | $learnpath_item_id = 0; |
48 | 48 | |
49 | 49 | if (empty($learnpath_item_id)) { |
50 | - $learnpath_item_id = Security::remove_XSS($_REQUEST['learnpath_item_id']); |
|
50 | + $learnpath_item_id = Security::remove_XSS($_REQUEST['learnpath_item_id']); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | $_SESSION['hotspot_coord']=array(); |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | $coords = explode('/', $_GET['hotspot']); |
69 | 69 | $user_array = ''; |
70 | 70 | if (is_array($coords) && count($coords) > 0) { |
71 | - foreach ($coords as $coord) { |
|
71 | + foreach ($coords as $coord) { |
|
72 | 72 | if (!empty($coord)) { |
73 | 73 | list($x, $y) = explode(';', $coord); |
74 | 74 | $user_array .= round($x).';'.round($y).'/'; |
75 | 75 | } |
76 | - } |
|
76 | + } |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | $choice_value = ''; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | // Getting the options by js |
88 | 88 | if (empty($choice_value)) { |
89 | 89 | |
90 | - echo "<script> |
|
90 | + echo "<script> |
|
91 | 91 | // this works for only radio buttons |
92 | 92 | var f = self.parent.window.document.frm_exercise; |
93 | 93 | var choice_js=''; |
@@ -116,12 +116,12 @@ discard block |
||
116 | 116 | } |
117 | 117 | |
118 | 118 | "; |
119 | - // IMPORTANT |
|
120 | - //this is the real redirect function |
|
121 | - //echo 'window.location.href = "exercise_submit_modal.php?learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&hotspotcoord="+ hotspotcoord + "&hotspot="+ hotspot + "&choice="+ choice_js + "&exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'&gradebook='.$gradebook.'";'; |
|
119 | + // IMPORTANT |
|
120 | + //this is the real redirect function |
|
121 | + //echo 'window.location.href = "exercise_submit_modal.php?learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&hotspotcoord="+ hotspotcoord + "&hotspot="+ hotspot + "&choice="+ choice_js + "&exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'&gradebook='.$gradebook.'";'; |
|
122 | 122 | echo ' url = "exercise_submit_modal.php?learnpath_id='.$learnpath_id.'&learnpath_item_id='.$learnpath_item_id.'&hotspotcoord="+ hotspotcoord + "&hotspot="+ hotspot + "&choice="+ choice_js + "&exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'&gradebook='.$gradebook.'";'; |
123 | 123 | echo "$('#global-modal .modal-body').load(url);"; |
124 | - echo '</script>'; |
|
124 | + echo '</script>'; |
|
125 | 125 | |
126 | 126 | exit; |
127 | 127 | } |
@@ -174,12 +174,12 @@ discard block |
||
174 | 174 | |
175 | 175 | // creates a temporary Question object |
176 | 176 | if (in_array($questionid, $questionList)) { |
177 | - $objQuestionTmp = Question :: read($questionid); |
|
178 | - $questionName =$objQuestionTmp->selectTitle(); |
|
179 | - $questionDescription=$objQuestionTmp->selectDescription(); |
|
180 | - $questionWeighting =$objQuestionTmp->selectWeighting(); |
|
181 | - $answerType =$objQuestionTmp->selectType(); |
|
182 | - $quesId =$objQuestionTmp->selectId(); //added by priya saini |
|
177 | + $objQuestionTmp = Question :: read($questionid); |
|
178 | + $questionName =$objQuestionTmp->selectTitle(); |
|
179 | + $questionDescription=$objQuestionTmp->selectDescription(); |
|
180 | + $questionWeighting =$objQuestionTmp->selectWeighting(); |
|
181 | + $answerType =$objQuestionTmp->selectType(); |
|
182 | + $quesId =$objQuestionTmp->selectId(); //added by priya saini |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | $objAnswerTmp=new Answer($questionid); |
@@ -202,43 +202,43 @@ discard block |
||
202 | 202 | $totalScore = 0; |
203 | 203 | |
204 | 204 | if (!empty($choice_value)) { |
205 | - for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) { |
|
206 | - $answer = $objAnswerTmp->selectAnswer($answerId); |
|
207 | - $answerComment = $objAnswerTmp->selectComment($answerId); |
|
208 | - $answerDestination = $objAnswerTmp->selectDestination($answerId); |
|
209 | - |
|
210 | - $answerCorrect = $objAnswerTmp->isCorrect($answerId); |
|
211 | - $answerWeighting = $objAnswerTmp->selectWeighting($answerId); |
|
212 | - $numAnswer = $objAnswerTmp->selectAutoId($answerId); |
|
213 | - |
|
214 | - //delineation |
|
215 | - $delineation_cord = $objAnswerTmp->selectHotspotCoordinates(1); |
|
216 | - $answer_delineation_destination=$objAnswerTmp->selectDestination(1); |
|
205 | + for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) { |
|
206 | + $answer = $objAnswerTmp->selectAnswer($answerId); |
|
207 | + $answerComment = $objAnswerTmp->selectComment($answerId); |
|
208 | + $answerDestination = $objAnswerTmp->selectDestination($answerId); |
|
209 | + |
|
210 | + $answerCorrect = $objAnswerTmp->isCorrect($answerId); |
|
211 | + $answerWeighting = $objAnswerTmp->selectWeighting($answerId); |
|
212 | + $numAnswer = $objAnswerTmp->selectAutoId($answerId); |
|
213 | + |
|
214 | + //delineation |
|
215 | + $delineation_cord = $objAnswerTmp->selectHotspotCoordinates(1); |
|
216 | + $answer_delineation_destination=$objAnswerTmp->selectDestination(1); |
|
217 | 217 | if ($dbg_local>0) { error_log(__LINE__.' answerId: '.$answerId.'('.$answerType.') - user delineation_cord: '.$delineation_cord.' - $answer_delineation_destination: '.$answer_delineation_destination,0);} |
218 | 218 | |
219 | - switch($answerType) { |
|
220 | - // for unique answer |
|
221 | - case UNIQUE_ANSWER : |
|
222 | - $studentChoice = ($choice_value == $numAnswer)?1:0; |
|
223 | - if ($studentChoice) { |
|
224 | - $questionScore +=$answerWeighting; |
|
225 | - $totalScore +=$answerWeighting; |
|
226 | - $newquestionList[]=$questionid; |
|
227 | - } |
|
228 | - break; |
|
229 | - case HOT_SPOT_DELINEATION : |
|
230 | - $studentChoice=$choice[$answerId]; |
|
231 | - if ($studentChoice) { |
|
232 | - $newquestionList[]=$questionid; |
|
233 | - } |
|
234 | - if ($answerId===1) { |
|
235 | - $questionScore +=$answerWeighting; |
|
236 | - $totalScore +=$answerWeighting; |
|
237 | - $_SESSION['hotspot_coord'][1] =$delineation_cord; |
|
238 | - $_SESSION['hotspot_dest'][1] =$answer_delineation_destination; |
|
239 | - } |
|
240 | - break; |
|
241 | - } |
|
219 | + switch($answerType) { |
|
220 | + // for unique answer |
|
221 | + case UNIQUE_ANSWER : |
|
222 | + $studentChoice = ($choice_value == $numAnswer)?1:0; |
|
223 | + if ($studentChoice) { |
|
224 | + $questionScore +=$answerWeighting; |
|
225 | + $totalScore +=$answerWeighting; |
|
226 | + $newquestionList[]=$questionid; |
|
227 | + } |
|
228 | + break; |
|
229 | + case HOT_SPOT_DELINEATION : |
|
230 | + $studentChoice=$choice[$answerId]; |
|
231 | + if ($studentChoice) { |
|
232 | + $newquestionList[]=$questionid; |
|
233 | + } |
|
234 | + if ($answerId===1) { |
|
235 | + $questionScore +=$answerWeighting; |
|
236 | + $totalScore +=$answerWeighting; |
|
237 | + $_SESSION['hotspot_coord'][1] =$delineation_cord; |
|
238 | + $_SESSION['hotspot_dest'][1] =$answer_delineation_destination; |
|
239 | + } |
|
240 | + break; |
|
241 | + } |
|
242 | 242 | |
243 | 243 | |
244 | 244 | if ($answerType == UNIQUE_ANSWER || $answerType == MULTIPLE_ANSWER) { |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | $lp_hotspot=$destination_items[2]; |
336 | 336 | $select_question_hotspot=$destination_items[3]; |
337 | 337 | $url_hotspot=$destination_items[4]; |
338 | - //echo 'show the feedback'; |
|
338 | + //echo 'show the feedback'; |
|
339 | 339 | } |
340 | 340 | } elseif($answerId>1) { |
341 | 341 | if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') { |
@@ -392,41 +392,41 @@ discard block |
||
392 | 392 | //we send the error |
393 | 393 | } |
394 | 394 | } |
395 | - } |
|
395 | + } |
|
396 | 396 | |
397 | - if ($overlap_color) { |
|
398 | - $overlap_color='green'; |
|
397 | + if ($overlap_color) { |
|
398 | + $overlap_color='green'; |
|
399 | 399 | } else { |
400 | - $overlap_color='red'; |
|
400 | + $overlap_color='red'; |
|
401 | 401 | } |
402 | - if ($missing_color) { |
|
403 | - $missing_color='green'; |
|
402 | + if ($missing_color) { |
|
403 | + $missing_color='green'; |
|
404 | 404 | } else { |
405 | - $missing_color='red'; |
|
405 | + $missing_color='red'; |
|
406 | 406 | } |
407 | - if ($excess_color) { |
|
408 | - $excess_color='green'; |
|
407 | + if ($excess_color) { |
|
408 | + $excess_color='green'; |
|
409 | 409 | } else { |
410 | - $excess_color='red'; |
|
410 | + $excess_color='red'; |
|
411 | 411 | } |
412 | 412 | |
413 | 413 | if (!is_numeric($final_overlap)) { |
414 | - $final_overlap = 0; |
|
414 | + $final_overlap = 0; |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | if (!is_numeric($final_missing)) { |
418 | - $final_missing = 0; |
|
418 | + $final_missing = 0; |
|
419 | 419 | } |
420 | 420 | if (!is_numeric($final_excess)) { |
421 | - $final_excess = 0; |
|
421 | + $final_excess = 0; |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | if ($final_excess>100) { |
425 | - $final_excess = 100; |
|
425 | + $final_excess = 100; |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | |
429 | - $table_resume = '<table class="data_table" > |
|
429 | + $table_resume = '<table class="data_table" > |
|
430 | 430 | <tr class="row_odd" > |
431 | 431 | <td></td> |
432 | 432 | <td ><b>'.get_lang('Requirements').'</b></td> |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | <td><div style="color:'.$missing_color.'">'.(($final_missing < 0)?0:intval($final_missing)).'</div></td> |
452 | 452 | </tr> |
453 | 453 | </table>'; |
454 | - //var_dump($final_overlap, $threadhold1 , $final_missing, $threadhold2 , $final_excess, $threadhold3); |
|
454 | + //var_dump($final_overlap, $threadhold1 , $final_missing, $threadhold2 , $final_excess, $threadhold3); |
|
455 | 455 | } |
456 | 456 | $_SESSION['newquestionList'] = $newquestionList; |
457 | 457 | |
@@ -468,68 +468,68 @@ discard block |
||
468 | 468 | if ($answerType != HOT_SPOT_DELINEATION) { |
469 | 469 | if (!empty($destination)) { |
470 | 470 | $item_list = explode('@@',$destination); |
471 | - //print_R($item_list); |
|
472 | - $try = $item_list[0]; |
|
473 | - $lp = $item_list[1]; |
|
474 | - $destinationid= $item_list[2]; |
|
475 | - $url=$item_list[3]; |
|
471 | + //print_R($item_list); |
|
472 | + $try = $item_list[0]; |
|
473 | + $lp = $item_list[1]; |
|
474 | + $destinationid= $item_list[2]; |
|
475 | + $url=$item_list[3]; |
|
476 | 476 | } |
477 | - $table_resume=''; |
|
477 | + $table_resume=''; |
|
478 | 478 | } else { |
479 | - $try = $try_hotspot; |
|
480 | - $lp = $lp_hotspot; |
|
481 | - $destinationid= $select_question_hotspot; |
|
482 | - $url=$url_hotspot; |
|
483 | - if ($organs_at_risk_hit==0 && $wrong_results==false ) { |
|
484 | - // no error = no oar and no wrong result for delineation |
|
485 | - //show if no error |
|
486 | - //echo 'no error'; |
|
487 | - $comment= $answerComment = $objAnswerTmp->selectComment($nbrAnswers); |
|
488 | - $answerDestination = $objAnswerTmp->selectDestination($nbrAnswers); |
|
489 | - |
|
490 | - //we send the error |
|
491 | - $destination_items= explode('@@', $answerDestination); |
|
492 | - $try=$destination_items[1]; |
|
493 | - $lp=$destination_items[2]; |
|
494 | - $destinationid=$destination_items[3]; |
|
495 | - $url=$destination_items[4]; |
|
496 | - $exerciseResult[$questionid] = 1; |
|
497 | - } else { |
|
498 | - $exerciseResult[$questionid] = 0; |
|
499 | - } |
|
479 | + $try = $try_hotspot; |
|
480 | + $lp = $lp_hotspot; |
|
481 | + $destinationid= $select_question_hotspot; |
|
482 | + $url=$url_hotspot; |
|
483 | + if ($organs_at_risk_hit==0 && $wrong_results==false ) { |
|
484 | + // no error = no oar and no wrong result for delineation |
|
485 | + //show if no error |
|
486 | + //echo 'no error'; |
|
487 | + $comment= $answerComment = $objAnswerTmp->selectComment($nbrAnswers); |
|
488 | + $answerDestination = $objAnswerTmp->selectDestination($nbrAnswers); |
|
489 | + |
|
490 | + //we send the error |
|
491 | + $destination_items= explode('@@', $answerDestination); |
|
492 | + $try=$destination_items[1]; |
|
493 | + $lp=$destination_items[2]; |
|
494 | + $destinationid=$destination_items[3]; |
|
495 | + $url=$destination_items[4]; |
|
496 | + $exerciseResult[$questionid] = 1; |
|
497 | + } else { |
|
498 | + $exerciseResult[$questionid] = 0; |
|
499 | + } |
|
500 | 500 | } |
501 | 501 | |
502 | 502 | // the link to retry the question |
503 | 503 | if (isset($try) && $try==1) { |
504 | - $num_value_array= (array_keys($questionList, $questionid)); |
|
505 | - $links.= Display :: return_icon('reload.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('TryAgain').'</a><br /><br />'; |
|
504 | + $num_value_array= (array_keys($questionList, $questionid)); |
|
505 | + $links.= Display :: return_icon('reload.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('TryAgain').'</a><br /><br />'; |
|
506 | 506 | } |
507 | 507 | |
508 | 508 | // the link to theory (a learning path) |
509 | 509 | if (!empty($lp)) { |
510 | - $lp_url= api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp; |
|
511 | - $list = new LearnpathList(api_get_user_id()); |
|
512 | - $flat_list = $list->get_flat_list(); |
|
513 | - $links.= Display :: return_icon('theory.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$lp_url.'">'.get_lang('SeeTheory').'</a><br />'; |
|
510 | + $lp_url= api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp; |
|
511 | + $list = new LearnpathList(api_get_user_id()); |
|
512 | + $flat_list = $list->get_flat_list(); |
|
513 | + $links.= Display :: return_icon('theory.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$lp_url.'">'.get_lang('SeeTheory').'</a><br />'; |
|
514 | 514 | } |
515 | 515 | $links.='<br />'; |
516 | 516 | |
517 | 517 | // the link to an external website or link |
518 | 518 | if (!empty($url)) { |
519 | - $links.= Display :: return_icon('link.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$url.'">'.get_lang('VisitUrl').'</a><br /><br />'; |
|
519 | + $links.= Display :: return_icon('link.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a target="_blank" href="'.$url.'">'.get_lang('VisitUrl').'</a><br /><br />'; |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | // the link to finish the test |
523 | 523 | if ($destinationid==-1) { |
524 | - $links.= Display :: return_icon('finish.gif', '', array ('style' => 'width:22px; height:22px; padding-left:0px;padding-right:5px;')).'<a onclick="SendEx(-1);" href="#">'.get_lang('EndActivity').'</a><br /><br />'; |
|
524 | + $links.= Display :: return_icon('finish.gif', '', array ('style' => 'width:22px; height:22px; padding-left:0px;padding-right:5px;')).'<a onclick="SendEx(-1);" href="#">'.get_lang('EndActivity').'</a><br /><br />'; |
|
525 | 525 | } else { |
526 | - // the link to other question |
|
527 | - if (in_array($destinationid,$questionList)) { |
|
528 | - $objQuestionTmp = Question :: read($destinationid); |
|
529 | - $questionName=$objQuestionTmp->selectTitle(); |
|
530 | - $num_value_array= (array_keys($questionList, $destinationid)); |
|
531 | - $links.= Display :: return_icon('quiz.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('GoToQuestion').' '.$num_value_array[0].'</a><br /><br />'; |
|
532 | - } |
|
526 | + // the link to other question |
|
527 | + if (in_array($destinationid,$questionList)) { |
|
528 | + $objQuestionTmp = Question :: read($destinationid); |
|
529 | + $questionName=$objQuestionTmp->selectTitle(); |
|
530 | + $num_value_array= (array_keys($questionList, $destinationid)); |
|
531 | + $links.= Display :: return_icon('quiz.gif', '', array ('style' => 'padding-left:0px;padding-right:5px;')).'<a onclick="SendEx('.$num_value_array[0].');" href="#">'.get_lang('GoToQuestion').' '.$num_value_array[0].'</a><br /><br />'; |
|
532 | + } |
|
533 | 533 | } |
534 | 534 | |
535 | 535 | echo '<script> |
@@ -546,43 +546,43 @@ discard block |
||
546 | 546 | </script>'; |
547 | 547 | |
548 | 548 | if ($links!='') { |
549 | - /*echo '<div id="ModalContent" style="padding-bottom:30px;padding-top:10px;padding-left:20px;padding-right:20px;"> |
|
549 | + /*echo '<div id="ModalContent" style="padding-bottom:30px;padding-top:10px;padding-left:20px;padding-right:20px;"> |
|
550 | 550 | <a onclick="self.parent.tb_remove();" href="#" style="float:right; margin-top:-10px;">'.api_ucfirst(get_lang('Close')).'</a>';*/ |
551 | - echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>'; |
|
552 | - |
|
553 | - if ($answerType == HOT_SPOT_DELINEATION) { |
|
554 | - if ($organs_at_risk_hit > 0) { |
|
555 | - //$message='<p>'.get_lang('YourDelineation').'</p>'; |
|
556 | - //$message.=$table_resume; |
|
557 | - $message.='<br />'.get_lang('ResultIs').' <b>'.get_lang('Unacceptable').'</b><br />'; |
|
558 | - //if ($wrong_results) { } |
|
559 | - $message.='<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>'; |
|
560 | - $message.='<p>'.$comment.'</p>'; |
|
561 | - } else { |
|
562 | - $message='<p>'.get_lang('YourDelineation').'</p>'; |
|
563 | - $message.=$table_resume; |
|
564 | - $message.='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />'; |
|
565 | - $message.='<p>'.$comment.'</p>'; |
|
566 | - } |
|
567 | - echo $message; |
|
568 | - } else { |
|
569 | - echo '<p>'.$comment.'</p>'; |
|
570 | - } |
|
571 | - echo '<h3>'.$links.'</h3>'; |
|
572 | - echo '</div>'; |
|
573 | - |
|
574 | - $_SESSION['hot_spot_result']=$message; |
|
575 | - $_SESSION['hotspot_delineation_result'][$exerciseId][$questionid] = array($message, $exerciseResult[$questionid]); |
|
576 | - //reseting the exerciseResult variable |
|
577 | - Session::write('exerciseResult',$exerciseResult); |
|
578 | - |
|
579 | - //save this variables just in case the exercise loads an LP with other exercise |
|
580 | - $_SESSION['objExerciseExtra'.$exerciseId] = $_SESSION['objExercise']; |
|
581 | - $_SESSION['exerciseResultExtra'.$exerciseId] = $_SESSION['exerciseResult']; |
|
582 | - $_SESSION['questionListExtra'.$exerciseId] = $_SESSION['questionList']; |
|
551 | + echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>'; |
|
552 | + |
|
553 | + if ($answerType == HOT_SPOT_DELINEATION) { |
|
554 | + if ($organs_at_risk_hit > 0) { |
|
555 | + //$message='<p>'.get_lang('YourDelineation').'</p>'; |
|
556 | + //$message.=$table_resume; |
|
557 | + $message.='<br />'.get_lang('ResultIs').' <b>'.get_lang('Unacceptable').'</b><br />'; |
|
558 | + //if ($wrong_results) { } |
|
559 | + $message.='<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>'; |
|
560 | + $message.='<p>'.$comment.'</p>'; |
|
561 | + } else { |
|
562 | + $message='<p>'.get_lang('YourDelineation').'</p>'; |
|
563 | + $message.=$table_resume; |
|
564 | + $message.='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />'; |
|
565 | + $message.='<p>'.$comment.'</p>'; |
|
566 | + } |
|
567 | + echo $message; |
|
568 | + } else { |
|
569 | + echo '<p>'.$comment.'</p>'; |
|
570 | + } |
|
571 | + echo '<h3>'.$links.'</h3>'; |
|
572 | + echo '</div>'; |
|
573 | + |
|
574 | + $_SESSION['hot_spot_result']=$message; |
|
575 | + $_SESSION['hotspot_delineation_result'][$exerciseId][$questionid] = array($message, $exerciseResult[$questionid]); |
|
576 | + //reseting the exerciseResult variable |
|
577 | + Session::write('exerciseResult',$exerciseResult); |
|
578 | + |
|
579 | + //save this variables just in case the exercise loads an LP with other exercise |
|
580 | + $_SESSION['objExerciseExtra'.$exerciseId] = $_SESSION['objExercise']; |
|
581 | + $_SESSION['exerciseResultExtra'.$exerciseId] = $_SESSION['exerciseResult']; |
|
582 | + $_SESSION['questionListExtra'.$exerciseId] = $_SESSION['questionList']; |
|
583 | 583 | } else { |
584 | - $questionNum++; |
|
585 | - echo '<script> |
|
584 | + $questionNum++; |
|
585 | + echo '<script> |
|
586 | 586 | self.parent.window.location.href = "exercise_submit.php?exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'"; |
587 | 587 | //self.parent.tb_remove(); |
588 | 588 | </script>'; |
@@ -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 |