dos2unix and some other changes...
This commit is contained in:
parent
1c7ce5a3ac
commit
12745b9309
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,476 +1,488 @@
|
|||||||
<?php
|
<?php
|
||||||
class PoolsTheme extends Themelet {
|
class PoolsTheme extends Themelet {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* HERE WE ADD THE POOL INFO ON IMAGE
|
* HERE WE ADD THE POOL INFO ON IMAGE
|
||||||
*/
|
*/
|
||||||
public function pool_info($linksPools) {
|
public function pool_info($linksPools){
|
||||||
global $config, $page;
|
global $config, $page;
|
||||||
$editor = 'This post belongs to the '.$linksPools.' pool.';
|
$editor = 'This post belongs to the '.$linksPools.' pool.';
|
||||||
|
|
||||||
if($config->get_bool("poolsInfoOnViewImage")) {
|
if($config->get_bool("poolsInfoOnViewImage")){
|
||||||
if($linksPools <> " ") {
|
if($linksPools <> " "){
|
||||||
$page->add_block(new Block("Pool Info", $editor, "main", 1));
|
$page->add_block(new Block("Pool Info", $editor, "main", 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* HERE WE SHOWS THE LIST OF POOLS
|
* HERE WE SHOWS THE LIST OF POOLS
|
||||||
*/
|
*/
|
||||||
public function list_pools(Page $page, $pools, $pageNumber, $totalPages) {
|
public function list_pools(Page $page, $pools, $pageNumber, $totalPages)
|
||||||
global $user;
|
{
|
||||||
|
global $user;
|
||||||
$html = '<table id="poolsList" class="zebra">'.
|
|
||||||
"<thead><tr>".
|
$html = '<table id="poolsList" class="zebra">'.
|
||||||
"<th>Name</th>".
|
"<thead><tr>".
|
||||||
"<th>Creator</th>".
|
"<th>Name</th>".
|
||||||
"<th>Posts</th>".
|
"<th>Creator</th>".
|
||||||
"<th>Public</th>";
|
"<th>Posts</th>".
|
||||||
|
"<th>Public</th>";
|
||||||
if($user->is_admin()) {
|
|
||||||
$html .= "<th>Action</th>";
|
if($user->is_admin()){
|
||||||
}
|
$html .= "<th>Action</th>";
|
||||||
$html .= "</tr></thead>";
|
}
|
||||||
|
$html .= "</tr></thead>";
|
||||||
$n = 0;
|
|
||||||
foreach ($pools as $pool) {
|
$n = 0;
|
||||||
$oe = ($n++ % 2 == 0) ? "even" : "odd";
|
foreach ($pools as $pool)
|
||||||
|
{
|
||||||
$pool_link = '<a href="'.make_link("pool/view/".$pool['id']).'">'.$pool['title']."</a>";
|
$oe = ($n++ % 2 == 0) ? "even" : "odd";
|
||||||
$user_link = '<a href="'.make_link("user/".$pool['user_name']).'">'.$pool['user_name']."</a>";
|
|
||||||
$del_link = '<a href="'.make_link("pool/nuke/".$pool['id']).'">Delete</a>';
|
$pool_link = '<a href="'.make_link("pool/view/".$pool['id']).'">'.$pool['title']."</a>";
|
||||||
|
$user_link = '<a href="'.make_link("user/".$pool['user_name']).'">'.$pool['user_name']."</a>";
|
||||||
if($pool['public'] == "Y") {
|
$del_link = '<a href="'.make_link("pool/nuke/".$pool['id']).'">Delete</a>';
|
||||||
$public = "Yes";
|
|
||||||
} elseif($pool['public'] == "N") {
|
if($pool['public'] == "Y"){
|
||||||
$public = "No";
|
$public = "Yes";
|
||||||
}
|
} elseif($pool['public'] == "N"){
|
||||||
|
$public = "No";
|
||||||
$html .= "<tr class='$oe'>".
|
}
|
||||||
"<td class='left'>".$pool_link."</td>".
|
|
||||||
"<td>".$user_link."</td>".
|
$html .= "<tr class='$oe'>".
|
||||||
"<td>".$pool['posts']."</td>".
|
"<td class='left'>".$pool_link."</td>".
|
||||||
"<td>".$public."</td>";
|
"<td>".$user_link."</td>".
|
||||||
|
"<td>".$pool['posts']."</td>".
|
||||||
if($user->is_admin()) {
|
"<td>".$public."</td>";
|
||||||
$html .= "<td>".$del_link."</td>";
|
|
||||||
}
|
if($user->is_admin()){
|
||||||
|
$html .= "<td>".$del_link."</td>";
|
||||||
$html .= "</tr>";
|
}
|
||||||
|
|
||||||
}
|
$html .= "</tr>";
|
||||||
|
|
||||||
if(!$user->is_anonymous()) {
|
}
|
||||||
$html .= "<tfoot><tr><td colspan='5'><a href='".make_link("pool/new")."'>Create New</a></td></tr></tfoot>";
|
|
||||||
}
|
$html .= "</tbody></table>";
|
||||||
$html .= "</tbody></table>";
|
|
||||||
|
$blockTitle = "Pools";
|
||||||
$blockTitle = "Pools";
|
$page->set_title(html_escape($blockTitle));
|
||||||
$page->set_title(html_escape($blockTitle));
|
$page->set_heading(html_escape($blockTitle));
|
||||||
$page->set_heading(html_escape($blockTitle));
|
$page->add_block(new Block($blockTitle, $html, "main", 10));
|
||||||
$page->add_block(new Block($blockTitle, $html, "main", 10));
|
|
||||||
|
$this->display_paginator($page, "pool/list", null, $pageNumber, $totalPages);
|
||||||
$this->display_paginator($page, "pool/list", null, $pageNumber, $totalPages);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
/*
|
* HERE WE DISPLAY THE NEW POOL COMPOSER
|
||||||
* HERE WE DISPLAY THE NEW POOL COMPOSER
|
*/
|
||||||
*/
|
public function new_pool_composer(Page $page)
|
||||||
public function new_pool_composer(Page $page) {
|
{
|
||||||
$html = "<form action=".make_link("pool/create")." method='POST'>
|
$html = "<form action=".make_link("pool/create")." method='POST'>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>Title:</td><td><input type='text' name='title'></td></tr>
|
<tr><td>Title:</td><td><input type='text' name='title'></td></tr>
|
||||||
<tr><td>Public?</td><td><input name='public' type='checkbox' value='Y' checked='checked'/></td></tr>
|
<tr><td>Public?</td><td><input name='public' type='checkbox' value='Y' checked='checked'/></td></tr>
|
||||||
<tr><td>Description:</td><td><textarea name='description'></textarea></td></tr>
|
<tr><td>Description:</td><td><textarea name='description'></textarea></td></tr>
|
||||||
<tr><td colspan='2'><input type='submit' value='Create' /></td></tr>
|
<tr><td colspan='2'><input type='submit' value='Submit' /></td></tr>
|
||||||
</table>
|
</table>
|
||||||
";
|
";
|
||||||
|
|
||||||
$blockTitle = "Create Pool";
|
$blockTitle = "Create Pool";
|
||||||
$page->set_title(html_escape($blockTitle));
|
$page->set_title(html_escape($blockTitle));
|
||||||
$page->set_heading(html_escape($blockTitle));
|
$page->set_heading(html_escape($blockTitle));
|
||||||
$page->add_block(new Block($blockTitle, $html, "main", 10));
|
$page->add_block(new Block($blockTitle, $html, "main", 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* HERE WE DISPLAY THE POOL WITH TITLE DESCRIPTION AND IMAGES WITH PAGINATION
|
* HERE WE DISPLAY THE POOL WITH TITLE DESCRIPTION AND IMAGES WITH PAGINATION
|
||||||
*/
|
*/
|
||||||
public function view_pool($pools, $images, $pageNumber, $totalPages) {
|
public function view_pool($pools, $images, $pageNumber, $totalPages)
|
||||||
global $user, $page;
|
{
|
||||||
|
global $user, $page;
|
||||||
$pool_info = "<table id='poolsList' class='zebra'>".
|
|
||||||
"<thead><tr>".
|
$pool_info = "<table id='poolsList' class='zebra'>".
|
||||||
"<th class='left'>Title</th>".
|
"<thead><tr>".
|
||||||
"<th class='left'>Description</th>".
|
"<th class='left'>Title</th>".
|
||||||
"</tr></thead>";
|
"<th class='left'>Description</th>".
|
||||||
|
"</tr></thead>";
|
||||||
$n = 0;
|
|
||||||
foreach ($pools as $pool) {
|
$n = 0;
|
||||||
$oe = ($n++ % 2 == 0) ? "even" : "odd";
|
foreach ($pools as $pool)
|
||||||
|
{
|
||||||
$pool_info .= "<tr class='$oe'>".
|
$oe = ($n++ % 2 == 0) ? "even" : "odd";
|
||||||
"<td class='left'>".$pool['title']."</td>".
|
|
||||||
"<td class='left'>".$pool['description']."</td>".
|
$pool_info .= "<tr class='$oe'>".
|
||||||
"</tr>";
|
"<td class='left'>".$pool['title']."</td>".
|
||||||
|
"<td class='left'>".$pool['description']."</td>".
|
||||||
// this will make disasters if more than one pool comes in the parameter
|
"</tr>";
|
||||||
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 will make disasters if more than one pool comes in the parameter
|
||||||
$this->sidebar_options($page, $pool);
|
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);
|
}
|
||||||
}
|
}
|
||||||
|
$this->display_paginator($page, "pool/view/".$pool['id']."", null, $pageNumber, $totalPages);
|
||||||
$pool_info .= "</tbody></table>";
|
}
|
||||||
|
|
||||||
if(count($pools) == 1) {
|
$pool_info .= "</tbody></table>";
|
||||||
$page->set_title("Pool: ".html_escape($pool['title']));
|
|
||||||
$page->set_heading(html_escape($pool['title']));
|
$page->set_title("Viewing Pool");
|
||||||
$page->add_block(new Block("Viewing Pool", $pool_info, "main", 10));
|
$page->set_heading("Viewing Pool");
|
||||||
}
|
$page->add_block(new Block("Viewing Pool", $pool_info, "main", 10));
|
||||||
else {
|
|
||||||
$page->set_title("Viewing Pool");
|
$pool_images = '';
|
||||||
$page->set_heading("Viewing Pool");
|
foreach($images as $pair) {
|
||||||
$page->add_block(new Block("Viewing Pool", $pool_info, "main", 10));
|
$image = $pair[0];
|
||||||
}
|
|
||||||
|
$thumb_html = $this->build_thumb_html($image);
|
||||||
$pool_images = '';
|
|
||||||
foreach($images as $pair) {
|
$pool_images .= '<span class="thumb">'.
|
||||||
$image = $pair[0];
|
'<a href="$image_link">'.$thumb_html.'</a>'.
|
||||||
|
'</span>';
|
||||||
$thumb_html = $this->build_thumb_html($image);
|
}
|
||||||
|
|
||||||
$pool_images .= '<span class="thumb">'.
|
//$pool_images .= print_r($images);
|
||||||
'<a href="$image_link">'.$thumb_html.'</a>'.
|
$page->add_block(new Block("Viewing Posts", $pool_images, "main", 30));
|
||||||
'</span>';
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//$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;
|
||||||
/*
|
|
||||||
* HERE WE DISPLAY THE POOL OPTIONS ON SIDEBAR BUT WE HIDE REMOVE OPTION IF THE USER IS NOT THE OWNER OR ADMIN
|
$editor = " <form action='".make_link("pool/import")."' method='POST'>
|
||||||
*/
|
<input type='text' name='pool_tag' id='edit' value='Please enter a tag' onclick='this.value=\"\";'/>
|
||||||
public function sidebar_options(Page $page, $pool) {
|
<input type='submit' name='edit' id='edit' value='Import'/>
|
||||||
global $user;
|
<input type='hidden' name='pool_id' value='".$pool['id']."'>
|
||||||
|
</form>
|
||||||
$editor = " <form action='".make_link("pool/import")."' method='POST'>
|
|
||||||
<input type='text' name='pool_tag' id='edit' value='Please enter a tag' onclick='this.value=\"\";'/>
|
<form id='form1' name='form1' method='post' action='".make_link("pool/edit_pool")."'>
|
||||||
<input type='submit' name='edit' id='edit' value='Import'/>
|
<input type='submit' name='edit' id='edit' value='Edit Pool'/>
|
||||||
<input type='hidden' name='pool_id' value='".$pool['id']."'>
|
<input type='hidden' name='pool_id' value='".$pool['id']."'>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form id='form1' name='form1' method='post' action='".make_link("pool/edit_pool")."'>
|
<form id='form1' name='form1' method='post' action='".make_link("pool/edit_order")."'>
|
||||||
<input type='submit' name='edit' id='edit' value='Edit Pool'/>
|
<input type='submit' name='edit' id='edit' value='Order Pool'/>
|
||||||
<input type='hidden' name='pool_id' value='".$pool['id']."'>
|
<input type='hidden' name='pool_id' value='".$pool['id']."'>
|
||||||
</form>
|
</form>
|
||||||
|
";
|
||||||
<form id='form1' name='form1' method='post' action='".make_link("pool/edit_order")."'>
|
|
||||||
<input type='submit' name='edit' id='edit' value='Order Pool'/>
|
if($user->id == $pool['user_id'] || $user->is_admin()){
|
||||||
<input type='hidden' name='pool_id' value='".$pool['id']."'>
|
$editor .= "
|
||||||
</form>
|
<script type='text/javascript'>
|
||||||
";
|
function confirm_action() {
|
||||||
|
return confirm('Are you sure that you want to delete this pool?');
|
||||||
if($user->id == $pool['user_id'] || $user->is_admin()) {
|
}
|
||||||
$editor .= "
|
</script>
|
||||||
<script type='text/javascript'>
|
|
||||||
function confirm_action() {
|
<form action='".make_link("pool/nuke_pool")."' method='POST'>
|
||||||
return confirm('Are you sure that you want to delete this pool?');
|
<input type='submit' name='delete' id='delete' value='Delete Pool' onclick='return confirm_action()' />
|
||||||
}
|
<input type='hidden' name='pool_id' value='".$pool['id']."'>
|
||||||
</script>
|
</form>
|
||||||
|
";
|
||||||
<form action='".make_link("pool/nuke_pool")."' method='POST'>
|
}
|
||||||
<input type='submit' name='delete' id='delete' value='Delete Pool' onclick='return confirm_action()' />
|
$page->add_block(new Block("Manage Pool", $editor, "left", 10));
|
||||||
<input type='hidden' name='pool_id' value='".$pool['id']."'>
|
}
|
||||||
</form>
|
|
||||||
";
|
|
||||||
}
|
|
||||||
$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 = "
|
||||||
* HERE WE DISPLAY THE RESULT OF THE SEARCH ON IMPORT
|
<script language='JavaScript' type='text/javascript'>
|
||||||
*/
|
|
||||||
public function pool_result(Page $page, $images, $pool_id) {
|
function checkAll()
|
||||||
|
{
|
||||||
$pool_images = "
|
var a=new Array();
|
||||||
<script language='JavaScript' type='text/javascript'>
|
a=document.getElementsByName('check[]');
|
||||||
|
var p=0;
|
||||||
function checkAll()
|
for(i=0;i<a.length;i++){
|
||||||
{
|
a[i].checked = true ;
|
||||||
var a=new Array();
|
}
|
||||||
a=document.getElementsByName('check[]');
|
}
|
||||||
var p=0;
|
|
||||||
for(i=0;i<a.length;i++) {
|
function uncheckAll()
|
||||||
a[i].checked = true ;
|
{
|
||||||
}
|
var a=new Array();
|
||||||
}
|
a=document.getElementsByName('check[]');
|
||||||
|
var p=0;
|
||||||
function uncheckAll()
|
for(i=0;i<a.length;i++){
|
||||||
{
|
a[i].checked = false ;
|
||||||
var a=new Array();
|
}
|
||||||
a=document.getElementsByName('check[]');
|
}
|
||||||
var p=0;
|
</script>
|
||||||
for(i=0;i<a.length;i++) {
|
|
||||||
a[i].checked = false ;
|
<script type='text/javascript'>
|
||||||
}
|
function confirm_action() {
|
||||||
}
|
return confirm('Are you sure you want to add selected posts to this pool?');
|
||||||
</script>
|
}
|
||||||
|
</script>
|
||||||
<script type='text/javascript'>
|
|
||||||
function confirm_action() {
|
";
|
||||||
return confirm('Are you sure you want to add selected posts to this pool?');
|
|
||||||
}
|
$pool_images .= "<form action='".make_link("pool/add_posts")."' method='POST' name='checks'>";
|
||||||
</script>
|
|
||||||
|
foreach($images as $image) {
|
||||||
";
|
|
||||||
|
$thumb_html = $this->build_thumb_html($image);
|
||||||
$pool_images .= "<form action='".make_link("pool/add_posts")."' method='POST' name='checks'>";
|
|
||||||
|
$pool_images .= '<span class="thumb">'.
|
||||||
foreach($images as $image) {
|
'<a href="$image_link">'.$thumb_html.'</a>'.
|
||||||
|
'<br>'.
|
||||||
$thumb_html = $this->build_thumb_html($image);
|
'<input name="check[]" type="checkbox" value="'.$image->id.'" />'.
|
||||||
|
'</span>';
|
||||||
$pool_images .= '<span class="thumb">'.
|
}
|
||||||
'<a href="$image_link">'.$thumb_html.'</a>'.
|
$pool_images .= "<br>".
|
||||||
'<br>'.
|
"<input type='submit' name='edit' id='edit' value='Add Selected' onclick='return confirm_action()'/>".
|
||||||
'<input name="check[]" type="checkbox" value="'.$image->id.'" />'.
|
"<input type='hidden' name='pool_id' value='".$pool_id."'>".
|
||||||
'</span>';
|
"</form>";
|
||||||
}
|
|
||||||
$pool_images .= "<br>".
|
$page->add_block(new Block("Import", $pool_images, "main", 10));
|
||||||
"<input type='submit' name='edit' id='edit' value='Add Selected' onclick='return confirm_action()'/>".
|
|
||||||
"<input type='hidden' name='pool_id' value='".$pool_id."'>".
|
$editor = "
|
||||||
"</form>";
|
<input type='button' name='CheckAll' value='Check All' onClick='checkAll()'>
|
||||||
|
<input type='button' name='UnCheckAll' value='Uncheck All' onClick='uncheckAll()'>
|
||||||
$page->add_block(new Block("Import", $pool_images, "main", 10));
|
";
|
||||||
|
|
||||||
$editor = "
|
$page->add_block(new Block("Manage Pool", $editor, "left", 10));
|
||||||
<input type='button' name='CheckAll' value='Check All' onClick='checkAll()'>
|
}
|
||||||
<input type='button' name='UnCheckAll' value='Uncheck All' onClick='uncheckAll()'>
|
|
||||||
";
|
|
||||||
|
|
||||||
$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)
|
||||||
/*
|
{
|
||||||
* HERE WE DISPLAY THE POOL ORDERER
|
global $user;
|
||||||
* WE LIST ALL IMAGES ON POOL WITHOUT PAGINATION AND WITH A TEXT INPUT TO SET A NUMBER AND CHANGE THE ORDER
|
|
||||||
*/
|
$pool_info = "<table id='poolsList' class='zebra'>".
|
||||||
public function edit_order(Page $page, $pools, $images) {
|
"<thead><tr>".
|
||||||
global $user;
|
"<th class='left'>Title</th>".
|
||||||
|
"<th class='left'>Description</th>".
|
||||||
$pool_info = "<table id='poolsList' class='zebra'>".
|
"</tr></thead>";
|
||||||
"<thead><tr>".
|
|
||||||
"<th class='left'>Title</th>".
|
$n = 0;
|
||||||
"<th class='left'>Description</th>".
|
|
||||||
"</tr></thead>";
|
foreach ($pools as $pool)
|
||||||
|
{
|
||||||
$n = 0;
|
$oe = ($n++ % 2 == 0) ? "even" : "odd";
|
||||||
|
|
||||||
foreach ($pools as $pool) {
|
$pool_info .= "<tr class='$oe'>".
|
||||||
$oe = ($n++ % 2 == 0) ? "even" : "odd";
|
"<td class='left'>".$pool['title']."</td>".
|
||||||
|
"<td class='left'>".$pool['description']."</td>".
|
||||||
$pool_info .= "<tr class='$oe'>".
|
"</tr>";
|
||||||
"<td class='left'>".$pool['title']."</td>".
|
|
||||||
"<td class='left'>".$pool['description']."</td>".
|
}
|
||||||
"</tr>";
|
$pool_info .= "</tbody></table>";
|
||||||
|
|
||||||
}
|
$page->set_title("Sorting Pool");
|
||||||
$pool_info .= "</tbody></table>";
|
$page->set_heading("Sorting Pool");
|
||||||
|
$page->add_block(new Block("Sorting Pool", $pool_info, "main", 10));
|
||||||
$page->set_title("Sorting Pool");
|
|
||||||
$page->set_heading("Sorting Pool");
|
$pool_images = "<form action='".make_link("pool/order_posts")."' method='POST' name='checks'>";
|
||||||
$page->add_block(new Block("Sorting Pool", $pool_info, "main", 10));
|
$n = 0;
|
||||||
|
foreach($images as $pair) {
|
||||||
$pool_images = "<form action='".make_link("pool/order_posts")."' method='POST' name='checks'>";
|
$image = $pair[0];
|
||||||
$n = 0;
|
|
||||||
foreach($images as $pair) {
|
$thumb_html = $this->build_thumb_html($image);
|
||||||
$image = $pair[0];
|
|
||||||
$thumb_html = $this->build_thumb_html($image);
|
$pool_images .= '<span class="thumb">'.
|
||||||
$pool_images .= '<span class="thumb">'.
|
'<a href="$image_link">'.$thumb_html.'</a>';
|
||||||
'<a href="$image_link">'.$thumb_html.'</a>';
|
|
||||||
$pool_images .= '<br><input name="imgs['.$n.'][]" type="text" width="50px" value="'.$image->image_order.'" />'.
|
|
||||||
'<input name="imgs['.$n.'][]" type="hidden" value="'.$image->id.'" />';
|
$pool_images .= '<br><input name="imgs['.$n.'][]" type="text" style="max-width:50px;" value="'.$image->image_order.'" />'.
|
||||||
$n = $n+1;
|
'<input name="imgs['.$n.'][]" type="hidden" value="'.$image->id.'" />';
|
||||||
$pool_images .= '</span>';
|
$n = $n+1;
|
||||||
}
|
|
||||||
|
$pool_images .= '</span>';
|
||||||
$pool_images .= "<br>".
|
}
|
||||||
"<input type='submit' name='edit' id='edit' value='Order'/>".
|
|
||||||
"<input type='hidden' name='pool_id' value='".$pool['id']."'>".
|
$pool_images .= "<br>".
|
||||||
"</form>";
|
"<input type='submit' name='edit' id='edit' value='Order'/>".
|
||||||
|
"<input type='hidden' name='pool_id' value='".$pool['id']."'>".
|
||||||
$page->add_block(new Block("Sorting Posts", $pool_images, "main", 30));
|
"</form>";
|
||||||
}
|
|
||||||
|
$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
|
/*
|
||||||
*/
|
* HERE WE DISPLAY THE POOL EDITOR
|
||||||
public function edit_pool(Page $page, $pools, $images) {
|
* WE LIST ALL IMAGES ON POOL WITHOUT PAGINATION AND WITH A CHECKBOX TO SELECT WHICH IMAGE WE WANT REMOVE
|
||||||
global $user;
|
*/
|
||||||
|
public function edit_pool(Page $page, $pools, $images)
|
||||||
$pool_info = "<table id='poolsList' class='zebra'>".
|
{
|
||||||
"<thead><tr>".
|
global $user;
|
||||||
"<th class='left'>Title</th>".
|
|
||||||
"<th class='left'>Description</th>".
|
$pool_info = "<table id='poolsList' class='zebra'>".
|
||||||
"</tr></thead>";
|
"<thead><tr>".
|
||||||
|
"<th class='left'>Title</th>".
|
||||||
$n = 0;
|
"<th class='left'>Description</th>".
|
||||||
|
"</tr></thead>";
|
||||||
foreach ($pools as $pool) {
|
|
||||||
$oe = ($n++ % 2 == 0) ? "even" : "odd";
|
$n = 0;
|
||||||
|
|
||||||
$pool_info .= "<tr class='$oe'>".
|
foreach ($pools as $pool)
|
||||||
"<td class='left'>".$pool['title']."</td>".
|
{
|
||||||
"<td class='left'>".$pool['description']."</td>".
|
$oe = ($n++ % 2 == 0) ? "even" : "odd";
|
||||||
"</tr>";
|
|
||||||
|
$pool_info .= "<tr class='$oe'>".
|
||||||
}
|
"<td class='left'>".$pool['title']."</td>".
|
||||||
$pool_info .= "</tbody></table>";
|
"<td class='left'>".$pool['description']."</td>".
|
||||||
|
"</tr>";
|
||||||
$page->set_title("Editing Pool");
|
|
||||||
$page->set_heading("Editing Pool");
|
}
|
||||||
$page->add_block(new Block("Editing Pool", $pool_info, "main", 10));
|
$pool_info .= "</tbody></table>";
|
||||||
|
|
||||||
|
$page->set_title("Editing Pool");
|
||||||
$pool_images = "
|
$page->set_heading("Editing Pool");
|
||||||
<script language='JavaScript' type='text/javascript'>
|
$page->add_block(new Block("Editing Pool", $pool_info, "main", 10));
|
||||||
|
|
||||||
function checkAll()
|
|
||||||
{
|
$pool_images = "
|
||||||
var a=new Array();
|
<script language='JavaScript' type='text/javascript'>
|
||||||
a=document.getElementsByName('check[]');
|
|
||||||
var p=0;
|
function checkAll()
|
||||||
for(i=0;i<a.length;i++) {
|
{
|
||||||
a[i].checked = true ;
|
var a=new Array();
|
||||||
}
|
a=document.getElementsByName('check[]');
|
||||||
}
|
var p=0;
|
||||||
|
for(i=0;i<a.length;i++){
|
||||||
function uncheckAll()
|
a[i].checked = true ;
|
||||||
{
|
}
|
||||||
var a=new Array();
|
}
|
||||||
a=document.getElementsByName('check[]');
|
|
||||||
var p=0;
|
function uncheckAll()
|
||||||
for(i=0;i<a.length;i++) {
|
{
|
||||||
a[i].checked = false ;
|
var a=new Array();
|
||||||
}
|
a=document.getElementsByName('check[]');
|
||||||
}
|
var p=0;
|
||||||
</script>
|
for(i=0;i<a.length;i++){
|
||||||
";
|
a[i].checked = false ;
|
||||||
|
}
|
||||||
$pool_images .= "<form action='".make_link("pool/remove_posts")."' method='POST' name='checks'>";
|
}
|
||||||
|
</script>
|
||||||
foreach($images as $pair) {
|
|
||||||
$image = $pair[0];
|
";
|
||||||
$thumb_html = $this->build_thumb_html($image);
|
|
||||||
$pool_images .= '<span class="thumb">'.
|
$pool_images .= "<form action='".make_link("pool/remove_posts")."' method='POST' name='checks'>";
|
||||||
'<a href="$image_link">'.$thumb_html.'</a>';
|
|
||||||
$pool_images .= '<br><input name="check[]" type="checkbox" value="'.$image->id.'" />';
|
foreach($images as $pair) {
|
||||||
$pool_images .= '</span>';
|
$image = $pair[0];
|
||||||
}
|
|
||||||
|
$thumb_html = $this->build_thumb_html($image);
|
||||||
$pool_images .= "<br>".
|
|
||||||
"<input type='submit' name='edit' id='edit' value='Remove Selected'/>".
|
$pool_images .= '<span class="thumb">'.
|
||||||
"<input type='hidden' name='pool_id' value='".$pool['id']."'>".
|
'<a href="$image_link">'.$thumb_html.'</a>';
|
||||||
"</form>";
|
|
||||||
|
|
||||||
$page->add_block(new Block("Editing Posts", $pool_images, "main", 30));
|
$pool_images .= '<br><input name="check[]" type="checkbox" value="'.$image->id.'" />';
|
||||||
|
|
||||||
$editor = "
|
|
||||||
<input type='button' name='CheckAll' value='Check All' onClick='checkAll()'>
|
$pool_images .= '</span>';
|
||||||
<input type='button' name='UnCheckAll' value='Uncheck All' onClick='uncheckAll()'>";
|
}
|
||||||
|
|
||||||
$page->add_block(new Block("Manage Pool", $editor, "left", 10));
|
$pool_images .= "<br>".
|
||||||
}
|
"<input type='submit' name='edit' id='edit' value='Remove Selected'/>".
|
||||||
|
"<input type='hidden' name='pool_id' value='".$pool['id']."'>".
|
||||||
|
"</form>";
|
||||||
|
|
||||||
/*
|
$page->add_block(new Block("Editing Posts", $pool_images, "main", 30));
|
||||||
* HERE WE DISPLAY THE HISTORY LIST
|
|
||||||
*/
|
$editor = "
|
||||||
public function show_history($histories, $pageNumber, $totalPages) {
|
<input type='button' name='CheckAll' value='Check All' onClick='checkAll()'>
|
||||||
global $page;
|
<input type='button' name='UnCheckAll' value='Uncheck All' onClick='uncheckAll()'>";
|
||||||
$html = "<table id='poolsList' class='zebra'>".
|
|
||||||
"<thead><tr>".
|
$page->add_block(new Block("Manage Pool", $editor, "left", 10));
|
||||||
"<th>Pool</th>".
|
}
|
||||||
"<th>Post Count</th>".
|
|
||||||
"<th>Changes</th>".
|
|
||||||
"<th>Updater</th>".
|
|
||||||
"<th>Date</th>".
|
/*
|
||||||
"<th>Action</th>".
|
* HERE WE DISPLAY THE HISTORY LIST
|
||||||
"</tr></thead>";
|
*/
|
||||||
|
public function show_history($histories, $pageNumber, $totalPages){
|
||||||
$n = 0;
|
global $page;
|
||||||
foreach ($histories as $history) {
|
$html = "<table id='poolsList' class='zebra'>".
|
||||||
$oe = ($n++ % 2 == 0) ? "even" : "odd";
|
"<thead><tr>".
|
||||||
|
"<th>Pool</th>".
|
||||||
$pool_link = "<a href='".make_link("pool/view/".$history['pool_id'])."'>".$history['title']."</a>";
|
"<th>Post Count</th>".
|
||||||
$user_link = "<a href='".make_link("user/".$history['user_name'])."'>".$history['user_name']."</a>";
|
"<th>Changes</th>".
|
||||||
$revert_link = "<a href='".make_link("pool/revert/".$history['id'])."'>Revert</a>";
|
"<th>Updater</th>".
|
||||||
|
"<th>Date</th>".
|
||||||
if ($history['action'] == 1) {
|
"<th>Action</th>".
|
||||||
$prefix = "+";
|
"</tr></thead>";
|
||||||
} elseif ($history['action'] == 0) {
|
|
||||||
$prefix = "-";
|
$n = 0;
|
||||||
}
|
foreach ($histories as $history)
|
||||||
|
{
|
||||||
$images = trim($history['images']);
|
$oe = ($n++ % 2 == 0) ? "even" : "odd";
|
||||||
$images = explode(" ", $images);
|
|
||||||
|
$pool_link = "<a href='".make_link("pool/view/".$history['pool_id'])."'>".$history['title']."</a>";
|
||||||
$image_link = "";
|
$user_link = "<a href='".make_link("user/".$history['user_name'])."'>".$history['user_name']."</a>";
|
||||||
foreach ($images as $image) {
|
$revert_link = "<a href='".make_link("pool/revert/".$history['id'])."'>Revert</a>";
|
||||||
$image_link .= "<a href='".make_link("post/view/".$image)."'>".$prefix.$image." </a>";
|
|
||||||
}
|
if ($history['action'] == 1) {
|
||||||
|
$prefix = "+";
|
||||||
$html .= "<tr class='$oe'>".
|
} elseif ($history['action'] == 0) {
|
||||||
"<td class='left'>".$pool_link."</td>".
|
$prefix = "-";
|
||||||
"<td>".$history['count']."</td>".
|
}
|
||||||
"<td>".$image_link."</td>".
|
|
||||||
"<td>".$user_link."</td>".
|
$images = trim($history['images']);
|
||||||
"<td>".$history['date']."</td>".
|
$images = explode(" ", $images);
|
||||||
"<td>".$revert_link."</td>".
|
|
||||||
"</tr>";
|
$image_link = "";
|
||||||
}
|
foreach ($images as $image) {
|
||||||
|
$image_link .= "<a href='".make_link("post/view/".$image)."'>".$prefix.$image." </a>";
|
||||||
$html .= "</tbody></table>";
|
}
|
||||||
|
|
||||||
$page->set_title("Recent Changes");
|
$html .= "<tr class='$oe'>".
|
||||||
$page->set_heading("Recent Changes");
|
"<td class='left'>".$pool_link."</td>".
|
||||||
$page->add_block(new Block("Recent Changes", $html, "main", 10));
|
"<td>".$history['count']."</td>".
|
||||||
|
"<td>".$image_link."</td>".
|
||||||
$this->display_paginator($page, "pool/updated", null, $pageNumber, $totalPages);
|
"<td>".$user_link."</td>".
|
||||||
}
|
"<td>".$history['date']."</td>".
|
||||||
|
"<td>".$revert_link."</td>".
|
||||||
|
"</tr>";
|
||||||
|
}
|
||||||
/*
|
|
||||||
* HERE WE DISPLAY THE ERROR
|
$html .= "</tbody></table>";
|
||||||
*/
|
|
||||||
public function display_error($errMessage) {
|
$page->set_title("Recent Changes");
|
||||||
global $page;
|
$page->set_heading("Recent Changes");
|
||||||
|
$page->add_block(new Block("Recent Changes", $html, "main", 10));
|
||||||
$page->set_title("Error");
|
|
||||||
$page->set_heading("Error");
|
$this->display_paginator($page, "pool/updated", null, $pageNumber, $totalPages);
|
||||||
$page->add_block(new Block("Error", $errMessage, "main", 10));
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
?>
|
/*
|
||||||
|
* 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));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
Loading…
x
Reference in New Issue
Block a user