{include file='common/header' /}
<div class="row">
	<div class="col-md-3">
		{include file='user/left' /}
	</div>
	<div class="col-md-9">
		<div class="panel panel-default">
			<div class="panel-body">
				<h1>我的帖子</h1>
				<hr>
				{php}
					$order = input('order','id');
					$sort = input('sort','desc');
					$order = in_array($order,['id','rethread_time','views','rethreads'])?$order:'id';
					$sort = in_array($sort,['desc','asc'])?$sort:'desc';
					$lists = \app\forum\model\Thread::with('forum,user') -> where(['user_id'=>\think\Session::get('user_id')]) -> order($order.' '.$sort) -> paginate(15);
					$page = $lists -> render();
				{/php}
				<table class="table table-bordered table-hover" style="table-layout: fixed;">
					<tr>
						<th>标题</th>
						<th style="width: 140px;" class="hidden-xs">
							<a href="{:url('thread',['order'=>'id','sort'=>'desc'])}">发帖时间</a>
						</th>
						<th style="width: 50px;" class="hidden-xs">
							<a href="{:url('thread',['order'=>'views','sort'=>'desc'])}">阅读</a>
						</th>
						<th style="width: 50px;" class="hidden-xs">
							<a href="{:url('thread',['order'=>'rethreads','sort'=>'desc'])}">跟帖</a>
						</th>
						<th style="width: 140px;" class="hidden-xs">
							<a href="{:url('thread',['order'=>'rethread_time','sort'=>'desc'])}">最后回帖</a>
						</th>
					</tr>
					{foreach name='lists' item='vo'}
					<tr>
						<td><a href="{$vo.forum.url}" class="text-muted">[{$vo.forum.title}]</a>&nbsp;<a href="{$vo.url}" style="{$vo.style}">{$vo.title}</a></td>
						<td class="hidden-xs">{$vo.create_time|date='Y-m-d H:i',###}</td>
						<td class="hidden-xs">{$vo.views}</td>
						<td class="hidden-xs">{$vo.rethreads2}</td>
						<td class="hidden-xs">{$vo.rethread_time|date='Y-m-d H:i',###}</td>
					</tr>
					{/foreach}
				</table>
				{$page}
			</div>
		</div>
	</div>
</div>
{include file='common/footer' /}