Exemplo n.º 1
0
								                    	} 
								                    }
								                    if(more && more.dnd && (operation === 'move_node' || operation === 'copy_node') && (node_parent.id === '#' || node_parent.parents.length != 1 || isset_children === 'false' )) {
													    return false;
													}
													return true;
									            },
									            "data" : [
										        	<?php 
foreach ($v_f_pers as $v_f_per) {
    echo '{"id" : "v_f_per_' . $v_f_per['tn'] . '", "icon" : "glyphicon glyphicon-user", "parent" : "#", "text" : "' . $v_f_per['fio'] . '", "li_attr" : { "data-panel" : "v_f_pers", "data-id" : "' . $v_f_per['tn'] . '" }},';
    $inner_list = \app\models\Permissions::find()->where(['SUBJECT_TYPE' => 2, 'SUBJECT_ID' => $v_f_per['tn'], 'DEL_TRACT_ID' => 0])->orderBy('PERM_TYPE')->all();
    if ($inner_list) {
        foreach ($inner_list as $li) {
            if ($li->PERM_TYPE == 1) {
                $result_li = \app\models\Actions::findOne($li->ACTION_ID);
                echo '{"id" : "' . $li->ID . '", "icon" : "glyphicon glyphicon-cog", "parent" : "v_f_per_' . $v_f_per['tn'] . '", "text" : "' . $result_li->ACTION_DESC . '", "li_attr" : { "data-id" : "' . $li->ID . '", "data-perm-level" : "' . $li->PERM_LEVEL . '", "class" : "inner-node-state"}},';
            } elseif ($li->PERM_TYPE == 2) {
                $result_li = \app\models\States::findOne($li->ACTION_ID);
                echo '{"id" : "' . $li->ID . '", "icon" : "glyphicon glyphicon-check", "parent" : "v_f_per_' . $v_f_per['tn'] . '", "text" : "' . $result_li->STATE_NAME . '", "li_attr" : { "data-id" : "' . $li->ID . '", "data-perm-level" : "' . $li->PERM_LEVEL . '", "class" : "inner-node-state"}},';
            }
        }
    }
}
?>
										        ],
									        },
										}).on("copy_node.jstree", function (e, data) {
										  	//store in database
										  	var parent_id = $('#jstree-v_f_pers').jstree(true).get_node(data.node.parents[0]).li_attr['data-id'];
										  	var parent_type = $('#jstree-v_f_pers').jstree(true).get_node(data.node.parents[0]).li_attr['data-panel'];