示例#1
0
 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'));
 }
示例#2
0
 /**
  * Output the HTML for this kind of object in a list
  *
  * @param NoticeListItem $nli The list item being shown.
  *
  * @return boolean hook value
  *
  * @todo FIXME: WARNING WARNING WARNING this closes a 'div' that is implicitly opened in BookmarkPlugin's showNotice implementation
  */
 function onStartShowNoticeItem(NoticeListItem $nli)
 {
     if (!$this->isMyNotice($nli->notice)) {
         return true;
     }
     $out = $nli->out;
     $notice = $nli->notice;
     $nli->showNotice($notice, $out);
     $nli->showNoticeLink();
     $nli->showNoticeSource();
     $nli->showNoticeLocation();
     $nli->showPermalink();
     $nli->showNoticeOptions();
     if ($notice->object_type == QnA_Question::OBJECT_TYPE) {
         $user = common_current_user();
         $question = QnA_Question::getByNotice($notice);
         if (!empty($user) and !empty($question)) {
             $profile = $user->getProfile();
             $answer = $question->getAnswer($profile);
             // Output a placeholder input -- clicking on it will
             // bring up a real answer form
             // NOTE: this whole ul is just a placeholder
             if (empty($question->closed) && empty($answer)) {
                 $out->elementStart('ul', 'notices qna-dummy');
                 $out->elementStart('li', 'qna-dummy-placeholder');
                 $out->element('input', array('class' => 'placeholder', 'value' => _m('Your answer...')));
                 $out->elementEnd('li');
                 $out->elementEnd('ul');
             }
         }
     }
     return false;
 }