示例#1
0
 /**
  * Create output for post information (Title, date, user)
  * Returns content and user object (discussion poster, null if anon)
  * @param object $forum
  * @param object $discussion
  * @param object $post
  * @return array content html, poster user object
  */
 public function render_usage_post_info($forum, $discussion, mod_forumng_post $post)
 {
     $user = $post->get_user();
     $link = html_writer::link($post->get_url(), format_string($post->get_effective_subject()));
     $content = html_writer::div($link);
     $content .= html_writer::div(mod_forumng_utils::display_date($post->get_created()));
     $content .= html_writer::start_div('fng_userlink');
     if ($post->get_asmoderator() == mod_forumng::ASMODERATOR_ANON && !$forum->can_post_anonymously()) {
         // Hide user details if anon post and user does not have permission to see.
         $user = null;
     } else {
         $content .= $forum->display_user_link($user) . ' ';
     }
     if ($post->get_asmoderator() != mod_forumng::ASMODERATOR_NO) {
         $content .= get_string('moderator', 'mod_forumng');
     }
     $content .= html_writer::end_div();
     return array($content, $user);
 }