Файл: Arhmobi_esdcms/dpanel/adm.tiket.php
Строк: 47
<?php
include_once '../sys/inc/start.php';
dpanel::check_access();
$doc = new document(3);
$doc->title = __('Открытые тикеты');
switch (@$_GET['down']) {
case 'all':
$down='all';
$where = null;
$doc->title = __('Все тикеты');
break;
case 'zak':
$down='zak';
$where = "WHERE `down` = '0'";
$doc->title = __('Закрытые тикеты');
break;
default:
$down='otk';
$where = "WHERE `down` = '1'";
break;
}
$pages = new pages($db->query("SELECT COUNT(*) FROM `tiket`")->fetchColumn());
$ord = array();
$ord[] = array("?down=otk&page={$pages->this_page}" , __('Открытые тикеты'), $down == 'otk');
$ord[] = array("?down=zak&page={$pages->this_page}" , __('Закрытые'), $down == 'zak');
$ord[] = array("?down=all&page={$pages->this_page}" , __('Все тикеты'), $down == 'all');
$or = new design();
$or->assign('order', $ord);
$or->display('design.order.tpl');
$listing = new listing();
$q = $db->query("SELECT * FROM `tiket` ".$where." ORDER BY `id` DESC LIMIT ".$pages->limit);
$after_id = false;
if ($arr = $q->fetchAll()) {
foreach ($arr AS $tiket) {
$ank = new user($tiket['id_user']);
$post = $listing->post();
$post->url = '/support/tiket.php?id=' . $tiket['id'];
$post->time = misc::when($tiket['time']);
$post->title = text::toValue($tiket['name']);
$post->post = text::toOutput(mb_substr($tiket['msg'],0,100,'utf-8')).'<br />';
$res = $db->prepare("SELECT COUNT(*) FROM `tiket_kom` WHERE `id_list` = ? AND `otv` = ? ");
$res->execute(Array($tiket['id'],1));
$k_kom = $res->fetchColumn();
$post->post .= __(misc::number($k_kom, 'Ответ', 'Ответа', 'Ответов') .': %s', $k_kom);;
$post->icon("tiket.{$tiket['down']}");
$post->bottom = __('Добавил' . ($ank->sex? '':'а').': %s',$ank->show());
if (($user->group >= 2)&& $tiket['down']==1)
$post->action("tiket.0", '/support/act.php?id='.$tiket['id'].'&act=clous');
if (($user->group >= 2)&& $tiket['down']==0)
$post->action("tiket.1", '/support/act.php?id='.$tiket['id'].'&act=clous');
if ($user->group >= 2)
$post->action("delete", '/support/act.php?id='.$tiket['id'].'&act=delete');
}
}
$listing->display(__('Открытых нет тикетов'));
$pages->display('?down=otk'); // вывод страниц