<!--<?php
require_once(uTemplate::printEot('header'));
require_once(uTemplate::printEot('user_appleft'));
print <<<EOT
-->
<link rel="stylesheet" href="apps/activity/images/style.css?{$GLOBALS['wind_repair']}" />
<div class="contUser">
<table width="100%"><tr><td valign="top" height="500">
	<div class="p15">
		<h4 class="site"><img src="u/images/module/activity.png" align="absmiddle" class="mr10" /><span>活動</span></h4>
		<div class="navC">
            <ul>
                <li id="a_own"><a href="{$basename}">我的活動</a></li>
                <li id="a_all"><a href="{$basename}a=all">全部活動</a></li>
                <li id="a_recommended"><a href="{$basename}a=recommended">推薦活動</a></li>
            </ul>
		</div>
<!--
EOT;
$b = $a;
print <<<EOT
-->
<script type="text/javascript">
setCurrent('a_$b','a_own','current');
</script>
		<div class="p10">
			<a href="{$basename}a=$a" id="see_fromforum">來自版塊</a><!--
EOT;
if ($a!='recommended') {print <<<EOT
-->&nbsp;|&nbsp;<a href="{$basename}a=$a&see=fromgroup" id="see_fromgroup">來自群組</a><!--
EOT;
}if (empty($a)) {print <<<EOT
-->&nbsp;|&nbsp;<a href="{$basename}a=$a&see=feeslog" id="see_feeslog">費用流通日志</a>
<!--
EOT;
}print <<<EOT
-->
		</div>
		<div class="bgA p10 cc">
		<span class="fr">
			<form action="apps.php?q=activity" method="GET">
			<input type="hidden" name="q" value="activity" />
			<input type="hidden" name="a" value="$a" />
			<input type="hidden" name="see" value="$see" />
<!--
EOT;
if ('feeslog' == $see) {print <<<EOT
-->
			<span class="mr10">活動名稱</span>
			<input class="mr10" type="text" size="10" name="activityname" value="$activityname" />
			<span class="mr10">交易者</span>
			<input class="mr10" type="text" size="10" name="otherpartyname" value="$otherpartyname" />
			<span class="mr10">活動狀態</span>
			$feesLogStatusSelectHtml
			<span class="bt2"><span><button type="submit" name="submit">搜索</button></span></span>
<!--
EOT;
} else {print <<<EOT
-->
			<select name="timerange" onchange="submit()">
				$timeSelectHtml
			</select>
<!--
EOT;
	if (empty($see)) {print <<<EOT
-->
			<select name="actmid" onchange="submit()">
				$actmidSelectHtml
			</select>
<!--
EOT;
	} else {print<<<EOT
-->
			<select name="type" onchange="submit()">
				<option value="0" $type_0>所有分類</option>
				<option value="1" $type_1>出游</option>
				<option value="2" $type_2>聚餐 </option>
				<option value="3" $type_3>舞會</option>
				<option value="4" $type_4>戶外</option>
				<option value="5" $type_5>燒烤</option>
				<option value="6" $type_6>其他</option>
			</select>
<!--
EOT;
	}
}print <<<EOT
-->
			</form>
		</span>
		<span class="f14 b s5 mr10">$seeTitle</span><span>(共{$count}個)</span>
		</div>
<!--
EOT;
if ('feeslog' == $see) {
	if (!empty($feesLog)) {print <<<EOT
-->
		<div class="p10">
			<table class="tr2" width="100%">
				<tr>
					<th width="15%">活動名稱/活動ID</th>
					<th width="12%">活動狀態</th>
					<th width="15%">創建時間</th>
					<th width="15%">交易者</th>
					<th width="8%">收入/支出</th>
					<th width="18%">費用</th>
					<th width="17%">說明</th>
				</tr>
<!--
EOT;
		foreach ($feesLog as $tid => $logs) {
			$rowspan = count($logs);
			$i = 0;
			foreach ($logs as $log) {
				$log[createtime] = str_replace(' ', '<br />', $log[createtime]);
print <<<EOT
-->
				<tr class="tr3">
<!--
EOT;
				$i++;
				if (1 == $i) {
print <<<EOT
-->
					<td class="tal" rowspan="$rowspan">
<!--
EOT;
					if (4 == $log['status']) {
print <<<EOT
-->
						$log[subject]
<!--
EOT;
					} else {
print <<<EOT
-->
						<a target="_blank" href="read.php?tid=$log[tid]">$log[subject]</a>
<!--
EOT;
					}
print <<<EOT
-->
						<div class="gray">活動ID︰$log[tid]</div>
					</td>
					<td rowspan="$rowspan">$log[statusText]</td>
<!--
EOT;
				}
print <<<EOT
-->
					<td class="f10">$log[createtime]</td>
					<td>$log[otherParty]</td>
					<td>$log[expenseOrIncome]</td>
					<td>$log[cost]元
<!--
EOT;
				if ($log['costtype']) {
print <<<EOT
-->
					（$log[costtype]）
<!--
EOT;
				}
print <<<EOT
-->
					</td>
					<td>$log[payDescription]</td>
				</tr>
<!--
EOT;
			}
		}
print <<<EOT
-->
			</table>
		</div>
		<div class="p10 cc">$pages</div>
<!--
EOT;
	} else {print <<<EOT
-->
		<div class="p15 f14 tac">沒有流通日志</div>
<!--
EOT;
	}
} else {
	if (!empty($activities)) {print <<<EOT
-->
<script type="text/javascript" src="js/global.js"></script>
<script type="text/javascript" src="js/app_global.js"></script>
<script type="text/javascript" src="apps/$appdir/js/activitytype.js"></script>
<script type="text/javascript">
function actRecommend(tid, actmid, obj) {
	var a = "$a";
	ajax.send("pw_ajax.php?action=activity&job=recommend&tid="+tid+"&actmid="+actmid,"",function(){
		var rText = ajax.request.responseText.split('\t');
		if (rText[0] == 'success') {
			var isRecommendOrNot;
			if (rText[1] != 1) {
				isRecommendOrNot = '推薦活動';
				var element = document.getElementById('activity_'+tid);
				if (element && a == "recommended") {
					element.parentNode.removeChild(element);
				}
			} else {
				isRecommendOrNot = '取消推薦';
			}
			obj.title = isRecommendOrNot;
			obj.innerHTML = isRecommendOrNot;
			showDialog('success','操作成功!',2);

		} else if (rText[0] == 'noright') {
			showDialog('error','您沒有推薦活動的權限',2);
			return false;
		} else {
			showDialog('error','操作失敗',2);
			return false;
		}
	});
}
</script>
		<div>
			<table width="100%">
<!--
EOT;
		foreach ($activities as $key => $value) {print <<<EOT
-->
				<tr class="tr3" id="activity_$key">
					<td>
						<h4 class="mb5 f14">
<!--
EOT;
			if (empty($see)) {
print <<<EOT
-->
							<a href="{$basename}a=$a&see=$see&actmid=$value[actmid]" class="s2">[{$activity_modeldb[$value[actmid]][name]}]</a>
<!--
EOT;
			} else {
				$activitydb = array(
					'1'=>'出游',
					'2'=>'聚餐 ',
					'3'=>'舞會',
					'4'=>'戶外',
					'5'=>'燒烤',
					'6'=>'其他',
				);
print <<<EOT
-->
							<a href="{$basename}a=$a&see=$see&type=$value[type]" class="s2">[{$activitydb[$value[type]]}]</a>
<!--
EOT;
			}
			if (empty($see)) {
print <<<EOT
-->
							<a target="_blank" href="read.php?tid=$value[tid]" class="b">$value[subject]</a>
<!--
EOT;
			} else {
print <<<EOT
-->
							<a target="_blank" href="apps.php?q=group&a=active&job=view&cyid=$value[cid]&id=$value[id]" class="b">$value[title]</a>
<!--
EOT;
			}
print <<<EOT
-->
						</h4>
						<p class="mb5">活動時間︰$value[starttime] 至 $value[endtime]</p>
						<p class="mb5">活動地點︰$value[location]</p>
						<p class="acSummary">
<!--
EOT;
			if (empty($see)) {
print <<<EOT
-->
							<a target="_blank" class="viewMore" href="read.php?tid=$value[tid]">查看活動詳情</a>
<!--
EOT;
			} else {
print <<<EOT
-->
							<a target="_blank" class="viewMore" href="apps.php?q=group&a=active&job=view&cyid=$value[cid]&id=$value[id]">查看活動詳情</a>
<!--
EOT;
			}
			if (empty($see)) {
				if ($isGM || $SYSTEM['delactive']) {
print <<<EOT
-->
							<a class="acDel" href="javascript:;" onclick="pwConfirm('是否確認刪除', this, function() {delActivity('$value[tid]')})">刪除活動</a>
<!--
EOT;
				}
				if ($isGM || $SYSTEM['recommendactive']) {
					$text = $value['recommend'] ? '取消推薦' : '推薦活動';
print <<<EOT
-->
							<a title="$text" class="acRecommend" href="javascript:;" onclick="actRecommend('$value[tid]', '$value[actmid]', this);">{$text}</a>
<!--
EOT;
				}
			}
print <<<EOT
-->
						</p>
					</td>
					<td width="28%">
						<p class="mb5">發起人︰
<!--
EOT;
			if ($value[authorid]) {
print <<<EOT
-->
							<a target="_blank" href="{$db_userurl}$value[authorid]">$value[author]</a>
<!--
EOT;
			} else {
print <<<EOT
-->
							<i>匿名</i>
<!--
EOT;
			}
print <<<EOT
-->
						</p>
						<p class="mb5">報名人數︰$value[signup]</p>
						$value[actionButton]
					</td>
				</tr>
<!--
EOT;
		}print <<<EOT
-->
			</table>
		</div>
		<div class="p10 cc">$pages</div>
<!--
EOT;
	} else {print <<<EOT
-->
		<div class="p15 f14 tac">暫無活動，你可以去看看推薦活動，或者去某個版塊或群組發起一個活動</div>
<!--
EOT;
	}
}
print <<<EOT
-->
	</div>
</td></tr></table>
</div>
<script type="text/javascript">setCurrent('see_$see','see_fromforum','b s5');</script>
<!--
EOT;
require_once(uTemplate::printEot('footer'));
?>-->