mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-48822 mod_forum: Add lastpost class to final post in discussion
Thanks to Lior Gil for the basis of the suggested fix.
This commit is contained in:
parent
4c27f52d91
commit
bfa7beceee
@ -1950,6 +1950,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;
|
||||
}
|
||||
|
||||
@ -3377,6 +3391,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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user