diff --git a/main/exercice/exercise.class.php b/main/exercice/exercise.class.php index 37d9d2943e..f13965d5f2 100755 --- a/main/exercice/exercise.class.php +++ b/main/exercice/exercise.class.php @@ -1516,7 +1516,7 @@ class Exercise { }); '; //$html .='
'; - $html .=''; + $html .=''; $html .= get_lang('ValidateAnswer').''; $html .='
'; @@ -1793,6 +1793,7 @@ class Exercise { $real_answers = array(); $quiz_question_options = Question::readQuestionOption($questionId); + $organs_at_risk_hit = 0; for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) { $answer = $objAnswerTmp->selectAnswer($answerId); @@ -2272,7 +2273,7 @@ class Exercise { $user_array = substr($user_array,0,-1); } else { if ($studentChoice) { - $newquestionList[]=$questionid; + $newquestionList[]=$questionId; } if ($answerId===1) { @@ -2290,7 +2291,7 @@ class Exercise { break; } // end switch Answertype - global $origin; + global $origin, $debug; if ($show_result) { @@ -2370,7 +2371,7 @@ class Exercise { $excess = $poly_results['s2Only']; //$overlap = round(polygons_overlap($poly_answer,$poly_user)); //this is an area in pixels - if ($dbg_local>0) { error_log(__LINE__.' - Polygons results are '.print_r($poly_results,1),0);} + if ($debug>0) { error_log(__LINE__.' - Polygons results are '.print_r($poly_results,1),0);} if ($overlap < 1) { //shortcut to avoid complicated calculations $final_overlap = 0; @@ -2379,13 +2380,13 @@ class Exercise { } else { // the final overlap is the percentage of the initial polygon that is overlapped by the user's polygon $final_overlap = round(((float)$overlap / (float)$poly_answer_area)*100); - if ($dbg_local>1) { error_log(__LINE__.' - Final overlap is '.$final_overlap,0);} + if ($debug>1) { error_log(__LINE__.' - Final overlap is '.$final_overlap,0);} // the final missing area is the percentage of the initial polygon that is not overlapped by the user's polygon $final_missing = 100 - $final_overlap; - if ($dbg_local>1) { error_log(__LINE__.' - Final missing is '.$final_missing,0);} + if ($debug>1) { error_log(__LINE__.' - Final missing is '.$final_missing,0);} // the final excess area is the percentage of the initial polygon's size that is covered by the user's polygon outside of the initial polygon $final_excess = round((((float)$poly_user_area-(float)$overlap)/(float)$poly_answer_area)*100); - if ($dbg_local>1) { error_log(__LINE__.' - Final excess is '.$final_excess,0);} + if ($debug>1) { error_log(__LINE__.' - Final excess is '.$final_excess,0);} } //checking the destination parameters parsing the "@@" @@ -2426,12 +2427,12 @@ class Exercise { } } elseif($answerId>1) { if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') { - if ($dbg_local>0) { error_log(__LINE__.' - answerId is of type noerror',0);} + if ($debug>0) { error_log(__LINE__.' - answerId is of type noerror',0);} //type no error shouldn't be treated $next = 1; continue; } - if ($dbg_local>0) { error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR',0);} + if ($debug>0) { error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR',0);} //check the intersection between the oar and the user //echo 'user'; print_r($x_user_list); print_r($y_user_list); //echo 'official';print_r($x_list);print_r($y_list); @@ -2451,7 +2452,7 @@ class Exercise { $next = 1; continue; } else { - if ($dbg_local>0) { error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit',0);} + if ($debug>0) { error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit',0);} $organs_at_risk_hit++; //show the feedback $next=0; @@ -2459,15 +2460,14 @@ class Exercise { $answerDestination=$objAnswerTmp->selectDestination($answerId); $destination_items= explode('@@', $answerDestination); - /* $try_hotspot=$destination_items[1]; $lp_hotspot=$destination_items[2]; $select_question_hotspot=$destination_items[3]; - $url_hotspot=$destination_items[4];*/ + $url_hotspot=$destination_items[4]; } } } else { // the first delineation feedback - if ($dbg_local>0) { error_log(__LINE__.' first',0);} + if ($debug>0) { error_log(__LINE__.' first',0);} } @@ -2552,7 +2552,7 @@ class Exercise { $excess = $poly_results['s2Only']; //$overlap = round(polygons_overlap($poly_answer,$poly_user)); //this is an area in pixels - if ($dbg_local>0) { error_log(__LINE__.' - Polygons results are '.print_r($poly_results,1),0);} + if ($debug>0) { error_log(__LINE__.' - Polygons results are '.print_r($poly_results,1),0);} if ($overlap < 1) { //shortcut to avoid complicated calculations $final_overlap = 0; @@ -2561,13 +2561,13 @@ class Exercise { } else { // the final overlap is the percentage of the initial polygon that is overlapped by the user's polygon $final_overlap = round(((float)$overlap / (float)$poly_answer_area)*100); - if ($dbg_local>1) { error_log(__LINE__.' - Final overlap is '.$final_overlap,0);} + if ($debug>1) { error_log(__LINE__.' - Final overlap is '.$final_overlap,0);} // the final missing area is the percentage of the initial polygon that is not overlapped by the user's polygon $final_missing = 100 - $final_overlap; - if ($dbg_local>1) { error_log(__LINE__.' - Final missing is '.$final_missing,0);} + if ($debug>1) { error_log(__LINE__.' - Final missing is '.$final_missing,0);} // the final excess area is the percentage of the initial polygon's size that is covered by the user's polygon outside of the initial polygon $final_excess = round((((float)$poly_user_area-(float)$overlap)/(float)$poly_answer_area)*100); - if ($dbg_local>1) { error_log(__LINE__.' - Final excess is '.$final_excess,0);} + if ($debug>1) { error_log(__LINE__.' - Final excess is '.$final_excess,0);} } //checking the destination parameters parsing the "@@" @@ -2608,12 +2608,12 @@ class Exercise { } } elseif($answerId>1) { if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') { - if ($dbg_local>0) { error_log(__LINE__.' - answerId is of type noerror',0);} + if ($debug>0) { error_log(__LINE__.' - answerId is of type noerror',0);} //type no error shouldn't be treated $next = 1; continue; } - if ($dbg_local>0) { error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR',0);} + if ($debug>0) { error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR',0);} //check the intersection between the oar and the user //echo 'user'; print_r($x_user_list); print_r($y_user_list); //echo 'official';print_r($x_list);print_r($y_list); @@ -2633,7 +2633,7 @@ class Exercise { $next = 1; continue; } else { - if ($dbg_local>0) { error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit',0);} + if ($debug>0) { error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit',0);} $organs_at_risk_hit++; //show the feedback $next=0; @@ -2641,15 +2641,14 @@ class Exercise { $answerDestination=$objAnswerTmp->selectDestination($answerId); $destination_items= explode('@@', $answerDestination); - /* $try_hotspot=$destination_items[1]; $lp_hotspot=$destination_items[2]; $select_question_hotspot=$destination_items[3]; - $url_hotspot=$destination_items[4];*/ + $url_hotspot=$destination_items[4]; } } } else { // the first delineation feedback - if ($dbg_local>0) { error_log(__LINE__.' first',0);} + if ($debug>0) { error_log(__LINE__.' first',0);} } break; case HOT_SPOT_ORDER: @@ -2777,8 +2776,9 @@ class Exercise { $message='

'.get_lang('YourDelineation').'

'; $message.=$table_resume; $message.='
'.get_lang('ResultIs').' '.$result_comment.'
'; - if ($organs_at_risk_hit>0) - $message.='

'.get_lang('OARHit').'

'; + if ($organs_at_risk_hit>0) { + $message.='

'.get_lang('OARHit').'

'; + } $message.='

'.$comment.'

'; echo $message; } else { @@ -2794,7 +2794,7 @@ class Exercise { $questionScore = 0; } exercise_attempt($questionScore, 1, $quesId, $exeId, 0); // we always insert the answer_id 1 = delineation - //we will only save one item + //we will only save one item - @TODO $my_hotspot_answer seems unefined. Find where it should come from exercise_attempt_hotspot($exeId,$quesId,1, $my_hotspot_answer, $exerciseResultCoordinates[$quesId]); } else { if ($final_answer==0) { diff --git a/main/exercice/question.class.php b/main/exercice/question.class.php index e142d7417f..9246948dd2 100755 --- a/main/exercice/question.class.php +++ b/main/exercice/question.class.php @@ -1193,6 +1193,7 @@ abstract class Question // include the class of the type require_once($a_type[0]); // get the picture of the type and the langvar which describes it + $img = $explanation = ''; eval('$img = '.$a_type[1].'::$typePicture;'); eval('$explanation = get_lang('.$a_type[1].'::$explanationLangVar);'); echo '
  • ';