body;
$categories = ['artworks', 'illustrations', 'manga', 'bookmarks'];
if (!isset($_GET['category']) || !in_array($_GET['category'], $categories)) {
$_GET['category'] = 'artworks';
}
$category = $_GET['category'];
$pathname = BASE_URL . "/users/$id";
render_page_header($info->name);
?>
= htmlspecialchars($info->name) ?>
= render_truncated_text(str_replace(PHP_EOL, "
", htmlspecialchars($info->comment))) ?>
0) ? $_GET['p'] : 1;
list($bookmarks, $error) = get_user_bookmarks(
$id,
ARTWORKS_PER_PAGE * ($current_page - 1),
ARTWORKS_PER_PAGE
);
if ($error) { ?>
= get_string($error); ?>
body;
$page_count = ceil($bookmarks->total / ARTWORKS_PER_PAGE);?>
= sprintf(get_string('user.work-count'), $bookmarks->total) ?>
works, true);
render_paginator($page_count, $current_page, function($page) use ($pathname) {
return "$pathname/bookmarks?p=$page#artworks";
});
break;
case (isset($_GET['tag']) && strlen($_GET['tag'])):
/* all/illusts/manga tab with tag */
$tag = $_GET['tag'];
$current_page = (isset($_GET['p']) && ctype_digit($_GET['p']) && $_GET['p'] > 0) ? $_GET['p'] : 1;
list($artworks, $error) = get_user_artworks_with_tag(
$id, $category, $tag,
ARTWORKS_PER_PAGE * ($current_page - 1), ARTWORKS_PER_PAGE
);
if ($error) { ?>
= get_string($error); ?>
body;
$page_count = ceil($artworks->total / ARTWORKS_PER_PAGE); ?>
= sprintf(get_string('user.work-count-with-tag'), htmlspecialchars($tag), $artworks->total) ?>
works);
render_paginator($page_count, $current_page, function($page) use ($pathname, $category, $tag) {
$tag_encoded = urlencode($tag);
return "$pathname/$category/$tag_encoded?p=$page#artworks";
});
break;
default:
/* all/illusts/manga tab without tag */
list($artworks_list, $error) = get_user_artworks_list($id);
if ($error) { ?>
= get_string($error); ?>
= sprintf(get_string('user.work-count'), $artwork_count) ?>
= get_string('no-works') ?>
body ?>
0 && $_GET['p'] <= $page_count
) ? $_GET['p'] : 1;
$selected_ids_in_page = array_slice($selected_ids, ($current_page - 1) * ARTWORKS_PER_PAGE, ARTWORKS_PER_PAGE);
list($artworks, $error) = get_user_artworks($id, $selected_ids_in_page);
if ($error) { ?>
= get_string($error) ?>
body->works;
render_artworks_grid($artworks);
render_paginator($page_count, $current_page, function($page) use ($pathname, $category) {
return "$pathname/$category?p=$page#artworks";
});
} ?>