QuizQuestion.class.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. var $question;
  22. /**
  23. * The description
  24. */
  25. var $description;
  26. /**
  27. * Ponderation
  28. */
  29. var $ponderation;
  30. /**
  31. * Type
  32. */
  33. var $quiz_type;
  34. /**
  35. * Position
  36. */
  37. var $position;
  38. /**
  39. * Level
  40. */
  41. var $level;
  42. /**
  43. * Answers
  44. */
  45. var $answers;
  46. /**
  47. * Picture
  48. */
  49. var $picture;
  50. var $extra;
  51. /**
  52. * Create a new QuizQuestion
  53. * @param string $question
  54. * @param string $description
  55. * @param int $ponderation
  56. * @param int $type
  57. * @param int $position
  58. */
  59. function QuizQuestion($id,$question,$description,$ponderation,$type,$position,$picture,$level, $extra) {
  60. parent::Resource($id,RESOURCE_QUIZQUESTION);
  61. $this->question = $question;
  62. $this->description = $description;
  63. $this->ponderation = $ponderation;
  64. $this->quiz_type = $type;
  65. $this->position = $position;
  66. $this->picture = $picture;
  67. $this->level = $level;
  68. $this->answers = array();
  69. $this->extra = $extra;
  70. }
  71. /**
  72. * Add an answer to this QuizQuestion
  73. */
  74. function add_answer($answer_id, $answer_text,$correct,$comment,$ponderation,$position,$hotspot_coordinates,$hotspot_type) {
  75. $answer = array();
  76. $answer['id'] = $answer_id;
  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. parent::show();
  91. echo $this->question;
  92. }
  93. }