if ($ISCAT) { ?> <br> <link href="<?php echo $g['s']; ?> /_core/css/tree.css" rel="stylesheet"> <?php $_treeOptions = array('site' => $s, 'table' => $table['s_menu'], 'dispNum' => true, 'dispHidden' => false, 'dispCheckbox' => false, 'allOpen' => false); ?> <?php $_treeOptions['link'] = $g['s'] . '/?r=' . $r . '&iframe=' . $iframe . '&system=' . $system . '&type=' . $type . '&cat='; ?> <?php echo getTreeMenu($_treeOptions, $cat, $code, 0, 0, ''); ?> <?php } else { ?> <div class="none">등록된 메뉴가 없습니다.</div> <?php } ?> <?php if ($CINFO['isson'] || !$cat && $ISCAT) {
$wdgvar['sid'] .= $wdgvar['mnarr'][$j] . '/'; } $wdgvar['sid'] = $wdgvar['sid'] ? substr($wdgvar['sid'], 0, strlen($wdgvar['sid']) - 1) : ''; $wdgvar['path'] = getDbData($table['s_menu'], "id='" . $wdgvar['mnarr'][$wdgvar['count']] . "'", 'uid,depth'); $wdgvar['smenu'] = $wdgvar['path']['uid']; $wdgvar['depth'] = $wdgvar['path']['depth']; } else { $wdgvar['smenu'] = $_HM['uid']; $wdgvar['depth'] = $_HM['depth']; $wdgvar['sid'] = $_HM['id']; } } else { if ($wdgvar['smenu']) { $wdgvar['mnarr'] = explode('/', $wdgvar['smenu']); $wdgvar['count'] = count($wdgvar['mnarr']); for ($j = 0; $j < $wdgvar['count']; $j++) { $wdgvar['path'] = getDbData($table['s_menu'], 'uid=' . (int) $wdgvar['mnarr'][$j], 'uid,id,depth'); $wdgvar['sid'] .= $wdgvar['path']['id'] . '/'; $wdgvar['smenu'] = $wdgvar['path']['uid']; $wdgvar['depth'] = $wdgvar['path']['depth']; } $wdgvar['sid'] = $wdgvar['sid'] ? substr($wdgvar['sid'], 0, strlen($wdgvar['sid']) - 1) : ''; } else { $wdgvar['smenu'] = 0; $wdgvar['depth'] = 0; $wdgvar['sid'] = ''; } } $_treeOptions = array('site' => $s, 'table' => $table['s_menu'], 'dispNum' => true, 'dispHidden' => true, 'hideIcon' => true, 'userMenu' => $wdgvar['link'], 'allOpen' => $wdgvar['menuopen'], 'mobile' => $wdgvar['mobile'], 'ctype' => 'id'); echo getTreeMenu($_treeOptions, $c, $wdgvar['depth'], $wdgvar['smenu'], $wdgvar['sid']);
function getTreeMenu($conf, $code, $depth, $parent, $tmpcode) { $ctype = $conf['ctype'] ? $conf['ctype'] : 'uid'; $id = 'tree_' . filterstr(microtime()); $tree = '<div class="rb-tree"><ul id="' . $id . '">'; $CD = getDbSelect($conf['table'], ($conf['site'] ? 'site=' . $conf['site'] . ' and ' : '') . 'depth=' . ($depth + 1) . ' and parent=' . $parent . ($conf['dispHidden'] ? ' and hidden=0' : '') . ($conf['mobile'] ? ' and mobile=1' : '') . ' order by gid asc', '*'); $_i = 0; while ($C = db_fetch_array($CD)) { $rcode = $tmpcode ? $tmpcode . '/' . $C[$ctype] : $C[$ctype]; $t_arr = explode('/', $code); $t1_arr = explode('/', $rcode); $topen = in_array($t1_arr[count($t1_arr) - 1], $t_arr) ? true : false; $tree .= '<li>'; if ($C['is_child']) { $tree .= '<a data-toggle="collapse" href="#' . $id . '-' . $_i . '-' . $C['uid'] . '" class="rb-branch' . ($conf['allOpen'] || $topen ? '' : ' collapsed') . '"></a>'; if ($conf['userMenu'] == 'link') { $tree .= '<a href="' . RW('c=' . $rcode) . '"><span' . ($code == $rcode ? ' class="rb-active"' : '') . '>'; } else { if ($conf['userMenu'] == 'bookmark') { $tree .= '<a data-scroll href="#rb-tree-menu-' . $C['id'] . '"><span' . ($code == $rcode ? ' class="rb-active"' : '') . '>'; } else { $tree .= '<a href="' . $conf['link'] . $C['uid'] . '&code=' . $rcode . ($conf['bookmark'] ? '#' . $conf['bookmark'] : '') . '"><span' . ($code == $rcode ? ' class="rb-active"' : '') . '>'; } } if ($conf['dispCheckbox']) { $tree .= '<input type="checkbox" name="tree_members[]" value="' . $C['uid'] . '">'; } if ($C['hidden']) { $tree .= '<u title="' . _LANG('fs002', 'admin') . '" data-tooltip="tooltip">'; } $tree .= $C['name']; if ($C['hidden']) { $tree .= '</span>'; } $tree .= '</u></a>'; if ($conf['dispNum'] && $C['num']) { $tree .= ' <small>(' . $C['num'] . ')</small>'; } if (!$conf['hideIcon']) { //if($C['mobile']) $tree.= '<i class="glyphicon glyphicon-phone" title="'._LANG('fs005','admin').'" data-tooltip="tooltip"></i> '; if ($C['target']) { $tree .= '<i class="glyphicon glyphicon-new-window" title="' . _LANG('fs004', 'admin') . '" data-tooltip="tooltip"></i> '; } if ($C['reject']) { $tree .= '<i class="glyphicon glyphicon-ban-circle" title="' . _LANG('fs003', 'admin') . '" data-tooltip="tooltip"></i>'; } } $tree .= '<ul id="' . $id . '-' . $_i . '-' . $C['uid'] . '" class="collapse' . ($conf['allOpen'] || $topen ? ' in' : '') . '">'; $tree .= getTreeMenu($conf, $code, $C['depth'], $C['uid'], $rcode); $tree .= '</ul>'; } else { $tree .= '<a href="#." class="rb-leaf"></a>'; if ($conf['userMenu'] == 'link') { $tree .= '<a href="' . RW('c=' . $rcode) . '"><span' . ($code == $rcode ? ' class="rb-active"' : '') . '>'; } else { if ($conf['userMenu'] == 'bookmark') { $tree .= '<a data-scroll href="#rb-tree-menu' . $C['id'] . '"><span' . ($code == $rcode ? ' class="rb-active"' : '') . '>'; } else { $tree .= '<a href="' . $conf['link'] . $C['uid'] . '&code=' . $rcode . ($conf['bookmark'] ? '#' . $conf['bookmark'] : '') . '"><span' . ($code == $rcode ? ' class="rb-active"' : '') . '>'; } } if ($conf['dispCheckbox']) { $tree .= '<input type="checkbox" name="tree_members[]" value="' . $C['uid'] . '">'; } if ($C['hidden']) { $tree .= '<u title="' . _LANG('fs002', 'admin') . '" data-tooltip="tooltip">'; } $tree .= $C['name']; if ($C['hidden']) { $tree .= '</u>'; } $tree .= '</span></a>'; if ($conf['dispNum'] && $C['num']) { $tree .= ' <small>(' . $C['num'] . ')</small>'; } if (!$conf['hideIcon']) { //if($C['mobile']) $tree.= '<i class="glyphicon glyphicon-phone" title="'._LANG('fs005','admin').'" data-tooltip="tooltip"></i> '; if ($C['target']) { $tree .= '<i class="glyphicon glyphicon-new-window" title="' . _LANG('fs004', 'admin') . '" data-tooltip="tooltip"></i> '; } if ($C['reject']) { $tree .= '<i class="glyphicon glyphicon-ban-circle" title="' . _LANG('fs003', 'admin') . '" data-tooltip="tooltip"></i>'; } } } $tree .= '</li>'; $_i++; } $tree .= '</ul></div>'; return $tree; }
function getTreeMenu($conf, $cat, $code, $depth, $parent, $tmpcode) { $id = 'tree_' . filterstr(microtime()); $tree = '<div class="rb-tree"><ul id="' . $id . '">'; $CD = getDbSelect($conf['table'], ($conf['site'] ? 'site=' . $conf['site'] . ' and ' : '') . 'depth=' . ($depth + 1) . ' and parent=' . $parent . ($conf['dispHidden'] ? ' and hidden=0' : '') . ' order by gid asc', '*'); $_i = 0; while ($C = db_fetch_array($CD)) { $rcode = $tmpcode ? $tmpcode . '/' . $C['uid'] : $C['uid']; $topen = $rcode == substr($code, 0, strlen($rcode)) ? true : false; $tree .= '<li>'; if ($C['isson']) { $tree .= '<a data-toggle="collapse" href="#' . $id . '-' . $_i . '-' . $C['uid'] . '" class="rb-branch' . ($conf['allOpen'] || $topen ? '' : ' collapsed') . '"></a>'; $tree .= '<a href="' . $conf['link'] . $C['uid'] . '&code=' . $rcode . ($conf['bookmark'] ? '#' . $conf['bookmark'] : '') . '"><span' . ($code == $rcode ? ' class="rb-active"' : '') . '>'; if ($conf['dispCheckbox']) { $tree .= '<input type="checkbox" name="tree_members[]" value="' . $C['uid'] . '">'; } $tree .= $C['name'] . '</span></a>'; if ($conf['dispNum'] && $C['num']) { $tree .= ' <small>(' . $C['num'] . ')</small>'; } if ($C['mobile']) { $tree .= '<i class="glyphicon glyphicon-phone" title="모바일"></i>'; } if ($C['hidden']) { $tree .= '<i class="glyphicon glyphicon-eye-close" title="숨김"></i>'; } if ($C['reject']) { $tree .= '<i class="glyphicon glyphicon-ban-circle" title="차단"></i>'; } $tree .= '<ul id="' . $id . '-' . $_i . '-' . $C['uid'] . '" class="collapse' . ($conf['allOpen'] || $topen ? ' in' : '') . '">'; $tree .= getTreeMenu($conf, $cat, $code, $C['depth'], $C['uid'], $rcode); $tree .= '</ul>'; } else { $tree .= '<a href="#." class="rb-leaf"></a>'; $tree .= '<a href="' . $conf['link'] . $C['uid'] . '&code=' . $rcode . ($conf['bookmark'] ? '#' . $conf['bookmark'] : '') . '"><span' . ($code == $rcode ? ' class="rb-active"' : '') . '>'; if ($conf['dispCheckbox']) { $tree .= '<input type="checkbox" name="tree_members[]" value="' . $C['uid'] . '">'; } $tree .= $C['name'] . '</span></a>'; if ($conf['dispNum'] && $C['num']) { $tree .= ' <small>(' . $C['num'] . ')</small>'; } if ($C['mobile']) { $tree .= '<i class="glyphicon glyphicon-phone" title="모바일"></i>'; } if ($C['hidden']) { $tree .= '<i class="glyphicon glyphicon-eye-close" title="숨김"></i>'; } if ($C['reject']) { $tree .= '<i class="glyphicon glyphicon-ban-circle" title="차단"></i>'; } } $tree .= '</li>'; $_i++; } $tree .= '</ul></div>'; return $tree; }