diff --git a/ground/controllers/IndexController.php b/ground/controllers/IndexController.php index 7569d49..aaff145 100644 --- a/ground/controllers/IndexController.php +++ b/ground/controllers/IndexController.php @@ -14,51 +14,4 @@ class IndexController extends Controller 'category' => $category->getAll(), )); } - - /** - * Проверка передачи переменных в шаблон - */ - static function actionTest() - { - self::render('testTemplate.php', array( - 'name' => 'Dmitry', - 'fname' => 'Krivchikov', - 'phone' => '+7-904-610-6141', - )); - } - - static function actionPoints() - { - $points = new Point(); - $points = $points->getAll(); - - $categories = new Category(); - $categories = $categories->getAll(); - - foreach ($points as &$point) { - $point['categoryIcon'] = $categories[$point['categoryId']]['icon']; - $point['categoryName'] = $categories[$point['categoryId']]['name']; - } - - self::renderPartial('json.php', array( - 'data' => $points, - )); - } - - /** - * Вывод элемента каталога. ID товара берётся из параметра /index/catalog/id/1 - */ - static function actionCatalog() - { - $id = (int) App::getParam('id'); - if ($id) - { - $goods = new Goods(); - self::render('goods.php', $goods->getByPK($id)); - } else - { - App::error404(); - } - } - } diff --git a/ground/controllers/JsonController.php b/ground/controllers/JsonController.php new file mode 100644 index 0000000..3338604 --- /dev/null +++ b/ground/controllers/JsonController.php @@ -0,0 +1,63 @@ +getAll(); + + $categories = new Category(); + $categories = $categories->getAll(); + + foreach ($points as &$point) { + $point['categoryIcon'] = $categories[$point['categoryId']]['icon']; + $point['categoryName'] = $categories[$point['categoryId']]['name']; + } + + self::renderPartial('json.php', array( + 'data' => $points, + )); + } + + /** + * Точка + */ + static function actionPoint() + { + $id = (int) App::getParam('id'); + if ($id) + { + $point = new Point(); + $point = $point->getByPK($id); + + $categories = new Category(); + $categories = $categories->getAll(); + + $point['categoryIcon'] = $categories[$point['categoryId']]['icon']; + $point['categoryName'] = $categories[$point['categoryId']]['name']; + + self::renderPartial('json.php', $point); + } else + { + App::error404(); + } + } + + /** + * Категории + */ + static function actionCategories() + { + $categories = new Category(); + $categories = $categories->getAll(); + + self::renderPartial('json.php', array( + 'data' => $categories, + )); + } +} diff --git a/ground/controllers/YandexController.php b/ground/controllers/YandexController.php deleted file mode 100644 index ccd57f0..0000000 --- a/ground/controllers/YandexController.php +++ /dev/null @@ -1,21 +0,0 @@ -getAll(); - $goodsSet = $goods->getAll(); - - self::renderPartial('yandexMarket.php', array( - 'categorySet' => $categorySet, - 'goodsSet' => $goodsSet, - )); - } - -} diff --git a/ground/views/layout.php b/ground/views/layout.php index e63b36c..d62a36d 100644 --- a/ground/views/layout.php +++ b/ground/views/layout.php @@ -6,7 +6,9 @@