exercise_submit_modal.php 21 KB

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