<?

$PageConfig = [	
	'title' =>  'Админ панель',
];
PageConfig($PageConfig);

$count = $sql->fetch("
	SELECT * FROM
	(SELECT COUNT(*) AS `trash` FROM `news` where `act` = 2) AS q1, 
	(SELECT COUNT(*) AS `pub` FROM `news` where `act` = 1) AS q2,
	(SELECT COUNT(*) AS `queue` FROM `news` where `act` = 0) AS q3,
	(SELECT COUNT(*) AS `all` FROM `news` where `act` != 4) AS q4,
	(SELECT COUNT(*) AS `users` FROM `news` where `act` = 3) AS q5,
	(SELECT COUNT(*) AS `freeze` FROM `news` where `act` = 4) AS q6,
	(SELECT COUNT(*) AS `new` FROM `news` where `date_create` > '". mktime(0, 0, 0) ."') AS q7,
	(SELECT COUNT(*) AS `userslist` FROM `users`) AS q8,
	(SELECT COUNT(*) AS `admins` FROM `news` where `act` = 5) AS q9,
	(SELECT COUNT(*) AS `adminslist` FROM `users` where `id_level` > '0') AS q10,
	(SELECT COUNT(*) AS `userslistnew` FROM `users` where `date_create` > '". (time() - 86400) ."') AS q11
");

/*
	name = название *
	link = ссылка *
	count = счётчик
	icon = иконка раздела
	icon_color = цвет иконки
	plus = true Скрывает "+"
	* = Обязательные 
*/

$data[] = ['name' => 'Все новости', 'link' => 'news-type?t=all', 'count' => $count['all'], 'plus' => true];
$data[] = ['name' => 'Новые за сутки', 'link' => 'news-type?t=new', 'count' => $count['new']];
$data[] = ['name' => 'В очереди на публикацию', 'link' => 'news-type?t=queue', 'count' => $count['queue'], 'plus' => true];
$data[] = ['name' => 'Новости от пользователей', 'link' => 'news-type?t=users', 'count' => $count['users'], 'plus' => true];
$data[] = ['name' => 'Все опубликованные','link' => 'news-type?t=pub', 'count' => $count['pub'], 'plus' => true];
$data[] = ['name' => 'В заморозке','link' => 'news-type?t=freeze', 'count' => $count['freeze'], 'plus' => true];
$data[] = ['name' => 'Новости от администрации','link' => 'news-type?t=admins', 'count' => $count['admins'], 'plus' => true];



if ($user['id_level'] >= 2) {
	$data[] = ['name' => 'На удаление (корзина)','link' => 'news-type?t=trash', 'count' => $count['trash'], 'icon' => 'fa-trash-o', 'icon_color' => '#3ead46', 'plus' => true];
}
$data[] = ['name' => 'Добавить новость','link' => '/user/news-add/', 'icon' => 'fa-plus-circle', 'icon_color' => '#3ead46'];
//$data[] = ['name' => 'Статистика системы', 'link' => 'statistics', 'icon' => 'fa-question-circle', 'icon_color' => '#76a6d8'];
if ($user['id_level'] >= 2) {
	$data[] = ['name' => 'Настройка разделов','link' => 'razd', 'icon' => 'fa-registered', 'icon_color' => '#3ead46'];
	$data[] = ['name' => 'Настройки системы', 'link' => 'settings-system', 'icon' => 'fa-cube', 'icon_color' => '#f49c95'];
	$data[] = ['name' => 'Логотип сайта', 'link' => 'logotype', 'icon' => 'fa-file-image-o', 'icon_color' => '#76a6d8'];
}
$data[] = ['name' => 'Пользователи сайта', 'link' => 'users', 'icon' => 'fa-user-circle-o', 'icon_color' => '#ff939e', 'count' => $count['userslist'], 'plus' => true];
$data[] = ['name' => 'Новые пользователи', 'link' => 'users?t=new', 'icon' => 'fa-user-circle-o', 'icon_color' => '#5aad55', 'count' => $count['userslistnew']];
$data[] = ['name' => 'Администрация сайта', 'link' => 'users?t=admins', 'icon' => 'fa-users', 'icon_color' => '#dc3545', 'count' => $count['adminslist'], 'plus' => true];

$t->assign('data', $data);
echo $t->fetch('apanel.index');