<?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="e_schedule.php" method="post" name="search">

<table width="770" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td width="180" valign="top">
			<?php
			include $templatePath . "a_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>
						<a href="<?php echo $_SERVER["PHP_SELF"]?>?time=<?php echo $links["last"]?>" class="txt_sub_menu"><?php echo $name["last"]?></a><br />
						<a href="<?php echo $_SERVER["PHP_SELF"]?>?time=<?php echo $links["next"]?>" class="txt_sub_menu"><?php echo $name["next"]?></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="570" valign="top">
			<table width="100%" cellpadding="2" cellspacing="2" border="0" class="table_stnd">
				<tr>
					<td class="txt_title" align="right">
						<?echo $today;?><br />
						<hr />
					</td>
				</tr>
			</table>

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

			<table width="100%" cellpadding="0" cellspacing="4" border="0" class="table_stnd">
				<tr>
					<td width="75%">
						<table width=100% cellpadding="0" cellspacing="4" border="0" class="table_nested">
							<?php
			   				if (isset($calendar[0])) {

			   				?>
			   				<tr>
			   					<td class="txt_footer">
									<?php echo $lang['txt_time'];?>
								</td>
			   					<td class="txt_footer">
									<?php echo $lang['txt_activity'];?>
								</td>
			   				</tr>

			   				<?php
			   				foreach($calendar as $key => $r):
			   				if(isset($r['content'][0]) | $key>8){
			   				?>
			   				<tr>
			   					<td width="10%">
			   					<?php echo $key.":00";?>
			   					</td>
			   					<td width="90%" valign="top">
			   						<table width="100%" cellpadding="4" cellspacing="0" border="0" class="table_nested">
			   							<tr>
			   								<td class="txt_footer">
			   									<?php
			   									if (isset($r['content'][0])) {
			   									$width = floor(100/$nr)>0 ? floor(100/$nr) : 100;
			   									?>
			   									<?php
			   									foreach($r['content'] as $key => $i):
			   									$title = "title: " . $i['activity_title'] . "\n" . $lang['txt_synopsis'] . ": " . $i['activity_synopsis'] . "\n" . "time: " . $i['activity_start_datetime'] . "\n" . "location: " . $i['activity_location'];
			   									?>
			   									<a href="a_activity.php?activity_id=<?php echo $i["activity_id"]?>" class="txt_footer_link" title="<?php echo $title;?>"><?php echo $i['activity_title'];?></a><br />
			   									
			   									<?php
			   									endforeach;

			   									}
			   									?>
			   								</td>
			   							</tr>
			   						</table>
			   					</td>
			   				</tr>
			   				<?php
			   				}
			   				endforeach;
			   				}
			   				?>
						</table>
					</td>
					<td width="25%" valign="top" cellpadding="2" cellspacing="2" border="0">
						<?php
						if (!empty($todo)) {
						echo "<strong>On this day</strong><br />";
						foreach($todo as $key => $i):
						$title = "title: " . $i['activity_title'] . "\n" . "description: " . $i['activity_description'] . "\n" . "time: " . $i['activity_start_datetime'] . "\n" . "location: " . $i['activity_location'];
						if($i['activity_type_id']<3){

							if(!isset($set_title)){
								echo "<br /><strong>Non time specific activities</strong><br />";
								$set_title = "yes";
							}
						?>
							<a href="e_activity.php?activity_id=<?php echo $i["activity_id"]?>" class="txt_footer_link" title="<?php echo $title;?>"><?php echo $i['activity_title'];?></a><br />
						<?php
						}
						else {
						?>
							<?php echo $i['activity_title'];?><br />
						<?php
						}
						?>

						<?php
						endforeach;
						}
						?>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
</form>
