/** * @param string $from * @param SurveyQuestion $question * @param string $answerString */ private function persistAnswer($from, SurveyQuestion $question, $answerString) { $answer = new SurveyAnswer(); $answer->setAnswer($answerString); $answer->setAnsweredBy($from); //Persist the answer $this->surveyManager->addAnswer($question->getId(), $answer); }
/** * Adds a table row with the summary stats for the provided question. * * @since 0.1 * * @param SurveyQuestion $question */ protected function displayQuestionStats(SurveyQuestion $question) { static $qNr = 0; $out = $this->getOutput(); $out->addHTML('<tr>'); $out->addHTML(Html::element('td', array('data-sort-value' => ++$qNr), wfMsgExt('surveys-surveystats-question-#', 'parsemag', $qNr))); $out->addHTML(Html::element('td', array(), wfMsg(SurveyQuestion::getTypeMessage($question->getField('type'))))); $out->addHTML(Html::element('td', array(), $question->getField('text'))); $out->addHTML(Html::element('td', array(), SurveyAnswer::count(array('question_id' => $question->getId())))); $out->addHTML(Html::rawElement('td', array(), $this->getAnswerList($question))); $out->addHTML('</tr>'); }