function showNoticeQuestion(Notice $notice, $out)
 {
     $user = common_current_user();
     // @hack we want regular rendering, then just add stuff after that
     $nli = new NoticeListItem($notice, $out);
     $nli->showNotice();
     $out->elementStart('div', array('class' => 'e-content question-description'));
     $question = QnA_Question::getByNotice($notice);
     if (!empty($question)) {
         $form = new QnashowquestionForm($out, $question);
         $form->show();
     } else {
         // TRANS: Error message displayed when question data is not present.
         $out->text(_m('Question data is missing.'));
     }
     $out->elementEnd('div');
     // @fixme
     $out->elementStart('div', array('class' => 'e-content'));
 }
Beispiel #2
0
 /**
  * Close a question
  *
  * @return void
  */
 function closeQuestion()
 {
     $user = common_current_user();
     try {
         if ($user->id != $this->question->profile_id) {
             // TRANS: Exception thrown trying to close another user's question.
             throw new Exception(_m('You did not ask this question.'));
         }
         $orig = clone $this->question;
         $this->question->closed = 1;
         $this->question->update($orig);
     } 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 an answer.
         $this->element('title', null, _m('Answers'));
         $this->elementEnd('head');
         $this->elementStart('body');
         $form = new QnashowquestionForm($this, $this->question);
         $form->show();
         $this->elementEnd('body');
         $this->elementEnd('html');
     } else {
         common_redirect($this->question->bestUrl(), 303);
     }
 }