Лайки на странице точки
This commit is contained in:
parent
d5474fd524
commit
4cfe36bd02
|
|
@ -59,6 +59,12 @@ class PageController extends Controller
|
||||||
self::addStyle('/css/bootstrap-theme.min.css');
|
self::addStyle('/css/bootstrap-theme.min.css');
|
||||||
self::addStyle('/css/fotorama.css');
|
self::addStyle('/css/fotorama.css');
|
||||||
|
|
||||||
|
if (App::$user && App::$user->id) {
|
||||||
|
self::addVar('user', App::$user->id);
|
||||||
|
} else {
|
||||||
|
self::addVar('user', '0');
|
||||||
|
}
|
||||||
|
|
||||||
$point = Point::model()->getByPK($pointId);
|
$point = Point::model()->getByPK($pointId);
|
||||||
|
|
||||||
if ($point->id == NULL)
|
if ($point->id == NULL)
|
||||||
|
|
@ -76,6 +82,9 @@ class PageController extends Controller
|
||||||
$point->categoryName = $categories[$point->categoryId]['name'];
|
$point->categoryName = $categories[$point->categoryId]['name'];
|
||||||
$point->descriptionHtml = Helper::replaceLinks($point->descriptionHtml);
|
$point->descriptionHtml = Helper::replaceLinks($point->descriptionHtml);
|
||||||
preg_match_all("/.*?(([.?!](?:\s|$))|$)/s", $point->descriptionHtml, $items);
|
preg_match_all("/.*?(([.?!](?:\s|$))|$)/s", $point->descriptionHtml, $items);
|
||||||
|
$point->inFavorites = Favorite::model()->checkIsMy($pointId);
|
||||||
|
$point->iLike = Like::model()->checkIsMy($pointId);
|
||||||
|
|
||||||
$similarPoints = Point::model()->getAll(array('where' => 'categoryId = '.$point->categoryId.' AND `id` <> '.$point->id.' ORDER BY RAND() LIMIT 6;'));
|
$similarPoints = Point::model()->getAll(array('where' => 'categoryId = '.$point->categoryId.' AND `id` <> '.$point->id.' ORDER BY RAND() LIMIT 6;'));
|
||||||
$closestPoints = Point::model()->getClosestPoints($pointId);
|
$closestPoints = Point::model()->getClosestPoints($pointId);
|
||||||
$randomPoint = Point::model()->getRandom();
|
$randomPoint = Point::model()->getRandom();
|
||||||
|
|
@ -93,6 +102,7 @@ class PageController extends Controller
|
||||||
'countInFavs' => Favorite::model()->countInFavs($pointId),
|
'countInFavs' => Favorite::model()->countInFavs($pointId),
|
||||||
'countLikes' => Like::model()->countLikes($pointId),
|
'countLikes' => Like::model()->countLikes($pointId),
|
||||||
'og' => Helper::buildOG($point),
|
'og' => Helper::buildOG($point),
|
||||||
|
'user' => App::$user,
|
||||||
));
|
));
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -70,8 +70,13 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p style="margin-top: 25px; text-align: right;">
|
<p style="margin-top: 25px; text-align: right;">
|
||||||
[ <span class="glyphicon glyphicon-star"></span> <?= $countInFavs ?> - в закладках ]
|
<?php if (App::$user && App::$user->id): ?>
|
||||||
[ <span class="glyphicon glyphicon-thumbs-up"></span> <?= $countLikes ?> - нравится ]
|
[ <button type="button" class="btn btn-link" style="color: #333;" onclick="addRemoveFavorite(<?= $point->id ?>)"><span id="myFavoritesButton" class="glyphicon glyphicon-star<?= $point->inFavorites ? '' : '-empty' ?>"></span> Хочу посетить</button> ]
|
||||||
|
[ <button type="button" class="btn btn-link" style="color: #333;" onclick="addRemoveLike(<?= $point->id ?>)"><span id="myLikesButton" class="glyphicon glyphicon-<?= $point->iLike ? 'ok' : 'thumbs-up' ?>"></span> Нравится</button> ]
|
||||||
|
<?php else: ?>
|
||||||
|
[ <span class="glyphicon glyphicon-star"></span> <?= $countInFavs ?> - в закладках ]
|
||||||
|
[ <span class="glyphicon glyphicon-thumbs-up"></span> <?= $countLikes ?> - нравится ]
|
||||||
|
<?php endif; ?>
|
||||||
[ <span class="glyphicon glyphicon-user"></span> <?= $point->authorUser->nick ?> - <span class="glyphicon glyphicon-pencil"></span> <?= $point->authorUser->getPointsCount() ?> ]
|
[ <span class="glyphicon glyphicon-user"></span> <?= $point->authorUser->nick ?> - <span class="glyphicon glyphicon-pencil"></span> <?= $point->authorUser->getPointsCount() ?> ]
|
||||||
[ <span class="glyphicon glyphicon-new-window"></span> <a href="<?= $point->source ?>" target="_blank">источник</a> ]
|
[ <span class="glyphicon glyphicon-new-window"></span> <a href="<?= $point->source ?>" target="_blank">источник</a> ]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue