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

?>


<form action="g_calendar.php" method="post">

<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" width="100%" cellspacing="4" cellpadding="0">
				<tr>
					<td class="txt_title">
						<?php echo $lang['section_action'];?><br />
						<hr />
					</td>
				</tr>
				<tr>
					<td>
						<a href="<?php echo $_SERVER["PHP_SELF"]?>?group_id=<?php echo $group['group_id'];?>&amp;time=<?php echo $links["last"]?>" class="txt_sub_menu"><?php echo $lang['menu_calendar_last'];?></a><br />
						<a href="g_calendar.php?group_id=<?php echo $group['group_id'];?>" class="txt_sub_menu"><?php echo $lang['menu_calendar_today'];?></a><br />
						<a href="<?php echo $_SERVER["PHP_SELF"]?>?group_id=<?php echo $group['group_id'];?>&amp;time=<?php echo $links["next"]?>" class="txt_sub_menu"><?php echo $lang['menu_calendar_next'];?></a><br />
						<a href="g_activity_edit.php?group_id=<?php echo $group['group_id'];?>" class="txt_sub_menu"><?php echo $lang['href_activity_add'];?></a><br />
					
					
					
					</td>
				</tr>
			</table>

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

			<table border="0" width="100%" cellspacing="4" cellpadding="0">
				<tr>
					<td class="txt_title">
						<?php echo $lang['section_search'];?><br />
						<hr />
					</td>
				</tr>
				<tr>
					<td>
						<input type="text" name="search_text" size="18" class="formInput" value="<?php if(isset($search)) { echo $search;}?>" /><br />
					</td>
			    </tr>
				<tr>
					<td align="right">
						<input type="submit" name="search" value="<?php echo $lang['sub_search'];?>" class="formInput" /><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="275" valign="top">
			<table width="100%" cellpadding="4" cellspacing="2" border="0" class="table_stnd">
				<tr>
					<td colspan="4" 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 valign="top" colspan="2">
						<?php
						if (isset($i['image'])) {
						?>
							<img align="left" src="get_file.php?file=<?php echo $i['image']['file'];?>" border="0" class="picture_left" title="<?php echo $i['image']['file_title'];?>" alt="" />
						<?
						}
						?>
						<a href="g_activity.php?activity_id=<?php echo $i['activity_id'];?>&amp;group_id=<?php echo $group['group_id'];?>"><?php echo $i['activity_title'];?></a><br />
						<span class="txt_footer"><?php echo $i['activity_synopsis'];?></span><br />
					</td>
					<td align="right" valign="top" nowrap>
						<?php echo $i['display_activity_start_datetime'];?><br />
					</td>
			    </tr>
				<?php
				endforeach;
				} else {
				?>
				<tr>
					<td colspan="3">
						<?php echo $lang['err_no_activity_tasks'];?><br />
					</td>
				</tr>
				<?php }?>
			</table>
		</td>
		
		<td width="20">&nbsp;</td>
		
		<td width="275" valign="top">
			<table width="100%" cellpadding="0" cellspacing="4" border="0" class="table_stnd">
				<tr>
					<td class="txt_title" align="right">
						<?echo $thismonth;?><br />
						<hr />
					</td>
				</tr>
				<tr>
					<td>
						<table width="100%" cellpadding="2" cellspacing="2" border="0" class="picture">
							<?php
							if (isset($calendar)) {

							$day = 0;
							?>
							<tr>
								<td class="bg2" align="center"><?php echo $lang['activity']['arr_day_name_abv']['1'];?></td>
								<td class="bg2" align="center"><?php echo $lang['activity']['arr_day_name_abv']['2'];?></td>
								<td class="bg2" align="center"><?php echo $lang['activity']['arr_day_name_abv']['3'];?></td>
								<td class="bg2" align="center"><?php echo $lang['activity']['arr_day_name_abv']['4'];?></td>
								<td class="bg2" align="center"><?php echo $lang['activity']['arr_day_name_abv']['5'];?></td>
								<td class="bg2" align="center"><?php echo $lang['activity']['arr_day_name_abv']['6'];?></td>
								<td class="bg2" align="center"><?php echo $lang['activity']['arr_day_name_abv']['7'];?></td>
							</tr>

							<?php
							foreach($calendar as $key => $r):

							if ($day == 0) {
							    echo "<tr>";
							}
							?>


								<?php
								if (isset($r['today'])) {
								?>

								<?php
								if ($todaynumber == $r['daynumber']) {
								?>
								<td width="14%" valign="top" class="bg1" align="center">
								<?php
								}
								else {
								?>
								<td width="14%" valign="top" class="bg3" align="center">
								<?php
								}
								?>
									<table width="100%" cellpadding="2" cellspacing="0" border="0" class="table_nested">
										<tr>
											<td align="center">
												<?php
												if(!isset($r['content'][0]))
													echo $r['daynumber'];
												else {
												?>
													<a href="g_schedule.php?group_id=<?php echo $group['group_id'];?>&amp;time=<?php echo strtotime($r["today"]);?>"><?php echo $r['daynumber'];?></a>
												<?php
												}
												?><br />
											</td>
										</tr>
										<tr>
											<td align="center">
												<?php
												if (isset($r['content'])) {
													$count = count($r['content']);
													if ($count <= 0) {
													    $count = "";
													}
												
													echo $count;
												}
												?>
												<br />
											</td>
										</tr>
									</table>



								</td>

								<?php
								}
								else {
								?>
								<td class="bg4">&nbsp;<br /></td>
								<?php
								}
								?>

							<?php
							$day++;

							if ($day == 7) {
							    echo "</tr>";
								$day = 0;
							}

							endforeach;
							}
							?>
						</table>
					</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" class="table_stnd">
				<tr>
					<td colspan="4" 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 width="3" valign="top">
						<img src="<?php echo $templatePath;?>img/green_dot.png" width="3" height="9" alt="" /><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'];?>&amp;task_id=<?php echo $i['task_id'];?>"><?php echo $i['task_title'];?></a><br />
						<span class="txt_footer"><?php echo $i['task_synopsis'];?></span><br />
					</td>
					<td valign="top">
						<?php echo $i['task_user_requirement'];?><br />
					</td>
					<td align="right" valign="top" nowrap>
						<?php echo $i['task_start_datetime'];?><br />
					</td>
			    </tr>
				<?php
				endforeach;
				} else {
				?>
				<tr>
					<td colspan="4">
						<?php echo $lang['err_no_activity_tasks'];?><br />
					</td>
				</tr>
				<?php }?>
			</table>
		</td>
	</tr>
</table>
</form>
