get_bool("poolsInfoOnViewImage")){ if($linksPools <> " "){ $page->add_block(new Block("Pool Info", $editor, "main", 1)); } } } /* * HERE WE SHOWS THE LIST OF POOLS */ public function list_pools(Page $page, $pools, $pageNumber, $totalPages) { global $user; $html = ''. "". "". "". "". ""; if($user->is_admin()){ $html .= ""; } $html .= ""; $n = 0; foreach ($pools as $pool) { $oe = ($n++ % 2 == 0) ? "even" : "odd"; $pool_link = ''.$pool['title'].""; $user_link = ''.$pool['user_name'].""; $del_link = 'Delete'; if($pool['public'] == "Y"){ $public = "Yes"; } elseif($pool['public'] == "N"){ $public = "No"; } $html .= "". "". "". "". ""; if($user->is_admin()){ $html .= ""; } $html .= ""; } $html .= "
NameCreatorPostsPublicAction
".$pool_link."".$user_link."".$pool['posts']."".$public."".$del_link."
"; $blockTitle = "Pools"; $page->set_title(html_escape($blockTitle)); $page->set_heading(html_escape($blockTitle)); $page->add_block(new Block($blockTitle, $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) { $html = "
Title:
Public?
Description:
"; $blockTitle = "Create Pool"; $page->set_title(html_escape($blockTitle)); $page->set_heading(html_escape($blockTitle)); $page->add_block(new Block($blockTitle, $html, "main", 10)); } /* * HERE WE DISPLAY THE POOL WITH TITLE DESCRIPTION AND IMAGES WITH PAGINATION */ public function view_pool($pools, $images, $pageNumber, $totalPages) { global $user, $page; $pool_info = "". "". "". "". ""; $n = 0; foreach ($pools as $pool) { $oe = ($n++ % 2 == 0) ? "even" : "odd"; $pool_info .= "". "". "". ""; // this will make disasters if more than one pool comes in the parameter 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); } } $this->display_paginator($page, "pool/view/".$pool['id']."", null, $pageNumber, $totalPages); } $pool_info .= "
TitleDescription
".$pool['title']."".$pool['description']."
"; $page->set_title("Viewing Pool"); $page->set_heading("Viewing Pool"); $page->add_block(new Block("Viewing Pool", $pool_info, "main", 10)); $pool_images = ''; foreach($images as $pair) { $image = $pair[0]; $thumb_html = $this->build_thumb_html($image); $pool_images .= ''. ''.$thumb_html.''. ''; } //$pool_images .= print_r($images); $page->add_block(new Block("Viewing Posts", $pool_images, "main", 30)); } /* * 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){ global $user; $editor = "
"; if($user->id == $pool['user_id'] || $user->is_admin()){ $editor .= "
"; } $page->add_block(new Block("Manage Pool", $editor, "left", 10)); } /* * HERE WE DISPLAY THE RESULT OF THE SEARCH ON IMPORT */ public function pool_result(Page $page, $images, $pool_id){ $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", 10)); $editor = " "; $page->add_block(new Block("Manage Pool", $editor, "left", 10)); } /* * 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, $pools, $images) { global $user; $pool_info = "". "". "". "". ""; $n = 0; foreach ($pools as $pool) { $oe = ($n++ % 2 == 0) ? "even" : "odd"; $pool_info .= "". "". "". ""; } $pool_info .= "
TitleDescription
".$pool['title']."".$pool['description']."
"; $page->set_title("Sorting Pool"); $page->set_heading("Sorting Pool"); $page->add_block(new Block("Sorting Pool", $pool_info, "main", 10)); $pool_images = "
"; $n = 0; foreach($images as $pair) { $image = $pair[0]; $thumb_html = $this->build_thumb_html($image); $pool_images .= ''. ''.$thumb_html.''; $pool_images .= '
'. ''; $n = $n+1; $pool_images .= '
'; } $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 REMOVE */ public function edit_pool(Page $page, $pools, $images) { global $user; $pool_info = "". "". "". "". ""; $n = 0; foreach ($pools as $pool) { $oe = ($n++ % 2 == 0) ? "even" : "odd"; $pool_info .= "". "". "". ""; } $pool_info .= "
TitleDescription
".$pool['title']."".$pool['description']."
"; $page->set_title("Editing Pool"); $page->set_heading("Editing Pool"); $page->add_block(new Block("Editing Pool", $pool_info, "main", 10)); $pool_images = " "; $pool_images .= "
"; foreach($images as $pair) { $image = $pair[0]; $thumb_html = $this->build_thumb_html($image); $pool_images .= ''. ''.$thumb_html.''; $pool_images .= '
'; $pool_images .= '
'; } $pool_images .= "
". "". "". "
"; $page->add_block(new Block("Editing Posts", $pool_images, "main", 30)); $editor = " "; $page->add_block(new Block("Manage Pool", $editor, "left", 10)); } /* * HERE WE DISPLAY THE HISTORY LIST */ public function show_history($histories, $pageNumber, $totalPages){ global $page; $html = "". "". "". "". "". "". "". "". ""; $n = 0; foreach ($histories as $history) { $oe = ($n++ % 2 == 0) ? "even" : "odd"; $pool_link = "".$history['title'].""; $user_link = "".$history['user_name'].""; $revert_link = "Revert"; if ($history['action'] == 1) { $prefix = "+"; } elseif ($history['action'] == 0) { $prefix = "-"; } $images = trim($history['images']); $images = explode(" ", $images); $image_link = ""; foreach ($images as $image) { $image_link .= "".$prefix.$image." "; } $html .= "". "". "". "". "". "". "". ""; } $html .= "
PoolPost CountChangesUpdaterDateAction
".$pool_link."".$history['count']."".$image_link."".$user_link."".$history['date']."".$revert_link."
"; $page->set_title("Recent Changes"); $page->set_heading("Recent Changes"); $page->add_block(new Block("Recent Changes", $html, "main", 10)); $this->display_paginator($page, "pool/updated", null, $pageNumber, $totalPages); } /* * HERE WE DISPLAY THE ERROR */ public function display_error($errMessage){ global $page; $page->set_title("Error"); $page->set_heading("Error"); $page->add_block(new Block("Error", $errMessage, "main", 10)); } } ?>