<?php
require_once('../classes/body.class.php');
require_once('../classes/db.class.php');
require_once('../classes/system.class.php');
$title= new Body;
$title->SetTitle('Служба поддержки - Мои обращения');
$title->GetHeader();
echo'<div class="tile"><div class="t-header th-alt bg-teal"><div class="th-title"><i class="zmdi zmdi-widgets"></i><a href="/"style="text-decoration:none; color:white;"> Главная</a> ::  <a href="/support"style="text-decoration:none; color:white;">Служба поддержки</a> ::  Мои обращения</div></div>';
$look = DB::$dbs->querySingle("SELECT COUNT(id) FROM `support` WHERE `user_id` = ?", [$b['id']]);
if ($look == 0) {
echo'<div class="alert alert-danger"> Вы еще не обращались в службу поддержки!</div>';
}
echo'<div class="t-body"><div class="list-group lg-alt">';
$num = 10;
$k_page = k_page($look, $num);
$page = page($k_page);
$start = $num*$page-$num;
$sql = DB::$dbs->query("SELECT * FROM `support` WHERE `user_id` = ? ORDER BY `time` DESC LIMIT $start,$num", [$b['id']]);
while($a = $sql->fetch()) {
$last = DB::$dbs->queryFetch("SELECT * FROM `support_mess` WHERE `tid` = ? ORDER BY `time` DESC LIMIT 1", [$a['id']]);
echo '<a class="list-group-item media" href="view.html?id='.$a['id'].'"><div class="pull-left"><img class="img-circle pull-left" src="/'.(user_inf($a['user_id'], 'ava') != NULL ? user_inf($a['user_id'], 'ava') : 'assets/img/4.jpg').'" alt="" width="40" height="40"></div><div class="media-body"><div class="list-group-item-heading">  '.$a['name'].'  </div><small class="list-group-item-text">('.vr($a['time']).')</small></div></a>';
}
echo'</div></div>';
if ($k_page > 1) {
str('?',$k_page,$page);
}
$title->GetMenu();
$title->GetFooter();
?>