Добавил страницу со сводкой по проекту

This commit is contained in:
Krivchikov Dmitry 2016-01-10 14:26:21 +03:00
parent 0cf7f4a698
commit 012573557c
2 changed files with 57 additions and 0 deletions

View File

@ -206,4 +206,50 @@ class PageController extends Controller
));
}
static function actionStatus()
{
if (App::$user && App::$user->isAdmin == 1) {
self::$layout = 'layouts/page.php';
self::addStyle('/css/style.css?ver=' . App::getConfig('version'));
self::addStyle('/css/pageStyle.css?ver=' . App::getConfig('version'));
self::addStyle('/css/bootstrap.min.css');
self::addScript('/js/jquery-2.1.0.min.js');
self::addScript('/js/bootstrap.min.js');
App::setConfig('title', 'Сводка по проекту');
$points = Point::model()->getCount(array(
'where' => '`status` = "published" AND `categoryId` NOT IN ('. implode(',', Category::$paidIds).')',
));
$paidPoints = Point::model()->getCount(array(
'where' => '`status` = "published" AND `categoryId` IN ('. implode(',', Category::$paidIds).')',
));
$notModeratedPoints = Point::model()->getCount(array(
'where' => '`status` = "moderation"',
));
$articles = Article::model()->getCount(array(
'where' => '`status` = "published"',
));
$comments = Comment::model()->getCount();
$users = User::model()->getCount();
self::render('page/status.php', array(
'points' => $points,
'paidPoints' => $paidPoints,
'notModeratedPoints' => $notModeratedPoints,
'articles' => $articles,
'comments' => $comments,
'users' => $users,
'randomPoint' => Point::model()->getRandom(),
));
} else {
App::error404();
}
}
}

11
views/page/status.php Normal file
View File

@ -0,0 +1,11 @@
<div id="pageSmoothBackground" style="background-image: url(<?= $randomPoint->getImg('middle') ?>);"></div>
<div class="container" style="background-color: rgba(255,255,255, 0.8);margin-top: -10px;padding-bottom: 30px; min-height: 100%;">
<h1>Сводка по проекту</h1>
<h3>Точек: <?= $points ?></h3>
Платных точек: <b><?= $paidPoints ?></b><br/>
Точек на модерации: <b><?= $notModeratedPoints ?></b><br/>
Статей: <b><?= $articles ?></b><br/>
Комментариев: <b><?= $comments ?></b><br/>
Пользователей: <b><?= $users ?></b><br/>
</div>