ADD Распечатывание маршрута
This commit is contained in:
parent
c378657c43
commit
6cb6cec2d5
|
|
@ -163,13 +163,20 @@ class IndexController extends Controller
|
||||||
print($xml->asXML());
|
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);
|
if (!isset($_GET['route']) || !$_GET['route']) {
|
||||||
//// print_r(array('where' => '`id` IN ('.implode(', ', array_fill(1, count($route), '?')).')'));die;
|
App::error404('Нет данных для построения маршрута!');
|
||||||
// print_r($route);die;
|
}
|
||||||
|
|
||||||
|
$route = json_decode($_GET['route']);
|
||||||
|
|
||||||
|
if (!$route || !is_array($route)) {
|
||||||
|
App::error404();
|
||||||
|
}
|
||||||
|
|
||||||
$points = array();
|
$points = array();
|
||||||
foreach ($route as $pointId){
|
foreach ($route as $pointId){
|
||||||
|
|
@ -178,7 +185,7 @@ class IndexController extends Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self::renderPartial('route.php', array(
|
self::render('route.php', array(
|
||||||
'points' => $points,
|
'points' => $points,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@
|
||||||
<div id="wayPoints"></div>
|
<div id="wayPoints"></div>
|
||||||
<div id="routeDistance"></div>
|
<div id="routeDistance"></div>
|
||||||
<button class="btn btn-info" onclick="buildRoute(true)"><span class="glyphicon glyphicon-send"></span> Проложить</button>
|
<button class="btn btn-info" onclick="buildRoute(true)"><span class="glyphicon glyphicon-send"></span> Проложить</button>
|
||||||
|
<a class="btn btn-default" href="" id="printRoute" target="_blank"><span class="glyphicon glyphicon-print"></span> Печать</a>
|
||||||
<?php if ($user): ?>
|
<?php if ($user): ?>
|
||||||
<button class="btn btn-default" onclick="saveRoute()"><span class="glyphicon glyphicon-cloud-upload" title="Сохранить"></span></button>
|
<button class="btn btn-default" onclick="saveRoute()"><span class="glyphicon glyphicon-cloud-upload" title="Сохранить"></span></button>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title><?= App::getConfig('title') ?></title>
|
||||||
|
|
||||||
|
<?php if ($styles): ?>
|
||||||
|
<?php foreach ($styles as $style): ?>
|
||||||
|
<link href="<?= $style ?>" media="all" rel="stylesheet" type="text/css" />
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($scripts): ?>
|
||||||
|
<?php foreach ($scripts as $script): ?>
|
||||||
|
<script src="<?= $script ?>" type="text/javascript"></script>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($vars): ?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
<?php foreach ($vars as $varName => $var): ?>
|
||||||
|
var <?= $varName ?> = '<?= $var ?>';
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</script>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Ubuntu:400&subset=Cyrillic">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>WikiPoints.ru</h1>
|
||||||
|
<hr/>
|
||||||
|
<?= isset($content) && !empty($content) ? $content : 'No content =(' ?>
|
||||||
|
<script>
|
||||||
|
window.onload=window.print();
|
||||||
|
</script>
|
||||||
|
<?= self::renderPartial('metrika.php', array(), true) ?>
|
||||||
|
<?= self::renderPartial('ganalytics.php', array(), true) ?>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
foreach ($points as $point)
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h2><?= $point->name ?></h2>
|
||||||
|
<img src="<?= $point->getImg('middle') ?>" style="float: left; margin: 0 10px 10px 0; display: block; width: 300px;"/>
|
||||||
|
<img src="http://chart.apis.google.com/chart?cht=qr&chs=150x150&chld=H|0&chl=http://wikipoints.ru/?point=<?= $point->id ?>" style="float: right; margin: 0 0 10px 10px; display: block;"/>
|
||||||
|
<?= $point->description ?>
|
||||||
|
|
||||||
|
<div class="coords-container">
|
||||||
|
http://wikipoints.ru/?point=<?= $point->id ?>
|
||||||
|
/
|
||||||
|
<nobr>
|
||||||
|
<?= $point->lat > 0 ? 'N' : 'S' ?><?= number_format(abs($point->lat), 5, '.', '') ?>°
|
||||||
|
<?= $point->lng > 0 ? 'E' : 'W' ?><?= number_format(abs($point->lng), 5, '.', '') ?>°
|
||||||
|
</nobr>
|
||||||
|
/
|
||||||
|
<nobr>
|
||||||
|
<?= $point->lat > 0 ? 'N' : 'S' ?><?= Coord::dergeeToMinute($point->lat) ?>
|
||||||
|
<?= $point->lng > 0 ? 'E' : 'W' ?><?= Coord::dergeeToMinute($point->lng) ?>
|
||||||
|
</nobr>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr style="clear: both;"/>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
@ -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;}
|
||||||
|
|
@ -175,6 +175,7 @@ function routeToURL()
|
||||||
});
|
});
|
||||||
|
|
||||||
history.pushState({route: JSON.stringify(wayPoints)}, document.title, "/?route=" + JSON.stringify(wayPoints));
|
history.pushState({route: JSON.stringify(wayPoints)}, document.title, "/?route=" + JSON.stringify(wayPoints));
|
||||||
|
$('#printRoute').attr('href', "/index/route/?route=" + JSON.stringify(wayPoints));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
Что я хочу видеть в распечатанном маршруте?
|
||||||
|
|
||||||
|
* Название места
|
||||||
|
* Координаты
|
||||||
|
* Фотографии / Фотогрфию (?)
|
||||||
|
* Описание точки
|
||||||
|
* Расстояние до следующей точки (актуально для пешеходных маршрутов)
|
||||||
|
* Ссылку на сайт (ручной ввод)
|
||||||
|
* QR-код со ссылкой на сайт (для сканирования телефоном)
|
||||||
|
* Ближайшие точки - фотка + ссылка + QR
|
||||||
|
* Иконка типа точки
|
||||||
Loading…
Reference in New Issue