QuizQuestion.class.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?php // $Id: QuizQuestion.class.php 13306 2007-09-27 07:16:52Z yannoo $
  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. * Answers
  50. */
  51. var $answers;
  52. /**
  53. * Create a new QuizQuestion
  54. * @param string $question
  55. * @param string $description
  56. * @param int $ponderation
  57. * @param int $type
  58. * @param int $position
  59. */
  60. function QuizQuestion($id,$question,$description,$ponderation,$type,$position,$picture)
  61. {
  62. parent::Resource($id,RESOURCE_QUIZQUESTION);
  63. $this->question = $question;
  64. $this->description = $description;
  65. $this->ponderation = $ponderation;
  66. $this->quiz_type = $type;
  67. $this->position = $position;
  68. $this->picture = $picture;
  69. $this->answers = array();
  70. }
  71. /**
  72. * Add an answer to this QuizQuestion
  73. */
  74. function add_answer($answer_text,$correct,$comment,$ponderation,$position,$hotspot_coordinates,$hotspot_type)
  75. {
  76. $answer = array();
  77. $answer['answer'] = $answer_text;
  78. $answer['correct'] = $correct;
  79. $answer['comment'] = $comment;
  80. $answer['ponderation'] = $ponderation;
  81. $answer['position'] = $position;
  82. $answer['hotspot_coordinates'] = $hotspot_coordinates;
  83. $answer['hotspot_type'] = $hotspot_type;
  84. $this->answers[] = $answer;
  85. }
  86. /**
  87. * Show this question
  88. */
  89. function show()
  90. {
  91. parent::show();
  92. echo $this->question;
  93. }
  94. }
  95. ?>