- /**
- * Custom HTML output for our notices
- *
- * @param Notice $notice
- * @param HTMLOutputter $out
- */
- function showNotice($notice, $out)
- {
- switch ($notice->object_type) {
- case QnA_Question::OBJECT_TYPE:
- return $this->showNoticeQuestion($notice, $out);
- case QnA_Answer::OBJECT_TYPE:
- return $this->showNoticeAnswer($notice, $out);
- default:
- throw new Exception(
- // TRANS: Exception thrown when performing an unexpected action on a question.
- // TRANS: %s is the unpexpected object type.
- sprintf(_m('Unexpected type for QnA plugin: %s.'),
- $notice->object_type
- )
- );
- }
- }
-
- function showNoticeQuestion($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' => 'entry-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' => 'entry-content'));
- }
-