SurveyQuestion.class.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. require_once 'Resource.class.php';
  4. /**
  5. * A SurveyQuestion
  6. * @author Yannick Warnier <yannick.warnier@beeznest.com>
  7. * @package chamilo.backup
  8. */
  9. class SurveyQuestion extends Resource
  10. {
  11. /**
  12. * Survey ID
  13. */
  14. var $survey_id;
  15. /**
  16. * Question and question comment
  17. */
  18. var $survey_question;
  19. var $survey_question_comment;
  20. /**
  21. * Question type
  22. */
  23. var $survey_question_type;
  24. /**
  25. * Display ?
  26. */
  27. var $display;
  28. /**
  29. * Sorting order
  30. */
  31. var $sort;
  32. /**
  33. * Shared question ID
  34. */
  35. var $shared_question_id;
  36. /**
  37. * Maximum value for the vote
  38. */
  39. var $max_value;
  40. /**
  41. * Question's options
  42. */
  43. var $options;
  44. /**
  45. * Create a new SurveyQuestion
  46. * @param int $id
  47. * @param int $survey_id
  48. * @param string $survey_question
  49. * @param string $survey_question_comment
  50. * @param string $type
  51. * @param string $display
  52. * @param int $sort
  53. * @param int $shared_question_id
  54. * @param int $max_value
  55. */
  56. function __construct(
  57. $id,
  58. $survey_id,
  59. $survey_question,
  60. $survey_question_comment,
  61. $type,
  62. $display,
  63. $sort,
  64. $shared_question_id,
  65. $max_value
  66. ) {
  67. parent::__construct($id,RESOURCE_SURVEYQUESTION);
  68. $this->survey_id = $survey_id;
  69. $this->survey_question = $survey_question;
  70. $this->survey_question_comment = $survey_question_comment;
  71. $this->survey_question_type = $type;
  72. $this->display = $display;
  73. $this->sort = $sort;
  74. $this->shared_question_id = $shared_question_id;
  75. $this->max_value = $max_value;
  76. $this->answers = array();
  77. }
  78. /**
  79. * Add an answer option to this SurveyQuestion
  80. * @param string $option_text
  81. * @param int $sort
  82. */
  83. function add_answer($option_text,$sort)
  84. {
  85. $answer = array();
  86. $answer['option_text'] = $option_text;
  87. $answer['sort'] = $sort;
  88. $this->answers[] = $answer;
  89. }
  90. /**
  91. * Show this question
  92. */
  93. function show()
  94. {
  95. parent::show();
  96. echo $this->survey_question;
  97. }
  98. }