Вывод ссылок на статьи, в которых упоминается точка
This commit is contained in:
parent
c659368459
commit
78a6d50b9a
|
|
@ -75,6 +75,16 @@ class PointController extends Controller
|
|||
$randomPoint->description = mb_substr($randomPoint->description, 0, 400, 'UTF-8');
|
||||
$randomPoint->description = Helper::replaceLinks($randomPoint->description);
|
||||
|
||||
$articlePoints = ArticlePoints::model()->getAll(array('where'=>'`pointId` = '.$pointId));
|
||||
$articleIds = array();
|
||||
$articles = array();
|
||||
if ($articlePoints) {
|
||||
foreach ($articlePoints as $articlePoint) {
|
||||
$articleIds[] = (int)$articlePoint->articleId;
|
||||
}
|
||||
$articles = Article::model()->getAll(array('where'=>'`id` IN ('. implode(',', $articleIds).')'));
|
||||
}
|
||||
|
||||
self::render('point.php', array(
|
||||
'point' => $point,
|
||||
'text' => $items[0],
|
||||
|
|
@ -88,6 +98,7 @@ class PointController extends Controller
|
|||
'og' => Helper::buildOG($point),
|
||||
'user' => App::$user,
|
||||
'photoLinks' => $photoLinksRes,
|
||||
'articles' => $articles,
|
||||
));
|
||||
} else {
|
||||
App::error404();
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class Article extends Model
|
|||
|
||||
}
|
||||
|
||||
return '/img/logo.png';
|
||||
return $size == 'small' ? '/img/noPhoto200150.png' : '/img/logo.png';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,9 +89,20 @@ $index = 0;
|
|||
<hr/>
|
||||
<!--googleoff: all-->
|
||||
<!--noindex-->
|
||||
<?php if ($articles): ?>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h3 style="margin-top: 0;">Поблизости:</h3>
|
||||
<h3 style="margin-top: 0;">Эта точка в статьях:</h3>
|
||||
<?php foreach ($articles as $article): ?>
|
||||
<a href="/article/<?= $article->id ?>" class="pagePoinsNearCards"><img src="<?= $article->getImg('small') ?>" title="<?= $article->title ?>" class="pagePoinsNearCardsImg"/></a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<hr/>
|
||||
<?php endif; ?>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h3 style="margin-top: 0;">Поблизости расположены:</h3>
|
||||
<?php if (empty($closestPoints)): ?>
|
||||
нет известных нам точек.
|
||||
<?php else: ?>
|
||||
|
|
@ -100,13 +111,15 @@ $index = 0;
|
|||
</div>
|
||||
</div>
|
||||
<hr/>
|
||||
<?php if (!$articles): ?>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h3 style="margin-top: 0;">Похожие:</h3>
|
||||
<h3 style="margin-top: 0;">Похожие точки:</h3>
|
||||
<?php foreach ($similarPoints as $sPoint): ?><a href="/point/<?= $sPoint->id ?>" class="pagePoinsNearCards"><img src="<?= $sPoint->getImg() ?>" title="<?= $sPoint->name ?>" class="pagePoinsNearCardsImg"/></a><?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<hr/>
|
||||
<?php endif; ?>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<a href="/point/<?= $randomPoint->id ?>" style="float: left; margin: 0 20px 0 0;"><img src="<?= $randomPoint->getImg() ?>" style="width: 200px;"/></a>
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 7.7 KiB |
Loading…
Reference in New Issue