<!--<?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/jobcenter.png" align="absmiddle" class="mr10" /><span>任務中心</span></h4>           	
        <div class="navC mb10">
            <ul>
                <li class="$current[1]"><a  href="jobcenter.php?action=applied"  hidefocus="true">我申請的</a></li>
                <li class="$current[0]"><a href="jobcenter.php?action=list" hidefocus="true">可申請的</a></li>
                <li class="$current[2]"><a  href="jobcenter.php?action=finish" hidefocus="true">完成的任務</a></li>
                <li class="$current[3]"><a  href="jobcenter.php?action=quit" hidefocus="true">失敗的任務</a></li>
            </ul>
        </div>
        <table width="100%" height="450">
            <tr><td valign="top">
                <div>
<!--begin-->
<!--
EOT;
if( $action == "list"){
print <<<EOT
-->

<!--
EOT;
if($jobs){
print <<<EOT
-->
                    <table width="100%" style="table-layout:fixed;">
                        <tr class="user-tr">
                            <td class="b gray" width="70">任務名稱</td>
                            <td>&nbsp;</td>
                            <td class="b gray" width="200">完成獎勵</td>
                            <td width="190">&nbsp;</td>
                        </tr>
                        <!--點擊任務名稱後出現的樣式-->
<!--
EOT;
foreach($jobs as $job){
print <<<EOT
-->
                        <tr class="user-tr">
                            <td><img src="$job[icon]" width="48" height="48" /></td>
                            <td class="vam user-t current">
                                <a href="javascript:;" class="text_open" hidefocus="true">$job[title]</a>
                                <p>$job[prepose]</p>
                            </td>
                            <td class="s2 vam">$job[reward]</td>
                            <td>$job[btn]</td>
                        </tr>
                        <tr class="tasks_text_tr user-tr" style="display:none;">
                            <td></td>
                            <td style="padding-top:0;">
                                <div class="tasks_text">
                                        <dl class="cc"><dt>任務描述:</dt><dd class="text">$job[description]</dd></dl>
                                        <dl class="cc"><dt>任務周期:</dt><dd>$job[period]</dd></dl>
<!--
EOT;
if($job['usergroup']){print <<<EOT
-->
                                        <dl class="cc"><dt>允許用戶組:</dt><dd>$job[usergroup]</dd></dl>
<!--
EOT;
}print <<<EOT
-->
<!--
EOT;
if($job['number']){print <<<EOT
-->
                                        <dl class="cc"><dt>人數限制:</dt><dd>$job[number]</dd></dl>
<!--
EOT;
}print <<<EOT
-->
                                        <dl class="cc"><dt>完成條件:</dt><dd>$job[condition]</dd></dl>
                                </div>
                            </td>
                            <td colspan="2"></td>
                        </tr>
<!--
EOT;
}
print <<<EOT
-->
                        <!--結束-->
                    </table>
<!--
EOT;
}else{
print <<<EOT
-->
                    <div class="ignoreTip">還沒有可申請的任務</div>
<!--
EOT;
}
print <<<EOT
-->

<!--
EOT;
}
print <<<EOT
-->
<!--
EOT;
if(empty($action) || $action == "applied"){
print <<<EOT
-->

<!--
EOT;
if($jobs){
print <<<EOT
-->
                    <table width="100%" style="table-layout:fixed;">
                        <tr class="user-tr">
                            <td class="b gray" width="70">任務名稱</td>
                            <td>&nbsp;</td>
                            <td class="b gray" width="200">完成獎勵</td>
                            <td width="190">&nbsp;</td>
                        </tr>
                        <!--點擊任務名稱後出現的樣式-->
<!--
EOT;
foreach($jobs as $job){
	$processHtml = '';
	if ($job['factor'] && $job['factor']['num'] > 0 && $job['factor']['fid']) {
		$processHtml = '完成進度: ' . round($job['step']/$job['factor']['num'] * 100) . '%';
	}
print <<<EOT
-->                     <tbody id="job_$job[id]">
                        <tr class="user-tr">
                            <td><img src="$job[icon]" width="48" height="48" /></td>
                            <td class="vam user-t current">
                                <a href="javascript:;" class="text_open" hidefocus="true">$job[title]</a> $processHtml
                            </td>
                            <td class="s2 vam">$job[reward]</td>
                            <td>$job[btn]</td>
                        </tr>
                        <tr class="tasks_text_tr user-tr" style="display:none;">
                            <td></td>
                            <td style="padding-top:0;">
                                <div class="tasks_text">
                                        <dl class="cc"><dt>任務描述:</dt><dd class="text">$job[description]</dd></dl>
                                        <dl class="cc"><dt>任務周期:</dt><dd>$job[period]</dd></dl>
                                        <dl class="cc"><dt>完成條件:</dt><dd id="job_condition_$job[id]">$job[condition]</dd></dl>
                                        <dl class="cc"><dt style="padding-top:5px;">$job[qbtn]</dt></dl>
                                </div>
                            </td>
                            <td colspan="2"></td>
                        </tr>
                        </tbody>
<!--
EOT;
}
print <<<EOT
-->
                        <!--結束-->
                    </table>
<!--
EOT;
}else{
print <<<EOT
-->
                    <div class="ignoreTip">還沒有已申請的任務</div>
<!--
EOT;
}
print <<<EOT
-->

<!--
EOT;
}
print <<<EOT
-->
<!--
EOT;
if($action == "finish"){
print <<<EOT
-->

<!--
EOT;
if($show == "detail"){
print <<<EOT
-->
                    <table width="100%" style="table-layout:fixed;">
                        <tr class="user-tr3">
                            <td width="80">
                                <img src="$list[icon]" width="64" height="64" />
                            </td>
                            <td>
                                <a href="profile.php?action=jobcenter&info_type=finish" class="f14 b blue mb5">$list[title]</a>
                                <p class="gray">$list[prepose]</p>
                                <div class="tasks_text">
                                    <dl class="cc"><dt>任務描述:</dt><dd class="text">$list[description]</dd></dl>
                                    <dl class="cc"><dt>任務周期:</dt><dd>$list[period]</dd></dl>
                                    <dl class="cc"><dt>任務獎勵:</dt><dd><span class="s2 ">$list[reward]</span></dd></dl>
                                </div>
                            </td>
                            <td width="300">&nbsp;</td>
                        </tr>
<!--
EOT;
if($list['usergroup'] && $list['number']){print <<<EOT
-->
                        <tr class="user-tr3">
                            <td>&nbsp;</td>
                            <td style="padding-top:0;">
                                <div class="tasks_text">
<!--
EOT;
if($list['usergroup']){print <<<EOT
-->
                                    <dl class="cc"><dt>可申請用戶組:</dt><dd>$list[usergroup]</dd></dl>
<!--
EOT;
}print <<<EOT
-->
<!--
EOT;
if($list['number']){print <<<EOT
-->
                                    <dl class="cc"><dt>人數限制:</dt><dd>$list[number]</dd></dl>
<!--
EOT;
}print <<<EOT
-->
                                </div>
                            </td>
                            <td>&nbsp;</td>
                        </tr>
<!--
EOT;
}print <<<EOT
-->
                        <tr class="user-tr3">
                            <td>&nbsp;</td>
                            <td>
                                <div class="tasks_text">
                                    <dl class="cc"><dt>完成條件:</dt><dd>$list[condition]</dd></dl>
                                </div>
                            </td>
                            <td>&nbsp;</td>
                        </tr>
                        <tr class="user-tr3">
                            <td><img src="$list[face]" width="64" height="64" /></td>
                            <td>
                                <b class="f14">我完成的情況:</b> <span class="gray">總共參加 $list[total] 次</span>
                                <div class="tasks_text">
                                    <dl class="cc"><dt>獎勵情況:</dt><dd>$list[rewardtotal]</dd></dl>
                                    <dl class="cc"><dt>最後一次:</dt><dd>$list[last]</dd></dl>
                                </div>
                            </td>
                            <td>&nbsp;</td>
                        </tr>
                        <tr class="user-tr3">
                            <td>&nbsp;</td>
                            <td>
<!--
EOT;
if($total){
print <<<EOT
-->
                                <b class="f14"></b> <span class="gray">還有 $total 位會員參與了任務</span>
                                <ul class="cc tasks_face_list">
<!--
EOT;
foreach($others as $other){
print <<<EOT
-->
                                    <li><a href="{$db_userurl}$other[uid]"><img src="$other[face]" width="48" height="48" /></a><p><a href="{$db_userurl}$other[uid]" title="$other[username]">$other[username]</a></p></li>
<!--
EOT;
}
print <<<EOT
-->
                                </ul>
<!--
EOT;
}
print <<<EOT
-->
                            </td>
                            <td>&nbsp;</td>
                        </tr>
                    </table>
                    <div class="tac" style=" padding:1em;width:180px;margin:0 auto;">
<!--
EOT;
if($list['isperiod']){
print <<<EOT
-->
                        <a href="javascript:;" id="apply_$list[id]"><span class="btn2"><span><button type="submit">重新申請</button></span></span></a>
<!--
EOT;
}
print <<<EOT
-->
                        <span class="bt2"><span><button onclick="top.location='jobcenter.php?action=finish'" type="submit">返回</button></span></span>
                    </div>
<!--
EOT;
}else{
print <<<EOT
-->
<!--
EOT;
if($jobs){
print <<<EOT
-->
                    <table width="100%" style="table-layout:fixed;">
                        <tr class="user-tr">
                            <td class="b gray" width="70">任務名稱</td>
                            <td>&nbsp;</td>
                            <td class="b gray" width="200">完成獎勵</td>
                            <td width="190">&nbsp;</td>
                        </tr>
                        <!--點擊任務名稱後出現的樣式-->
<!--
EOT;
foreach($jobs as $job){
print <<<EOT
-->
                        <tr class="user-tr">
                            <td><img src="$job[icon]" width="48" height="48" /></td>
                            <td class="vam user-t current">
                                <p class="mb5"><a href="javascript:;" class="text_open" hidefocus="true">$job[title]</a></p><p class="gray">$job[lastfinish]</p>
                                <p>$job[prepose]</p>
                            </td>
                            <td class="s2 vam">$job[reward]</td>
                            <td>$job[btn]</td>
                        </tr>
                        <tr class="tasks_text_tr user-tr" style="display:none;">
                            <td></td>
                            <td style="padding-top:0;">
                                <div class="tasks_text">
                                        <dl class="cc one"><dt>任務描述:</dt><dd class="text">$job[description]</dd></dl>
                                        <dl class="cc"><dt>任務周期:</dt><dd>$job[period]</dd></dl>
<!--
EOT;
if($job['number']){print <<<EOT
-->
                                        <dl class="cc one"><dt>人數限制:</dt><dd>$job[number]</dd></dl>
<!--
EOT;
}print <<<EOT
-->
                                        <dl class="cc"><dt>完成條件:</dt><dd>$job[condition]</dd></dl>
                                        <dl class="cc one"><dt>&nbsp;</dt><dd><a href="jobcenter.php?action=finish&jobid=$job[id]">詳細信息</a></dd></dl>
                                </div>
                            </td>
                            <td colspan="2"></td>
                        </tr>
<!--
EOT;
}
print <<<EOT
-->
                        <!--結束-->
                    </table>
<!--
EOT;
}else{
print <<<EOT
-->
                    <div class="ignoreTip">還沒有已完成的任務，趕快去申請！</div>
<!--
EOT;
}
print <<<EOT
-->
<!--
EOT;
}
print <<<EOT
-->

<!--
EOT;
}
print <<<EOT
-->


<!--
EOT;
if($action == "quit"){
print <<<EOT
-->
<!--
EOT;
if($jobs){
print <<<EOT
-->
                    <table width="100%" style="table-layout:fixed;">
                        <tr class="user-tr">
                            <td class="b gray" width="70">任務名稱</td>
                            <td>&nbsp;</td>
                            <td class="b gray" width="200">完成獎勵</td>
                            <td width="190">&nbsp;</td>
                        </tr>
                        <!--點擊任務名稱後出現的樣式-->
<!--
EOT;
foreach($jobs as $job){
print <<<EOT
-->
                        <tr class="user-tr">
                            <td><img src="$job[icon]" width="48" height="48" /></td>
                            <td class="vam user-t current">
                                <p class="mb5"><a href="javascript:;" class="text_open" hidefocus="true">$job[title]</a></p>
                                <p class="gray">$job[info]</p>
                                <p>$job[prepose]</p>
                            </td>
                            <td class="s2 vam">$job[reward]</td>
                            <td>$job[btn]</td>
                        </tr>
                        <tr class="tasks_text_tr user-tr" style="display:none;">
                            <td></td>
                            <td style="padding-top:0;">
                                <div class="tasks_text">
                                        <dl class="cc"><dt>任務描述:</dt><dd class="text">$job[description]</dd></dl>
                                        <dl class="cc"><dt>任務周期:</dt><dd>$job[period]</dd></dl>
<!--
EOT;
if($job['number']){print <<<EOT
-->
                                        <dl class="cc"><dt>人數限制:</dt><dd>$job[number]</dd></dl>
<!--
EOT;
}print <<<EOT
-->
                                        <dl class="cc"><dt>完成條件:</dt><dd>$job[condition]</dd></dl>
                                </div>
                            </td>
                            <td colspan="2"></td>
                        </tr>
<!--
EOT;
}
print <<<EOT
-->
                        <!--結束-->
                    </table>
<!--
EOT;
}else{
print <<<EOT
-->
                    <div class="ignoreTip">還沒有失敗的任務</div>
<!--
EOT;
}
print <<<EOT
-->

<!--
EOT;
}
print <<<EOT
-->
<script type="text/javascript" src="js/pw_jobcenter.js"></script>
<script>
window.onReady(function(){
	jobCenterInit();
	PW.accordion("user-t","tasks_text_tr")
})
</script>
<!--end-->
                </div>
            </td></tr>
        </table>
    </div>
</div>
<!--
EOT;
require_once uTemplate::PrintEot('footer');
?>-->