您的位置:首页 > 其它

discuzx3.2后台管理菜单定制,管理菜单二次开发,discuzx3.2后台管理菜单自定义

2016-03-20 13:04 513 查看
discuzx3.2后台管理菜单定制,管理菜单二次开发

详情请参考:http://www.infosz.com/forum.php?mod=viewthread&tid=199

第一步:source\admincp\menu下添加 menu_infosz.php,内容如下:



第二步:source\admincp目录下添加admincp_infosz.php 文件,内容如下:



第三步: source\language\lang_admincp_menu.php添加如下内容:



第四步:source\admincp\infosz下添加后台处理逻辑文件(业务处理逻辑可以参考最后)



第5步:admin.php页, $admincp_actions_normal 变量添加后加一项 infosz ,否则会提示没有权限访问;

完成后后台显示效果如下



:gift.php内容如下:

<?php

shownav('global', '礼品兑换');

if(!submitcheck('delGiftBtn') &&
!submitcheck('addGiftBtn')

&&
!submitcheck('addGiftInfoSubmit') &&!submitcheck('editGiftInfoSubmit')

) {

if(empty($_GET['giftId'])){ //无礼品ID为显示列表

//此处action必须为infosz,否则会提示无权限

showformheader("infosz&operation=gift&do=addGift","","addGiftForm");

showtableheader('当前礼品列表', 'fixpadding');//表格开始

showsubtitle(array('ID','礼品名称','图片路径','礼品价值', '所需金币','礼品总数','剩余数量','状态','商品链接','备注','操作'));

$groups=array();

$query =
C::t('infosz_gift')->fetch_all_range();

foreach($query as
$group) {

$newgroup = array(

$group['id'],

$group['gift_name'],

$group['img_path'],

$group['value'],

$group['credit'],

$group['total_count'],

$group['left_count'],

$group['status'],

$group['detail_url'],

$group['remark'],

"<a
href='admin.php?action=infosz&operation=gift&do=editGift&giftId={$group['id']}'>编辑</a>

<a
href='admin.php?action=infosz&operation=gift&do=delGift&giftId={$group['id']}'>删除</a>"

);

showtablerow('',
array('width="20"','width="100"','width="100"','width="50"'),$newgroup);

}

showsubmit('addGiftBtn','新增');

showtablefooter();

showformfooter();

}

else{//有礼品ID则为点击编辑的入口

if($_GET['do']=='editGift')

{

shownav('global', '修改礼品');

$giftId=$_GET['giftId'];

$group =C::t('infosz_gift')->get_gift_by_id($giftId);

showformheader("infosz&operation=gift&do=editGiftInfoSubmit","","editGiftInfoForm");

showhiddenfields(array('id' => "{$group['id']}"));

showsetting('礼品名称', '', '', '<input type="text"
style="width:300px;" name="gift_name"
value="'.$group['gift_name'].'"');

echo '<br><br>';

showsetting('图片路径','img_path',"{$group['img_path']}",'text');

echo '<br><br>';

showsetting('礼品价值','value',"{$group['value']}",'text');

echo '<br><br>';

showsetting('所需金币','credit',"{$group['credit']}",'text');

echo '<br><br>';

showsetting('礼品总数','total_count',"{$group['total_count']}",'text');

echo '<br><br>';

showsetting('剩余数量','left_count',"{$group['left_count']}",'text');

echo '<br><br>';

showsetting('状态','status',"{$group['status']}",'text');

echo ' 1 可用,0 禁用<br><br>';

showsetting('商品链接','detail_url',"{$group['detail_url']}",'text');

echo ' 1 可用,0 禁用<br><br>';

showsetting('备注','remark',"{$group['remark']}",'text');

showsubmit('editGiftInfoSubmit','提交');

showformfooter();

}

if($_GET['do']=='delGift')

{

$giftId=$_GET['giftId'];

C::t('info_gift')->delete($giftId);

echo '删除成功';

}

}

}else{

//进入新增礼品界面

if($do=='addGift'){

shownav('global', '新增礼品');

showformheader("infosz&operation=gift&do=addGiftInfoSubmit","","addGiftInfoForm");

showsetting('礼品名称', '', '', '<input type="text"
style="width:300px;" name="gift_name" value=""');

echo '<br><br>';

showsetting('图片路径','img_path','','text');

echo ' 图片存路径:static\image\aikede\gift<br><br>';

showsetting('礼品价值','value','','text');

echo '<br><br>';

showsetting('所需金币','credit','','text');

echo '<br><br>';

showsetting('商品链接','','','<input type="text"
style="width:300px;" name="detail_url" value=""');

echo '<br><br>';

showsetting('礼品总数','total_count','','text');

echo '<br><br>';

showsetting('剩余数量','left_count','','text');

echo '<br><br>';

showsetting('备 注','remark','','text');

echo '<br><br>';

showsubmit('addGiftInfoSubmit','提交');

showformfooter();

}

//新增礼品表单提交

if($do=='addGiftInfoSubmit'){

require_once libfile('function/infosz_duihuan');

new_gift($_GET['gift_name'],$_GET['img_path'],$_GET['value'],$_GET['credit'],$_GET['total_count'],$_GET['left_count'],$_GET['remark'],

$_GET['detail_url']

);

echo '保存成功';

}

//修改礼品信息提交

if($do=='editGiftInfoSubmit'){

$giftId=$_GET['id'];

$giftData=array(

'gift_name'=>$_GET['gift_name'],

'img_path'=>$_GET['img_path'],

'value'=>$_GET['value'],

'credit'=>$_GET['credit'],

'total_count'=>$_GET['total_count'],

'left_count'=>$_GET['left_count'],

'status'=>$_GET['status'],

'detail_url'=>$_GET['detail_url'],

'remark'=>$_GET['remark']

);

C::t('infosz_gift')->update($giftId,$giftData);

echo '修改成功';

}

}

?>

本内容由www.infosz.com原创,保留所有版权,转载请注明出处!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: