<?php

// -----------------------------------------------------------------------
// This file is part of AROUNDMe
//
// Copyright (C) 2003 - 2007 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., 51 Franklin St, Fifth Floor, Boston, MA
// 02110-1301, USA.
// -----------------------------------------------------------------------

?>

<style type="text/css">
<!--
@import url(<?php echo $template_path_core;?>css/aroundme_form.css);
-->
</style>


<form action="index.php?amn=core_me_ties" method="post" name="frm" id="id_frm">

<div class="box">
	<div class="box_top">
		<div class="content">
			<h1><?php echo $lang['hdr_mutual_relations'];?></h1>
		</div>
	</div>

	<div class="box_mid">
		<div class="content">
			
			
			<?php
			if (isset($respected_mutual)) {
			?>
			<table cellspacing="2" cellpadding="2" border="0" width="100%">
				<?php
				$tdn = 1;
				
				foreach ($respected_mutual as $key => $i):
				if ($tdn == 1) {
					echo "<tr>";
				}
				?>
				<td width="25%" align="center" valign="top">
					<a href="index.php?amn=core_profile&amp;module_id=<?php echo $i['module_id'];?>&amp;item_id=<?php echo $i['item_id'];?>&amp;identity_id=<?php echo $i['identity']['identity_id'];?>"><b><?php echo $i['identity_nic'];?></b></a><br />
				
					<p>
						<a href="index.php?amn=core_profile&amp;module_id=<?php echo $i['module_id'];?>&amp;item_id=<?php echo $i['item_id'];?>&amp;identity_id=<?php echo $i['identity']['identity_id'];?>"><img class="picture" src="get_file.php?file=<?php echo $i['image']['file_md5_name_view'];?>" border="0" alt="<?php echo isset($i['image']['file_save_name']) ? $i['image']['file_save_name'] : $lang['alt_no_image'];?>" /></a><br />
					</p>
					
					<table width="80%">
					<tr>
						<td>respected you at: <?php echo $this->date->formatDate($i['relation']['mutual']['relation_create_datetime']); ?> <a href="<?php echo $i['item']['item_url']; ?>"><?php echo $i['item']['item_title']; ?></a></td>
						<td valign="right"><?php echo drawMatrix($i); ?></td>
					</tr>
					
					</table>
					
				</td>
				<?php
				if ($tdn == 4) {
					echo "</tr>";
					$tdn = 1;
				}
				$tdn++;
				endforeach;
				
				if ($tdn < 4) {
					$i = 4-$tdn;
					
					while ($i <= 4) {
  						echo "<td><br /></td>";
  						$i++;
					}
				}
 
				?>
			</table>
			<?php
			} else {
			?>
				<p>
					<?php echo $lang['err_no_ties'];?><br />
				</p>
			<?php }?>
		</div>
	</div>
</div>

<div class="box">
	<div class="box_top">
		<div class="content">
			<h1><?php echo $lang['hdr_relations'];?></h1>
		</div>
	</div>

	<div class="box_mid">
		<div class="content">
			<?php
			if (isset($respected)) {
			?>
			<table cellspacing="2" cellpadding="0" border="0" width="100%">
				<?php
				foreach ($respected as $key => $i): 
				?>
				<tr>
					<td width="32">
						<a href="index.php?amn=core_profile&amp;module_id=<?php echo $i['matrix'][0]['relation']['respected']['module_id'];?>&amp;item_id=<?php echo $i['matrix'][0]['relation']['respected']['item_id'];?>&amp;identity_id=<?php echo $i['matrix'][0]['identity_relation']['identity_id'];?>"><img src="get_file.php?file=<?php echo $i['identity']['image']['file_md5_name_view'];?>" border="0" alt="<?php echo isset($i['identity']['image']['file_save_name']) ? $i['identity']['image']['file_save_name'] : $lang['alt_no_image'];?>" /></a><br />
					</td>
					<td valign="top">
						<a href="index.php?amn=core_profile&amp;module_id=<?php echo $i['matrix'][0]['relation']['respected']['module_id'];?>&amp;item_id=<?php echo $i['matrix'][0]['relation']['respected']['item_id'];?>&amp;identity_id=<?php echo $i['matrix'][0]['identity_relation']['identity_id'];?>"><?php echo $i['matrix'][0]['identity_relation']['identity_nic'];?></a><br />
					</td>
					<td valign="top" align="left">
						<?php echo drawMatrix($i['matrix'][0]); ?>
						
					</td>
					
					<td valign="top" align="right">
						<input type="checkbox" name="identity_id_relation[]" value="<?php echo $i['identity_id_relation'];?>"/><br />
						<input type="hidden" name="identity_id[]" value="<?php echo $i['identity_id']; ?>" />
					</td>
				</tr>
				<?php
				endforeach;
				?>
			</table>
			
			<hr />
			
			<p align="right">
				<input type="submit" name="remove_respect" class="input_submit" value="<?php echo $lang['sub_remove_respect']; ?>" /><br />
			</p>
			<?php
			} else {
			?>
				<p>
					<?php echo $lang['err_no_portable'];?><br />
				</p>
			<?php }?>
		</div>
	</div>
</div>
</form>