/** * show the content of the notice * * Shows the content of the notice. This is pre-rendered for efficiency * at save time. Some very old notices might not be pre-rendered, so * they're rendered on the spot. * * @return void */ function showContent() { $this->out->elementStart('p', array('class' => 'entry-content answer-content')); if ($this->notice->rendered) { $this->out->raw($this->notice->rendered); } else { // XXX: may be some uncooked notices in the DB, // we cook them right now. This should probably disappear in future // versions (>> 0.4.x) $this->out->raw(common_render_content($this->notice->content, $this->notice)); } if (!empty($this->answer)) { $form = new QnashowanswerForm($this->out, $this->answer); $form->show(); } else { // TRANS: Error message displayed when an answer has no content. $out->text(_m('Answer data is missing.')); } $this->out->elementEnd('p'); }
/** * Mark the answer as the "best" answer * * @return void */ function markBest() { $question = $this->question; $answer = $this->answer; try { // close the question to further answers $orig = clone $question; $question->closed = 1; $result = $question->update($orig); // mark this answer an the best answer $orig = clone $answer; $answer->best = 1; $result = $answer->update($orig); } catch (ClientException $ce) { $this->error = $ce->getMessage(); $this->showPage(); return; } if ($this->boolean('ajax')) { common_debug("ajaxy part"); 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('Answer')); $this->elementEnd('head'); $this->elementStart('body'); $form = new QnashowanswerForm($this, $answer); $form->show(); $this->elementEnd('body'); $this->elementEnd('html'); } else { common_redirect($this->answer->bestUrl(), 303); } }
/** * show the content of the notice * * Shows the content of the notice. This is pre-rendered for efficiency * at save time. Some very old notices might not be pre-rendered, so * they're rendered on the spot. * * @return void */ function showContent() { $this->out->elementStart('p', array('class' => 'e-content answer-content')); $this->out->raw($this->notice->getRendered()); if (!empty($this->answer)) { $form = new QnashowanswerForm($this->out, $this->answer); $form->show(); } else { // TRANS: Error message displayed when an answer has no content. $out->text(_m('Answer data is missing.')); } $this->out->elementEnd('p'); }
function showNoticeAnswer($notice, $out) { $user = common_current_user(); $answer = QnA_Answer::getByNotice($notice); $question = $answer->getQuestion(); $nli = new NoticeListItem($notice, $out); $nli->showNotice(); $out->elementStart('div', array('class' => 'entry-content answer-content')); if (!empty($answer)) { $form = new QnashowanswerForm($out, $answer); $form->show(); } else { // TRANS: Error message displayed when answer data is not present. $out->text(_m('Answer data is missing.')); } $out->elementEnd('div'); // @todo FIXME $out->elementStart('div', array('class' => 'entry-content')); }