FIX - сортировка, вывод ника вместо имени

This commit is contained in:
Krivchikov Dmitry 2014-07-27 01:26:47 +04:00
parent eab2a90b34
commit 93ba81e0d9
2 changed files with 9 additions and 9 deletions

View File

@ -9,7 +9,7 @@ class JsonController extends Controller
static function actionPoints() static function actionPoints()
{ {
$points = Point::model()->getAll(); $points = Point::model()->getAll();
$categories = Category::model()->getAll(array('asArray'=>true)); $categories = Category::model()->getAll(array('order' => 'ord ASC', 'asArray' => true));
$result = array(); $result = array();
@ -41,7 +41,7 @@ class JsonController extends Controller
$point->descriptionHtml = nl2br($point->description); $point->descriptionHtml = nl2br($point->description);
$point->name = htmlspecialchars($point->name); $point->name = htmlspecialchars($point->name);
$categories = Category::model()->getAll(array('asArray'=>true)); $categories = Category::model()->getAll(array('order' => 'ord ASC', 'asArray' => true));
$point->categoryIcon = $categories[$point->categoryId]['icon']; $point->categoryIcon = $categories[$point->categoryId]['icon'];
$point->categoryName = $categories[$point->categoryId]['name']; $point->categoryName = $categories[$point->categoryId]['name'];
@ -58,7 +58,7 @@ class JsonController extends Controller
*/ */
static function actionCategories() static function actionCategories()
{ {
$categories = Category::model()->getAll(array('asArray'=>true)); $categories = Category::model()->getAll(array('order' => 'ord ASC', 'asArray' => true));
self::renderPartial('json.php', array( self::renderPartial('json.php', array(
'data' => $categories, 'data' => $categories,

View File

@ -15,7 +15,7 @@ class PageController extends Controller
$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);
$categories = Category::model()->getAll(); $categories = Category::model()->getAll(array('order' => 'ord ASC'));
$result = array(); $result = array();
@ -25,7 +25,7 @@ class PageController extends Controller
$result[$id]['name'] = $point->name; $result[$id]['name'] = $point->name;
$result[$id]['lat'] = $point->lat; $result[$id]['lat'] = $point->lat;
$result[$id]['lng'] = $point->lng; $result[$id]['lng'] = $point->lng;
$result[$id]['author'] = $point->authorUser->name; $result[$id]['author'] = $point->authorUser->nick;
$result[$id]['categoryId'] = $point->categoryId; $result[$id]['categoryId'] = $point->categoryId;
$result[$id]['categoryIcon'] = $categories[$point->categoryId]->icon; $result[$id]['categoryIcon'] = $categories[$point->categoryId]->icon;
} }
@ -61,7 +61,7 @@ class PageController extends Controller
$point->descriptionHtml = nl2br($point->description); $point->descriptionHtml = nl2br($point->description);
$point->name = htmlspecialchars($point->name); $point->name = htmlspecialchars($point->name);
$categories = Category::model()->getAll(array('asArray' => true)); $categories = Category::model()->getAll(array('order' => 'ord ASC', 'asArray' => true));
$point->categoryIcon = $categories[$point->categoryId]['icon']; $point->categoryIcon = $categories[$point->categoryId]['icon'];
$point->categoryName = $categories[$point->categoryId]['name']; $point->categoryName = $categories[$point->categoryId]['name'];