<?php
$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="/market"style="text-decoration:none; color:white;"> Маркет</a> :: <a href="uskab"style="text-decoration:none; color:white;"> Кабинет </a> :: Мои покупки</div></div></div>';
$count = DB::$dbs->querySingle("SELECT count(id) FROM `magazin_mybuy` WHERE  `user_id` = ?",[$b['id']]);
if ($count==0) {
echo '<div class="alert alert-danger"role="alert">Покупок пока нет</div>';
}
echo'<div class="t-body"><div class="list-group lg-alt">';
$sql = DB::$dbs->query("SELECT * FROM `magazin_mybuy` WHERE  `user_id` = ? ORDER BY id DESC",[$b['id']]);
while($a = $sql->fetch()) {
$file = DB::$dbs->queryFetch("SELECT * FROM `magazin_file` WHERE `id` = ?",[$a['file']]);
$screen = DB::$dbs->queryFetch("SELECT * FROM `magazin_screen` WHERE `file` = ? ORDER BY `id` DESC LIMIT 1",[$file['id']]);
echo '<a href="/market/file/'.$file['id'].'" class="list-group-item media"><div class="pull-left"><img class="img-circle pull-left" src="/files/mag_screen/'.$screen['screen'].'" alt="" width="40" height="40"></div><div class="media-body"><div class="list-group-item-heading">'.$file['name'].' ('.vr($file['time']).')</div><small class="list-group-item-text">Стоимость: <b><font color="green">'.$file['price'].'</font></b> р.</small></div></a>';
}
echo'</div></div>';
?>