<?php

// -----------------------------------------------------------------------
// This file is part of AROUNDMe
// 
// Copyright (C) 2003 - 2006 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.
// -----------------------------------------------------------------------

?>


<form action="grp_directory.php" method="post">
<input type="hidden" name="group_id" value="<?php echo $group['group_id'];?>" />

<div class="col_main">
	<?php
	if (isset($display) && $display == "invite_members") {
	?>
	<div class="box">
		<div class="box_top">
			<?php echo $lang['hdr_invite_friends'];?><br />
		</div>
		
		<div class="box_mid">
			<div class="content">
				<?php
				if (isset($non_member_friends)) {
				?>
				<table width="100%" cellpadding="4" cellspacing="0" border="0">
					<tr>
						<td>
							<?php echo $lang['txt_invite_friends'];?><br />
						</td>
					</tr>
					<tr>
						<td align="right">
							<input type="submit" name="invite_friends" value="<?php echo $lang['sub_invite'];?>" class="button" /><br />
						</td>
					</tr>
				</table>

				<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />
				<?php }?>
				
				<table width="100%" cellpadding="4" cellspacing="0" border="0">
					<tr>
						<td colspan="5">
							<b><?php echo $lang['hdr_non_member_friends'];?></b><br />
						</td>
					</tr>
					<?php
					if (isset($non_member_friends)) {
					?>
					<tr height="25" valign="middle">
						<td>
							<br />
						</td>
						<td>
							<?php echo $lang['txt_user_name'];?><br />
						</td>
						<td>
							<?php echo $lang['txt_user_hometown'];?><br />
						</td>
						<td>
							<?php echo $lang['txt_join_date'];?><br />
						</td>
						<td align="right">
							<?php echo $lang['txt_apply'];?><br />
						</td>
					</tr>
					<?php
					foreach($non_member_friends as $key => $i):
					?>
					<tr>
						<td width="3" valign="top">
							<img src="<?php echo $templatePath;?>img/green_dot.png" width="3" height="9" alt="" /><br />
						</td>
						<td valign="top">
							<?php echo $i['profile_nic'];?><br />
						</td>
						<td valign="top">
							<?php echo $i['profile_hometown'];?><br />
						</td>
						<td valign="top">
							<?php echo $i['profile_create_datetime'];?><br />
						</td>
						<td valign="top" align="right">
							<input type="hidden" name="data[group_invite_profile][<?php echo $i['user_id'];?>]" value="<?php echo $i['profile_id'];?>" /><br />
							<input type="checkbox" name="data[group_invite][]" value="<?php echo $i['user_id'];?>" /><br />
						</td>
					</tr>
					<tr>
						<td colspan="5">
							<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="4" alt="" /><br />
						</td>
					</tr>
					<?php
					endforeach;
					}
					else {
					?>
					<tr>
						<td colspan="5">
							<?php echo $lang['err_no_friends'];?><br />
						</td>
					</tr>
					<?php }?>
				</table>
			</div>
		</div>
	</div>
	
	<div class="box_bottom">
		<span class="box_bottom_right"></span>
		<span class="box_bottom_left"></span>
	</div>
	
	<?php
	}
	else {
	?>
	
	<div class="box">
		<div class="box_top">
			<?php echo $lang['hdr_members'];?><br />
		</div>
		
		<div class="box_mid">
			<div class="content">
				<?php
				if (isset($members)) {
				$display_items = trimArray($members);
				?>
				<table border="0" cellspacing="0" cellpadding="4" width="100%">
					<tr>
						<td>
							<br />
						</td>
						<td>
							<?php echo $lang['txt_user_nic'];?><br />
						</td>
						<td>
							<?php echo $lang['txt_group_join_date'];?><br />
						</td>
						<td>
							<?php echo $lang['txt_role'];?><br />
						</td>
						<td>
							<?php echo $lang['txt_member_status'];?><br />
						</td>
						<td>
							<br />
						</td>
					</tr>
					<?php
					foreach($display_items as $key => $i):
					?>
					<tr>
						<td valign="top">
							<a href="grp_membership.php?group_id=<?php echo $group['group_id'];?>&amp;user_id=<?php echo $i['user_id'];?>"><?php echo $i['user_id'];?></a><br />
						</td>
						<td valign="top">
							<b><?php echo $i['profile_nic'];?></b><br />
						</td>
						<td valign="top">
							<?php echo $this->date->formatDate($i['group_member_create_datetime']);?><br />
						</td>
						<td valign="top">
							<?php
							foreach($group_roles as $key => $r):
								if ($r['role_id'] == $i['role_id']) {
									echo $r['role_name'];
									break;
								}
							endforeach;
							?><br />
						</td>
						<td valign="top" nowrap="nowrap">
							<?php echo $lang['arr_group_member_status'][$i['status_id']];?>&nbsp;(<?php
							if ($i['online_status'] == 1) {
								echo "<span class='txt_red'><b>" . $lang['arr_user_online_status'][1] . "</b></span>";
							}
							else {
									echo $lang['arr_user_online_status'][$i['online_status']];
							}
							?>)<br />
						</td>
						<td valign="top" align="right">
							<a href="msg_edit.php?to_user_id=<?php echo $i['user_id'];?>"><img src="<?php echo $templatePath;?>img/unopenned_mail.png" alt="<?php echo $lang['ttl_send_message'];?>" border="0" /></a><br />
						</td>
					</tr>
					<?php
					endforeach;
					?>
				</table>
				<?php
				echo createArrayList($members);
				}
				else {
				?>
				<p>
					<?php echo $lang['err_no_members'];?><br />
				</p>
				<?php }?>
			</div>
		</div>
	</div>
	
	<div class="box_bottom">
		<span class="box_bottom_right"></span>
		<span class="box_bottom_left"></span>
	</div>
	<?php }?>
</div>

<div class="col_side">
	<div class="box">
		<div class="box_top">
			<?php echo $group['group_title'];?><br />
		</div>
		
		<div class="box_mid">
			<div class="content">
				<?php
				if (isset($group['image']['file_id'])) {
				?>
				<img src="get_file.php?file=<?php echo $group['image']['file'];?>" border="0" alt="<?php echo $group['image']['file_title'];?>" /><br />
				<?php }?>
			
			
				<form action="grp_view.php" method="post" name="frm_view" id="id_frm_view">
				<input type="hidden" name="group_id" value="<?php if(isset($group['group_id'])) { echo $group['group_id'];}?>" />
				
				<p>
					<select name="options" class="options_select">
					<option value="grp_view" selected="selected"><?php echo $lang['txt_option_group'];?></option>
					<option value="grp_structure" selected="selected"><?php echo $lang['txt_option_structure'];?></option>
					<option value="grp_membership" selected="selected"><?php echo $lang['txt_option_membership'];?></option>
				</select>
					<input type="image" src="<?php echo $templatePath;?>img/go.png" value="option_action" class="go" /><br />
				</p>
			</div>
		</div>
	</div>
	
	<div class="box_bottom">
		<span class="box_bottom_right"></span>
		<span class="box_bottom_left"></span>
	</div>
	
	<div class="box">
		<div class="box_top">
			<?php echo $group['group_title'];?><br />
		</div>
		
		<div class="box_mid">
			<div class="content">
				<p>
					members: <?php echo count($members);?><br />
				</p>
				
				<p align="right">
					<a href="grp_directory.php?group_id=<?php if(isset($group['group_id'])) { echo $group['group_id'];}?>&amp;invite_members=1">invite members</a><br />
				</p>
			</div>
		</div>
	</div>
	
	<div class="box_bottom">
		<span class="box_bottom_right"></span>
		<span class="box_bottom_left"></span>
	</div>
</div>
</form>
