class QnanewanswerForm extends Form
{
protected $question;
+ protected $showQuestion;
/**
* Construct a new answer form
*
* @return void
*/
- function __construct(QnA_Question $question, HTMLOutputter $out)
+ function __construct(HTMLOutputter $out, QnA_Question $question, $showQuestion = false)
{
parent::__construct($out);
$this->question = $question;
+ $this->showQuestion = $showQuestion;
}
/**
*/
function formClass()
{
- return 'form_settings ajax';
+ return 'form_settings qna_answer_form ajax-notice';
}
/**
$out = $this->out;
$id = "question-" . $question->id;
- $out->element('p', 'answer', $question->title);
- $out->hidden('id', $id);
- $out->element('input', array('type' => 'text', 'name' => 'answer'));
+ if ($this->showQuestion) {
+ $out->raw($this->question->asHTML());
+ }
+
+ $out->hidden('qna-question-id', $id, 'id');
+ $out->textarea('qna-answer', _m('Enter your answer'), null, null, 'answer');
}
/**
function formActions()
{
// TRANS: Button text for submitting a poll response.
- $this->out->submit('submit', _m('BUTTON', 'Submit'));
+ $this->out->submit('qna-answer-submit', _m('BUTTON', 'Answer'), 'submit', 'submit');
}
}
-