function printUser() { // displays a users schedule in printable form $oSched = getMySched($_SESSION['USERID']); // print out the results ?> <html> <head> <title>Viewing Your Schedule</title> <link href="global.css" rel="stylesheet" type="text/css"> </head> <body> <table width="100%" cellpadding="2" cellspacing="0"> <tr> <td> <?php if (count($oSched)) { //display rows foreach ($oSched as $Sched) { $oAreaPos = getAreaPos($Sched->event_area_id); ?> </p> <hr align="left"> <?php echo $Sched->event_name; ?> <br> <table width="100%" border="0" cellpadding="2" class="contactInfo"> <tr> <td class="contactInfoName"><?php print date("D, n/d", strtotime($Sched->event_date)); ?> </td> </tr> <tr> <td width="31%">Start: <?php echo date("g:i a", strtotime($Sched->event_start)); ?> <div align="left"></div></td> <td width="69%">End: <?php echo date("g:i a", strtotime($Sched->event_end)); ?> </td> </tr> <tr> <td>Position: <?php echo $Sched->pos_name; ?> </td> <td>Location: <?php echo $Sched->area_name; ?> </td> </tr> <tr valign="top"> <?php // now we go through each pos and list the scheduled emps foreach ($oAreaPos as $Pos) { ?> <td><table border="0" cellpadding="2" class="contactInfo"> <tr><td colspan=2><strong><?php echo $Pos->pos_name; ?> </strong></td></tr><?php $bRow = true; $oEventEmps = getEventEmps($Sched->event_id, $Pos->pos_id); if (count($oEventEmps)) { // we have emps, display them foreach ($oEventEmps as $Emp) { $bRow = !$bRow; ?> <tr<?php if ($bRow) { print " class=evenRow"; } ?> > <td colspan=2><?php echo $Emp->user_first . ' ' . $Emp->user_last; ?> </td> </tr> <?php } } else { //we don't, display msg print "<tr><td colspan=2><i>No employees scheduled yet</i></td></tr>"; } ?> </table></td><?php } ?> </tr> </table> <?php } } else { // tell the user they have free time ?> You are currently not assigned any shifts.<?php } ?> </td></tr></table> <?php }
<?php if ($_REQUEST['filter'] != 2) { ?> <a href="mySchedule.php?filter=2">Show all of my events</a> <?php } else { print "Showing all events"; } ?> </span> <br>An <b>*</b> denotes schedule override. <?php // loop through all events w/filters foreach ($oSched as $Sched) { $oAreaPos = getAreaPos($Sched->event_area_id); ?> </p> <hr align="left"> <?php echo $Sched->event_name; ?> <table width="100%" border="0" cellpadding="2" class="contactInfo"> <tr> <td class="contactInfoName"><?php print date("D, n/d", strtotime($Sched->event_date)); ?> </td> <td><a href="mySchedule.php?getDesc=<?php echo $Sched->event_id; ?>
function schedEvent($postData, $iEventID = '') { global $mail; global $host; global $docroot; // take the input vals, call addEvent, and call addAssign // if we have an event_id, we do an update, else, we just add if ($iEventID) { $iEID = $iEventID; // we update the event, delete the currently assigned emps, and re-add the sub'd ones updateEvent($iEventID, sanitizeInput($postData['dDate']), sanitizeInput($postData['dStartTime']), sanitizeInput($postData['dEndTime']), sanitizeInput($postData['area']), sanitizeInput($postData['tbName'])); // now do the delete delAssign($iEventID); } else { // first add the event and get back the eventID $iEID = addEvent(sanitizeInput($postData['dDate']), sanitizeInput($postData['dStartTime']), sanitizeInput($postData['dEndTime']), sanitizeInput($postData['area']), sanitizeInput($postData['tbName'])); } // now we grab the positions for the area // and iterate through the emp lists, adding the assignments $oPositions = getAreaPos($postData['area']); $oEmps = getMyEmployees($_SESSION['USERID']); // grab data for email // get sender details $oSender = getUserVals($_SESSION['USERID']); // get event details $oEventDetails = getEventDetails($iEID); // set up email basics $mail->From = $oSender->user_email; $mail->FromName = $oSender->user_first . ' ' . $oSender->user_last; // if updated event, change subj line if ($iEventID) { $sSubj = "UPDATED: "; } else { $sSubj = ""; } $sSubj .= 'You have been scheduled for ' . $oEventDetails->event_name; $mail->Subject = $sSubj; // the message // handle updated event if ($iEventID) { $sBody = "The following event has been UPDATED!\n"; } else { $sBody = ""; } $sBody .= "You have been scheduled for the following:\n"; $sBody .= "Event Name: " . $oEventDetails->event_name . "\n"; $sBody .= "Event Date: " . date("l, F jS, Y", strtotime($oEventDetails->event_date)) . "\n"; $sBody .= "From: " . date("g:i a", strtotime($oEventDetails->event_start)) . " To: " . date("g:i a", strtotime($oEventDetails->event_end)) . "\n"; $sBody .= "\nPlease see http://" . $host . $docroot . " for more details.\n"; $sBody .= "Thanks, \n" . $oSender->user_first . " " . $oSender->user_last; // append to mail $mail->Body = $sBody; // iterate list $bAssigned = false; // this flag flips once an assignment is made foreach ($oEmps as $Emp) { if ($_POST['rad' . $Emp->user_id]) { $bAssigned = true; // flip the flag addAssign($Emp->user_id, $_POST['rad' . $Emp->user_id], $iEID); $mail->AddAddress($Emp->user_email, $Emp->user_first . " " . $Emp->user_last); } } // now check for curUser assign if ($_POST['rad' . $_SESSION['USERID']]) { addAssign($_SESSION['USERID'], $_POST['rad' . $_SESSION['USERID']], $iEID); } // send mail if checkbox checked and if >= 1 emp assigned if ($postData['chkMail'] && $bAssigned) { // send the mail if (!$mail->Send()) { accessDenied("There has been an error sending mail!"); } $mail->ClearAddresses(); $mail->ClearAttachments(); } return $iEID; }
<br>An <b>*</b> denotes a schedule override. <?php if (!count($oAreaSched)) { // let user know we have no rows print "<br><i>You haven't created a schedule for this area yet.</i>"; } ?> <br>Total events for this view: <strong><?php echo count($oAreaSched); ?> </strong><br> <?php // Area events go to the left foreach ($oAreaSched as $Sched) { // get area positions $oAreaPos = getAreaPos($_REQUEST['area']); ?> <br> <hr align="left"> <?php echo $Sched->event_name; ?> <table width="100%" border="0" cellpadding="2" class="contactInfo"> <tr> <td class="contactInfoName"><?php print date("D, n/d/y", strtotime($Sched->event_date)); ?> </td> <td><a href="editNotes.php?event=<?php echo $Sched->event_id; ?>
//then we have a match, set the radio to checked $sChecked = " checked"; } } print "\t<td align=center><input type=radio name=rad{$Emp->user_id} value={$Pos->pos_id} {$sChecked}></td>\n"; } print "</tr>\n"; } ?> <tr><td><a href="viewSched.php?user=<?php echo $_SESSION['USERID']; ?> &doPop=1" target=_blank title="Click for availibility">Yourself</a></td> <?php print "<td align=center><input type=radio name=rad" . $_SESSION['USERID'] . " value=0 checked></td>"; $oAreaPos = getAreaPos($_REQUEST[area]); foreach ($oAreaPos as $Pos) { print "<td align=center><input type=radio name=rad" . $_SESSION['USERID'] . " value={$Pos->pos_id}></td>\n"; } print "</tr>"; ?> <tr class="evenRow" align="center"><td colspan="<?php echo count($oAreaPos) + 2; ?> "><input type="checkbox" name= "chkMail" value="1"> Mail users?</td></tr> <tr class="evenRow" align="center"><td colspan="<?php echo count($oAreaPos) + 2; ?> "><input type="submit" value="Assign?"></td></tr> </table> </form>