<?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="sn_profile.php" method="post">
<input type="hidden" name="user_id" value="<?php echo $profile['user_id'];?>" />

<table width="770" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td width="180" valign="top">
			<?php
			include $templatePath . "sn_menu.inc.tpl.php";
			?>

			<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />

			<table border="0" cellspacing="0" cellpadding="4" width="100%">
				<tr class="table_stnd">
					<td class="txt_title">
						<?php echo $lang['section_action'];?><br />
						<hr />
					</td>
				</tr>
				<tr>
					<td>
						<?php
						if (isset($display) && $display == "blocked") {
						?>
						<a href="sn_profile.php?user_id=<?php echo $profile['user_id'];?>&amp;unblock=1" class="txt_sub_menu"><?php echo $lang['href_unblock'];?></a><br />
						<?php
						}
						elseif (isset($display) && $display == "block") {
						?>
						<table width="100%" cellpadding="4" cellspacing="0" border="0">
			   				<tr>
								<td>
									<b><?php echo $lang['hdr_block'];?></b><br />
									<?php echo $lang['txt_block_description_text'];?><br />
								</td>
							</tr>
							<tr>
								<td>
									<textarea rows="3" cols="25" name="data[block_description]" class="formInput"></textarea><br />
								</td>
							</tr>
							<tr>
								<td align="right">
									<input type="submit" name="set_block" value="<?php echo $lang['sub_block'];?>" class="formInput" /><br />
									<br />
								</td>
							</tr>
						</table>
						<?
						}
						elseif (isset($profile['user_id']) && $profile['user_id'] != $me['user_id']) {
						?>
						<a href="sn_profile.php?user_id=<?php echo $profile['user_id'];?>&amp;block=1" class="txt_sub_menu"><?php echo $lang['href_block'];?></a><br />
						<?
						}
						?>
					</td>
				</tr>
			</table>

			<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="370" valign="top">
			<table width="100%" cellpadding="4" cellspacing="0" border="0" class="table_stnd">
				<tr>
					<tr>
					<td colspan="2" class="txt_title" align="right">
						<?php echo $lang['hdr_summary'];?><br />
						<hr />
					</td>
				</tr>
				<tr>
					<td valign="top">
						<?php echo $profile['profile_summary'];?><br />
					</td>
				</tr>
			</table>

			<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />

			<table width="100%" cellpadding="4" cellspacing="0" border="0" class="table_stnd">
				<tr>
					<tr>
					<td class="txt_title" align="right">
						<?php echo $lang['hdr_relationship'];?><br />
						<hr />
					</td>
				</tr>
				<?php
				if (isset($relationship_paths)) {
				foreach($relationship_paths as $key => $r):
				?>
				<tr>
					<td>
						<table cellpadding="0" cellspacing="4" border="0" class="table_nested">
							<tr>
								<?php
								foreach($r['relation'] as $key1 => $i):
								?>
								<td>
									<?php 
									if ($i == $me['user_id']) {
									    echo "me<br />";
									}
									else {
										foreach($relationship_profiles as $keyrp => $rp):
											if ($i == $rp['user_id']) {
												
												if (count($r['relation']) > $key1+1) {
													echo "<a href=\"sn_profile.php?user_id=" . $rp['user_id'] . "\">" . $rp['profile_nic'] . "</a><br />";
												}
												else {
													echo $rp['profile_nic'] . "<br />";
												}
												
												break;
											}
										endforeach;
									}
									?>
								</td>
								<?php
								if (count($r['relation']) > $key1+1) {
									echo "<td>-&#62;<br /></td>";
								}
								?>
								<?php 
								endforeach;
								?>
							</tr>
						</table>
					</td>
				</tr>
				<?
				endforeach;
				}
				?>
			</table>

			<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />
			
			<table width="100%" cellpadding="4" cellspacing="0" border="0" class="table_stnd">
				<tr>
					<tr>
					<td colspan="2" class="txt_title" align="right">
						<?php echo $lang['hdr_contact'];?><br />
						<hr />
					</td>
				</tr>
				<?php
				if (!empty($lang['txt_profile_text1'])) {
				?>
				<tr>
					<td>
						<?php echo $lang['txt_profile_text1'];?><br />
					</td>
					<td>
						<?php echo $profile['profile_text1'];?><br />
					</td>
				</tr>
				<?php }?>
				
				<?php
				if (!empty($lang['txt_profile_text2'])) {
				?>
				<tr>
					<td>
						<?php echo $lang['txt_profile_text2'];?><br />
					</td>
					<td>
						<?php echo $profile['profile_text2'];?><br />
					</td>
				</tr>
				<?php }?>
				
				<?php
				if (!empty($lang['txt_profile_text3'])) {
				?>
				<tr>
					<td>
						<?php echo $lang['txt_profile_text3'];?><br />
					</td>
					<td>
						<?php echo $profile['profile_text3'];?><br />
					</td>
				</tr>
				<?php }?>
				
				<?php
				if (!empty($lang['txt_profile_text4'])) {
				?>
				<tr>
					<td>
						<?php echo $lang['txt_profile_text4'];?><br />
					</td>
					<td>
						<?php echo $profile['profile_text4'];?><br />
					</td>
				</tr>
				<?php }?>
				
				<?php
				if (!empty($lang['txt_profile_text5'])) {
				?>
				<tr>
					<td>
						<?php echo $lang['txt_profile_text5'];?><br />
					</td>
					<td>
						<?php echo $profile['profile_text5'];?><br />
					</td>
				</tr>
				<?php }?>
				
				<?php
				if (!empty($lang['txt_profile_text6'])) {
				?>
				<tr>
					<td>
						<?php echo $lang['txt_profile_text6'];?><br />
					</td>
					<td>
						<?php echo $profile['profile_text6'];?><br />
					</td>
				</tr>
				<?php }?>
				
				<?php
				if (!empty($lang['txt_profile_text7'])) {
				?>
				<tr>
					<td>
						<?php echo $lang['txt_profile_text7'];?><br />
					</td>
					<td>
						<?php echo $profile['profile_text7'];?><br />
					</td>
				</tr>
				<?php }?>
				
				<?php
				if (!empty($lang['txt_profile_text8'])) {
				?>
				<tr>
					<td>
						<?php echo $lang['txt_profile_text8'];?><br />
					</td>
					<td>
						<?php echo $profile['profile_text8'];?><br />
					</td>
				</tr>
				<?php }?>
				
				<?php
				if (!empty($lang['txt_profile_text9'])) {
				?>
				<tr>
					<td>
						<?php echo $lang['txt_profile_text9'];?><br />
					</td>
					<td>
						<?php echo $profile['profile_text9'];?><br />
					</td>
				</tr>
				<?php }?>
				
				<?php
				if (!empty($lang['txt_profile_text10'])) {
				?>
				<tr>
					<td>
						<?php echo $lang['txt_profile_text10'];?><br />
					</td>
					<td>
						<?php echo $profile['profile_text10'];?><br />
					</td>
				</tr>
				<?php }?>
			</table>
		</td>

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

		<td width="180" valign="top">
			<table border="0" cellspacing="0" cellpadding="4" width="100%" class="table_stnd">
				<tr>
					<td class="txt_title" align="right">
						<?php echo $lang['hdr_profile'];?><br />
						<hr />
					</td>
				</tr>
				<tr>
					<td>
						<table border="0" cellspacing="2" cellpadding="4" width="100%" class="picture">
							<tr>
								<td class="bg1" colspan="2">
									<?php echo $profile['profile_nic'];?><br />
								</td>
							</tr>
							<tr>
								<td colspan="2">
									<img src="get_file.php?file=<?php echo $profile['image']['file'];?>" border="0" alt="<?php echo $profile['image']['file_title'];?>" /><br />
								</td>
							</tr>
							<tr>
								<td class="bg3">
									<span class="txt_footer">
									<?php echo $lang['txt_profile_session_status'];?><br />
									</span>
								</td>
								<td class="bg4">
									<?php
									if ($profile['online_status'] == 1) {
									    echo "<b>" . $lang['arr_user_online_status'][1] . "</b><br />";
									}
									else {
										    echo "<span class=\"txt_footer\">" . $lang['arr_user_online_status'][$profile['online_status']] . "</span><br />";
									}
									?>
								</td>
							</tr>
							<tr>
								<td class="bg3">
									<span class="txt_footer">
									<?php echo $lang['txt_profile_hometown'];?><br />
									</span>
								</td>
								<td class="bg4">
									<span class="txt_footer">
									<?php echo $profile['profile_hometown'];?><br />
									</span>
								</td>
							</tr>
							<tr>
								<td class="bg3">
									<span class="txt_footer">
									<?php echo $lang['txt_profile_create_datetime'];?><br />
									</span>
								</td>
								<td class="bg4">
									<span class="txt_footer">
									<?php echo $profile['profile_create_datetime'];?><br />
									</span>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
			
			<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />

			<table border="0" width="100%" cellspacing="0" cellpadding="4" class="table_stnd">
				<tr>
					<td colspan="2" class="txt_title" align="right">
						<?php echo $lang['hdr_statistics'];?><br />
						<hr />
					</td>
				</tr>
				<?php
				if (isset($profile_statistic)) {
				foreach($profile_statistic as $key => $i):
				?>
				<tr>
					<td>
						<span class="txt_footer"><?php echo $lang['arr_user_statistic_type_id'][$i['statistic_type_id']];?></span><br />
					</td>
					<td align="right">
						<span class="txt_footer"><?php echo $i['total'];?></span><br />
					</td>
				</tr>
				<?php
				endforeach;
				} else {
				?>
				<tr>
					<td colspan="2">
						<?php echo $lang['err_no_statistics'];?><br />
					</td>
				</tr>
				<?php }?>
			</table>
		</td>
	</tr>
</table>
</form>
