hotspot_save.inc.php 1.4 KB

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