ADD 5 последних созданных точек на странице пользователя

This commit is contained in:
Krivchikov Dmitry 2016-04-08 16:51:54 +03:00
parent 894f7bc5a3
commit d99bbded8c
3 changed files with 19 additions and 0 deletions

View File

@ -54,10 +54,19 @@ class UserController extends Controller
// $photos = ArticlePhotos::model()->getByUser($id, 5); // $photos = ArticlePhotos::model()->getByUser($id, 5);
$photos = NULL; // Скрыл фотоленту, так как туда могут попадать фотки неопубликованных статей $photos = NULL; // Скрыл фотоленту, так как туда могут попадать фотки неопубликованных статей
$pointsIds = App::DB()->query('SELECT `id` FROM `points` WHERE `author` ='.$id.' AND `status` = \'published\' AND `moderate` =1 ORDER BY `ord` DESC LIMIT 0 , 5')->fetchAll(PDO::FETCH_ASSOC);
$points = array();
if (!empty($pointsIds)) {
foreach ($pointsIds as $pointsId) {
$points[] = Point::model()->getByPK($pointsId['id']);
}
}
self::render('user/index.php', array( self::render('user/index.php', array(
'user' => $user, 'user' => $user,
'articles' => $articles, 'articles' => $articles,
'photos' => $photos, 'photos' => $photos,
'points' => $points,
'imAuthor' => App::$user && App::$user->id == $id, 'imAuthor' => App::$user && App::$user->id == $id,
'randomPoint' => $randomPoint, 'randomPoint' => $randomPoint,
)); ));

BIN
public/img/morePoints.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -57,6 +57,16 @@ $statuses = array(
</div> </div>
</div> </div>
<?php if (!empty($points)): ?>
<br/>
<div class="row">
<div class="col-md-12">
<h3 style="margin-top: 0;">Точки:</h3>
<?php foreach ($points as $sPoint): ?><a href="/point/<?= $sPoint->id ?>" class="pagePoinsNearCards"><img src="<?= $sPoint->getImg() ?>" title="<?= $sPoint->name ?>" class="pagePoinsNearCardsImg"/></a><?php endforeach; ?><a href="/page/points/user/<?= $user->id ?>" class="pagePoinsNearCards"><img src="/img/morePoints.png" title="Больше точек" class="pagePoinsNearCardsImg"/></a>
</div>
</div>
<?php endif; ?>
<?php if ($photos): ?> <?php if ($photos): ?>
<div class="row"> <div class="row">
<div class="col-md-12 photoList"> <div class="col-md-12 photoList">