hotspot_save.inc.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  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. require_once __DIR__.'/../inc/global.inc.php';
  10. $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER);
  11. $questionId = intval($_GET['questionId']);
  12. $answerId = intval($_GET['answerId']);
  13. if ($_GET['type'] == "square" || $_GET['type'] == "circle") {
  14. $hotspot_type = $_GET['type'];
  15. $hotspot_coordinates = $_GET['x'].";".$_GET['y']."|".$_GET['width']."|".$_GET['height'];
  16. }
  17. if ($_GET['type'] == "poly" || $_GET['type'] == "delineation" || $_GET['type'] == "oar") {
  18. $hotspot_type = $_GET['type'];
  19. $tmp_coord = explode(",", $_GET['co']);
  20. $i = 0;
  21. $hotspot_coordinates = "";
  22. foreach ($tmp_coord as $coord) {
  23. if ($i % 2 == 0) {
  24. $delimiter = ";";
  25. } else {
  26. $delimiter = "|";
  27. }
  28. $hotspot_coordinates .= $coord.$delimiter;
  29. $i++;
  30. }
  31. $hotspot_coordinates = api_substr($hotspot_coordinates, 0, -2);
  32. }
  33. $course_id = api_get_course_int_id();
  34. $sql = "UPDATE $TBL_ANSWER SET
  35. hotspot_coordinates = '".Database::escape_string($hotspot_coordinates)."',
  36. hotspot_type = '".Database::escape_string($hotspot_type)."'
  37. WHERE
  38. c_id = $course_id AND
  39. id = ".intval($answerId)." AND
  40. question_id = ".intval($questionId)."
  41. LIMIT 1 ";
  42. $result = Database::query($sql);
  43. echo "done=done";