Since: 1.0
Author: Kartik Visweswaran (kartikv2@gmail.com)
Inheritance: extends kartik\base\Widget
Example #1
1
<?php
use kartik\tree\TreeView;
use app\models\Course;
use yii\helpers\html;
 
 $this->title = Yii::t('app', 'Course Manage');

echo TreeView::widget([
    // single query fetch to render the tree
    // use the Product model you have in the previous step
    'query' => Course::find()->addOrderBy('root, lft'), 
    'headingOptions' => ['label' => Yii::t('app', 'Contents')],
    'fontAwesome' => false,     // optional
    'isAdmin' => true,         // optional (toggle to enable admin mode)
    'displayValue' => 1,        // initial display value
    'softDelete' => true,       // defaults to true
    'cacheSettings' => [        
        'enableCache' => true   // defaults to true
    ]
]);
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     $module = TreeView::module();
     $keyAttribute = $nameAttribute = $leftAttribute = $rightAttribute = $depthAttribute = null;
     $treeAttribute = $iconAttribute = $iconTypeAttribute = null;
     extract($module->treeStructure + $module->dataStructure);
     $labels = [$keyAttribute => Yii::t('kvtree', 'ID'), $nameAttribute => Yii::t('kvtree', 'Name'), $leftAttribute => Yii::t('kvtree', 'Left'), $rightAttribute => Yii::t('kvtree', 'Right'), $depthAttribute => Yii::t('kvtree', 'Depth'), $iconAttribute => Yii::t('kvtree', 'Icon'), $iconTypeAttribute => Yii::t('kvtree', 'Icon Type'), 'active' => Yii::t('kvtree', 'Active'), 'selected' => Yii::t('kvtree', 'Selected'), 'disabled' => Yii::t('kvtree', 'Disabled'), 'readonly' => Yii::t('kvtree', 'Read Only'), 'visible' => Yii::t('kvtree', 'Visible'), 'collapsed' => Yii::t('kvtree', 'Collapsed'), 'movable_u' => Yii::t('kvtree', 'Movable Up'), 'movable_d' => Yii::t('kvtree', 'Movable Down'), 'movable_l' => Yii::t('kvtree', 'Movable Left'), 'movable_r' => Yii::t('kvtree', 'Movable Right'), 'removable' => Yii::t('kvtree', 'Removable'), 'removable_all' => Yii::t('kvtree', 'Removable (with children)')];
     if (!$treeAttribute) {
         $labels[$treeAttribute] = Yii::t('kvtree', 'Root');
     }
     return $labels;
 }
Example #3
1
$this->title = 'Портфолио';
if (Yii::$app->user->identity->role != User::ROLE_STUDENT) {
    $this->params['breadcrumbs'][] = ['label' => 'Образовательные программы', 'url' => ['/program', 'idParent' => $student->idProgram->id_faculty]];
    $this->params['breadcrumbs'][] = ['label' => 'Студенты', 'url' => ['main/index', 'idParent' => $student->id_program, 'page' => Yii::$app->session->get('studentPage')]];
}
$this->params['breadcrumbs'][] = $this->title;
?>

<h2>Портфолио</h2>
<h3>
    Студент: <?php 
echo $student->studentName;
?>
 Курс: <?php 
echo $student->course;
?>
 Программа: <?php 
echo $student->idProgram->fullName;
?>
</h3>


<?php 
echo TreeView::widget(['options' => ['id' => 'idPortfolio'], 'query' => StudentPortfolio::find()->where(['id_student' => $id])->addOrderBy('root, lft'), 'showIDAttribute' => false, 'nodeFormOptions' => ['name' => 'nodeForm', 'enctype' => 'multipart/form-data'], 'displayValue' => $beginNodeId, 'isAdmin' => false, 'softDelete' => false, 'multiple' => false, 'rootOptions' => ['label' => ''], 'iconEditSettings' => ['show' => 'none'], 'mainTemplate' => '<div class="row">
        <div class="col-sm-5">
            {wrapper}
        </div>
           <div class="col-sm-7">
            {detail}
        </div>
        </div>', 'wrapperTemplate' => '{tree}{footer}', 'nodeAddlViews' => [Module::VIEW_PART_2 => '@backend/modules/student/views/portfolio/_file'], 'cacheSettings' => ['enableCache' => true], 'showTooltips' => false]);
Example #4
0
 /**
  * Generate and return the breadcrumbs for the node
  *
  * @param int $depth the breadcrumbs parent depth
  * @param string $glue the pattern to separate the breadcrumbs
  * @param string $currNodeCss the CSS class to be set for current node
  * @param string $untitled the name to be displayed for a new node
  *
  * @return string the parsed breadcrumbs
  */
 public function getBreadcrumbs($depth = 1, $glue = ' &raquo; ', $currNodeCss = 'kv-crumb-active', $untitled = 'Untitled')
 {
     /**
      * @var Tree $this
      */
     if ($this->isNewRecord || empty($this)) {
         return $currNodeCss ? Html::tag('span', $untitled, ['class' => $currNodeCss]) : $untitled;
     }
     $depth = empty($depth) ? null : intval($depth);
     $module = TreeView::module();
     $nameAttribute = ArrayHelper::getValue($module->dataStructure, 'nameAttribute', 'name');
     $crumbNodes = $depth === null ? $this->parents()->all() : $this->parents($depth - 1)->all();
     $crumbNodes[] = $this;
     $i = 1;
     $len = count($crumbNodes);
     $crumbs = [];
     foreach ($crumbNodes as $node) {
         $name = $node->{$nameAttribute};
         if ($i === $len && $currNodeCss) {
             $name = Html::tag('span', $name, ['class' => $currNodeCss]);
         }
         $crumbs[] = $name;
         $i++;
     }
     return implode($glue, $crumbs);
 }
Example #5
0
<?php

use kartik\tree\TreeView;
use common\models\Category;
use kartik\tree\TreeViewInput;
$this->title = Yii::t('app', 'Categories Data');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="row">
<div class="col-lg-12">
<?php 
echo TreeView::widget(['query' => Category::find()->addOrderBy('root, lft'), 'nodeAddlViews' => [\kartik\tree\Module::VIEW_PART_2 => '@backend/views/category/_treePart2'], 'headingOptions' => ['label' => '分类数据'], 'fontAwesome' => false, 'isAdmin' => true, 'displayValue' => 1, 'softDelete' => true, 'cacheSettings' => ['enableCache' => true]]);
?>

</div>

</div>
Example #6
0
      //'cacheSettings'   => ['enableCache' => true]      // normally not needed to change
      'rootOptions'       => ['label'=>'<span class="text-primary">计生系统</span>'],
      'softDelete'        => true,
      'cacheSettings'     => ['enableCache' => true],
      'iconEditSettings'=> [
          'show'      => 'list',
          'listData'  => [
              'folder' => 'Folder',
              'file' => 'File',
              'star' => 'Star',
              'bell' => 'Bell',
          ]
      ],
  ]);*/
echo \kartik\tree\TreeView::widget(['query' => \common\models\PreferencesTree::find()->addOrderBy('root, lft'), 'headingOptions' => ['label' => '<span class="text-info">系统参数配置</span>'], 'fontAwesome' => true, 'isAdmin' => true, 'displayValue' => 1, 'softDelete' => true, 'cacheSettings' => ['enableCache' => true], 'iconEditSettings' => ['show' => 'list', 'listData' => ['folder' => 'Folder', 'file' => 'File', 'star' => 'Star', 'bell' => 'Bell']], 'nodeAddlViews' => [\kartik\tree\Module::VIEW_PART_2 => '@common/views/treemanager/_preferencesTree']]);
echo \kartik\tree\TreeView::widget(['query' => \common\models\Nav::find()->addOrderBy('root, lft'), 'headingOptions' => ['label' => '<span class="text-info">系统参数配置</span>'], 'fontAwesome' => true, 'isAdmin' => true, 'displayValue' => 1, 'softDelete' => true, 'cacheSettings' => ['enableCache' => true], 'iconEditSettings' => ['show' => 'list', 'listData' => ['folder' => 'Folder', 'file' => 'File', 'star' => 'Star', 'bell' => 'Bell']], 'nodeAddlViews' => [\kartik\tree\Module::VIEW_PART_2 => '@common/views/treemanager/_nav']]);
\common\widgets\JsBlock::begin();
?>
    <script type="text/javascript">
        $(document).ready(function() {
            var switcher1 = $('#switchCheck1').switcher();
            var switcher2 = $('.switch').switcher();
            $('#switchCheck1').switcher().on('change', function() {
                console.log(1111);
            });
            $('#calendar').fullCalendar({
                theme: true,
                header: {
                    left: 'prev,next today',
                    center: 'title',
                    right: 'month,agendaWeek,agendaDay'
Example #7
0
File: list.php Project: vetoni/toko
<?php

use app\models\Category;
use kartik\tree\TreeView;
use yii\helpers\Url;
use yii\web\View;
/**
 * @var View $this
 * @var integer $node
 */
$this->title = Yii::t('app', 'Categories');
$id = 'category_tree';
echo TreeView::widget(['id' => $id, 'query' => Category::find()->addOrderBy('root, lft'), 'isAdmin' => false, 'displayValue' => $node, 'iconEditSettings' => ['show' => 'none', 'listData' => []], 'wrapperTemplate' => "{tree}{footer}", 'defaultChildNodeIcon' => '<i class="glyphicon glyphicon-folder-close"></i>', 'softDelete' => false, 'nodeFormOptions' => ['enctype' => 'multipart/form-data'], 'nodeAddlViews' => [\kartik\tree\Module::VIEW_PART_2 => '@app/modules/admin/views/category/details'], 'rootOptions' => ['label' => Yii::t('app', 'Shop')]]);
$listUrl = Url::to(['/admin/category/list']);
$this->registerJs(new \yii\web\JsExpression(<<<EOD
\$("#{$id}").on('treeview.selected', function(event, key, data, textStatus, jqXHR) {
    if (key) window.history.pushState(key, 'key', '{$listUrl}?node=' + (key));
});
EOD
));
<?php

use yii\helpers\Html;
use besnovatyj\blog\models\Thread;
use kartik\tree\TreeView;
$this->title = Yii::t('thread', 'Threads');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="thread-index">

    <h4><?php 
echo Html::encode($this->title);
?>
</h4>
    <?php 
echo TreeView::widget(['query' => Thread::find()->addOrderBy('root, lft'), 'headingOptions' => ['label' => 'Threads'], 'isAdmin' => false, 'displayValue' => 1]);
?>
</div>


 /**
  * View, create, or update a tree node via ajax
  *
  * @return string json encoded response
  */
 public function actionManage()
 {
     Yii::$app->response->format = Response::FORMAT_JSON;
     static::checkValidRequest();
     $parentKey = $action = null;
     $modelClass = '\\kartik\\tree\\models\\Tree';
     $isAdmin = $softDelete = $showFormButtons = $showIDAttribute = false;
     $currUrl = $nodeView = $formOptions = $formAction = $breadCrumbs = '';
     $iconsList = $nodeAddlViews = [];
     extract(static::getPostData());
     /**
      * @var Tree $modelClass
      * @var Tree $node
      */
     if (!isset($id) || empty($id)) {
         $node = new $modelClass();
         $node->initDefaults();
     } else {
         $node = $modelClass::findOne($id);
     }
     $module = TreeView::module();
     $params = $module->treeStructure + $module->dataStructure + ['node' => $node, 'parentKey' => $parentKey, 'action' => $formAction, 'formOptions' => empty($formOptions) ? [] : $formOptions, 'modelClass' => $modelClass, 'currUrl' => $currUrl, 'isAdmin' => $isAdmin, 'iconsList' => $iconsList, 'softDelete' => $softDelete, 'showFormButtons' => $showFormButtons, 'showIDAttribute' => $showIDAttribute, 'nodeView' => $nodeView, 'nodeAddlViews' => $nodeAddlViews, 'breadcrumbs' => empty($breadcrumbs) ? [] : $breadcrumbs];
     if (!empty($module->unsetAjaxBundles)) {
         Event::on(View::className(), View::EVENT_AFTER_RENDER, function ($e) use($module) {
             foreach ($module->unsetAjaxBundles as $bundle) {
                 unset($e->sender->assetBundles[$bundle]);
             }
         });
     }
     $callback = function () use($nodeView, $params) {
         return $this->renderAjax($nodeView, ['params' => $params]);
     };
     return self::process($callback, Yii::t('kvtree', 'Error while viewing the node. Please try again later.'), null);
 }
use besnovatyj\blog\models\Category;
use kartik\tree\TreeView;
/**
 * @var yii\web\View $this
 * @var yii\data\ActiveDataProvider $dataProvider
 * @var besnovatyj\blog\models\CategorySearch $searchModel
 */
$this->title = Yii::t('blog', 'Categories');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="category-index">


    <?php 
if (Yii::$app->user->can('administrator')) {
    echo '<div class="alert alert-danger">Внимание!<br />У вас привилегии администратора, будьте осторожны при изменении и удалении любой информации на этой странице!</div>';
}
?>


    <h4><?php 
echo Html::encode($this->title);
?>
</h4>
    <?php 
echo TreeView::widget(['query' => Category::find()->addOrderBy('root, lft'), 'headingOptions' => ['label' => 'Категории'], 'isAdmin' => false, 'softDelete' => !Yii::$app->user->can('administrator')]);
?>
</div>


Example #11
0
<?php

$this->title = '菜单管理';
$this->params['breadcrumbs'][] = $this->title;
/**
 * @author oba.ou
 */
// VIEW - views/product/index.php
echo \kartik\tree\TreeView::widget(['query' => \app\core\models\SystemMenu::find()->addOrderBy('root, lft , sort'), 'headingOptions' => ['label' => '菜单管理'], 'rootOptions' => ['label' => '<span class="text-primary">顶级栏目</span>'], 'fontAwesome' => true, 'isAdmin' => false, 'displayValue' => 1, 'softDelete' => false, 'cacheSettings' => ['enableCache' => true], 'showIDAttribute' => false, 'nodeAddlViews' => [\kartik\tree\Module::VIEW_PART_1 => '@app/core/modules/system/views/menu/menu-form']]);
Example #12
0
<?php

use yii\helpers\Html;
use yii\helpers\Url;
use yii\grid\GridView;
use kartik\tree\TreeView;
use yii\bootstrap\Tabs;
?>

<div class="panel panel-primary">
    <div class="panel-heading">Categories</div>
    <div class="panel-body">
        <div class="posts-index">
            <?php 
echo Tabs::widget(['items' => [['label' => 'Category Tree Admin', 'content' => '<br>' . TreeView::widget(['query' => \plathir\smartblog\backend\models\Categorytree::find()->addOrderBy('root, lft'), 'headingOptions' => ['label' => 'Categories'], 'isAdmin' => true, 'displayValue' => 1, 'softDelete' => true, 'showInactive' => true, 'cacheSettings' => ['enableCache' => false]])], ['label' => 'Extra fields', 'content' => '<br>' . GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['header' => 'Name', 'format' => 'html', 'value' => function ($model, $key, $index, $grid) {
    $lvlVal = '';
    for ($x = 0; $x < $model->lvl; $x++) {
        if ($x == 0) {
            $lvlVal .= str_repeat('&nbsp;', 5);
        }
        $lvlVal .= '<span class="glyphicon glyphicon-minus" aria-hidden="true"></span>';
    }
    if ($lvlVal == '') {
        $lvlVal .= '<span class="glyphicon glyphicon-tree-conifer" aria-hidden="true"></span>';
        $lvlVal .= $model->name;
    } else {
        $lvlVal .= '<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>' . $model->name;
    }
    return $lvlVal;
}], 'id', ['attribute' => 'active', 'value' => function ($model, $key, $index, $widget) {
    return $model->active == true ? '<span class="label label-success">Active</span>' : '<span class="label label-danger">Inactive</span>';
Example #13
0
<?php

use kartik\tree\Module;
use kartik\tree\TreeView;
use common\models\Category;
$this->title = Yii::t('app', 'Category');
echo TreeView::widget(['query' => Category::find()->addOrderBy('root, lft'), 'headingOptions' => ['label' => Yii::t('app', 'Categories')], 'fontAwesome' => false, 'isAdmin' => true, 'displayValue' => 1, 'softDelete' => true, 'cacheSettings' => ['enableCache' => true], 'nodeAddlViews' => [Module::VIEW_PART_1 => '', Module::VIEW_PART_2 => '@backend/views/category/seo', Module::VIEW_PART_3 => '', Module::VIEW_PART_4 => '', Module::VIEW_PART_5 => '']]);
Example #14
0
?>

<h2>Портфолио</h2>
<h3>
    Студент: <?php 
echo $student->studentName;
?>
 Курс: <?php 
echo $student->course;
?>
 Программа: <?php 
echo $student->idProgram->fullName;
?>
</h3>

<?php 
FontAwesomeAsset::register($this);
echo TreeView::widget(['options' => ['id' => 'idPortfolio'], 'query' => StudentPortfolio::find()->where(['id_student' => $id])->addOrderBy('root, lft'), 'displayValue' => 0, 'fontAwesome' => true, 'nodeView' => '@frontend/modules/student/views/portfolio/_view', 'mainTemplate' => '<div class="row">
        <div class="col-sm-6">
            {wrapper}
        </div>
           <div class="col-sm-6">
            {detail}
        </div>
        </div>', 'wrapperTemplate' => '{tree}', 'rootOptions' => ['label' => ''], 'showFormButtons' => false, 'multiple' => false, 'iconEditSettings' => ['show' => 'none'], 'emptyNodeMsg' => ' ', 'showTooltips' => false]);
$script = <<<JS

\$('#idPortfolio').treeview("collapseAll");

JS;
$this->registerJs($script);
Example #15
0
File: index.php Project: C12D/api
use kartik\builder\Form;
use kartik\tree\TreeView;
use kartik\tree\TreeViewInput;
use frontend\models\doc\Doctree;
use kartik\tree\Module;
use frontend\assets\AppDoc;
/* CLASS ASSET CSS/JS/THEME Author: -ptr.nov-*/
AppDoc::register($this);
/* INDEPENDENT CSS/JS/THEME FOR PAGE  Author: -ptr.nov-*/
//use backend\assets\AppAsset;  	/* CLASS ASSET CSS/JS/THEME Author: -ptr.nov-*/
//AppAsset::register($this);		/* INDEPENDENT CSS/JS/THEME FOR PAGE  Author: -ptr.nov-*/
$this->sideCorp = 'PT. Gosend';
/* Title Select Company pada header pasa sidemenu/menu samping kiri */
$this->sideMenu = 'DOCUMENTATION';
/* kd_menu untuk list menu pada sidemenu, get from table of database */
$this->title = Yii::t('app', 'Gosend - Order ');
/* title pada header page */
$this->params['breadcrumbs'][] = $this->title;
/* belum di gunakan karena sudah ada list sidemenu, on plan next*/
echo TreeView::widget(['query' => Doctree::find()->addOrderBy('root'), 'headingOptions' => ['label' => 'Doc Categories'], 'fontAwesome' => false, 'isAdmin' => false, 'displayValue' => 1, 'iconEditSettings' => ['show' => 'list', 'listData' => ['folder-close' => 'Folder', 'file' => 'File', 'phone' => 'Phone', 'bell' => 'Bell']], 'softDelete' => false, 'cacheSettings' => ['enableCache' => false], 'nodeView' => '@kvtree/views/_form1', 'nodeAddlViews' => [Module::VIEW_PART_1 => 'a', Module::VIEW_PART_2 => '', Module::VIEW_PART_3 => '', Module::VIEW_PART_4 => '', Module::VIEW_PART_5 => ''], 'mainTemplate' => '    <div class="row">
        <div class="col-sm-3">
            {wrapper}
        </div>
        <div class="col-sm-9">
            {detail}
        </div>
    </div>']);
?>


Example #16
0
if (!$node->isNewRecord) {
    if ($node->isReadonly()) {
        $inputOpts['readonly'] = true;
    }
    if ($node->isDisabled()) {
        $inputOpts['disabled'] = true;
    }
    $flagOptions['disabled'] = $node->isLeaf();
}
/*
 * Begin active form
 * @controller NodeController
 */
$form = ActiveForm::begin(['action' => $action]);
// Get tree manager module
$treeViewModule = TreeView::module();
// create node Url
$nodeUrl = $node->createUrl();
// In case you are extending this form, it is mandatory to set
// all these hidden inputs as defined below.
echo Html::hiddenInput("Tree[{$keyAttribute}]", $node->id);
echo Html::hiddenInput('treeNodeModify', $node->isNewRecord);
echo Html::hiddenInput('parentKey', $parentKey);
echo Html::hiddenInput('currUrl', $currUrl);
echo Html::hiddenInput('modelClass', $modelClass);
echo Html::hiddenInput('softDelete', $softDelete);
?>
<div class="vertical-spacer"></div>

<?php 
if ($nodeUrl !== null) {
Example #17
0
 * Wrapper templates
 */
$headerTemplate = <<<HTML
<div class="row">
    <div class="col-sm-6" id="pages-detail-heading">
        {heading}
    </div>
    <div class="col-sm-6" id="pages-detail-search">
        {search}
    </div>
</div>
HTML;
$mainTemplate = <<<HTML
<div class="row">
    <div class="col-md-4" id="pages-detail-wrapper">
        <div class="box boy-body">
        {wrapper}
        </div>
    </div>
    <div class="col-md-8" id="pages-detail-panel">
        {detail}
    </div>
</div>
HTML;
/** @var Tree $queryTree */
$queryTree = Tree::find()->where([Tree::ATTR_ACCESS_DOMAIN => [\Yii::$app->language, Yii::$app->user->can(Tree::GLOBAL_ACCESS_PERMISSION) ? Tree::GLOBAL_ACCESS_DOMAIN : '']])->orderBy('root, lft');
/**
 * Render tree view
 */
echo TreeView::widget(['query' => $queryTree, 'isAdmin' => true, 'softDelete' => false, 'displayValue' => 1, 'wrapperTemplate' => '{header}{footer}{tree}', 'headingOptions' => ['label' => 'Nodes'], 'treeOptions' => ['style' => 'height:auto; min-height:400px'], 'headerTemplate' => $headerTemplate, 'mainTemplate' => $mainTemplate]);
Example #18
0
$title = Inflector::titleize($this->context->module->id);
\dmstr\modules\pages\assets\PagesAsset::register($this);
?>

<?php 
/**
 * Output TreeView widget
 */
// Wrapper templates
$headerTemplate = <<<HTML
<div class="row">
    <div class="col-sm-6" id="pages-detail-heading">
        {heading}
    </div>
    <div class="col-sm-6" id="pages-detail-search">
        {search}
    </div>
</div>
HTML;
$mainTemplate = <<<HTML
<div class="row">
    <div class="col-md-4" id="pages-detail-wrapper">
        {wrapper}
    </div>
    <div class="col-md-8" id="pages-detail-panel">
        {detail}
    </div>
</div>
HTML;
echo TreeView::widget(['query' => Tree::find()->addOrderBy('root, lft')->andWhere([Tree::ATTR_ACCESS_DOMAIN => \Yii::$app->language]), 'isAdmin' => true, 'softDelete' => false, 'displayValue' => 1, 'wrapperTemplate' => "{header}{footer}{tree}", 'headingOptions' => ['label' => $title . '-Module'], 'treeOptions' => ['style' => 'height:600px'], 'headerTemplate' => $headerTemplate, 'mainTemplate' => $mainTemplate]);
Example #19
0
 * SECTION 1: Initialize node view params & setup helper methods.
 */
extract($params);
$isAdmin = $isAdmin == true || $isAdmin === "true";
// admin mode flag
$inputOpts = [];
// readonly/disabled input options for node
$flagOptions = ['class' => 'kv-parent-flag'];
// node options for parent/child
// parse parent key
if (empty($parentKey)) {
    $parent = $node->parents(1)->one();
    $parentKey = empty($parent) ? '' : Html::getAttributeValue($parent, $keyAttribute);
}
// get module and setup form
$module = TreeView::module();
// the treemanager module
$formOptions['id'] = 'kv-' . uniqid();
$form = ActiveForm::begin(['action' => $action, 'options' => $formOptions]);
// the primary key input field
if ($showIDAttribute) {
    $options = ['readonly' => true];
    if ($node->isNewRecord) {
        $options['value'] = Yii::t('kvtree', '(new)');
    }
    $keyField = $form->field($node, $keyAttribute)->textInput($options);
} else {
    $keyField = Html::activeHiddenInput($node, $keyAttribute);
}
// initialize for create or update
$depth = ArrayHelper::getValue($breadcrumbs, 'depth');
Example #20
0
<?php

use alexsers\store\Module;
use alexsers\themes\backend\widgets\Box;
use alexsers\themes\backend\widgets\GridView;
use kartik\tree\TreeView;
use alexsers\store\models\StoreCategory;
use kartik\tree\models\Tree;
$this->title = Module::t('store', 'Категории товара');
$this->params['subtitle'] = Module::t('store', 'Список категорий');
$this->params['breadcrumbs'] = [$this->title];
echo TreeView::widget(['query' => StoreCategory::find()->addOrderBy('root, lft'), 'headingOptions' => ['label' => 'Категории'], 'fontAwesome' => false, 'isAdmin' => true, 'displayValue' => 1, 'softDelete' => true, 'cacheSettings' => ['enableCache' => true]]);
/*echo'<pre>';
print_r(Tree::find()->addOrderBy('root, lft'));
echo'</pre>';*/
 /**
  * Renders the markup for the button actions toolbar
  *
  * @return string
  */
 public function renderToolbar()
 {
     if (!$this->showToolbar) {
         return '';
     }
     unset($this->toolbar[self::BTN_CREATE], $this->toolbar[self::BTN_CREATE_ROOT], $this->toolbar[self::BTN_REMOVE]);
     return parent::renderToolbar();
 }
Example #22
0
<?php

use dpodium\filemanager\models\Tree;
use kartik\tree\Module;
// use dpodium\filemanager\models\tree;
use kartik\tree\TreeView;
use yii\helpers\Url;
use yii\bootstrap\Modal;
?>



<?php 
// print_r(Yii::getAlias('@treeview_part2').'files/tree_part2.php');
// die();
echo TreeView::widget(['query' => Tree::find()->addOrderBy('root, lft'), 'nodeAddlViews' => [Module::VIEW_PART_2 => '@treeview_part2/files/tree_part2'], 'headingOptions' => ['label' => 'Categories'], 'headingOptions' => ['label' => 'Categories'], 'rootOptions' => ['label' => '<i class="fa fa-tree"></i>'], 'fontAwesome' => true, 'displayValue' => 1, 'iconEditSettings' => ['show' => 'list', 'listData' => ['folder' => 'Folder', 'file' => 'File', 'mobile' => 'Phone', 'bell' => 'Bell']]]);
?>