";
$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));
}
/**
* @param array $pools
* @param string $heading
* @param bool $check_all
*/
private function display_top(/*array*/ $pools, /*string*/ $heading, $check_all=false) {
global $page, $user;
$page->set_title($heading);
$page->set_heading($heading);
$nav_html = 'Index';
$poolnav_html = '
Pool Index Create Pool Pool Changes
';
$page->add_block(new Block($nav_html, null, "left", 5));
$page->add_block(new Block("Pool Navigation", $poolnav_html, "left", 10));
if(count($pools) == 1) {
$pool = $pools[0];
if($pool['public'] == "Y" || $user->is_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);
}
}
$bb = new BBCode();
$page->add_block(new Block(html_escape($pool['title']), $bb->format($pool['description']), "main", 10));
}
}
/**
* HERE WE DISPLAY THE POOL WITH TITLE DESCRIPTION AND IMAGES WITH PAGINATION.
*
* @param array $pools
* @param array $images
* @param int $pageNumber
* @param int $totalPages
*/
public function view_pool(/*array*/ $pools, /*array*/ $images, /*int*/ $pageNumber, /*int*/ $totalPages) {
global $user, $page;
$this->display_top($pools, "Pool: ".html_escape($pools[0]['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/".$pools[0]['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.
*
* @param Page $page
* @param array $pool
* @param bool $check_all
*/
public function sidebar_options(Page $page, $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') ).'
';
if($user->id == $pool['user_id'] || $user->is_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.
*
* @param Page $page
* @param array $images
* @param array $pool
*/
public function pool_result(Page $page, /*array*/ $images, /*array*/ $pool) {
$this->display_top($pool, "Importing Posts", true);
$pool_images = "
";
$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
*
* @param Page $page
* @param array $pools
* @param array $images
*/
public function edit_order(Page $page, /*array*/ $pools, /*array*/ $images) {
global $user;
$this->display_top($pools, "Sorting Pool");
$pool_images = "\n";
$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
*
* @param Page $page
* @param array $pools
* @param array $images
*/
public function edit_pool(Page $page, /*array*/ $pools, /*array*/ $images) {
global $user;
/* EDIT POOL DESCRIPTION */
$desc_html = "
".make_form(make_link("pool/edit_description"))."
";
/* REMOVE POOLS */
$pool_images = "\n";
$pools[0]['description'] = ""; //This is a rough fix to avoid showing the description twice.
$this->display_top($pools, "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.
*
* @param array $histories
* @param int $pageNumber
* @param int $totalPages
*/
public function show_history($histories, /*int*/ $pageNumber, /*int*/ $totalPages) {
global $page;
$html = '