hotspot_save.inc.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004 Dokeos S.A.
  6. Copyright (c) 2003 Ghent University (UGent)
  7. Copyright (c) 2001 Universite catholique de Louvain (UCL)
  8. Copyright (c) Olivier Brouckaert
  9. For a full list of contributors, see "credits.txt".
  10. The full license can be read in "license.txt".
  11. This program is free software; you can redistribute it and/or
  12. modify it under the terms of the GNU General Public License
  13. as published by the Free Software Foundation; either version 2
  14. of the License, or (at your option) any later version.
  15. See the GNU General Public License for more details.
  16. Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
  17. ==============================================================================
  18. */
  19. /**
  20. ==============================================================================
  21. * This file generates the ActionScript code used by the HotSpot .swf
  22. *
  23. * @author Toon Keppens
  24. * @package dokeos.exercise
  25. ==============================================================================
  26. */
  27. include('exercise.class.php');
  28. include('question.class.php');
  29. include('answer.class.php');
  30. include('../inc/global.inc.php');
  31. $TBL_ANSWER = $_GET['dbNameGlu']."quiz_answer";
  32. $questionId = $_GET['questionId'];
  33. $answerId = $_GET['answerId'];
  34. if ($_GET['type'] == "square" || $_GET['type'] == "circle")
  35. {
  36. $hotspot_type = $_GET['type'];
  37. $hotspot_coordinates = $_GET['x'].";".$_GET['y']."|".$_GET['width']."|".$_GET['height'];
  38. }
  39. if ($_GET['type'] == "poly")
  40. {
  41. $hotspot_type = $_GET['type'];
  42. $tmp_coord = explode(",",$_GET['co']);
  43. $i = 0;
  44. $hotspot_coordinates = "";
  45. foreach ($tmp_coord as $coord)
  46. {
  47. if ($i%2 == 0)
  48. {
  49. $delimiter = ";";
  50. } else
  51. {
  52. $delimiter = "|";
  53. }
  54. $hotspot_coordinates .= $coord.$delimiter;
  55. $i++;
  56. }
  57. $hotspot_coordinates = substr($hotspot_coordinates,0,-2);
  58. }
  59. $sql = "UPDATE `$TBL_ANSWER` SET `hotspot_coordinates` = '$hotspot_coordinates',`hotspot_type` = '$hotspot_type' WHERE `id` =$answerId AND `question_id` =$questionId LIMIT 1 ;";
  60. $result = api_sql_query($sql,__FILE__,__LINE__);
  61. echo "done=done";
  62. ?>