<?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();

if ($b == false){
header('location:/');
die();
}

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 typeof="v:Breadcrumb"><a href="/office" rel="v:url" property="v:title">Кабинет</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> -<a href="/office"> Кабинет</a> - Тема оформления </div>';
echo '<div class="row text_box"><form method="post" action="?style">Выбрать дизайн:<br/><select  class="form-control" name="style">';
 ////////////////////////////////////////////////////////////
 $s_default = DB::$dbs->querySingle( "SELECT COUNT(*) FROM `blogger` WHERE (`style` = 'default')" );
 echo '<option value="default"';
 if ( $b[ 'style' ] == "default" ) echo 'selected';
 echo '>Стандартный (' . $s_default . ')</option>';
 ////////////////////////////////////////////////////////////
 $s_green = DB::$dbs->querySingle( "SELECT COUNT(*) FROM `blogger` WHERE (`style` = 'green')" );
 echo '<option value="green"';
 if ( $b[ 'style' ] == "green" ) echo 'selected';
 echo '>Темно зеленый (' . $s_green . ')</option>';
 ////////////////////////////////////////////////////////////


 echo '</select><br/><input type="submit" class="btn btn-primary" value="Установить"/></form></div>';
 if ( isset( $_GET[ 'style' ] ) ) {
     DB::$dbs->query( "UPDATE `blogger` SET `style` = ? WHERE `id` = ?", [ $_POST[ 'style' ],$b[ 'id' ]  ] );
     header( 'refresh:3; url=/' );
     echo '<div class="row text_box">Тема оформления успешно изменена!</div>';
 } 

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

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