Merge branch 'MDL-48822-master' of git://github.com/andrewnicols/moodle

This commit is contained in:
David Monllao
2015-02-10 14:10:28 +08:00
+18
View File
@@ -1947,6 +1947,20 @@ function forum_get_all_discussion_posts($discussionid, $sort, $tracking=false) {
$posts[$p->parent]->children[$pid] =& $posts[$pid];
}
// Start with the last child of the first post.
$post = &$posts[reset($posts)->id];
$lastpost = false;
while (!$lastpost) {
if (!isset($post->children)) {
$post->lastpost = true;
$lastpost = true;
} else {
// Go to the last child of this post.
$post = &$posts[end($post->children)->id];
}
}
return $posts;
}
@@ -3374,6 +3388,10 @@ function forum_print_post($post, $discussion, $forum, &$cm, $course, $ownpost=fa
$topicclass = ' firstpost starter';
}
if (!empty($post->lastpost)) {
$forumpostclass = ' lastpost';
}
$postbyuser = new stdClass;
$postbyuser->post = $post->subject;
$postbyuser->user = $postuser->fullname;