pools coding standards

This commit is contained in:
Shish 2009-11-15 05:00:24 +00:00
parent 14b48d5599
commit e61b1fe954
2 changed files with 702 additions and 725 deletions

View File

@ -8,7 +8,6 @@
*/ */
class Pools extends SimpleExtension { class Pools extends SimpleExtension {
public function onInitExt($event) { public function onInitExt($event) {
global $config, $database; global $config, $database;

View File

@ -20,8 +20,7 @@ class PoolsTheme extends Themelet {
/* /*
* 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">'. $html = '<table id="poolsList" class="zebra">'.
@ -37,8 +36,7 @@ class PoolsTheme extends Themelet {
$html .= "</tr></thead>"; $html .= "</tr></thead>";
$n = 0; $n = 0;
foreach ($pools as $pool) foreach ($pools as $pool) {
{
$oe = ($n++ % 2 == 0) ? "even" : "odd"; $oe = ($n++ % 2 == 0) ? "even" : "odd";
$pool_link = '<a href="'.make_link("pool/view/".$pool['id']).'">'.$pool['title']."</a>"; $pool_link = '<a href="'.make_link("pool/view/".$pool['id']).'">'.$pool['title']."</a>";
@ -80,8 +78,7 @@ class PoolsTheme extends Themelet {
/* /*
* 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>
@ -102,8 +99,7 @@ class PoolsTheme extends Themelet {
/* /*
* 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'>". $pool_info = "<table id='poolsList' class='zebra'>".
@ -113,8 +109,7 @@ class PoolsTheme extends Themelet {
"</tr></thead>"; "</tr></thead>";
$n = 0; $n = 0;
foreach ($pools as $pool) foreach ($pools as $pool) {
{
$oe = ($n++ % 2 == 0) ? "even" : "odd"; $oe = ($n++ % 2 == 0) ? "even" : "odd";
$pool_info .= "<tr class='$oe'>". $pool_info .= "<tr class='$oe'>".
@ -266,8 +261,7 @@ class PoolsTheme extends Themelet {
* HERE WE DISPLAY THE POOL ORDERER * 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 * 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) public function edit_order(Page $page, $pools, $images) {
{
global $user; global $user;
$pool_info = "<table id='poolsList' class='zebra'>". $pool_info = "<table id='poolsList' class='zebra'>".
@ -278,8 +272,7 @@ class PoolsTheme extends Themelet {
$n = 0; $n = 0;
foreach ($pools as $pool) foreach ($pools as $pool) {
{
$oe = ($n++ % 2 == 0) ? "even" : "odd"; $oe = ($n++ % 2 == 0) ? "even" : "odd";
$pool_info .= "<tr class='$oe'>". $pool_info .= "<tr class='$oe'>".
@ -298,17 +291,12 @@ class PoolsTheme extends Themelet {
$n = 0; $n = 0;
foreach($images as $pair) { foreach($images as $pair) {
$image = $pair[0]; $image = $pair[0];
$thumb_html = $this->build_thumb_html($image); $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.'" />'. $pool_images .= '<br><input name="imgs['.$n.'][]" type="text" width="50px" value="'.$image->image_order.'" />'.
'<input name="imgs['.$n.'][]" type="hidden" value="'.$image->id.'" />'; '<input name="imgs['.$n.'][]" type="hidden" value="'.$image->id.'" />';
$n = $n+1; $n = $n+1;
$pool_images .= '</span>'; $pool_images .= '</span>';
} }
@ -326,8 +314,7 @@ class PoolsTheme extends Themelet {
* HERE WE DISPLAY THE POOL EDITOR * 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 * 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) public function edit_pool(Page $page, $pools, $images) {
{
global $user; global $user;
$pool_info = "<table id='poolsList' class='zebra'>". $pool_info = "<table id='poolsList' class='zebra'>".
@ -338,8 +325,7 @@ class PoolsTheme extends Themelet {
$n = 0; $n = 0;
foreach ($pools as $pool) foreach ($pools as $pool) {
{
$oe = ($n++ % 2 == 0) ? "even" : "odd"; $oe = ($n++ % 2 == 0) ? "even" : "odd";
$pool_info .= "<tr class='$oe'>". $pool_info .= "<tr class='$oe'>".
@ -378,23 +364,16 @@ class PoolsTheme extends Themelet {
} }
} }
</script> </script>
"; ";
$pool_images .= "<form action='".make_link("pool/remove_posts")."' method='POST' name='checks'>"; $pool_images .= "<form action='".make_link("pool/remove_posts")."' method='POST' name='checks'>";
foreach($images as $pair) { foreach($images as $pair) {
$image = $pair[0]; $image = $pair[0];
$thumb_html = $this->build_thumb_html($image); $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="check[]" type="checkbox" value="'.$image->id.'" />'; $pool_images .= '<br><input name="check[]" type="checkbox" value="'.$image->id.'" />';
$pool_images .= '</span>'; $pool_images .= '</span>';
} }
@ -430,8 +409,7 @@ class PoolsTheme extends Themelet {
"</tr></thead>"; "</tr></thead>";
$n = 0; $n = 0;
foreach ($histories as $history) foreach ($histories as $history) {
{
$oe = ($n++ % 2 == 0) ? "even" : "odd"; $oe = ($n++ % 2 == 0) ? "even" : "odd";
$pool_link = "<a href='".make_link("pool/view/".$history['pool_id'])."'>".$history['title']."</a>"; $pool_link = "<a href='".make_link("pool/view/".$history['pool_id'])."'>".$history['title']."</a>";