$poolInfo) { $linksPools[] = "" . html_escape($poolInfo['info']->title) . ""; if (!empty($poolInfo['nav'])) { $navlinks = ""; if (!empty($poolInfo['nav']['prev'])) { $navlinks .= 'Prev'; } if (!empty($poolInfo['nav']['next'])) { $navlinks .= 'Next'; } if (!empty($navlinks)) { $navlinks .= "
"; $linksPools[] = $navlinks; } } } if (count($linksPools) > 0) { $page->add_block(new Block("Pools", implode("
", $linksPools), "left")); } } public function get_adder_html(Image $image, array $pools): string { $h = ""; foreach ($pools as $pool) { $h .= ""; } return "\n" . make_form(make_link("pool/add_post")) . " "; } /** * HERE WE SHOWS THE LIST OF POOLS. */ public function list_pools(Page $page, array $pools, int $pageNumber, int $totalPages) { $html = ' '; // Build up the list of pools. foreach ($pools as $pool) { $pool_link = 'id) . '">' . html_escape($pool->title) . ""; $user_link = 'user_name)) . '">' . html_escape($pool->user_name) . ""; $public = ($pool->public ? "Yes" : "No"); $html .= "" . "" . "" . "" . "" . ""; } $html .= "
Name Creator Posts Public
" . $pool_link . "" . $user_link . "" . $pool->posts . "" . $public . "
"; $order_html = ''; $this->display_top(null, "Pools"); $page->add_block(new Block("Order By", $order_html, "left", 15)); $page->add_block(new Block("Pools", $html, "main", 10)); $this->display_paginator($page, "pool/list", null, $pageNumber, $totalPages); } /* * HERE WE DISPLAY THE NEW POOL COMPOSER */ public function new_pool_composer(Page $page) { $create_html = " " . make_form(make_link("pool/create")) . "
Title:
Public?
Description:
"; $this->display_top(null, "Create Pool"); $page->add_block(new Block("Create Pool", $create_html, "main", 20)); } private function display_top(?Pool $pool, string $heading, bool $check_all = false) { global $page, $user; $page->set_title($heading); $page->set_heading($heading); $poolnav_html = ' Pool Index
Create Pool
Pool Changes '; $page->add_block(new NavBlock()); $page->add_block(new Block("Pool Navigation", $poolnav_html, "left", 10)); if (!is_null($pool)) { if ($pool->public || $user->can(Permissions::POOLS_ADMIN)) {// IF THE POOL IS PUBLIC OR IS ADMIN SHOW EDIT PANEL if (!$user->is_anonymous()) {// IF THE USER IS REGISTERED AND LOGGED IN SHOW EDIT PANEL $this->sidebar_options($page, $pool, $check_all); } } $tfe = new TextFormattingEvent($pool->description); send_event($tfe); $page->add_block(new Block(html_escape($pool->title), $tfe->formatted, "main", 10)); } } /** * HERE WE DISPLAY THE POOL WITH TITLE DESCRIPTION AND IMAGES WITH PAGINATION. */ public function view_pool(Pool $pool, array $images, int $pageNumber, int $totalPages) { global $page; $this->display_top($pool, "Pool: " . html_escape($pool->title)); $pool_images = ''; foreach ($images as $image) { $thumb_html = $this->build_thumb_html($image); $pool_images .= "\n" . $thumb_html . "\n"; } $page->add_block(new Block("Viewing Posts", $pool_images, "main", 30)); $this->display_paginator($page, "pool/view/" . $pool->id, null, $pageNumber, $totalPages); } /** * HERE WE DISPLAY THE POOL OPTIONS ON SIDEBAR BUT WE HIDE REMOVE OPTION IF THE USER IS NOT THE OWNER OR ADMIN. */ public function sidebar_options(Page $page, Pool $pool, bool $check_all) { global $user; $editor = "\n" . make_form(make_link('pool/import')) . ' ' . make_form(make_link('pool/edit')) . ' ' . make_form(make_link('pool/order')) . ' ' . make_form(make_link('pool/reverse')) . ' ' . make_form(make_link('post/list/pool_id%3A' . $pool->id . '/1')) . ' '; if ($user->id == $pool->user_id || $user->can(Permissions::POOLS_ADMIN)) { $editor .= " " . make_form(make_link("pool/nuke")) . " "; } if ($check_all) { $editor .= "
"; } $page->add_block(new Block("Manage Pool", $editor, "left", 15)); } /** * HERE WE DISPLAY THE RESULT OF THE SEARCH ON IMPORT. */ public function pool_result(Page $page, array $images, Pool $pool) { $this->display_top($pool, "Importing Posts", true); $pool_images = " "; $pool_images .= "
"; foreach ($images as $image) { $thumb_html = $this->build_thumb_html($image); $pool_images .= '' . $thumb_html . '
' . '' . '
'; } $pool_images .= "
" . "" . "" . "
"; $page->add_block(new Block("Import", $pool_images, "main", 30)); } /** * HERE WE DISPLAY THE POOL ORDERER. * WE LIST ALL IMAGES ON POOL WITHOUT PAGINATION AND WITH A TEXT INPUT TO SET A NUMBER AND CHANGE THE ORDER */ public function edit_order(Page $page, Pool $pool, array $images) { $this->display_top($pool, "Sorting Pool"); $pool_images = "\n
"; $i = 0; foreach ($images as $image) { $thumb_html = $this->build_thumb_html($image); $pool_images .= '' . "\n" . $thumb_html . "\n" . '
' . '' . '
'; $i++; } $pool_images .= "
" . "" . "" . "
"; $page->add_block(new Block("Sorting Posts", $pool_images, "main", 30)); } /** * HERE WE DISPLAY THE POOL EDITOR. * * WE LIST ALL IMAGES ON POOL WITHOUT PAGINATION AND WITH * A CHECKBOX TO SELECT WHICH IMAGE WE WANT TO REMOVE */ public function edit_pool(Page $page, Pool $pool, array $images) { /* EDIT POOL DESCRIPTION */ $desc_html = " " . make_form(make_link("pool/edit_description")) . "
"; /* REMOVE POOLS */ $pool_images = "\n
"; foreach ($images as $image) { $thumb_html = $this->build_thumb_html($image); $pool_images .= '' . "\n" . $thumb_html . "\n" . '
' . '
'; } $pool_images .= "
" . "" . "" . "
"; $pool->description = ""; //This is a rough fix to avoid showing the description twice. $this->display_top($pool, "Editing Pool", true); $page->add_block(new Block("Editing Description", $desc_html, "main", 28)); $page->add_block(new Block("Editing Posts", $pool_images, "main", 30)); } /** * HERE WE DISPLAY THE HISTORY LIST. */ public function show_history(array $histories, int $pageNumber, int $totalPages) { global $page; $html = ' '; foreach ($histories as $history) { $pool_link = "" . html_escape($history['title']) . ""; $user_link = "" . html_escape($history['user_name']) . ""; $revert_link = "Revert"; if ($history['action'] == 1) { $prefix = "+"; } elseif ($history['action'] == 0) { $prefix = "-"; } else { throw new RuntimeException("history['action'] not in {0, 1}"); } $images = trim($history['images']); $images = explode(" ", $images); $image_link = ""; foreach ($images as $image) { $image_link .= "" . $prefix . $image . " "; } $html .= "" . "" . "" . "" . "" . "" . "" . ""; } $html .= "
Pool Post Count Changes Updater Date Action
" . $pool_link . "" . $history['count'] . "" . $image_link . "" . $user_link . "" . $history['date'] . "" . $revert_link . "
"; $this->display_top(null, "Recent Changes"); $page->add_block(new Block("Recent Changes", $html, "main", 10)); $this->display_paginator($page, "pool/updated", null, $pageNumber, $totalPages); } public function get_bulk_pool_selector(array $pools): string { $output = ""; } public function get_bulk_pool_input(array $search_terms): string { return ""; } public function get_help_html(): string { return '

Search for posts that are in a pool.

pool=1

Returns posts in pool #1.

pool=any

Returns posts in any pool.

pool=none

Returns posts not in any pool.

pool_by_name=swimming

Returns posts in the "swimming" pool.

pool_by_name=swimming_pool

Returns posts in the "swimming pool" pool. Note that the underscore becomes a space

'; } }