Points list

This commit is contained in:
Krivchikov Dmitry 2015-06-28 10:10:44 +03:00
parent f4294405c6
commit a79ed2eba5
2 changed files with 12 additions and 2 deletions

View File

@ -36,7 +36,11 @@ class PageController extends Controller
// ------------------------------------------ // ------------------------------------------
$param['order']='id DESC'; $param['order']='id DESC';
$param['where']=App::getParam('category') ? 'categoryId = '.(int)App::getParam('category') : ''; if (App::getParam('category')) {
$param['where'] = 'categoryId = '.(int)App::getParam('category');
} else {
$param['limit'] = 100;
}
$points = Point::model()->getAll($param); $points = Point::model()->getAll($param);
$categories = Category::model()->getAll(array('order' => 'ord ASC')); $categories = Category::model()->getAll(array('order' => 'ord ASC'));

View File

@ -20,8 +20,14 @@ foreach ($categories as $category) {
} }
?> ?>
<?php
$header = 'Неплоный список точек (100 недавно добавленных)';
if ((int)App::getParam('category')) {
$header = 'Список точек в категории "'.$categories[(int)App::getParam('category')]->name.'"';
}
<h3>Список точек</h3> ?>
<h3><?=$header?></h3>
<?php foreach ($points as $point): ?> <?php foreach ($points as $point): ?>
#<?=$point['id']?> <img src="<?=$point['categoryIcon']?>" /> <a href="/page/point/id/<?=$point['id']?>"><?=$point['name']?></a> #<?=$point['id']?> <img src="<?=$point['categoryIcon']?>" /> <a href="/page/point/id/<?=$point['id']?>"><?=$point['name']?></a>