SurveyQuestion.class.php 1.9 KB

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