You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

139 lines
3.5 KiB

<?php
/**
* Created by Error202
* Date: 10.07.2018
*/
use kartik\form\ActiveForm;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
/**
* @var $this \yii\web\View
* @var $model \core\forms\menu\MenuSelectForm
* @var $menus \core\entities\menu\Menu[]
* @var $menu \core\entities\menu\Menu
* @var $creator array
*/
$this->title = Yii::t('menu', 'Menu');
$this->params['breadcrumbs'][] = Html::encode(isset($menu->translation) ? $menu->translation->name : Yii::t('menu', 'Not set'));
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="menu">
<div class="box box-default">
<div class="box-header with-border"><?= Yii::t('menu', 'Current Menu') ?></div>
<div class="box-body">
<div class="row">
<div class="col-md-6">
<?php $form = ActiveForm::begin([
'enableClientValidation' => false,
'method' => 'get',
'id' => 'select_menu',
]); ?>
<?= $form->field($model, 'id')->dropDownList($menus, [
//'prompt' => Yii::t('menu', 'Select menu...'),
'value' => $menu->id,
'onchange' => 'this.form.submit()',
])->label(false) ?>
<?php ActiveForm::end(); ?>
</div>
<div class="col-md-6">
<?= Html::a(Yii::t('menu', 'Create Menu'), ['menu/create'], [
'class' => 'btn btn-success',
]) ?>
<?= Html::a(Yii::t('menu', 'Update Menu'), ['menu/update', 'id' => $menu->id], [
'class' => 'btn btn-primary',
]) ?>
<?= Html::a(Yii::t('menu', 'Delete Menu'), ['menu/delete', 'id' => $menu->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => Yii::t('buttons', 'Are you sure you want to delete this item?'),
'method' => 'post',
],
]) ?>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="box box-default">
<div class="box-header with-border"><?= Yii::t('menu', 'Available Blocks') ?></div>
<div class="box-body">
<div class="panel-group" id="accordion">
<?php foreach ($creator as $item): ?>
<div class="panel panel-default">
<div class="panel-heading" style="padding-left: 0">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse<?= $item['id'] ?>"><?= $item['title'] ?>
<i class="fa fa-angle-down pull-right" aria-hidden="true"></i></a>
</h4>
</div>
<div id="collapse<?= $item['id'] ?>" class="panel-collapse collapse">
<div class="panel-body">
<?= $item['content'] ?>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<div class="box box-default">
<div class="box-header with-border"><?= Yii::t('menu', 'Menu Items') ?></div>
<div class="box-body">
<?= \backend\components\menu\widgets\MenuEditorWidget::widget([
'menu_id' => $menu->id
]) ?>
</div>
</div>
</div>
<div class="col-md-3">
<div class="box box-default">
<div class="box-header with-border"><?= Yii::t('menu', 'Insert Code') ?></div>
<div class="box-body">
<?php
$code = Html::encode(
"<?= \core\widgets\menu\MenuWidget::widget([
'menu_id' => ".$menu->id.",
]) ?>");
?>
<p><?= Yii::t('menu', 'For template') ?></p>
<pre><?= $code ?></pre>
<?php
$code = Html::encode(
"[?= \core\widgets\menu\MenuWidget::widget([
'menu_id' => ".$menu->id.",
]) ?]");
?>
<p><?= Yii::t('menu', 'For editor') ?></p>
<pre><?= $code ?></pre>
</div>
</div>
</div>
</div>