<?php
require_once('../classes/body.class.php');
require_once('../classes/db.class.php');
require_once('../classes/system.class.php');
$title= new Body;

$id = isset($_GET['id']) ? abs((int)$_GET['id']) : false;
$array = DB :: $dbs -> query ("SELECT * FROM down_r WHERE `id` = ?",[$id]);
if ($array -> rowCount() == 0) {
header('location: /');
die();
}
$r = $array -> fetch ();
$title->SetTitle('Загруз-центр - '.$r['name']);
///Подключаем шапку
$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>Категория - '.$r['name'].' </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">'.$r['name'].'</span></li></ol></div><div class="col-xs-12 col-sm-4 col-md-3 col-lg-3 text-right page_header_sidebar"></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="/downs"><i class="md-format-list-bulleted"></i> Загруз-центр</a> - '.$r['name'].'</div>';
if (DB :: $dbs -> querySingle ("SELECT COUNT(id) FROM `down_pr` WHERE `id_r`= ?", [$r['id']])!=0) {
$query = DB::$dbs -> query("SELECT * FROM `down_pr` WHERE `id_r`= ?ORDER BY `id`", [$r['id']]);
while ($pr = $query -> fetch ()) {
echo '<div class="row text_box"><a href="show_kat.html?id=' . $pr['id'] . '"><i class="md-folder"></i> ' . $pr['name'] . ' ('.DB :: $dbs -> querySingle ("SELECT COUNT(id) FROM `downs` WHERE `prid`= ? AND `mod` = ?", [$pr['id'],0]).')</div></a>'; }
} else {
err('Подразделы ещё не созданы!');
}

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


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