$images
*/
public function display_comment_list(array $images, int $page_number, int $total_pages, bool $can_post): void
{
global $config, $page, $user;
$page->disable_left();
// parts for the whole page
$prev = $page_number - 1;
$next = $page_number + 1;
$h_prev = ($page_number <= 1) ? "Prev" :
"Prev";
$h_index = "Index";
$h_next = ($page_number >= $total_pages) ? "Next" :
"Next";
$nav = "$h_prev | $h_index | $h_next";
$page->set_title("Comments");
$page->set_heading("Comments");
$page->add_block(new Block("Navigation", $nav, "left"));
$this->display_paginator($page, "comment/list", null, $page_number, $total_pages);
// parts for each image
$position = 10;
$comment_captcha = $config->get_bool('comment_captcha');
$comment_limit = $config->get_int("comment_list_count", 10);
foreach ($images as $pair) {
$image = $pair[0];
$comments = $pair[1];
$thumb_html = $this->build_thumb_html($image);
$s = " ";
$un = $image->get_owner()->name;
$t = "";
foreach ($image->get_tag_array() as $tag) {
$t .= "".html_escape($tag)." ";
}
$p = autodate($image->posted);
$r = Extension::is_enabled(RatingsInfo::KEY) ? "Rating ".Ratings::rating_to_human($image['rating']) : "";
$comment_html = "Date $p $s User $un $s $r
Tags $t
"; $comment_count = count($comments); if ($comment_limit > 0 && $comment_count > $comment_limit) { //$hidden = $comment_count - $comment_limit; $comment_html .= "
showing $comment_limit of $comment_count comments
"; $comments = array_slice($comments, negative_int($comment_limit)); } foreach ($comments as $comment) { $comment_html .= $this->comment_to_html($comment); } if ($can_post) { if (!$user->is_anonymous()) { $comment_html .= $this->build_postbox($image->id); } else { if (!$comment_captcha) { $comment_html .= $this->build_postbox($image->id); } else { $comment_html .= "Add Comment"; } } } $html = "$thumb_html | $comment_html |
$h_userlink $h_del
$h_posted
$h_comment
$h_userlink $h_posted$h_del |
$h_comment |