Location: PHPKode > projects > Employee Scheduling System > essv1-2/myDayOff.php
<?php require_once('common.php'); 
// $Id: myDayOff.php,v 1.1 2005/01/24 00:15:54 atrommer Exp $
checkUser($_SESSION['USERTYPE'], 1);

// check for postback
if ($_POST['isPostback']){
	$dStart = $_POST['ddSYear'] .'-'. $_POST['ddSMo'] .'-'. $_POST['ddSDay'];
	$dEnd = $_POST['ddEYear'] .'-'. $_POST['ddEMo'] .'-'. $_POST['ddEDay'];	
	newDayOff($_SESSION['USERID'], $dStart, $dEnd, $_POST['tbDesc']);
	redirect("myDayOff.php");
}

//check for delete
if ($_REQUEST['del']){
	delDayOff($_SESSION['USERID'], $_REQUEST['del']);
	redirect("myDayOff.php");
}
doHeader("My Days Off");
$oDaysOff = getDayOff($_SESSION['USERID']);
?>
<strong>My Days Off</strong><br>
<? if (!count($oDaysOff)){
	print "<br><i>You have not submitted a day off</i><br>";
} ?>
<form method="post" name="frmDayOff" action="<?=$_SERVER['PHP_SELF'] ?>">
<? 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>
	<td><a href="myDayOff.php?del=<?=$Day->day_id ?>">Delete Day?</a></td>
	</tr>
	<tr><td colspan=2><?=$Day->day_desc ?></td></tr>
	</table>
	<hr>
<? } ?>
<strong>Add a new day off:</strong>
<table width="100%" border="0" cellpadding="2" class="contactInfo">
	<input type="hidden" name="isPostback" value="1">
	<tr>
		<td>Start Day:</td>
		<td>
		<? // draw the ddowns for dmy hm 
		?>
		<select name="ddSMo">
		<? drawMonthDD(); ?>
		</select>
		<select name="ddSDay">
		<? drawDayDD(); ?>
		</select>
		<select name="ddSYear">
		<? drawYearDD(); ?>
		</select>
		</td>
	</tr>
	<tr>
		<td>End Day:</td>
		<td>
		<? // draw the ddowns for dmy hm 
		?>
		<select name="ddEMo">
		<? drawMonthDD(); ?>
		</select>
		<select name="ddEDay">
		<? drawDayDD(); ?>
		</select>
		<select name="ddEYear">
		<? drawYearDD(); ?>
		</select>
		</td>
	</tr>
	<tr>
		<td>Description:</td>
		<td><input type="text" name="tbDesc"></td>
	</tr>
	<tr>
		<td colspan=2 align=center><input type="submit" value="Add Day Off?"></td>
</table>
 	
  
</form>
<? doFooter(); ?>
Return current item: Employee Scheduling System