미채택 완료

추천인 조직도 관리자일대 전체 추천인조직도 보이게 할려면 어떻게 수정해야 합니까?

추천인 조직도 관리자일대 전체 추천인조직도 보이게 할려면 어떻게 수정해야 합니까?


<?
include_once("./_common.php");
include_once("./_head.php");
if (!$member[mb_id]) { 
alert("회원만 볼 수 있습니다.");
}else{
?>
<style type="text/css">

.small {font-family:'Nanum Gothic';font-size:12px;}
.Rnum { font-family:'Nanum Gothic';font-size:12px;color:coral;font-weight:bold; }

.tttyyy th {
    white-space: nowrap;
    clear: both;
    height: 43px;
    background: url(../img/head.gif) repeat-x !important;
    font-weight: bold;
    font-size: 12px;
    color: #333;
    border: 0px !important;
    padding: 0px !important;
    margin: 0px !important;
    text-align: center;
}
.table>tbody>tr>td{
    padding: 8px;
    line-height: 1.42857143;
    vertical-align: top;
    border-top: 0px solid #ddd;
}
</style>
<?
echo "<div class='table-responsive'>";
echo "<a href='$g5[path]/bbs/member_group.php'><b>나이 추천 회원 리스트</b></a>";
if ($mbrecommend) {
$profileRc = get_member("$mbrecommend");
echo "<p><i class=\"fa fa-arrow-circle-right\"></i><b>$profileRc[mb_name]</b>($profileRc[mb_nick], $profileRc[mb_id])님의 하위그룹입니다.</p>";
}
echo "<p>※ <span class='Rnum'>(추천회원숫자)</span>를 클릭하면 하위그룹으로 이동합니다.";
echo "<table width=100% class='table div-table list-pc bg-white tttyyy'>";
echo "<colgroup><colgroup><colgroup><colgroup><colgroup><colgroup width=50>";
echo "<tr align=center height='50px'>
        <th width='small'>NO
        <th class='small'>아이디
        <th class='small'>닉네임
        <th class='small'>전화/이메일
        <th class='small'>마지막로그인/가입일";
echo " <th class='small'>추천인";
if ($mbrecommend == "") { $memberid = $member[mb_id]; } else { $memberid = $mbrecommend; }
$sql = " select mb_id, mb_name, mb_email, mb_homepage, mb_open, mb_recommend from $g5[member_table] where mb_recommend = '$memberid' and mb_level >= '2' order by mb_datetime desc ";
$result = sql_query($sql);
if(@sql_num_rows($result)>0) {
for ($i=0,$j=1; $row=sql_fetch_array($result); $i++,$j++) {
$tmp_id = $row[mb_id];
$profile = get_member("$tmp_id");
$sqlRnum = "select count(*) as Rnum from $g5[member_table] where mb_recommend = '$tmp_id' and mb_level >= '2'";
$rowRnum = sql_fetch($sqlRnum);
echo "<tr align=center style='border-bottom: 1px solid #ddd;'>";
echo "<td class='small'>$j";
echo "<td class='small'>$profile[mb_id]";
echo "<td><b>$profile[mb_nick]";
echo "<td class='small'>";
if ($profile[mb_hp]) { echo "$profile[mb_hp]"; }
if ($profile[mb_tel]) { echo "<br />$profile[mb_tel]"; }
if ($profile[mb_email]) { echo "<br />$profile[mb_email]"; }

echo "<td class='small'>$profile[mb_today_login]<br />$profile[mb_datetime]";

echo "<td><a href='$g5[path]/bbs/member_group.php?mbrecommend=$profile[mb_id]'><span class='Rnum'>($rowRnum[Rnum])</span></a>";
} }
echo "</table>";
echo "</div>";
}
include_once("./_tail.php");
;?>
|

답변 2개

function print_recommend_tree($mb_id, $depth=0) {
    global $g5;
    $sql = "SELECT mb_id, mb_name, mb_nick, mb_email, mb_hp, mb_tel, mb_today_login, mb_datetime 
            FROM {$g5['member_table']} 
            WHERE mb_recommend = '{$mb_id}' AND mb_level >= '2' 
            ORDER BY mb_datetime DESC";
    $result = sql_query($sql);
    while ($row = sql_fetch_array($result)) {
        echo str_repeat("&nbsp;", $depth*4) . "- {$row['mb_id']} ({$row['mb_nick']})<br>";
        print_recommend_tree($row['mb_id'], $depth+1);
    }
}

print_recommend_tree('admin_id'); 이런게 호출을해보세요
위소스를 수정 해서 는 어렵네요
위소스는 어떤 아이디를 기준으로 검색하라는 것인데
회원 간의 연결 코드가 필요해보이네요

에를 들자면
디비를 트리구조로 만들어야 조직도를 볼수있을거같씁니다
한 21 자리정도면 될꺼라 생각 되네요
머 그이상의 조직 이라면 브라우저에 나오기 힘들테고

단순하게 표현만 하자면
 처음 커리문을 의 아이디 조건을 버리고 모든 회원을 검색 하라고 해서 
표현 하면 될듯한데  그러면 조직도라고보기어렵고 짝꿍표 정도 생각되네요.. 

답변을 작성하려면 로그인이 필요합니다.