<!--<?php
include_once PrintEot('left');
$classBasic = $classKmdmanage = $classPaylog = $classCheck = $classUsermanage = '';
$className = 'class' . ucfirst($adminitem);
${$className} = ' class="current"';
print<<<EOT
-->
<div class="nav3 mb10">
	<ul class="cc">
		<li{$classBasic}><a href="$jobUrl">基本設置</a></li>
		<li{$classPaylog}><a href="$jobUrl&adminitem=paylog">支付管理</a></li>
		<li{$classCheck}><a href="$jobUrl&adminitem=check">帖子審核</a></li>
		<li{$classKmdmanage}><a href="$jobUrl&adminitem=kmdmanage">孔明燈管理</a></li>
		<li{$classUsermanage}><a href="$jobUrl&adminitem=usermanage">用戶管理</a></li>
	</ul>
</div>
<!--
EOT;
if($adminitem == 'basic'){
if($db_kmd_ifkmd){
	$ifkmd_N .= " onclick=\"showtips('closetips');\"";
}
print <<<EOT
-->
<h2 class="h1">參數設置</h2>
<form action="$basename" method="post">
<input type="hidden" name="step" value="2">
<div class="admin_table mb10">
<table width="100%" cellspacing="0" cellpadding="0">
	<tr class="tr1">
		<td class="td1">孔明燈功能</td>
		<td class="td2" width="420">
			<ul class="list_A list_80">
				<li><input name="config[kmd_ifkmd]" type="radio" value="1" $ifkmd_Y />開啟</li>
				<li><input name="config[kmd_ifkmd]" type="radio" value="0" $ifkmd_N />關閉</li>
<script>
function hidetips(obj) {
	getObj(obj).style.display = 'none';
}
function showtips(obj) {
	getObj(obj).style.display = '';
}
</script>
				<div class="fl" id="closetips" style="display:none">
   					<div style="position:absolute;margin-top:22px;">
						<div class="popout">
							<table border="0" cellspacing="0" cellpadding="0">
								<tbody>
									<tr><td class="bgcorner1"></td>
										<td class="pobg1"></td>
										<td class="bgcorner2"></td>
									</tr>
									<tr><td class="pobg4"></td>
									<td>
									<div class="popoutContent">
									<div style="width:370px;">
									<div class="popTop cc"><a href="javascript:;" class="del_img fr" onclick="hidetips('closetips')">關閉</a>友情提示
									</div>
									<p class="s4 cc p10">關閉後所有孔明燈將失效!</p>
									</div></div></td>
									<td class="pobg2"></td></tr>
									<tr><td class="bgcorner4"></td><td class="pobg3"></td><td class="bgcorner3"></td></tr>
								</tbody>
							</table>
						</div>
					</div>
				</div>
			</ul>
		</td>
		<td class="td2"><div class="help_a">關閉後，所有的孔明燈服務都將取消</div></td>
	</tr>
	<tr class="tr1">
		<td class="td1">審核員</td>
		<td class="td2"><input class="input input_wb" name="username" value="$db_kmd_reviewperson" /></td>
		<td class="td2"><div class="help_a">孔明燈申請的審核員，有用戶申請時會收到提醒短消息，多個帳號用,號隔開</div></td>
	</tr>
	<tr class="tr1">
		<td class="td1">更換帖子設置</td>
		<td class="td2">
			<select name="config[kmd_deducttime]" class="select_wa">
				<option value="1" $deducttime_1 >1小時</option>
				<option value="3" $deducttime_3  >3小時</option>
				<option value="6" $deducttime_6  >6小時</option>
				<option value="12" $deducttime_12 >12小時</option>
				<option value="24" $deducttime_24 >1天</option>
				<option value="48" $deducttime_48 >2天</option>
				<option value="72" $deducttime_72 >3天</option>
			</select>
		</td>
		<td class="td2"><div class="help_a">更換孔明燈中的帖子扣除的推廣時間</div></td>
	</tr>
	<tr class="tr1">
		<td class="td1 vt">費用設置</td>
		<td class="td2">
			<div class="admin_tableB">
				<table>
					<tr>
						<td width="30" height="25">順序</td>
						<td width="170">套餐名稱</td>
						<td width="30">天數</td>
						<td width="85">人民幣（元）</td>
						<td width="50">折扣</td>
						<td>&nbsp;</td>
					</tr>
<!--
EOT;
foreach ($spreads as $key => $value){
print <<<EOT
-->
					<tr height="30" id="kmd_$value[sid]">
						<td><input  type="text" class="input input_wd" name="spreads[displayorder][$key]" value="$value[displayorder]"/></td>
						<td><input  type="text" class="input input_wa" name="spreads[name][$key]" value="$value[name]"/></td>
						<td><input type="text" class="input input_wd" name="spreads[day][$key]" value="$value[day]"/></td>
						<td><input  type="text" class="input input_wc" name="spreads[price][$key]" value="$value[price]"/></td>
						<td><input type="text" class="input" style="width:40px;" name="spreads[discount][$key]"  value="$value[discount]"/></td>
						<td><a href="javascript:;" onclick="delPay('$value[sid]');">[刪除]</a></td>
					</tr>
<!--
EOT;
}print <<<EOT
-->
<tbody id="tbody">
</tbody>
<tbody id="tmode" style="display:none"><tr>
<td><input type="text" class="input input_wd mr5" name="newspreads[displayorder][]" value=""/>
<td><input type="text" class="input input_wa" name="newspreads[name][]" value=""/>
<td><input type="text" class="input input_wd" name="newspreads[day][]" value=""/>
<td><input type="text" class="input input_wc" name="newspreads[price][]" value=""/>
<td><input type="text" class="input" style="width:40px;" name="newspreads[discount][]" value=""/></td>
<td>&nbsp;</td>
</tr>
</tbody>
				</table>
				<p><i class="expand expand_c"></i><a class="cp s3" onclick="addtype();">添加套餐</a></p>
			</div>
		</td>
		<td class="td2"><div class="help_a"></div></td>
	</tr>
	<tr class="tr1">
		<td class="td1 vt">聯系方式</td>
		<td class="td2">
			<p class="mb5">電話︰<input name="config[kmd_phone]" value="$db_kmd_phone" type="text" class="input input_wa" /></p>
			<p class="mb5">手機︰<input name="config[kmd_mobile]" value="$db_kmd_mobile" type="text" class="input input_wa" /></p>
			<p class="mb5">旺旺︰<input name="config[kmd_aliww]" value="$db_kmd_aliww" type="text" class="input input_wa" /></p>
			<p class="mb5">ＱＱ︰<input name="config[kmd_qq]" value="$db_kmd_qq" type="text" class="input input_wa" /></p>
		</td>
		<td class="td2"><div class="help_a">&nbsp;</div></td>
	</tr>
	<tr class="tr1">
		<td class="td1 vt">支付方式</td>
		<td class="td2">
<!--
EOT;
if($ol_payto){
print <<<EOT
-->
<p class="b s5">支付寶</p><p class="mb10"><span class="mr10">$ol_payto</span><a href="admin.php?adminjob=userpay&adminitem=userpay" onClick="parent.PW.Dialog({id:'userpay',url:'$admin_file?adminjob=userpay&adminitem=userpay',name:'網上支付'});return false;">[修改]</a></p>
<!--
EOT;
}else{
print <<<EOT
-->
<p class="b s5">支付寶</p><p class="mb10"><span class="mr10">您還沒有添加支付寶帳號</span><a href="admin.php?adminjob=userpay&adminitem=userpay" onClick="parent.PW.Dialog({id:'userpay',url:'$admin_file?adminjob=userpay&adminitem=userpay',name:'網上支付'});return false;">[添加]</a></p>
<!--
EOT;
}print <<<EOT
-->
<p class="b s5">銀行轉賬</p>
<p class="mb5">公司名稱︰<input name="config[kmd_company]" value="$db_kmd_company" type="text" class="input input_wa" /></p>
<p class="mb5">銀行賬戶︰<input name="config[kmd_account]" value="$db_kmd_account" type="text" class="input input_wa" /></p>
<p class="mb10">開&nbsp;戶&nbsp;行︰<input name="config[kmd_bank]" value="$db_kmd_bank" type="text" class="input input_wa" /></p>
<p class="b s5">現金</p>
<p class="mb5">辦理地址︰<input name="config[kmd_address]" value="$db_kmd_address" type="text" class="input input_wb" /></p>
		</td>
		<td class="td2"><div class="help_a"></div></td>
	</tr>
</table>
</div>
<div class="mb10 tac"><span class="btn"><span><button type="submit">提交</button></span></span></div>
</form>
<script type="text/javascript">
function addtype(){
	var s = getObj('tmode').firstChild.cloneNode(true);
	getObj('tbody').appendChild(s);
}
function delPay(id) {
	var url = '{$basename}&adminitem=basic&step=3&sid=' + id ;
	if (!confirm("確定要刪除此條費用嗎？")) return false;
	//var data = '?adminjob=kmd&action=delpay&sid='+id;
	ajax.send(url,'',delPayR);
}
function delPayR(){
	var sid = ajax.request.responseText.split("\t");
	if (sid[0] == 'success') {
	    delElement('kmd_'+sid[1]);
	} else {
		alert("刪除錯誤！");
	}
}
onReady(function(){
	addtype();
})

</script>
<!--
EOT;
}elseif($adminitem == 'paylog'){
print <<<EOT
-->
<script type="text/javascript" src="js/date.js"></script>
<h2 class="h1">支付管理</h2>
<form action="$basename" method="post">
<div class="p10 mb10">
	<p class="mb10">
		<span class="mr20">版塊︰<select name="fid"  class="select_wa"><option value='0'>所有版塊</option>$forumcache</select></span>
		<span class="mr20">購買者︰<input name="username" type="text" class="input input_wa"  value="$username"/></span>
		<span class="mr20">狀態︰
			<select name="status" class="select_wa"><option value='0'>所有狀態</option>
<!--
EOT;
for($i=1;$i<4;$i++){
$tmpSelected = $status == $i?' selected="selected"' : '';
print <<<EOT
-->
<option value="$i"$tmpSelected>{$kmdService->payStatus[$i]}</option>
<!--
EOT;
}print <<<EOT
-->			</select>
		</span>
		<span class="mr20">
			購買時間︰<input name="starttime" id="startTime"  title="開始時間" onClick="javascript:ShowCalendar(this.id)" type="text" class="input input_wc" value="$starttime" />
			<span class="p_lr_10">至</span><input name="endtime" id="endTime" title="結束時間" onClick="javascript:ShowCalendar(this.id)" type="text" class="input input_wc" value="$endtime" />
		</span>
		<span class="btn2"><span><button type="submit">查找</button></span></span>
		<p class="b" style="border-top:1px dashed #ccc;padding-top:10px;">
			共購買孔明燈 <span class="s2">$count</span> 次
<!--
EOT;
	if(!$status || $status==KMD_PAY_STATUS_PAYED){print <<<EOT
-->
			，收入 <span class="s2">$income</span> 元
<!--
EOT;
	}
	print <<<EOT
-->
		</p>
	</p>
</div>
</form>
<form action="$basename&action=manage" method="post" name="FORM" >
<input type="hidden" name="step" value="2">
<div class="admin_table mb10" style="border-top:1px solid #dde9f5;">
  <table width="100%" cellspacing="0" cellpadding="0">
	<tr class="tr2">
		<td>購買者</td>
		<td>版塊</td>
		<td>推廣費用</td>
		<td>支付方式</td>
		<td>購買時間</td>
		<td width="170">操作</td>
	</tr>
<!--
EOT;
if(S::isArray($payLogs)){
foreach($payLogs as $k =>$v){
	$v['createtime'] = get_date($v['createtime'],'Y-m-d H:i:s');
print <<<EOT
-->
	<tr class="tr1 vt">
		<td class="td2"><a href="u.php?uid={$v['uid']}" target="_blank">{$v['username']}</a></td>
		<td class="td2"><a href="thread.php?fid={$v['fid']}" target="_blank">{$v['forumname']}</a></td>
		<td class="td2">{$v['money']}元</td>
		<td class="td2">{$kmdService->payTypes[$v['type']]}</td>
		<td class="td2">{$v['createtime']}</td>
<!--
EOT;
$actionHtml = '';
if ($v['status'] == KMD_PAY_STATUS_NOTPAY){
	$actionHtml = "<a onclick=\"javascript:return confirm('確認已收到貨款，並將狀態設置為已支付？')\" href=\"$basename&step=2&operater=1&payid={$v['id']}\">[確認支付]</a>&nbsp;
					<a onclick=\"javascript:return confirm('確認刪除付款記錄？')\" href=\"$basename&step=2&operater=2&payid={$v['id']}\">[刪除]</a>";
} else {
	$actionHtml = $kmdService->payStatus[$v['status']];
}
print <<<EOT
-->
		<td class="td2">$actionHtml</td>
	</tr>
<!--
EOT;
}
}else{
print <<<EOT
-->
	<tr class="tr1"><td class="td2" colspan="7"><div class="admin_tips">啊哦！暫無相關信息</div></td></tr>
<!--
EOT;
}
print <<<EOT
-->
</table>
</div>
<div class="cc">$pages</div>
</form>
<!--
EOT;
}elseif($adminitem == 'check'){
print <<<EOT
-->
<h2 class="h1">帖子審核</h2>
<form action="$basename" method="post">
<div class="p10">
	<p class="mb10">
		<span class="mr20">版塊︰<select name="fid"  class="select_wa"><option value='0'>所有版塊</option>$forumcache</select></span>
		<span class="mr20">購買者︰<input name="username" type="text" class="input input_wa"  value="$username"/></span>
		<span class="btn2"><span><button type="submit">查找</button></span></span></p>
	</p>
</div>
</form>
<form action="$basename&action=manage" method="post" name="FORM" >
<input type="hidden" name="step" value="2">
<div class="admin_table mb10" style="border-top:1px solid #dde9f5;">
  <table width="100%" cellspacing="0" cellpadding="0">
	<tr class="tr2">
		<td width="50"><span onclick="CheckAll(document.FORM)" class="cp">全選</span></td>
		<td>購買者</td>
		<td>帖子標題</td>
		<td>版塊</td>
		<td width="170">操作</td>
	</tr>
<!--
EOT;
if(S::isArray($checks)){
foreach($checks as $k =>$v){
print <<<EOT
-->
	<tr class="tr1 vt">
		<td class="td2"><input type="checkbox" name="kids[]" value="{$v['kid']}" /></td>
		<td class="td2"><a href="u.php?uid={$v['uid']}" target="_blank">{$v['username']}</a></td>
		<td class="td2"><a href="read.php?tid={$v['tid']}" target="_blank">{$v['subject']}</a></td>
		<td class="td2"><a href="thread.php?fid={$v['fid']}" target="_blank">{$v['forumname']}</a></td>
		<td class="td2">
			<a href="$basename&step=2&operater=1&kid={$v['kid']}">[通過]</a>&nbsp;
			<a href="$basename&step=2&operater=2&kid={$v['kid']}">[拒絕]</a>
		</td>
	</tr>
<!--
EOT;
}
}else{
print <<<EOT
-->
	<tr class="tr1"><td class="td2" colspan="5"><div class="admin_tips">啊哦！暫無相關信息</div></td></tr>
<!--
EOT;
}
print <<<EOT
-->
</table>
</div>
<div class="cc">$pages</div>
<div class="tac p10">
	<p class="mb10">選中操作:
		<input type="radio" name="operater" value="1"  checked/>審核通過&nbsp;
		<input type="radio" name="operater" value="2" />&nbsp;審核拒絕&nbsp;
	</p>
<span class="bt"><span><button type="button" onclick="CheckAll(document.FORM)">全 選</button></span></span>
<span class="btn"><span><button type="submit">提 交</button></span></span>
</div>
</form>
<!--
EOT;
}elseif($adminitem == 'kmdmanage'){
print <<<EOT
-->
<script type="text/javascript" src="js/date.js"></script>
<h2 class="h1">孔明燈管理<!-- &nbsp;<a style="margin-left:15px;" href="javascript:void(0);" onclick="javascript:sendmsg('{$basename}&step=3');">添加孔明燈</a> --></h2>
<form action="$basename" method="post">
<div class="p10 mb10">
	<p class="mb10">
		<span class="mr20">版塊︰<select name="fid"  class="select_wa"><option value='0'>所有版塊</option>$forumcache</select></span>
		<span class="mr20">狀態︰
			<select name="status" class="select_wa"><option value='0'>所有狀態</option>
<!--
EOT;
for($i=1;$i<=4;$i++){
$tmpSelected = $status == $i?' selected="selected"' : '';
print <<<EOT
-->
<option value="$i"$tmpSelected>{$kmdService->threadStatus[$i]}</option>
<!--
EOT;
}print <<<EOT
-->
			</select>
		</span>
		<span class="mr20">
			推廣時間︰<input name="starttime" id="startTime"  title="開始時間" onClick="javascript:ShowCalendar(this.id)" type="text" class="input input_wc" value="$starttime" />
			<span class="p_lr_10">至</span><input name="endtime" id="endTime" title="結束時間" onClick="javascript:ShowCalendar(this.id)" type="text" class="input input_wc" value="$endtime" />
		</span>
		<span class="mr20">購買者︰<input name="username" type="text" class="input input_wa"  value="$username"/></span>
		<span class="btn2"><span><button type="submit">查找</button></span></span>
	</p>
	<p>
</div>
</form>
<form action="$basename" method="post" name="FORM" >
<input type="hidden" name="step" value="2">
<input type="hidden" name="operater" value="1">
<div class="admin_table mb10" style="border-top:1px solid #dde9f5;">
  <table width="100%" cellspacing="0" cellpadding="0">
	<tr class="tr2">
		<td width="50"><span onclick="CheckAll(document.FORM)" class="cp">全選</span></td>
		<td>購買者</td>
		<td>推廣版塊</td>
		<td>推廣時間</td>
		<td>狀態</td>
		<td width="170">操作</td>
	</tr>
<!--
EOT;
if(S::isArray($kmdInfos)){
foreach($kmdInfos as $v){
	$v['starttime'] = get_date($v['starttime'],'Y-m-d H:i:s');
	$v['endtime'] = get_date($v['endtime'],'Y-m-d H:i:s');
	$actionHtml = "<a onclick=\"javascript:return confirm('確認回收該孔明燈？')\" href=\"$basename&step=2&operater=1&kid={$v['kid']}\">[刪除]</a>";
	$v['tid'] && $actionHtml .= "&nbsp;<a href=\"read.php?tid={$v['tid']}\" target=\"_blank\">[查看]</a>";
print <<<EOT
-->
<tr class="tr1">
	<td class="td2"><input type="checkbox" name="kids[]" value="{$v['kid']}" /></td>
	<td class="td2"><a href="u.php?uid={$v['uid']}" target="_blank">{$v['username']}</a></td>
	<td class="td2"><a href="thread.php?fid={$v['fid']}" target="_blank">{$v['forumname']}</a></td>
	<td class="td2">{$v['starttime']} 至 {$v['endtime']}</td>
	<td class="td2">{$kmdService->threadStatus[$v['status']]}</td>
	<td class="td2">$actionHtml</td>
</tr>
<!--
EOT;
}
}else{
print <<<EOT
-->
	<tr class="tr1"><td class="td2" colspan="6"><div class="admin_tips">啊哦！暫無相關信息</div></td></tr>
<!--
EOT;
}
print <<<EOT
-->
</table>
</div>
<div class="cc">$pages</div>
<div class="tac p10">
<span class="bt"><span><button type="button" onclick="CheckAll(document.FORM)">全 選</button></span></span>
<span class="btn"><span><button type="submit" name="hello">提 交</button></span></span>
</div>
</form>
<!--
EOT;
}elseif($adminitem == 'usermanage'){
print <<<EOT
-->
<h2 class="h1">用戶管理</h2>
<form action="$basename" method="post">
<div class="p10">
	<p class="mb10"><span class="mr20">用戶名︰
	 <input name="username" type="text" class="input input_wa" value="$username" /></span>
	<span class="btn2"><span><button type="submit">查找</button></span></span></p>
	<p class="b" style="border-top:1px dashed #ccc;padding-top:10px;">
		共 <span class="s2">$count</span>人購買孔明燈
	</p>
</div>
</form>
<div class="admin_table mb10" style="border-top:1px solid #dde9f5;">
<table width="100%" cellspacing="0" cellpadding="0">
	<tr class="tr2">
		<td>用戶名</td>
		<td>真實姓名</td>
		<td>手機</td>
		<td>發票抬頭</td>
		<td>聯系地址</td>
		<td>操作</td>
	</tr>
<!--
EOT;
if($users){
foreach($users as $value){
print <<<EOT
-->
	<tr class="tr1">
      <td class="td2"><a href="u.php?uid={$value['uid']}" target="_blank">{$value['username']}</a></td>
      <td class="td2">{$value['realname']}</td>
      <td class="td2">{$value['phone']}</td>
	<td class="td2">{$value['invoice']}</td>
	<td class="td2">{$value['address']}</td>
	<td class="td2"><a href="$basename&adminitem=paylog&username={$value['username']}">購買記錄</a></td>
	</tr>
	
<!--
EOT;
}print <<<EOT
-->
</table>
$pages
</div>
<!--
EOT;
}else{
print <<<EOT
-->
<tr class="tr1"><td class="td2" colspan="6"><div class="admin_tips">啊哦！暫無相關信息</div></td></tr>

<!--
EOT;
}
}
include_once PrintEot('adminbottom');
?>-->


