Quiz.class.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <?php // $Id: Quiz.class.php 15802 2008-07-17 04:52:13Z 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 Quiz
  23. * @author Bart Mollet <bart.mollet@hogent.be>
  24. * @package dokeos.backup
  25. */
  26. class Quiz extends Resource
  27. {
  28. /**
  29. * The title
  30. */
  31. var $title;
  32. /**
  33. * The description
  34. */
  35. var $description;
  36. /**
  37. * random
  38. */
  39. var $random;
  40. /**
  41. * Type
  42. */
  43. var $quiz_type;
  44. /**
  45. * Active
  46. */
  47. var $active;
  48. /**
  49. * Sound or video file
  50. * This should be the id of the file and not the file-name like in the
  51. * database!
  52. */
  53. var $media;
  54. /**
  55. * Questions
  56. */
  57. var $question_ids;
  58. /**
  59. * Max attempts
  60. */
  61. var $attempts;
  62. /**
  63. * Results disabled
  64. */
  65. var $results_disabled;
  66. /**
  67. * Access condition
  68. */
  69. var $access_condition;
  70. /**
  71. * Start time
  72. */
  73. var $start_time;
  74. /**
  75. * End time
  76. */
  77. var $end_time;
  78. /**
  79. * Feedback type
  80. */
  81. var $feedback_type;
  82. /**
  83. * Create a new Quiz
  84. * @param string $title
  85. * @param string $description
  86. * @param int $random
  87. * @param int $type
  88. * @param int $active
  89. */
  90. function Quiz($id, $title, $description, $random, $type, $active, $media, $attempts = 0, $results_disabled = 0, $access_condition = null, $start_time = '0000-00-00 00:00:00', $end_time = '0000-00-00 00:00:00', $feedback_type = 0)
  91. {
  92. parent::Resource($id, RESOURCE_QUIZ);
  93. $this->title = $title;
  94. $this->description = $description;
  95. $this->random = $random;
  96. $this->quiz_type = $type;
  97. $this->active = $active;
  98. $this->media = $media;
  99. $this->attempts = $attempts;
  100. $this->question_ids = array();
  101. $this->results_disabled = $results_disabled;
  102. $this->access_condition = $access_condition;
  103. $this->start_time = $start_time;
  104. $this->end_time = $end_time;
  105. $this->feedback_type = $feedback_type;
  106. }
  107. /**
  108. * Add a question to this Quiz
  109. */
  110. function add_question($id)
  111. {
  112. $this->question_ids[] = $id;
  113. }
  114. /**
  115. * Show this question
  116. */
  117. function show()
  118. {
  119. parent::show();
  120. echo $this->title;
  121. }
  122. }