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.
 
 
 
 
 

155 lines
3.8 KiB

<?php
/**
* Created by Error202
* Date: 11.07.2018
*/
/**
* @var $this \yii\web\View
* @var $items array
* @var $menu \core\entities\menu\Menu
*/
use backend\components\menu\assets\MenuAsset;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\web\JsExpression;
MenuAsset::register($this);
function menu_generate($items) {
$html = '<ol class="dd-list">';
foreach ($items as $item) {
$html.=Yii::$app->getView()->render( '_item', [
'item' => $item,
] );
}
return $html . '</ol>';
}
$url = Url::to(['/menu/save-menu-items']);
$redirect = Url::to(['menu/index', 'id' => $menu->id]);
?>
<div class="dd" id="nestable3">
<?= menu_generate($items) ?>
</div>
<!--
<div class="dd" id="nestable2">
<ol class="dd-list">
<li class="dd-item dd3-item" data-id="13">
<div class="dd3-content">
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<div class="dd-handle dd3-handle"> </div>
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1">Item 13
<i class="fa fa-angle-down pull-right" aria-hidden="true"></i></a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse">
<div class="panel-body">
Content Panel
</div>
</div>
</div>
</div>
</div>
</li>
<li class="dd-item dd3-item" data-id="14">
<div class="dd3-content">
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<div class="dd-handle dd3-handle"> </div>
<a data-toggle="collapse" data-parent="#accordion" href="#collapse2">Item 14
<i class="fa fa-angle-down pull-right" aria-hidden="true"></i></a>
</h4>
</div>
<div id="collapse2" class="panel-collapse collapse">
<div class="panel-body">
Content Panel
</div>
</div>
</div>
</div>
</div>
</li>
<li class="dd-item dd3-item" data-id="15">
<div class="dd3-content">
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<div class="dd-handle dd3-handle"> </div>
<a data-toggle="collapse" data-parent="#accordion" href="#collapse3">Item 15
<i class="fa fa-angle-down pull-right" aria-hidden="true"></i></a>
</h4>
</div>
<div id="collapse3" class="panel-collapse collapse">
<div class="panel-body">
Content Panel
</div>
</div>
</div>
</div>
</div>
<ol class="dd-list">
<li class="dd-item dd3-item" data-id="16">
<div class="dd3-content">
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<div class="dd-handle dd3-handle"> </div>
<a data-toggle="collapse" data-parent="#accordion" href="#collapse4">Item 16
<i class="fa fa-angle-down pull-right" aria-hidden="true"></i></a>
</h4>
</div>
<div id="collapse4" class="panel-collapse collapse">
<div class="panel-body">
Content Panel
</div>
</div>
</div>
</div>
</div>
</li>
</ol>
</li>
</ol>
</div>
</div>
<div style="clear: both;"></div>
<hr>
<button class="btn btn-primary" id="serialize">Serialize</button>
<hr>
<textarea class="form-control" id="output"></textarea>
<hr>
<textarea class="form-control" id="output2"></textarea>
-->
<div style="clear: both;"></div>
<hr>
<?= Html::button(Yii::t('buttons', 'Save'), [
'class' => 'btn btn-success pull-right',
'onclick' => new JsExpression('sendTree('.$menu->id.', "'.$url.'", "'.$redirect.'")'),
]) ?>