QuizQuestion.class.php 2.6 KB

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