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 @@
-
-
- = $article->title ?>
- = mb_substr(Markdown::getClear(str_replace('"', 'ʺ', $article->text)), 0, 250, 'UTF-8') ?>…
-
-
+
+
+ = $article->title ?>
+ = mb_substr(Markdown::getClear(str_replace('"', 'ʺ', $article->text)), 0, 250, 'UTF-8') ?>…
+
+