<?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="g_group_create.php" method="post" name="frm" id="id_frm">

<table width="760" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td width="760" valign="top">
			<div class="box_top">
				<?php echo $lang['section_create_group'];?><br />
			</div>
			
			<div class="box_mid" style="padding: 9px;">
			<?php
			if (isset($display) && $display == "group_select") {
			?>
			<table width="100%" cellpadding="4" cellspacing="0" border="0">
				<tr>
					<td colspan="2">
						<span class="txt_item_title">
						<?php echo $lang['txt_intro'];?>
						</span><br />
						<?php echo $lang['txt_intro_help'];?><br />
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<b><?php echo $lang['hdr_group_setup_rules'];?></b><br />
						<?php echo $lang['txt_group_setup_rules'];?><br />
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />
					</td>
				</tr>
				<tr>
					<td valign="top">
						<input type="radio" name="data[group_visibility]" value="0" checked="checked" /><br />
					</td>
					<td>
						<b><?php echo $lang['sub_hidden_group_radio'];?></b><br />
						<?php echo $lang['txt_hidden_group_intro'];?><br />
					</td>
				</tr>

				<tr>
					<td valign="top">
						<input type="radio" name="data[group_visibility]" value="1" /><br />
					</td>
					<td>
						<b><?php echo $lang['sub_visible_group_radio'];?></b><br />
						<?php echo $lang['txt_visible_group_intro'];?><br />
					</td>
				</tr>
				<tr>
					<td align="right" colspan="2">
						<input type="submit" name="create_group" value="<?php echo $lang['sub_apply'];?>" class="button_urgent" /><br />
					</td>
				</tr>
			</table>
			
			

			<?php
			}
			elseif (isset($display) && $display == "group_setup") {
			?>

			<input type="hidden" name ="data[group_visibility]" value="<?php echo $group['group_visibility'];?>">

			<table width="100%" cellpadding="4" cellspacing="0" border="0">
				<tr>
					<td>
						<?php echo $lang['txt_group_title'];?><br />
					</td>
				</tr>
				<tr>
					<td>
						<input type="text" name="data[group_title]" class="formInput" size="42" value="<?php if (isset($group['group_title'])) { echo $group['group_title']; }?>" /><br />
					</td>
				</tr>
				<tr>
					<td>
						<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />
					</td>
				</tr>
				<tr>
					<td>
						<?php echo $lang['txt_group_description'];?><br />
					</td>
				</tr>
				<tr>
					<td>
						<textarea name="data[group_synopsis]" rows="2" cols="80" class="formInput"><?php if (isset($group['group_synopsis'])) { echo $group['group_synopsis']; }?></textarea><br />
					</td>
				</tr>
				<tr>
					<td>
						<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />
					</td>
				</tr>
				<tr>
					<td>
						<?php echo $lang['txt_group_language'];?><br />
					</td>
				</tr>
				<tr>
					<td>
					<select name="data[language_id]" size="1" class="formInput">
						<?php 
						if (isset($group['language_id'])) {
						    $language_id = $group['language_id'];
						}
						foreach($lang['arr_lang_name'] as $key => $i): ?>
						<option value="<?php echo $key;?>" <? if($language_id == $key) echo "selected=\"selected\"";?>><?php echo $i;?></option>
						<?php endforeach; ?>
					</select>
					<br />
					</td>
				</tr>
				<tr>
					<td>
						<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />
					</td>
				</tr>
				<?php
				if ($group['group_visibility'] == "1") {
				?>
				<tr>
					<td>
						<?php echo $lang['txt_group_registration_type'];?><br />
					</td>
				</tr>
				<tr>
					<td>
						<input type="radio" name="data[group_registration_type]" value="<?php echo $group_registration_type['closed'];?>" checked="checked" />&nbsp;<?php echo $lang['txt_group_registration_closed'];?><br />
						<input type="radio" name="data[group_registration_type]" value="<?php echo $group_registration_type['approved'];?>" <?php if (isset($group['group_registration_type']) && $group['group_registration_type'] == $group_registration_type['approved']) { echo "checked=\"checked\""; }?> />&nbsp;<?php echo $lang['txt_group_registration_approved'];?><br />
						<input type="radio" name="data[group_registration_type]" value="<?php echo $group_registration_type['automatic'];?>" <?php if (isset($group['group_registration_type']) && $group['group_registration_type'] == $group_registration_type['automatic']) { echo "checked=\"checked\""; }?> />&nbsp;<?php echo $lang['txt_group_registration_automatic'];?><br />
					
					</td>
				</tr>
				<tr>
					<td>
						<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />
					</td>
				</tr>
				<tr>
					<td>
						<?php echo $lang['txt_group_age'];?><br />
					</td>
				</tr>
				<tr>
					<td>
						<?php
						if (isset($group['group_from_age'])) {
						    $from_txt = $group['group_from_age'];
						}
						else {
							$from_txt = $lang['txt_age_any'];
						}
						?>
						<?php echo $lang['txt_age_from'];?> <input type="text" size="5" name="data[group_from_age]" value="<?php echo $from_txt;?>" class="formInput">&nbsp;
						<?php
						if (isset($group['group_to_age'])) {
						    $to_txt = $group['group_to_age'];
						}
						else {
							$to_txt = $lang['txt_age_any'];
						}
						?>
						<?php echo $lang['txt_age_to'];?> <input type="text" size="5" name="data[group_to_age]" value="<?php echo $to_txt;?>" class="formInput"><br />
					</td>
				</tr>
				<tr>
					<td>
						<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />
					</td>
				</tr>
				<?php }?>
				
				<?php
				if (($group['group_visibility'] != "1" && $group_setup['allow_auto_hidden_approval'] != "1") || ($group['group_visibility'] == 1 && $group_setup['allow_auto_visible_approval'] != "1")) {
				?>
				<tr>
					<td>
						<?php echo $lang['txt_admin_note'];?><br />
					</td>
				</tr>
				<tr>
					<td>
						<textarea name="data[note]" rows="2" cols="80" class="formInput"><?php if (isset($group['note'])) { echo $group['note']; }?></textarea><br />
					</td>
				</tr>
				<?php }?>
				<tr>
					<td align="right">
						<input type="submit" name="insert_group" value="<?php echo $lang['sub_create_group'];?>" class="button_urgent" /><br />
					</td>
				</tr>
			</table>

			<?php
			}
			elseif (isset($display) && $display == "completed") {
			?>
			<table width="100%" cellpadding="4" cellspacing="0" border="0">
				<tr>
					<td>
						<?php echo $lang['txt_group_completed'];?><br />
					</td>
				</tr>
				<tr>
					<td align="right">
						<a href="g_acs.php?group_id=<?php echo $group_id;?>" class="link_urgent"><?php echo $lang['href_new_group'];?></a><br />
					</td>
				</tr>
			</table>

			<?php
			}
			elseif (isset($display) && $display == "completed_pending") {
			?>
			<table width="100%" cellpadding="4" cellspacing="0" border="0">
				<tr>
					<td>
						<?php echo $lang['txt_group_completed_pending'];?><br />
					</td>
				</tr>
			</table>

			<?php }?>
			</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>
		</td>
	</tr>
</table>
</form>
