FIX
This commit is contained in:
parent
55fcd7c39b
commit
6c4a89faa9
|
|
@ -22,6 +22,7 @@ class FeedController extends Controller
|
|||
|
||||
// --------- POINTS
|
||||
$points = Point::model()->getAll(array(
|
||||
'where' => '`moderate` = 1',
|
||||
'order' => '`date` DESC',
|
||||
'limit' => 5,
|
||||
));
|
||||
|
|
@ -36,6 +37,7 @@ class FeedController extends Controller
|
|||
|
||||
// --------- ARTICLES
|
||||
$articles = Article::model()->getAll(array(
|
||||
'where' => '`status` = "published"',
|
||||
'order' => '`id` DESC',
|
||||
'limit' => 5,
|
||||
));
|
||||
|
|
|
|||
|
|
@ -31,4 +31,17 @@ class Article extends Model
|
|||
return $size == 'small' ? '/img/noPhoto200150.png' : '/img/logo.png';
|
||||
}
|
||||
|
||||
public function hasImg()
|
||||
{
|
||||
$imgId = (int)$this->photoId;
|
||||
|
||||
if ($imgId) {
|
||||
$img = ArticlePhotos::model()->getByPK($imgId);
|
||||
if ($img) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,31 +7,36 @@
|
|||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<h2>Новости</h2>
|
||||
<?php foreach ($news as $item) : ?>
|
||||
<div style="margin: 3px; padding: 3px; border: solid 1px #999;">
|
||||
<div style="margin: 3px; padding: 3px">
|
||||
<h4><?= $item->title ?></h4>
|
||||
<?= mb_substr($item->text, 0, 400, 'UTF-8') ?>…
|
||||
</div>
|
||||
<?php endforeach;?>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<h2>Точки</h2>
|
||||
<?php foreach ($points as $item) : ?>
|
||||
<div style="margin: 3px; padding: 3px; border: solid 1px #999;">
|
||||
<h4><?= $item->name ?></h4>
|
||||
<img src="<?= $item->getImg() ?>" style="width: 200px; margin: 0 10px 5px 0;"/><br/>
|
||||
<?= mb_substr($item->description, 0, 400, 'UTF-8') ?>…
|
||||
<div style="margin: 3px; padding: 3px">
|
||||
<a href="/article/<?= $item->id ?>">
|
||||
<h4><?= $item->name ?></h4>
|
||||
</a>
|
||||
<img src="<?= $item->getImg() ?>" style="width: 200px; float: left; margin: 0 10px 5px 0;"/>
|
||||
<?= mb_substr($item->description, 0, 400, 'UTF-8') ?> …
|
||||
<a href="/article/<?= $item->id ?>">>>></a>
|
||||
</div>
|
||||
<?php endforeach;?>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<h2>Статьи</h2>
|
||||
<?php foreach ($articles as $item) : ?>
|
||||
<div style="margin: 3px; padding: 3px; border: solid 1px #999;">
|
||||
<h4><?= $item->title ?></h4>
|
||||
<div style="margin: 3px; padding: 3px">
|
||||
<a href="/article/<?= $item->id ?>">
|
||||
<h4><?= $item->title ?></h4>
|
||||
</a>
|
||||
<?php if($item->hasImg()): ?>
|
||||
<img src="<?= $item->getImg() ?>" style="width: 200px; float: left; margin: 0 10px 5px 0;"/>
|
||||
<?= mb_substr($item->text, 0, 400, 'UTF-8') ?>…
|
||||
<?php endif; ?>
|
||||
<?= mb_substr(Markdown::getClear($item->text), 0, 400, 'UTF-8') ?> …
|
||||
<a href="/article/<?= $item->id ?>">>>></a>
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
<?php endforeach;?>
|
||||
|
|
|
|||
Loading…
Reference in New Issue