コード例 #1
0
 /**
  * [Rule 菜单管理开始]
  * ======================================================================
  */
 public function Rule()
 {
     if (IS_POST) {
         $table_Rules = M("AuthRule");
         $table_Rules = $table_Rules->field("id,title,name,sort,display,cls,rule_id")->order("sort asc")->select();
         $this->ajaxReturn(treeRule($table_Rules));
         exit;
     }
     $this->display();
 }
コード例 #2
0
ファイル: function.php プロジェクト: wangscript/oa-2
function treeRule($data, $rule_id = '0')
{
    $tree = array();
    foreach ($data as $v) {
        if ($v['rule_id'] == $rule_id) {
            $v['children'] = treeRule($data, $v['id']);
            $tree[] = $v;
        }
    }
    return $tree;
}