<?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="sch_allocation.php" method="post" name="frm" id="id_frm">
<input type="hidden" name="group_id" value="<?php if(isset($group['group_id'])) { echo $group['group_id'];}?>" />
<input type="hidden" name="schedule_id" value="<?php if(isset($schedule['schedule_id'])) { echo $schedule['schedule_id'];}?>" />

<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td width="180" valign="top">
			<?php
			if (isset($group)) {
			include $templatePath . "g_menu.inc.tpl.php";
			}
			else {
			?>
		
				<div id="box_side2">
					<?php echo $lang['section_schedule_item'];?><br />
				</div>
										
				<div id="box_side1">
					<table border="0" cellspacing="0" cellpadding="2" width="100%">
						<tr>
							<td colspan="2">
								<b><?php echo $lang['hdr_author'];?></b><br />
							</td>
						</tr>
						<tr>
							<td>
								<?php echo $lang['txt_profile_nic'];?><br />
							</td>
							<td>
								<a href="sn_profile.php?user_id=<?php echo $profile['user_id'];?>"><?php echo $profile['profile_nic'];?></a><br />
							</td>
						</tr>
						<tr>
							<td>
								<?php echo $lang['txt_profile_session_status'];?><br />
							</td>
							<td>
								<?php
								if ($profile['online_status'] == 1) {
								    echo "<b>" . $lang['arr_user_online_status'][1] . "</b><br />";
								}
								else {
									    echo $lang['arr_user_online_status'][$profile['online_status']] . "<br />";
								}
								?>
							</td>
						</tr>
						<tr>
							<td>
								<?php echo $lang['txt_profile_hometown'];?><br />
							</td>
							<td>
								<?php echo $profile['profile_hometown'];?><br />
							</td>
						</tr>
						<tr>
							<td valign="top">
								<?php echo $lang['txt_profile_create_datetime'];?><br />
							</td>
							<td>
								<?php echo $profile['display_profile_create_datetime'];?><br />
							</td>
						</tr>
					</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>
			<?php }?>
		</td>

		<td width="20">&nbsp;</td>

		<td width="560" valign="top">
			<div class="box_top">
				<?php echo $lang['hdr_allocation'];?><br />
			</div>
			<div class="box_mid" style="padding: 9px;">
			<table border="0" cellspacing="0" cellpadding="4" width="100%">
				<tr>
					<td colspan="5">
						<?php echo $lang['txt_applicants'];?><br />
					</td>
				</tr>
				<tr>
					<td colspan="5">
						<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="6" alt="" /><br />
					</td>
				</tr>
				<?php
				if (isset($schedule_allocation)) {
				?>
				<tr>
					<td>
						<?php echo $lang['txt_profile_nic'];?><br />
					</td>
					<td>
						<?php echo $lang['txt_profile_hometown'];?><br />
					</td>
					<td>
						<br />
					</td>
					<td>
						<?php echo $lang['txt_date'];?><br />
					</td>
					<td>
						<br />
					</td>
				</tr>
				<?php
				foreach($schedule_allocation as $key => $i):
				?>
				
				<tr>
					<td valign="top">
						<?php echo $i['profile']['profile_nic'];?><br />
					</td>
					<td valign="top">
						<?php echo $i['profile']['profile_hometown'];?><br />
					</td>
					<td valign="top">
						<a href="msg_compose.php?to_user_id=<?php echo $i['user_id'];?>"><img src="<?php echo $templatePath;?>img/unopenned_mail.png" title="<?php echo $lang['href_send_message'];?>" border="0" alt="" /></a>&nbsp;
					</td>
					<td valign="top">
						<?php echo $i['schedule_allocation_create_datetime'];?><br />
					</td>
					<td align="right">
						<?php
						if (isset($i['status_id']) && $i['status_id'] == $schedule_config['allocation_status']['confirmed']) {
						    echo $lang['schedule']['allocation_status'][$schedule_config['allocation_status']['confirmed']];
						}
						elseif (isset($i['status_id']) && $i['status_id'] == $schedule_config['allocation_status']['withdrawn']) {
						    echo $lang['schedule']['allocation_status'][$schedule_config['allocation_status']['withdrawn']];
						}
						else {
						$show_submit_button = 1;
						?>
						<input type="hidden" name="user_ids[]" value="<?php echo $i['user_id'];?>" />
						<select name="status_ids[]" class="formInput">
						<option value="0" selected><?php echo $lang['txt_none'];?></option>
						<?php
						foreach($lang['schedule']['allocation_status'] as $key => $r):
							$selected="";
							if ($key == $i['status_id']) {
							    $selected = "selected";
							}
							echo "<option value='" . $key . "' " . $selected . ">" . $r . "</option>";
						endforeach;
						}
						?>
						<br />
					</td>
			    </tr>
				<?php
				endforeach;
				}
				if (isset($show_submit_button) && $show_submit_button > 0) {
				?>
				<tr>
					<td colspan="5">
						<img src="<?php echo $templatePath;?>img/pixel.png" width="1" height="3" alt="" /><br />
					</td>
				</tr>
				<?php
				}
				?>
				<tr>
					<td align="right" colspan="5">
						<div class="box_edit">
							<?php 
							if (isset($group)) {
							?>
							<a href="sch_item.php?group_id=<?php echo $group['group_id'];?>&amp;schedule_id=<?php echo $schedule['schedule_id'];?>" class="link_stnd"><?php echo $lang['href_view_schedule'];?></a>
							<?php
							}
							else {
							?>
							<a href="sch_item.php?schedule_id=<?php echo $schedule['schedule_id'];?>" class="link_stnd"><?php echo $lang['href_view_schedule'];?></a>
							<?php }?>
							&nbsp;
							<input type="submit" name="update_allocations" value="<?php echo $lang['sub_update'];?>" class="button_urgent" />
							<br />
						</div>
					</td>
				</tr>
			</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>
</form>
