SurveyQuestion.class.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?php // $Id: $
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004-2007 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 QuizQuestion
  23. * @author Yannick Warnier <yannick.warnier@dokeos.com>
  24. * @package dokeos.backup
  25. */
  26. class SurveyQuestion extends Resource
  27. {
  28. /**
  29. * Survey ID
  30. */
  31. var $survey_id;
  32. /**
  33. * Question and question comment
  34. */
  35. var $survey_question;
  36. var $survey_question_comment;
  37. /**
  38. * Question type
  39. */
  40. var $survey_question_type;
  41. /**
  42. * Display ?
  43. */
  44. var $display;
  45. /**
  46. * Sorting order
  47. */
  48. var $sort;
  49. /**
  50. * Shared question ID
  51. */
  52. var $shared_question_id;
  53. /**
  54. * Maximum value for the vote
  55. */
  56. var $max_value;
  57. /**
  58. * Question's options
  59. */
  60. var $options;
  61. /**
  62. * Create a new SurveyQuestion
  63. * @param int $id
  64. * @param int $survey_id
  65. * @param string $survey_question
  66. * @param string $survey_question_comment
  67. * @param string $type
  68. * @param string $display
  69. * @param int $sort
  70. * @param int $shared_question_id
  71. * @param int $max_value
  72. */
  73. function SurveyQuestion($id,$survey_id,$survey_question,$survey_question_comment,
  74. $type,$display,$sort,$shared_question_id,$max_value)
  75. {
  76. parent::Resource($id,RESOURCE_SURVEYQUESTION);
  77. $this->survey_id = $survey_id;
  78. $this->survey_question = $survey_question;
  79. $this->survey_question_comment = $survey_question_comment;
  80. $this->survey_question_type = $type;
  81. $this->display = $display;
  82. $this->sort = $sort;
  83. $this->shared_question_id = $shared_question_id;
  84. $this->max_value = $max_value;
  85. $this->answers = array();
  86. }
  87. /**
  88. * Add an answer option to this SurveyQuestion
  89. * @param string $option_text
  90. * @param int $sort
  91. */
  92. function add_answer($option_text,$sort)
  93. {
  94. $answer = array();
  95. $answer['option_text'] = $option_text;
  96. $answer['sort'] = $sort;
  97. $this->answers[] = $answer;
  98. }
  99. /**
  100. * Show this question
  101. */
  102. function show()
  103. {
  104. parent::show();
  105. echo $this->survey_question;
  106. }
  107. }
  108. ?>