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