<?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>


<form action="index.php?amn=core_maint_location" method="post" name="frm" id="id_frm">
<input type="hidden" name="location_id" value="<?php echo isset($location['location_id']) ? $location['location_id'] : ''; ?>" />

<div class="col_main">
	<div class="box">
		<div class="box_top">	
			<div class="content">
				<h1><?php echo $lang['hdr_locations'];?></h1>
			</div>
		</div>
	
		<div class="box_mid">
			<div class="content">
				<p align="right">
					<a href="index.php?amn=core_maint_location&amp;add_location=1">add location</a><br />
				</p>
				
				<?php
				if (isset($locations)) {
				?>
				<table border="0" cellspacing="0" cellpadding="4" width="100%">
					<tr>
						<td>
							&nbsp;<br />
						</td>
						<td valign="top">
							<b><?php echo $lang['txt_location_name'];?></b><br />
						</td>
						<td valign="top">
							<b><?php echo $lang['txt_location_language'];?></b><br />
						</td>
					</tr>
					<?php
					foreach($locations as $key => $i):
					?>
					<tr>
						<td valign="top">
							<a href="index.php?amn=core_maint_location&amp;location_id=<?php echo $i['location_id'];?>"><?php echo $i['location_id'];?></a><br />
						</td>
						<td valign="top">
							<?php echo $i['location_name'];?><br />
						</td>
						<td valign="top">
							<?php
							if (isset($lang['arr_lang_name'][$i['language_id']])) {
								echo ucfirst($lang['arr_lang_name'][$i['language_id']]);
							}
							?><br />
						</td>
					</tr>
					<?php
					endforeach;
					?>
				</table>
				<?php
				?>
				<?php
				}
				else {
				?>
				<p>
					<?php echo $lang['template_error']['err_no_items'];?><br />
				</p>
				<?php }?>
			</div>
		</div>
	</div>
</div>

<div class="col_side">
	<div class="box">
		<div class="box_top">
			<div class="content">
				<h1><?php echo $lang['hdr_edit_language'];?></h1>
			</div>
		</div>
			
		<div class="box_mid">
			<div class="content">
				<p>
					<label for="id_location_name"><?php echo $lang['txt_location_name'];?></label>
					<input id="id_location_name" type="text" name="location_name" value="<?php if(isset($location['location_name'])) { echo $location['location_name'];}?>" /><br />
				</p>	
				
				<?php
				if (count($core_config['language']['pack']) > 1) {
				?>
				
				<p>
					<label for="id_language_id"><?php echo $lang['txt_location_language'];?></label><br />
					<select id="id_language_id" name="language_id" size="1">
						<?php
						foreach($core_config['language']['pack'] as $key => $i):
						?>
						<option value="<?php echo $i;?>" <?php if(isset($location['language_id']) && $location['language_id'] == $key) echo "selected=\"selected\"";?>><?php echo ucfirst($lang['arr_lang_name'][$key1]);?></option>
						<?php
						endforeach;
						?>
					</select><br />
				</p>
				<?php
				}
				else {
				?>
				<input type="hidden" name="language_id" value="<?php echo $core_config['language']['default_id'];?>" />
				<?php }?>
				
				<hr />
				
				<p align="right">
					<?php
					if (isset($location)) {
					?>
					<input type="submit" name="delete_location" class="input_submit" value="<?php echo $lang['sub_delete'];?>" />&nbsp;
					<?php }?>
					<input type="submit" name="update_location" class="input_submit" value="<?php echo isset($location) ? $lang['sub_update'] : $lang['sub_add']; ?>" /><br />
				</p>
			</div>
		</div>
	</div>
</div>
</form>