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

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

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

		<td width="560" valign="top">
			<?php
			if (isset($display) && $display == "view_user") {
			?>
			<div class="box_top">
				<?php echo $lang['section_user'];?><br />
			</div>
			
			<div class="box_mid" style="padding: 9px;">
			<table width="100%" cellpadding="4" cellspacing="0" border="0">
				<tr>
					<td colspan="2">
						<b><?php echo $user['user_firstname'] . " " . $user['user_surname'];?></b><br />
					</td>
				</tr>
				<tr>
					<td width="40%">
						<?php echo $lang['txt_user_id'];?><br />
					</td>
					<td width="60%">
						<?php echo $user['user_id'];?><br />
					</td>
				</tr>
				<tr>
					<td width="40%">
						<?php echo $lang['txt_user_number'];?><br />
					</td>
					<td width="60%">
						<?php echo $user['user_number'];?><br />
					</td>
				</tr>
				<tr>
					<td>
						<?php echo $lang['txt_user_email'];?><br />
					</td>
					<td>
						<a href="mailto:<?php echo $user['user_email'];?>"><?php echo $user['user_email'];?></a><br />
					</td>
				</tr>
				<tr>
					<td>
						<?php echo $lang['txt_hometown'];?><br />
					</td>
					<td>
						<?php echo $user['user_hometown'];?><br />
					</td>
				</tr>
				<tr>
					<td>
						<?php echo $lang['txt_dob'];?><br />
					</td>
					<td>
						<?php echo $user['user_dob'];?><br />
					</td>
				</tr>
				<tr>
					<td>
						<?php echo $lang['txt_gender'];?><br />
					</td>
					<td>
						<?php echo $user['user_gender'];?><br />
					</td>
				</tr>
				<tr>
					<td>
						<?php echo $lang['txt_language'];?><br />
					</td>
					<td>
						<?php echo $lang['arr_lang_name'][$user['language_id']];?><br />
					</td>
				</tr>
				<tr>
					<td>
						<?php echo $lang['txt_status'];?><br />
					</td>
					<td>
						<?php echo $lang['arr_user_status'][$user['status_id']];?><br />
					</td>
				</tr>
				<tr>
					<td>
						<?php echo $lang['txt_role'];?><br />
					</td>
					<td>
						<?php echo $lang['arr_acs']['role'][$user['role_id']];?><br />
					</td>
				</tr>
				<tr>
					<td>
						<?php echo $lang['txt_user_create_datetime'];?><br />
					</td>
					<td>
						<?php echo $user['display_user_create_datetime'];?><br />
					</td>
			    </tr>
				<tr>
					<td>
						<?php echo $lang['txt_file_allocation'];?><br />
					</td>
					<td>
						<?php echo round($user['user_file_allocation']/1000, 2);?>kb<br />
					</td>
			    </tr>
			</table>
			</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>
			
			<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="6" alt="" /><br />
			
			<div class="box_top">
				<?php echo $lang['section_profile'];?><br />
			</div>
			
			<div class="box_mid" style="padding: 9px;">
			<table border="0" cellspacing="0" cellpadding="4" width="100%">
				<tr>
					<td valign="top" rowspan="12">
						<img src="get_file.php?file=<?php echo $profile['image']['file'];?>" align="left" border="0" class="picture" alt="<?php echo $profile['image']['file_title'];?>" /><br />
					</td>
					<td>
						<?php echo $lang['txt_profile_name'];?><br />
					</td>
					<td>
						<?php echo $profile['profile_name'];?><br />
					</td>
				</tr>
				
				<tr>
					<td valign="top">
						<?php echo $lang['txt_profile_nic'];?><br />
					</td>
					<td>
						<?php echo $profile['profile_nic'];?><br />
					</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>
			</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>
			
			<?php
			}
			elseif (isset($display) && $display == "edit_user") {
			?>
			
			<div class="box_top">
				<?php echo $lang['section_user'];?><br />
			</div>
			
			<div class="box_mid" style="padding: 9px;">
			<table width="100%" cellpadding="4" cellspacing="0" border="0">
				<tr>
					<td colspan="2">
						<b><?php echo $user['user_firstname'] . " " . $user['user_surname'];?></b><br />
					</td>
				</tr>
				<tr>
					<td>
						<label for="id_user_number"><?php echo $lang['txt_user_number'];?></label><br />
					</td>
					<td>
						<input id="id_user_number" type="text" name="data[user_number]" size="30" value="<?php echo $user['user_number'];?>"><br />
					</td>
				</tr>
				<tr>
					<td>
						<label for="id_user_file_allocation"><?php echo $lang['txt_file_allocation'];?></label><br />
					</td>
					<td>
						<input id="id_user_file_allocation" type="text" name="data[user_file_allocation]" size="10" value="<?php echo round($user['user_file_allocation']/1000, 2);?>">&nbsp;kb<br />
					</td>
			    </tr>
				<tr>
					<td>
						<label for="id_status"><?php echo $lang['txt_status'];?></label><br />
					</td>
					<td>
						<select id="id_status" name="data[status_id]" size="1">
						<?php foreach($lang['arr_user_status'] as $key => $i): 
						?>
						<option value="<?php echo $key;?>" <? if($user['status_id'] == $key) echo "selected=\"selected\"";?>><?php echo $i;?></option>
						<?php endforeach; ?>
						</select>
						<br />
					</td>
				</tr>
				<tr>
					<td>
						<label for="id_role"><?php echo $lang['txt_role'];?></label><br />
					</td>
					<td>
						<select id="id_role" name="data[role_id]" size="1">
						<?php 
						foreach($lang['arr_acs']['role'] as $key => $i): 
						?>
						<option value="<?php echo $key;?>" <? if($user['role_id'] == $key) echo "selected=\"selected\"";?>><?php echo $i;?></option>
						<?php endforeach; ?>
						</select>
						<br />
					</td>
				</tr>
				<tr>
					<td align="right" colspan="2">
						<input type="submit" name="update_user" value="<?php echo $lang['sub_update_user'];?>" class="button_urgent"><br />
					</td>
				</tr>
			</table>
			</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>
			<?php
			}
			else {
			?>
			
			<div class="box_top">
				<?php echo $lang['menu_user_list'];?><br />
			</div>
			
			<div class="box_mid" style="padding: 9px;">
			<table border="0" cellspacing="0" cellpadding="4" width="100%">
				<tr>
					<td>
						&nbsp;<br />
					</td>
					<td>
						<?php echo $lang['txt_name'];?><br />
					</td>
					<td>
						<?php echo $lang['txt_hometown'];?><br />
					</td>
					<td>
						<?php echo $lang['txt_user_create_datetime'];?><br />
					</td>
				</tr>
				<?php
				if (isset($users)) {
				foreach($users as $key => $i):
				?>
				<tr>
					<td valign="top">
						<a href="node_user.php?user_id=<?php echo $i['user_id'];?>"><?php echo $i['user_id'];?></a><br />
					</td>
					<td valign="top">
						<?php echo $i['user_firstname'] . " " . $i['user_surname'];?><br />
					</td>
					<td valign="top">
						<?php echo $i['user_hometown'];?><br />
					</td>
					<td valign="top">
						<?php echo $i['display_user_create_datetime'];?><br />
					</td>
				</tr>
				<tr>
					<td>
						&nbsp;<br />
					</td>
					<td class="txt_footer" colspan="5">
						<?php
						if (isset($lang['arr_lang_name'][$i['language_id']])) {
						    echo $lang['arr_lang_name'][$i['language_id']];
						}
						?>,
						<?php
						if (isset($lang['arr_user_status'][$i['status_id']])) {
						    echo $lang['arr_user_status'][$i['status_id']];
						}
						?>,
						<?php
						if (isset($lang['arr_acs']['role'][$i['role_id']])) {
						    echo $lang['arr_acs']['role'][$i['role_id']];
						}
						?>
						<br />
					</td>
				</tr>
				<?php
				endforeach;
				}
				else {
				?>
				<tr>
					<td colspan="5">
						<?php echo $lang['err_no_users'];?><br />
					</td>
				</tr>
				<?php
				}
				?>
			</table>
			</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>
			<?php }?>
		</td>
	</tr>
</table>
</form>
