<?php
/**
* Product: Katyshop
* @version 0.3.2.1
* @author Catalin Hulea - hide@address.com
* @copyright Copyright (C) 2007 Catalin Hulea
* @license GNU General Public License version 3
* You can find a copy of GNU GPL v3 at this path: /docs/LICENSE
* @link https://sourceforge.net/projects/katyshop
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
$category = Application::getCurrentCategory();
if(empty($_GET["order_by"]["products"]))
$_GET["order_by"]["products"] = "pos";
if(empty($_GET["order_direction"]["products"]))
$_GET["order_direction"]["products"] = "asc";
$productsCount = $db->tbProduct->getCount(array("id_category" => intval($category->id)), @$_GET["start"], @$_GET["rowsPerPage"], @$_GET["order_by"]["products"], @$_GET["order_direction"]["products"]);
$list = $db->tbProduct->search(array("id_category" => intval($category->id)), @$_GET["start"], @$_GET["rowsPerPage"], @$_GET["order_by"]["products"], @$_GET["order_direction"]["products"]);
if($productsCount > 0)
{
?>
<a name="products"></a>
<dl>
<dt></dt>
<dd>
<h3>Produsele din <?php echo Escape::html($category->title); ?></h3>
<table width="470">
<tr>
<td width="35">
<?php
displayOrderBy($category->id, "pos", "asc", "admin/category.php", "products");
displayOrderBy($category->id, "pos", "desc", "admin/category.php", "products");
?>
</td>
<td></td>
<td width="300">
<?php
displayOrderBy($category->id, "title", "asc", "admin/category.php", "products");
displayOrderBy($category->id, "title", "desc", "admin/category.php", "products");
?>
</td>
<td width="40">
<?php
displayOrderBy($category->id, "active", "asc", "admin/category.php", "products");
displayOrderBy($category->id, "active", "desc", "admin/category.php", "products");
?>
</td>
<td width="60">
<?php
displayOrderBy($category->id, "date_created", "asc", "admin/category.php", "products");
displayOrderBy($category->id, "date_created", "desc", "admin/category.php", "products");
?>
</td>
</tr>
<?php
for($i = 0; $i < count($list); $i++)
{
$p = $list[$i];
?>
<tr valign="top">
<td>
<table cellpadding="0" cellspacing="0" style="margin: 0px;">
<tr>
<td style="font-size: 20pt; "><?php echo Escape::html($p->pos); ?></td>
<td>
<a href="javascript:product_moveUp('<?php echo intval($p->id); ?>'); " title="move up" style="display: block; "><img src="img/icons/bullet_arrow_up_blue.gif" alt="move up"></a>
<a href="javascript:product_moveDown('<?php echo intval($p->id); ?>'); " title="move down"><img src="img/icons/bullet_arrow_down_blue.gif" alt="move down"></a>
</td>
</tr>
</table>
</td>
<td align="center">
<?php
if(!empty($p->picture) && is_file(WEB_DIR . "/img/products/small/{$p->picture}"))
{
?>
<a href="admin/product.php?id_product=<?php echo intval($p->id); ?>">
<img src="img/products/small/<?php echo Escape::htmlValue($p->picture); ?>">
</a>
<?php
}
?>
</td>
<td>
<a href="admin/product.php?id_product=<?php echo intval($p->id); ?>"><?php echo Escape::html($p->title); ?></a>
<br>
<?php echo nl2br(Escape::html(Tools::limitString($p->description, 100))); ?>
</td>
<td>
<?php
if(intval($p->active) == 1)
{
?>
<a href="javascript:deactivateProduct('<?php echo intval($p->id); ?>'); " title="dezactivati"><img src="img/icons/bullet_red_blur.gif" alt="dezactivati"></a>
<img src="img/icons/bullet_green.gif" alt="produsul este activ pe siteul public">
<?php
}
else
{
?>
<img src="img/icons/bullet_red.gif" alt="produsul nu este activ pe siteul public">
<a href="javascript:activateProduct('<?php echo intval($p->id); ?>'); " title="activati"><img src="img/icons/bullet_green_blur.gif" alt="activati"></a>
<?php
}
?>
</td>
<td style="font-size: 8pt;">
<table cellpadding="0" cellspacing="0" style="margin: 0px;">
<tr>
<td><a href="admin/product.php?action=edit&id_product=<?php echo intval($p->id); ?>" title="edit"><img src="img/icons/edit.gif" alt="edit"></a></td>
<td><a href="admin/product.php?action=change_parent&id_product=<?php echo intval($p->id); ?>" title="move"><img src="img/icons/move.gif" alt="mutati"></a></td>
<td><a href="javascript:deleteProduct('<?php echo intval($p->id); ?>'); " title="delete"><img src="img/icons/delete.png" alt="stergeti"></a></td>
</tr>
</table>
<?php echo Escape::html($p->date_created); ?>
</td>
</tr>
<?php
}
?>
</table>
<?php
echo getListPages($productsCount);
?>
</dd>
</dl>
<?php
}
?>