<!--<?php
require_once(uTemplate::printEot('header'));
require_once(uTemplate::printEot('user_appleft'));
print<<<EOT
-->
<div class="contUser">
    <div class="p15">
			<h4 class="site"><img src="u/images/module/lightbulb.png" align="absmiddle" class="mr10" /><span>孔明燈</span></h4>           	
        <div class="navC">
            <ul>
                <li><a  href="apps.php?q=kmd"  hidefocus="true">我的孔明燈</a></li>
                <li class="current"><a href="apps.php?q=kmd&a=record" hidefocus="true">購買記錄</a></li>
            </ul>
			<span class="btn_add fl"><span><button onclick="window.location.href='{$basename}a=buy1';">購買孔明燈</button></span></span>
        </div>
        <table width="100%">
        	 <tr class="tr3">
							<td width="15">&nbsp;</td>
							<td>帖子標題</td>
							<td>版塊</td>
							<td width="100">推廣套餐</td>
							<td width="70">申請時間</td>
							<td width="70">帖子狀態</td>
							<td width="70">支付狀態</td>
							<td width="60">操作</td>
						</tr>
  <!--
EOT;
if (!empty($kmd)) {
foreach ($kmd as $key => $value) {
	if ($value['spread']&&$kmd_spread[$value['spread']]){
		$spreadInfo = $kmd_spread[$value['spread']];
		$discount = $spreadInfo['discount'] ? $spreadInfo['discount'].'折' : '';
		$price = $spreadInfo['day'].'天/<span class="s2">'.$spreadInfo['rmb'].'元 '.$discount.'</span>' ;
	}
	$thread_status = '';
	switch ($value['thread_status']){
		case 1:
			$thread_status = '<span class="s2">審核中</span>';
			break;
		case 2:
			$thread_status = '<span class="s3">推廣中</span>';
			break;
		case 3:
			$thread_status = '<span class="gray">未通過</span>';
			break;
		case 4:
			$thread_status = '<span class="gray">已停用</span>';
			break;	
	}
	$pay_status = '';
	$operation = '';
	switch ($value['pay_status']){
		case 1:
			$pay_status = '<span class="s1">未支付</span>';
			$operation = '<a href="'.$basename.'a=buy3&kid='.$value['kid'].'">[支付]</a>';
			
			break;
		case 2:
			$pay_status = '<span class="s3">已支付</span>';
			if($value['thread_status']==2 || $value['thread_status']==4){
				$operation = '<a onclick="checkKmd('.$value['tid'].','.$value['spread'].')" href="javascript:;">[續費]</a>';
			}else{
				$operation = ' ';
			}			
			break;
		case 3:
			$pay_status = '<span class="gray">已退款</span>';
			$operation = '<a href="'.$basename.'a=buy1">[購買]</a>';
			break;		
	}
	if (!$value['forum']) {
		$value['subject']='<font color="#ff0000">該帖已被刪除</font>';
		$operation = ' ';
	}
print <<<EOT
-->	      
            		<tr class="tr3">
							<td><img src="images/wind/thread/topicnew.gif" /></td>
							<td><a target="_blank" href="read.php?tid={$value['tid']}">{$value['subject']}</a></td>
							<td><a target="_blank" href="thread.php?fid={$value['fid']}">{$value['forum']}</a></td>
							<td>{$price}</td>
							<td>{$value['createdtime']}</td>
							<td>{$thread_status}</td>
							<td>{$pay_status}</td>
							<td>{$operation}</td>
						</tr>
<!--
EOT;
}
} else {print <<<EOT
-->	
						<tr>
							<td colspan="8" class="p15 tac f14">暫無主題！</td>
						</tr>
<!--
EOT;
}print <<<EOT
-->								
        </table>
    </div>
<div class="p10 cc">$pages</div>  
</div>
<script type="text/javascript">
function checkKmd(tid,sid) {
	ajax.send("{$basename}a=checkkmd&tid="+tid,'',function(){
		var rText = ajax.request.responseText;		
		if (rText.substring(0,7) == 'success'){	
				window.location.href="{$basename}a=buy1&tid="+tid+"&sid="+sid;	
				//window.open("{$basename}a=buy1&tid="+tid+"&sid="+sid,"_blank");
			//	alert("{$basename}a=buy1&tid="+tid+"&sid="+sid);	
			 } else{				 
			 	showDialog('error',rText);		
			 }
			 return false;
	});
}
</script>
<!--
EOT;
require_once(uTemplate::printEot('footer'));
?>