<?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="<?php echo $_SERVER['PHP_SELF'];?>" method="post" name="tag" id="id_frm_tag">

<?php
if (isset($hidden_form)) {
	foreach($hidden_form as $key => $i):
?>
<input type="hidden" name="<?php echo $key?>" value="<?php echo $i;?>" />
<?php 
	endforeach;
}
?>
	
<div class="box_top">
	<?php echo $lang['hdr_tag'];?><br />
</div>

<div class="box_mid" style="padding: 9px;">

<?php
if (!isset($show_item)) {
?>
<table border="0" cellspacing="0" cellpadding="2">
	<tr>
		<td>
			<?php echo $lang['txt_tag_intro'];?><br/>
			
			<?php
			$tags = "";
			if (isset($my_tags)) {
				foreach ($my_tags as $key => $i):
					$tags .= $i['tag_body'];
					if (count($my_tags) > $key+1) {
						$tags .= ", ";
					}
				endforeach;
			}
			?>
			
			<php echo $lang['txt_tag_network'];?>
			
			
			<textarea cols="20" rows="2" name="tags"><?php echo $tags;?></textarea>
		</td>
	</tr>
	<tr>
		<td align="right">
			<input type="submit" name="update_tag" value="<?php echo $lang['sub_update_tag'];?>" class="button" /><br />
		</td>
	</tr>
</table>

<?php
}
if (isset($show_item)) {
?>
<p>
	<?php echo $lang['txt_tag_item'];?>:<br /> 
	
	<?php
	$tags = "";
	if (isset($item_tags)) {
		foreach ($item_tags as $key => $i):
			$tags .= "<a href='search.php?tag=" . $i['tag_body']. "'>" . $i['tag_body'] . "</a>";
			
			if ($i['user_id'] == $me['user_id']) {
				$tags .= "*";
			}
			
			if (count($item_tags) > $key+1) {
				$tags .= ", ";
			}
		endforeach;
		echo $tags;
	}
	?>
</p>
<?php }?>

<?php
if (isset($show_network)) {
?>
<p>
	<?php echo $lang['txt_tag_network'];?>:<br /> 
	
	<?php
	$tags = "";
	if (isset($network_tags)) {
		foreach ($network_tags as $key => $i):
			$tags .= "<a href='search.php?tag=" . $i['tag_body']. "'>" . $i['tag_body'] . "</a>";
			
			if ($i['user_id'] == $me['user_id']) {
				$tags .= "*";
			}
			
			if (count($network_tags) > $key+1) {
				$tags .= ", ";
			}
		endforeach;
		echo $tags;
	}
	?>
</p>
<?php }?>

<?php
if (isset($group) && isset($lang['txt_tag_group'])) {
?>
<hr />

<p>
	<?php echo $lang['txt_tag_group'];?>:<br />
	
	<?php
	$tags = "";
	if (isset($group_tags)) {
		foreach ($group_tags as $key => $i):
			$tags .= "<a href='search.php?group_id=" . $group['group_id'] . "&amp;tag=" . $i['tag_body']. "'>" . $i['tag_body'] . "</a>";
			
			if ($i['user_id'] == $me['user_id']) {
				$tags .= "*";
			}
			
			if (count($group_tags) > $key+1) {
				$tags .= ", ";
			}
		endforeach;
		echo $tags;
	}
	?>
</p>
<?php }?>
	
</div>

<div id="box_bottom">
	<table cellpadding="0" cellspacing="0" border="0" width="100%">
		<tr>
			<td align="left">
				<img src="<?php echo $templatePath;?>img/box_bottom_left.png" width="5" height="18" alt="" border="0" /><br />
			</td>
			<td align="left">
				<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="9" alt="" border="0" /><br />
			</td>
			<td align="right">
				<img src="<?php echo $templatePath;?>img/box_bottom_right.png" width="5" height="18" alt="" border="0" /><br />
			</td>
		</tr>
	</table>
</div>
</form>