dokeos-exercise
[ class tree: dokeos-exercise ] [ index: dokeos-exercise ] [ all elements ]

Source for file hotspot_savescore.inc.php

Documentation is available at hotspot_savescore.inc.php

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

Documentation generated on Thu, 12 Jun 2008 13:39:41 -0500 by phpDocumentor 1.4.1