mcma.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. <?php
  2. /*
  3. DOKEOS - elearning and course management software
  4. For a full list of contributors, see documentation/credits.html
  5. This program is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU General Public License
  7. as published by the Free Software Foundation; either version 2
  8. of the License, or (at your option) any later version.
  9. See "documentation/licence.html" more details.
  10. Contact:
  11. Dokeos
  12. Rue des Palais 44 Paleizenstraat
  13. B-1030 Brussels - Belgium
  14. Tel. +32 (2) 211 34 56
  15. */
  16. /**
  17. * @package dokeos.survey
  18. * @author
  19. * @version $Id: mcma.php 10705 2007-01-12 22:40:01Z pcool $
  20. */
  21. // name of the language file that needs to be included
  22. $language_file = 'survey';
  23. // including the global dokeos file
  24. require_once ('../inc/global.inc.php');
  25. // including additional libraries
  26. /** @todo check if these are all needed */
  27. /** @todo check if the starting / is needed. api_get_path probably ends with an / */
  28. require_once ('select_question.php');
  29. require_once (api_get_path(LIBRARY_PATH).'/fileManage.lib.php');
  30. require_once (api_get_path(CONFIGURATION_PATH) ."/add_course.conf.php");
  31. require_once (api_get_path(LIBRARY_PATH)."/add_course.lib.inc.php");
  32. require_once (api_get_path(LIBRARY_PATH)."/surveymanager.lib.php");
  33. require_once (api_get_path(LIBRARY_PATH)."/usermanager.lib.php");
  34. /** @todo replace this with the correct code */
  35. /*
  36. $status = surveymanager::get_status();
  37. api_protect_course_script();
  38. if($status==5)
  39. {
  40. api_protect_admin_script();
  41. }
  42. */
  43. /** @todo this has to be moved to a more appropriate place (after the display_header of the code)*/
  44. if (!api_is_allowed_to_edit())
  45. {
  46. Display :: display_header();
  47. Display :: display_error_message(get_lang('NotAllowedHere'));
  48. Display :: display_footer();
  49. exit;
  50. }
  51. // Database table definitions
  52. /** @todo use database constants for the survey tables */
  53. $table_survey = Database :: get_course_table(TABLE_SURVEY);
  54. $table_group = Database :: get_course_table(TABLE_SURVEY_GROUP);
  55. $table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION);
  56. $table_languages = Database::get_main_table(TABLE_MAIN_LANGUAGE);
  57. if(isset($_REQUEST['questtype']))
  58. {
  59. $add_question12=$_REQUEST['questtype'];
  60. }
  61. else
  62. {
  63. $add_question12=$_REQUEST['add_question'];
  64. }
  65. $add_question = $_REQUEST['add_question'];
  66. $groupid = $_REQUEST['groupid'];
  67. $surveyid = $_REQUEST['surveyid'];
  68. $interbreadcrumb[] = array ("url" => "survey_list.php?n=$n", "name" => get_lang('Survey'));
  69. //$n=$_REQUEST['n'];
  70. if ($_POST['action'] == 'addquestion')
  71. {
  72. $groupid = $_REQUEST['groupid'];
  73. $surveyid = $_REQUEST['surveyid'];
  74. $questtype = $_REQUEST['questtype'];
  75. $enter_question =$_POST['enterquestion'];
  76. if(isset($_POST['next']))
  77. {
  78. $enter_question=$_POST['enterquestion'];
  79. $answers=$_POST['mutlichkboxtext'];
  80. $rating=$_POST['chkboxpoint'];
  81. $answerT=$_POST['chkboxdefault1'];
  82. $answerD=$_POST['chkboxdefault'];
  83. $alignment=$_POST['alignment'];
  84. $open_ans="";
  85. $count=count($_POST['mutlichkboxtext']);
  86. $default=0;
  87. $true=0;
  88. $noans=0;
  89. $nopoint=0;
  90. for($i=0;$i<$count;$i++)
  91. {
  92. $answers[$i]=trim($answers[$i]);
  93. if(!empty($answerT[$i]))
  94. $true++;
  95. if(!empty($answerD[$i]))
  96. $default++;
  97. if(empty($answers[$i]))
  98. $noans++;
  99. if(!is_numeric($rating[$i]))
  100. $number=1;
  101. }
  102. $enter_question=trim($enter_question);
  103. if(empty($enter_question))
  104. $error_message = get_lang('PleaseEnterAQuestion')."<br>";
  105. if ($noans)
  106. $error_message = $error_message."<br>".get_lang('PleasFillAllAnswer');
  107. //if($number==1)
  108. //$error_message = $error_message."<br>".get_lang('PleaseFillNumber');
  109. //if($nopoint)
  110. //$error_message = $error_message."<br>".get_lang('PleaseFillAllPoints');
  111. //if($true<1)
  112. //$error_message=$error_message."<br>".get_lang('PleaseSelectOneTrue');
  113. //if($default<1)
  114. //$error_message=$error_message."<br>".get_lang('PleaseSelectOneDefault');
  115. if(isset($error_message));
  116. //Display::display_error_message($error_message);
  117. else
  118. {
  119. $groupid = $_REQUEST['groupid'];
  120. $questtype = $_REQUEST['questtype'];
  121. $surveyid = $_REQUEST['surveyid'];
  122. $enter_question = addslashes($enter_question); SurveyManager::create_question($groupid,$surveyid,$questtype,$enter_question,$alignment,$answers,$open_ans,$answerT,$answerD,$rating,$curr_dbname);
  123. header("location:select_question_group.php?groupid=$groupid&surveyid=$surveyid");
  124. exit;
  125. }
  126. }
  127. elseif(isset($_POST['back']))
  128. {
  129. $groupid = $_REQUEST['groupid'];
  130. $surveyid = $_REQUEST['surveyid'];
  131. header("location:addanother.php?groupid=$groupid&surveyid=$surveyid");
  132. exit;
  133. }
  134. elseif(isset($_POST['saveandexit']))
  135. {
  136. $enter_question=$_POST['enterquestion'];
  137. $answers=$_POST['mutlichkboxtext'];
  138. $rating=$_POST['chkboxpoint'];
  139. $answerT=$_POST['chkboxdefault1'];
  140. $answerD=$_POST['chkboxdefault'];
  141. $alignment=$_POST['alignment'];
  142. $open_ans="";
  143. $count=count($_POST['mutlichkboxtext']);
  144. $default=0;
  145. $true=0;
  146. $noans=0;
  147. $nopoint=0;
  148. for($i=0;$i<$count;$i++)
  149. {
  150. $answers[$i]=trim($answers[$i]);
  151. if(!empty($answerT[$i]))
  152. $true++;
  153. if(!empty($answerD[$i]))
  154. $default++;
  155. if(empty($answers[$i]))
  156. $noans++;
  157. if(empty($rating[$i])&&($rating[$i]!='0'))
  158. $nopoint++;
  159. }
  160. $enter_question=trim($enter_question);
  161. if(empty($enter_question))
  162. $error_message = get_lang('PleaseEnterAQuestion')."<br>";
  163. if ($noans)
  164. $error_message = $error_message."<br>".get_lang('PleasFillAllAnswer');
  165. //if($nopoint)
  166. //$error_message = $error_message."<br>".get_lang('PleaseFillAllPoints');
  167. //if($true<1)
  168. //$error_message=$error_message."<br>".get_lang('PleaseSelectOneTrue');
  169. //if($default<1)
  170. //$error_message=$error_message."<br>".get_lang('PleaseSelectOneDefault');
  171. if(isset($error_message));
  172. //Display::display_error_message($error_message);
  173. else
  174. {
  175. $groupid = $_REQUEST['groupid'];
  176. $surveyid = $_REQUEST['surveyid'];
  177. $enter_question = addslashes($enter_question); SurveyManager::create_question($groupid,$surveyid,$questtype,$enter_question,$alignment,$answers,$open_ans,$answerT,$answerD,$rating,$curr_dbname);
  178. header("location:survey_list.php?n=$n");
  179. exit;
  180. }
  181. }
  182. }
  183. ?>
  184. <?php
  185. $tool = get_lang('AddAnotherQuestion');
  186. Display::display_header($tool);
  187. ?>
  188. <script type="text/javascript">
  189. function changeAction()
  190. {
  191. var x=document.getElementById("myForm")
  192. x.action="preview_mcma.php"
  193. return true;
  194. }
  195. </script>
  196. <?php
  197. select_question_type($add_question12,$groupid,$surveyid,$cidReq,$curr_dbname);
  198. ?>
  199. <table>
  200. <tr>
  201. <td>
  202. <?php api_display_tool_title(get_lang('AddNewQuestionType'));?>
  203. </td>
  204. <td>
  205. <?php api_display_tool_title(get_lang('MultipleChoiceMulti'));?>
  206. </td>
  207. </tr>
  208. </table>
  209. <?php
  210. if( isset($error_message) )
  211. {
  212. Display::display_error_message($error_message);
  213. }
  214. ?>
  215. <SCRIPT LANGUAGE="JAVASCRIPT">
  216. function checkLength(form){
  217. if (form.description.value.length > 250){
  218. alert("Text too long. Must be 250 characters or less");
  219. return false;
  220. }
  221. return true;
  222. }
  223. </SCRIPT>
  224. <form method="POST" name ="mcma" id="myForm" action="<?php echo $_SERVER['PHP_SELF'];?>?add_question=<?php echo $add_question; ?>&groupid=<?php echo $groupid; ?>&surveyid=<?php echo $surveyid; ?>&curr_dbname=<?php echo $curr_dbname; ?>">
  225. <input type="hidden" name="groupid" value="<?php echo $groupid; ?>">
  226. <input type="hidden" name="surveyid" value="<?php echo $surveyid; ?>">
  227. <input type="hidden" name="questtype" value="<?php echo $add_question12; ?>">
  228. <input type="hidden" name="action" value="addquestion" >
  229. <table width="100%" border="0" cellspacing="0" cellpadding="0" class="outerBorder_innertable">
  230. <tr><td>
  231. <tr>
  232. <td valign="top"><strong><?php echo get_lang('SelectDisplayType'); ?></strong>&nbsp;</td>
  233. </tr>
  234. <tr><td>
  235. <input type="radio" name="alignment" value="horizontal" checked>Horizontal</td>
  236. </tr>
  237. <tr><td>
  238. <input type="radio" name="alignment" value="vertical">Vertical</td>
  239. </tr>
  240. </td></tr>
  241. <tr><td><br></td></tr>
  242. <tr>
  243. <td class="pagedetails_heading"><a class="form_text_bold"><strong>Question</strong></a></td>
  244. </tr>
  245. </table>
  246. <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="outerBorder_innertable">
  247. <tr class="white_bg">
  248. <td height="30" class="form_text1">
  249. Enter the question.
  250. </td>
  251. <td class="form_text1" align="right">&nbsp;
  252. </td>
  253. </tr>
  254. <tr class="form_bg">
  255. <td width="542" height="30" colspan="2" >
  256. <?php
  257. require_once(api_get_path(LIBRARY_PATH) . "/fckeditor/fckeditor.php");
  258. $oFCKeditor = new FCKeditor('enterquestion') ;
  259. $oFCKeditor->BasePath = api_get_path(WEB_PATH) . 'main/inc/lib/fckeditor/' ;
  260. $oFCKeditor->Height = '300';
  261. $oFCKeditor->Width = '400';
  262. $oFCKeditor->Value = stripslashes($enterquestion);
  263. $oFCKeditor->Config['CustomConfigurationsPath'] = api_get_path(REL_PATH)."main/inc/lib/fckeditor/myconfig.js";
  264. $oFCKeditor->ToolbarSet = "Survey";
  265. $sql="SELECT isocode FROM ".$table_languages." WHERE english_name='".$_SESSION["_course"]["language"]."'";
  266. $result_sql=api_sql_query($sql);
  267. $isocode_language=mysql_result($result_sql,0,0);
  268. $oFCKeditor->Config['DefaultLanguage'] = $isocode_language;
  269. $return = $oFCKeditor->CreateHtml();
  270. echo $return;
  271. ?>
  272. </td>
  273. </tr>
  274. </table>
  275. <br>
  276. <table width="100%" border="0" cellspacing="0" cellpadding="0" class="outerBorder_innertable">
  277. <tr>
  278. <td class="pagedetails_heading"><a class="form_text_bold"><strong>Answer</strong></a></td>
  279. </tr>
  280. </table>
  281. <table width="100%" border="0" cellspacing="0" cellpadding="0" class="outerBorder_innertable">
  282. <tr class="white_bg">
  283. <td height="30"><span class="form_text1">Enter the answers</span>.
  284. </td>
  285. <td>&nbsp;</td>
  286. <td width="192" align="right">&nbsp; </td>
  287. </tr>
  288. </table>
  289. <table ID="tblFields" width="70%" border="0" cellpadding="0" cellspacing="0" class="outerBorder_innertable">
  290. <?php
  291. $start=1;$end=5;$upx=2;$upy=1;$dwnx=0;$dwny=1;$jd=0;$sn=1;
  292. $id="id";
  293. $tempmutlichkboxtext="jkjk";
  294. $tempchkboxdefault="jkjk";
  295. $tempchkboxpoint="jkjk";
  296. $tempchkboxdefault1="jkjk";
  297. $up="up";
  298. $down="down";
  299. $flag=1;
  300. if(isset($_POST['mutlichkboxtext']))
  301. $end=count($_POST['mutlichkboxtext']);
  302. //echo ",before 1st loop end=".$end;
  303. for($i=$start;$i<=$end;$i++)
  304. {
  305. $id="id".$i."_x";
  306. //echo ",".$id;
  307. if(isset($_POST[$id]))
  308. {
  309. $jd=$i;
  310. $flag=0;
  311. $end=count($_POST['mutlichkboxtext']);
  312. if($end<=3)
  313. {
  314. $end=3;
  315. }
  316. else
  317. $end-=1;
  318. break;
  319. //echo ",while checking id,end=".$end;
  320. }
  321. }
  322. for($i=$start;$i<=$end;$i++)
  323. {
  324. $up="up".$i."_x";
  325. $down="down".$i."_x";
  326. if(isset($_POST[$up])||isset($_POST[$down]))
  327. {
  328. //if(isset($_POST['up2_x']))
  329. $flag=0;
  330. if(isset($_POST[$up]))
  331. {
  332. $tempmutlichkboxtext=$_POST['mutlichkboxtext'];
  333. $tempchkboxdefault=$_POST['chkboxdefault'];
  334. $tempchkboxpoint=$_POST['chkboxpoint'];
  335. $tempchkboxdefault1=$_POST['chkboxdefault1'];
  336. $tempm= $tempmutlichkboxtext[$i-2];
  337. $tempchkboxd=$tempchkboxdefault[$i-2];
  338. $tempchkboxp=$tempchkboxpoint[$i-2];
  339. $tempchkboxd1=$tempchkboxdefault1[$i-2];
  340. $tempmutlichkboxtext[$i-2]=$tempmutlichkboxtext[$i-1];
  341. $tempchkboxdefault[$i-2]=$tempchkboxdefault[$i-1];
  342. $tempchkboxpoint[$i-2]=$tempchkboxpoint[$i-1];
  343. $tempchkboxdefault1[$i-2]=$tempchkboxdefault1[$i-1];
  344. $tempmutlichkboxtext[$i-1]=$tempm;
  345. $tempchkboxdefault[$i-1]=$tempchkboxd;
  346. $tempchkboxpoint[$i-1]=$tempchkboxp;
  347. $tempchkboxdefault1[$i-1]=$tempchkboxd1;
  348. $_POST['mutlichkboxtext']=$tempmutlichkboxtext;
  349. $_POST['chkboxdefault']=$tempchkboxdefault;
  350. $_POST['chkboxpoint']=$tempchkboxpoint;
  351. $_POST['chkboxdefault1']=$tempchkboxdefault1;
  352. }
  353. if(isset($_POST[$down]))
  354. {
  355. $tempmutlichkboxtext=$_POST['mutlichkboxtext'];
  356. $tempchkboxdefault=$_POST['chkboxdefault'];
  357. $tempchkboxpoint=$_POST['chkboxpoint'];
  358. $tempchkboxdefault1=$_POST['chkboxdefault1'];
  359. $tempm= $tempmutlichkboxtext[$i];
  360. $tempchkboxd=$tempchkboxdefault[$i];
  361. $tempchkboxp=$tempchkboxpoint[$i];
  362. $tempchkboxd1=$tempchkboxdefault1[$i];
  363. $tempmutlichkboxtext[$i]=$tempmutlichkboxtext[$i-1];
  364. $tempchkboxdefault[$i]=$tempchkboxdefault[$i-1];
  365. $tempchkboxpoint[$i]=$tempchkboxpoint[$i-1];
  366. $tempchkboxdefault1[$i]=$tempchkboxdefault1[$i-1];
  367. $tempmutlichkboxtext[$i-1]=$tempm;
  368. $tempchkboxdefault[$i-1]=$tempchkboxd;
  369. $tempchkboxpoint[$i-1]=$tempchkboxp;
  370. $tempchkboxdefault1[$i-1]=$tempchkboxd1;
  371. $_POST['mutlichkboxtext']=$tempmutlichkboxtext;
  372. $_POST['chkboxdefault']=$tempchkboxdefault;
  373. $_POST['chkboxpoint']=$tempchkboxpoint;
  374. $_POST['chkboxdefault1']=$tempchkboxdefault1;
  375. }
  376. //echo ",while checking up/down end=".$end;
  377. $jd=0;
  378. break;
  379. }
  380. }
  381. if($flag==1)
  382. {
  383. if(isset($_POST['addnewrows']))
  384. {
  385. $end=count($_POST['mutlichkboxtext']);
  386. if($end<10)
  387. {
  388. $end=$end+$_POST['addnewrows'];
  389. if($end>10)
  390. $end=10;
  391. }
  392. else
  393. {
  394. $end=10;
  395. $error_message = get_lang('YouCantAddMoreThanTen')."<br>";
  396. if( isset($error_message) )
  397. {
  398. Display::display_error_message($error_message);
  399. }
  400. }
  401. //echo ",while checking select end=".$end;
  402. /*else
  403. $end=$end+$_POST['addnewrows'];*/
  404. }
  405. }
  406. //echo ",after select end=".$end;
  407. for($i=$start;$i<=$end;$i++)
  408. {
  409. if($i==$jd)
  410. /*{
  411. if($end<=3);
  412. else;
  413. //continue;
  414. }*/
  415. {
  416. $end++;
  417. }
  418. else
  419. {
  420. $k=$i-1;
  421. $post_text = $_POST['mutlichkboxtext'];
  422. $post_check=$_POST['chkboxdefault'];
  423. $post_point=$_POST['chkboxpoint'];
  424. $post_true=$_POST['chkboxdefault1'];
  425. ?>
  426. <tr class="form_bg" id="0">
  427. <td width="16" height="30" align="left" class="form_text">
  428. <?php echo $sn;?>
  429. </td>
  430. <td class="form_bg"><textarea name="mutlichkboxtext[]" cols="50" rows="3" class="text_field" style="width:100%;"><?php echo $post_text[$k]; ?></textarea>
  431. </td>
  432. <td width="10" class="form_text"><img src="../img/blank.gif" width="10" height="8">
  433. </td>
  434. <td width="10" class="form_text"><img src="../img/blank.gif" width="10" height="8">
  435. </td>
  436. <?php
  437. if($i>$start)
  438. {
  439. ?>
  440. <td width="30" align="center" class="form_text1">
  441. <input type="image" src="../img/up.gif" width="24" height="24" border="0" onclick="this.form.submit();" name="<?php echo "up".$i;?>" style="cursor:hand">
  442. </td>
  443. <?php }
  444. else
  445. {
  446. ?> <td width="30" align="center" class="form_text1">
  447. </td>
  448. <?php }
  449. $sn++;
  450. ?>
  451. <?php if($i<$end)
  452. {
  453. ?>
  454. <td width="30" align="center" class="form_text">
  455. <input type="image" src="../img/down.gif" width="24" height="24" border="0" onclick="this.form.submit();" name="<?php echo "down".$i;?>" style="cursor:hand">
  456. </td>
  457. <?php }
  458. else
  459. {
  460. ?> <td width="30" align="center" class="form_text1">
  461. </td>
  462. <?php }
  463. ?>
  464. <td width="30" align="center" class="form_text">
  465. <input type="image" src="../img/delete.gif" width="24" height="24" border="0" style="cursor:hand" name="<?php echo "id".$i;?>" value="<?php echo $end;?>" onclick="this.form.submit();">
  466. </tr>
  467. <?php }
  468. }
  469. ?>
  470. </table>
  471. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  472. <tr class="white_bg">
  473. <td height="30"><span class="form_text1">Add&nbsp;&nbsp;</span>
  474. <select name="addnewrows" class="text_field_small" style="width:100px" onChange="this.form.submit();">
  475. <!--<option value="1" <?php if(isset($_POST['addnewrows'])){if($_POST['addnewrows']=="1")echo "selected";}?>>1</option>
  476. <option value="2" <?php if(isset($_POST['addnewrows'])){if($_POST['addnewrows']=="2")echo "selected";}?>>2</option>
  477. <option value="3" <?php if(isset($_POST['addnewrows'])){if($_POST['addnewrows']=="3")echo "selected";}?>>3</option>
  478. <option value="4" <?php if(isset($_POST['addnewrows'])){if($_POST['addnewrows']=="4")echo "selected";}?>>4</option>
  479. <option value="5" <?php if(isset($_POST['addnewrows'])){if($_POST['addnewrows']=="5")echo "selected";}?>>5</option>-->
  480. <option value="0" >0</option>
  481. <option value="1" >1</option>
  482. <option value="2" >2</option>
  483. <option value="3" >3</option>
  484. <option value="4" >4</option>
  485. <option value="5" >5</option>
  486. </select>
  487. <a class="form_text1">New Answer</a>
  488. <span class="form_text"><span class="form_text1">
  489. </td>
  490. </tr>
  491. </table>
  492. <br>
  493. <br>
  494. <div align="center">
  495. <!--
  496. <input type="hidden" name="type" value="mcma">-->
  497. <input type="HIDDEN" name="end1" value="<?php echo $end; ?>">
  498. <?php if(isset($_POST['add_question']))
  499. {
  500. ?> <input type="hidden" name="add_question" value="<?php echo $_POST['add_question'];?>" >
  501. <?php }
  502. $sql = "SELECT * FROM $table_survey WHERE survey_id='$surveyid'";
  503. $res=api_sql_query($sql);
  504. $obj=mysql_fetch_object($res);
  505. switch($obj->template)
  506. {
  507. case "template1":
  508. $temp = 'white';
  509. break;
  510. case "template2":
  511. $temp = 'bluebreeze';
  512. break;
  513. case "template3":
  514. $temp = 'brown';
  515. break;
  516. case "template4":
  517. $temp = 'grey';
  518. break;
  519. case "template5":
  520. $temp = 'blank';
  521. break;
  522. }
  523. ?>
  524. <input type="submit" name="back" value="<?php echo get_lang('Back'); ?>">
  525. <input type="submit" name="saveandexit" value="<?php echo get_lang('SaveAndExit');?>">
  526. <input type="button" value="<?php echo get_lang('Preview');?>" onClick="preview('mcma','<?php echo $temp; ?>','<?php echo get_lang('MultipleChoiceMulti'); ?>')">
  527. <input type="submit" name="next" value="<?php echo get_lang('Next'); ?>">
  528. </div>
  529. <!--this partcular field helps in identify the item to be add at the itemadd.php-->
  530. </form>
  531. </div>
  532. <div id=bottomnav align="center"></DIV>
  533. </body>
  534. </html>
  535. <SCRIPT LANGUAGE="JavaScript">
  536. function preview(form,temp,qtype)
  537. {
  538. var ques = editor.getHTML();
  539. //alert(ques);
  540. var id_str = "";
  541. for(i=0;i<eval("document."+form+"['mutlichkboxtext[]'].length");i++)
  542. {
  543. var box = (eval("document."+form+"['mutlichkboxtext[]']["+i+"]"));
  544. id_str += box.value+"|";
  545. }
  546. window.open(temp+'.php?ques='+ques+'&ans='+id_str+'&qtype='+qtype, 'popup', 'width=800,height=600,scrollbars=yes,toolbar = no, status = no');
  547. }
  548. </script>
  549. <?php
  550. Display :: display_footer();
  551. ?>