diff --git a/ground/controllers/FeedController.php b/ground/controllers/FeedController.php index 8afd6a0..264fb63 100644 --- a/ground/controllers/FeedController.php +++ b/ground/controllers/FeedController.php @@ -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, )); diff --git a/ground/models/Article.php b/ground/models/Article.php index e27e71a..ccd3915 100644 --- a/ground/models/Article.php +++ b/ground/models/Article.php @@ -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; + } + } diff --git a/ground/views/feed/index.php b/ground/views/feed/index.php index 05722ff..e11ce05 100644 --- a/ground/views/feed/index.php +++ b/ground/views/feed/index.php @@ -7,31 +7,36 @@