Basic Menu. Přesunutí geojson.

master
Kowalski 2025-03-07 19:26:10 +01:00
parent 4048548923
commit 53b64105bb
7 changed files with 78 additions and 10358 deletions

View File

@ -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);
}
} }

View File

@ -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>
<div class="list-group" style="max-width: 200px">
<script src="{$basePath}/js/mapa.js"></script> {foreach $obvody as $obvod}
<script src="{$basePath}/js/obvody.js"></script> <a n:href=":Obvody: id:$obvod" class="list-group-item list-group-item-action">{$obvod}</a>
{/foreach}
</div>

View File

@ -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
{
}
}

View File

@ -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

File diff suppressed because it is too large Load Diff