QuizQuestion.class.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Exercises questions backup script
  5. * @package chamilo.backup
  6. */
  7. /**
  8. * Code
  9. */
  10. require_once 'Resource.class.php';
  11. /**
  12. * An QuizQuestion
  13. * @author Bart Mollet <bart.mollet@hogent.be>
  14. * @package chamilo.backup
  15. */
  16. class QuizQuestion extends Resource
  17. {
  18. /**
  19. * The question
  20. */
  21. public $question;
  22. /**
  23. * The description
  24. */
  25. public $description;
  26. /**
  27. * Ponderation
  28. */
  29. public $ponderation;
  30. /**
  31. * Type
  32. */
  33. public $quiz_type;
  34. /**
  35. * Position
  36. */
  37. public $position;
  38. /**
  39. * Level
  40. */
  41. public $level;
  42. /**
  43. * Answers
  44. */
  45. public $answers;
  46. /**
  47. * Picture
  48. */
  49. public $picture;
  50. public $extra;
  51. public $categories;
  52. public $parent_info;
  53. /**
  54. * * Create a new QuizQuestion
  55. * @param $id
  56. * @param $question
  57. * @param $description
  58. * @param $ponderation
  59. * @param $type
  60. * @param $position
  61. * @param $picture
  62. * @param $level
  63. * @param $extra
  64. * @param $parent_info
  65. * @param $categories
  66. */
  67. function QuizQuestion($id, $question, $description, $ponderation, $type, $position, $picture, $level, $extra, $parent_info, $categories)
  68. {
  69. parent::Resource($id, RESOURCE_QUIZQUESTION);
  70. $this->question = $question;
  71. $this->description = $description;
  72. $this->ponderation = $ponderation;
  73. $this->quiz_type = $type;
  74. $this->position = $position;
  75. $this->picture = $picture;
  76. $this->level = $level;
  77. $this->answers = array();
  78. $this->extra = $extra;
  79. $this->parent_info = $parent_info;
  80. $this->categories = $categories;
  81. }
  82. /**
  83. * Add an answer to this QuizQuestion
  84. */
  85. function add_answer($answer_id, $answer_text, $correct, $comment, $ponderation, $position, $hotspot_coordinates, $hotspot_type)
  86. {
  87. $answer = array();
  88. $answer['iid'] = $answer_id;
  89. $answer['answer'] = $answer_text;
  90. $answer['correct'] = $correct;
  91. $answer['comment'] = $comment;
  92. $answer['ponderation'] = $ponderation;
  93. $answer['position'] = $position;
  94. $answer['hotspot_coordinates'] = $hotspot_coordinates;
  95. $answer['hotspot_type'] = $hotspot_type;
  96. $this->answers[] = $answer;
  97. }
  98. /**
  99. * @param $option_obj
  100. */
  101. function add_option($option_obj)
  102. {
  103. $this->question_options[$option_obj->obj->id] = $option_obj;
  104. }
  105. /**
  106. * Show this question
  107. */
  108. function show()
  109. {
  110. parent::show();
  111. echo $this->question;
  112. }
  113. }