From 20c00aeb4e081f8a91683bc8244a1768df25096d Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Sun, 15 Mar 2015 23:52:06 +0300 Subject: [PATCH] =?UTF-8?q?ADD=20articles=20-=20=D0=BF=D0=B5=D1=80=D0=B2?= =?UTF-8?q?=D0=B0=D1=8F=20=D1=80=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ground/controllers/PageController.php | 40 +++++++++++++++++++++++++++ ground/models/Article.php | 18 ++++++++++++ ground/views/article.php | 29 +++++++++++++++++++ ground/views/layoutPage.php | 2 +- public/css/style.css | 2 +- 5 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 ground/models/Article.php create mode 100644 ground/views/article.php diff --git a/ground/controllers/PageController.php b/ground/controllers/PageController.php index 33008fa..29d7c79 100644 --- a/ground/controllers/PageController.php +++ b/ground/controllers/PageController.php @@ -120,6 +120,46 @@ class PageController extends Controller } } + static function actionArticle() + { + self::$layout = 'layoutPage.php'; + + $articleId = (int) App::getParam('id'); + if ($articleId) + { + self::addScript('/js/jquery-2.1.0.min.js'); + self::addScript('/js/jquery-ui-1.10.4.custom.min.js'); + self::addScript('/js/bootstrap.min.js'); + + self::addScript('/js/app.js?ver=' . App::getConfig('version')); + self::addScript('http://cdnjs.cloudflare.com/ajax/libs/fotorama/4.6.3/fotorama.js'); + + self::addStyle('/css/style.css?ver=' . App::getConfig('version')); + self::addStyle('/css/bootstrap.min.css'); + self::addStyle('/css/bootstrap-theme.min.css'); + self::addStyle('http://cdnjs.cloudflare.com/ajax/libs/fotorama/4.6.3/fotorama.css'); + + $article = Article::model()->getByPK($articleId); + + if ($article->id == NULL) + { + App::error404(); + } + + App::setConfig('title', $article->title. ' - wikipoints.ru'); + + self::render('article.php', array( + 'article' => $article, + 'randomPoint' => Point::model()->getRandom(), +// 'og' => Helper::buildOG($point), +// 'user' => App::$user, + )); + } else + { + App::error404(); + } + } + static function action404($message) { self::renderPartial('error404.php', array( diff --git a/ground/models/Article.php b/ground/models/Article.php new file mode 100644 index 0000000..a95aedf --- /dev/null +++ b/ground/models/Article.php @@ -0,0 +1,18 @@ +_tableName_ = 'articles'; + parent::__construct($fromArray); + $this->setRelation('authorUser', 'author', 'User', 'id', self::TO_ONE); + } + + static function model() + { + return new self(); + } + +} + diff --git a/ground/views/article.php b/ground/views/article.php new file mode 100644 index 0000000..733e1bf --- /dev/null +++ b/ground/views/article.php @@ -0,0 +1,29 @@ +
+
+
+
+

title ?>

+
+ Вернуться на карту. +
+ +
+ text; + ?> +
+ +
+
+
+
+
+ +

Это интересно: name ?>

+

+ description, 0, 400, 'UTF-8') ?>... + читать далее » +

+
+
+
diff --git a/ground/views/layoutPage.php b/ground/views/layoutPage.php index 7638b05..01b3cb6 100644 --- a/ground/views/layoutPage.php +++ b/ground/views/layoutPage.php @@ -42,7 +42,7 @@
- +
diff --git a/public/css/style.css b/public/css/style.css index 9c1713a..245a26b 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -19,7 +19,7 @@ div.infoCard h3 {text-align: center; margin-top: 0;} div.infoCard img {width: 200px; float: left; margin: 0 10px 5px 0; cursor: pointer;} div.infoCard .photosCount {position: absolute;margin: 3px;color: white;background-color: black;border-radius: 3px;padding: 2px 4px;opacity: 0.5;} div.header {display: block; position: absolute; top: 0px; left: 40px; z-index: 1000; background-color: rgba(255,255,255,0.7); padding: 5px 10px; border-radius: 0 0 5px 5px;} -div.header img {height: 99px;} +div.header img {height: 89px;} div.add {cursor: pointer;} .fotorama {display: inline-block;}