exercise.lib.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Exercise library
  5. * shows a question and its answers
  6. * @package dokeos.exercise
  7. * @author Olivier Brouckaert <oli.brouckaert@skynet.be>
  8. * @version $Id: exercise.lib.php 22247 2009-07-20 15:57:25Z ivantcholakov $
  9. */
  10. // The initialization class for the online editor is needed here.
  11. require_once '../inc/lib/fckeditor/fckeditor.php';
  12. /**
  13. * @param int question id
  14. * @param boolean only answers
  15. * @param boolean origin i.e = learnpath
  16. * @param int current item from the list of questions
  17. * @param int number of total questions
  18. * */
  19. function showQuestion($questionId, $onlyAnswers = false, $origin = false, $current_item, $total_item) {
  20. // Text direction for the current language
  21. $is_ltr_text_direction = api_get_text_direction() != 'rtl';
  22. // Change false to true in the following line to enable answer hinting.
  23. $debug_mark_answer = api_is_allowed_to_edit() && false;
  24. if (!ereg("MSIE", $_SERVER["HTTP_USER_AGENT"])) {
  25. //echo '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.js" type="text/javascript"></script>';
  26. //echo '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.corners.min.js" type="text/javascript"></script>';
  27. }
  28. // Reads question informations.
  29. if (!$objQuestionTmp = Question::read($questionId)) {
  30. // question not found
  31. return false;
  32. }
  33. $answerType=$objQuestionTmp->selectType();
  34. $pictureName=$objQuestionTmp->selectPicture();
  35. if ($answerType != HOT_SPOT) {
  36. // Question is not of type hotspot
  37. if (!$onlyAnswers) {
  38. $questionName=$objQuestionTmp->selectTitle();
  39. $questionDescription=$objQuestionTmp->selectDescription();
  40. $questionName=api_parse_tex($questionName);
  41. $s="<div id=\"question_title\" class=\"sectiontitle\">
  42. ".get_lang('Question').' ';
  43. $s.=$current_item;
  44. //@todo I need the get the feedback type
  45. //if($answerType != 1)
  46. //$s.=' / '.$total_item;
  47. echo $s;
  48. echo ' : ';
  49. echo $questionName.'</div>';
  50. $s='';
  51. $s.="<table class='exercise_questions' style='margin:4px;padding:2px;'>
  52. <tr><td valign='top' colspan='2'>";
  53. $questionDescription=api_parse_tex($questionDescription);
  54. $s.=$questionDescription;
  55. $s.="</td></tr></table>";
  56. if (!empty($pictureName)) {
  57. $s.="
  58. <tr>
  59. <td align='center' colspan='2'><img src='../document/download.php?doc_url=%2Fimages%2F'".$pictureName."' border='0'></td>
  60. </tr>";
  61. }
  62. }
  63. $s.= '</table>';
  64. if (!ereg("MSIE",$_SERVER["HTTP_USER_AGENT"])) {
  65. $s .= '<div class="rounded exercise_questions" style="width: 720px; padding: 3px;">';
  66. } else {
  67. $option_ie="margin-left:10px";
  68. }
  69. $s .= '<table width="720" class="exercise_options" style="width: 720px;'.$option_ie.' background-color:#fff;">';
  70. // construction of the Answer object (also gets all answers details)
  71. $objAnswerTmp=new Answer($questionId);
  72. $nbrAnswers=$objAnswerTmp->selectNbrAnswers();
  73. // For "matching" type here, we need something a little bit special
  74. // because the match between the suggestions and the answers cannot be
  75. // done easily (suggestions and answers are in the same table), so we
  76. // have to go through answers first (elems with "correct" value to 0).
  77. $select_items = array();
  78. //This will contain the number of answers on the left side. We call them
  79. // suggestions here, for the sake of comprehensions, while the ones
  80. // on the right side are called answers
  81. $num_suggestions = 0;
  82. if ($answerType == MATCHING) {
  83. $x = 1; //iterate through answers
  84. $letter = 'A'; //mark letters for each answer
  85. $answer_matching = $cpt1 = array();
  86. $answer_suggestions = $nbrAnswers;
  87. for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) {
  88. $answerCorrect = $objAnswerTmp->isCorrect($answerId);
  89. $numAnswer = $objAnswerTmp->selectAutoId($answerId);
  90. $answer=$objAnswerTmp->selectAnswer($answerId);
  91. if ($answerCorrect==0) {
  92. // options (A, B, C, ...) that will be put into the list-box
  93. // have the "correct" field set to 0 because they are answer
  94. $cpt1[$x] = $letter;
  95. $answer_matching[$x]=$objAnswerTmp->selectAnswerByAutoId($numAnswer);
  96. $x++; $letter++;
  97. }
  98. }
  99. $i = 1;
  100. foreach ($answer_matching as $id => $value) {
  101. $select_items[$i]['id'] = $value['id'];
  102. $select_items[$i]['letter'] = $cpt1[$id];
  103. $select_items[$i]['answer'] = $value['answer'];
  104. $i ++;
  105. }
  106. $num_suggestions = ($nbrAnswers - $x) + 1;
  107. } elseif ($answerType == FREE_ANSWER) {
  108. #$comment = $objAnswerTmp->selectComment(1);
  109. //
  110. $oFCKeditor = new FCKeditor("choice[".$questionId."]") ;
  111. $oFCKeditor->ToolbarSet = 'TestFreeAnswer';
  112. $oFCKeditor->Width = '100%';
  113. $oFCKeditor->Height = '200';
  114. $oFCKeditor->Value = '' ;
  115. $s .= '<tr><td colspan="3">'.$oFCKeditor->CreateHtml()."</td></tr>";
  116. //$s.="<tr><td colspan='2'><textarea cols='80' rows='10' name='choice[".$questionId."]'>$answer</textarea></td></tr>";
  117. }
  118. // Now navigate through the possible answers, using the max number of
  119. // answers for the question as a limiter
  120. $lines_count=1; // a counter for matching-type answers
  121. for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) {
  122. $answer = $objAnswerTmp->selectAnswer($answerId);
  123. $answerCorrect = $objAnswerTmp->isCorrect($answerId);
  124. $numAnswer = $objAnswerTmp->selectAutoId($answerId);
  125. if ($answerType == FILL_IN_BLANKS) {
  126. // splits text and weightings that are joined with the character '::'
  127. list($answer) = explode('::',$answer);
  128. // because [] is parsed here we follow this procedure:
  129. // 1. find everything between the [tex] and [/tex] tags
  130. $startlocations = api_strpos($answer,'[tex]');
  131. $endlocations = api_strpos($answer,'[/tex]');
  132. if ($startlocations !== false && $endlocations !== false) {
  133. $texstring = api_substr($answer,$startlocations,$endlocations-$startlocations+6);
  134. // 2. replace this by {texcode}
  135. $answer = str_replace($texstring,'{texcode}',$answer);
  136. }
  137. // 3. do the normal matching parsing
  138. // replaces [blank] by an input field
  139. //getting the matches
  140. $answer = api_ereg_replace('\[[^]]+\]','<input type="text" name="choice['.$questionId.'][]" size="10" />',($answer));
  141. // Change input size
  142. /*
  143. preg_match_all('/\[[^]]+]/',$answer,$matches);
  144. $answer=ereg_replace('\[[^]]+\]','<input type="text" name="choice['.$questionId.'][]" size="@@" />',($answer));
  145. // 4. resize the input
  146. foreach($matches[0] as $match) {
  147. $answer_len = strlen($match)-2;
  148. //we will only replace 1 item
  149. // echo implode("replace term", explode("search term", "input", $limit));
  150. if ($answer_len <= 5) {
  151. $answer = (implode("5", explode("@@", $answer, 2)));
  152. } elseif($answer_len <= 10) {
  153. $answer = (implode("10", explode("@@", $answer, 2)));
  154. } elseif($answer_len <= 20) {
  155. $answer = (implode("20", explode("@@", $answer, 2)));
  156. } elseif($answer_len <= 30) {
  157. $answer = (implode("30", explode("@@", $answer, 2)));
  158. } elseif($answer_len <= 40) {
  159. $answer = (implode("45", explode("@@", $answer, 2)));
  160. } elseif($answer_len <= 50) {
  161. $answer = (implode("60", explode("@@", $answer, 2)));
  162. } elseif($answer_len <= 60) {
  163. $answer = (implode("70", explode("@@", $answer, 2)));
  164. } elseif($answer_len <= 70) {
  165. $answer = (implode("80", explode("@@", $answer, 2)));
  166. } elseif($answer_len <= 80) {
  167. $answer = (implode("90", explode("@@", $answer, 2)));
  168. } elseif($answer_len <= 90) {
  169. $answer = (implode("100", explode("@@", $answer, 2)));
  170. } elseif($answer_len <= 100) {
  171. $answer = (implode("110", explode("@@", $answer, 2)));
  172. } elseif($answer_len > 100 ) {
  173. $answer = (implode("120", explode("@@", $answer, 2)));
  174. }
  175. }
  176. */
  177. // 5. replace the {texcode by the api_pare_tex parsed code}
  178. $texstring = api_parse_tex($texstring);
  179. $answer=str_replace("{texcode}",$texstring,$answer);
  180. }
  181. // Unique answer
  182. if ($answerType == UNIQUE_ANSWER) {
  183. // set $debug_mark_answer to true at function start to
  184. // show the correct answer with a suffix '-x'
  185. $help = $selected = '';
  186. if ($debug_mark_answer) {
  187. if ($answerCorrect) {
  188. $help = 'x-';
  189. $selected = 'checked="checked"';
  190. }
  191. }
  192. $answer = api_parse_tex($answer);
  193. $answer = Security::remove_XSS($answer, STUDENT);
  194. $s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />'.
  195. '<tr><td colspan="3"><div class="u-m-answer"><p style="float: '.($is_ltr_text_direction ? 'left' : 'right').'; padding-'.($is_ltr_text_direction ? 'right' : 'left').': 4px;">'.
  196. '<span><input class="checkbox" type="radio" name="choice['.$questionId.']" value="'.$numAnswer.'" '.$selected.' /></span></p>'.
  197. '<div style="margin-'.($is_ltr_text_direction ? 'left' : 'right').': 24px;">'.
  198. $answer.
  199. '</div></div></td></tr>';
  200. } elseif ($answerType == MULTIPLE_ANSWER) {
  201. // multiple answers
  202. // set $debug_mark_answer to true at function start to
  203. // show the correct answer with a suffix '-x'
  204. $help = $selected = '';
  205. if ($debug_mark_answer) {
  206. if ($answerCorrect) {
  207. $help = 'x-';
  208. $selected = 'checked="checked"';
  209. }
  210. }
  211. $answer = api_parse_tex($answer);
  212. $answer = Security::remove_XSS($answer, STUDENT);
  213. $s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />'.
  214. '<tr><td colspan="3"><div class="u-m-answer"><p style="float: '.($is_ltr_text_direction ? 'left' : 'right').'; padding-'.($is_ltr_text_direction ? 'right' : 'left').': 4px;">'.
  215. '<span><input class="checkbox" type="checkbox" name="choice['.$questionId.']['.$numAnswer.']" value="1" '.$selected.' /></span></p>'.
  216. '<div style="margin-'.($is_ltr_text_direction ? 'left' : 'right').': 24px;">'.
  217. $answer.
  218. '</div></div></td></tr>';
  219. } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION) {
  220. // multiple answers
  221. // set $debug_mark_answer to true at function start to
  222. // show the correct answer with a suffix '-x'
  223. $help = $selected = '';
  224. if ($debug_mark_answer) {
  225. if ($answerCorrect) {
  226. $help = 'x-';
  227. $selected = 'checked="checked"';
  228. }
  229. }
  230. $answer = api_parse_tex($answer);
  231. $answer = Security::remove_XSS($answer, STUDENT);
  232. $s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />'.
  233. '<tr><td colspan="3"><div class="u-m-answer"><p style="float: '.($is_ltr_text_direction ? 'left' : 'right').'; padding-'.($is_ltr_text_direction ? 'right' : 'left').': 4px;">'.
  234. '<span><input class="checkbox" type="checkbox" name="choice['.$questionId.']['.$numAnswer.']" value="1" '.$selected.' /></span></p>'.
  235. '<div style="margin-'.($is_ltr_text_direction ? 'left' : 'right').': 24px;">'.
  236. $answer.
  237. '</div></div></td></tr>';
  238. } elseif ($answerType == FILL_IN_BLANKS) {
  239. // fill in blanks
  240. $s .= '<tr><td colspan="3">'.$answer.'</td></tr>';
  241. } else {
  242. // matching type, showing suggestions and answers
  243. // TODO: replace $answerId by $numAnswer
  244. if ($answerCorrect != 0) {
  245. // only show elements to be answered (not the contents of
  246. // the select boxes, who are corrrect = 0)
  247. $s .= '<tr><td width="45%" valign="top" >';
  248. $parsed_answer = api_parse_tex($answer);
  249. //left part questions
  250. $s .= ' <span style="float:left; width:8%;"><b>'.$lines_count.'</b>.&nbsp;</span>
  251. <span style="float:left; width:92%;">'.$parsed_answer.'</span></td>';
  252. //middle part (matches selects)
  253. $s .= '<td width="10%" valign="top" align="center">&nbsp;&nbsp;
  254. <select name="choice['.$questionId.']['.$numAnswer.']">
  255. <option value="0">--</option>';
  256. // fills the list-box
  257. foreach ($select_items as $key=>$val) {
  258. // set $debug_mark_answer to true at function start to
  259. // show the correct answer with a suffix '-x'
  260. $help = $selected = '';
  261. if ($debug_mark_answer) {
  262. if ($val['id'] == $answerCorrect) {
  263. $help = '-x';
  264. $selected = 'selected="selected"';
  265. }
  266. }
  267. $s.='<option value="'.$val['id'].'" '.$selected.'>'.$val['letter'].$help.'</option>';
  268. } // end foreach()
  269. $s .= '</select>&nbsp;&nbsp;</td>';
  270. //print_r($select_items);
  271. //right part (answers)
  272. $s.='<td width="45%" valign="top" >';
  273. if (isset($select_items[$lines_count])) {
  274. $s.='<span style="float:left; width:5%;"><b>'.$select_items[$lines_count]['letter'].'.</b></span>'.
  275. '<span style="float:left; width:95%;">'.$select_items[$lines_count]['answer'].'</span>';
  276. } else {
  277. $s.='&nbsp;';
  278. }
  279. $s .= '</td>';
  280. $s .= '</tr>';
  281. $lines_count++;
  282. //if the left side of the "matching" has been completely
  283. // shown but the right side still has values to show...
  284. if (($lines_count -1) == $num_suggestions) {
  285. // if it remains answers to shown at the right side
  286. while (isset($select_items[$lines_count])) {
  287. $s .= '<tr>
  288. <td colspan="2">&nbsp;</td>
  289. <td valign="top">';
  290. $s.='<b>'.$select_items[$lines_count]['letter'].'.</b> '.$select_items[$lines_count]['answer'];
  291. $s.="</td>
  292. </tr>";
  293. $lines_count++;
  294. } // end while()
  295. } // end if()
  296. }
  297. }
  298. } // end for()
  299. if (!ereg("MSIE", $_SERVER["HTTP_USER_AGENT"])) {
  300. $s .= '</table>';
  301. }
  302. $s .= '</div><br />';
  303. // destruction of the Answer object
  304. unset($objAnswerTmp);
  305. // destruction of the Question object
  306. unset($objQuestionTmp);
  307. if ($origin != 'export') {
  308. echo $s;
  309. } else {
  310. return($s);
  311. }
  312. } elseif ($answerType == HOT_SPOT) {
  313. // Question is of type HOT_SPOT
  314. $questionName=$objQuestionTmp->selectTitle();
  315. $questionDescription=$objQuestionTmp->selectDescription();
  316. // Get the answers, make a list
  317. $objAnswerTmp=new Answer($questionId);
  318. $nbrAnswers=$objAnswerTmp->selectNbrAnswers();
  319. // get answers of hotpost
  320. $answers_hotspot = array();
  321. for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) {
  322. $answers = $objAnswerTmp->selectAnswerByAutoId($objAnswerTmp->selectAutoId($answerId));
  323. $answers_hotspot[$answers['id']] = $objAnswerTmp->selectAnswer($answerId);
  324. }
  325. // display answers of hotpost order by id
  326. $answer_list = '<div style="padding: 10px; margin-left: 0px; border: 1px solid #A4A4A4; height: 408px; width: 200px;"><b>'.get_lang('HotspotZones').'</b><dl>';
  327. if (!empty($answers_hotspot)) {
  328. ksort($answers_hotspot);
  329. foreach ($answers_hotspot as $key => $value) {
  330. $answer_list .= '<dt>'.$key.'.- '.$value.'</dt><br />';
  331. }
  332. }
  333. $answer_list .= '</dl></div>';
  334. if (!$onlyAnswers) {
  335. echo '<div id="question_title" class="sectiontitle">'.get_lang('Question').' '.$current_item.' : '.$questionName.'</div>';
  336. //@todo I need to the get the feedback type
  337. //if($answerType == 2)
  338. // $s.=' / '.$total_item;
  339. echo '<input type="hidden" name="hidden_hotspot_id" value="'.$questionId.'" />';
  340. echo '<table class="exercise_questions" >
  341. <tr>
  342. <td valign="top" colspan="2">';
  343. echo $questionDescription=api_parse_tex($questionDescription);
  344. echo '</td></tr>';
  345. }
  346. $canClick = isset($_GET['editQuestion']) ? '0' : (isset($_GET['modifyAnswers']) ? '0' : '1');
  347. //$tes = isset($_GET['modifyAnswers']) ? '0' : '1';
  348. //echo $tes;
  349. $s .= '<script language="JavaScript" type="text/javascript" src="../plugin/hotspot/JavaScriptFlashGateway.js"></script>
  350. <script src="../plugin/hotspot/hotspot.js" type="text/javascript" language="JavaScript"></script>
  351. <script language="JavaScript" type="text/javascript">
  352. <!--
  353. // Globals
  354. // Major version of Flash required
  355. var requiredMajorVersion = 7;
  356. // Minor version of Flash required
  357. var requiredMinorVersion = 0;
  358. // Minor version of Flash required
  359. var requiredRevision = 0;
  360. // the version of javascript supported
  361. var jsVersion = 1.0;
  362. // -->
  363. </script>
  364. <script language="VBScript" type="text/vbscript">
  365. <!-- // Visual basic helper required to detect Flash Player ActiveX control version information
  366. Function VBGetSwfVer(i)
  367. on error resume next
  368. Dim swControl, swVersion
  369. swVersion = 0
  370. set swControl = CreateObject("ShockwaveFlash.ShockwaveFlash." + CStr(i))
  371. if (IsObject(swControl)) then
  372. swVersion = swControl.GetVariable("$version")
  373. end if
  374. VBGetSwfVer = swVersion
  375. End Function
  376. // -->
  377. </script>
  378. <script language="JavaScript1.1" type="text/javascript">
  379. <!-- // Detect Client Browser type
  380. var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
  381. var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
  382. var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
  383. jsVersion = 1.1;
  384. // JavaScript helper required to detect Flash Player PlugIn version information
  385. function JSGetSwfVer(i) {
  386. // NS/Opera version >= 3 check for Flash plugin in plugin array
  387. if (navigator.plugins != null && navigator.plugins.length > 0) {
  388. if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
  389. var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
  390. var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
  391. descArray = flashDescription.split(" ");
  392. tempArrayMajor = descArray[2].split(".");
  393. versionMajor = tempArrayMajor[0];
  394. versionMinor = tempArrayMajor[1];
  395. if ( descArray[3] != "" ) {
  396. tempArrayMinor = descArray[3].split("r");
  397. } else {
  398. tempArrayMinor = descArray[4].split("r");
  399. }
  400. versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
  401. flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
  402. } else {
  403. flashVer = -1;
  404. }
  405. }
  406. // MSN/WebTV 2.6 supports Flash 4
  407. else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
  408. // WebTV 2.5 supports Flash 3
  409. else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
  410. // older WebTV supports Flash 2
  411. else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
  412. // Can\'t detect in all other cases
  413. else
  414. {
  415. flashVer = -1;
  416. }
  417. return flashVer;
  418. }
  419. // When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
  420. function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) {
  421. reqVer = parseFloat(reqMajorVer + "." + reqRevision);
  422. // loop backwards through the versions until we find the newest version
  423. for (i=25;i>0;i--) {
  424. if (isIE && isWin && !isOpera) {
  425. versionStr = VBGetSwfVer(i);
  426. } else {
  427. versionStr = JSGetSwfVer(i);
  428. }
  429. if (versionStr == -1 ) {
  430. return false;
  431. } else if (versionStr != 0) {
  432. if(isIE && isWin && !isOpera) {
  433. tempArray = versionStr.split(" ");
  434. tempString = tempArray[1];
  435. versionArray = tempString .split(",");
  436. } else {
  437. versionArray = versionStr.split(".");
  438. }
  439. versionMajor = versionArray[0];
  440. versionMinor = versionArray[1];
  441. versionRevision = versionArray[2];
  442. versionString = versionMajor + "." + versionRevision; // 7.0r24 == 7.24
  443. versionNum = parseFloat(versionString);
  444. // is the major.revision >= requested major.revision AND the minor version >= requested minor
  445. if ( (versionMajor > reqMajorVer) && (versionNum >= reqVer) ) {
  446. return true;
  447. } else {
  448. return ((versionNum >= reqVer && versionMinor >= reqMinorVer) ? true : false );
  449. }
  450. }
  451. }
  452. }
  453. // -->
  454. </script>';
  455. $s .= '<tr><td valign="top" colspan="2" width="520"><table><tr><td width="520">
  456. <script language="JavaScript" type="text/javascript">
  457. <!--
  458. // Version check based upon the values entered above in "Globals"
  459. var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
  460. // Check to see if the version meets the requirements for playback
  461. if (hasReqestedVersion) { // if we\'ve detected an acceptable version
  462. var oeTags = \'<object type="application/x-shockwave-flash" data="../plugin/hotspot/hotspot_user.swf?modifyAnswers='.$questionId.'&amp;canClick:'.$canClick.'" width="560" height="436">\'
  463. + \'<param name="movie" value="../plugin/hotspot/hotspot_user.swf?modifyAnswers='.$questionId.'&amp;canClick:'.$canClick.'" />\'
  464. + \'<\/object>\';
  465. document.write(oeTags); // embed the Flash Content SWF when all tests are passed
  466. } else { // flash is too old or we can\'t detect the plugin
  467. var alternateContent = "Error<br \/>"
  468. + "Hotspots requires Macromedia Flash 7.<br \/>"
  469. + "<a href=\"http://www.macromedia.com/go/getflash/\">Get Flash<\/a>";
  470. document.write(alternateContent); // insert non-flash content
  471. }
  472. // -->
  473. </script>
  474. </td>
  475. <td valign="top" align="left">'.$answer_list.'</td></tr>
  476. </table>
  477. </td></tr>';
  478. echo $s;
  479. }
  480. echo '</table><br />';
  481. return $nbrAnswers;
  482. }