hotspot_save.inc.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php //$id:$
  2. /* For licensing terms, see /dokeos_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 = $_GET['questionId'];
  16. $answerId = $_GET['answerId'];
  17. if ($_GET['type'] == "square" || $_GET['type'] == "circle")
  18. {
  19. $hotspot_type = $_GET['type'];
  20. $hotspot_coordinates = $_GET['x'].";".$_GET['y']."|".$_GET['width']."|".$_GET['height'];
  21. }
  22. if ($_GET['type'] == "poly" || $_GET['type'] == "delineation")
  23. {
  24. $hotspot_type = $_GET['type'];
  25. $tmp_coord = explode(",",$_GET['co']);
  26. $i = 0;
  27. $hotspot_coordinates = "";
  28. foreach ($tmp_coord as $coord)
  29. {
  30. if ($i%2 == 0)
  31. {
  32. $delimiter = ";";
  33. }
  34. else
  35. {
  36. $delimiter = "|";
  37. }
  38. $hotspot_coordinates .= $coord.$delimiter;
  39. $i++;
  40. }
  41. $hotspot_coordinates = api_substr($hotspot_coordinates,0,-2);
  42. }
  43. $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 ;";
  44. $result = api_sql_query($sql,__FILE__,__LINE__);
  45. echo "done=done";
  46. ?>