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;}