public function init() { parent::init(); if ($this->parentMenuItemId) { $query = MenuContent::find()->where(['and', 'active=1', 'parent_id=' . $this->parentMenuItemId]); if (\Yii::$app->user->isGuest) { $query->andWhere(['public' => 1]); } $this->_items = $query->orderBy(['item_order' => SORT_ASC])->all(); } else { throw new InvalidParamException(\Yii::t('front', 'No required parameter given') . ' - parentMenuItemId'); } }
<nav> <div class="container"> <div id="search-btn" class="right hide-on-med-and-down"><i class="material-icons small waves-effect waves-light tooltipped" data-position="bottom" data-delay="50" data-tooltip="zobrazit / skrýt okno pro vyhledávání">search</i> </div> <div class="nav-wrapper"> <?php echo Html::a(Html::img(Yii::$app->request->baseUrl . '/basic-assets/img/logo.png', ['alt' => 'Sportoviště Dačice - logo']), Yii::$app->homeUrl, ['class' => 'brand-logo']); ?> <a href="#" data-activates="mobile-navigation" class="button-collapse"><i class="material-icons">menu</i></a> <?php $menuItems = MenuContent::getItemsTree('mainmenu', null, 'dropdown'); echo Menu::widget(['options' => ['class' => 'right hide-on-med-and-down'], 'activateParents' => true, 'encodeLabels' => false, 'items' => $menuItems]); $sideMenuItems = MenuContent::getItemsTree('mainmenu', null, 'collapsible'); echo Menu::widget(['options' => ['id' => 'mobile-navigation', 'class' => 'side-nav collapsible', 'data-collapsible' => 'accordion'], 'activateParents' => true, 'encodeLabels' => false, 'items' => $sideMenuItems]); ?> </div> </div> </nav> </div> </header> <main class="page-row page-row-expanded"> <div class="container" style="position: relative;"> <div id="search-form-box" style="display: none;"> <h3><?php echo Yii::t('front', 'Search this site'); ?> </h3>
/** * Sets $_menuContent property * @param integer $menuId */ public function setMenuContent($menuId) { if ($menuId && ($menuContent = MenuContent::findOne($menuId))) { $this->_menuContent = $menuContent; } }
/* @var $menuContent \frontend\models\MenuContent */ /* @var $page \common\models\Page */ use dosamigos\google\maps\LatLng; use dosamigos\google\maps\Map; use dosamigos\google\maps\overlays\InfoWindow; use dosamigos\google\maps\overlays\Marker; use frontend\models\MenuContent; use frontend\utilities\FrontEndHelper; use pavlinter\display\DisplayImage; use yii\helpers\Html; $this->title = $menuContent->title; $this->params['menuContent'] = $menuContent; $page = $menuContent->content; /** @noinspection PhpUndefinedFieldInspection */ $this->context->layout = 'page-content'; $data = [['title' => Yii::t('front', 'Aquapark of Dačice'), 'lat' => 49.083191, 'lng' => 15.422774, 'url' => MenuContent::getMenuUrlFromId(Yii::$app->params[Yii::$app->language]['poolMenuId'])], ['title' => Yii::t('front', 'Sports Hall'), 'lat' => 49.082224, 'lng' => 15.433216, 'url' => MenuContent::getMenuUrlFromId(Yii::$app->params[Yii::$app->language]['hallMenuId'])], ['title' => Yii::t('front', 'Town Stadium'), 'lat' => 49.084096, 'lng' => 15.434793, 'url' => MenuContent::getMenuUrlFromId(Yii::$app->params[Yii::$app->language]['stadiumMenuId'])], ['title' => Yii::t('front', 'Skittle-alley'), 'lat' => 49.081995, 'lng' => 15.433613, 'url' => MenuContent::getMenuUrlFromId(Yii::$app->params[Yii::$app->language]['skittleMenuId'])], ['title' => Yii::t('front', 'Playground in the Boženy Němcové Street'), 'lat' => 49.083391, 'lng' => 15.426961, 'url' => MenuContent::getMenuUrlFromId(Yii::$app->params[Yii::$app->language]['playgroundTownMenuId'])], ['title' => Yii::t('front', 'Playground in the Bratrská Street'), 'lat' => 49.082153, 'lng' => 15.434847, 'url' => MenuContent::getMenuUrlFromId(Yii::$app->params[Yii::$app->language]['playgroundTownMenuId'])], ['title' => Yii::t('front', 'Playground in the Dlouhá Street'), 'lat' => 49.082818, 'lng' => 15.423321, 'url' => MenuContent::getMenuUrlFromId(Yii::$app->params[Yii::$app->language]['playgroundTownMenuId'])], ['title' => Yii::t('front', 'Playground Nivy'), 'lat' => 49.080432, 'lng' => 15.419617, 'url' => MenuContent::getMenuUrlFromId(Yii::$app->params[Yii::$app->language]['playgroundTownMenuId'])], ['title' => Yii::t('front', 'Playground in the Vápovská Street'), 'lat' => 49.079634, 'lng' => 15.441433, 'url' => MenuContent::getMenuUrlFromId(Yii::$app->params[Yii::$app->language]['playgroundTownMenuId'])], ['title' => Yii::t('front', 'Playground Za školou'), 'lat' => 49.074403, 'lng' => 15.442875, 'url' => MenuContent::getMenuUrlFromId(Yii::$app->params[Yii::$app->language]['playgroundTownMenuId'])], ['title' => Yii::t('front', 'Playground in the Chateau park'), 'lat' => 49.077979, 'lng' => 15.430677, 'url' => MenuContent::getMenuUrlFromId(Yii::$app->params[Yii::$app->language]['playgroundTownMenuId'])], ['title' => Yii::t('front', 'Playground in the Bílkov Village'), 'lat' => 49.084297, 'lng' => 15.478046, 'url' => MenuContent::getMenuUrlFromId(Yii::$app->params[Yii::$app->language]['playgroundPlacesMenuId'])], ['title' => Yii::t('front', 'Playground in the Borek Village'), 'lat' => 49.074553, 'lng' => 15.460972, 'url' => MenuContent::getMenuUrlFromId(Yii::$app->params[Yii::$app->language]['playgroundPlacesMenuId'])], ['title' => Yii::t('front', 'Playground in the Dolní Němčice Village'), 'lat' => 49.093647, 'lng' => 15.395012, 'url' => MenuContent::getMenuUrlFromId(Yii::$app->params[Yii::$app->language]['playgroundPlacesMenuId'])], ['title' => Yii::t('front', 'Playground in the Hostkovice Village'), 'lat' => 49.081998, 'lng' => 15.383993, 'url' => MenuContent::getMenuUrlFromId(Yii::$app->params[Yii::$app->language]['playgroundPlacesMenuId'])], ['title' => Yii::t('front', 'Playground in the Hradišťko Village'), 'lat' => 49.059376, 'lng' => 15.43991, 'url' => MenuContent::getMenuUrlFromId(Yii::$app->params[Yii::$app->language]['playgroundPlacesMenuId'])], ['title' => Yii::t('front', 'Playground in the Chlumec Village'), 'lat' => 49.051084, 'lng' => 15.462888, 'url' => MenuContent::getMenuUrlFromId(Yii::$app->params[Yii::$app->language]['playgroundPlacesMenuId'])], ['title' => Yii::t('front', 'Playground in the Lipolec Village'), 'lat' => 49.086869, 'lng' => 15.357986, 'url' => MenuContent::getMenuUrlFromId(Yii::$app->params[Yii::$app->language]['playgroundPlacesMenuId'])], ['title' => Yii::t('front', 'Playground in the Malý Pěčín Village'), 'lat' => 49.107628, 'lng' => 15.458102, 'url' => MenuContent::getMenuUrlFromId(Yii::$app->params[Yii::$app->language]['playgroundPlacesMenuId'])], ['title' => Yii::t('front', 'Playground in the Prostřední Vydří Village'), 'lat' => 49.123202, 'lng' => 15.41228, 'url' => MenuContent::getMenuUrlFromId(Yii::$app->params[Yii::$app->language]['playgroundPlacesMenuId'])], ['title' => Yii::t('front', 'Playground in the Velký Pěčín Village'), 'lat' => 49.119018, 'lng' => 15.450244, 'url' => MenuContent::getMenuUrlFromId(Yii::$app->params[Yii::$app->language]['playgroundPlacesMenuId'])]]; $center = new LatLng(['lat' => 49.091067, 'lng' => 15.421259]); $map = new Map(['width' => '100%', 'height' => 800, 'center' => $center, 'zoom' => 13]); foreach ($data as $item) { $coord = new LatLng(['lat' => $item['lat'], 'lng' => $item['lng']]); $marker = new Marker(['position' => $coord, 'title' => $item['title']]); $marker->attachInfoWindow(new InfoWindow(['content' => isset($item['url']) ? Html::a($item['title'], $item['url']) : $item['title']])); $map->addOverlay($marker); } echo '<div class="row"><div class="col s12">'; echo $map->display(); echo '</div></div>'; if ($page->image) { echo DisplayImage::widget(['options' => ['class' => 'responsive-img', 'title' => $menuContent->title], 'category' => 'all', 'image' => $page->image->filename]); } if ($page->perex) {
<?php /* @var $this yii\web\View */ /* @var $content string */ /* @var $menuContent \frontend\models\MenuContent */ use frontend\assets\basic\BasicContentAsset; use frontend\components\SiblingMenus; use frontend\models\MenuContent; use yii\helpers\Url; use yii\widgets\Breadcrumbs; BasicContentAsset::register($this); $menuContent = $this->params['menuContent']; $breadcrumbs = MenuContent::getBreadCrumbs($menuContent->id); $this->beginContent($this->theme->getPath('layouts/main.php')); ?> <section> <div class="container"> <div class="page-title"> <h2> <?php if ($breadcrumbs) { echo Breadcrumbs::widget(['homeLink' => ['label' => Yii::t('front', 'home'), 'url' => Yii::$app->homeUrl], 'activeItemTemplate' => "<span>{link}</span>", 'itemTemplate' => "<span>{link}</span>", 'links' => $breadcrumbs, 'tag' => 'div', 'options' => ['class' => 'breadcrumbs']]); } ?> <?php echo ucfirst($this->title); ?> </h2> </div> </div>
/** * Sets found items array * @param $data * @param $type */ private function setItems($data, $type) { foreach ($data as $item) { $this->items[] = ['id' => $type != 'article' ? $item->id : $item['article_id'], 'title' => $type != 'article' ? $item->title : $item['article_title'], 'breadcrumbs' => MenuContent::getBreadCrumbs($type != 'article' ? $item->parent_id : $item['menu_item_id'], [], false), 'perex' => StringHelper::truncateWords($type == 'category' ? $item->category->description : ($type == 'content' ? $item->content->perex ? $item->content->perex : $item->content->description : $item['perex']), 30), 'url' => $type != 'article' ? $item->getUrl() : ArticleContent::getUrl($item['menu_item_title'], $item['menu_item_id'], $item['article_title'], $item['article_id']), 'updated_at' => $type != 'article' ? $item->updated_at : $item['article_updated_at']]; } }
<?php /* @var $this yii\web\View */ /* @var $content string */ /* @var $menuContent \frontend\models\MenuContent */ /* @var $articleContent \frontend\models\ArticleContent */ use frontend\assets\basic\BasicContentAsset; use frontend\components\CategoryArticlesList; use frontend\models\MenuContent; use yii\helpers\Url; use yii\widgets\Breadcrumbs; BasicContentAsset::register($this); $menuContent = $this->params['menuContent']; $articleContent = $this->params['articleContent']; $breadcrumbs = MenuContent::getBreadCrumbs($menuContent->id, [], true); $windowOpen = 'javascript:window.open(this.href, \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600\');return false;'; $this->beginContent($this->theme->getPath('layouts/main.php')); ?> <section> <div class="container"> <div class="page-title"> <h2> <?php if ($breadcrumbs) { echo Breadcrumbs::widget(['homeLink' => ['label' => Yii::t('front', 'home'), 'url' => Yii::$app->homeUrl], 'activeItemTemplate' => "<span>{link}</span>", 'itemTemplate' => "<span>{link}</span>", 'links' => $breadcrumbs, 'tag' => 'div', 'options' => ['class' => 'breadcrumbs']]); } ?> <?php echo $articleContent->title; ?>
?> </div> </div> <div class="col s12 m4"> <div class="info-important"> <i class="material-icons medium">place</i> <h4><?php echo Yii::t('front', 'map of sports'); ?> </h4> <p><?php echo Yii::t('front', 'You can view a map<br /> with the location of sports venues.'); ?> </p> <?php echo Html::a('<i class="material-icons right">forward</i>' . Yii::t('front', 'view map'), MenuContent::getMenuUrlFromId(Yii::$app->params[Yii::$app->language]['mapMenuId']), ['class' => 'btn']); ?> </div> </div> <!-- <div class="col s12 m4"> <div class="info-important"> <i class="material-icons medium">event</i> <h4>rezervace</h4> <p>Můžete si rezervovat čas v některé<br/> z tělocvičen sportovní haly</p> <a href="#!" class="btn"><i class="material-icons right">forward</i><?php /* echo Yii::t( 'front', 'booking form' ); */ ?> </a>