hotspot_save.inc.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php //$id:$
  2. /* For licensing terms, see /license.txt */
  3. //error_log(__FILE__);
  4. /**
  5. *
  6. * @package dokeos.exercise
  7. * @author Toon Keppens
  8. * @version $Id: admin.php 10680 2007-01-11 21:26:23Z pcool $
  9. */
  10. include('exercise.class.php');
  11. include('question.class.php');
  12. include('answer.class.php');
  13. include('../inc/global.inc.php');
  14. $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER);
  15. $questionId = intval($_GET['questionId']);
  16. $answerId = intval($_GET['answerId']);
  17. if ($_GET['type'] == "square" || $_GET['type'] == "circle") {
  18. $hotspot_type = $_GET['type'];
  19. $hotspot_coordinates = $_GET['x'].";".$_GET['y']."|".$_GET['width']."|".$_GET['height'];
  20. }
  21. if ($_GET['type'] == "poly" || $_GET['type'] == "delineation" || $_GET['type'] == "oar") {
  22. $hotspot_type = $_GET['type'];
  23. $tmp_coord = explode(",",$_GET['co']);
  24. $i = 0;
  25. $hotspot_coordinates = "";
  26. foreach ($tmp_coord as $coord) {
  27. if ($i%2 == 0) {
  28. $delimiter = ";";
  29. } else {
  30. $delimiter = "|";
  31. }
  32. $hotspot_coordinates .= $coord.$delimiter;
  33. $i++;
  34. }
  35. $hotspot_coordinates = api_substr($hotspot_coordinates,0,-2);
  36. }
  37. $sql = "UPDATE $TBL_ANSWER SET hotspot_coordinates = '".Database::escape_string($hotspot_coordinates)."',hotspot_type = '".Database::escape_string($hotspot_type)."' WHERE id = '".Database::escape_string($answerId)."' AND question_id ='".Database::escape_string($questionId)."' LIMIT 1 ;";
  38. $result = Database::query($sql);
  39. echo "done=done";