Location: PHPKode > projects > Employee Scheduling System > essv1-2/viewSched.php
<?php require_once('common.php'); 
// $Id: viewSched.php,v 1.6 2005/01/26 06:26:16 atrommer Exp $
checkUser($_SESSION['USERTYPE'], 2);
if (empty($_REQUEST['user'])){ // keep people from navigating here directly
	accessDenied("Please choose a user first.");
}

$oEmp = getUserVals($_REQUEST['user']);
if (empty($oEmp)){ // this would happen if they arbitrarily typed in a num in the url
	accessDenied("You selected an invalid user!");
}
if (!$_REQUEST['doPop']){
	doHeader("Viewing $oEmp->user_first $oEmp->user_last's schedule");
} else {
	?>
	<html>
	<head>
	<title>Viewing <?=$oEmp->user_first .' '. $oEmp->user_last ?>'s schedule</title>
	<link href="global.css" rel="stylesheet" type="text/css">
	</head>
	
	<body>
	<?
}
?>
Displaying availibility for <? print $oEmp->user_first . " " . $oEmp->user_last; ?>:<br>
<?
// draw day grid
print "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=center><tr>";

for ($iDay=0; $iDay<7; $iDay++){
	print "<tr><td class=contactInfoName align=center>" . $gaDOW[$iDay] . "</td></tr>";
	$oEmpAvail = getAvail($_REQUEST['user'], $iDay);
	if (count($oEmpAvail)){
		foreach ($oEmpAvail as $Block){
			print "<tr><td>" . date("g:ia", strtotime($Block->avail_start)) . " - ";
			print date("g:ia", strtotime($Block->avail_end)) . "</td></tr>";
			}
	} else { print "<tr><td><i>Not Available</i></td></tr>"; }
	next($gaDOW);
}

print "</tr></table>";
?>
<hr>
Days requested off:
<br>
<?
$oDaysOff = getDayOff($_REQUEST['user']);
 if (!count($oDaysOff)){
	print "<br><i>No days requested off</i><br>";
}
foreach ($oDaysOff as $Day){ ?>
	<table width="100%" border="0" cellpadding="2" class="contactInfo">
	<tr>
	<td class="contactInfoName"><? print(date("D, n/d/y", strtotime($Day->day_start))) ?> 
	thru <? print(date("D, n/d/y", strtotime($Day->day_end))) ?></td>
	</tr>
	<tr><td><?=$Day->day_desc ?></td></tr>
	</table>
	<hr>
<? } ?>


<?doFooter();
?>
Return current item: Employee Scheduling System