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

Source for file hotspot_actionscript_admin.as.php

Documentation is available at hotspot_actionscript_admin.as.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 generates the ActionScript variables code used by the HotSpot .swf
  23. *    @package dokeos.exercise
  24. *     @author Toon Keppens
  25. *     @version $Id: admin.php 10680 2007-01-11 21:26:23Z pcool $
  26. */
  27.  
  28.  
  29.  
  30.  
  31. include('exercise.class.php');
  32. include('question.class.php');
  33. include('answer.class.php');
  34. include('../inc/global.inc.php');
  35. // set vars
  36. $questionId    $_GET['modifyAnswers'];
  37. $objQuestion Question::read($questionId);
  38.  
  39. $documentPath  api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
  40.  
  41. $picturePath   $documentPath.'/images';
  42. $pictureName   $objQuestion->selectPicture();
  43. $pictureSize   getimagesize($picturePath.'/'.$objQuestion->selectPicture());
  44. $pictureWidth  $pictureSize[0];
  45. $pictureHeight $pictureSize[1];
  46.  
  47. $courseLang $_course['language'];
  48. $courseCode $_course['sysCode'];
  49. $coursePath $_course['path'];
  50.  
  51. // Query db for answers
  52. //$sql = "SELECT id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS WHERE question_id = '$questionId' ORDER BY id";
  53. //$result = api_sql_query($sql,__FILE__,__LINE__);
  54.  
  55. // Init
  56. $output "hotspot_lang=$courseLang&hotspot_image=$pictureName&hotspot_image_width=$pictureWidth&hotspot_image_height=$pictureHeight&courseCode=$coursePath";
  57. $i 0;
  58. $nmbrTries 0;
  59.  
  60.  
  61. $answers=$_SESSION['tmp_answers'];
  62. $nbrAnswers count($answers['answer']);
  63.  
  64. for($i=1;$i <= $nbrAnswers;$i++)
  65. {
  66.        $output .= "&hotspot_".$i."=true";
  67.     $output .= "&hotspot_".$i."_answer=".$answers['answer'][$i];
  68.  
  69.     // Square or rectancle
  70.     if ($answers['hotspot_type'][$i== 'square' )
  71.     {
  72.         $output .= "&hotspot_".$i."_type=square";
  73.     }
  74.  
  75.     // Circle or ovale
  76.     if ($answers['hotspot_type'][$i== 'circle')
  77.     {
  78.         $output .= "&hotspot_".$i."_type=circle";
  79.     }
  80.  
  81.     // Polygon
  82.     if ($answers['hotspot_type'][$i== 'poly')
  83.     {
  84.         $output .= "&hotspot_".$i."_type=poly";
  85.     }
  86.  
  87.     // This is a good answer, count + 1 for nmbr of clicks
  88.     if ($answers['weighting'][$i0)
  89.     {
  90.         $nmbrTries++;
  91.     }
  92.  
  93.     $output .= "&hotspot_".$i."_coord=".$answers['hotspot_coordinates'][$i]."";
  94. }
  95.  
  96. // Generate empty
  97. $i++;
  98. for ($i$i <= 12$i++)
  99. {
  100.     $output .= "&hotspot_".$i."=false";
  101. }
  102.  
  103. // Output
  104. echo $output."&nmbrTries=".$nmbrTries."&done=done";
  105. ?>

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