hotspot_actionscript_admin.as.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * This file generates the ActionScript variables code used by the HotSpot .swf
  5. * @package chamilo.exercise
  6. * @author Toon Keppens
  7. * @version $Id: admin.php 10680 2007-01-11 21:26:23Z pcool $
  8. */
  9. include('../inc/global.inc.php');
  10. // set vars
  11. $questionId = intval($_GET['modifyAnswers']);
  12. $objQuestion = Question::read($questionId);
  13. $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
  14. $picturePath = $documentPath.'/images';
  15. $pictureName = $objQuestion->selectPicture();
  16. $pictureSize = getimagesize($picturePath.'/'.$objQuestion->selectPicture());
  17. $pictureWidth = $pictureSize[0];
  18. $pictureHeight = $pictureSize[1];
  19. $courseLang = $_course['language'];
  20. $courseCode = $_course['sysCode'];
  21. $coursePath = $_course['path'];
  22. // Init
  23. $output = "hotspot_lang=$courseLang&hotspot_image=$pictureName&hotspot_image_width=$pictureWidth&hotspot_image_height=$pictureHeight&courseCode=$coursePath";
  24. $i = 0;
  25. $nmbrTries = 0;
  26. $answers = $_SESSION['tmp_answers'];
  27. $nbrAnswers = count($answers['answer']);
  28. for($i=1;$i <= $nbrAnswers;$i++) {
  29. $output .= "&hotspot_".$i."=true";
  30. $output .= "&hotspot_".$i."_answer=".$answers['answer'][$i];
  31. if ($answer_type==HOT_SPOT_DELINEATION) {
  32. if ($i==1)
  33. $output .= "&hotspot_".$i."_type=delineation";
  34. else
  35. $output .= "&hotspot_".$i."_type=oar";
  36. } else {
  37. // Square or rectancle
  38. if ($answers['hotspot_type'][$i] == 'square' )
  39. {
  40. $output .= "&hotspot_".$i."_type=square";
  41. }
  42. // Circle or ovale
  43. if ($answers['hotspot_type'][$i] == 'circle')
  44. {
  45. $output .= "&hotspot_".$i."_type=circle";
  46. }
  47. // Polygon
  48. if ($answers['hotspot_type'][$i] == 'poly')
  49. {
  50. $output .= "&hotspot_".$i."_type=poly";
  51. }
  52. /*// Delineation
  53. if ($answers['hotspot_type'][$i] == 'delineation')
  54. {
  55. $output .= "&hotspot_".$i."_type=delineation";
  56. }*/
  57. }
  58. // This is a good answer, count + 1 for nmbr of clicks
  59. if ($answers['weighting'][$i] > 0)
  60. {
  61. $nmbrTries++;
  62. }
  63. $output .= "&hotspot_".$i."_coord=".$answers['hotspot_coordinates'][$i]."";
  64. }
  65. // Generate empty
  66. $i++;
  67. for ($i; $i <= 12; $i++) {
  68. $output .= "&hotspot_".$i."=false";
  69. }
  70. // Output
  71. echo $output."&nmbrTries=".$nmbrTries."&done=done";