Example #1
0
function get_menu_list($fatherid = 0, $selid = 0, $layer = 0, $ac, $fileurl, $homemana)
{
    global $db;
    $sql = "SELECT * FROM " . DB_TABLEPRE . "menu where fatherid='{$fatherid}' and menutype!='1' ORDER BY menunum Asc";
    $query = $db->query($sql);
    echo '<tbody id="group_' . trim($fatherid) . '">';
    if (count($query) > 0) {
        while ($row = $db->fetch_array($query)) {
            $rsfno = $db->fetch_one_array("SELECT * FROM " . DB_TABLEPRE . "menu where fatherid='" . $row[menuid] . "' ORDER BY menunum asc");
            global $_USER;
            $rsuser = $db->fetch_one_array("SELECT uid FROM " . DB_TABLEPRE . "user_view where  uid='" . $_USER->id . "' and homemana like '%" . $row[menuid] . ",%' limit 0,1");
            echo '<tr class="hover">';
            echo '<td class="td25"></td>';
            echo '<td class="td25">';
            if ($row['menutype'] == 2) {
                echo '<input type="checkbox" name="id[]" value="' . trim($row[menuid]) . '" style="border:0px;" ';
                if (trim($rsuser['uid']) != '') {
                    echo 'checked="checked"';
                }
                echo '/>';
            }
            echo '</td>';
            echo '<td><div class="board">' . trim($row[menuname]) . '</div></td></tr>';
            if ($rsfno[menuid] != '') {
                get_menu_list_view($row['menuid'], $selid, $layer + 1, $ac, $fileurl, $homemana);
            }
        }
    }
    echo '</tbody>';
    return;
}
Example #2
0
function get_menu_list($fatherid = 0, $selid = 0, $layer = 0, $ac, $fileurl)
{
    global $db;
    $sql = "SELECT * FROM " . DB_TABLEPRE . "menu where fatherid='{$fatherid}' ORDER BY menunum Asc";
    $query = $db->query($sql);
    echo '<tbody id="group_' . trim($fatherid) . '">';
    if (count($query) > 0) {
        while ($row = $db->fetch_array($query)) {
            $rsfno = $db->fetch_one_array("SELECT * FROM " . DB_TABLEPRE . "menu where fatherid='" . $row[menuid] . "' ORDER BY menunum asc limit 0,1");
            echo '<tr class="hover">';
            echo '<td class="td25"></td>';
            echo '<td class="td25"><input type="hidden" name="id[]" value="' . trim($row[menuid]) . '" /><input type="text" class="txt" name="';
            echo 'menunum[' . trim($row[menuid]) . ']" value="' . trim($row[menunum]) . '" /></td>';
            echo '<td><div class="board"><input type="text" name="menuname[' . trim($row[menuid]) . ']"';
            echo ' value="' . trim($row[menuname]) . '" class="txt" /><input type="text" name="menuurl[' . trim($row[menuid]) . ']" value="' . trim($row[menuurl]) . '" class="txt" style="width:260px;" ';
            if (COOKSHOW == 1) {
                echo ' readonly';
            }
            echo '/>';
            echo '<a href="###" onclick="addrowdirect = 1;addrow(this, 2, 2)" ';
            echo 'class="addchildboard">添加子菜单</a></div></td>';
            echo '<td class="td25 lightfont">(' . trim($row[menuid]) . ')</td>';
            echo '<td class="td23"><select name="menutype[' . trim($row[menuid]) . ']">';
            echo '<option value="0" ';
            if ($row[menutype] == '0') {
                echo ' selected="selected"';
            }
            echo '>正常</option>';
            echo '<option value="2" ';
            if ($row[menutype] == '2') {
                echo ' selected="selected"';
            }
            echo '>桌面</option>';
            echo '<option value="1" ';
            if ($row[menutype] == '1') {
                echo ' selected="selected"';
            }
            echo '>隐藏</option>';
            echo '</select></td>';
            echo '<td width="160">';
            if (COOKSHOW == 1) {
                echo ' 不可删除';
            } else {
                echo '<a href="admin.php?ac=' . $ac . '&fileurl=' . $fileurl . '&do=update&id=' . trim($row[menuid]) . '" class="act">删除</a>';
            }
            echo '</td></tr>';
            if ($rsfno[menuid] != '') {
                get_menu_list_view($row['menuid'], $selid, $layer + 1, $ac, $fileurl);
            }
        }
    }
    echo '</tbody>';
    return;
}