]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/QnA/lib/qnanewanswerform.php
Update translator documentation.
[quix0rs-gnu-social.git] / plugins / QnA / lib / qnanewanswerform.php
index 967b27e70cdcad868310c7a7be0c12b6ee163ccf..e3ef9ba42c464fc52bbbb79e37d1634e45eff27c 100644 (file)
@@ -47,6 +47,7 @@ if (!defined('STATUSNET')) {
 class QnanewanswerForm extends Form
 {
     protected $question;
+    protected $showQuestion;
 
     /**
      * Construct a new answer form
@@ -56,10 +57,11 @@ class QnanewanswerForm extends 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;
     }
 
     /**
@@ -79,7 +81,7 @@ class QnanewanswerForm extends Form
      */
     function formClass()
     {
-        return 'form_settings ajax';
+        return 'form_settings qna_answer_form ajax-notice';
     }
 
     /**
@@ -103,9 +105,12 @@ class QnanewanswerForm extends Form
         $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');
     }
 
     /**
@@ -116,7 +121,6 @@ class QnanewanswerForm extends Form
     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');
     }
 }
-