Example #1
0
function tree_cols($list = false, $padding = array())
{
    if (!$list) {
        return "";
    }
    $tree = "";
    $count = count($list);
    // var_dump($list);
    foreach ($list as $k => $v) {
        $tree .= '<li data-id="' . $v['cid'] . '" data-sort="' . $v['csort_id'] . '">';
        $tree .= '<span> <input class="select-it" type="checkbox" value="' . $v['cid'] . '" > </span>';
        // $tree.= '<span class="label"> '.$v['cid'].'</span>';
        $tree .= implode('', $padding);
        // 如果当序列是最后一个
        if (!isset($list[$k + 1])) {
            if (is_array($v['more'])) {
                $tree .= ' ';
            } else {
                $tree .= ' <i class="fa fa-circle-o"></i>';
            }
        } else {
            if ($k == 0 and $v['parent_id'] == 0) {
            } else {
                if (is_array($v['more'])) {
                    $tree .= ' ';
                } else {
                    $tree .= ' <i class="fa fa-circle-o"></i>';
                }
            }
        }
        if (intval($v['more'])) {
            $tree .= '<i class="fa fa-chevron-circle-right"></i>';
        } else {
            // $tree.= '<i class="fa fa-ellipsis-h "></i>';
        }
        $tree .= ' <a href="' . GLOBAL_URL . 'index.php' . $v['path'] . '" target="_blank"> <span> ' . $v['ctitle'] . ' </span></a> - <span class="label label-success">' . $v['cid'] . '</span><span class="label" title="' . $v['path'] . '" >' . $v['cidentify'] . '</span>';
        if (ENVIRONMENT == "development") {
            $tree .= '<span class="label label-info">' . $v['temp_index'] . '</span><span class="label">' . $v['temp_show'] . '</span>';
        }
        $tree .= '<div class="btn-group pull-right">';
        if ($v['cshow']) {
            $tree .= '<a href="#" class="btn btn-primary btn-small btn-ajax-show" data-id="' . $v['cid'] . '" data-show="0">  <i class="fa fa-eye"></i></a>';
        } else {
            $tree .= '<a href="#" class="btn btn-small btn-ajax-show" data-id="' . $v['cid'] . '" data-show="1"> <i class="fa fa-eye-slash"></i></a>';
        }
        $tree .= '<a class="btn btn-small" href="' . site_url('columns/edit/' . $v['cid']) . ' " title="' . lang('edit') . '"> <i class="fa fa-pencil"></i> </a>';
        $tree .= '<a class="btn btn-small" href="' . site_url('coltypes/index/') . '?c=' . $v['cid'] . '&field=ctype&rc=' . $v['controller'] . ' " title="分类管理"> <i class="fa fa-magnet "></i> </a>';
        $tree .= '<a class="btn btn-danger btn-small btn-del" href="#" title="' . lang('del') . '" data-id="' . $v['cid'] . '"> <i class="fa fa-times"></i> </a>';
        $tree .= '</div>';
        $tree .= '</li>';
        if (is_array($v['more'])) {
            $p = $padding;
            if (isset($list[$k + 1])) {
                array_push($p, '|&nbsp;&nbsp;&nbsp; ');
            } else {
                array_push($p, '&nbsp;&nbsp;&nbsp; ');
            }
            $tree .= tree_cols($v['more'], $p);
        }
    }
    return $tree;
}
Example #2
0
<div class="btn-group">
	<a href="<?php 
echo site_url('columns/create');
?>
" class='btn btn-primary' > <i class="fa fa-plus"></i> 栏目 </a>
</div>

<p></p>

<div class="boxed">
	<div class="boxed-inner">
		<h3> <i class="fa fa-list"></i> 栏目列表 </h3>
		<input id='selectbox-all' type="checkbox" class="hide" >
		<ul class="boxed-list select-list sort-list">
		<?php 
echo tree_cols($list);
?>
		</ul>
		<div class="clearfix"></div>
	</div>
</div>

<div class="btn-group">
	<a id='select-all' class='btn' href="#"> <i class="fa fa-check-square-o"></i> <?php 
echo lang('select_all');
?>
 </a>
	<a id='unselect-all' class='btn hide' href="#"> <i class="fa fa-square-o"></i> <?php 
echo lang('unselect');
?>
 </a>