From ab04c51680d60c6827c6c8f780f2f539e6e9059c Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Fri, 25 Sep 2015 17:56:59 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B0=20=D1=81=D1=82=D1=80=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D1=86=D0=B5=20=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D1=82=D0=B5=D0=BB=D1=8F=20=D0=B2=D1=8B=D0=B2=D0=B5=D0=BB?= =?UTF-8?q?=20=D0=BA=D1=83=D1=81=D0=BE=D1=87=D0=B5=D0=BA=20=D1=84=D0=BE?= =?UTF-8?q?=D1=82=D0=BE=D0=BB=D0=B5=D0=BD=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ground/controllers/UserController.php | 3 ++ ground/models/ArticlePhotos.php | 12 +++++++ ground/views/user/index.php | 52 +++++++++++++++++---------- public/css/user.css | 3 ++ 4 files changed, 52 insertions(+), 18 deletions(-) diff --git a/ground/controllers/UserController.php b/ground/controllers/UserController.php index c2434a2..45ff360 100644 --- a/ground/controllers/UserController.php +++ b/ground/controllers/UserController.php @@ -43,9 +43,12 @@ class UserController extends Controller $randomPoint->description = mb_substr($randomPoint->description, 0, 400, 'UTF-8'); $randomPoint->description = Helper::replaceLinks($randomPoint->description); + $photos = ArticlePhotos::model()->getByUser($id, 5); + self::render('user/index.php', array( 'user' => $user, 'articles' => $articles, + 'photos' => $photos, 'imAuthor' => App::$user && App::$user->id == $id, 'randomPoint' => $randomPoint, )); diff --git a/ground/models/ArticlePhotos.php b/ground/models/ArticlePhotos.php index e70f7f0..ed260a9 100644 --- a/ground/models/ArticlePhotos.php +++ b/ground/models/ArticlePhotos.php @@ -15,4 +15,16 @@ class ArticlePhotos extends Model return new self(); } + function getByUser($userId, $limit = 0) + { + $params = array( + 'where' => '`owner` = '.(int)$userId, + ); + + if ($limit > 0) { + $params['limit'] = (int) $limit; + } + + return $this->getAll($params); + } } diff --git a/ground/views/user/index.php b/ground/views/user/index.php index 06c0087..44cdb62 100644 --- a/ground/views/user/index.php +++ b/ground/views/user/index.php @@ -16,28 +16,44 @@
-

Статьи:

+

Записи:

- -
- - photoId): ?> - - - - - - title ?> - text)), 0, 250, 'UTF-8') ?>… -
-
- - Пока нет статей. - + +
+ + photoId): ?> + + + + + + title ?> + text)), 0, 250, 'UTF-8') ?>… +
+
+ + + В блоге пока пусто. +
+ + +
+
+

Фотолента:

+
+ +
+ +
+ +
+
+
+ +
diff --git a/public/css/user.css b/public/css/user.css index af0c93e..6beae73 100644 --- a/public/css/user.css +++ b/public/css/user.css @@ -11,3 +11,6 @@ .articlesList .article {border: solid 1px #ddd; border-radius: 3px; padding: 4px; margin-bottom: 5px;background-color: rgba(255,255,255, 0.8);} .articlesList .article img {width: 100px; float: left; margin-right: 10px;} .articlesList .article .h {font-size: 18px; font-weight: bold; display: block;} + +.photoList {} +.photoList .photo {display: inline-block; border: solid 3px #fff; margin: 3px;}