/** * @return string|\yii\web\Response */ public function actionContact() { $modelPage = Page::currentPage(); $model = new ContactForm(); if ($model->load(Yii::$app->request->post()) && $model->validate()) { if ($model->sendEmail()) { Yii::$app->session->setFlash('success', Yii::t("app/contact", "Thank you for contacting us. We will respond to you as soon as possible.", ['dot' => false])); return $this->refresh(); } Yii::$app->session->setFlash('error', Yii::t("app/contact", "There was an error sending email.", ['dot' => false])); } return $this->render('contact', ['model' => $model, 'modelPage' => $modelPage]); }
<?php use app\assets_b\AppAsset; use app\core\admpages\models\Page; use yii\bootstrap\Nav; use yii\bootstrap\NavBar; use yii\helpers\Html; use app\helpers\Url; use yii\widgets\Breadcrumbs; /* @var $this \yii\web\View */ /* @var $content string */ $appAsset = AppAsset::register($this); /* @var $i18n \pavlinter\translation\I18N */ $i18n = Yii::$app->getI18n(); \app\modules\admunderconst\Module::loadUnderConstruction($this); $menus = Page::find()->with(['translations', 'childs' => function ($q) { $q->andWhere(['active' => 1, 'visible' => 1]); }])->where(['id_parent' => [1, 2, 3], 'active' => 1, 'visible' => 1])->orderBy(['weight' => SORT_ASC])->all(); $Menu1 = []; $Menu2 = []; $Menu3 = []; $baseUrl = Url::getLangUrl(); foreach ($menus as $menu) { $item = []; $item['label'] = $menu->name; if ($menu->type === 'main') { $item['url'] = $baseUrl; } else { $item['url'] = $menu->url(); } if ($menu->childs) {
<?php use app\assets_b\AppAsset; use app\core\admpages\models\Page; use yii\bootstrap\Nav; use yii\bootstrap\NavBar; use yii\helpers\Html; use app\helpers\Url; use yii\widgets\Breadcrumbs; /* @var $this \yii\web\View */ /* @var $content string */ $appAsset = AppAsset::register($this); /* @var $i18n \pavlinter\translation\I18N */ $i18n = Yii::$app->getI18n(); \app\modules\admunderconst\Module::loadUnderConstruction($this); $menus = Page::find()->with(['translations', 'childs'])->where(['id_parent' => [1, 2, 3], 'active' => 1, 'visible' => 1])->orderBy(['weight' => SORT_ASC])->all(); $Menu1 = []; $Menu2 = []; $Menu3 = []; $baseUrl = Url::getLangUrl(); foreach ($menus as $menu) { $item = []; $item['label'] = $menu->name; if ($menu->type === 'main') { $item['url'] = $baseUrl; } else { $item['url'] = $menu->url(); } if ($menu->childs) { foreach ($menu->childs as $child) { $item['items'][] = ['label' => $child->name, 'url' => $child->url()];