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

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


<?
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개

중간에 수정과정을 많이 거친것으로 보이는데 AI 에게 다시 처음부터 제작 요청하세요.
구문오류및 잘못된 부분이 너무 많네요.
===;;;?
일단 <a href='$g5[path]/bbs/ 이렇게 처리한부분을<a href='".G5_BBS_URL."/ 다바꾸세요
그리고 <?php 넣어주세요 또 마직막 닫기 처리 부분 ?>
하지만
한 단계 하위 추천인”만 보이는 구조라서, 관리자일 때 전체 조직도를 한 번에 펼쳐서 보려면 추가 로직이 필요합니다.
관리자용 전체 출력 함수를 추가하는 방식으로 가야 합니다.
다음 재귀 함수를 활용해 보시 기 바랍니다.
function print_recommend_tree($memberid, $depth = 0) {
    global $g5;
    $sql = "SELECT mb_id, mb_name, mb_nick, mb_email 
            FROM {$g5['member_table']} 
            WHERE mb_recommend = '{$memberid}' AND mb_level >= '2'";
    $result = sql_query($sql);

    while ($row = sql_fetch_array($result)) {
        echo str_repeat("&nbsp;&nbsp;", $depth * 4);
        echo "- {$row['mb_id']} ({$row['mb_nick']})<br>";
        print_recommend_tree($row['mb_id'], $depth + 1);
    }
}
if ($member['mb_level'] >= 10) { // 관리자 레벨 
    echo "<h3>전체 추천인 조직도</h3>";
    print_recommend_tree($member['mb_id']);
}

 

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