Нормальная реализация избранного
This commit is contained in:
parent
7a762de04d
commit
28d10be26f
|
|
@ -154,7 +154,6 @@ abstract class Model
|
||||||
$sql .= isset($params['where'])&&$params['where'] ? ' WHERE ' . $params['where'] : '';
|
$sql .= isset($params['where'])&&$params['where'] ? ' WHERE ' . $params['where'] : '';
|
||||||
$sql .= isset($params['order'])&&$params['order'] ? ' ORDER BY ' . $params['order'] : '';
|
$sql .= isset($params['order'])&&$params['order'] ? ' ORDER BY ' . $params['order'] : '';
|
||||||
$sql .= isset($params['limit'])&&$params['limit'] ? ' LIMIT ' . $params['limit'] : '';
|
$sql .= isset($params['limit'])&&$params['limit'] ? ' LIMIT ' . $params['limit'] : '';
|
||||||
|
|
||||||
$res = App::DB()->query($sql);
|
$res = App::DB()->query($sql);
|
||||||
|
|
||||||
$ready = array();
|
$ready = array();
|
||||||
|
|
@ -176,12 +175,10 @@ abstract class Model
|
||||||
*/
|
*/
|
||||||
function getOne($whereField, $whereValue)
|
function getOne($whereField, $whereValue)
|
||||||
{
|
{
|
||||||
return array_shift(
|
return $this->getAll(array(
|
||||||
$this->getAll(array(
|
|
||||||
'where' => '`' . $whereField . '` = "' . $whereValue . '"',
|
'where' => '`' . $whereField . '` = "' . $whereValue . '"',
|
||||||
'limit' => 1
|
'limit' => 1
|
||||||
))
|
));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,6 @@ class IndexController extends Controller
|
||||||
{
|
{
|
||||||
$source = file_get_contents('http://ulogin.ru/token.php?token=' . $_POST['token'] . '&host=' . $_SERVER['HTTP_HOST']);
|
$source = file_get_contents('http://ulogin.ru/token.php?token=' . $_POST['token'] . '&host=' . $_SERVER['HTTP_HOST']);
|
||||||
$uLoginUser = json_decode($source, true);
|
$uLoginUser = json_decode($source, true);
|
||||||
//var_dump($uLoginUser);die;
|
|
||||||
$uLoginUser['identity'] = md5($uLoginUser['uid'] . $uLoginUser['network'] . '=P');
|
$uLoginUser['identity'] = md5($uLoginUser['uid'] . $uLoginUser['network'] . '=P');
|
||||||
|
|
||||||
$user = User::model()->getByUID($uLoginUser['identity']);
|
$user = User::model()->getByUID($uLoginUser['identity']);
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
<?php if ($user): ?>
|
<?php if ($user): ?>
|
||||||
<div class="glyphicon glyphicon-map-marker _t" id="addPointButton" title="Добавить точку" onclick="activateAddPoint()"></div>
|
<div class="glyphicon glyphicon-map-marker _t" id="addPointButton" title="Добавить точку" onclick="activateAddPoint()"></div>
|
||||||
|
<div class="glyphicon glyphicon-star _c boxButtonFavorites" onclick="openBox('Favorites')" title="Хочу посетить"></div>
|
||||||
<div class="glyphicon glyphicon-cloud-download _c boxButtonRoutes" onclick="openBox('Routes')" title="Мои маршруты"></div>
|
<div class="glyphicon glyphicon-cloud-download _c boxButtonRoutes" onclick="openBox('Routes')" title="Мои маршруты"></div>
|
||||||
<div class="glyphicon glyphicon-user _b boxButtonUser" onclick="openBox('User')" title="Профиль"></div>
|
<div class="glyphicon glyphicon-user _b boxButtonUser" onclick="openBox('User')" title="Профиль"></div>
|
||||||
<?php else:?>
|
<?php else:?>
|
||||||
|
|
@ -63,6 +64,18 @@
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<?php if ($user): ?>
|
<?php if ($user): ?>
|
||||||
|
<div id="boxFavorites">
|
||||||
|
<h3>Хочу посетить</h3>
|
||||||
|
<div id="favorites">
|
||||||
|
<?php if ($favorites): ?>
|
||||||
|
<?php foreach ($favorites as $favorite) : ?>
|
||||||
|
<a onclick="showInfo(<?= $favorite->pointId ?>)" class="btn btn-link"><?= $favorite->point->name ?></a><br/>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php else: ?>
|
||||||
|
Ваши закладки пока пусты.
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div id="boxRoutes">
|
<div id="boxRoutes">
|
||||||
<h3>Мои маршруты</h3>
|
<h3>Мои маршруты</h3>
|
||||||
<div id="routes">
|
<div id="routes">
|
||||||
|
|
@ -80,12 +93,6 @@
|
||||||
<h3>Профиль</h3>
|
<h3>Профиль</h3>
|
||||||
<a class="btn btn-default" type="button" href="/index/logout"><span class="glyphicon glyphicon-ban-circle"></span> Выйти</a>
|
<a class="btn btn-default" type="button" href="/index/logout"><span class="glyphicon glyphicon-ban-circle"></span> Выйти</a>
|
||||||
<hr/>
|
<hr/>
|
||||||
<?php var_dump($favorite); ?>
|
|
||||||
<?php if (false && $favorites): ?>
|
|
||||||
<?php foreach ($favorites as $favorite) : ?>
|
|
||||||
<?= $favorite->point->name ?><br/>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?= $user ? '' : self::renderPartial('modals/login.php', null, true) ?>
|
<?= $user ? '' : self::renderPartial('modals/login.php', null, true) ?>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue