hotspot_updatescore.inc.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /*
  3. DOKEOS - elearning and course management software
  4. For a full list of contributors, see documentation/credits.html
  5. This program is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU General Public License
  7. as published by the Free Software Foundation; either version 2
  8. of the License, or (at your option) any later version.
  9. See "documentation/licence.html" more details.
  10. Contact:
  11. Dokeos
  12. Rue des Palais 44 Paleizenstraat
  13. B-1030 Brussels - Belgium
  14. Tel. +32 (2) 211 34 56
  15. */
  16. /**
  17. * This file saves every click in the hotspot tool into track_e_hotspots
  18. * @package dokeos.exercise
  19. * @author Toon Keppens
  20. * @version $Id: admin.php 10680 2007-01-11 21:26:23Z pcool $
  21. */
  22. include('exercise.class.php');
  23. include('question.class.php');
  24. include('answer.class.php');
  25. include('../inc/global.inc.php');
  26. $courseCode = $_GET['coursecode'];
  27. $questionId = $_GET['questionId'];
  28. $coordinates = $_GET['coord'];
  29. $objExcercise = $_SESSION['objExercise'];
  30. $hotspotId = $_GET['hotspotId'];
  31. $exerciseId = $objExcercise->selectId();
  32. if ($_GET['answerId'] == "0") // click is NOT on a hotspot
  33. {
  34. $hit = 0;
  35. $answerId = $hotspotId;
  36. // remove from session
  37. unset($_SESSION['exerciseResult'][$questionId][$answerId]);
  38. // Save clicking order
  39. //$answerOrderId = count($_SESSION['exerciseResult'][$questionId]['order'])+1;
  40. //$_SESSION['exerciseResult'][$questionId]['order'][$answerOrderId] = $answerId;
  41. }
  42. else // user clicked ON a hotspot
  43. {
  44. $hit = 1;
  45. $answerId = $hotspotId;
  46. // Save into session
  47. $_SESSION['exerciseResult'][$questionId][$answerId] = $hit;
  48. // Save clicking order
  49. //$answerOrderId = count($_SESSION['exerciseResult'][$questionId]['order'])+1;
  50. //$_SESSION['exerciseResult'][$questionId]['order'][$answerOrderId] = $answerId;
  51. }
  52. $TBL_TRACK_E_HOTSPOT = Database::get_statistic_table(STATISTIC_TRACK_E_HOTSPOTS);
  53. // update db
  54. $update_id = $_SESSION['exerciseResult'][$questionId]['ids'][$answerId];
  55. $sql = "UPDATE $TBL_TRACK_E_HOTSPOT SET `coordinate` = '".$coordinates."' WHERE `id` =$update_id LIMIT 1 ;;";
  56. $result = api_sql_query($sql,__FILE__,__LINE__);
  57. ?>