Basic Menu. Přesunutí geojson.
parent
4048548923
commit
53b64105bb
|
|
@ -5,8 +5,37 @@ declare(strict_types=1);
|
||||||
namespace App\Presentation\Home;
|
namespace App\Presentation\Home;
|
||||||
|
|
||||||
use Nette;
|
use Nette;
|
||||||
|
use Nette\Utils\Json;
|
||||||
|
use Nette\Utils\FileSystem;
|
||||||
|
|
||||||
final class HomePresenter extends Nette\Application\UI\Presenter
|
final class HomePresenter extends Nette\Application\UI\Presenter
|
||||||
{
|
{
|
||||||
|
public function beforeRender(): void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function renderDefault(int $obvod = null): void
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
// načti seznam obvodů:
|
||||||
|
$content = FileSystem::read('../www/data/geo-obvody.geojson');
|
||||||
|
// dekóduj geo-json:
|
||||||
|
$geoObvody = Json::decode($content, true);
|
||||||
|
} catch (Nette\Utils\JsonException $e) {
|
||||||
|
// Ošetření výjimky
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($geoObvody))
|
||||||
|
return;
|
||||||
|
|
||||||
|
$obvody = array();
|
||||||
|
foreach ($geoObvody["features"] as $o) {
|
||||||
|
$obvody[] = $o["properties"]["number"];
|
||||||
|
}
|
||||||
|
asort($obvody);
|
||||||
|
$this->template->obvody = $obvody;
|
||||||
|
|
||||||
|
bdump($geoObvody["features"]);
|
||||||
|
bdump($obvody);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
{* This is the welcome page, you can delete it *}
|
{* This is the welcome page, you can delete it *}
|
||||||
|
|
||||||
{block content}
|
{block content}
|
||||||
<div id="map"></div>
|
<h3>Seznam obvodů</h3>
|
||||||
|
|
||||||
|
|
||||||
<script src="{$basePath}/js/mapa.js"></script>
|
<div class="list-group" style="max-width: 200px">
|
||||||
<script src="{$basePath}/js/obvody.js"></script>
|
{foreach $obvody as $obvod}
|
||||||
|
<a n:href=":Obvody: id:$obvod" class="list-group-item list-group-item-action">{$obvod}</a>
|
||||||
|
{/foreach}
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Presentation\Obvody;
|
||||||
|
|
||||||
|
use Nette;
|
||||||
|
|
||||||
|
|
||||||
|
final class ObvodyPresenter extends Nette\Application\UI\Presenter
|
||||||
|
{
|
||||||
|
public function beforeRender(): void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function renderDefault(int $obvod = null): void
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
{* This is the welcome page, you can delete it *}
|
||||||
|
|
||||||
|
{block content}
|
||||||
|
<div id="map"></div>
|
||||||
|
|
||||||
|
|
||||||
|
<script src="{$basePath}/js/mapa.js"></script>
|
||||||
|
<script src="{$basePath}/js/obvody.js"></script>
|
||||||
File diff suppressed because one or more lines are too long
10366
www/js/obvody.js
10366
www/js/obvody.js
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue