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; + } +?>
@@ -12,7 +18,7 @@ -
+
diff --git a/ground/views/modals/article.php b/ground/views/modals/article.php new file mode 100644 index 0000000..f06cc76 --- /dev/null +++ b/ground/views/modals/article.php @@ -0,0 +1,16 @@ + \ No newline at end of file diff --git a/public/js/map.js b/public/js/map.js index 6d13d6d..6411689 100644 --- a/public/js/map.js +++ b/public/js/map.js @@ -297,3 +297,14 @@ function setLayer(name) $.cookie('mapLayer', layer); } +function showArticle(id) +{ + $.ajax({ + url: "/json/article/id/" + id, + success: function (data) { + $('#articleModal').modal('hide').remove(); + $('body').append($(data)); + $('#articleModal').modal('show'); + } + }); +}