<?
$title = "Админка";
$l = "Админка";
require (CORE."head.php");
$thisLink .= "?admin";
echo "<div class=\"app-block\">";
admin :: access(array('a'=>3,'m'=>1));
if ($user['id'] != 3 && $user['id'] != 1) {
header("Location: /");
exit;
}
if (isset($_GET['add_cat'])) {
require('add_cat.php');
exit;
} else if (isset($_GET['adm_cat'])) {
require('adm_cat.php');
exit;
} else if (isset($_GET['edit_cat'])) {
require('edit_cat.php');
} else if (isset($_GET['dell_kat'])) {
require('dell_kat.php');
exit;
} else if (isset($_GET['add_gift'])) {
require('add_gift.php');
exit;
} else if (isset($_GET['adm_gift'])) {
require('adm_gift.php');
exit;
} else if (isset($_GET['edit_gift'])) {
require('edit_gift.php');
exit;
} else if (isset($_GET['dell_gift'])) {
require('dell_gift.php');
exit;
}
?>
<a href="<?=$thisLink?>&add_cat=1" class="app-action"><?=system :: icon("add")?> Добавить категорию</a>
<?php
$total = DB :: $pdo -> querySingle("SELECT COUNT(*) FROM `gifts_kat`");
if ($total == 0)
{
?>
<div class="list _gray _font-s _center">Категории не найдены!</div>
<?
} else {
if ($total > 10)
{
$p = (($_GET['p']) ? intval($_GET['p']) : 1);
$pagination = new pagination(10, $total, $p);
$total_lin = $pagination -> limit;
} else {
$total_lin = '';
}
$query_gifts = DB :: $pdo -> query("SELECT * FROM `gifts_kat` ORDER BY `id` DESC ".$total_lin."");
while($r = $query_gifts -> fetch())
{
echo system :: touch("{$thisLink}&adm_cat=".$r['id']."", $r['name']);
}
if ($total > 10)
{
echo $pagination -> printPages("{$thisLink}&");
}
}
echo "</div>";
require (CORE."foot.php");
?>