first
This commit is contained in:
74
_core/function/menu.func.php
Normal file
74
_core/function/menu.func.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
//메뉴출력
|
||||
function getMenuShow($site,$table,$j,$parent,$depth,$uid,$CXA,$hidden)
|
||||
{
|
||||
global $cat,$g;
|
||||
global $MenuOpen,$numhidden,$checkbox,$headfoot;
|
||||
static $j;
|
||||
|
||||
$CD=getDbSelect($table,($site?'site='.$site.' and ':'').'depth='.($depth+1).' and parent='.$parent.($hidden ? ' and hidden=0':'').' order by gid asc','*');
|
||||
while($C=db_fetch_array($CD))
|
||||
{
|
||||
$j++;
|
||||
if(@in_array($C['uid'],$CXA)) $MenuOpen .= 'trees[0].tmB('.$j.');';
|
||||
$numprintx = !$numhidden && $C['num'] ? '<span class="num">('.$C['num'].')</span>' : '';
|
||||
$C['name'] = $headfoot && ($C['imghead']||$C['imgfoot']||$C['codhead']||$C['codfoot']) ? '<b>'.$C['name'].'<b>' : $C['name'];
|
||||
$name = $C['uid'] != $cat ? addslashes($C['name']): '<span class="on">'.addslashes($C['name']).'</span>';
|
||||
$name = '<span class="ticon tdepth'.$C['depth'].'"></span><span class="name'.($C['hidden']||$C['reject']?' hidden':'').' ndepth'.$C['depth'].'">'.$name.'</span>';
|
||||
|
||||
if($checkbox) $icon1 = '<input type="checkbox" name="members[]" value="'.$C['uid'].'" />';
|
||||
$icon2 = $C['mobile'] ? ' <img src="'.$g['img_core'].'/_public/ico_mobile.gif" class="mobile" alt="" />' : '';
|
||||
$icon3 = $C['reject'] ? ' <img src="'.$g['img_core'].'/_public/ico_hidden.gif" alt="" />' : '';
|
||||
|
||||
if ($C['is_child'])
|
||||
{
|
||||
echo "['".$icon1.$name.$icon2.$numprintx."','".$C['uid']."',";
|
||||
getMenuShow($site,$table,$j,$C['uid'],$C['depth'],$uid,$CXA,$hidden);
|
||||
echo "],\n";
|
||||
}
|
||||
else {
|
||||
echo "['".$icon1.$name.$icon2.$icon3.$numprintx."','".$C['uid']."',''],\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//메뉴코드->경로
|
||||
function getMenuCodeToPath($table,$cat,$j)
|
||||
{
|
||||
global $DB_CONNECT;
|
||||
static $arr;
|
||||
|
||||
$R=getUidData($table,$cat);
|
||||
if($R['parent'])
|
||||
{
|
||||
$arr[$j]['uid'] = $R['uid'];
|
||||
$arr[$j]['id'] = $R['id'];
|
||||
$arr[$j]['name']= $R['name'];
|
||||
getMenuCodeToPath($table,$R['parent'],$j+1);
|
||||
}
|
||||
else {
|
||||
$C=getUidData($table,$cat);
|
||||
$arr[$j]['uid'] = $C['uid'];
|
||||
$arr[$j]['id'] = $C['id'];
|
||||
$arr[$j]['name']= $C['name'];
|
||||
}
|
||||
sort($arr);
|
||||
reset($arr);
|
||||
return $arr;
|
||||
}
|
||||
//메뉴코드->SQL
|
||||
function getMenuCodeToSql($table,$cat,$f)
|
||||
{
|
||||
static $sql;
|
||||
|
||||
$R=getUidData($table,$cat);
|
||||
if ($R['uid']) $sql .= $f.'='.$R['uid'].' or ';
|
||||
if ($R['is_child'])
|
||||
{
|
||||
$RDATA=getDbSelect($table,'parent='.$R['uid'],'uid');
|
||||
while($C=db_fetch_array($RDATA)) getMenuCodeToSql($table,$C['uid'],$f);
|
||||
}
|
||||
return substr($sql,0,strlen($sql)-4);
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user