<?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>
		<?php
		if (isset($group) || isset($profile)) {
		?>
		<td width="180" valign="top">
			<?php
			if (isset($group)) {
			include $templatePath . "g_menu.inc.tpl.php";
			}
			elseif (isset($profile)) {
			include $templatePath . "sn_menu.inc.tpl.php";
			}
			?>
		</td>

		<td width="20">
			<img src="<?php echo $templatePath;?>img/pixel.png" width="20" height="1" alt="" /><br />
		</td>
		
		<td width="560" valign="top">
		<?php 
		}
		else {
		?>
		
		<td width="760" valign="top">
		<?php }?>
		
			<?php
			if (isset($display) && $display == 'group_schedule') {
			?>
			
			<div class="box_top">
				<?php echo $lang['section_group_schedule'];?><br />
			</div>
			
			<div class="box_mid" style="padding: 9px;">
			<table width="100%" cellpadding="2" cellspacing="2" border="0">
				<tr>
					<td>
						<b><?php echo $lang['hdr_tasks'];?></b><br />
					</td>
				</tr>
				<?php
				if (isset($schedule_tasks)) {
				foreach($schedule_tasks as $key => $i):
				?>
				 <tr>
					<td valign="top">
						<a href="sch_item.php?group_id=<?php echo $group['group_id'];?>&amp;schedule_id=<?php echo $i['schedule_id'];?>"><?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="2">
						<?php echo $lang['err_no_schedule_items'];?><br />
					</td>
				</tr>
				<?php }?>
			</table>
					
			<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="9" alt="" border="0" /><br />
					
			<table width="100%" cellpadding="2" cellspacing="2" border="0">
				<tr>
					<td colspan="2">
						<b><?php echo $lang['hdr_events'];?></b><br />
					</td>
				</tr>
				<?php
				if (isset($schedule_events)) {
				foreach($schedule_events as $key => $i):
				?>
				 <tr>
					<td valign="top">
						<a href="sch_item.php?group_id=<?php echo $group['group_id'];?>&amp;schedule_id=<?php echo $i['schedule_id'];?>"><?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="2">
						<?php echo $lang['err_no_schedule_items'];?><br />
					</td>
				</tr>
				<?php }?>
			</table>
			
			<table cellpadding="2" cellspacing="0" border="0" width="100%">
				<tr>
					<td align="right">
						<div class="box_edit">
						<?php
						$url = "sch_edit.php?group_id=" . $group['group_id'] . "&amp;schedule_type_id=";
						?>
						
						<a href="sch_gantt.php?group_id=<?php echo $group['group_id'];?>" class="link_stnd"><?php echo $lang['href_gantt'];?></a>&nbsp;
						<a href="<?php echo $url . $schedule_config['type']['event'];?>" class="link_stnd"><?php echo $lang['href_event_add'];?></a>&nbsp;
						<a href="<?php echo $url . $schedule_config['type']['task'];?>" class="link_stnd"><?php echo $lang['href_task_add'];?></a><br />
						</div>
					</td>
				</tr>
			</table>
			
			
			
			
			<?php
			}
			else {
			?>
			<div class="box_top">
				<?php echo $lang['section_schedule'];?><br />
			</div>
			
			<div class="box_mid" style="padding: 9px;">
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td width="370" valign="top">
						<table width="100%" cellpadding="2" cellspacing="2" border="0">
							<tr>
								<td colspan="2">
									<b><?php echo $lang['hdr_task_allocated'];?></b><br />
								</td>
							</tr>
						</table>
						
						<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="9" alt="" /><br />
						
						<table width="100%" cellpadding="2" cellspacing="2" border="0">
							<tr>
								<td colspan="2">
									<b><?php echo $lang['hdr_task_initiated'];?></b><br />
								</td>
							</tr>
							<tr>
								<td colspan="2">
									<table width="100%" cellpadding="2" cellspacing="0" border="0">
										<?php
										if (isset($schedule_tasks)) {
										foreach($schedule_tasks as $key => $i):
										?>
									     <tr>
											<td valign="top">
												<a href="sch_item.php?schedule_id=<?php echo $i['schedule_id'];?>"><?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="2">
												<?php echo $lang['err_no_schedule_items'];?><br />
											</td>
										</tr>
										<?php }?>
									</table>
								</td>
							</tr>
							<tr>
								<td colspan="2" align="right">
									<a href="sch_edit.php?schedule_type_id=<?php echo $schedule_config['type']['task'];?>" class="link_urgent"><?php echo $lang['href_task_add'];?></a><br />
								</td>
							</tr>
						</table>
					</td>
					
					<td width="20">
						<img src="<?php echo $templatePath;?>img/pixel.png" width="20" height="1" alt="" border="0" /><br />
					</td>
								
					<td width="370" valign="top">
						<table width="100%" cellpadding="2" cellspacing="2" border="0">
							<tr>
								<td colspan="2">
									<b><?php echo $lang['hdr_event_attendance'];?></b><br />
								</td>
							</tr>
						</table>
						
						<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="9" alt="" /><br />
						
						<table width="100%" cellpadding="2" cellspacing="2" border="0">
							<tr>
								<td colspan="2">
									<b><?php echo $lang['hdr_event_initiated'];?></b><br />
								</td>
							</tr>
							<tr>
								<td colspan="2">
									<table width="100%" cellpadding="2" cellspacing="0" border="0">
										<?php
										if (isset($schedule_events)) {
										foreach($schedule_events as $key => $i):
										?>
									     <tr>
											<td valign="top">
												<a href="sch_item.php?schedule_id=<?php echo $i['schedule_id'];?>"><?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="2">
												<?php echo $lang['err_no_schedule_items'];?><br />
											</td>
										</tr>
										<?php }?>
									</table>
								</td>
							</tr>
							<tr>
								<td colspan="2" align="right">
									<a href="sch_edit.php?schedule_type_id=<?php echo $schedule_config['type']['event'];?>" class="link_urgent"><?php echo $lang['href_event_add'];?></a><br />
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
			
			<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="12" alt="" border="0" /><br />
			
			<div class="box_edit">
			<table cellpadding="0" cellspacing="0" border="0" width="100%">
				<tr>
					<td valign="top">
						<form action="sch_schedule.php" method="post" name="frm">
						<input type="hidden" name="schedule_type_id" value="<?php if(isset($schedule_type_id)) { echo $schedule_type_id;}?>" />
						<b>view</b><br />
						<table cellpadding="4" cellspacing="0" border="0" width="100%">
							<tr>
								<td>
									<label for="id_from_date"><?php echo $lang['form_label_from_date'];?></label><br />
								</td>
								<td valign="top">
									<input type="text" name="from_date" id="id_from_date" size="11" /><br />
								</td>
								<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>
						</table>
						
						<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="9" alt="" border="0" /><br />
						<hr />
						<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="3" alt="" border="0" /><br />
						
						<b>add personal task shortcut</b><br />
						<table cellpadding="4" cellspacing="0" border="0" width="100%">
							<tr>
								<td valign="top">
									<label for="id_form_title"><?php echo $lang['form_label_title'];?></label><br />
								</td>
								<td valign="top">
									<input type="text" name="schedule_title" id="id_form_title" size="33" /><br />
								</td>
							</tr>
							<tr>
								<td valign="top">
									<label for="id_form_synopsis"><?php echo $lang['form_label_synopsis'];?></label><br />
								</td>
								<td valign="top">
									<textarea rows="2" cols="30" name="schedule_synopsis" id="id_form_synopsis"></textarea><br />
								</td>
							</tr>
						</table>
						
						</form>
					</td>
					<td width="20">
						<img src="<?php echo $templatePath;?>img/pixel.png" width="20" height="1" alt="" border="0" /><br />
					</td>
					<td align="right" valign="top">
						<div id="calendar-container-flat" style="width:210px">
						<script type="text/javascript">
						  function dateChanged(calendar) {
						    if (calendar.dateClicked) {
						      var y = calendar.date.getFullYear();
						      var m = calendar.date.getMonth();     // integer, 0..11
						      var d = calendar.date.getDate();      // integer, 1..31
							  
							  document.frm.id_from_date.value = m + '-' + d + '-' + y;
						    }
						  };
						
						  Calendar.setup(
						    {
						      flat         : "calendar-container-flat", // ID of the parent element
						      flatCallback : dateChanged           // our callback function
						    }
						  );
						</script>
						</div>
					</td>
				</tr>
			</table>
			</div>
			
			</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>
	</tr>
</table>



