DISCUZ 管理后台页面开发实例


            $result = DB::query("SELECT grouptitle,groupid,system FROM ".DB::table('common_usergroup')." WHERE type='special' AND groupid>'19' ORDER BY groupid");
            while($group = DB::fetch($result)){
                list($group['dailyprice'], $group['minspan']) = explode("\t", $group['system']);
                $newgroup = array(
                    $group['grouptitle'],
                    $group['groupid'],
                    $group['dailyprice'],
                    $group['minspan'],
                    "编辑"    
                );
                showtablerow('', array('width="150"','width="150"','width="150"','width="150"'), $newgroup);
            }
        
            showtablefooter();//表格结束
            showformfooter();//表单结束 
        }else{      
            $groupid = $_G['gp_groupid'];
            $grouptitle = $_G['gp_grouptitle'];
            $group = DB::fetch_first("SELECT * FROM ".DB::table('common_usergroup_field')." WHERE groupid=$groupid");
            showsubmenu("编辑用户组-{$grouptitle}(groupid:{$groupid})",array());


            showformheader("job&operation=group","","groupsetting");
            echo "";
            showtableheader();
            showsetting('开启个人求职模块', 'settingnew[allowjobperson]', $group['allowjobperson'], 'radio');
            showsetting('开启招聘管理模块', 'settingnew[allowjobcompany]', $group['allowjobcompany'], 'radio');
            showsetting('设为基本用户组(成功注册会员将可进行选择)','settingnew[allowjobbasic]',$group['allowjobbasic'],'radio');
            showsubmit('settingsubmit');
            showtablefooter();
            showformfooter();        
        }
    }else{//有表单提交
        
        $group = $_G['gp_settingnew'];
        $groupid = $_G['gp_groupid'];
        $newdata = array(
            "allowjobperson" => $group['allowjobperson'],
            "allowjobcompany" => $group['allowjobcompany'],
            "allowjobbasic" => $group['allowjobbasic']
        );
        $res = DB::update("common_usergroup_field",$newdata,array("groupid"=>$groupid));
        if($res){
            cpmsg("用户组更新成功","action=job&operation=group&groupid=$groupid","succeed");
        }else{
            cpmsg("未更新成功","","error");
        }
        
    }
    
    
}


/*********operation=test***********/
if($operation == "expirygroup"){
    
    showsubmenu('人才网用户组',array(
       array('用户组','job&operation=group',0),
       array('过期用户组','job&operation=expirygroup',1)
    ));
    echo "这里将能设定过期之后默认用户组!";
    
}
?>

页面效果:

DISCUZ 管理后台页面开发实例_第1张图片

DISCUZ 管理后台页面开发实例_第2张图片


那么是如何在用户左边栏自定义添加选项呢

首先在source/admincp/menu下新增文件menu_job.php

DISCUZ 管理后台页面开发实例_第3张图片


然后在source/language下增加lang_admincp_job.php如下 ,这个是语言包

DISCUZ 管理后台页面开发实例_第4张图片


对了,上面的代码文件是在admincp_job.php中,放在source/admincp目录下

DISCUZ 管理后台页面开发实例_第5张图片


下面说说原理:

DISCUZ 管理后台页面开发实例_第6张图片

那么job_group页面会跳转到哪呢?它将跳转到  href="admin.php?action=job&operation=group"

job_group被分隔为action=job&operation=group

同理job_expirygroup被分隔为action=job&operation=expirygroup


admin.php?action=job 页面将跳转到admincp_job.php

有图有真相:

DISCUZ 管理后台页面开发实例_第7张图片

你可能感兴趣的:(discuz)