<?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_activity'], $privilege_ids['allow_edit'])) { //resourece_id, Priv_id
						?>
						<a href="g_activity_edit.php?group_id=<?php echo $group['group_id'];?>&amp;activity_id=<?php echo $activity['activity_id'];?>" class="txt_sub_menu"><?php echo $lang['href_edit_this'];?></a><br />
						<a href="g_activity_task_edit.php?group_id=<?php echo $group['group_id'];?>&amp;activity_id=<?php echo $activity['activity_id'];?>" class="txt_sub_menu"><?php echo $lang['href_add_task'];?></a><br />
						<?php }?>

						<?php
						if (isset($activity['bookmark']['watch'])) {
						?>
						<a href="g_activity.php?group_id=<?php echo $group['group_id'];?>&amp;activity_id=<?php echo $activity['activity_id'];?>&amp;unwatch=1" class="txt_sub_menu"><?php echo $lang['href_unwatch_this'];?></a><br />
						<?php
						}
						else {
						?>
						<a href="g_activity.php?group_id=<?php echo $group['group_id'];?>&amp;activity_id=<?php echo $activity['activity_id'];?>&amp;watch=1" class="txt_sub_menu"><?php echo $lang['href_watch_this'];?></a><br />
						<?php
						}
						?>

						<?php
						if (isset($activity['bookmark']['recommend'])) {
						?>
						<a href="g_activity.php?group_id=<?php echo $group['group_id'];?>&amp;activity_id=<?php echo $activity['activity_id'];?>&amp;unrecommend=1" class="txt_sub_menu"><?php echo $lang['href_unrecommend_this'];?></a><br />
						<?php
						}
						else {
						?>
						<a href="g_activity.php?group_id=<?php echo $group['group_id'];?>&amp;activity_id=<?php echo $activity['activity_id'];?>&amp;recommend=1" class="txt_sub_menu"><?php echo $lang['href_recommend_this'];?></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="570" valign="top">

			<table border="0" cellspacing="0" cellpadding="4" width="100%">
				<tr>
					<td class="txt_title" align="right" colspan="2">
						<?php echo $lang['hdr_activity_details'];?><br />
						<hr />
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<b><?php echo $activity['activity_title'];?></b><br />
					</td>
				</tr>
				<tr>
					<td class="txt_footer" colspan="2">
						<a href="g_member_profile.php?group_id=<?php echo $group['group_id'];?>&amp;user_id=<?php echo $activity['author']['user_id'];?>" class="txt_footer_link"><?php echo $activity['author']['profile_nic'];?></a>&nbsp;(joined: <?php echo $activity['author']['display_profile_create_datetime'];?>, <?php echo $lang['arr_user_online_status'][$activity['author']['online_status']];?>, <?php echo $lang['txt_hometown'];?>: <?php echo $activity['author']['profile_hometown'];?>)<br />
					</td>
				</tr>
				<tr>
					<td valign="top" width="1%">
						<img align="left" src="get_file.php?file=<?php echo $activity['image']['file'];?>" border="0" class="picture" title="<?php echo $activity['image']['file_title'];?>" alt="" /><br />
					</td>
					<td valign="top">
						<table border="0" cellspacing="0" cellpadding="2">
							<tr>
								<td colspan="2">
									<?php echo $activity['activity_synopsis'];?><br />
								</td>
							</tr>
							<tr>
								<td>
									<?php echo $lang['txt_start'];?><br />
								</td>
								<td>
									<?php echo $activity['activity_start_datetime'];?><br />
								</td>
							</tr>
							<tr>
								<td>
									<?php echo $lang['txt_end'];?><br />
								</td>
								<td>
									<?php echo $activity['activity_end_datetime'];?><br />
								</td>
							</tr>
							<tr>
								<td>
									<?php echo $lang['txt_location'];?><br />
								</td>
								<td>
									<?php echo $activity['activity_location'];?><br />
								</td>
							</tr>
							<tr>
								<td>
									<?php echo $lang['txt_type'];?><br />
								</td>
								<td>
									<?php 
									if (isset($activity['activity_type_id'])) {
									    echo $lang['group']['arr_activity_type'][$activity['activity_type_id']];
									}?><br />
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td valign="top" colspan="2">
						<?php echo $activity['activity_body'];?><br />
					</td>
				</tr>
			</table>

			<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" align="right" colspan="2">
						<?php echo $lang['hdr_tasks'];?><br />
						<hr />
					</td>
				</tr>
				<?php
				if (isset($tasks)) {
				foreach($tasks as $key => $i):
				?>
				<tr>
					<td colspan="2">
						<?php
						if ($this->group_acs->checkPermission($resource_ids['group_activity'], $privilege_ids['allow_edit'])) { //resourece_id, Priv_id
						?>
						<a href="g_activity_task_edit.php?group_id=<?php echo $group['group_id'];?>&amp;activity_id=<?php echo $activity['activity_id'];?>&amp;task_id=<?php echo $i['task_id'];?>"><b><?php echo $i['task_title'];?></b></a><br />
						<?php 
						}
						else {
						?>
						<b><?php echo $i['task_title'];?></b><br />
						<?php }?>
					</td>
				</tr>
				<tr>
					<td width="60%" valign="top">
						<?php echo $i['task_synopsis'];?><br />
						<span class="txt_footer">
						<?php echo $lang['txt_allocation'];?>:&nbsp;<?php echo $i['task_user_requirement'];?>, 
						<?php echo $lang['txt_applications'];?>:&nbsp;<?php echo $i['task_applicants'];?>, 
						<?php echo $lang['txt_confirmed'];?>:&nbsp;<?php echo $i['task_confirmed'];?><br />
						</span>
					</td>
					<td width="40%" valign="top" align="right">
						<?php echo $lang['txt_task_status'];?>:&nbsp;
						<?php
						if ($i['task_user_requirement'] > $i['task_confirmed']) { //more spaces than those users confirmed for task
						if (isset($i['status']['status_id'])) {
						?>
						<?php echo $lang['arr_activity_user_status'][$i['status']['status_id']];?><br />
						<?php
						//if task is confirmed allow use to remove it
						if ($i['status']['status_id'] == $task_status_ids['confirmed']) {
						?>
						<a href="g_activity.php?group_id=<?php echo $group['group_id'];?>&amp;activity_id=<?php echo $activity['activity_id'];?>&amp;task_id=<?php echo $i['task_id'];?>&amp;withdraw_confirmation=1"><?php echo $lang['href_task_withdraw_confirmation'];?></a><br />
						<?php
						}
						elseif ($i['status']['status_id'] == $task_status_ids['withdrawn'] || $i['status']['status_id'] < 1) {
						?>
						<a href="g_activity.php?group_id=<?php echo $group['group_id'];?>&amp;activity_id=<?php echo $activity['activity_id'];?>&amp;task_id=<?php echo $i['task_id'];?>&amp;task_apply_update=1"><?php echo $lang['href_task_apply'];?></a><br />
						<?php
						}
						}
						else {
						?>
						<a href="g_activity.php?group_id=<?php echo $group['group_id'];?>&amp;activity_id=<?php echo $activity['activity_id'];?>&amp;task_id=<?php echo $i['task_id'];?>&amp;task_apply=1"><?php echo $lang['href_task_apply'];?></a><br />
						<?php
						}
						}
						else {
						?>
						<?php echo $lang['txt_task_full'];?><br />
						<?php
						}
						?>
					</td>
				</tr>
				<?php
				endforeach;
				} else {
				?>
				<tr>
					<td colspan="3">
						<?php echo $lang['err_no_tasks'];?><br />
					</td>
				</tr>
			</table>
				<?php }?>
			</table>
		</td>
	</tr>
</table>