Файл: Arhmobi_esdcms/dpanel/presents/category.php
Строк: 37
<?php
include_once '../../sys/inc/start.php';
dpanel::check_access();
$doc = new document(4);
$doc->title = __('Подарки');
$doc->ret(__('К категориям'), './');
if (!isset($_GET['id']) || !is_numeric($_GET['id']))
{
header('Refresh: 1; url=./');
$doc->err(__('Ошибка выбора категории'));
exit;
}
$id_cat = (int)$_GET['id'];
$q = $db->prepare("SELECT * FROM `present_categories` WHERE `id` = ?");
$q->execute(Array($id_cat));
if (!$category = $q->fetch())
{
header('Refresh: 1; url=./');
$doc->err(__('Категория не доступна'));
exit;
}
$doc->title .= ' - ' . $category['name'];
$res = $db->prepare("SELECT COUNT(*) FROM `present_items` WHERE `id_category` = ?");
$res->execute(Array($category['id']));
$pages = new pages;
$pages->posts = $res->fetchColumn();
$q = $db->prepare("SELECT * FROM `present_items` WHERE `id_category` = ? ORDER BY `id` DESC LIMIT " . $pages->limit);
$q->execute(Array($category['id']));
$listing = new listing();
while ($item = $q->fetch())
{
$post = $listing->post();
if(is_file(H . $screen = '/sys/images/presents/' . $item['id'] . '.png'))
{
$post->title= '<img src="' . $screen . '" style="max-width: 80px;"/> ';
}
else
{
$post->post = __('No foto');
}
$post->title .= text::toValue($item['name']);
$post->url = "item.edit.php?id=" . $item['id'] . "&return=" . URL;
$post->action('image', 'item.image.php?id=' . $item['id'] . "&return=" . URL);
$post->action('delete', 'item.delete.php?id=' . $item['id'] . "&return=" . URL);
$post->counter= __('Стоимость: %s', '<span class="DCMS_rating_up">' . ($item['ball'] == 0 ? __('Бесплатно') : $item['ball']) . '</span>');
}
$listing->display(__('Подарков нет'));
$pages->display('?id=' . $id_cat . '&');
$doc->act(__('Создать подарок'), 'item.new.php?id=' . $category['id'] . "&return=" . URL);
$doc->act(__('Параметры категории'), 'category.edit.php?id=' . $category['id'] . "&return=" . URL);