From 6cb6cec2d5841d71b6c275f39234d046eecba0c3 Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Sun, 14 Dec 2014 16:41:54 +0300 Subject: [PATCH] =?UTF-8?q?ADD=20=D0=A0=D0=B0=D1=81=D0=BF=D0=B5=D1=87?= =?UTF-8?q?=D0=B0=D1=82=D1=8B=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BC=D0=B0?= =?UTF-8?q?=D1=80=D1=88=D1=80=D1=83=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ground/controllers/IndexController.php | 19 ++++++--- ground/views/indexTemplate.php | 1 + ground/views/layoutPrint.php | 39 +++++++++++++++++++ ground/views/route.php | 28 +++++++++++++ public/css/print.css | 18 +++++++++ public/js/route.js | 1 + ...очу видеть в маршруте.md | 11 ++++++ 7 files changed, 111 insertions(+), 6 deletions(-) create mode 100644 ground/views/layoutPrint.php create mode 100644 ground/views/route.php create mode 100644 public/css/print.css create mode 100644 source/Что я хочу видеть в маршруте.md diff --git a/ground/controllers/IndexController.php b/ground/controllers/IndexController.php index fc230a8..1d0dd3f 100644 --- a/ground/controllers/IndexController.php +++ b/ground/controllers/IndexController.php @@ -163,13 +163,20 @@ class IndexController extends Controller print($xml->asXML()); } - static function actionTest() + static function actionRoute() { - $route = array(301, 128); + self::$layout = 'layoutPrint.php'; + self::addStyle('/css/print.css?ver=' . App::getConfig('version')); -// $route = Point::model()->getAll(array('where' => '`id` IN ('.implode(', ', array_fill(1, count($route), '?')).')'), $route); -//// print_r(array('where' => '`id` IN ('.implode(', ', array_fill(1, count($route), '?')).')'));die; -// print_r($route);die; + if (!isset($_GET['route']) || !$_GET['route']) { + App::error404('Нет данных для построения маршрута!'); + } + + $route = json_decode($_GET['route']); + + if (!$route || !is_array($route)) { + App::error404(); + } $points = array(); foreach ($route as $pointId){ @@ -178,7 +185,7 @@ class IndexController extends Controller } } - self::renderPartial('route.php', array( + self::render('route.php', array( 'points' => $points, )); } diff --git a/ground/views/indexTemplate.php b/ground/views/indexTemplate.php index d2407e6..68795e9 100644 --- a/ground/views/indexTemplate.php +++ b/ground/views/indexTemplate.php @@ -59,6 +59,7 @@
+ Печать diff --git a/ground/views/layoutPrint.php b/ground/views/layoutPrint.php new file mode 100644 index 0000000..ce07c9a --- /dev/null +++ b/ground/views/layoutPrint.php @@ -0,0 +1,39 @@ + + + + <?= App::getConfig('title') ?> + + + + + + + + + + + + + + + + + + + + + +

WikiPoints.ru

+
+ + + + + + \ No newline at end of file diff --git a/ground/views/route.php b/ground/views/route.php new file mode 100644 index 0000000..3c0d5bd --- /dev/null +++ b/ground/views/route.php @@ -0,0 +1,28 @@ + + +

name ?>

+ + + description ?> + +
+ http://wikipoints.ru/?point=id ?> +   /   + + lat > 0 ? 'N' : 'S' ?>lat), 5, '.', '') ?>° + lng > 0 ? 'E' : 'W' ?>lng), 5, '.', '') ?>° + +   /   + + lat > 0 ? 'N' : 'S' ?>lat) ?> + lng > 0 ? 'E' : 'W' ?>lng) ?> + +
+ +
+ \ No newline at end of file diff --git a/public/css/print.css b/public/css/print.css new file mode 100644 index 0000000..1674587 --- /dev/null +++ b/public/css/print.css @@ -0,0 +1,18 @@ +/* + Document : style + Created on : 03.04.2014, 10:51:45 + Author : all4dk + Description: + Purpose of the stylesheet follows. +*/ + +html {height: 100%;} +body {margin: 1%; padding: 0; height: 100%; width: 98%;} +html body h1 {font-family: Ubuntu, inherit;} +html body h2 {font-family: Ubuntu, inherit; text-align: center;} +html body h3 {font-family: Ubuntu, inherit;} + +div.clear {clear: both;} + +/* ------------- PAGE --------------------*/ +.coords-container {text-align: right; margin-bottom: 20px; margin-top: 10px; color: #777;font-size: 0.9em;} \ No newline at end of file diff --git a/public/js/route.js b/public/js/route.js index 3268436..0f5280d 100644 --- a/public/js/route.js +++ b/public/js/route.js @@ -175,6 +175,7 @@ function routeToURL() }); history.pushState({route: JSON.stringify(wayPoints)}, document.title, "/?route=" + JSON.stringify(wayPoints)); + $('#printRoute').attr('href', "/index/route/?route=" + JSON.stringify(wayPoints)); return true; } diff --git a/source/Что я хочу видеть в маршруте.md b/source/Что я хочу видеть в маршруте.md new file mode 100644 index 0000000..5bff6f7 --- /dev/null +++ b/source/Что я хочу видеть в маршруте.md @@ -0,0 +1,11 @@ +Что я хочу видеть в распечатанном маршруте? + +* Название места +* Координаты +* Фотографии / Фотогрфию (?) +* Описание точки +* Расстояние до следующей точки (актуально для пешеходных маршрутов) +* Ссылку на сайт (ручной ввод) +* QR-код со ссылкой на сайт (для сканирования телефоном) +* Ближайшие точки - фотка + ссылка + QR +* Иконка типа точки \ No newline at end of file