From 8c24272371589ce5ffa8f33c10ae30bfeb992640 Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Sat, 5 Dec 2015 11:25:45 +0300 Subject: [PATCH] =?UTF-8?q?ADD=20=D0=B8=D0=B7=D0=B1=D1=80=D0=B0=D0=BD?= =?UTF-8?q?=D0=BD=D0=BE=D0=B5=20=D0=BD=D0=B0=20=D0=BE=D1=82=D0=B4=D0=B5?= =?UTF-8?q?=D0=BB=D1=8C=D0=BD=D0=BE=D0=B9=20=D1=81=D1=82=D1=80=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D1=86=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/UserController.php | 16 ++++++++++++++ models/Category.php | 10 +++++++++ views/indexTemplate.php | 2 ++ views/user/favorites.php | 40 ++++++++++++++++++++++++++++++++++ 4 files changed, 68 insertions(+) create mode 100644 views/user/favorites.php diff --git a/controllers/UserController.php b/controllers/UserController.php index 44c0d86..77dc326 100644 --- a/controllers/UserController.php +++ b/controllers/UserController.php @@ -89,4 +89,20 @@ class UserController extends Controller 'randomPoint' => $randomPoint, )); } + + function actionFavorites() + { + if (!App::$user) { + App::redirect('/'); + } + + $randomPoint = Point::model()->getRandom(); + $randomPoint->description = mb_substr($randomPoint->description, 0, 400, 'UTF-8'); + $randomPoint->description = Helper::replaceLinks($randomPoint->description); + + self::render('user/favorites.php', array( + 'favorites' => Favorite::model()->getAllMy(), + 'randomPoint' => $randomPoint, + )); + } } diff --git a/models/Category.php b/models/Category.php index f4805b7..a0ca786 100644 --- a/models/Category.php +++ b/models/Category.php @@ -2,6 +2,7 @@ class Category extends Model { + private static $categories = NULL; function __construct($fromArray = array()) { @@ -15,4 +16,13 @@ class Category extends Model return new self(); } + static function getIcoById($id) + { + if (self::$categories === NULL) { + self::$categories = self::model()->getAll(array('asArray'=>true)); + } + + return (isset(self::$categories[$id])) ? self::$categories[$id]['icon'] : NULL; + } + } diff --git a/views/indexTemplate.php b/views/indexTemplate.php index eae8904..d7026af 100644 --- a/views/indexTemplate.php +++ b/views/indexTemplate.php @@ -109,6 +109,8 @@ if (App::$user) {

Хочу посетить

+ На отдельной странице +
point->name ?>
diff --git a/views/user/favorites.php b/views/user/favorites.php new file mode 100644 index 0000000..35411ae --- /dev/null +++ b/views/user/favorites.php @@ -0,0 +1,40 @@ +
+ +
+
+
+

Ваши избраные точки

+
+ Перейти: на карту + + / страница nick?>. + +
+
+
+ point;?> + +
+ + + name ?> + +
+
+ +
+
+
+
+
+
+
+ +

Это интересно: name ?>

+

+ description, 0, 400, 'UTF-8') ?>… + читать далее » +

+
+
+