From 2607750376edd610368445a34fadd8bb5eb76dda Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Thu, 7 Jan 2016 01:21:33 +0300 Subject: [PATCH] =?UTF-8?q?ADD=20=D0=BF=D0=BB=D0=B0=D1=82=D0=BD=D1=8B?= =?UTF-8?q?=D0=B5=20=D1=82=D0=BE=D1=87=D0=BA=D0=B8=20-=20=D0=B4=D0=BE?= =?UTF-8?q?=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5,=20=D0=B4?= =?UTF-8?q?=D1=80=D1=83=D0=B3=D0=BE=D0=B9=20=D1=86=D0=B2=D0=B5=D1=82,=20?= =?UTF-8?q?=D0=BE=D0=BF=D1=80=D0=B5=D0=B4=D0=B5=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D0=BF=D0=BB=D0=B0=D1=82=D0=BD=D0=BE=D1=81=D1=82=D0=B8?= =?UTF-8?q?=20=D1=82=D0=BE=D1=87=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/IndexController.php | 14 +------------- controllers/JsonController.php | 2 +- models/Category.php | 15 +++++++++++++++ models/Point.php | 5 +++++ public/ico/color | 1 + public/ico/hotel_c.png | Bin 0 -> 777 bytes public/ico/restaurant_c.png | Bin 0 -> 1516 bytes public/js/app.js | 5 +++-- views/indexTemplate.php | 2 +- views/modals/addPoint.php | 2 +- 10 files changed, 28 insertions(+), 18 deletions(-) create mode 100644 public/ico/color create mode 100644 public/ico/hotel_c.png create mode 100644 public/ico/restaurant_c.png diff --git a/controllers/IndexController.php b/controllers/IndexController.php index 6c9839a..aff3986 100644 --- a/controllers/IndexController.php +++ b/controllers/IndexController.php @@ -43,6 +43,7 @@ class IndexController extends Controller self::addScript('//ulogin.ru/js/ulogin.js'); $category = Category::model()->getAll(array('order' => 'ord ASC')); + $categoryArray = Category::model()->getAll(array('order' => 'ord ASC', 'asArray' => true)); $routes = array(); $favorites = array(); @@ -60,11 +61,6 @@ class IndexController extends Controller self::addVar('pointLat', (isset($_GET['lat'])?floatval($_GET['lat']):0)); self::addVar('pointLng', (isset($_GET['lng'])?floatval($_GET['lng']):0)); - $categoryArray = array(); - foreach ($category as $cat) { - $categoryArray[] = $cat->getValues(); - } - $og = array(); if (isset($_GET['point']) && $_GET['point'] && is_numeric($_GET['point'])) { $id = (int) $_GET['point']; @@ -98,14 +94,6 @@ class IndexController extends Controller )); } - static function actionUser() - { - App::error404(); - $routes = Route::model()->getByAuthor(App::$user->id); - - var_dump($routes); - } - static function actionLogout() { App::userLogout(); diff --git a/controllers/JsonController.php b/controllers/JsonController.php index abbfdf1..1f22e97 100644 --- a/controllers/JsonController.php +++ b/controllers/JsonController.php @@ -225,7 +225,7 @@ class JsonController extends Controller $_POST['description'] = strip_tags($_POST['description']); } - if (!( isset($_POST['name']) && $_POST['name'] && strlen($_POST['name']) > 5 )) { + if (!( isset($_POST['name']) && $_POST['name'] && strlen($_POST['name']) >= 5 )) { $errors[1] = 'Неверное название точки'; } diff --git a/models/Category.php b/models/Category.php index a0ca786..56e84ad 100644 --- a/models/Category.php +++ b/models/Category.php @@ -3,6 +3,7 @@ class Category extends Model { private static $categories = NULL; + private static $paidIds = array(24,25); function __construct($fromArray = array()) { @@ -25,4 +26,18 @@ class Category extends Model return (isset(self::$categories[$id])) ? self::$categories[$id]['icon'] : NULL; } + public function getCategoriesForChoise() + { + if (App::$user && App::$user->isAdmin == 1) { + return $this->getAll(array('order' => 'ord ASC', 'asArray' => true)); + } else { + return $this->getAll(array('where' => '`id` NOT IN ('. implode(',', $this->paidIds).')', 'order' => 'ord ASC', 'asArray' => true)); + } + } + + public static function isPaidCategory($id) + { + return array_search($id, self::$paidIds) !== FALSE; + } + } diff --git a/models/Point.php b/models/Point.php index 81ce1ae..346d198 100644 --- a/models/Point.php +++ b/models/Point.php @@ -146,4 +146,9 @@ class Point extends Model return self::statusModeration; } } + + public function isPaid() + { + return Category::isPaidCategory($this->categoryId); + } } diff --git a/public/ico/color b/public/ico/color new file mode 100644 index 0000000..d73c924 --- /dev/null +++ b/public/ico/color @@ -0,0 +1 @@ +ff7112 diff --git a/public/ico/hotel_c.png b/public/ico/hotel_c.png new file mode 100644 index 0000000000000000000000000000000000000000..15c166c642419943223750b4fed72460210a5599 GIT binary patch literal 777 zcmV+k1NQuhP)l&H6vuy1poXBRN<~M+T&arMOjU<2W@*-r{S;jyhJFB+eu=IbnF?!_DXRJn5Tm7{ zDxvgZ9J>Se$eG+3J2H9F$@V?_{=a*EKHsY(NdiE>->(5xprMa7%C!iHfe?tt<8cH~ zNs>gw8-S-u&d`ES_qna7y$%p?jW`C48U4WkGPAt8Z@r0G+`o zbuKHX%>=Fpq!SZ>%{+}uP2!Iks=f1kdg)G9YbMg$T%gAvV>(@l@}@;#j| z-<{%}!HDLY4|E2j+z?iP^?(u78rFxDx{E?eT*Ed`PIE&zBA{n~+`s2(9`|(=Dpv8$ zeK{el09msKAPP}xWv;GC!KJmNyZC2Kn>%nG?fNchOd|Ce4Y;KK$`xSiseZPOlAJOIS zo+t46xz*>6Kt|#`)QUymkxY^>el*29iv=Ju8cN;nP0<*8qgmyyTv7nbWwaLv*_O+t z){HB@?>B%p@QjSYq}My(=;&!KvHARl>GZGFrwfw+_ya6ztRtXUmrLlP!7RD+P`r#s4XIhy6$PaA|G{#wsc z-m?i{FVC|~gL$m;q^%)-nGlBfu@+zGrbNhPI{_RJZHWY6&U`@u@!S9wh(ir=3CKHN zuuiVr;)MXVAX>V~#xZ0a`ehOE!T<(@B&B?+@`;5-!~y;Tr#Y@57<=cc00000NkvXX Hu0mjf@)C9K literal 0 HcmV?d00001 diff --git a/public/ico/restaurant_c.png b/public/ico/restaurant_c.png new file mode 100644 index 0000000000000000000000000000000000000000..5a0f39288569b715628334fe898e82495e00fa39 GIT binary patch literal 1516 zcmVZ^*cs;SSi)>0IUVk@Yig0*TF6`%O%s;#er zqM{xUL(BD}d@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5DLL%d~x z86e_5#9knXc@ZzUS{82$;3x>qZ^5Bp;<;XLN4#x-I*1@CgQXfQF|!?Ufd2p^mf6D= S7_jC50000= roundIndex) - return showInfo(key); + if (runner++ >= roundIndex) { + return showInfo(key); + } } } diff --git a/views/indexTemplate.php b/views/indexTemplate.php index d7026af..1b1c9d5 100644 --- a/views/indexTemplate.php +++ b/views/indexTemplate.php @@ -136,7 +136,7 @@ if (App::$user) { - $categories), true) : '' ?> + Category::model()->getCategoriesForChoise()), true) : '' ?> $categories), true) ?> diff --git a/views/modals/addPoint.php b/views/modals/addPoint.php index 7b1c22b..c1fede5 100644 --- a/views/modals/addPoint.php +++ b/views/modals/addPoint.php @@ -42,7 +42,7 @@