hotspot_save.inc.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. * This file generates the ActionScript code used by the HotSpot .swf
  18. * @package dokeos.exercise
  19. * @author Toon Keppens
  20. * @version $Id: admin.php 10680 2007-01-11 21:26:23Z pcool $
  21. */
  22. include('exercise.class.php');
  23. include('question.class.php');
  24. include('answer.class.php');
  25. include('../inc/global.inc.php');
  26. $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER);
  27. $questionId = $_GET['questionId'];
  28. $answerId = $_GET['answerId'];
  29. if ($_GET['type'] == "square" || $_GET['type'] == "circle")
  30. {
  31. $hotspot_type = $_GET['type'];
  32. $hotspot_coordinates = $_GET['x'].";".$_GET['y']."|".$_GET['width']."|".$_GET['height'];
  33. }
  34. if ($_GET['type'] == "poly")
  35. {
  36. $hotspot_type = $_GET['type'];
  37. $tmp_coord = explode(",",$_GET['co']);
  38. $i = 0;
  39. $hotspot_coordinates = "";
  40. foreach ($tmp_coord as $coord)
  41. {
  42. if ($i%2 == 0)
  43. {
  44. $delimiter = ";";
  45. }
  46. else
  47. {
  48. $delimiter = "|";
  49. }
  50. $hotspot_coordinates .= $coord.$delimiter;
  51. $i++;
  52. }
  53. $hotspot_coordinates = substr($hotspot_coordinates,0,-2);
  54. }
  55. $sql = "UPDATE `$TBL_ANSWER` SET `hotspot_coordinates` = '$hotspot_coordinates',`hotspot_type` = '$hotspot_type' WHERE `id` =$answerId AND `question_id` =$questionId LIMIT 1 ;";
  56. $result = api_sql_query($sql,__FILE__,__LINE__);
  57. echo "done=done";
  58. ?>