- <?php
- if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
- exit('Access Denied');
- }
- @set_time_limit(600);
- cpheader();
- shownav('global', '人才网用户组');//顶左部
- /********operation=="group"**********/
- if($operation == "group"){
- if(!submitcheck("settingsubmit")){//没有表单提交
- if(empty($_G['gp_groupid'])){
- showsubmenu('人才网用户组',array(//导航菜单
- array('用户组','job&operation=group',1),
- array('过期用户组','job&operation=expirygroup',0)
- ));
- showtips('job_admin_tips');//顶部相关信息,帮助信息
- showformheader("");//表单开始
- showtableheader('人才网专属用户组列表', 'fixpadding');//表格开始
- showsubtitle(array('组头衔', '组ID', '价格(交易积分/天)','购买下限(天数)','编辑'));//表首行<th>
- $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'],
- "<a href='admin.php?action=job&operation=group&groupid={$group['groupid']}&grouptitle={$group['grouptitle']}'>编辑</a>"
- );
- 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 "<input type='hidden' name='groupid' value='{$groupid}' />";
- 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 "这里将能设定过期之后默认用户组!";
- }
- ?>
页面效果:
那么是如何在用户左边栏自定义添加选项呢
首先在source/admincp/menu下新增文件menu_job.php
然后在source/language下增加lang_admincp_job.php如下 ,这个是语言包
对了,上面的代码文件是在admincp_job.php中,放在source/admincp目录下
下面说说原理:
那么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
有图有真相: