Exemplo n.º 1
0
 /**
  * Add a new answer
  *
  * @return void
  */
 function answer()
 {
     try {
         $notice = Answer::saveNew($this->user->getProfile(), $this->question, $this->answer);
     } catch (ClientException $ce) {
         $this->error = $ce->getMessage();
         $this->showPage();
         return;
     }
     if ($this->boolean('ajax')) {
         header('Content-Type: text/xml;charset=utf-8');
         $this->xw->startDocument('1.0', 'UTF-8');
         $this->elementStart('html');
         $this->elementStart('head');
         // TRANS: Page title after sending in a vote for a question or answer.
         $this->element('title', null, _m('Answers'));
         $this->elementEnd('head');
         $this->elementStart('body');
         $form = new QnA_Answer($this->question, $this);
         $form->show();
         $this->elementEnd('body');
         $this->elementEnd('html');
     } else {
         common_redirect($this->question->bestUrl(), 303);
     }
 }