QuizQuestion.class.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php // $Id: QuizQuestion.class.php 18549 2009-02-17 18:08:58Z cfasanando $
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004 Dokeos S.A.
  6. Copyright (c) 2003 Ghent University (UGent)
  7. Copyright (c) 2001 Universite catholique de Louvain (UCL)
  8. Copyright (c) Bart Mollet (bart.mollet@hogent.be)
  9. For a full list of contributors, see "credits.txt".
  10. The full license can be read in "license.txt".
  11. This program is free software; you can redistribute it and/or
  12. modify it under the terms of the GNU General Public License
  13. as published by the Free Software Foundation; either version 2
  14. of the License, or (at your option) any later version.
  15. See the GNU General Public License for more details.
  16. Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
  17. Mail: info@dokeos.com
  18. ==============================================================================
  19. */
  20. require_once('Resource.class.php');
  21. /**
  22. * An QuizQuestion
  23. * @author Bart Mollet <bart.mollet@hogent.be>
  24. * @package dokeos.backup
  25. */
  26. class QuizQuestion extends Resource
  27. {
  28. /**
  29. * The question
  30. */
  31. var $question;
  32. /**
  33. * The description
  34. */
  35. var $description;
  36. /**
  37. * Ponderation
  38. */
  39. var $ponderation;
  40. /**
  41. * Type
  42. */
  43. var $quiz_type;
  44. /**
  45. * Position
  46. */
  47. var $position;
  48. /**
  49. * Level
  50. */
  51. var $level;
  52. /**
  53. * Answers
  54. */
  55. var $answers;
  56. /**
  57. * Create a new QuizQuestion
  58. * @param string $question
  59. * @param string $description
  60. * @param int $ponderation
  61. * @param int $type
  62. * @param int $position
  63. */
  64. function QuizQuestion($id,$question,$description,$ponderation,$type,$position,$picture,$level)
  65. {
  66. parent::Resource($id,RESOURCE_QUIZQUESTION);
  67. $this->question = $question;
  68. $this->description = $description;
  69. $this->ponderation = $ponderation;
  70. $this->quiz_type = $type;
  71. $this->position = $position;
  72. $this->picture = $picture;
  73. $this->level = $level;
  74. $this->answers = array();
  75. }
  76. /**
  77. * Add an answer to this QuizQuestion
  78. */
  79. function add_answer($answer_text,$correct,$comment,$ponderation,$position,$hotspot_coordinates,$hotspot_type)
  80. {
  81. $answer = array();
  82. $answer['answer'] = $answer_text;
  83. $answer['correct'] = $correct;
  84. $answer['comment'] = $comment;
  85. $answer['ponderation'] = $ponderation;
  86. $answer['position'] = $position;
  87. $answer['hotspot_coordinates'] = $hotspot_coordinates;
  88. $answer['hotspot_type'] = $hotspot_type;
  89. $this->answers[] = $answer;
  90. }
  91. /**
  92. * Show this question
  93. */
  94. function show()
  95. {
  96. parent::show();
  97. echo $this->question;
  98. }
  99. }
  100. ?>