Вывод администратору точек на модерации

This commit is contained in:
Krivchikov Dmitry 2015-05-31 13:51:08 +03:00
parent 2a5f34f679
commit fa6a1cc2fb
2 changed files with 36 additions and 0 deletions

View File

@ -12,6 +12,29 @@ class PageController extends Controller
self::addStyle('/css/bootstrap.min.css'); self::addStyle('/css/bootstrap.min.css');
self::addStyle('/css/bootstrap-theme.min.css'); self::addStyle('/css/bootstrap-theme.min.css');
$notModeratedPoints = $result = array();
// On moderation
if (App::$user && App::$user->isAdmin) {
$param['order']='id DESC';
$param['where']= '`moderate` = 0';
$points = Point::model()->getAll($param);
$categories = Category::model()->getAll(array('order' => 'ord ASC'));
foreach ($points as $point) {
$id = $point->id;
$result[$id]['id'] = $point->id;
$result[$id]['name'] = $point->name;
$result[$id]['lat'] = $point->lat;
$result[$id]['lng'] = $point->lng;
$result[$id]['author'] = $point->authorUser->nick;
$result[$id]['categoryId'] = $point->categoryId;
$result[$id]['categoryIcon'] = $categories[$point->categoryId]->icon;
}
$notModeratedPoints = $result;
}
// ------------------------------------------
$param['order']='id DESC'; $param['order']='id DESC';
$param['where']=App::getParam('category') ? 'categoryId = '.(int)App::getParam('category') : ''; $param['where']=App::getParam('category') ? 'categoryId = '.(int)App::getParam('category') : '';
$points = Point::model()->getAll($param); $points = Point::model()->getAll($param);
@ -37,6 +60,7 @@ class PageController extends Controller
'categories' => $categories, 'categories' => $categories,
'user' => App::$user, 'user' => App::$user,
'points' => $result, 'points' => $result,
'notModeratedPoints' => $notModeratedPoints,
)); ));
} }

View File

@ -1,3 +1,15 @@
<?php if($notModeratedPoints):?>
<h3>Точки на модерации</h3>
<?php foreach ($notModeratedPoints as $point): ?>
#<?=$point['id']?> <img src="/ico/lock.png" />
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<img src="<?=$point['categoryIcon']?>" /> <a href="/page/point/id/<?=$point['id']?>"><?=$point['name']?></a>
<?=$point['author']?>
<br/>
<?php endforeach; ?>
<hr/>
<?php endif; ?>
<h3>Список точек</h3> <h3>Список точек</h3>
<?php foreach ($points as $point): ?> <?php foreach ($points as $point): ?>