<?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;?>css/aroundme_form.css);
-->
</style>

<?php
if (isset($display) && $display == "setup") {
?>

<form action="index.php?amn=core_setup" method="post" name="frm" id="id_frm" enctype="multipart/form-data">
<input type="hidden" name="user_id" value="<?php if (isset($_POST['user_id'])) { echo $_POST['user_id'];}?>" />

<div class="box">
	<div class="box_top">
		<?php echo $lang['hdr_setup'];?><br />
	</div>
	
	<div class="box_mid">
		<div class="content">
			<table border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td width="50%" valign="top">
						<p>
							<b><?php echo $lang['txt_profile'];?></b><br />
						</p>
						
						<p>
							<label for="id_nic"><?php echo $lang['txt_firstname'];?></label>
							<input id="id_nic" type="text" class="input1" name="user_firstname" size="32"  maxlength="50" value="<?php if (isset($_POST['user_firstname'])) { echo $_POST['user_firstname'];}?>" /><br />
						</p>
						
						<p>
							<label for="id_nic"><?php echo $lang['txt_surname'];?></label>
							<input id="id_nic" type="text" class="input1" name="user_surname" size="32"  maxlength="50" value="<?php if (isset($_POST['user_surname'])) { echo $_POST['user_surname'];}?>" /><br />
						</p>
						
						<p>
							<label for="id_nic"><?php echo $lang['txt_nic'];?></label>
							<input id="id_nic" type="text" class="input1" name="user_nic" size="32" value="<?php if (isset($_POST['user_nic'])) { echo $_POST['user_nic'];}?>" /><br />
						</p>
						
						<?php
						if (isset($locations)) {
						?>
						<p>
							<label for="id_location"><?php echo $lang['txt_location'];?></label>
							<select id="id_location" name="location_id">
							<option value="0"><?php echo $lang['txt_location'];?></option>
							
						<?php
						foreach($locations as $key => $i):
						?>
						<option value="<?php echo $i['location_id'];?>"<?php if (isset($_POST['location_id']) && $_POST['location_id'] == $i['location_id']) { echo " selected=\"selected\"";}?>><?php echo $i['location_name'];?></option>
						<?php
						endforeach;
						?>
						</select>		
						</p>
						<?php }?>
						
						
						<p>
							<label for="id_gender"><?php echo $lang['txt_gender'];?></label>
							<input id="id_gender" type="radio" name="user_gender" value="0" checked="checked">&nbsp;<?php echo $lang['txt_none'];?>
							<input id="id_gender" type="radio" name="user_gender" value="1" <?php if (isset($_POST['user_gender']) && $_POST['user_gender'] == "1") { echo "checked";}?>>&nbsp;<?php echo $lang['txt_male'];?>
							<input id="id_gender" type="radio" name="user_gender" value="2" <?php if (isset($_POST['user_gender']) && $_POST['user_gender'] == "2") { echo "checked";}?>>&nbsp;<?php echo $lang['txt_female'];?><br />
						</p>
						
						<p>
							<b><label for="frm_file"><?php echo $lang['txt_file_to_upload']; ?></label></b><br />				
						</p>
						
						<p>
							<?php echo $lang['txt_file_help'];?><br />						
						</p>
						<p>
							<input type="file" name="frm_file" id="frm_file" class="input" /><br />
						</p>
						
								
						<?php
						if (isset($lang['user']['preference'])) {
						?>
						<img src="<?php echo $template_path;?>img/pixel.png" width="1" height="6" alt="" border="0" /><br />
						
						<p>
							<b><?php echo $lang['txt_preference'];?></b><br />
						</p>
						
						<table border="0" cellspacing="0" cellpadding="0">
						<?php
						foreach($lang['user']['preference'] as $key => $i):
						?>
						<tr>
							<td width="6" valign="top">
								<img src="<?php echo $template_path;?>img/dot.png" width="3" height="9" alt="" border="0" /><br />
							</td>
							<td>
								<?php echo $i;?><br />
							</td>
							<td width="1" align="right">
								<?php
								if (isset($lang['user']['pref_options'][$key])) {
								?>
								<select name="user_preferences[<?php echo $key;?>]">
								<?php
								foreach($lang['user']['pref_options'][$key] as $optionkey => $r):
								?>
								<option value="<?php echo $optionkey;?>"<?php if (isset($_POST['user_preferences'][$key]) && $_POST['user_preferences'][$key] == $optionkey) { echo " selected=\"selected\"";}?>><?php echo $r;?></option>
								<?php
								endforeach;
								?>
								</select>
								<?php
								}
								else {
								?>
								<input type="checkbox" name="user_preferences[<?php echo $key;?>]" value="1" <?php if (isset($_POST['user_preferences'][$key])) { echo "checked=\"checked\"";}?> /><br />
								<?php }?>
							</td>
						</tr>
						<?php
						endforeach;
						?>
						</table>
						<?php }?>
					</td>
					<td>
						<img src="<?php echo $template_path;?>img/pixel.png" width="20" height="1" alt="" border="0" /><br />
					</td>
					<td width="50%" valign="top">
						<p>
							<b><?php echo $lang['txt_access_code'];?></b>
							<?php echo $lang['txt_access_code_help'];?><br />
						</p>
								
						<p>
							<input type="text" class="input1" name="access_code" size="10" value="<?php if (isset($_POST['access_code'])) { echo $_POST['access_code'];}?>" /><br />
						</p>
							
						<img src="<?php echo $template_path;?>img/pixel.png" width="1" height="10" alt="" /><br />
							
						<p>
							<b><?php echo $lang['txt_create_password'];?></b>
							<?php echo $lang['txt_create_password_help'];?><br />
						</p>
						
						<p>
							<label for="id_user_password1" style="width:160px;"><?php echo $lang['txt_password1'];?></label>
							<input type="password" id="id_user_password1" class="input1" name="user_password1" size="8" value="<?php if (isset($_POST['user_password1'])) { echo $_POST['user_password1'];}?>" /><br />
						</p>
						
						<p>
							<label for="id_user_password2" style="width:160px;"><?php echo $lang['txt_password2'];?></label>
							<input type="password" id="id_user_password2" class="input1" name="user_password2" size="8" value="<?php if (isset($_POST['user_password1'])) { echo $_POST['user_password1'];}?>" /><br />
						</p>
							
						<img src="<?php echo $template_path;?>img/pixel.png" width="1" height="10" alt="" /><br />
							
						<p>
							<b><?php echo $lang['txt_dob'];?></b><br />
							<?php echo $lang['txt_dob_help'];?><br />
						</p>
						
						<p>
							<?php echo $datedropdown;?><br />
						</p>
					</td>
				</tr>
				<tr>
					<td colspan="3" align="right">
						<input type="submit" name="setup" value="<?php echo $lang['sub_finish'];?>" class="input_submit" /><br />
					</td>
				</tr>				
			</table>
		</div>
	</div>
</div>
</form>


<?php
}
else { // already setup
?>
<div class="box">
	<div class="box_top">
		<?php echo $lang['hdr_setup'];?><br />
	</div>
	
	<div class="box_mid">
		<div class="content">
			<p>
				<?php echo $lang['txt_already_setup'];?><br />
			</p>
				
			<p>
				<a href="index.php?amn=core_login"><?php echo $lang['href_index'];?></a><br />
				<a href="index.php?amn=core_new_password"><?php echo $lang['href_new_password'];?></a><br />
			<p />
		</div>
	</div>
</div>
<?php }?>