Esempio n. 1
0
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;
}
Esempio n. 2
0
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/
// $Id: emailEmps.php,v 1.3 2005/10/30 22:37:19 atrommer Exp $
checkUser($_SESSION['USERTYPE'], 1);
// check for postback
if ($_POST['isPostback']) {
    emailEmps($_POST, $_SESSION['USERID']);
    redirect();
}
// grab based on usertype
// if >= super, get owned emps and all supers
// otherwise, only coworkers on parents
if ($_SESSION['USERTYPE'] > 1) {
    // get super case
    $oMyEmps = getMyEmployees($_SESSION['USERID']);
    $oSupers = getSupervisors();
} else {
    $oMyEmps = getMyCowork($_SESSION['USERID']);
    $oSupers = getMySupers($_SESSION['USERID']);
}
doHeader("Bulk Email");
?>
Please enter the subject, body, and select all or some of the employees you would like to email.
<br/>
<form name="frmEmail" action="emailEmps.php" method="post">
<input type="hidden" name="isPostback" value="1">
<table border="0" cellpadding="1" cellspacing="0" width="100%" class="contactInfo">
<tr>
	<td colspan=4 class="contactInfoName">Employees:</td>
</tr>
Esempio n. 3
0
 *  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 this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/
// $Id: myEmps.php,v 1.7 2006/02/03 20:24:34 atrommer Exp $
checkUser($_SESSION['USERTYPE'], 2);
// grab the emps based on the filter
if (isset($_REQUEST['f'])) {
    $filter = $_REQUEST['f'];
} else {
    $filter = 1;
}
$aEmployees = getMyEmployees($_SESSION['USERID'], $filter);
doHeader("My Employees");
?>
<a href="newUser.php">Add new employee?</a><br>
<span class="contactInfo"><a href="myEmps.php?f=1">Show Active</a> | <a href="myEmps.php?f=2">Show Inactive</a> | <a href="myEmps.php?f=0">Show All</a></span><br>
<?php 
if (!count($aEmployees)) {
    // we have no coworkers
    print "<br><i>You currently have no employees assigned to you!</i><br>";
} else {
    foreach ($aEmployees as $emp) {
        $aPhone1 = formatPhoneNum($emp->user_phone1);
        $aPhone2 = formatPhoneNum($emp->user_phone2);
        ?>
<hr align="left">
<table width="100%" border="0" cellpadding="2" class="contactInfo">