<?php $this->widget('bbs.widgets.web.HeaderWidget',array('title'=>$forum['name'].' - '.setting('webname')));?>
<style type="text/css">
h1, h2, h3, h4, h5, h6 {
    font-size: 100%;
    font-weight: normal;
}
strong {
	font-weight: bold;
}
.forum table, th, td {
    border-bottom: 1px dashed #E9F4E9;
    margin-top: 4px;
}
.forum table tr {
    border: 1px solid #E9F4E9;
}
.forum caption {
    height: 30px;
    line-height: 30px;
    text-align: left;
    background-color: #E9F4E9;
    padding: 2px 10px 0;
    font-weight: bold;
}
.forum a {
	font-size: 14px;
}
.forum th {
	height: 24px;
	color: #999999;
}
.forum tr {
	height: 36px;
}
.forum .forum_img {
	width: 10px;
	padding: 4px;
}
.forum #nomal {
	height:22px;
	background-color:#EEEEEE;
}
.thread_subject {
	padding-left:6px;
}

.p_pop li {
	display: block;
	line-height: 20px;
	margin-left: 6px;
}
#newspecial_menu {
    width: 60px;
}
.p_pop, .p_pof {
    background: none repeat scroll 0 0 #FEFEFE;
    border: 1px solid #DDDDDD;
    padding: 5px 0;
}
tr.over td {
	background:#F3F9FB;
}
.xi1 {
	color: #F26C4F;
}
.xs1 {
	padding-left:10px;
}
.xs2 {
	font-size: 14px;
}
h1 {
    display: inline;
    font-weight: 700;
}
.forum_info {
	border: 1px solid #E9F4E9;
}
.pbn {
	padding-bottom: 5px !important;
}
.fititle {
    background: none repeat scroll 0 0 transparent;
    border: medium none;
    padding-top: 5px;
    height: 31px;
    line-height: 31px;
    overflow: hidden;
    padding: 0 10px;
    white-space: nowrap;
}
.ficontent {
	padding: 10px;
	padding-top: 0px;
}
.simage {
	vertical-align: middle;
}
.threadpages a {
	color: #666666;
    padding: 2px 2px;
    font-size: 12px;
}
.small {
	color:#999999;
	font-size:11px;
}
</style>

<?php
$topArray = $threadArray = array();
foreach ($threads as $thread)
{
    if ($thread['topped'])
    {
        $topArray[] = $thread;
    }
    else
    {
        $threadArray[] = $thread;
    }
}
?>
<div id="forum_nav"><?php echo $this->nav($forum['fid']);?></div>

<div class="clear"></div>

<div class="forum_info">
	<div class="fititle"><h1 class="xs2"><?php echo $forum['name'];?></h1><span class="xs1 xw0 i">今日: <strong class="xi1"><?php echo $forum['todayposts'];?></strong><span class="pipe"> | </span>主题: <strong class="xi1"><?php echo $forum['threads'];?></strong></span> | </span>贴数: <strong class="xi1"><?php echo $forum['posts'];?></strong></span>
	</div>
	
	<div class="ficontent">
		<?php if (!empty($forum['forumadmin'])):?>
			<?php $forumAdmins = explode(',', trim($forum['forumadmin'],','));?>
			<?php foreach ($forumAdmins as $admin):?>
				<?php $names[] = userName($admin);?>
			<?php endforeach;;?>
			<div class="pbn">版主:<?php echo implode(',', $names);?></div>
		<?php endif;?>
		
		<?php if (!empty($forum['rule'])):?>
			<div><?php echo $this->ubbCode($forum['rule']);?></div>
		<?php endif;?>
	</div>
</div>

<div class="clear"></div>
<div class="brbr"></div>
<div class="pages">	
	<div class="pages_left" style="float:left;">
		<?php $this->widget('bbs.widgets.web.PaginationWidget',array('totalRecord'=>$pageObj->getTotalRecord(),'pageSize'=>$pageObj->getPageSize()));?>
	</div>
	<div class="postmenu" style="float:right">
		<ul>
			<li><a href="<?php echo $this->url('system',array('s'=>'bbs','c'=>'thread','a'=>'post','fid'=>$fid));?>">发贴</a>
				<ul>
					<li><a href="<?php echo $this->url('system',array('s'=>'bbs','c'=>'thread','a'=>'post','fid'=>$fid));?>">发表帖子</a></li>
				</ul>
			</li>
		</ul>
	</div>
</div>

<script type="text/javascript">
$(function() {
	$('.postmenu li').has('ul').find('a:first').append('<span></span>');
	$('.postmenu li').hover(
		function(){$(this).find('ul').stop(true,true).slideDown(0);},
		function(){$(this).find('ul').stop(true,true).slideUp(0);
	});
	$(".forum tr").mouseover(function(){
		$(this).addClass("over");}).mouseout(function(){
		$(this).removeClass("over")});
});
</script>

<ul style="position: absolute; z-index: 301; top: 174px; left: 1065px; display: none;" id="newspecial_menu" class="p_pop">
	<li><a href="<?php echo $this->url('system',array('s'=>'bbs','c'=>'thread','a'=>'post','fid'=>$fid));?>">发表帖子</a></li>
</ul>
<div class="clear"></div>
<div class="forum">
	<div id="thread_list">
		<table>
			<?php if ($forum['t_type'] && !empty($typeList)):?>
				<tr>
				<td colspan="5" style="padding-left:10px;"><?php foreach ($typeList as $type):?><?php echo ilink($type['name'],$this->url('system',array('s'=>'bbs','a'=>'forum','fid'=>$fid,'filter'=>'type','typeid'=>$type['id'])));?> <?php endforeach;;?></td>
				</tr>
			<?php endif;?>
			<tr>
    	    	<th colspan="2" style="text-align:center;">主题</th>
		        <th class="forum_admin">作者</th>
    	    	<th class="forum_reply">回复</th>
        		<th class="forum_last">最后发表</th>
		    </tr>
		    
		    <?php if (!empty($topArray)):?>
		        <?php foreach ($topArray as $top):?>
		    		<tr>
        				<td class="forum_img"><a href="<?php echo $this->url('system',array('s'=>'bbs','a'=>'thread','tid'=>$top['id']));?>" title="新窗口打开" target="_blank"><?php echo printImage('bbs/web/top_'.$top['topped'].'.gif');?></a></td>
        				<td class="thread_subject"><a href="<?php echo $this->url('system',array('s'=>'bbs','a'=>'thread','tid'=>$top['id']));?>" target="_blank"><?php echo str_replace('&amp;', '&', $this->filter(sFilter($top['subject'])));?></a><?php if ($top['isupload']):?> <img src="<?php echo getImageFile('bbs/web/filetype/'.getFileTypeImage($top['isupload']));?>" /><?php endif;?><?php if ($top['date'] == CDATE):?>New<?php endif;?><?php if ($top['isdigest']):?> <?php echo printImage('bbs/web/digest.gif', '精华', '精华');?><?php endif;?>  <?php if ($top['spagination']):?><span class="threadpages"><?php echo $top['spagination'];?></span><?php endif;?></td>
        				<td><?php echo $top['username'];?><br/><span class="small"><?php echo date('Y-m-d', $top['createdate']);?></span></td>
        				<td><?php echo $top['replies'];?>/<?php echo $top['hits'];?></td>
        				<td><?php echo $top['lastpost_user'];?><br/><span class="small"><?php echo time2Units($top['lastpost']);?> »</span></td>
    				</tr>
		        <?php endforeach;?>
		        <tr id="nomal"><td colspan="5" style="text-align:center;">普通主题</td></tr>
		    <?php endif;?>
		    
		    <?php foreach ($threadArray as $thread):?>
    			<tr>
    				<td class="forum_img"><a href="<?php echo $this->url('system',array('s'=>'bbs','a'=>'thread','tid'=>$thread['id']));?>" title="新窗口打开" target="_blank"><?php if ($thread['islock']):?><?php echo printImage('bbs/web/folder_lock.gif');?><?php else:?><?php echo printImage('bbs/web/folder_new.gif');?><?php endif;?></a></td>
    				<td class="thread_subject"><?php echo str_replace(array('&lt;','&gt;'), array('[',']'), $thread['type']);?> <a href="<?php echo $this->url('system',array('s'=>'bbs','a'=>'thread','tid'=>$thread['id']));?>" target="_blank"><?php echo str_replace('&amp;', '&', $this->filter(sFilter($thread['subject'])));?></a> <?php if ($thread['rating']):?>[<span class="xi1">+<?php echo $thread['ratings'];?></span>]<?php endif;?> <?php if ($thread['isupload']):?> <img src="<?php echo getImageFile('bbs/web/filetype/'.getFileTypeImage($thread['isupload']));?>" /><?php endif;?><?php if ($thread['date'] == CDATE):?> <a class="xi1" href="<?php echo url('system',array('s'=>'bbs','c'=>'post','a'=>'last','tid'=>$thread['id']));?>">New</a><?php endif;?><?php if ($thread['isdigest']):?> <?php echo printImage('bbs/web/digest.gif', '精华', '精华');?><?php endif;?> <?php if ($thread['hits'] > 200 && $thread['replies'] > 20):?><?php echo printImage('bbs/web/hot_1.gif', '热门', '热门');?><?php endif;?> <?php if (1 == $thread['special']):?><?php echo printImage('bbs/web/pollsmall.gif','投票','投票');?><?php elseif (2 == $thread['special']):?>[赏]<?php elseif (3 == $thread['special']):?>[售]<?php endif;?> <?php if ($thread['spagination']):?><span class="threadpages"><?php echo $thread['spagination'];?></span><?php endif;?></td>
    				<td><?php echo $thread['username'];?><br/><span class="small"><?php echo date('Y-m-d', $thread['createdate']);?></span></td>
    				<td><?php echo $thread['replies'];?>/<?php echo $thread['hits'];?></td>
    				<td><?php echo $thread['lastpost_user'];?><br/><span class="small"><?php echo time2Units($thread['lastpost']);?>前 »</span></td>
    			</tr>
			<?php endforeach;?>
		</table>
	</div>
</div>

<div class="clear"></div>
<?php $this->widget('bbs.widgets.web.PaginationWidget',array('totalRecord'=>$pageObj->getTotalRecord(),'pageSize'=>$pageObj->getPageSize()));?>

<?php $this->widget('bbs.widgets.web.FooterWidget');?>