ADD платные точки - добавление, другой цвет, определение платности точки
This commit is contained in:
parent
fd6733e43d
commit
2607750376
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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] = 'Неверное название точки';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -146,4 +146,9 @@ class Point extends Model
|
|||
return self::statusModeration;
|
||||
}
|
||||
}
|
||||
|
||||
public function isPaid()
|
||||
{
|
||||
return Category::isPaidCategory($this->categoryId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
ff7112
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 777 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
|
|
@ -173,9 +173,10 @@ function showRandomPoint()
|
|||
runner = 0;
|
||||
for (var key in points)
|
||||
{
|
||||
if (runner++ >= roundIndex)
|
||||
if (runner++ >= roundIndex) {
|
||||
return showInfo(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ if (App::$user) {
|
|||
<?php endif; ?>
|
||||
</div>
|
||||
<?= $user ? '' : self::renderPartial('modals/login.php', null, true) ?>
|
||||
<?= $user ? self::renderPartial('modals/addPoint.php', array('categories' => $categories), true) : '' ?>
|
||||
<?= $user ? self::renderPartial('modals/addPoint.php', array('categories' => Category::model()->getCategoriesForChoise()), true) : '' ?>
|
||||
<?= self::renderPartial('modals/categories.php', array('categories' => $categories), true) ?>
|
||||
<?= self::renderPartial('modals/image.php', array(), true) ?>
|
||||
<map name="vkbutton">
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
<label class="control-label" for="categoryId">Тип</label>
|
||||
<select id="addPointCategoryId" name="categoryId" class="form-control">
|
||||
<?php foreach ($categories as $category): ?>
|
||||
<option value="<?= $category->id ?>"><?= $category->name ?></option>
|
||||
<option value="<?= $category['id'] ?>"><?= $category['name'] ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue