<?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="action">

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

			<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="570" valign="top">
			<?php
			if (isset($display) && $display == "group_select") {
			?>
			<table width="100%" cellpadding="4" cellspacing="0" border="0" class="bg_1">
				<tr>
					<td colspan="2" class="txt_title" align="right">
						<?php echo $lang['section_create_group'];?><br />
						<hr />
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<?php echo $lang['txt_intro'];?><br />
						<span class="txt_footer"><?php echo $lang['txt_intro_help'];?></span><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">
						<?php echo $lang['hdr_group_setup_rules'];?><br />
						<span class="txt_footer"><?php echo $lang['txt_group_setup_rules'];?></span><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>
						<input type="radio" name="data[group_visibility]" value="0" checked="checked" /><br />
					</td>
					<td>
						<?php echo $lang['sub_hidden_group_radio'];?><br />
						<span class="txt_footer"><?php echo $lang['txt_hidden_group_intro'];?></span><br />
					</td>
				</tr>

				<tr>
					<td>
						<input type="radio" name="data[group_visibility]" value="1" /><br />
					</td>
					<td>
						<?php echo $lang['sub_visible_group_radio'];?><br />
						<span class="txt_footer"><?php echo $lang['txt_visible_group_intro'];?></span><br />
					</td>
				</tr>
				<tr>
					<td align="right" colspan="2">
						<input type="submit" name="create_group" value="<?php echo $lang['sub_apply'];?>" class="formInput" /><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" class="bg_1">
				<tr>
					<td class="txt_title" align="right">
						<?php echo $lang['section_create_group'];?><br />
						<hr />
					</td>
				</tr>
				<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>
				<tr>
					<td>
						<?php echo $lang['txt_group_genre'];?><br />
					</td>
				</tr>
				<tr>
					<td>
						<select name="data[genre_id]" class="formInput">
							<option value="0"><?php echo $lang['txt_all_genre'];?></option>
							<?php
							if (isset($group['genre_id'])) {
						   		$genre_id = $group['genre_id'];
							}
							foreach($lang['arr_genre'] as $key => $i):
								$selected = "";
								if(isset($genre_id) && $genre_id == $key) {
									$selected = " selected";
								}
								print "<option value='" . $key . "'" . $selected . ">" . $i . "</option>";
							endforeach;
							?>
						</select>
					</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="formInput" /><br />
					</td>
				</tr>
			</table>

			<?php
			}
			elseif (isset($display) && $display == "completed") {
			?>
			<table width="100%" cellpadding="4" cellspacing="0" border="0">
				<tr>
					<td class="txt_title" align="right">
						<?php echo $lang['section_create_group'];?><br />
						<hr />
					</td>
				</tr>
				<tr>
					<td>
						<?php echo $lang['txt_group_completed'];?><br />
					</td>
				</tr>
			</table>

			<?php }?>
		</td>
	</tr>
</table>
</form>
