<?php
$t = 'Тикеты ожидающие ответа';
require_once '../../wcore/core.php';
require_once '../../wcore/head.php';
iank(2);
$cat = !isset($_GET['cat'])?:antixs($_GET['cat']);
$all = isset($_GET['all'])?NULL:'WHERE `status` = 1';
$k_post = _mc('tickets_list', $all);
$k_page = k_page($k_post, 10);
$page = page($k_page);
$start = 10*$page-10;
$_tmp = mysqli_query($mysqli,"SELECT * FROM `tickets_list` ".$all." ORDER BY `tid` DESC LIMIT $start, 10") or die("Ошибка запроса: ".mysqli_error($mysqli));
while ($list = mysqli_fetch_assoc($_tmp)){
$data[] = [
'id' => $list['tid'],
'name' => $list['name'],
'status' => $list['status'],
'count' => mysqli_fetch_object(mysqli_query($mysqli,"SELECT COUNT( * ) AS `read`,(SELECT COUNT( * ) FROM `tickets_mess` WHERE `tid` = '".$list['tid']."' AND `read_mess` = 0) AS `noread` FROM `tickets_mess` WHERE `tid` = '".$list['tid']."'"))
];
}
$data = !isset($data)?NULL:$data;
echo $twig->render('pages_tickets_index.tpl', [
'lang' => $lang,
'data' => $data,
'count' => $k_post,
'all' => $all,
'show_B'=> ($ank->prv >= 3?true:false),
]);
if ($k_page > 1){str(($all == NULL?'?all&':'?'),$k_page,$page);}
require_once '../../wcore/foot.php';
?>