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

?>





<?php
if (isset($group['group_id']) && $page_name_short != "g_apply") {
?>

<div id="box_side2">
	<?php echo $group['group_title'];?><br />
</div>

<div id="box_side1">
	<?php
	if ($page_name_short == "g_group") {
	?>
	<span class="txt_highlight3"><?php echo $lang['menu_group_home'];?></span><br />
	<?php
	} else {
	?>
	<a href="g_group.php?group_id=<?php echo $group['group_id'];?>"><?php echo $lang['menu_group_home'];?></a><br />
	<?php }?>
	

	<?php
	if ($this->group_acs->checkPermission($resource_ids['group_blog'], $privilege_ids['allow_access'])) { //resourece_id, Priv_id
	if ($page_name_short == "blg_item") {
	?>
	<span class="txt_highlight3"><?php echo $lang['menu_blog'];?></span><br />
	<?php
	} else {
	?>
	<a href="blg_item.php?group_id=<?php echo $group['group_id'];?>"><?php echo $lang['menu_blog'];?></a><br />
	<?php }}?>


	<?php
	if ($this->group_acs->checkPermission($resource_ids['group_forum'], $privilege_ids['allow_access'])) { //resourece_id, Priv_id
	if ($page_name_short == "frm_list" || $page_name_short == "frm_item") {
	?>
	<span class="txt_highlight3"><?php echo $lang['menu_discussions'];?></span><br />
	<?php
	}
	else {
	?>
	<a href="frm_list.php?group_id=<?php echo $group['group_id'];?>"><?php echo $lang['menu_discussions'];?></a><br />
	<?php }}?>
	

	<?php
	if ($this->group_acs->checkPermission($resource_ids['group_poll'], $privilege_ids['allow_access'])) { //resourece_id, Priv_id
	if ($page_name_short == "g_poll" || $page_name_short == "g_poll_edit") {
	?>
	<span class="txt_highlight3"><?php echo $lang['menu_polls'];?></span><br />
	&nbsp;&nbsp;<a href="pol_edit.php?group_id=<?php echo $group['group_id'];?>"><?php echo $lang['href_add'];?></a><br />
	&nbsp;&nbsp;<a href="pol_list.php?group_id=<?php echo $group['group_id'];?>"><?php echo $lang['href_list'];?></a><br />
	<?php
	} else {
	?>
	<a href="pol_list.php?group_id=<?php echo $group['group_id'];?>"><?php echo $lang['menu_polls'];?></a><br />
	<?php }}?>
	
	
	<?php
	if ($this->group_acs->checkPermission($resource_ids['group_files'], $privilege_ids['allow_access'])) { //resourece_id, Priv_id
	if ($page_name_short == "fil_list" || $page_name_short == "fil_edit") {
	?>
	<span class="txt_highlight3"><?php echo $lang['menu_files'];?></span><br />
	<?php
	} else {
	?>
	<a href="fil_list.php?group_id=<?php echo $group['group_id'];?>"><?php echo $lang['menu_files'];?></a><br />
	<?php }}?>


	<?php
	if ($this->group_acs->checkPermission($resource_ids['group_library'], $privilege_ids['allow_access'])) { //resourece_id, Priv_id
	if ($page_name_short == "lib_item") {
	?>
	<span class="txt_highlight3"><?php echo $lang['menu_library'];?></span><br />
	<?php
	} else {
	?>
	<a href="lib_item.php?group_id=<?php echo $group['group_id'];?>"><?php echo $lang['menu_library'];?></a><br />
	<?php 
	}}
	?>
	
	
	<?php
	if ($this->group_acs->checkPermission($resource_ids['group_schedule'], $privilege_ids['allow_access'])) { //resourece_id, Priv_id
	if ($page_name_short == "sch_gantt" || $page_name_short == "sch_item" || $page_name_short == "sch_schedule") {
	?>
	<span class="txt_highlight3"><?php echo $lang['menu_schedule'];?></span><br />
	<?php
	} else {
	?>
	<a href="sch_schedule.php?group_id=<?php echo $group['group_id'];?>"><?php echo $lang['menu_schedule'];?></a><br />
	<?php }}?>
	
	
	<?php
	if ($this->group_acs->checkPermission($resource_ids['group_channels'], $privilege_ids['allow_access'])) { //resourece_id, Priv_id
	if ($page_name_short == "chl_list") {
	?>
	<span class="txt_highlight3"><?php echo $lang['menu_channels'];?></span><br />
	<?php
	} else {
	?>
	<a href="chl_list.php?group_id=<?php echo $group['group_id'];?>"><?php echo $lang['menu_channels'];?></a><br />
	<?php 
	}}
	?>
	
	
	<?php
	if ($page_name_short == "g_structure") {
	?>
	<span class="txt_highlight3"><?php echo $lang['menu_structure'];?></span><br />
		<?php
		if ($this->group_acs->checkPermission($resource_ids['group_administration'], $privilege_ids['allow_access'])) { //resourece_id, Priv_id
		?>
		&nbsp;&nbsp;<a href="g_group_edit.php?group_id=<?php echo $group['group_id'];?>"><?php echo $lang['href_edit_group'];?></a><br />
		&nbsp;&nbsp;<a href="g_group_edit.php?group_id=<?php echo $group['group_id'];?>&amp;edit_group_rules=1"><?php echo $lang['href_edit_rules'];?></a><br />
		&nbsp;&nbsp;<a href="g_group_edit.php?group_id=<?php echo $group['group_id'];?>&amp;edit_group_categories=1"><?php echo $lang['href_edit_categories'];?></a><br />
		<?php }?>
	<?php
	} else {
	?>
	<a href="g_structure.php?group_id=<?php echo $group['group_id'];?>"><?php echo $lang['menu_structure'];?></a><br />
	<?php }?>


	<?php
	if ($this->group_acs->checkPermission($resource_ids['group_membership'], $privilege_ids['allow_access'])) { //resourece_id, Priv_id
	if ($page_name_short == "g_membership" || ($page_name_short == "g_member_profile" && $profile['user_id'] != $me['user_id'])) {
	?>
	<span class="txt_highlight3"><?php echo $lang['menu_membership'];?></span><br />
	
		<?php
		if ($this->group_acs->checkPermission($resource_ids['group_membership'], $privilege_ids['allow_invite'])) { //resourece_id, Priv_id
		?>
		&nbsp;&nbsp;<a href="g_membership.php?group_id=<?php echo $group['group_id'];?>&amp;invite_members=1"><?php echo $lang['menu_invite_members'];?></a><br />
		<?php
		}
		?>
						
	<?php
	} else {
	?>
	<a href="g_membership.php?group_id=<?php echo $group['group_id'];?>"><?php echo $lang['menu_membership'];?></a><br />
	<?php 
	}}
	?>
	
	
	<?php
	if ($page_name_short == "g_member_profile" && $profile['user_id'] == $me['user_id']) {
	?>
	<span class="txt_highlight3"><?php echo $lang['menu_my_membership'];?></span><br />
	<?php
	} else {
	?>
	<a href="g_member_profile.php?group_id=<?php echo $group['group_id'];?>"><?php echo $lang['menu_my_membership'];?></a><br />
	<?php 
	}
	?>
	
	
	<?php
	if ($this->group_acs->checkPermission($resource_ids['group_acs'], $privilege_ids['allow_access'])) { //resourece_id, Priv_id
	if ($page_name_short == "g_acs") {
	?>
	<span class="txt_highlight3"><?php echo $lang['menu_acs'];?></span><br />
	<?
	}
	else {
	?>
	<a href="g_acs.php?group_id=<?php echo $group['group_id'];?>"><?php echo $lang['menu_acs'];?></a><br />
	<?php }}?>
	
	<?php
	if ($this->group_acs->checkPermission($resource_ids['group_rsp'], $privilege_ids['allow_edit'])) { //resourece_id, Priv_id
	if ($page_name_short == "g_rsp") {
	?>
	<span class="txt_highlight3"><?php echo $lang['menu_rsp'];?></span><br />
	<?
	}
	else {
	?>
	<a href="g_rsp.php?group_id=<?php echo $group['group_id'];?>"><?php echo $lang['menu_rsp'];?></a><br />
	<?php }}?>
	
	<?php
	if ($this->group_acs->checkPermission($resource_ids['group_newsletter'], $privilege_ids['allow_send'])) { //resourece_id, Priv_id
	if ($page_name_short == 'nlt_edit') {
	?>
	<span class="txt_highlight3"><?php echo $lang['menu_newsletter'];?></span><br />
	<?
	}
	else {
	?>
	<a href="nlt_edit.php?group_id=<?php echo $group['group_id'];?>"><?php echo $lang['menu_newsletter'];?></a><br />
	<?php }}?>
	<br />
	
	<form action="search.php" method="post">
	<input type="hidden" name="group_id" value="<?php if(isset($group['group_id'])) { echo $group['group_id'];}?>" />

	<table cellpadding="0" cellspacing="2" border="0">
		<tr>
			<td>
			<input type="text" name="search_text" size="16" value="<?php if (isset($search_text)) { echo $search_text; } else { echo $lang['txt_search'];}?>" onFocus="javascript:this.value='';" /><br />
			</td>
			<td>
				<img src="<?php echo $templatePath;?>img/pixel.png" width="4" height="1" alt="" /><br />
			</td>
			<td>
				<input type="image" src="<?php echo $templatePath;?>img/search.png" value="search" class="checkbox" /><br />
			</td>
		</tr>
	</table>
	</form>
	<br />
	
	<hr />
	
	<?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 }?>
		
	<table border="0" cellspacing="0" cellpadding="2" width="100%">
		
		<?php
		if (isset($group['member']['role_id'])) {
		?>
		<tr>
			<td>
				<?php echo $lang['txt_membership_status'];?><br />
			</td>
			<td>
				<?php echo $group['member']['role_name'];?><br />
			</td>
		</tr>
		<?php
		}
		else {
		?>
		<tr>
			<td colspan="2">
				<?php echo $lang['txt_group_apply'];?><br /><br />
				<a href="g_apply.php?group_id=<?php echo $group['group_id'];?>"><?php echo $lang['href_join'];?></a><br />
			</td>
		</tr>
		<?php }?>
		<tr>
			<td>
				<?php echo $lang['txt_group_language'];?><br />
			</td>
			<td>
				<?php
				if (isset($lang['arr_lang_name'][$group['language_id']])) {
					echo $lang['arr_lang_name'][$group['language_id']];
				}
				?><br />
			</td>
		</tr>
		<tr>
			<td>
				<?php echo $lang['txt_group_type'];?><br />
			</td>
			<td>
				<?php 
				if (isset($group['group_registration_type'])) {
				    echo $lang['arr_registration_type'][$group['group_registration_type']];
				}
				else {
					echo $lang['txt_hidden'];
				}
				
				?><br />
			</td>
		</tr>
		<tr>
			<td>
				<?php echo $lang['txt_rec_age'];?><br />
			</td>
			<td>
				<?
				if ($group['group_from_age'] && $group['group_to_age']) {
				    echo $group['group_from_age'] . "/" . $group['group_to_age'];
				}
				else if ($group['group_from_age'] && !$group['group_to_age']) {
					echo $group['group_from_age'] . " and up";
				}
				else if (!$group['group_from_age'] && $group['group_to_age']) {
					echo "up to " . $group['group_to_age'];
				}
				else {
					echo "all";
				}
				?>
				<br />
			</td>
		</tr>
	</table>
	<br />
	
	
	<?php
	if (isset($group_statistic)) {
	?>
	<hr />
	<table width="100%" cellpadding="2" cellspacing="0" border="0">
		<?php
		foreach($group_statistic as $key => $i):
		if (isset($lang['arr_group_statistic_type_id'][$i['statistic_type_id']])) {
		?>
		<tr>
			<td>
				<?php echo $lang['arr_group_statistic_type_id'][$i['statistic_type_id']];?><br />
			</td>
			<td align="right">
				<?php echo $i['total'];?><br />
			</td>
		</tr>
		<?php
		}
		endforeach;
		?>
	</table>
	<?php }?>
	<?php }?>	
	<br />
</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>