<?php
require_once('classes/body.class.php');
require_once('classes/db.class.php');
require_once('classes/system.class.php');
$title= new Body;
$title->SetTitle(''.homeurl.' - Список мастеров!');
///Подключаем шапку
$title->GetHeader();

echo '<div class="container-fluid page_header"><div class="container"><div class="row"><div class="col-xs-12 col-sm-8 col-md-9 col-lg-9"><h1>Пользователи </h1><ol class="breadcrumb" xmlns:v="http://'.homeurl.'/#"><li typeof="v:Breadcrumb"><a href="/" rel="v:url" property="v:title">'.homeurl.'</a></li><li class="active" typeof="v:Breadcrumb"><span property="v:title">Список мастеров</span></li></ol></div></div></div></div>';
echo'<div class="container page_body"><div class="row"><div class="col-xs-12 page_content col-lg-9"><div class="navbar page_content_navbar collapse hidden-lg"><div class="container-fluid"><div class="navbar-collapse"></div></div></div><div class="text_box hidden-lg pr_block_small hidden"></div><div class="container-fluid cols_table">';

echo '<div class="catSides"><a href="/"><i class="md-format-list-bulleted"></i> Главная </a> - Список мастеров</div>';
echo '<ul class="nav nav-pills nav-stacked"><li><a href="/search"><i class="md-search"></i>  Поиск мастеров</a></ul>';
$sort = check($_GET['sort']);
$sort_desc = (empty($sort) ? 'id' : $sort);
if ($sort == 'id') {
$pages = '';
} else {
$pages = 'sort='.$sort_desc;
}
if (empty($sort)) {
header('location: ?sort=id');
}
echo '<div class="row text_box"><div class="pull-right text-muted top_right_box"></div>';
echo 'Сортировать:<br />По: ';
$arrSort = array('id'=>'ID','reg'=>'Дата реги','gears'=>'Gears','post'=>'Кол-во Постов','row'=>'Статусу','total_onl'=>'Онлайн');
foreach($arrSort as $v => $value){
echo '<a href="?sort='.$v.'">'.$value.'</a> | ';
}
echo '</div>';
if ($sort == 'id') {
$desc = 'ASC';
} else {
$desc = 'DESC';
}
$look = DB::$dbs->querySingle("SELECT COUNT(id) FROM blogger");
if ($look == 0) {
err('Пусто!');
}
$num = 10;
$k_page = k_page($look, $num);
$page = page($k_page);
$start = $num*$page-$num;
$sql = DB::$dbs->query("SELECT * FROM blogger ORDER BY ".$sort_desc." ".$desc." LIMIT $start,$num");
$i = 0;
while($a = $sql->fetch()) {
$i++;
$col = $start + $i;
$sort_row = strtr($a['row'],$row);
echo '<div class="row"><div class="col-xs-3 col-sm-1"><div class="user_brief">'.$col.') '.Nick($a['id']).' '.($sort == 'post' ? '(<b>'.$a['post'].'</b> Постов)':NULL).($sort == 'gears' ? '(<b>'.$a['gears'].'</b>  Gears)':NULL).($sort == 'id' ? '(ID: <b>'.$a['id'].'</b>)' : NULL).($sort == 'reg' ? '(Дата реги: <b>'.vr($a['reg']).'</b>)' : NULL).($sort == 'row' ? '('.$sort_row.')': NULL).($sort == 'total_onl' ? '('.timecount($a['total_onl']).')':NULL).'</div></div></div>';
}
if ($k_page > 1) {
str('?sort='.$sort.'&',$k_page,$page);
}

///Подключаем меню
$title->GetMenu();


///Подключаем футер
$title->GetFooter();
?>
