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 }
* along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ require_once 'classes/class.ical.inc.php'; // $Id: iCalView.php,v 1.3 2005/10/30 22:37:19 atrommer Exp $ // if we have a uid, grab their schedule // if we have aid, grab area schedule // otherwise, do nothing if ($_REQUEST['uid']) { $oSched = getMySched($_REQUEST['uid'], 2); } elseif ($_REQUEST['aid']) { $oSched = getAreaSched($_REQUEST['aid'], 2); } else { accessDenied("Invalid user or area!"); } $iCal = (object) new iCal('', 0); // (ProgrammID, Method [1 = Publish | 0 = Request]) $categories = array('Work', 'Party'); // main loop for the events foreach ($oSched as $Sched) { $aAssign = array(); $oEventEmps = getEventEmps($Sched->event_id); // add all event emps to the attendees foreach ($oEventEmps as $Emp) { $aTemp = array($Emp->user_first . ' ' . $Emp->user_last => $Emp->user_email . ",1"); $aAssign = array_merge($aAssign, $aTemp); } $iCal->addEvent('', strtotime($Sched->event_date . ' ' . $Sched->event_start), strtotime($Sched->event_date . ' ' . $Sched->event_end), $Sched->area_name, 0, $categories, 'Log into ESS for more details!', $Sched->event_name, 1, $aAssign, 5, 0, 1, 1, '', 0, '', '', 1, 'http://' . $host . $docroot, 'en', ''); } // end of main loop $iCal->outputFile('ics');
?> </td> </tr> <tr valign="top"> <?php // now we go through each pos and list the scheduled emps foreach ($oAreaPos as $Pos) { $sDay = date("w", strtotime($Sched->event_date)); ?> <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; print "<tr><td>"; if ($_SESSION['USERTYPE'] > 1) { // grab override data if super or higher $oMatch = checkEmpConflict($Sched->event_start, $Sched->event_end, $sDay, $Emp->user_id, $Sched->event_date); if (!count($oMatch)) { ?> * <?php } ?> <a href="viewSched.php?user=<?php echo $Emp->user_id;
function deleteEvent($iEventID) { global $db; global $DEV; global $mail; global $host; global $docroot; // get sender details $oSender = getUserVals($_SESSION['USERID']); // get event details $oEventDetails = getEventDetails($iEventID); // get event emps $oEEmps = getEventEmps($iEventID); // set up email basics $mail->From = $oSender->user_email; $mail->FromName = $oSender->user_first . ' ' . $oSender->user_last; $mail->Subject = $oEventDetails->event_name . ' has been canceled!'; // the message $sBody = 'The event, ' . $oEventDetails->event_name . ', on ' . date("l, F jS, Y", strtotime($oEventDetails->event_date)); $sBody .= ' from ' . date("g:i a", strtotime($oEventDetails->event_start)) . ' to ' . date("g:i a", strtotime($oEventDetails->event_end)); $sBody .= ' has been canceled. Please plan accordingly.'; $sBody .= "\nPlease see http://" . $host . $docroot . " for more details."; $sBody .= "\nThanks, \n" . $oSender->user_first . ' ' . $oSender->user_last; $mail->Body = $sBody; // add the scheduled emps to the list foreach ($oEEmps as $Emp) { $mail->AddAddress($Emp->user_email, $Emp->user_first . ' ' . $Emp->user_last); } if (!$mail->Send()) { accessDenied("There has been an error sending mail!"); } $mail->ClearAddresses(); $mail->ClearAttachments(); $db->query("delete from events where event_id={$iEventID}"); }