From 894f7bc5a3f00a3cf1a760bc644e796acdd5e607 Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Fri, 8 Apr 2016 15:41:30 +0300 Subject: [PATCH] ADD top5 authors --- controllers/FeedController.php | 11 ++++++++++- public/css/style.css | 5 +++++ views/feed/index.php | 14 ++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/controllers/FeedController.php b/controllers/FeedController.php index a99def0..ef5ecd8 100644 --- a/controllers/FeedController.php +++ b/controllers/FeedController.php @@ -51,9 +51,17 @@ class FeedController extends Controller } // --------- SORT - krsort($feed); + // --------- AUTHORS + $authors = array(); + $authorIds = App::DB()->query('SELECT `author` , COUNT( * ) `cnt` FROM `points` GROUP BY `author` ORDER BY `cnt` DESC LIMIT 0 , 6')->fetchAll(PDO::FETCH_ASSOC); + foreach ($authorIds as $authorId) { + $author = User::model()->getByPK($authorId['author']); + $author->pointsCount = $authorId['cnt']; + $authors[] =$author; + } + self::$layout = 'layouts/page.php'; self::addScript('/js/jquery-2.1.0.min.js'); self::addScript('/js/jquery-ui-1.10.4.custom.min.js'); @@ -70,6 +78,7 @@ class FeedController extends Controller 'news' => $news, 'articles' => $articles, 'points' => $points, + 'authors' => $authors, )); } } diff --git a/public/css/style.css b/public/css/style.css index f08e49a..8465c94 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -88,6 +88,7 @@ nav.navbar.navbar-inverse .navbar-nav>li>a {color: #ddd;} nav.navbar.navbar-inverse .navbar-nav>li.important {background-color: #3c3c3c;} span.notifications {font-weight: bolder; color: red;} +div.top5authors {width: 16.66666667%; float: left; display: inline-block;} /*BOX*/ body.openBox div#box {display: block; z-index: 100; overflow-y: scroll;overflow-x: hidden;} @@ -148,6 +149,8 @@ img.imageInArticle {border: solid 3px white;max-width: 100%;} padding: 3px!important; margin: 0!important; } + div.top5authors {width: 33.33333334%;} + h4.top5authors {text-align: center;} } @media screen and (max-width:815px) { @@ -179,4 +182,6 @@ img.imageInArticle {border: solid 3px white;max-width: 100%;} div.container.feed div.row.elements div.element {width: 100%;} div.container.feed div.row.elements div.element a.imgContainer {margin: 0 0 10px 0; display: block; width: 100%;text-align: center;} div.container.feed div.row.elements div.element a img.elementImg {margin: 0; display: inline;max-width: 100%; float: none;} + + div.top5authors {width: 50%;} } diff --git a/views/feed/index.php b/views/feed/index.php index d27e24c..e00a810 100644 --- a/views/feed/index.php +++ b/views/feed/index.php @@ -1,5 +1,19 @@
+
+
+

Самые активные авторы

+ + + +
+
+

Новости