<?php
require_once '../core/system.php';
echo admin();
$header = 'Служба поддержки | Режим администратора';
include_once '../core/head.php';
if ($user[prava] >= 5) {
echo '<center><b>Режим:</b> <a href="/support"><b><span class="underline" style="color:grey;">Игрока</span></a></b> | 
<b><span style="color:red;">Администратора</span></b></center>';
}
echo '<hr />';
echo '<div class="player menuList">
<li><a href=/clear_tickets_list><img src="/images/icon/arrow.png">Удалить все запросы</a></li>
</div>';
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `support_tickets`"),0);
$k_page = k_page($k_post,$set['p_str']);
$page = page($k_page);
$start = $set['p_str']*$page-$set['p_str'];
$q = mysql_query("SELECT * FROM `support_tickets` ORDER BY `last_msg_time` DESC LIMIT $start, $set[p_str]");
if($k_post == 0)echo "<div class='player grey'>Нет запросов</div>";
//echo "<div class='player menuList'>";
while ($post = mysql_fetch_assoc($q)){
$ank = mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = '$post[user_id]' LIMIT 1"));
$mess = mysql_query("SELECT * FROM `support_messages` WHERE `ticket_id` = '$post[id]' AND `ticket_title` = '1' ORDER BY id DESC LIMIT 1");
//$ticket_new = mysql_fetch_assoc(mysql_query("SELECT * FROM `support_tickets` WHERE `id` = '$post[id]' LIMIT 1"));
$msg = mysql_fetch_assoc($mess);
if($post[new_for_admin] == 1)$color = 'green';
if($post[new_for_admin] == 0)$color = 'grey';
echo '
<Center>Автор: <a href="/user/'.$ank[id].'/">'.$ank[nick].'</a></center>
<Div class="player menuList">
<li><a href="view_ticket_admin?id='.$post[id].'">
<span class="dgreen">'.vremja($msg[post_time]).'</span>
<br><span class="'.$color.'">'.rez_text($msg[message]).'</span></a></li>
<div class="dot-line"></div>';
echo "</div>";
}
if ($k_page>1)str('?',$k_page,$page); // Вывод страниц
include_once '../core/foot.php';
?>