discuzx3.2後臺管理菜單定製,管理菜單二次開發php
詳情請參考:http://www.infosz.com/forum.php?mod=viewthread&tid=199fetch
第一步:source\admincp\menu下添加 menu_infosz.php,內容以下:
第二步:source\admincp目錄下添加admincp_infosz.php 文件,內容以下:ui
第三步: 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原創,保留全部版權,轉載請註明出處!url