<?php
require_once('../classes/body.class.php');
require_once('../classes/db.class.php');
require_once('../classes/system.class.php');
$title= new Body;
$title->SetTitle('Панель управления - Модерация рейтинга');
$title->GetHeader();
if ($b['level'] < 1) {
header('location:/');
die();
}
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="/administration/"style="text-decoration:none; color:white;"> Дата-центр</a> :: Модерация рейтинга</div></div></div>';

if (isset($_GET['da'])) {
$in = DB::$dbs->queryFetch("SELECT * FROM arbitage WHERE id = ? LIMIT 1",array(intval($_GET['id'])));
DB :: $dbs -> query ("UPDATE arbitage SET status = ? WHERE id = ?",array(0,abs(intval($_GET['id']))));
header('location: ?');
}
if (isset($_GET['net'])) {
DB :: $dbs -> query ("DELETE FROM arbitage WHERE id = ?",array(abs(intval($_GET['id']))));
header('location: ?');
}
$look = DB :: $dbs -> querySingle("SELECT COUNT(id) FROM arbitage WHERE status = ?",[1]);
$num = 10;
$k_page = k_page($look, $num);
$page = page($k_page);
$start = $num*$page-$num;
if ($look==0) {
echo '<div class="alert alert-danger" role="alert"">Нет отзывов на модерации!</div>';
} else {
$query = DB :: $dbs -> query("SELECT * FROM arbitage WHERE status = ? ORDER BY time DESC LIMIT $start,$num",[1]);
while ($arr = $query -> fetch()) {
echo '<div class="list-group-item media"><i class="zmdi zmdi-forum"></i> '.Nick($arr['id_user']).' оставил <b>'.($arr['type'] == 1 ? '<font color="green">Замечательный</font>':'<font color="red">Негативный</font>').'</b> отзыв для  '.Nick($arr['user_id']).' ('.vr($arr['time']).')<br/><br/>Текст: '.text($arr['text']).'<br/></div>
<div class="list-group-item media"><i class="zmdi zmdi-shuffle"></i> <a href="?da&id='.$arr['id'].'"> [подтвердить]</a> / <a href="?net&id='.$arr['id'].'">[отклонить]</a></div>';
}
if ($k_page>1) {
str('?id='.$id.'&', $k_page,$page);
}}

$title->GetMenu();
$title->GetFooter();
?>
