Quiz.class.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Exercises backup script
  5. * @package chamilo.backup
  6. */
  7. /**
  8. * Code
  9. */
  10. require_once 'Resource.class.php';
  11. /**
  12. * An Quiz
  13. * @author Bart Mollet <bart.mollet@hogent.be>
  14. * @package chamilo.backup
  15. */
  16. class Quiz extends Resource
  17. {
  18. /**
  19. * The title
  20. */
  21. var $title;
  22. /**
  23. * The description
  24. */
  25. var $description;
  26. /**
  27. * random
  28. */
  29. var $random;
  30. /**
  31. * Type
  32. */
  33. var $quiz_type;
  34. /**
  35. * Active
  36. */
  37. var $active;
  38. /**
  39. * Sound or video file
  40. * This should be the id of the file and not the file-name like in the
  41. * database!
  42. */
  43. var $media;
  44. /**
  45. * Questions
  46. */
  47. var $question_ids;
  48. /**
  49. * Questions orders
  50. */
  51. var $question_orders;
  52. /**
  53. * Max attempts
  54. */
  55. var $attempts;
  56. /**
  57. * Results disabled
  58. */
  59. var $results_disabled;
  60. /**
  61. * Access condition
  62. */
  63. var $access_condition;
  64. /**
  65. * Start time
  66. */
  67. var $start_time;
  68. /**
  69. * End time
  70. */
  71. var $end_time;
  72. /**
  73. * Feedback type
  74. */
  75. var $feedback_type;
  76. /**
  77. * Random answers
  78. */
  79. var $random_answers;
  80. /**
  81. * Expired time
  82. */
  83. var $expired_time;
  84. /**
  85. * Create a new Quiz
  86. * @param string $title
  87. * @param string $description
  88. * @param int $random
  89. * @param int $type
  90. * @param int $active
  91. */
  92. function Quiz($id, $title, $description, $random, $type, $active, $media, $attempts = 0, $results_disabled = 0, $access_condition = null,
  93. $start_time = '0000-00-00 00:00:00', $end_time = '0000-00-00 00:00:00', $feedback_type = 0, $random_answers = 0, $expired_time = 0, $session_id = 0)
  94. {
  95. parent::Resource($id, RESOURCE_QUIZ);
  96. $this->title = $title;
  97. $this->description = $description;
  98. $this->random = $random;
  99. $this->quiz_type = $type;
  100. $this->active = $active;
  101. $this->media = $media;
  102. $this->attempts = $attempts;
  103. $this->question_ids = array();
  104. $this->question_orders= array();
  105. $this->results_disabled = $results_disabled;
  106. $this->access_condition = $access_condition;
  107. $this->start_time = $start_time;
  108. $this->end_time = $end_time;
  109. $this->feedback_type = $feedback_type;
  110. $this->random_answers = $random_answers;
  111. $this->expired_time = $expired_time;
  112. $this->session_id = $session_id;
  113. }
  114. /**
  115. * Add a question to this Quiz
  116. */
  117. function add_question($id,$question_order)
  118. {
  119. $this->question_ids[] = $id;
  120. $this->question_orders[] = $question_order;
  121. }
  122. /**
  123. * Show this question
  124. */
  125. function show()
  126. {
  127. parent::show();
  128. echo $this->title;
  129. }
  130. }