Exemplo n.º 1
0
	/**
	 * Creates / stores question answer from question instance into
	 * question data instance.
	 * @param  $question  qp_StubQuestion
	 *   instance of question which has current user vote
	 */
	public function setQuestion( qp_StubQuestion $question ) {
		if ( $this->questionExists( $question->mQuestionId ) ) {
			# question data already exists, poll structure was stored during previous
			# submission.
			# question, category and proposal descriptions are already loaded into
			# $this->Questions[$question->mQuestionId] by $this->loadQuestions()
			# but might have pending update, if the source of the poll was modified
			$this->Questions[$question->mQuestionId]->applyQuestion( $question );
		} else {
			# create new question data from scratch (first submission)
			$this->Questions[$question->mQuestionId] = qp_QuestionData::factory( $question );
		}
	}