<!--<?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'));
?>-->