2017 © Pedro Peláez
 

yii2-extension yii2-tree-manager

image

yongtiger/yii2-tree-manager

  • Tuesday, December 12, 2017
  • by yongtiger
  • Repository
  • 3 Watchers
  • 2 Stars
  • 56 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 28 Versions
  • 10 % Grown

The README.md

yii2-tree-manager v0.0.27 (FIX# remove out creocoder\nestedsets from TreeTrait class)

Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

, (*2)

FEATURES

  • Sample of extensions directory structure. src, docs, etc.
  • README.md
  • composer.json
  • development-roadmap.md

DEPENDENCES

INSTALLATION

The preferred way to install this extension is through composer., (*3)

Either run, (*4)

php composer.phar require --prefer-dist yongtiger/yii2-tree-manager "*"

or add, (*5)

"yongtiger/yii2-tree-manager": "*"

to the require section of your composer.json., (*6)

CONFIGURATION

USAGES

echo \yongtiger\tree\widgets\TreeView::widget([
    'nodes' => $items,

    ///all the followings are optional
    'options' => [
        'tag' => 'div',         ///set to false to disable the tag
        'class' => 'myclass',
        // more ...
    ],
    'nodesOptions' => [
        'tag' => 'ol',          ///set to false to disable the tag
        'class' => 'myclass',
        // more ...
    ],
    'nodeOptions' => [
        'tag' => 'li',          ///set to false to disable the tag
        'class' => 'myclass',
        // more ...
    ],

    'clientOptions' => [
        'selector' => 'ol.sortable',
        'startCollapsed' => true,
        // more ...
    ],
    'clientEventOptions' => [
        'change' => "function(){ console.log('Relocated item'); }",
        // more ...
    ],

    'nodeActionsOptions' => [
        'tag' => 'span',        ///set to false to disable the tag
        'class' => 'myclass',
        // more ...
    ],
    'nodeActionOptions' => [
        'tag' => 'button',      ///set to false to disable the tag
        // more ...
    ],
    'nodeActions' => [
        'view' => [
            'actionText' => '<span class="glyphicon glyphicon-eye-open"></span>',
            'actionOptions' => [
                'class' => 'btn btn-xs btn-default',
            ],
        ],
        'update' => [
            'actionText' => '<span class="glyphicon glyphicon-pencil"></span>',
            'actionOptions' => [
                'class' => 'btn btn-xs btn-primary',
            ],
        ],
        'create' => [
            'actionText' => '<span class="glyphicon glyphicon-plus"></span>',
            'actionOptions' => [
                'class' => 'btn btn-xs btn-success',
            ],
        ],
        'delete' => [
            'actionText' => '<span class="glyphicon glyphicon-trash"></span>',
            'actionOptions' => [
                'class' => 'btn btn-xs btn-primary',
                'data-confirm' => 'Are you sure you want to delete this item?', ///???i18n
                'data-method' => 'post',
                ///for ajax
                'href' => 'javascript:void(0)',         ///Note: It will override the 'href' of `nodeActionOptions`
                'data-action-url' => '{action-url}',    ///Note: It will be replaced with the URL created using [[createUrl()]]
            ],
        ],
        // more ...
    ],

    'urlCreator' => function ($action, $id, $treeView) {
        // return 'string';
    },
    'controller' => 'category/default',

    'nodeNameTemplate' => '<span class="disclose"><span></span></span>{name}',
    'encodeNodeNames' => true,
]);

NOTES

DOCUMENTS

REFERENCES

Example of TreeView nodes data ($items):

Array(
    [0] => Array(
        [id] => 1
        [name] => node 1

        ///optional, action urls
        [view-url] => Array(
            [0] => category/default/view
            [id] => 1
        )
        [update-url] => Array(
            [0] => category/default/update
            [id] => 1
        )
        [create-url] => Array(
            [0] => category/default/create
            [id] => 1
        )
        [delete-url] => Array(
            [0] => category/default/delete
            [id] => 1
        )

        [nodes] => Array(
            [0] => Array(
                [id] => 2
                [name] => node 1.1
                // optional, action urls ...
            )
            [1] => Array(
                [id] => 3
                [name] => node 1.2
                // optional, action urls ...
            )
            // more nodes ...
        )
    )
    [1] => Array(
        // ...
    )
)

Example of nestedSortable html code:

<ol class="sortable">
    <li id="list_368">
        <div>   <span class="disclose"><span></span></span>Driving Directions</div>
    </li>
    <li id="list_369">
        <div>   <span class="disclose"><span></span></span>Food Menu</div>
        <ol class="sortable">
            <li id="list_373">
                <div>   <span class="disclose"><span></span></span>Meals</div>
            </li>
            <li id="list_374">
                <div>   <span class="disclose"><span></span></span>Pizza & Pasta</div>
            </li>
        </ol>
    </li>
</ol>

jquery-ui version 1.11.4 options:

// appendTo: "parent",
// axis: false,
// connectWith: false,
// containment: false,
// cursor: "auto",
// cursorAt: false,
// dropOnEmpty: true,
forcePlaceholderSize: true,                 ///defaults to false 
// forceHelperSize: false,
// grid: false,
handle: 'div',                              ///defaults to false
helper: 'clone',                            ///defaults to "original"
items: 'li',                                ///defaults to "> *"
opacity: .6,                                ///defaults to false 
placeholder: 'placeholder',                 ///defaults to false 
revert: 250,                                ///defaults to false 
// scroll: true,
// scrollSensitivity: 20,
// scrollSpeed: 20,
// scope: "default",
tolerance: 'pointer',                       ///defaults to "intersect" 
toleranceElement: '> div',                  ///defaults to null 
// zIndex: 1000,

jquery.mjs.nestedSortable.js v 2.0b1 options:

// disableParentChange: false,
// doNotClear: false,
// expandOnHover: 700,
// isAllowed: function() { return true; },
isTree: true,                               ///defaults to false
// listType: "ol",
// maxLevels: 0,
// protectRoot: false,
// rootID: null,
// rtl: false,
// startCollapsed: false,
// tabSize: 20,
// branchClass: "mjs-nestedSortable-branch",
// collapsedClass: "mjs-nestedSortable-collapsed",
// disableNestingClass: "mjs-nestedSortable-no-nesting",
// errorClass: "mjs-nestedSortable-error",
// expandedClass: "mjs-nestedSortable-expanded",
// hoveringClass: "mjs-nestedSortable-hovering",
// leafClass: "mjs-nestedSortable-leaf",
// disabledClass: "mjs-nestedSortable-disabled",

SEE ALSO

  • https://github.com/ilikenwf/nestedSortable
  • http://jsfiddle.net/vq9dD/2/

TBD

Development roadmap

LICENSE

yii2-tree-manager is released under the MIT license, see LICENSE file for details., (*7)

The Versions

12/12 2017

dev-master

9999999-dev http://www.branbook.cc

  Sources   Download

MIT

The Requires

 

extension yii2 manager tree nested nested sets adjacency list materialized path nested intervals flat table

23/04 2017

v0.0.26

0.0.26.0 http://www.branbook.cc

  Sources   Download

MIT

The Requires

 

extension yii2 manager tree nested sets adjacency list materialized path nested intervals flat table

23/04 2017

v0.0.25

0.0.25.0 http://www.branbook.cc

  Sources   Download

MIT

The Requires

 

extension yii2 manager tree nested sets adjacency list materialized path nested intervals flat table

23/04 2017

v0.0.24

0.0.24.0 http://www.branbook.cc

  Sources   Download

MIT

The Requires

 

extension yii2 manager tree nested sets adjacency list materialized path nested intervals flat table

23/04 2017

v0.0.23

0.0.23.0 http://www.branbook.cc

  Sources   Download

MIT

The Requires

 

extension yii2 manager tree nested sets adjacency list materialized path nested intervals flat table

23/04 2017

v0.0.22

0.0.22.0 http://www.branbook.cc

  Sources   Download

MIT

The Requires

 

extension yii2 manager tree nested sets adjacency list materialized path nested intervals flat table

23/04 2017

v0.0.21

0.0.21.0 http://www.branbook.cc

  Sources   Download

MIT

The Requires

 

extension yii2 manager tree nested sets adjacency list materialized path nested intervals flat table

23/04 2017

v0.0.20

0.0.20.0 http://www.branbook.cc

  Sources   Download

MIT

The Requires

 

extension yii2 manager tree nested sets adjacency list materialized path nested intervals flat table

22/04 2017

v0.0.19

0.0.19.0 http://www.branbook.cc

  Sources   Download

MIT

The Requires

 

extension yii2 manager tree nested sets adjacency list materialized path nested intervals flat table

22/04 2017

v0.0.18

0.0.18.0 http://www.branbook.cc

  Sources   Download

MIT

The Requires

 

extension yii2 manager tree nested sets adjacency list materialized path nested intervals flat table

22/04 2017

v0.0.17

0.0.17.0 http://www.branbook.cc

  Sources   Download

MIT

The Requires

 

extension yii2 manager tree nested sets adjacency list materialized path nested intervals flat table

21/04 2017

v0.0.16

0.0.16.0 http://www.branbook.cc

  Sources   Download

MIT

The Requires

 

extension yii2 manager tree nested sets adjacency list materialized path nested intervals flat table

20/04 2017

v0.0.15

0.0.15.0 http://www.branbook.cc

  Sources   Download

MIT

The Requires

 

extension yii2 manager tree nested sets adjacency list materialized path nested intervals flat table

20/04 2017

v0.0.14

0.0.14.0 http://www.branbook.cc

  Sources   Download

MIT

The Requires

 

extension yii2 manager tree nested sets adjacency list materialized path nested intervals flat table

19/04 2017

v0.0.13

0.0.13.0 http://www.branbook.cc

  Sources   Download

MIT

The Requires

 

extension yii2 manager tree nested sets adjacency list materialized path nested intervals flat table

19/04 2017

v0.0.12

0.0.12.0 http://www.branbook.cc

  Sources   Download

MIT

The Requires

 

extension yii2 manager tree nested sets adjacency list materialized path nested intervals flat table

19/04 2017

v0.0.11

0.0.11.0 http://www.branbook.cc

  Sources   Download

MIT

The Requires

 

extension yii2 manager tree nested sets adjacency list materialized path nested intervals flat table

19/04 2017

v0.0.10

0.0.10.0 http://www.branbook.cc

  Sources   Download

MIT

The Requires

 

extension yii2 manager tree nested sets adjacency list materialized path nested intervals flat table

19/04 2017

v0.0.9

0.0.9.0 http://www.branbook.cc

  Sources   Download

MIT

The Requires

 

extension yii2 manager tree nested sets adjacency list materialized path nested intervals flat table

19/04 2017

v0.0.8

0.0.8.0 http://www.branbook.cc

  Sources   Download

MIT

The Requires

 

extension yii2 manager tree nested sets adjacency list materialized path nested intervals flat table

19/04 2017

v0.0.7

0.0.7.0 http://www.branbook.cc

  Sources   Download

MIT

The Requires

 

extension yii2 manager tree nested sets adjacency list materialized path nested intervals flat table

19/04 2017

v0.0.6

0.0.6.0 http://www.branbook.cc

  Sources   Download

MIT

The Requires

 

extension yii2 manager tree nested sets adjacency list materialized path nested intervals flat table

19/04 2017

v0.0.5

0.0.5.0 http://www.branbook.cc

  Sources   Download

MIT

The Requires

 

extension yii2 manager tree nested sets adjacency list materialized path nested intervals flat table

19/04 2017

v0.0.4

0.0.4.0 http://www.branbook.cc

  Sources   Download

MIT

The Requires

 

extension yii2 manager tree nested sets adjacency list materialized path nested intervals flat table

19/04 2017

v0.0.3

0.0.3.0 http://www.branbook.cc

  Sources   Download

MIT

The Requires

 

extension yii2 manager tree nested sets adjacency list materialized path nested intervals flat table

16/04 2017

v0.0.2

0.0.2.0 http://www.branbook.cc

  Sources   Download

MIT

The Requires

 

extension yii2 manager tree nested sets adjacency list materialized path nested intervals flat table

15/04 2017

v0.0.1

0.0.1.0 http://www.branbook.cc

  Sources   Download

MIT

The Requires

 

extension yii2 manager tree nested nested sets adjacency list materialized path nested intervals flat table

14/04 2017

v0.0.0

0.0.0.0 http://www.branbook.cc

  Sources   Download

MIT

The Requires

 

extension yii2 manager tree nested nested sets adjacency list materialized path nested intervals flat table