<?php

// -----------------------------------------------------------------------
// This file is part of aroundme
// 
// Copyright (C) 2003, 2005 Barnraiser
// http://www.barnraiser.org/
// info@barnraiser.org
// 
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option) any
// later version.
// 
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with program; see the file COPYING. If not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
// -----------------------------------------------------------------------

?>


<form action="g_forum_topic_edit.php" method="post">
<input type="hidden" name="group_id" value="<?php echo $group['group_id'];?>">

<table width="770" border="0" cellspacing="0" cellpadding="4">
	<tr>

		<td width="180" valign="top">
			<?php
			include $templatePath . "g_menu.inc.tpl.php";
			?>
			
			<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="52" alt="" /><br />

			<?php
			include $templatePath . "logo.inc.tpl.php";
			?>
			
			
		</td>

		<td width="20">&nbsp;</td>

		<td width="570" valign="top">
			<table border="0" cellspacing="0" cellpadding="4" width="100%">
				<tr>
					<td colspan="3" class="txt_title" align="right">
						<?php echo $lang['hdr_topics'];?><br />
						<hr />
					</td>
				</tr>
				<?php 
				if (isset($topics)) {
				foreach($topics as $key => $i): ?>
				<tr>
					<td>
						<a href="g_forum_topic_edit.php?group_id=<?php echo $group['group_id'];?>&amp;topic_id=<?php echo $i['topic_id'];?>"><?php echo $i['topic_title'];?></a><br />
					</td>
					<td align="right">
						<?php if ($i['topic_hidden'] == 1) { echo $lang['txt_hidden'];}?><br />
					</td>
				</tr>
				<tr>
					<td colspan="2" class="txt_footer">
						<?php echo $i['topic_synopsis'];?><br />
					</td>
				</tr>
				<?php 
				endforeach; 
				}
				else {
				?>
				<tr>
					<td>
						<?php echo $lang['err_no_topics'];?><br />
					</td>
				</tr>
				<?php }?>
			</table>

			<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />
			
			<table border="0" cellspacing="0" cellpadding="4" width="100%">
				<tr>
					<td class="txt_title" align="right">
						<?php
						if (isset($topic)) {
							echo $lang['hdr_edit_topic'];
						}
						else {
							echo $lang['hdr_add_topic'];
						}
						?><br />
						<hr />
					</td>
				</tr>
				<tr>
					<td>
						<b><?php echo $lang['txt_topic_title'];?></b><br />
					</td>
				</tr>
				<tr>
					<td>
						<input type="text" name="data[topic_title]" size="40" class="formInput" value="<?php if (isset($topic['topic_title'])) { echo $topic['topic_title'];}?>" /><br />
					</td>
				</tr>
				<tr>
					<td>
						<b><?php echo $lang['txt_topic_synopsis'];?></b><br />
					</td>
				</tr>
				<tr>
					<td>
						<input type="text" name="data[topic_synopsis]" size="40" maxlength="255" class="formInput" value="<?php if (isset($topic['topic_synopsis'])) { echo $topic['topic_synopsis'];}?>"><br />
					</td>
				</tr>
				<?php
				if ($this->group_acs->checkPermission($resource_ids['group_forum'], $privilege_ids['allow_hidden'])) { //resource_id, Priv_id
				?>
				<tr>
					<td>
						<b><?php echo $lang['txt_hidden'];?></b><br />
						<span class="txt_footer"><?php echo $lang['txt_hidden_help'];?></span><br />
					</td>
				</tr>
				<tr>
					<td>
						<input type="checkbox" name="data[topic_hidden]" value="1" <?php if (isset($topic['topic_hidden']) && $topic['topic_hidden'] == 1) { echo "checked=\"checked\"";}?> />&nbsp;<?php echo $lang['txt_hidden'];?><br />
					</td>
				</tr>
				<?php  }?>
				<tr>
					<td align="right">
						<?php
						if (isset($topic)) {
						?>
						<input type="hidden" name="data[topic_id]" value="<?php echo $topic['topic_id'];?>" />
						<input type="submit" name="edit_topic" class="formInput" value="<?php echo $lang['sub_update'];?>" /><br />
						<?php
						}
						else {
						?>
						<input type="submit" name="insert_topic" class="formInput" value="<?php echo $lang['sub_insert'];?>"><br />
						<?php }?>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
</form>