diff --git a/ground/controllers/JsonController.php b/ground/controllers/JsonController.php index b1270c7..859e324 100644 --- a/ground/controllers/JsonController.php +++ b/ground/controllers/JsonController.php @@ -406,4 +406,26 @@ class JsonController extends Controller self::renderPartial('json.php', array('query' => $search, 'suggestions' => $results)); } + /** + * Article / K.O. =) + */ + static function actionArticle() + { + $id = (int) App::getParam('id'); + if ($id) + { + $article = Article::model()->getByPK($id); + + if (!$article) { + die; + } +// print_r($article->text); + self::renderPartial('modals/article.php', + array( + 'title' => $article->title, + 'text' => $article->text, + )); + } + } + } diff --git a/ground/models/User.php b/ground/models/User.php index b568342..93eda50 100644 --- a/ground/models/User.php +++ b/ground/models/User.php @@ -6,7 +6,7 @@ class User extends Model { $this->_tableName_ = 'users'; parent::__construct($fromArray); - $this->setRelation('category', 'catogoryId', 'Category', 'id', self::TO_ONE); + $this->setRelation('points', 'id', 'Point', 'id', self::TO_MANY); } static function model() diff --git a/ground/views/indexTemplate.php b/ground/views/indexTemplate.php index 3ab8295..ea75dfe 100644 --- a/ground/views/indexTemplate.php +++ b/ground/views/indexTemplate.php @@ -1,3 +1,9 @@ +getCountByUser(App::$user->id) > 0; + } +?>