PageRenderTime 44ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/packages/bd_quiz/blocks/bd_quiz/tools/action_quiz.php

https://bitbucket.org/selfeky/xclusivescardwebsite
PHP | 531 lines | 436 code | 88 blank | 7 comment | 83 complexity | 99f36865f7ed81e7f18924bbe666a23f MD5 | raw file
  1. <?php
  2. defined('C5_EXECUTE') or die(_("Access Denied."));
  3. $jq_task = $_REQUEST['ajax_task'];
  4. @ob_start();
  5. $jq_ret_str = '';
  6. switch ($jq_task) {
  7. case 'start': $jq_ret_str = JQ_StartQuiz(); break;
  8. case 'next': $jq_ret_str = JQ_NextQuestion(); break;
  9. case 'finish_stop': $jq_ret_str = JQ_FinishQuiz(); break;
  10. case 'time_up': $jq_ret_str = PQ_TimeUp(); break;
  11. default: break;
  12. }
  13. $debug_str = @ob_get_contents();
  14. @ob_end_clean();
  15. if ($jq_ret_str != "") {
  16. header ('Expires: Fri, 14 Mar 1980 20:53:00 GMT');
  17. header ('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
  18. header ('Cache-Control: no-cache, must-revalidate');
  19. header ('Pragma: no-cache');
  20. header ('Content-Type: text/xml');
  21. echo '<?php xml version="1.0" encoding="UTF-8" standalone="yes"?>';
  22. echo '<response>' . "\n";
  23. echo $jq_ret_str;
  24. echo "\t" . '<debug><![CDATA['.$debug_str.']]></debug>' . "\n";
  25. echo '</response>' . "\n";
  26. } else {
  27. header ('Expires: Fri, 14 Mar 1980 20:53:00 GMT');
  28. header ('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
  29. header ('Cache-Control: no-cache, must-revalidate');
  30. header ('Pragma: no-cache');
  31. header ('Content-Type: text/xml');
  32. echo '<?php xml version="1.0" encoding="UTF-8" standalone="yes"?>';
  33. echo '<response>' . "\n";
  34. echo "\t" . '<task>failed</task>' . "\n";
  35. echo "\t" . '<info>boom</info>' . "\n";
  36. echo "\t" . '<dqerrors><![CDATA['.$debug_str.']]></dqerrors>' . "\n";
  37. echo '</response>' . "\n";
  38. }
  39. die();
  40. function JQ_StartQuiz() {
  41. $u = new User();
  42. $uID = intval( $u->getUserID() );
  43. $db = Loader::db();
  44. $ret_str = '';
  45. $quiz_id = intval($_REQUEST['quiz']);
  46. $unique_report = md5(uniqid(rand(), true));
  47. $quiz = $db->getAll('SELECT * FROM QzQuiz WHERE qzid = ?',array($quiz_id));
  48. if (count($quiz)) {
  49. $quiz = $quiz[0];
  50. } else {
  51. return $ret_str;
  52. }
  53. if ( !$u->isLoggedIn() && !$quiz["qz_guest"]) {
  54. return PQ_Mess(t('To pass this quiz you need to be authorized'));
  55. }
  56. $user_id = $u->isLoggedIn()?$uID:0;
  57. if ($quiz_id) {
  58. $unique_id = md5(uniqid(rand(), true));
  59. if(isset($_COOKIE['pq_quiz'.$quiz_id]) && $_COOKIE['pq_quiz'.$quiz_id]){
  60. $unique_id = $_COOKIE['pq_quiz'.$quiz_id];
  61. }else{
  62. setcookie('pq_quiz'.$quiz_id,$unique_id,time()+3600);
  63. }
  64. $query = "SELECT COUNT(*) FROM QzQuizReport"
  65. ." WHERE quiz_id = ? AND (uniqueid = ? "
  66. .($user_id?" OR user_id = ?":"").")";
  67. $v = array($quiz_id, $unique_id);
  68. if($user_id){
  69. $v = array($quiz_id, $unique_id, $user_id);
  70. }
  71. $attempts_count = $db->getOne($query, $v);
  72. $query = "SELECT COUNT(*) FROM QzQuizReport WHERE passed='1' AND quiz_id = ?"
  73. ." AND (uniqueid = ? "
  74. .($user_id?" OR user_id=?":"").")";
  75. $passed_count = $db->getOne($query, $v);
  76. if($attempts_count >= $quiz["qz_attempts"] && $quiz["qz_attempts"]){
  77. return PQ_Mess(t('You run out of attempts to pass this Quiz'));
  78. }
  79. if($passed_count){
  80. if($quiz["qz_passed_criteria"] == 2){
  81. }else{
  82. return PQ_Mess(t('Thank you, you have already answered the questions. We appreciate your opinion'));
  83. }
  84. }
  85. $v = array($user_id, $quiz_id, $unique_id, time(), $unique_report);
  86. $r = $db->prepare("INSERT INTO QzQuizReport(user_id,quiz_id,uniqueid,start_date,unique_report)"
  87. . " VALUES(?,?,?,?,?)");
  88. $db->execute($r, $v);
  89. $report_id = $db->Insert_ID();
  90. $q_data = $db->getAll("SELECT DISTINCT(q.q_id),q.* FROM QzQuestion as q ,QzQuestQuiz as z "
  91. . "WHERE z.quiz_id = ? AND q.q_id = z.quest_id ORDER BY z.ordering", array($quiz_id));
  92. $quest_ids = array();
  93. if($q_data){
  94. for($i=0;$i<count($q_data);$i++){
  95. $quest_ids[] = $q_data[$i]["q_id"];
  96. }
  97. }
  98. $q_fromcat = $db->getAll("SELECT * FROM QzQuizQfromcat as q "
  99. ." JOIN QzQcat as qc ON q.cat_id = qc.qc_id"
  100. ." WHERE q.quiz_id = ?",array($quiz_id));
  101. if($q_fromcat){
  102. for($i=0;$i<count($q_fromcat);$i++){
  103. $dopq = $q_fromcat[$i];
  104. $query = "SELECT q.* FROM QzQuestion as q ,QzQuestCat as c "
  105. . " WHERE c.cat_id = ? AND q.q_id=c.quest_id "
  106. .(count($quest_ids)?" AND q.q_id NOT IN (".implode(',',$quest_ids).")":"")
  107. . "GROUP BY q.q_id ORDER BY rand() LIMIT ?";
  108. $q_data_cat = $db->getAll($query, array($dopq["cat_id"], intval($dopq["number"])));
  109. if($q_data_cat && count($q_data_cat)){
  110. $q_data = array_merge($q_data,$q_data_cat);
  111. for($j=0;$j<count($q_data_cat);$j++){
  112. if($q_data_cat[$j]["q_id"]){
  113. $quest_ids[] = $q_data_cat[$j]["q_id"];
  114. }
  115. }
  116. }
  117. }
  118. }
  119. $kol_quests = count($q_data);
  120. $quest_num = 0;
  121. if ($kol_quests > 0) {
  122. $numbers = range (0,($kol_quests - 1));
  123. if ($quiz["qz_random"]) {
  124. srand ((float)microtime()*1000000);
  125. shuffle ($numbers);
  126. }
  127. if($quiz["qz_questnumber"] && $quiz["qz_questnumber"] < $kol_quests){
  128. $kol_quests = $quiz["qz_questnumber"];
  129. }
  130. if(count($numbers)){
  131. $quest_num = $numbers[0];
  132. }
  133. $i = 0;
  134. while (list (, $number) = each ($numbers)) {
  135. if($i < $kol_quests){
  136. $db->execute("INSERT INTO QzQuizChain(report_id,question_id,ordering) VALUES(?, ?, ?)",
  137. array($report_id, $q_data[$number]["q_id"], $i));
  138. $i++;
  139. }
  140. }
  141. }else{
  142. return PQ_Mess(t('This Quiz is empty. Please contact the site administrator'));
  143. }
  144. $ret_str .= "\t" . '<task>start</task>' . "\n";
  145. $ret_str .= "\t" . '<stu_quiz_id>'.$report_id.'</stu_quiz_id>' . "\n";
  146. $ret_str .= "\t" . '<user_unique_id>'.$unique_id.'</user_unique_id>' . "\n";
  147. $ret_str .= "\t" . '<quiz_count_quests>'.$kol_quests.'</quiz_count_quests>' . "\n";
  148. $ret_str .= "\t" . '<quiz_quest_num>1</quiz_quest_num>' . "\n";
  149. $ret_str .= JQ_GetQuestData($q_data[$quest_num],$report_id);
  150. } else {
  151. $ret_str = '';
  152. }
  153. return $ret_str;
  154. }
  155. function JQ_FinishQuiz() {
  156. $db = Loader::db();
  157. $u = new User();
  158. $ret_str = '';
  159. $quiz_id = intval( $_REQUEST['quiz'] );
  160. $quiz = $db->getAll('SELECT * FROM QzQuiz WHERE qzid = ?',array($quiz_id));
  161. if (count($quiz)) {
  162. $quiz = $quiz[0];
  163. } else {
  164. return $ret_str;
  165. }
  166. if ( !$u->isLoggedIn() && !$quiz["qz_guest"]) {
  167. return PQ_Mess(t('To pass this quiz you need to be authorized'));
  168. }
  169. if ($quiz_id) {
  170. $report_id = intval( $_REQUEST['stu_quiz_id'] );
  171. if ($report_id) {
  172. $q_beg_time = $db->getOne('SELECT start_date FROM QzQuizReport WHERE id = ?', array($report_id));
  173. $q_time_total = intval(time()) - intval($q_beg_time);
  174. $user_points = $db->getOne("SELECT SUM(points) FROM QzQuizReportQuest "
  175. . " WHERE report_id = ?",array($report_id));
  176. $overal_points = $db->getOne("SELECT SUM(q.q_point) FROM QzQuizChain as c, QzQuestion as q "
  177. . " WHERE q.q_id = c.question_id AND c.report_id = ?", array($report_id));
  178. $perc = 0;
  179. $successfull = 1;
  180. if($overal_points && $quiz["qz_passing"] && $quiz["qz_passed_criteria"]){
  181. $perc = round(($user_points/$overal_points)*100);
  182. if($perc < $quiz["qz_passing"]){
  183. $successfull = 0;
  184. }
  185. }
  186. $finmsg = $successfull?$quiz["qz_passed_mess"]:$quiz["qz_failed_mess"];
  187. $v = array($user_points, $perc, $q_time_total, $successfull, $finmsg, $report_id);
  188. $db->execute("UPDATE QzQuizReport SET finished='1',points=?,percent=?,time_spend=?,"
  189. . " passed=?,result_text=? WHERE id = ?", $v);
  190. $user_points = $db->getOne("SELECT SUM(points) FROM QzQuizReportQuest"
  191. . " WHERE report_id = ?", array($report_id));
  192. $overal_points = $db->getOne("SELECT SUM(q.q_point) FROM QzQuizChain as c, QzQuestion as q"
  193. . " WHERE q.q_id = c.question_id AND c.report_id = ?", array($report_id));
  194. $unique_report = $db->getOne('SELECT unique_report FROM QzQuizReport WHERE id = ?',array($report_id));
  195. $quiz_played = $db->getOne("SELECT COUNT(unique_report) FROM QzQuizReport"
  196. ." WHERE quiz_id = ? AND finished='1'", array($quiz_id));
  197. $avg_points = $db->getOne('SELECT AVG(q.points) FROM QzQuizReport as q JOIN QzQuizReportQuest as qr'
  198. .' ON q.id = qr.report_id WHERE q.quiz_id = ? AND q.finished="1"', array($quiz_id));
  199. // user points
  200. $finmsg = str_replace('{points}',$user_points,$finmsg);
  201. // overall points
  202. $finmsg = str_replace('{total_points}',$overal_points,$finmsg);
  203. // user time
  204. $finmsg = str_replace('{time}',$q_time_total,$finmsg);
  205. // avarage point
  206. $finmsg = str_replace('{avg_points}',sprintf("%.2f",$avg_points),$finmsg);
  207. // quiz played count
  208. $finmsg = str_replace('{played}',$quiz_played,$finmsg);
  209. $ret_str .= "\t" . '<task>results</task>' . "\n";
  210. $ret_str .= "\t" . '<unique_report><![CDATA['.$unique_report.']]></unique_report>' . "\n";
  211. $ret_str .= "\t" . '<finish_msg><![CDATA['.$finmsg.']]></finish_msg>' . "\n";
  212. }
  213. }
  214. return $ret_str;
  215. }
  216. function PQ_TimeUp(){
  217. $msg_html = t("Your time is up");
  218. $ret_str = "\t" . '<task>time_is_up</task>' . "\n";
  219. $ret_str .= "\t" . '<quiz_message_box><![CDATA['.$msg_html.']]></quiz_message_box>' . "\n";
  220. return $ret_str;
  221. }
  222. function PQ_Mess($msg_html) {
  223. $ret_str = "\t" . '<task>showmess</task>' . "\n";
  224. $ret_str .= "\t" . '<quiz_message_box><![CDATA['.$msg_html.']]></quiz_message_box>' . "\n";
  225. return $ret_str;
  226. }
  227. function JQ_NextQuestion() {
  228. $db = Loader::db();
  229. $u = new User();
  230. $ret_str = '';
  231. $quiz_id = intval($_REQUEST['quiz']);
  232. $quiz = $db->getAll('SELECT * FROM QzQuiz WHERE qzid = ?',array($quiz_id));
  233. if (count($quiz)) {
  234. $quiz = $quiz[0];
  235. } else {
  236. return $ret_str;
  237. }
  238. if ( !$u->isLoggedIn() && !$quiz["qz_guest"]) {
  239. return PQ_Mess(t('To pass this quiz you need to be authorized'));
  240. }
  241. $report_id = intval( $_REQUEST['stu_quiz_id'] );
  242. $quest_id = intval( $_REQUEST['quest_id'] );
  243. $answer = strval( $_REQUEST['answer'] );
  244. $user_unique_id = strval( $_REQUEST['user_unique_id'] );
  245. $backquest = intval( $_REQUEST['backquest'] );
  246. if (($quiz_id) && ($report_id) && ($quest_id)) {
  247. if ($quiz["qz_time_limit"] && $quiz["qz_ticktack"]) {
  248. $quiz_time1 = time();
  249. $qtime = $db->getOne("SELECT start_date FROM QzQuizReport WHERE id = ?",array($report_id));
  250. $user_time = $quiz_time1 - $qtime;
  251. if ($user_time > ($quiz["qz_time_limit"])) {
  252. return PQ_TimeUp();
  253. }
  254. }
  255. $question = $db->getAll('SELECT q.* FROM QzQuestion as q WHERE q.q_id = ?',array($quest_id));
  256. if (count($question)) {
  257. $question = $question[0];
  258. } else {
  259. return $ret_str;
  260. }
  261. $is_correct = 0;
  262. if(!$backquest){
  263. switch($question["q_type"]){
  264. case '1':
  265. $is_correct = $db->getOne('SELECT c_right FROM QzQuestChoice WHERE c_id = ?'
  266. . ' AND c_question_id = ?',array($answer, $quest_id));
  267. if($question["require_answer"] == 0){
  268. $is_correct = 1;
  269. }
  270. break;
  271. case '2':
  272. $correct_answers = $db->getAll('SELECT c_id FROM QzQuestChoice WHERE c_right="1"'
  273. . ' AND c_question_id = ? ',array($quest_id));
  274. $ans_array = explode(',',$answer);
  275. if(count($correct_answers) == count($ans_array)){
  276. $is_correct = 1;
  277. foreach($correct_answers as $answ){
  278. if(!in_array($answ["c_id"],$ans_array)){
  279. $is_correct = 0;
  280. }
  281. }
  282. }
  283. if($question["require_answer"] == 0){
  284. $is_correct = 1;
  285. }
  286. break;
  287. case '3':
  288. if($question['qchoice'] == $answer){
  289. $is_correct = 1;
  290. }
  291. break;
  292. case '4':
  293. $is_correct = 1;
  294. $answer = trim(urldecode($answer));
  295. break;
  296. default:
  297. break;
  298. }
  299. $points = 0;
  300. if($is_correct && $question["q_point"]){
  301. $points = $question["q_point"];
  302. }
  303. $v = array($report_id, $quest_id, $answer, $points, $is_correct, $answer, $points);
  304. $query = 'INSERT INTO QzQuizReportQuest (report_id,question_id,answer,points,`c_right`)'
  305. . ' VALUES(?, ?, ?, ?, ?)'
  306. . ' ON DUPLICATE KEY UPDATE answer = ?, points = ?';
  307. if($question["q_type"] == 4){
  308. $v = array($report_id, $quest_id, $answer, $points, $answer, $points);
  309. $query = 'INSERT INTO QzQuizReportQuest (report_id,question_id,answer_text,points)'
  310. .' VALUES(?, ?, ?, ?)'
  311. .' ON DUPLICATE KEY UPDATE answer = ?, points = ?';
  312. }
  313. $db->execute($query, $v);
  314. $quest_num = $db->getOne('SELECT ordering FROM QzQuizChain WHERE report_id = ? AND question_id = ?',
  315. array($report_id, $quest_id));
  316. $next_question_id = $db->getOne('SELECT question_id FROM QzQuizChain WHERE report_id = ?'
  317. .' AND ordering = ?',array($report_id, ($quest_num+1)));
  318. }else{
  319. $quest_num = $db->getOne('SELECT ordering FROM QzQuizChain WHERE report_id = ? AND question_id = ?',
  320. array($report_id, $quest_id));
  321. $next_question_id = $db->getOne('SELECT question_id FROM QzQuizChain WHERE report_id = ?'
  322. .' AND ordering = ?',array($report_id, ($quest_num-1)));
  323. }
  324. if($next_question_id){
  325. $q_data = $db->getAll('SELECT q.* FROM QzQuestion as q WHERE q.q_id = ?', array($next_question_id));
  326. $ret_str .= "\t" . '<task>next</task>' . "\n";
  327. $ret_str .= "\t" . '<quest_feedback_repl_func>'
  328. . '<![CDATA[jq_QuizContinue();]]>'
  329. . '</quest_feedback_repl_func>' . "\n";
  330. $ret_str .= "\t" . '<quiz_quest_num>'
  331. .($backquest?($quest_num-1):($quest_num+1))
  332. . '</quiz_quest_num>' . "\n";
  333. $ret_str .= JQ_GetQuestData($q_data[0], $report_id);
  334. }else{
  335. $ret_str .= "\t" . '<task>finish</task>' . "\n";
  336. $ret_str .= "\t" . '<quest_feedback_repl_func>'
  337. . '<![CDATA[jq_QuizContinueFinish();]]>'
  338. . '</quest_feedback_repl_func>' . "\n";
  339. }
  340. $ret_str .= "\t" . '<quiz_prev_correct>'.$is_correct.'</quiz_prev_correct>' . "\n";
  341. $ret_str .= "\t" . '<stu_quiz_id>'.$report_id.'</stu_quiz_id>' . "\n";
  342. $ret_str .= "\t" . '<user_unique_id>'.$user_unique_id.'</user_unique_id>' . "\n";
  343. }
  344. return $ret_str;
  345. }
  346. function JQ_GetQuestData($q_data,$report_id) {
  347. $db = Loader::db();
  348. $ret_add = '<div class="qdata_div">'.$q_data["qName"].'</div>';
  349. $ret_str = "\t" . '<quest_data><![CDATA['.$ret_add.']]></quest_data>' . "\n";
  350. $ret_str .= "\t" . '<quest_type>'.$q_data["q_type"].'</quest_type>' . "\n";
  351. $ret_str .= "\t" . '<quest_id>'.$q_data["q_id"].'</quest_id>' . "\n";
  352. $ret_str .= "\t" . '<quest_score><![CDATA['.$q_data["q_point"].']]></quest_score>' . "\n";
  353. //--if randomize quest
  354. $qrandom = $db->getOne("SELECT q_random from QzQuestion WHERE q_id = ?",array($q_data["q_id"]));
  355. //answered?
  356. $v = array($report_id, $q_data["q_id"]);
  357. $query = 'SELECT answer FROM QzQuizReportQuest WHERE report_id=? AND question_id=?';
  358. $answ_isset = $db->getOne('SELECT COUNT(*) FROM QzQuizReportQuest WHERE report_id=?'
  359. .' AND question_id=?', $v);
  360. if($q_data["q_type"] == 4){
  361. $query = 'SELECT answer_text FROM QzQuizReportQuest WHERE report_id=? AND question_id=?';
  362. }
  363. $answered = $db->getOne($query, $v);
  364. switch ($q_data["q_type"]) {
  365. case 1:
  366. $query = "SELECT c_id as value, c_choice as text, '0' as c_right FROM QzQuestChoice "
  367. ." WHERE c_question_id = ?";
  368. if ($qrandom){
  369. $query .= "\n ORDER BY rand()";
  370. }else{
  371. $query .= "\n ORDER BY ordering";
  372. }
  373. $choice_data = $db->getAll($query, array($q_data["q_id"]));
  374. $z = 1;
  375. $qhtml = "<table align='left'>" . "\n";
  376. foreach ($choice_data as $qone) {
  377. $qhtml .= "<tr><td><input id='quest_choice_".$z."' name='quest_choice' value='".(isset
  378. ($qone["value"])
  379. ?$qone["value"]:"")."' type='radio' ".((isset($answered) && ($qone["value"] == $answered))
  380. ?"checked":"")." ></td><td align='left' class='quest_pos'><label for='quest_choice_".$z."'>".
  381. stripslashes($qone["text"])."</label></td>" . "\n";
  382. $qhtml .= "</tr>" . "\n";
  383. $z++;
  384. }
  385. $qhtml .= "</table>" . "\n";
  386. $ret_str .= "\t" . '<quest_data_user><![CDATA[<div class="div_answr"><form name=\'quest_form\'>'
  387. . $qhtml . '</form></div>]]></quest_data_user>' . "\n";
  388. break;
  389. case 2:
  390. $query = "SELECT c_id as value, c_choice as text, '0' as c_right FROM QzQuestChoice WHERE "
  391. ." c_question_id = ?";
  392. if ($qrandom){
  393. $query .= "\n ORDER BY rand()";
  394. }else{
  395. $query .= "\n ORDER BY ordering";
  396. }
  397. $choice_data = $db->getAll($query, array($q_data["q_id"]));
  398. $qhtml = "<table align='left'>" . "\n";
  399. if(isset($answered)){
  400. $answered = explode(',',$answered);
  401. }
  402. $z = 1;
  403. foreach ($choice_data as $qone) {
  404. $qhtml .= "<tr><td>
  405. <input id='quest_choice_".$z."' name='quest_choice'
  406. value='".(isset($qone["value"])?$qone["value"]:"")."'
  407. type='checkbox' ".((isset($answered) && in_array($qone["value"],$answered))?"checked":"")." />
  408. </td>
  409. <td align='left' class='quest_pos'>
  410. <label for='quest_choice_".$z."'>".stripslashes($qone["text"])."</label>
  411. </td>" . "\n";
  412. $qhtml .= "</tr>" . "\n";
  413. $z++;
  414. }
  415. $qhtml .= "</table>" . "\n";
  416. $ret_str .= "\t" . '<quest_data_user><![CDATA[<div class="div_answr"><form name=\'quest_form\'>'
  417. . $qhtml . '</form></div>]]></quest_data_user>' . "\n";
  418. break;
  419. case 3:
  420. $qhtml = "<table align='left'>" . "\n";
  421. $qhtml .= "<tr><td><input id='quest_choice_1' name='quest_choice' value='1' type='radio'
  422. ".((isset($answered) && $answered)?"checked":"")."></td>
  423. <td align='left' class='quest_pos'><label for='quest_choice_1'>".t("True")."</label></td>" . "\n";
  424. $qhtml .= "</tr>" . "\n";
  425. $qhtml .= "<tr><td><input id='quest_choice_2' name='quest_choice' value='0' type='radio'
  426. ".(($answ_isset && $answered == 0)?"checked":"")."></td>
  427. <td align='left' class='quest_pos'><label for='quest_choice_2'>".t("False")."</label></td>" . "\n";
  428. $qhtml .= "</tr>" . "\n";
  429. $qhtml .= "</table>" . "\n";
  430. $ret_str .= "\t" . '<quest_data_user><![CDATA[<div class="div_answr"><form name=\'quest_form\'>'
  431. . $qhtml . '</form></div>]]></quest_data_user>' . "\n";
  432. break;
  433. case 4:
  434. $qhtml = '<textarea cols="50" rows="10" name="free_text" id="free_text">'
  435. .((isset($answered) && $answered)?$answered:"") . '</textarea>';
  436. $ret_str .= "\t" . '<quest_data_user><![CDATA[<div class="div_answr"><form name=\'quest_form\'>'
  437. . $qhtml . '</form></div>]]></quest_data_user>' . "\n";
  438. break;
  439. default:
  440. break;
  441. }
  442. return $ret_str;
  443. }