Quiz.class.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. var $attempts;
  59. /**
  60. * Create a new Quiz
  61. * @param string $title
  62. * @param string $description
  63. * @param int $random
  64. * @param int $type
  65. * @param int $active
  66. */
  67. function Quiz($id,$title,$description,$random,$type,$active,$media,$attempts=0)
  68. {
  69. parent::Resource($id,RESOURCE_QUIZ);
  70. $this->title = $title;
  71. $this->description = $description;
  72. $this->random = $random;
  73. $this->quiz_type = $type;
  74. $this->active = $active;
  75. $this->media = $media;
  76. $this->attempts = $attempts;
  77. $this->question_ids = array();
  78. }
  79. /**
  80. * Add a question to this Quiz
  81. */
  82. function add_question($id)
  83. {
  84. $this->question_ids[] = $id;
  85. }
  86. /**
  87. * Show this question
  88. */
  89. function show()
  90. {
  91. parent::show();
  92. echo $this->title;
  93. }
  94. }
  95. ?>