<?php require_once('./templates/overall_header.tpl.php'); ?>
	<div id="content">
		<?php if ($this->TPL['forum_info']['locked'] == false) { ?>
		<a href="index.php?mode=newtopic&amp;id=<?php echo $_GET['id']; ?>" class="btn">New Topic</a>
	<?php } else { ?>
			<div class="btn">
				Locked
			</div>
	<?php } ?>
		<br />
		<div class="forum_table">
			<div class="row">
				<div class="hc1"><?php echo $this->TPL['f_name']; ?></div>
				<div class="hc2" style="width: 150px">&nbsp;</div>
				<div class="hc3" style="width: 80px">&nbsp;</div>
				<div class="hc4">&nbsp;</div>
			</div>
			<div class="row">
				<div class="tc1 tab_desc">Topic name</div>
				<div class="tc2 tab_desc" style="width: 150px">Author</div>
				<div class="tc3 tab_desc" style="width: 80px">Replies</div>
				<div class="tc4 tab_desc">Last Post</div>
			</div>
	<?php 
	for ($i=0; $i<count($this->TPL['topics_list']); $i++)
	{
		echo '<div class="row">'."\n";
		$sticky = ($this->TPL['topics_list'][$i]['sticky']) ? '<span style="font-weight: bold">Sticky</span>: ' : '';
		echo "\t\t\t".'<div class="tc1"><a href="index.php?mode=viewtopic&amp;id='.$this->TPL['topics_list'][$i]['topic_id'].'">'.$sticky.$this->TPL['topics_list'][$i]['topic_title'].'</a></div>'."\n";
		echo "\t\t\t".'<div class="tc2" style="width: 150px">';
		if ($this->TPL['topics_list'][$i]['user_id'] != null)
			echo '<a href="index.php?mode=viewprofile&amp;id='.$this->TPL['topics_list'][$i]['user_id'].'">'.$this->colorRank($this->TPL['topics_list'][$i]['user_nick'], $this->TPL['topics_list'][$i]['user_rank']).'</a>';
		else
			echo 'Anonymous';
		echo '</div>'."\n";
		echo "\t\t\t".'<div class="tc3" style="width: 80px">'.($this->TPL['topics_list'][$i]['post_count']-1).'</div>'."\n";
			
		if ($this->TPL['topics_list'][$i]['lastpost_post_id'] != null)
		{
			$lastpost = '<span class="fsmall"> <span style="font-weight: bold">'.$this->TPL['topics_list'][$i]['lastpost_date'].'</span><br><a href="index.php?mode=viewtopic&amp;id='.$this->TPL['topics_list'][$i]['topic_id'].'#p'.$this->TPL['topics_list'][$i]['lastpost_post_id'].'" style="font-weight: bold">Post #'.$this->TPL['topics_list'][$i]['lastpost_post_id'].'</a>: ';
			if ($this->TPL['topics_list'][$i]['lastpost_user_id'] != null)
						$lastpost .= '<a href="index.php?mode=viewprofile&amp;id='.$this->TPL['topics_list'][$i]['lastpost_user_id'].'">'.$this->colorRank($this->TPL['topics_list'][$i]['lastpost_user_nick'], $this->TPL['topics_list'][$i]['lastpost_user_rank']).'</a>';
					else
						$lastpost .= 'Anonymous';	
					$lastpost .= '</span>';
		}
		else
		{
			$lastpost = 'No posts.';
		}
			
		echo "\t\t\t".'<div class="tc4">'.$lastpost.'</div>'."\n";
		echo "\t\t".'</div>'."\n";
	}
	?>
		
		
		<?php
		if (count($this->TPL['topics_list']) == 0)
		{
			echo '<div class="rcol">No topics in this forum.</div>';
		}
		?>
		</div>
		<br>
		<?php if ($this->TPL['forum_info']['locked'] == false) { ?>
		<a href="index.php?mode=newtopic&amp;id=<?php echo $_GET['id']; ?>" class="btn">New Topic</a>
	<?php } else { ?>
			<div class="btn">
				Locked
			</div>
	<?php } ?>
	</div>
	
<?php require_once('./templates/overall_footer.tpl.php'); ?>