<?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_structure.php" method="post" name="frm" id="id_frm">
<input type="hidden" name="group_id" value="<?php if(isset($group['group_id'])) { echo $group['group_id'];}?>" />

<div class="col_main">
	<div class="box">
		<div class="box_top">
			<?php echo $lang['hdr_group_rules'];?><br />
		</div>
		
		<div class="box_mid">
			<div class="content">
				<?php echo $group['group_rules'];?><br />
			</div>
		</div>
	</div>
	
	<div class="box_bottom">
		<span class="box_bottom_right"></span>
		<span class="box_bottom_left"></span>
	</div>
	
	<?php
	$group_mgmt_content = "";
	
	if ($this->group_acs->checkPermission($resource_ids['group']['administration'], $privilege_ids['allow_edit'])) { //resourece_id, Priv_id
		$group_mgmt_content .= "<a href=\"grp_edit.php?group_id=" . $group['group_id'] . "\">" . $lang['href_edit_group'] . "</a>&nbsp;&nbsp;";
		$group_mgmt_content .= "<a href=\"grp_edit.php?edit_group_rules=1&amp;group_id=" . $group['group_id'] . "\">" . $lang['href_edit_group_rules'] . "</a>&nbsp;&nbsp;";
		$group_mgmt_content .= "<a href=\"grp_edit.php?archive_group=1&amp;group_id=" . $group['group_id'] . "\">" . $lang['href_archive_group'] . "</a>&nbsp;&nbsp;";
	}
	
	if ($this->group_acs->checkPermission($resource_ids['group']['administration'], $privilege_ids['allow_tag'])) { //resourece_id, Priv_id
		$group_mgmt_content .= "<a href=\"grp_tags.php?group_id=" . $group['group_id'] . "\">" . $lang['href_tag'] . "</a>&nbsp;&nbsp;";
	}
	
	if (!empty($group_mgmt_content)) {
	?>
	
	
	<div class="box">
		<div class="box_top">
			<?php echo $lang['hdr_group_management'];?><br />
		</div>
		
		<div class="box_mid">
			<div class="content">
				<?php echo $group_mgmt_content;?><br />
			</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 $lang['hdr_roles'];?><br />
		</div>
		
		<div class="box_mid">
			<div class="content">
				<table cellpadding="4" cellspacing="0" border="0" width="100%">
					<?php
					if (isset($group_roles)) {
					foreach($group_roles as $i):?>
					<tr>
						<td valign="top">
							<?php echo $i['role_name'];?><br />
						</td>
						<td valign="top" align="right">
							<a href="grp_membership.php?group_id=<?php echo $group['group_id'];?>&amp;role_id=<?php echo $i['role_id'];?>" class="txt_footer_link"><?php echo $i['total_members'];?></a><br />
						</td>
					</tr>
					<?php
					endforeach;
					?>
					<?php
					}
					else {
					?>
					<tr>
						<td colspan="2">
							<?php echo $lang['err_no_roles'];?><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>
</div>
</form>
