exercise_submit_modal.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * @package chamilo.exercise
  5. * @author Julio Montoya <gugli100@gmail.com>
  6. */
  7. /**
  8. * Code
  9. */
  10. use \ChamiloSession as Session;
  11. $language_file = array('exercice');
  12. require_once '../inc/global.inc.php';
  13. api_protect_course_script(false);
  14. require_once api_get_path(LIBRARY_PATH).'geometry.lib.php';
  15. Display::display_reduced_header();
  16. $dbg_local = 0;
  17. require_once 'exercise.class.php';
  18. require_once 'question.class.php';
  19. require_once 'answer.class.php';
  20. require_once 'exercise.lib.php';
  21. if (empty ($exerciseResult)) {
  22. $exerciseResult = $_SESSION['exerciseResult'];
  23. }
  24. if (empty($exerciseResultCoordinates)) {
  25. $exerciseResultCoordinates = $_REQUEST['exerciseResultCoordinates'];
  26. }
  27. if (empty($origin)) {
  28. $origin = Security::remove_XSS($_REQUEST['origin']);
  29. }
  30. // if origin is learnpath
  31. if (empty ($learnpath_id)) {
  32. $learnpath_id = Security::remove_XSS($_REQUEST['learnpath_id']);
  33. }
  34. if (empty ($learnpath_item_id)) {
  35. $learnpath_item_id = Security::remove_XSS($_REQUEST['learnpath_item_id']);
  36. }
  37. $_SESSION['hotspot_coord']=array();
  38. $newquestionList= $_SESSION['newquestionList'];
  39. $questionList = $_SESSION['questionList'];
  40. $exerciseId = intval($_GET['exerciseId']);
  41. $exerciseType = intval($_GET['exerciseType']);
  42. $questionNum = intval($_GET['num']);
  43. $nbrQuestions = intval($_GET['nbrQuestions']);
  44. //clean extra session variables
  45. Session::erase('objExerciseExtra'.$exerciseId);
  46. Session::erase('exerciseResultExtra'.$exerciseId);
  47. Session::erase('questionListExtra'.$exerciseId);
  48. //round-up the coordinates
  49. $coords = explode('/',$_GET['hotspot']);
  50. $user_array = '';
  51. if (is_array($coords) && count($coords)>0){
  52. foreach ($coords as $coord) {
  53. list($x,$y) = explode(';',$coord);
  54. $user_array .= round($x).';'.round($y).'/';
  55. }
  56. }
  57. $user_array = substr($user_array,0,-1);
  58. if (isset($_GET['choice'])){
  59. $choice_value = intval($_GET['choice']);
  60. }
  61. // Getting the options by js
  62. if (empty($choice_value)) {
  63. echo "<script>
  64. // this works for only radio buttons
  65. var f= self.parent.window.document.frm_exercise;
  66. var choice_js='';
  67. var hotspot = new Array();
  68. var hotspotcoord = new Array();
  69. var counter=0;
  70. for( var i = 0; i < f.elements.length; i++ ) {
  71. if (f.elements[i].type=='radio' && f.elements[i].checked) {
  72. //alert( f.elements[i].name);
  73. choice_js = f.elements[i].value;
  74. counter ++;
  75. }
  76. if (f.elements[i].type=='hidden' ) {
  77. name = f.elements[i].name;
  78. if (name.substr(0,7)=='hotspot')
  79. hotspot.push(f.elements[i].value);
  80. if (name.substr(0,20)=='hotspot_coordinates')
  81. hotspotcoord.push(f.elements[i].value);
  82. //hotspot = f.elements[i].value;
  83. }
  84. }
  85. if (counter==0) {
  86. choice_js=-1; // this is an error
  87. }
  88. //alert(choice_js);
  89. ";
  90. // IMPORTANT
  91. //this is the real redirect function
  92. 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.'";</script>';
  93. }
  94. $choice = array();
  95. $questionid= $questionList[$questionNum];
  96. // $choice_value => value of the user selection
  97. $choice[$questionid] = $choice_value;
  98. // initializing
  99. if(!is_array($exerciseResult)) {
  100. $exerciseResult = array();
  101. }
  102. // if the user has answered at least one question
  103. if (is_array($choice)) {
  104. if ($exerciseType == EXERCISE_FEEDBACK_TYPE_DIRECT) {
  105. // $exerciseResult receives the content of the form.
  106. // Each choice of the student is stored into the array $choice
  107. $exerciseResult = $choice;
  108. } else {
  109. // gets the question ID from $choice. It is the key of the array
  110. list($key)=array_keys($choice);
  111. // if the user didn't already answer this question
  112. if(!isset($exerciseResult[$key])) {
  113. // stores the user answer into the array
  114. $exerciseResult[$key]=$choice[$key];
  115. }
  116. }
  117. }
  118. // the script "exercise_result.php" will take the variable $exerciseResult from the session
  119. Session::write('exerciseResult', $exerciseResult);
  120. Session::write('exerciseResultCoordinates', $exerciseResultCoordinates);
  121. /*
  122. // if it is the last question (only for a sequential exercise)
  123. if($questionNum >= $nbrQuestions)
  124. {
  125. if($debug>0){echo str_repeat('&nbsp;',0).'Redirecting to exercise_result.php - Remove debug option to let this happen'."<br />\n";}
  126. // goes to the script that will show the result of the exercise
  127. // header("Location: exercise_result.php?origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id");
  128. // echo 'location result';
  129. }*/
  130. // gets the student choice for this question
  131. //print_r($choice); echo "<br>";
  132. // creates a temporary Question object
  133. if (in_array($questionid, $questionList)) {
  134. $objQuestionTmp = Question :: read($questionid);
  135. $questionName =$objQuestionTmp->selectTitle();
  136. $questionDescription=$objQuestionTmp->selectDescription();
  137. $questionWeighting =$objQuestionTmp->selectWeighting();
  138. $answerType =$objQuestionTmp->selectType();
  139. $quesId =$objQuestionTmp->selectId(); //added by priya saini
  140. }
  141. $objAnswerTmp=new Answer($questionid);
  142. $nbrAnswers=$objAnswerTmp->selectNbrAnswers();
  143. //echo 'answe_type '.$answerType;echo '<br />';
  144. $choice = $exerciseResult[$questionid];
  145. $destination=array();
  146. $comment='';
  147. $next=1;
  148. $_SESSION['hotspot_coord'] = array();
  149. $_SESSION['hotspot_dest'] = array();
  150. $overlap_color = $missing_color = $excess_color=false;
  151. $organs_at_risk_hit = 0;
  152. $wrong_results = false;
  153. $hot_spot_load = false;
  154. if (!empty($choice_value)) {
  155. for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) {
  156. $answer = $objAnswerTmp->selectAnswer($answerId);
  157. $answerComment = $objAnswerTmp->selectComment($answerId);
  158. $answerDestination = $objAnswerTmp->selectDestination($answerId);
  159. $answerCorrect = $objAnswerTmp->isCorrect($answerId);
  160. $answerWeighting = $objAnswerTmp->selectWeighting($answerId);
  161. $numAnswer = $objAnswerTmp->selectAutoId($answerId);
  162. //delineation
  163. $delineation_cord = $objAnswerTmp->selectHotspotCoordinates(1);
  164. $answer_delineation_destination=$objAnswerTmp->selectDestination(1);
  165. if ($dbg_local>0) { error_log(__LINE__.' answerId: '.$answerId.'('.$answerType.') - user delineation_cord: '.$delineation_cord.' - $answer_delineation_destination: '.$answer_delineation_destination,0);}
  166. switch($answerType) {
  167. // for unique answer
  168. case UNIQUE_ANSWER :
  169. $studentChoice = ($choice_value == $numAnswer)?1:0;
  170. if ($studentChoice) {
  171. $questionScore +=$answerWeighting;
  172. $totalScore +=$answerWeighting;
  173. $newquestionList[]=$questionid;
  174. }
  175. break;
  176. case HOT_SPOT_DELINEATION :
  177. $studentChoice=$choice[$answerId];
  178. if ($studentChoice) {
  179. $newquestionList[]=$questionid;
  180. }
  181. if ($answerId===1) {
  182. $questionScore +=$answerWeighting;
  183. $totalScore +=$answerWeighting;
  184. $_SESSION['hotspot_coord'][1] =$delineation_cord;
  185. $_SESSION['hotspot_dest'][1] =$answer_delineation_destination;
  186. }
  187. break;
  188. }
  189. if ($answerType == UNIQUE_ANSWER || $answerType == MULTIPLE_ANSWER) {
  190. //display_unique_or_multiple_answer($answerType, $studentChoice, $answer, $answerComment, $answerCorrect);
  191. //echo $questionScore;
  192. if ($studentChoice) {
  193. $destination = $answerDestination;
  194. $comment = $answerComment;
  195. }
  196. } elseif($answerType == HOT_SPOT_DELINEATION) {
  197. if ($next) {
  198. if ($dbg_local>0) { error_log(__LINE__.' - next',0);}
  199. $hot_spot_load = true; //apparently the script is called twice
  200. $user_answer = $user_array;
  201. $_SESSION['exerciseResultCoordinates'][$questionid]=$user_answer; //needed for exercise_result.php
  202. // we compare only the delineation not the other points
  203. $answer_question = $_SESSION['hotspot_coord'][1];
  204. $answerDestination = $_SESSION['hotspot_dest'][1];
  205. $poly_user = convert_coordinates($user_answer,'/');
  206. $poly_answer = convert_coordinates($answer_question,'|');
  207. $max_coord = poly_get_max($poly_user,$poly_answer);
  208. if (empty($_GET['hotspot'])) { //no user response
  209. $overlap = -2;
  210. } else {
  211. $poly_user_compiled = poly_compile($poly_user,$max_coord);
  212. $poly_answer_compiled = poly_compile($poly_answer,$max_coord);
  213. $poly_results = poly_result($poly_answer_compiled,$poly_user_compiled,$max_coord);
  214. $overlap = $poly_results['both'];
  215. $poly_answer_area = $poly_results['s1'];
  216. $poly_user_area = $poly_results['s2'];
  217. $missing = $poly_results['s1Only'];
  218. $excess = $poly_results['s2Only'];
  219. }
  220. //$overlap = round(polygons_overlap($poly_answer,$poly_user)); //this is an area in pixels
  221. if ($dbg_local>0) { error_log(__LINE__.' - Polygons results are '.print_r($poly_results,1),0);}
  222. if ($overlap < 1) {
  223. //shortcut to avoid complicated calculations
  224. $final_overlap = 0;
  225. $final_missing = 100;
  226. $final_excess = 100;
  227. } else {
  228. // the final overlap is the percentage of the initial polygon that is overlapped by the user's polygon
  229. $final_overlap = round(((float)$overlap / (float)$poly_answer_area)*100);
  230. if ($dbg_local>1) { error_log(__LINE__.' - Final overlap is '.$final_overlap,0);}
  231. // the final missing area is the percentage of the initial polygon that is not overlapped by the user's polygon
  232. $final_missing = 100 - $final_overlap;
  233. if ($dbg_local>1) { error_log(__LINE__.' - Final missing is '.$final_missing,0);}
  234. // 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
  235. $final_excess = round((((float)$poly_user_area-(float)$overlap)/(float)$poly_answer_area)*100);
  236. if ($dbg_local>1) { error_log(__LINE__.' - Final excess is '.$final_excess,0);}
  237. }
  238. $destination_items= explode('@@', $answerDestination);
  239. $threadhold_total = $destination_items[0];
  240. $threadhold_items=explode(';',$threadhold_total);
  241. $threadhold1 = $threadhold_items[0]; // overlap
  242. $threadhold2 = $threadhold_items[1]; // excess
  243. $threadhold3 = $threadhold_items[2]; //missing
  244. // echo $final_overlap.' '.$threadhold1 .' - '. $final_missing.' '. $threadhold2 .' - '. $final_excess.' '. $threadhold3;
  245. // if is delineation
  246. if ($answerId===1) {
  247. //setting colors
  248. if ($final_overlap>=$threadhold1) {
  249. $overlap_color=true; //echo 'a';
  250. }
  251. //echo $excess.'-'.$threadhold2;
  252. if ($final_excess<=$threadhold2) {
  253. $excess_color=true; //echo 'b';
  254. }
  255. //echo '--------'.$missing.'-'.$threadhold3;
  256. if ($final_missing<=$threadhold3) {
  257. $missing_color=true; //echo 'c';
  258. }
  259. // if pass
  260. //if ($final_overlap>=$threadhold1 && $final_missing<=$threadhold2 && $final_excess<=$threadhold3) {
  261. if ($final_overlap>=$threadhold1 && $final_missing<=$threadhold3 && $final_excess<=$threadhold2) {
  262. $next=1; //go to the oars
  263. $result_comment=get_lang('Acceptable');
  264. } else {
  265. $next=1; //Go to the oars. If $next = 0 we will show this message: "One (or more) area at risk has been hit" instead of the table resume with the results
  266. $wrong_results = true;
  267. $result_comment=get_lang('Unacceptable');
  268. $special_comment = $comment=$answerDestination=$objAnswerTmp->selectComment(1);
  269. $answerDestination=$objAnswerTmp->selectDestination(1);
  270. $destination_items= explode('@@', $answerDestination);
  271. $try_hotspot=$destination_items[1];
  272. $lp_hotspot=$destination_items[2];
  273. $select_question_hotspot=$destination_items[3];
  274. $url_hotspot=$destination_items[4];
  275. //echo 'show the feedback';
  276. }
  277. } elseif($answerId>1) {
  278. if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') {
  279. if ($dbg_local>0) { error_log(__LINE__.' - answerId is of type noerror',0);}
  280. //type no error shouldn't be treated
  281. $next = 1;
  282. continue;
  283. }
  284. if ($dbg_local>0) { error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR',0);}
  285. //check the intersection between the oar and the user
  286. //echo 'user'; print_r($x_user_list); print_r($y_user_list);
  287. //echo 'official';print_r($x_list);print_r($y_list);
  288. //$result = get_intersection_data($x_list,$y_list,$x_user_list,$y_user_list);
  289. //$delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId);
  290. $delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId); //getting the oars coordinates
  291. $poly_answer = convert_coordinates($delineation_cord,'|');
  292. $max_coord = poly_get_max($poly_user,$poly_answer); //getting max coordinates
  293. $test = false;
  294. // if ($answerId == 2 ){$test = true;} for test oars
  295. if (empty($_GET['hotspot'])) { //no user response
  296. $overlap = false;
  297. } else {
  298. // poly_compile really works tested with gnuplot
  299. $poly_user_compiled = poly_compile($poly_user,$max_coord,$test);//$poly_user is already set when answerid = 1
  300. $poly_answer_compiled = poly_compile($poly_answer,$max_coord,$test);
  301. $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled,$max_coord);
  302. }
  303. if ($overlap == false) {
  304. //all good, no overlap
  305. $next = 1;
  306. continue;
  307. } else {
  308. if ($dbg_local>0) { error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit',0);}
  309. $organs_at_risk_hit++;
  310. //show the feedback
  311. $next=1;
  312. $comment=$answerDestination=$objAnswerTmp->selectComment($answerId);
  313. $answerDestination=$objAnswerTmp->selectDestination($answerId);
  314. $destination_items= explode('@@', $answerDestination);
  315. $try_hotspot=$destination_items[1];
  316. $lp_hotspot=$destination_items[2];
  317. $select_question_hotspot=$destination_items[3];
  318. $url_hotspot=$destination_items[4];
  319. }
  320. }
  321. } else {
  322. // the first delineation feedback
  323. if ($dbg_local>0) { error_log(__LINE__.' first',0);}
  324. //we send the error
  325. }
  326. }
  327. }
  328. if ($overlap_color) {
  329. $overlap_color='green';
  330. } else {
  331. $overlap_color='red';
  332. }
  333. if ($missing_color) {
  334. $missing_color='green';
  335. } else {
  336. $missing_color='red';
  337. }
  338. if ($excess_color) {
  339. $excess_color='green';
  340. } else {
  341. $excess_color='red';
  342. }
  343. if (!is_numeric($final_overlap)) {
  344. $final_overlap = 0;
  345. }
  346. if (!is_numeric($final_missing)) {
  347. $final_missing = 0;
  348. }
  349. if (!is_numeric($final_excess)) {
  350. $final_excess = 0;
  351. }
  352. if ($final_excess>100) {
  353. $final_excess = 100;
  354. }
  355. $table_resume = '<table class="data_table" >
  356. <tr class="row_odd" >
  357. <td></td>
  358. <td ><b>'.get_lang('Requirements').'</b></td>
  359. <td><b>'.get_lang('YourAnswer').'</b></td>
  360. </tr>
  361. <tr class="row_even">
  362. <td><b>'.get_lang('Overlap').'</b></td>
  363. <td>'.get_lang('Min').' '.$threadhold1.'</td>
  364. <td><div style="color:'.$overlap_color.'">'.(($final_overlap < 0)?0:intval($final_overlap)).'</div></td>
  365. </tr>
  366. <tr>
  367. <td><b>'.get_lang('Excess').'</b></td>
  368. <td>'.get_lang('Max').' '.$threadhold2.'</td>
  369. <td><div style="color:'.$excess_color.'">'.(($final_excess < 0)?0:intval($final_excess)).'</div></td>
  370. </tr>
  371. <tr class="row_even">
  372. <td><b>'.get_lang('Missing').'</b></td>
  373. <td>'.get_lang('Max').' '.$threadhold3.'</td>
  374. <td><div style="color:'.$missing_color.'">'.(($final_missing < 0)?0:intval($final_missing)).'</div></td>
  375. </tr>
  376. </table>';
  377. //var_dump($final_overlap, $threadhold1 , $final_missing, $threadhold2 , $final_excess, $threadhold3);
  378. }
  379. $_SESSION['newquestionList'] = $newquestionList;
  380. $links='';
  381. if ($choice_value == -1) {
  382. if ($answerType != HOT_SPOT_DELINEATION) {
  383. $links .= '<a href="#" onclick="self.parent.tb_remove();">'.get_lang('ChooseAnAnswer').'</a><br />';
  384. }
  385. }
  386. if ($answerType != HOT_SPOT_DELINEATION) {
  387. if (!empty($destination)) {
  388. $item_list = explode('@@',$destination);
  389. //print_R($item_list);
  390. $try = $item_list[0];
  391. $lp = $item_list[1];
  392. $destinationid= $item_list[2];
  393. $url=$item_list[3];
  394. }
  395. $table_resume='';
  396. } else {
  397. $try = $try_hotspot;
  398. $lp = $lp_hotspot;
  399. $destinationid= $select_question_hotspot;
  400. $url=$url_hotspot;
  401. if ($organs_at_risk_hit==0 && $wrong_results==false ) {
  402. // no error = no oar and no wrong result for delineation
  403. //show if no error
  404. //echo 'no error';
  405. $comment= $answerComment = $objAnswerTmp->selectComment($nbrAnswers);
  406. $answerDestination = $objAnswerTmp->selectDestination($nbrAnswers);
  407. //we send the error
  408. $destination_items= explode('@@', $answerDestination);
  409. $try=$destination_items[1];
  410. $lp=$destination_items[2];
  411. $destinationid=$destination_items[3];
  412. $url=$destination_items[4];
  413. $exerciseResult[$questionid] = 1;
  414. } else {
  415. $exerciseResult[$questionid] = 0;
  416. }
  417. }
  418. // the link to retry the question
  419. if ($try==1) {
  420. $num_value_array= (array_keys($questionList, $questionid));
  421. $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 />';
  422. }
  423. // the link to theory (a learning path)
  424. if (!empty($lp)) {
  425. $lp_url= api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp;
  426. require_once('../newscorm/learnpathList.class.php');
  427. $list = new LearnpathList(api_get_user_id());
  428. $flat_list = $list->get_flat_list();
  429. $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 />';
  430. }
  431. $links.='<br />';
  432. // the link to an external website or link
  433. if (!empty($url)) {
  434. $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 />';
  435. }
  436. // the link to finish the test
  437. if ($destinationid==-1) {
  438. $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 />';
  439. } else {
  440. // the link to other question
  441. if (in_array($destinationid,$questionList)) {
  442. $objQuestionTmp = Question :: read($destinationid);
  443. $questionName=$objQuestionTmp->selectTitle();
  444. $num_value_array= (array_keys($questionList, $destinationid));
  445. $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 />';
  446. }
  447. }
  448. echo '<script>
  449. function SendEx(num) {
  450. if (num == -1) {
  451. self.parent.window.location.href = "exercise_result.php?take_session=1&exerciseId='.$exerciseId.'&num="+num+"&exerciseType='.$exerciseType.'&origin='.$origin.'&learnpath_item_id='.$learnpath_item_id.'&learnpath_id='.$learnpath_id.'";
  452. self.parent.tb_remove();
  453. } else {
  454. num -= 1;
  455. self.parent.window.location.href = "exercise_submit.php?tryagain=1&exerciseId='.$exerciseId.'&num="+num+"&exerciseType='.$exerciseType.'&origin='.$origin.'&learnpath_item_id='.$learnpath_item_id.'&learnpath_id='.$learnpath_id.'";
  456. self.parent.tb_remove();
  457. }
  458. }
  459. </script>';
  460. if ($links!='') {
  461. echo '<div id="ModalContent" style="padding-bottom:30px;padding-top:10px;padding-left:20px;padding-right:20px;">
  462. <a onclick="self.parent.tb_remove();" href="#" style="float:right; margin-top:-10px;">'.api_ucfirst(get_lang('Close')).'</a>
  463. <h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>';
  464. if ($answerType == HOT_SPOT_DELINEATION) {
  465. if ($organs_at_risk_hit > 0) {
  466. //$message='<p>'.get_lang('YourDelineation').'</p>';
  467. //$message.=$table_resume;
  468. $message.='<br />'.get_lang('ResultIs').' <b>'.get_lang('Unacceptable').'</b><br />';
  469. //if ($wrong_results) { }
  470. $message.='<p style="color:#DC0A0A;"><b>'.get_lang('OARHit').'</b></p>';
  471. $message.='<p>'.$comment.'</p>';
  472. } else {
  473. $message='<p>'.get_lang('YourDelineation').'</p>';
  474. $message.=$table_resume;
  475. $message.='<br />'.get_lang('ResultIs').' <b>'.$result_comment.'</b><br />';
  476. $message.='<p>'.$comment.'</p>';
  477. }
  478. echo $message;
  479. } else {
  480. echo '<p>'.$comment.'</p>';
  481. }
  482. echo '<h3>'.$links.'</h3>';
  483. echo '</div>';
  484. $_SESSION['hot_spot_result']=$message;
  485. $_SESSION['hotspot_delineation_result'][$exerciseId][$questionid] = array($message, $exerciseResult[$questionid]);
  486. //reseting the exerciseResult variable
  487. Session::write('exerciseResult',$exerciseResult);
  488. //save this variables just in case the exercise loads an LP with other exercise
  489. $_SESSION['objExerciseExtra'.$exerciseId] = $_SESSION['objExercise'];
  490. $_SESSION['exerciseResultExtra'.$exerciseId] = $_SESSION['exerciseResult'];
  491. $_SESSION['questionListExtra'.$exerciseId] = $_SESSION['questionList'];
  492. } else {
  493. $questionNum++;
  494. echo '<script>
  495. self.parent.window.location.href = "exercise_submit.php?exerciseId='.$exerciseId.'&num='.$questionNum.'&exerciseType='.$exerciseType.'&origin='.$origin.'";
  496. //self.parent.tb_remove();
  497. </script>';
  498. }