SurveyQuestion.class.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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 SurveyQuestion($id,$survey_id,$survey_question,$survey_question_comment,
  57. $type,$display,$sort,$shared_question_id,$max_value)
  58. {
  59. parent::Resource($id,RESOURCE_SURVEYQUESTION);
  60. $this->survey_id = $survey_id;
  61. $this->survey_question = $survey_question;
  62. $this->survey_question_comment = $survey_question_comment;
  63. $this->survey_question_type = $type;
  64. $this->display = $display;
  65. $this->sort = $sort;
  66. $this->shared_question_id = $shared_question_id;
  67. $this->max_value = $max_value;
  68. $this->answers = array();
  69. }
  70. /**
  71. * Add an answer option to this SurveyQuestion
  72. * @param string $option_text
  73. * @param int $sort
  74. */
  75. function add_answer($option_text,$sort)
  76. {
  77. $answer = array();
  78. $answer['option_text'] = $option_text;
  79. $answer['sort'] = $sort;
  80. $this->answers[] = $answer;
  81. }
  82. /**
  83. * Show this question
  84. */
  85. function show()
  86. {
  87. parent::show();
  88. echo $this->survey_question;
  89. }
  90. }