<?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";
			?>

			<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="10" alt="" /><br />
			
			<table border="0" cellspacing="0" cellpadding="4" width="100%">
				<tr>
					<td class="txt_title">
						<?php echo $lang['section_action'];?><br />
						<hr />
					</td>
				</tr>
				<tr>
					<td>
						<?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_sub_menu_on"><?php echo $lang['menu_acs'];?></span><br />
						<?php
						} else {
						?>
						<a href="g_acs.php?group_id=<?php echo $group['group_id'];?>" class="txt_sub_menu"><?php echo $lang['menu_acs'];?></a><br />
						<?php
						}}
						?>
						
						
						<?php
						if ($this->group_acs->checkPermission($resource_ids['group_administration'], $privilege_ids['allow_access'])) { //resourece_id, Priv_id
						if ($page_name_short == "g_group_edit" && isset($display) && ($display == "edit_group_rules" || $display == "edit_group_rules")) {
						?>
						<span class="txt_sub_menu_on"><?php echo $lang['href_edit_rules'];?></span><br />
						<?php
						} else {
						?>
						<a href="g_group_edit.php?group_id=<?php echo $group['group_id'];?>&amp;edit_group_rules=1" class="txt_sub_menu"><?php echo $lang['href_edit_rules'];?></a><br />
						<?php
						}}
						?>
			
			
						<?php
						if ($this->group_acs->checkPermission($resource_ids['group_administration'], $privilege_ids['allow_access'])) { //resourece_id, Priv_id
						if ($page_name_short == "g_group_edit" && !isset($display)) {
						?>
						<span class="txt_sub_menu_on"><?php echo $lang['href_edit_group'];?></span><br />
						<?php
						} else {
						?>
						<a href="g_group_edit.php?group_id=<?php echo $group['group_id'];?>" class="txt_sub_menu"><?php echo $lang['href_edit_group'];?></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 == "g_files_edit") {
						?>
						<span class="txt_sub_menu_on"><?php echo $lang['href_edit_files'];?></span><br />
						<?php
						} else {
						?>
						<a href="g_files_edit.php?group_id=<?php echo $group['group_id'];?>" class="txt_sub_menu"><?php echo $lang['href_edit_files'];?></a><br />
						<?php
						}}
						?>
						
						<?php
						if ($this->group_acs->checkPermission($resource_ids['group_cms'], $privilege_ids['allow_edit'])) { //resourece_id, Priv_id
						if ($page_name_short == "g_cms") {
						?>
						<span class="txt_sub_menu_on"><?php echo $lang['menu_cms'];?></span><br />
						<?php
						} else {
						?>
						<a href="g_cms.php?group_id=<?php echo $group['group_id'];?>" class="txt_sub_menu"><?php echo $lang['menu_cms'];?></a><br />
						<?php
						}}
						?>
					</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">
				<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 />

			<table width="100%" cellpadding="4" cellspacing="0" border="0">
				<tr>
					<td class="txt_title" align="right">
						<?php echo $lang['hdr_recommended_b'];?><br />
						<hr />
					</td>
				</tr>
				<?php
				if (isset($blogs)) {
				foreach($blogs as $key => $i):
				?>
				<tr>
					<td valign="top">
						<?php
						if (isset($i['image']['file_id'])) {
						?>
						<a href="g_forum.php?group_id=<?php echo $group['group_id'];?>&amp;topic_id=<?php echo $i['topic_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>
						<?
						}
						?>
						<a href="g_blog.php?group_id=<?php echo $group['group_id'];?>&amp;topic_id=<?php echo $i['blog_id'];?>"><?php echo $i['blog_title'];?></a><br />
						<span class="txt_footer"><?php echo $i['blog_synopsis'];?></span><br />
					</td>
			    </tr>
				<?php
				endforeach;
				} else {
				?>
				<tr>
					<td>
						<?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 />

			<table width="100%" cellpadding="4" cellspacing="0" border="0">
				<tr>
					<td class="txt_title" align="right">
						<?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">
						<?php
						if (isset($i['image']['file_id'])) {
						?>
							<a href="g_forum_subject.php?group_id=<?php echo $group['group_id'];?>&amp;topic_id=<?php echo $i['topic_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>
						<?
						}
						?>
						<a href="g_forum_subject.php?group_id=<?php echo $group['group_id'];?>&amp;topic_id=<?php echo $i['topic_id'];?>&amp;subject_id=<?php echo $i['subject_id'];?>"><?php echo $i['subject_title'];?></a><br />
						<span class="txt_footer"><?php echo dots(200,$i['subject_body']);?></span><br />
					</td>
			    </tr>
				<?php
				endforeach;
				} else {
				?>
				<tr>
					<td>
						<?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 />

			<table width="100%" cellpadding="4" cellspacing="0" border="0">
				<tr>
					<td class="txt_title" align="right">
						<?php echo $lang['hdr_library'];?><br />
						<hr />
					</td>
				</tr>

				<?php
				if (isset($library)) {
				foreach($library as $key => $i):
				?>
				<tr>
					<td>
						<?php
						if (isset($i['image']['file_id'])) {
						?>
							<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>
						<?
						}
						?>
						<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 />
						<span class="txt_footer"><?php echo dots('180', $i['library_synopsis']);?></span><br />
					</td>

				<tr>
					<td>
						<img src=<?php echo $templatePath;?>img/pixel.png width="1" height="4"><br />
					</td>
				</tr>
			<?php
				endforeach;
				} else {
				?>
				<tr>
					<td>
						<?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 />

			<table width="100%" cellpadding="4" cellspacing="0" border="0">
				<tr>
					<td class="txt_title" align="right">
						<?php echo $lang['hdr_activities'];?><br />
						<hr />
					</td>
				</tr>
				<?php
				if (isset($activities)) {
				foreach($activities as $key => $i):
				?>
				
			    <tr>
					<td>
						<?php
						if (isset($i['image'])) {
						?>
							<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>
						<?php }?>
						<a href="g_activity.php?group_id=<?php echo $group['group_id'];?>&amp;activity_id=<?php echo $i['activity_id'];?>"><?php echo $i['activity_title'];?></a><br />
						<?php echo $i['activity_start_datetime'];?><br />
						<br />
						<span class="txt_footer"><?php echo $i['activity_synopsis'];?></span><br />

					</td>
				</tr>
			<?php
				endforeach;
				} else {
				?>
				<tr>
					<td>
						<?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 />

			<table width="100%" cellpadding="4" cellspacing="0" border="0">
				<tr>
					<td class="txt_title" align="right">
						<?php echo $lang['hdr_tasks'];?><br />
						<hr />
					</td>
				</tr>
				<?php
				if (isset($tasks)) {
				foreach($tasks as $key => $i):
				?>
				
			    <tr>
					<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_title'];?></a><br />
						<?php echo $i['task_start_datetime'];?><br />
						<br />
						<span class="txt_footer"><?php echo $i['task_synopsis'];?></span><br />
					</td>
				</tr>
			<?php
				endforeach;
				} else {
				?>
				<tr>
					<td>
						<?php echo $lang['err_no_tasks'];?><br />
					</td>
				</tr>
			<?php }?>
			</table>
		</td>

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

		<td width="180" valign="top">
			<table border="0" cellspacing="0" cellpadding="4" width="100%">
				<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 echo $lang['arr_registration_type'][$group['group_registration_type']];?><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 (isset($polls)) {
 			?>
 			<table border="0" cellspacing="4" cellpadding="0" width="100%">
 				<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">
				<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>
