<?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">
		<?php echo $lang['hdr_relations_portable'];?><br />
	</div>

	<div class="box_mid">
		<div class="content">
			<p align="right">
				<img src="<?php echo $template_path_core;?>img/help.png" style="cursor:help;"  title="<?php echo $lang['txt_help'];?>" hspace="2" alt="" border="0" onClick="javascript:launchPopupWindow('components/core/help.php?help=core_ties');" />
			</p>
			
			<?php
			if (isset($portable_ties)) {
			?>
			<table cellspacing="2" cellpadding="2" border="0" width="100%">
				<?php
				$tdn = 1;
				
				foreach ($portable_ties 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_id_relation'];?>"><b><?php echo $i['identity']['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_id_relation'];?>"><img src="get_file.php?file=<?php echo $i['identity']['image']['file_md5_name_view'];?>" border="0" alt="<?php echo $i['identity']['image']['file_title'];?>" /></a><br />
					</p>
					
					<p>
						<?php echo $i['identity']['location_name'];?><br />
						<?php echo $this->date->formatDate($i['identity']['user_create_datetime']);?><br />
						<?php echo $lang['user_online_status'][$i['identity']['online_status']];?><br />
					</p>
					
					<p>
						<?php 
						if ($i['common_ties']) { 
						?>
						<a href="index.php?amn=core_tie_matrix&amp;identity_id=<?php echo $i['identity_id']; ?>&amp;identity_id_relation=<?php echo $i['identity']['identity_id'];?>"><span class="icon_frame">
						<span class="icon_title">ties:</span>
						<span class="icon_value"><?php if (isset($i['common_ties'])) echo $i['common_ties']['count_strong'];?></span>
						<span class="icon_value"><?php if (isset($i['common_ties'])) echo $i['common_ties']['count_weak'];?></span>
						</span>
						</a>
						<br />
						<?php } ?>
					</p>	
					
					<p>
						<?php
						if ($i['module_id'] > 0) {
						?>
						<a href="index.php?amn=<?php echo $core_config['module'][$i['module_id']]['prefix'];?>_overview">
						<?php echo $lang['arr_module'][$i['module_id']];?></a><br />
						<?php }?>
						
						<?php
						if (!empty($i['mutual'])) {
							echo $lang['txt_mutual'];
						}
						
						if (!empty($i['relation_portable'])) {
							echo "<sup>*</sup>";
						}
						?><br />
					</p>			
				</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 }?>
		</div>
	</div>
</div>

<div class="box_bottom">
	<span class="box_bottom_right"></span>
	<span class="box_bottom_left"></span>
</div>


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

	<div class="box_mid">
		<div class="content">		
			<?php
			if (isset($ties)) {
			?>
			<table cellspacing="2" cellpadding="0" border="0" width="100%">
				<?php
				foreach ($ties as $key => $i):
				?>
				<tr>
					<td width="32">
						<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_id_relation'];?>"><img src="get_file.php?file=<?php echo $i['identity']['image']['file_md5_name_view'];?>" border="0" alt="<?php echo $i['identity']['image']['file_title'];?>" /></a><br />
					</td>
					<td valign="top">
						<a href="index.php?amn=profile&amp;module_id=<?php echo $i['module_id'];?>&amp;item_id=<?php echo $i['item_id'];?>&amp;identity_id=<?php echo $i['identity_id_relation'];?>"><?php echo $i['identity']['identity_nic'];?></a><br />
					</td>
					<td valign="top">
						<?php
						if ($i['module_id'] > 0) {
						?>
						<a href="index.php?amn=<?php echo $core_config['module'][$i['module_id']]['prefix'];?>_overview">
						<?php echo $lang['arr_module'][$i['module_id']];?>
						<?php }?>
						<br />
						
					</td>
					<td valign="top">
						<?php
						if (!empty($i['mutual'])) {
							echo $lang['txt_mutual'];
						}
						
						if (!empty($i['relation_portable'])) {
							echo "<sup>*</sup>";
						}
						?><br />
					</td>
					<td valign="top" align="right">
						<?php
						$checked = "";
						
						if (!empty($i['relation_portable'])) {
							$checked = "checked=\"checked\"";				
						}
						?>
						<input type="checkbox" name="identity_id_portable[][<?php echo $i['module_id'];?>][<?php echo $i['item_id'];?>]" value="<?php echo $i['identity_id_relation'];?>" <?php echo $checked;?> /><br />
					</td>
				</tr>
				<?php
				endforeach;
				?>
			</table>
			
			<hr />
			
			<p align="right">
				<input type="submit" name="set_portable" class="input_submit" value="<?php echo $lang['sub_set_portable'];?>" /><br />
			</p>
			<?php }?>
		</div>
	</div>
</div>

<div class="box_bottom">
	<span class="box_bottom_right"></span>
	<span class="box_bottom_left"></span>
</div>

</form>
