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

?>


<table width="770" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td width="180" valign="top">
			<?php
			include $templatePath . "g_menu.inc.tpl.php";
			
			$menu_output = "";
			if ($this->group_acs->checkPermission($resource_ids['group_acs'], $privilege_ids['allow_access'])) { //resourece_id, Priv_id
				$menu_output .= "<a href=\"g_acs.php?group_id=" . $group['group_id'] . "\" class=\"txt_sub_menu\">" . $lang['menu_acs'] . "</a><br />\n";
			}
			
			if ($this->group_acs->checkPermission($resource_ids['group_administration'], $privilege_ids['allow_access'])) { //resourece_id, Priv_id
				$menu_output .= "<a href=\"g_group_edit.php?group_id=" . $group['group_id'] . "&amp;edit_group_rules=1\" class=\"txt_sub_menu\">" . $lang['href_edit_rules'] . "</a><br />\n";
			}
			
			if ($this->group_acs->checkPermission($resource_ids['group_administration'], $privilege_ids['allow_access'])) { //resourece_id, Priv_id
				$menu_output .= "<a href=\"g_group_edit.php?group_id=" . $group['group_id'] . "\" class=\"txt_sub_menu\">" . $lang['href_edit_group'] . "</a><br />\n";
			}
			
			if ($this->group_acs->checkPermission($resource_ids['group_cms'], $privilege_ids['allow_edit'])) { //resourece_id, Priv_id
				$menu_output .= "<a href=\"g_cms.php?group_id=" . $group['group_id'] . "\" class=\"txt_sub_menu\">" . $lang['menu_cms'] . "</a><br />\n";
			}
			?>
			
			<?php
			if (!empty($menu_output)) {
			?>
			<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />
			
			<table border="0" cellspacing="0" cellpadding="4" width="100%">
				<tr class="table_stnd">
					<td class="txt_title">
						<?php echo $lang['section_action'];?><br />
						<hr />
					</td>
				</tr>
				<tr>
					<td>
						<?php echo $menu_output;?><br />
					</td>
				</tr>
			</table>
			<?php }?>

			<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />

			<table border="0" width="100%" cellspacing="0" cellpadding="4" class="table_stnd">
				<tr>
					<td class="txt_title">
						<?php echo $lang['hdr_rss'];?><br />
						<hr />
					</td>
				</tr>
				<tr>
					<td>
						<?php echo $lang['txt_rss_help'];?><br />
					</td>
				</tr>
				<tr>
					<td>
						<a href="rss_feed_group.php?feed=<?php echo $group['group_id'] . "_" . $user['user_feed_password'] . $user['user_id'];?>"><img src="<?php echo $templatePath;?>img/rss.png" width="36" height="14" border="0" alt="" /></a><br />
					</td>
				</tr>
			</table>
			
			<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="370" valign="top">
			<table width="100%" cellpadding="4" cellspacing="0" border="0" class="table_stnd">
				<tr>
					<td class="txt_title" align="right">
						<?php echo $group['group_title'];?><br />
						<hr />
					</td>
				</tr>
				<tr>
					<td valign="top">
						<?php echo $group['group_home_synopsis'];?><br />
					</td>
				</tr>
			</table>

			<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />
			
			<?php
			if ($this->group_acs->checkPermission($resource_ids['group_blog'], $privilege_ids['allow_access'])) { //resourece_id, Priv_id
			?>
			<table width="100%" cellpadding="4" cellspacing="0" border="0" class="table_stnd">
				<tr>
					<td class="txt_title" align="right" colspan="2">
						<?php echo $lang['hdr_recommended_b'];?><br />
						<hr />
					</td>
				</tr>
				<?php
				if (isset($blogs)) {
				foreach($blogs as $key => $i):
				?>
				<tr>
					<td valign="top" width="1%">
						<a href="g_blog.php?group_id=<?php echo $group['group_id'];?>&amp;blog_id=<?php echo $i['blog_id'];?>"><img align="right" src="get_file.php?file=<?php echo $i['image']['file'];?>" border="0" class="picture" title="<?php echo $i['image']['file_title'];?>"></a><br />
					</td>
					<td valign="top">
						<a href="g_blog.php?group_id=<?php echo $group['group_id'];?>&amp;blog_id=<?php echo $i['blog_id'];?>"><?php echo $i['blog_create_datetime'];?></a><br />
						<b><?php echo $i['blog_title'];?></b><br />
						<span class="txt_footer"><?php echo $i['blog_synopsis'];?></span><br />
					</td>
			    </tr>
				<?php
				endforeach;
				} else {
				?>
				<tr>
					<td colspan="2">
						<?php echo $lang['err_no_blogs'];?><br />
					</td>
				</tr>
				<?php }?>
			</table>

			<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />
			<?php }?>
			
			<?php
			if ($this->group_acs->checkPermission($resource_ids['group_forum'], $privilege_ids['allow_access'])) { //resourece_id, Priv_id
			?>
			<table width="100%" cellpadding="4" cellspacing="0" border="0" class="table_stnd">
				<tr>
					<td class="txt_title" align="right" colspan="2">
						<?php echo $lang['hdr_recommended_s'];?><br />
						<hr />
					</td>
				</tr>
				<?php
				if (isset($subjects)) {
				foreach($subjects as $key => $i):
				?>
				<tr valign="top">
					<td valign="top" width="1%">
						<a href="g_forum_subject.php?group_id=<?php echo $group['group_id'];?>&amp;subject_id=<?php echo $i['subject_id'];?>"><img align="right" src="get_file.php?file=<?php echo $i['image']['file'];?>" border="0" class="picture" title="<?php echo $i['image']['file_title'];?>"></a><br />
					</td>
					<td valign="top">
						<a href="g_forum_subject.php?group_id=<?php echo $group['group_id'];?>&amp;subject_id=<?php echo $i['subject_id'];?>"><?php echo $i['subject_create_datetime'];?></a><br />
						<b><?php echo $i['subject_title'];?></b><br />
						<span class="txt_footer"><?php echo dots(200,$i['subject_body']);?></span><br />
		 			</td>
				</tr>
				<?php
				endforeach;
				} else {
				?>
				<tr>
					<td colspan="2">
						<?php echo $lang['err_no_subjects'];?><br />
					</td>
				</tr>
				<?php }?>
			</table>
			
			<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />
			<?php }?>
			
			<?php
			if ($this->group_acs->checkPermission($resource_ids['group_library'], $privilege_ids['allow_access'])) { //resourece_id, Priv_id
			?>
			<table width="100%" cellpadding="4" cellspacing="0" border="0" class="table_stnd">
				<tr>
					<td class="txt_title" align="right" colspan="2">
						<?php echo $lang['hdr_library'];?><br />
						<hr />
					</td>
				</tr>
				<?php
				if (isset($library)) {
				foreach($library as $key => $i):
				?>
				<tr>
					<td valign="top" width="1%">
						<a href="g_library.php?group_id=<?php echo $group['group_id'];?>&amp;page=<?php echo $i['library_page_name'];?>"><img align="right" src="get_file.php?file=<?php echo $i['image']['file'];?>" border="0" class="picture" title="<?php echo $i['image']['file_title'];?>"></a><br />
					</td>
					<td valign="top">
						<a href="g_library.php?group_id=<?php echo $group['group_id'];?>&amp;page=<?php echo $i['library_page_name'];?>"><?php echo $i['library_title'];?></a><br />
						<b><?php echo $i['library_title'];?></b><br />
						<span class="txt_footer"><?php echo dots('180', $i['library_synopsis']);?></span><br />
					</td>
				</tr>
			<?php
				endforeach;
				} else {
				?>
				<tr>
					<td colspan="2">
						<?php echo $lang['err_no_library'];?><br />
					</td>
				</tr>
			<?php }?>
			</table>

			<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />
			<?php }?>
			
			<?php
			if ($this->group_acs->checkPermission($resource_ids['group_activity'], $privilege_ids['allow_access'])) { //resourece_id, Priv_id
			?>
			<table width="100%" cellpadding="4" cellspacing="0" border="0" class="table_stnd">
				<tr>
					<td class="txt_title" align="right" colspan="2">
						<?php echo $lang['hdr_activities'];?><br />
						<hr />
					</td>
				</tr>
				<?php
				if (isset($activities)) {
				foreach($activities as $key => $i):
				?>
			    <tr>
					<td valign="top" width="1%">
						<a href="g_activity.php?group_id=<?php echo $group['group_id'];?>&amp;activity_id=<?php echo $i['activity_id'];?>"><img align="right" src="get_file.php?file=<?php echo $i['image']['file'];?>" border="0" class="picture" title="<?php echo $i['image']['file_title'];?>"></a><br />
					</td>
					<td valign="top">
						<a href="g_activity.php?group_id=<?php echo $group['group_id'];?>&amp;activity_id=<?php echo $i['activity_id'];?>"><?php echo $i['activity_start_datetime'];?></a><br />
						<b><?php echo $i['activity_title'];?></b><br />
						<span class="txt_footer"><?php echo $i['activity_synopsis'];?></span><br />

					</td>
				</tr>
			<?php
				endforeach;
				} else {
				?>
				<tr>
					<td colspan="2">
						<?php echo $lang['err_no_activities'];?><br />
					</td>
				</tr>
			<?php }?>
			</table>
			
			<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />
			<?php }?>
			
			<?php
			if ($this->group_acs->checkPermission($resource_ids['group_activity'], $privilege_ids['allow_access'])) { //resourece_id, Priv_id
			?>
			
			<table width="100%" cellpadding="4" cellspacing="0" border="0" class="table_stnd">
				<tr>
					<td class="txt_title" align="right" colspan="2">
						<?php echo $lang['hdr_tasks'];?><br />
						<hr />
					</td>
				</tr>
				<?php
				if (isset($tasks)) {
				foreach($tasks 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>
						<a href="g_activity.php?group_id=<?php echo $group['group_id'];?>&amp;activity_id=<?php echo $i['activity_id'];?>"><?php echo $i['task_start_datetime'];?></a><br />
						<b><?php echo $i['task_title'];?></b><br />
						<span class="txt_footer"><?php echo $i['task_synopsis'];?></span><br />
					</td>
				</tr>
				<?php
				endforeach;
				} else {
				?>
				<tr>
					<td colspan="2">
						<?php echo $lang['err_no_tasks'];?><br />
					</td>
				</tr>
				<?php }?>
			</table>
			<?php }?>
		</td>

		<td width="20">&nbsp;</td>

		<td width="180" valign="top">
			<table border="0" cellspacing="0" cellpadding="4" width="100%" class="table_stnd">
				<tr>
					<td class="txt_title" align="right">
						<?php echo $lang['section_group'];?><br />
						<hr />
					</td>
				</tr>
				<tr>
					<td>
						<table border="0" cellspacing="2" cellpadding="4" width="100%" class="picture">
							<tr>
								<td class="bg1" colspan="2">
									<?php echo $group['group_title'];?><br />
								</td>
							</tr>
							<?php
							if (isset($group['image']['file_id'])) {
							?>
							<tr>
								<td colspan="2">
									<img src="get_file.php?file=<?php echo $group['image']['file'];?>" border="0" alt="<?php echo $group['image']['file_title'];?>" />
								</td>
							</tr>
							<?php }?>
							<?php
							if (isset($group['member']['role_id'])) {
							?>
							<tr>
								<td class="bg3">
									<span class="txt_footer">
									<?php echo $lang['txt_membership_status'];?><br />
									</span>
								</td>
								<td class="bg4">
									<span class="txt_footer">
									<?php echo $group['member']['role_name'];?><br />
									</span>
								</td>
							</tr>
							<?
							}
							else {
							?>
							<tr>
								<td colspan="2" class="bg4">
									<span class="txt_footer">
									<?php echo $lang['txt_group_apply'];?><br /><br />
									<a href="g_apply.php?group_id=<?php echo $group['group_id'];?>" class="txt_footer_link"><?php echo $lang['href_join'];?></a><br />
									</span>
								</td>
							</tr>
							<?
							}
							?>
							<tr>
								<td class="bg3">
									<span class="txt_footer">
									<?php echo $lang['txt_group_language'];?><br />
									</span>
								</td>
								<td class="bg4">
									<span class="txt_footer">
									<?php
									if (isset($lang['arr_lang_name'][$group['language_id']])) {
										echo $lang['arr_lang_name'][$group['language_id']];
									}
									?><br />
									</span>
								</td>
							</tr>
							<tr>
								<td class="bg3">
									<span class="txt_footer">
									<?php echo $lang['txt_group_type'];?><br />
									</span>
								</td>
								<td class="bg4">
									<span class="txt_footer">
									<?php 
									if (isset($group['group_registration_type'])) {
									    echo $lang['arr_registration_type'][$group['group_registration_type']];
									}
									else {
										echo $lang['txt_hidden'];
									}
									
									?><br />
									</span>
								</td>
							</tr>
							<tr>
								<td class="bg3">
									<span class="txt_footer">
									<?php echo $lang['txt_rec_age'];?><br />
									</span>
								</td>
								<td class="bg4">
									<span class="txt_footer">
									<?
									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 />
									</span>
								</td>
							</tr>
							<tr>
								<td class="bg3">
									<span class="txt_footer">
									<?php echo $lang['txt_group_genre'];?><br />
									</span>
								</td>
								<td class="bg4">
									<span class="txt_footer">
									<?php
									if (isset($lang['arr_genre'][$group['genre_id']])) {
									    echo $lang['arr_genre'][$group['genre_id']];
									}
									?>
									<br />
									</span>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
			
			<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />
			
			<?php
			if ($this->group_acs->checkPermission($resource_ids['group_poll'], $privilege_ids['allow_access'])) { //resourece_id, Priv_id
			if (isset($polls)) {
 			?>
 			<table border="0" cellspacing="4" cellpadding="0" width="100%" class="table_stnd">
 				<tr>
 					<td class="txt_title" align="right">
 						<?php echo $lang['hdr_polls'];?><br />
 						<hr />
 					</td>
 				</tr>
 				<?php
 				foreach($polls as $key => $i):
 				?>
 				<tr>
 					<td valign="top">
 						<?php
						$poll = $i;
 						include $templatePath . "poll.inc.tpl.php";
 						?>
 					</td>
 			    </tr>
				<tr>
 					<td valign="top" class="txt_footer" align="right">
 						<a href="g_poll.php?group_id=<?php echo $group['group_id'];?>&amp;poll_id=<?php echo $i['poll_id'];?>" class="txt_footer_lnk">visit poll</a><br />
 					</td>
 			    </tr>
				<tr>
					<td>
						<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="2" alt="" /><br />
					</td>
				</tr>
 				<?php
 				endforeach;
 				?>
 			</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" class="table_stnd">
				<tr>
					<td colspan="2" class="txt_title" align="right">
						<?php echo $lang['hdr_statistics'];?><br />
						<hr />
					</td>
				</tr>
				<?php
				if (isset($group_statistic[0])) {
				foreach($group_statistic as $key => $i):
				?>
				<tr>
					<td class="txt_footer">
						<?php echo $lang['arr_group_statistic_type_id'][$i['statistic_type_id']];?><br />
					</td>
					<td align="right">
						<span class="txt_footer"><?php echo $i['total'];?></span><br />
					</td>
				</tr>
				<?php
				endforeach;
				} else {
				?>
				<tr>
					<td colspan="2">
						<?php echo $lang['err_no_statistics'];?><br />
					</td>
				</tr>
				<?php }?>
			</table>
		</td>
	</tr>
</table>
