<?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> :: Новые товары</div></div></div>';
$k_post = DB::$dbs->querySingle("SELECT COUNT(id) FROM magazin_file");
if ($k_post == 0) {
err('Новых товаров нет!');
}
echo'<div class="t-body"><div class="list-group lg-alt">';
$num = 10;
$k_page = k_page($k_post, $num);
$page = page($k_page);
$start = $num*$page-$num;
$sql = DB::$dbs->query("SELECT * FROM magazin_file ORDER BY time DESC LIMIT $start,$num",[$id]);
while($a = $sql->fetch()) {
$New = ($a['time'] > time()-86400 ? '<font color="red"><b>[new]</b></font>':NULL);
$screen = DB::$dbs->queryFetch("SELECT * FROM `magazin_screen` WHERE `file` = ? ORDER BY `id` DESC LIMIT 1",[$a['id']]);
echo '<a href="/market/file/'.$a['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">'.$a['name'].' '.$New.' ('.vr($a['time']).')</div><small class="list-group-item-text">Стоимость: <b><font color="green">'.$a['price'].'</font></b> р.</small></div></a>';
}
echo'</div></div>';
if ($k_page > 1) {
str('?id='.$id.'&',$k_page,$page);
}
?>