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

?>

<script type="text/javascript" src="js/calendar.js"></script>
<script type="text/javascript" src="<?php echo $languagePath;?>calendar/calendar-lang.js"></script>
<script type="text/javascript" src="js/calendar-setup.js"></script>


<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td width="240" valign="top">
			<form action="sch_list.php" method="post" name="frm">
			<input type="hidden" name="schedule_type_id" value="<?php if(isset($schedule_type_id)) { echo $schedule_type_id;}?>" />

			<?php
			if (isset($display) && $display == "task") {
			?>

			<div class="box_top">
				<?php echo $lang['hdr_task'];?><br />
			</div>

			<div class="box_mid" style="padding: 9px;">
			<table width="100%" cellpadding="2" cellspacing="2" border="0">
				<tr>
					<td colspan="2">
						<?php echo $lang['txt_task_summary'];?><br />
					</td>
				</tr>
				<tr>
					<td align="center" colspan=2">
						<div id="calendar-container-flat" style="top:100px; width:210px">
						<script type="text/javascript">
						  function dateChanged(calendar) {
						    if (calendar.dateClicked) {
						      var y = calendar.date.getFullYear();
						      var m = calendar.date.getMonth()+1;     // integer, 0..11
						      var d = calendar.date.getDate();      // integer, 1..31

							  document.frm.id_start_date.value = y + '-' + m + '-' + d;
						    }
						  };

						  Calendar.setup(
						    {
						      flat         : "calendar-container-flat", // ID of the parent element
						      flatCallback : dateChanged           // our callback function
						    }
						  );
						</script>
						</div>
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="3" alt="" border="0" /><br />
					</td>
				</tr>
				<tr>
					<td>
						<label for="id_start_date"><?php echo $lang['form_label_from_date'];?></label><br />
					</td>
					<td valign="top">
						<input type="text" name="start_date" id="id_start_date" size="11" value="<?php if(isset($search['start_date'])) { echo $search['start_date'];}?>" /><br />
					</td>
				</tr>
					<tr>
					<td colspan="2">
						<?php echo $lang['txt_hint_date'];?><br />
					</td>
				</tr>
				<tr>
					<td valign="top">
						<label for="id_schedule_priority"><?php echo $lang['form_label_priority'];?></label><br />
					</td>
					<td>
						<select id="id_schedule_priority" name="schedule_priority">
						<option value="0"><?php echo $lang['form_option_all'];?></option>
						<?php
						foreach($lang['schedule']['arr_priority'] as $key => $i):
						$selected = "";

						if (isset($schedule_priority) && $schedule_priority == $key) {
						    $selected = " selected=\"selected\"";
						}
						?>
						<option value="<?php echo $key;?>"<?php echo $selected;?>><?php echo $i;?></option>
						<?php endforeach; ?>
						</select>
					</td>
				</tr>
				<tr>
					<td colspan="2" align="center">
						<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="3" alt="" border="0" /><br />
					</td>
				</tr>
				<tr>
					<td colspan="2" align="right">
						<input type="submit" name="search" class="button_urgent" value="<?php echo $lang['form_sub_find'];?>" /><br />
					</td>
				</tr>
			</table>
			</form>

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

			<form action="search.php" method="post" name="searchfrm">
			<table cellpadding="2" cellspacing="0" border="0" width="100%">
				<tr>
					<td colspan="3">
						<?php echo $lang['txt_task_search_intro'];?><br />
						<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="6" alt="" /><br />
					</td>
				</tr>
				<tr>
					<td>
						<?php echo $lang['txt_search'];?>
					</td>
					<td>
						<input type="text" name="search_text" size="20" value="" /><br />
					</td>
					<td>
						<input type="image" src="<?php echo $templatePath;?>img/search.png" value="search" class="checkbox" /><br />
					</td>
				</tr>
			</table>
			</form>
			</div>

			<div id="box_bottom">
				<table cellpadding="0" cellspacing="0" border="0" width="100%">
					<tr>
						<td align="left">
							<img src="<?php echo $templatePath;?>img/box_bottom_left.png" width="5" height="18" alt="" border="0" /><br />
						</td>
						<td align="left">
							<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="9" alt="" border="0" /><br />
						</td>
						<td align="right">
							<img src="<?php echo $templatePath;?>img/box_bottom_right.png" width="5" height="18" alt="" border="0" /><br />
						</td>
					</tr>
				</table>
			</div>


			<?php
			}
			else {
			?>

			<div class="box_top">
				<?php echo $lang['hdr_event'];?><br />
			</div>

			<div class="box_mid" style="padding: 9px;">
			<table width="100%" cellpadding="2" cellspacing="2" border="0">
				<tr>
					<td colspan="2">
						<?php echo $lang['txt_event_summary'];?><br />
					</td>
				</tr>
				<tr>
					<td align="center" colspan=2">
						<div id="calendar-container-flat" style="100%">
						<script type="text/javascript">
						  function dateChanged(calendar) {
						    if (calendar.dateClicked) {
						      var y = calendar.date.getFullYear();
						      var m = calendar.date.getMonth()+1;     // integer, 0..11
						      var d = calendar.date.getDate();      // integer, 1..31
							  
							  document.frm.id_start_date.value = y + '-' + m + '-' + d;
							  
							 }
						  };

						  Calendar.setup(
						    {
						      flat         : "calendar-container-flat", // ID of the parent element
						      flatCallback : dateChanged           // our callback function
						    }
						  );
						</script>
						</div>
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="3" alt="" border="0" /><br />
					</td>
				</tr>
				<tr>
					<td>
						<label for="id_start_date"><?php echo $lang['form_label_from_date'];?></label><br />
					</td>
					<td valign="top">
						<input type="text" name="start_date" id="id_start_date" size="11" value="<?php if(isset($search['start_date'])) { echo $search['start_date'];}?>" /><br />
					</td>
				</tr>
				<tr>
					<td valign="top">
						<label for="id_schedule_show"><?php echo $lang['form_label_show'];?></label><br />
					</td>
					<td>
						<select id="id_schedule_show" name="schedule_show">
						<option value="0"><?php echo $lang['form_option_all'];?></option>
						<?php
						foreach($lang['schedule']['arr_show_days'] as $key => $i):
						$selected = "";

						if (isset($schedule_network) && $schedule_network == $key) {
						    $selected = " selected=\"selected\"";
						}
						?>
						<option value="<?php echo $key;?>"<?php echo $selected;?>><?php echo $i;?></option>
						<?php endforeach; ?>
						</select>
					</td>
				</tr>
				<tr>
					<td valign="top">
						<label for="id_schedule_network"><?php echo $lang['form_label_network'];?></label><br />
					</td>
					<td>
						<select id="id_schedule_network" name="schedule_network">
						<?php
						foreach($lang['schedule']['arr_network'] as $key => $i):
						$selected = "";

						if (isset($schedule_network) && $schedule_network == $key) {
						    $selected = " selected=\"selected\"";
						}
						?>
						<option value="<?php echo $key;?>"<?php echo $selected;?>><?php echo $i;?></option>
						<?php endforeach; ?>
						</select>
					</td>
				</tr>
				<tr>
					<td valign="top">
						<label for="id_schedule_status"><?php echo $lang['form_label_tentative'];?></label><br />
					</td>
					<td>
						<input type="checkbox" id="id_schedule_status" name="schedule_status" class="checkbox" /><br />
					</td>
				</tr>
				<tr>
					<td colspan="2" align="center">
						<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="3" alt="" border="0" /><br />
					</td>
				</tr>
				<tr>
					<td colspan="2" align="right">
						<input type="submit" name="search" class="button_urgent" value="<?php echo $lang['form_sub_find'];?>" /><br />
					</td>
				</tr>
			</table>
			</form>

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

			<form action="search.php" method="post" name="searchfrm">
			<table cellpadding="2" cellspacing="0" border="0" width="100%">
				<tr>
					<td colspan="2">
						<?php echo $lang['txt_event_search_intro'];?><br />
						<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="6" alt="" /><br />
					</td>
				</tr>
				<tr>
					<td>
						<input type="text" name="search_text" size="20" value="" /><br />
					</td>
					<td>
						<input type="image" src="<?php echo $templatePath;?>img/search.png" value="search" class="checkbox" /><br />
					</td>
				</tr>
			</table>
			</form>
			
			</div>

			<div id="box_bottom">
				<table cellpadding="0" cellspacing="0" border="0" width="100%">
					<tr>
						<td align="left">
							<img src="<?php echo $templatePath;?>img/box_bottom_left.png" width="5" height="18" alt="" border="0" /><br />
						</td>
						<td align="left">
							<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="9" alt="" border="0" /><br />
						</td>
						<td align="right">
							<img src="<?php echo $templatePath;?>img/box_bottom_right.png" width="5" height="18" alt="" border="0" /><br />
						</td>
					</tr>
				</table>
			</div>
			<?php }?>

		</td>

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

		<td width="500" valign="top">
			<div class="box_top">
				<?php echo $lang['hdr_featured_tasks'];?><br />
			</div>

			<div class="box_mid" style="padding: 9px;">
			<table width="100%" cellpadding="4" cellspacing="0" border="0">
				<?php
				if (isset($schedule_items)) {
				foreach($schedule_items as $key => $i):
				?>
			     <tr>
					<td valign="top">
						<?php
						if (isset($group)) {
							$lnk = "sch_item.php?group_id=" . $i['group_id'] . "&amp;schedule_id=" . $i['schedule_id'];
						}
						else {
							$lnk = "sch_item.php?user_id=" . $i['user_id'] . "&amp;schedule_id=" . $i['schedule_id'];
						}
						?>
						<a href="<?php echo $lnk;?>"><?php echo $i['schedule_title'];?></a><br />
						<span class="txt_footer"><?php echo $i['schedule_synopsis'];?></span><br />
					</td>
					<td align="right" valign="top" nowrap>
						occurence&nbsp;
						<?php echo $i['display_schedule_start_datetime'];?><br />
						<?php
						if (isset($i['schedule_allocation'])) {
						    echo "attendees: " . $i['schedule_allocation'] . "<br />";
						}
						?>
					</td>
			    </tr>
				<?php
				endforeach;
				} else {
				?>
				<tr>
					<td colspan="4">
						<?php echo $lang['err_no_schedule_items'];?><br />
					</td>
				</tr>
				<?php }?>
			</table>
			</div>

			<div id="box_bottom">
				<table cellpadding="0" cellspacing="0" border="0" width="100%">
					<tr>
						<td align="left">
							<img src="<?php echo $templatePath;?>img/box_bottom_left.png" width="5" height="18" alt="" border="0" /><br />
						</td>
						<td align="left">
							<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="9" alt="" border="0" /><br />
						</td>
						<td align="right">
							<img src="<?php echo $templatePath;?>img/box_bottom_right.png" width="5" height="18" alt="" border="0" /><br />
						</td>
					</tr>
				</table>
			</div>
		</td>
	</tr>
</table>
