diff --git a/ground/controllers/GoController.php b/ground/controllers/GoController.php new file mode 100644 index 0000000..a280674 --- /dev/null +++ b/ground/controllers/GoController.php @@ -0,0 +1,28 @@ + date('c'), + 'url' => $url, + 'ref' => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '', + )); + $go->save(); + App::redirect($url, 302); + } else { + App::log('goAwayErrors', $url); + App::error404(); + } + } +} diff --git a/ground/controllers/PointController.php b/ground/controllers/PointController.php index 93c6a6a..8ed92f6 100644 --- a/ground/controllers/PointController.php +++ b/ground/controllers/PointController.php @@ -101,6 +101,7 @@ class PointController extends Controller 'photoLinks' => $photoLinksRes, 'articles' => $articles, 'extraParams' => $point->getExtraParams(), + 'goods' => Goods::model()->getRandom(6), )); } else { App::error404(); diff --git a/ground/models/GoAway.php b/ground/models/GoAway.php new file mode 100644 index 0000000..c27ea7b --- /dev/null +++ b/ground/models/GoAway.php @@ -0,0 +1,17 @@ +_tableName_ = 'goAway'; + parent::__construct($fromArray); + } + + static function model() + { + return new self(); + } + +} diff --git a/ground/models/Goods.php b/ground/models/Goods.php new file mode 100644 index 0000000..50d309b --- /dev/null +++ b/ground/models/Goods.php @@ -0,0 +1,24 @@ +_tableName_ = 'goods'; + parent::__construct($fromArray); + } + + static function model() + { + return new self(); + } + + function getRandom($count = 6) + { + return $this->getAll(array( + 'order' => 'RAND()', + 'limit' => (int) $count, + )); + } +} diff --git a/ground/views/point.php b/ground/views/point.php index 201ef8f..7cc4600 100644 --- a/ground/views/point.php +++ b/ground/views/point.php @@ -90,19 +90,7 @@ $index = 0; Использованы фотоматериалы с сайтов: = $photoLinks ?> -
+
id): ?> [ ] [ ] @@ -150,6 +138,16 @@ $index = 0;