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

Source for file hotspot_actionscript.as.php

Documentation is available at hotspot_actionscript.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. include('exercise.class.php');
  29. include('question.class.php');
  30. include('answer.class.php');
  31.  
  32. include('../inc/global.inc.php');
  33.  
  34. // set vars
  35. $questionId    $_GET['modifyAnswers'];
  36. $objQuestion Question::read($questionId);
  37. $documentPath  api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
  38. $picturePath   $documentPath.'/images';
  39. $pictureName   $objQuestion->selectPicture();
  40. $pictureSize   getimagesize($picturePath.'/'.$objQuestion->selectPicture());
  41. $pictureWidth  $pictureSize[0];
  42. $pictureHeight $pictureSize[1];
  43.  
  44. $courseLang $_course['language'];
  45. $courseCode $_course['sysCode'];
  46. $coursePath $_course['path'];
  47.  
  48. // Query db for answers
  49. $sql "SELECT id, answer, hotspot_coordinates, hotspot_type, ponderation FROM $TBL_ANSWERS WHERE question_id = '$questionId' ORDER BY id";
  50. $result api_sql_query($sql,__FILE__,__LINE__);
  51.  
  52. // Init
  53. $output "hotspot_lang=$courseLang&hotspot_image=$pictureName&hotspot_image_width=$pictureWidth&hotspot_image_height=$pictureHeight&courseCode=$coursePath";
  54. $i 0;
  55. $nmbrTries 0;
  56.  
  57. while ($hotspot mysql_fetch_assoc($result))
  58. {
  59.        $output .= "&hotspot_".$hotspot['id']."=true";
  60.     $output .= "&hotspot_".$hotspot['id']."_answer=".str_replace('&','{amp}',$hotspot['answer']);
  61.     // Square or rectancle
  62.     if ($hotspot['hotspot_type'== 'square' )
  63.     {
  64.         $output .= "&hotspot_".$hotspot['id']."_type=square";
  65.     }
  66.     // Circle or ovale
  67.     if ($hotspot['hotspot_type'== 'circle')
  68.     {
  69.         $output .= "&hotspot_".$hotspot['id']."_type=circle";
  70.     }
  71.     // Polygon
  72.     if ($hotspot['hotspot_type'== 'poly')
  73.     {
  74.         $output .= "&hotspot_".$hotspot['id']."_type=poly";
  75.     }
  76.  
  77.     // This is a good answer, count + 1 for nmbr of clicks
  78.     if ($hotspot['hotspot_type'0)
  79.     {
  80.         $nmbrTries++;
  81.     }
  82.  
  83.     $output .= "&hotspot_".$hotspot['id']."_coord=".$hotspot['hotspot_coordinates']."";
  84.     $i++;
  85.  
  86. }
  87.  
  88. // Generate empty
  89. $i++;
  90. for ($i$i <= 12$i++)
  91. {
  92.     $output .= "&hotspot_".$i."=false";
  93. }
  94.  
  95. // Output
  96. echo $output."&nmbrTries=".$nmbrTries."&done=done";
  97. ?>

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