начата работа по выводу избранного + странное выравнивание строчек
This commit is contained in:
parent
2a253676b4
commit
7a762de04d
|
|
@ -46,12 +46,17 @@ class IndexController extends Controller
|
|||
{
|
||||
$routes = Route::model()->getByAuthor(App::$user->id);
|
||||
self::addVar('user', App::$user->id);
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
self::addVar('user', '0');
|
||||
}
|
||||
|
||||
$favorites = array();
|
||||
if (App::$user && App::$user->id)
|
||||
{
|
||||
$favorites = Favorite::model()->getAllMy();
|
||||
}
|
||||
|
||||
self::addVar('isAdmin', (int) (App::$user && App::$user->isAdmin == 1));
|
||||
|
||||
$res = App::DB()->query("SELECT COUNT(`id`) pointsCount FROM `points`")->fetch(PDO::FETCH_ASSOC);
|
||||
|
|
@ -75,8 +80,7 @@ class IndexController extends Controller
|
|||
$og['type'] = 'article';
|
||||
$og['url'] = 'http://wikipoints.ru/?point=' . $id;
|
||||
$og['image'] = $point->getImg();
|
||||
}
|
||||
else if(isset($_GET['point']) && $_GET['point'] && strtolower($_GET['point']) == 'random')
|
||||
} else if (isset($_GET['point']) && $_GET['point'] && strtolower($_GET['point']) == 'random')
|
||||
{
|
||||
$og['title'] = 'Случайная точка на wikipoints.ru';
|
||||
$og['description'] = 'Загляните сюда: http://vk.com/wikipoints Случайная точка на карте - лучший способ узнать что-то новое!';
|
||||
|
|
@ -90,6 +94,7 @@ class IndexController extends Controller
|
|||
'categories' => $category,
|
||||
'user' => App::$user,
|
||||
'routes' => $routes,
|
||||
'favorites' => $favorites,
|
||||
'og' => $og,
|
||||
));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
class Favorite extends Model
|
||||
{
|
||||
|
||||
function __construct($fromArray = array())
|
||||
{
|
||||
$this->_tableName_ = 'favorites';
|
||||
|
|
@ -25,7 +26,8 @@ class Favorite extends Model
|
|||
if ($res)
|
||||
{
|
||||
return boolval(Favorite::model()->delete($res->id));
|
||||
} else {
|
||||
} else
|
||||
{
|
||||
return Favorite::model()->add(array('userId' => App::$user->id, 'pointId' => $pointId));
|
||||
}
|
||||
}
|
||||
|
|
@ -45,5 +47,5 @@ class Favorite extends Model
|
|||
|
||||
return boolval($this->getAll(array('where' => '`userId` = ' . (int) App::$user->id . ' AND `pointId` = ' . (int) $pointId)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,6 +79,13 @@
|
|||
<div id="boxUser">
|
||||
<h3>Профиль</h3>
|
||||
<a class="btn btn-default" type="button" href="/index/logout"><span class="glyphicon glyphicon-ban-circle"></span> Выйти</a>
|
||||
<hr/>
|
||||
<?php var_dump($favorite); ?>
|
||||
<?php if (false && $favorites): ?>
|
||||
<?php foreach ($favorites as $favorite) : ?>
|
||||
<?= $favorite->point->name ?><br/>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?= $user ? '' : self::renderPartial('modals/login.php', null, true) ?>
|
||||
|
|
|
|||
Loading…
Reference in New Issue