- function onEndNoticeAsActivity($notice, &$act) {
- switch ($notice->object_type) {
- case Answer::NORMAL:
- case Answer::ANONYMOUS:
- $act->verb = $notice->object_type;
+ function onStartOpenNoticeListItemElement($nli)
+ {
+ $type = $nli->notice->object_type;
+
+ switch($type)
+ {
+ case QnA_Question::OBJECT_TYPE:
+ $id = (empty($nli->repeat)) ? $nli->notice->id : $nli->repeat->id;
+ $class = 'h-entry notice question';
+ if ($nli->notice->scope != 0 && $nli->notice->scope != 1) {
+ $class .= ' limited-scope';
+ }
+
+ $question = QnA_Question::getKV('uri', $nli->notice->uri);
+
+ if (!empty($question->closed)) {
+ $class .= ' closed';
+ }
+
+ $nli->out->elementStart(
+ 'li', array(
+ 'class' => $class,
+ 'id' => 'notice-' . $id
+ )
+ );
+ Event::handle('EndOpenNoticeListItemElement', array($nli));
+ return false;
+ break;
+ case QnA_Answer::OBJECT_TYPE:
+ $id = (empty($nli->repeat)) ? $nli->notice->id : $nli->repeat->id;
+
+ $cls = array('h-entry', 'notice', 'answer');
+
+ $answer = QnA_Answer::getKV('uri', $nli->notice->uri);
+
+ if (!empty($answer) && !empty($answer->best)) {
+ $cls[] = 'best';
+ }
+
+ $nli->out->elementStart(
+ 'li',
+ array(
+ 'class' => implode(' ', $cls),
+ 'id' => 'notice-' . $id
+ )
+ );
+ Event::handle('EndOpenNoticeListItemElement', array($nli));
+ return false;