本文整理汇总了PHP中sapp_Global::_sendEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP sapp_Global::_sendEmail方法的具体用法?PHP sapp_Global::_sendEmail怎么用?PHP sapp_Global::_sendEmail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sapp_Global
的用法示例。
在下文中一共展示了sapp_Global::_sendEmail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ffinitialize
public function ffinitialize($appInitId, $tableid, $enable_to, $check)
{
if ($tableid) {
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$loginUserId = $auth->getStorage()->read()->id;
$loginuserRole = $auth->getStorage()->read()->emprole;
$loginuserGroup = $auth->getStorage()->read()->group_id;
$loginUserEmpId = $auth->getStorage()->read()->employeeId;
$loginUserfullname = $auth->getStorage()->read()->userfullname;
}
$ffEmpRatingsModel = new Default_Model_Feedforwardemployeeratings();
$feedforwardInitModel = new Default_Model_Feedforwardinit();
$appraisalEmpsData = $feedforwardInitModel->getEmpsFromAppEmpRat($appInitId);
$appEmpIDs = array();
if (sizeof($appraisalEmpsData) > 0) {
foreach ($appraisalEmpsData as $appE) {
$appEmpIDs[] = $appE['employee_id'];
$where = '';
$data = array('ff_initialization_id' => $tableid, 'question_ids' => $check != '' ? implode(',', $check) : NULL, 'manager_id' => $appE['line_manager_1'], 'employee_id' => $appE['employee_id'], 'ff_status' => 1, 'createdby' => $loginUserId, 'createdby_role' => $loginuserRole, 'createdby_group' => $loginuserGroup, 'createddate' => gmdate("Y-m-d H:i:s"));
$ffEmpRatingsModel->SaveorUpdateFFEmpRatingsData($data, $where);
}
}
if (sizeof($appEmpIDs) > 0 && $enable_to == 1) {
$appEmpIDsCsv = implode(',', $appEmpIDs);
$allEmpsData = $feedforwardInitModel->getEmpsFromSummary($appEmpIDsCsv);
if (sizeof($allEmpsData) > 0) {
foreach ($allEmpsData as $allE) {
$where1 = '';
$data1 = array('ff_initialization_id' => $tableid, 'question_ids' => $check != '' ? implode(',', $check) : NULL, 'manager_id' => $allE['reporting_manager'], 'employee_id' => $allE['user_id'], 'ff_status' => 1, 'createdby' => $loginUserId, 'createdby_role' => $loginuserRole, 'createdby_group' => $loginuserGroup, 'createddate' => gmdate("Y-m-d H:i:s"));
$ffEmpRatingsModel->SaveorUpdateFFEmpRatingsData($data1, $where1);
}
}
}
$actionflag = 1;
$tableid = '';
$menuID = INITIALIZE_FEEDFORWARD;
$result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid);
/** Start
* Sending Mails to Super Admin,Management,HR
*/
$appraisalratingsmodel = new Default_Model_Appraisalratings();
$appraisalconfigmodel = new Default_Model_Appraisalconfig();
//to get initialization details using appraisal Id for Business Unit,Department,To Year
$appraisal_details = $appraisalratingsmodel->getappdata($appInitId);
if (!empty($appraisal_details)) {
$businessUnit = $appraisal_details['businessunit_id'];
$department = $appraisal_details['deptid'];
$bunit = $appraisal_details['unitname'];
$dept = $appraisal_details['deptname'];
$to_year = $appraisal_details['to_year'];
$employeeDetailsArr = $appraisalconfigmodel->getUserDetailsByID($businessUnit, $department);
if ($enable_to == 1) {
$empforFF = $feedforwardInitModel->getEmpIdforFF($businessUnit, $department);
} else {
$empforFF = $feedforwardInitModel->getAppemployeeIDs($appInitId);
}
$ffEmpArr = array();
$ffEmpList = '';
if (!empty($empforFF)) {
foreach ($empforFF as $emp) {
array_push($ffEmpArr, $emp['employeeId']);
}
$ffEmpList = implode(',', $ffEmpArr);
}
$ffEmpEmailArr = array();
$ffemployeeDetailsArr = $feedforwardInitModel->getUserDetailsByIds($ffEmpList);
if (!empty($ffemployeeDetailsArr)) {
foreach ($ffemployeeDetailsArr as $empFF) {
array_push($ffEmpEmailArr, $empFF['emailaddress']);
}
}
$dept_str = $dept == '' ? " " : "and department <b>{$dept}</b> ";
$emp_id_str = $loginuserRole == SUPERADMINROLE ? " " : "({$loginUserEmpId})";
//Preparing Employee array for Bcc
$empArr = array();
$total_emp_arr = array();
if (!empty($employeeDetailsArr)) {
$empArrList = '';
foreach ($employeeDetailsArr as $emp) {
array_push($empArr, $emp['emailaddress']);
}
}
$total_emp_arr = array_merge($empArr, $ffEmpEmailArr);
//Sending mail to Super admin,HR,Management
$options['subject'] = APPLICATION_NAME . ': Feedforward Initialization';
$options['header'] = 'Feedforward Initialization : ' . $to_year;
$options['toEmail'] = SUPERADMIN_EMAIL;
$options['toName'] = 'Super Admin';
$options['bcc'] = $total_emp_arr;
$options['message'] = "<div style='padding: 0; text-align: left; font-size:14px; font-family:Arial, Helvetica, sans-serif;'>\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t<span style='color:#3b3b3b;'>Hi,</span><br />\n\t\t\t\t\t\t\t\t\t\t<div style='padding:20px 0 0 0;color:#3b3b3b;'>Feedforward process have been initialized for the year <b>{$to_year}</b> for business unit <b>{$bunit}</b> {$dept_str} by " . $loginUserfullname . $emp_id_str . ". </div>\n\t\t\t\t\t\t\t\t\t\t<div style='padding:20px 0 10px 0;'>Please <a href=" . BASE_URL . " target='_blank' style='color:#b3512f;'>click here</a> to login to your <b>" . APPLICATION_NAME . "</b> account and check the details.</div>\n\t\t\t\t\t\t\t\t\t\t</div> ";
//'Dear Super Admin, performance appraisal Initialized '.$mail_str;
$mail_id = sapp_Global::_sendEmail($options);
}
}
}
示例2: send_configuration_mail
/**
* This function is used to send mail when we delete any configurations.
* @param String $config_menu_name = name of configuration screen (Ex: Positions)
* @param String $config_name = name of configuration (Ex: "Developer one")
*/
public static function send_configuration_mail($config_menu_name, $config_name)
{
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$sess_values = $auth->getStorage()->read();
}
$users_model = new Default_Model_Usermanagement();
$emp_arr = $users_model->getEmpForConfigMail();
foreach ($emp_arr as $empdata) {
$text = "<div style='padding: 0; text-align: left; font-size:14px; font-family:Arial, Helvetica, sans-serif;'>\n <span style='color:#3b3b3b;'>Dear " . ucfirst($empdata['userfullname']) . ",</span><br />\n\n <div style='padding:20px 0 0 0;color:#3b3b3b;'><b>" . ucfirst($config_name) . "</b> " . $config_menu_name . " in configurations has been deleted by " . $sess_values->userfullname . ". </div> \n <div style='padding:20px 0 10px 0;'>Please <a href='" . BASE_URL . "index/popup' target='_blank' style='color:#b3512f;'>click here</a> to login and check the details.</div>\t\t\n\n </div> ";
$options['subject'] = APPLICATION_NAME . ': ' . ucfirst($config_menu_name) . ' is deleted';
$options['header'] = ucfirst($config_menu_name) . ' is deleted';
$options['toEmail'] = $empdata['emailaddress'];
$options['toName'] = $empdata['userfullname'];
$options['message'] = $text;
$options['cron'] = 'yes';
sapp_Global::_sendEmail($options);
}
}
示例3: saveCronMail
public static function saveCronMail($optionArr)
{
$options['subject'] = APPLICATION_NAME . ':' . $optionArr['subject'];
$options['header'] = $optionArr['header'];
$options['toEmail'] = $optionArr['toname'];
$options['toName'] = $optionArr['toemail'];
$options['bcc'] = $optionArr['bcc'];
$options['message'] = $optionArr['message'];
$options['cron'] = $optionArr['cron'];
sapp_Global::_sendEmail($options);
}
示例4: deletepocAction
/**
* @name deletepocAction
*
* This action is used to delete a point of contact of an agency.
* @author Asma
* @version 1.0
*/
public function deletepocAction()
{
try {
$pocsmodel = new Default_Model_Bgpocdetails();
$agencylistmodel = new Default_Model_Agencylist();
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$loginUserId = $auth->getStorage()->read()->id;
}
$poc_name = '';
$agencyid = $this->_request->getParam('agencyid');
$pocid = $this->_request->getParam('pocid');
$pocdata = $pocsmodel->getSingleagencyPOCData($pocid);
if (!empty($pocdata[0])) {
$poc_name = $pocdata[0]['first_name'] . ' ' . $pocdata[0]['last_name'];
}
$messages['message'] = '';
$messages['msgtype'] = '';
$actionflag = 3;
if (isset($pocdata[0]['contact_type']) && $pocdata[0]['contact_type'] == '2') {
if ($pocid && $agencyid) {
$data = array('isactive' => 0, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
$where = array('id=?' => $pocid, 'bg_agencyid=?' => $agencyid);
$result = $pocsmodel->SaveorUpdatePOCDetails($data, $where);
$result_2 = $pocsmodel->deleteBGcheckdetails($agencyid, $pocid, $loginUserId);
// Mail to Secondary contact
$options['subject'] = APPLICATION_NAME . ' :: POC is deleted';
$options['header'] = 'POC deleted';
$options['toEmail'] = trim($pocdata[0]['email']);
$options['toName'] = $pocdata[0]['userfullname'];
$salutation = 'Dear ' . $pocdata[0]['first_name'] . ',';
$custom_base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
$options['message'] = '<div>
<div>' . $salutation . ' </div>
<div></div>
<div>You are deleted as a secondary point of contact from ' . $pocdata[0]['agencyname'] . ' agency.</div>
<div>
<table border="1" style="border-collapse:collapse;">
<tr><td>Name : </td><td>' . $poc_name . '</td></tr>
<tr><td>Contact Number : </td><td>' . $pocdata[0]['contact_no'] . '</td></tr>
<tr><td>Email : </td><td>' . $pocdata[0]['email'] . '</td></tr>
</table>
</div>
<div></div>
</div>';
$options['cron'] = 'Yes';
if ($options['toEmail'] != '') {
$result_email = sapp_Global::_sendEmail($options);
}
// Mail to Primary contact
$primary_poc = $pocsmodel->getPrimaryPOCData($agencyid);
$primary_poc_name = $primary_poc[0]['first_name'] . ' ' . $primary_poc[0]['last_name'];
$options['subject'] = APPLICATION_NAME . ' :: POC is deleted';
$options['header'] = 'POC deleted';
$options['toEmail'] = trim($primary_poc[0]['email']);
$options['toName'] = $primary_poc_name;
$salutation = 'Dear ' . $primary_poc[0]['first_name'] . ',';
$options['message'] = '<div>
<div>' . $salutation . ' </div>
<div></div>
<div>Secondary point of contact has been deleted from ' . $pocdata[0]['agencyname'] . ' agency. Please find the details below:</div>
<div>
<table border="1" style="border-collapse:collapse;">
<tr><td>Name : </td><td>' . $poc_name . '</td></tr>
<tr><td>Contact Number : </td><td>' . $pocdata[0]['contact_no'] . '</td></tr>
<tr><td>Email : </td><td>' . $pocdata[0]['email'] . '</td></tr>
</table>
</div>
<div></div>
<div style="padding:20px 0 10px 0;">Please <a href="' . $custom_base_url . '/index/popup" target="_blank" style="color:#b3512f;">click here</a> to login and check the agency details.</div>
</div>';
$options['cron'] = 'Yes';
if ($options['toEmail'] != '') {
$result_email = sapp_Global::_sendEmail($options);
}
// Mail to HR and Management
$emailids = $agencylistmodel->getAllHRManagementEMails();
foreach ($emailids as $email) {
$options['subject'] = APPLICATION_NAME . ' :: POC is deleted';
$options['header'] = 'POC deleted';
$options['toEmail'] = trim($email['groupEmail']);
$options['toName'] = $email['group_name'];
if ($email['group_id'] == 4) {
$salutation = 'Dear HR,';
} else {
$salutation = 'Dear Management,';
}
$options['message'] = '<div>
<div>' . $salutation . '</div>
<div></div>
<div>Secondary point of contact has been deleted from ' . $pocdata[0]['agencyname'] . ' agency. Please find the details below:</div>
<div>
<table cellpadding="0" cellspacing="0" border="1">
//.........这里部分代码省略.........
示例5: deleteAction
public function deleteAction()
{
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$loginUserId = $auth->getStorage()->read()->id;
$loginUserEmail = $auth->getStorage()->read()->emailaddress;
$loginUserName = $auth->getStorage()->read()->userfullname;
}
$id = $this->_request->getParam('objid');
$messages['message'] = '';
$actionflag = 5;
$businessunitid = '';
$leavetypetext = '';
if ($id) {
$leaverequestmodel = new Default_Model_Leaverequest();
$usersmodel = new Default_Model_Users();
$employeesmodel = new Default_Model_Employees();
$employeeleavetypesmodel = new Default_Model_Employeeleavetypes();
$loggedInEmployeeDetails = $employeesmodel->getLoggedInEmployeeDetails($loginUserId);
if ($loggedInEmployeeDetails[0]['businessunit_id'] != '') {
$businessunitid = $loggedInEmployeeDetails[0]['businessunit_id'];
}
$dataarr = array('leavestatus' => 4, 'modifieddate' => gmdate("Y-m-d H:i:s"), 'modifiedby' => $loginUserId);
$where = array('id=?' => $id);
$Id = $leaverequestmodel->SaveorUpdateLeaveRequest($dataarr, $where);
$data = $leaverequestmodel->getsinglePendingLeavesData($id);
$data = $data[0];
$appliedleavesdaycount = $data['appliedleavescount'];
$to_date = $data['to_date'];
$from_date = $data['from_date'];
$reason = $data['reason'];
$leavetypeid = $data['leavetypeid'];
$repmngrnameArr = $usersmodel->getUserDetailsByID($data['rep_mang_id']);
$reportingmanageremail = $repmngrnameArr[0]['emailaddress'];
$reportingmanagername = $repmngrnameArr[0]['userfullname'];
if ($Id == 'update') {
$menuID = PENDINGLEAVES;
$result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id);
/** MAILING CODE **/
if ($to_date == '' || $to_date == NULL) {
$to_date = $from_date;
}
/* Mail to Employee */
$options['subject'] = 'Leave request cancelled';
$options['header'] = 'Leave Request';
$options['toEmail'] = $loginUserEmail;
$options['toName'] = $loginUserName;
$options['message'] = '<div>Hi,</div>
<div>The below leave(s) has been cancelled.</div>
<div>
<table width="100%" cellspacing="0" cellpadding="15" border="0" style="border:3px solid #BBBBBB; font-size:16px; font-family:Arial, Helvetica, sans-serif; margin:30px 0 30px 0;" bgcolor="#ffffff">
<tbody><tr>
<td width="28%" style="border-right:2px solid #BBBBBB;">Employee Name</td>
<td width="72%">' . $loginUserName . '</td>
</tr>
<tr bgcolor="#e9f6fc">
<td style="border-right:2px solid #BBBBBB;">No. of Day(s)</td>
<td>' . $appliedleavesdaycount . '</td>
</tr>
<tr>
<td style="border-right:2px solid #BBBBBB;">From</td>
<td>' . $from_date . '</td>
</tr>
<tr bgcolor="#e9f6fc">
<td style="border-right:2px solid #BBBBBB;">To</td>
<td>' . $to_date . '</td>
</tr>
<tr bgcolor="#e9f6fc">
<td style="border-right:2px solid #BBBBBB;">Reason for Leave</td>
<td>' . $reason . '</td>
</tr>
</tbody></table>
</div>
<div style="padding:20px 0 10px 0;">Please <a href="' . BASE_URL . '/index/popup" target="_blank" style="color:#b3512f;">click here</a> to login and check the leave details.</div>';
$result = sapp_Global::_sendEmail($options);
/* End */
/* Mail to Reporting Manager */
$options['subject'] = 'Leave request cancelled';
$options['header'] = 'Leave Request';
$options['toEmail'] = $reportingmanageremail;
$options['toName'] = $reportingmanagername;
$options['message'] = '<div>Hi,</div>
<div>The below leave(s) has been cancelled.</div>
<div>
<table width="100%" cellspacing="0" cellpadding="15" border="0" style="border:3px solid #BBBBBB; font-size:16px; font-family:Arial, Helvetica, sans-serif; margin:30px 0 30px 0;" bgcolor="#ffffff">
<tbody><tr>
<td width="28%" style="border-right:2px solid #BBBBBB;">Employee Name</td>
<td width="72%">' . $loginUserName . '</td>
</tr>
<tr bgcolor="#e9f6fc">
<td style="border-right:2px solid #BBBBBB;">No. of Day(s)</td>
<td>' . $appliedleavesdaycount . '</td>
</tr>
<tr>
<td style="border-right:2px solid #BBBBBB;">From</td>
<td>' . $from_date . '</td>
</tr>
<tr bgcolor="#e9f6fc">
<td style="border-right:2px solid #BBBBBB;">To</td>
//.........这里部分代码省略.........
示例6: save
//.........这里部分代码省略.........
if ($i == 0) {
$salutation = 'Dear ' . ucfirst($agencysalutationName) . ',';
$options['toName'] = ucfirst($agencysalutationName);
}
if ($i == 1) {
$salutation = 'Dear ' . ucfirst($lmanager1Name) . ',';
$options['toName'] = ucfirst($lmanager1Name);
}
if ($i == 2) {
$salutation = 'Dear Management,';
$options['toName'] = 'Management';
}
if ($i == 3) {
$salutation = 'Dear HR,';
$options['toName'] = 'HR';
}
$options['subject'] = APPLICATION_NAME . ' : Background checks re-opened';
$options['header'] = 'Background checks re-opened';
$options['toEmail'] = $emailArr[$i];
$createdbyName = $usermodel->getUserDetails($loginUserId);
if ($i == 0) {
$mailsentflag = 1;
$options['message'] = '<div>' . $salutation . '<div>The background check for ' . ucfirst($username) . '
has been re-opened by ' . $createdbyName[0]['userfullname'] . '. </div>
<div style="padding:20px 0 10px 0;">Please <a href="' . $baseUrl . '/index/popup" target="_blank" style="color:#b3512f;">click here</a> to login and check the details.</div>
</div>';
} else {
$options['message'] = '<div>' . $salutation . '<div>The background check for ' . ucfirst($username) . '
has been re-opened by ' . $createdbyName[0]['userfullname'] . '. </div>
<div style="padding:20px 0 10px 0;">Please <a href="' . $baseUrl . '/index/popup" target="_blank" style="color:#b3512f;">click here</a> to login and check the details.</div>
</div>';
}
$options['cron'] = 'yes';
sapp_Global::_sendEmail($options);
}
}
/* END */
}
/* END */
$data = array('specimen_id' => $specimen_id, 'flag' => $userflag, 'bgagency_id' => $agencyid, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
if ($id != '') {
$data['process_status'] = $newStatus;
$data['explanation'] = NULL;
$where = array('id=?' => $id);
$actionflag = 2;
} else {
$data['process_status'] = $newStatus;
$data['bgagency_pocid'] = $radio_pocId;
$data['createdby'] = $loginUserId;
$data['createddate'] = gmdate("Y-m-d H:i:s");
$data['isactive'] = 1;
$where = '';
$actionflag = 1;
if ($newStatus == 'In process' && ($BGStatus != 'Complete' || $oldbgstatus != 'Complete' || $BGStatus != 'On hold' || $oldbgstatus != 'On hold') && $mailsentflag == 0) {
$empData = $empscreeningModel->getEmpPersonalData($specimen_id, $userflag);
$table = '';
if ($userflag == 1) {
$username = $empData[0]['name'];
$lmanager1Email = $empData[0]['rmanager_email'];
$lmanager1Name = $empData[0]['reporting_manager'];
$table = '<div>
<table border="1" style="border-collapse:collapse;">
<tr><td>Employee ID</td><td>' . $empData[0]['employee_id'] . '</td></tr>
<tr><td>Employee Email</td><td>' . $empData[0]['email_id'] . '</td></tr>
<tr><td>Employee Designation</td><td>' . $empData[0]['designation'] . '</td></tr>
</table>
示例7: addemppopupAction
//.........这里部分代码省略.........
$emp_form->emp_status_id->addMultiOption($employmentStatusres['workcodename'], $employmentStatusres['statusname']);
}
} else {
$msgarray['emp_status_id'] = 'Employment status is not configured yet.';
$emptyFlag++;
}
$reportingManagerData = $usersModel2->getReportingManagerList_employees('', '', MANAGEMENT_GROUP);
if (!empty($reportingManagerData)) {
$report_opt = $reportingManagerData;
if (isset($_POST['reporting_manager']) && $_POST['reporting_manager'] != '') {
$emp_form->setDefault('reporting_manager', $_POST['reporting_manager']);
}
} else {
$msgarray['reporting_manager'] = 'Reporting managers are not added yet.';
$flag = 'false';
}
if ($this->getRequest()->getPost()) {
if ($emp_form->isValid($this->_request->getPost()) && $flag == 'true') {
$jobtitle_id = $this->_request->getParam('jobtitle_id', null);
$position_id = $this->_request->getParam('position_id', null);
$date_of_joining = sapp_Global::change_date($this->_request->getParam('date_of_joining', null), 'database');
$date_of_leaving = $this->_request->getParam('date_of_leaving', null);
$date_of_leaving = sapp_Global::change_date($date_of_leaving, 'database');
$employeeId = $this->_getParam('employeeId', null);
$emprole = $this->_getParam('emprole', null);
$reporting_manager = $this->_getParam('reporting_manager', null);
$emailaddress = $this->_getParam('emailaddress', null);
$emppassword = sapp_Global::generatePassword();
$firstname = trim($this->_getParam('firstname', null));
$lastname = trim($this->_getParam('lastname', null));
$userfullname = $firstname . ' ' . $lastname;
//$userfullname = trim($this->_request->getParam('userfullname',null));
$prefix_id = $this->_getParam('prefix_id', null);
$user_id = $this->_getParam('user_id', null);
$emp_status_id = $this->_getParam('emp_status_id', null);
$user_data = array('emprole' => $emprole, 'firstname' => $firstname != '' ? $firstname : NULL, 'lastname' => $lastname != '' ? $lastname : NULL, 'userfullname' => $userfullname, 'emailaddress' => $emailaddress, 'jobtitle_id' => $jobtitle_id, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"), 'emppassword' => md5($emppassword), 'employeeId' => $employeeId, 'modeofentry' => 'Direct', 'selecteddate' => $date_of_joining, 'userstatus' => 'old');
$emp_data = array('user_id' => $user_id, 'jobtitle_id' => $jobtitle_id, 'position_id' => $position_id, 'prefix_id' => $prefix_id, 'department_id' => $deptidforhead, 'reporting_manager' => $reporting_manager, 'date_of_joining' => $date_of_joining, 'date_of_leaving' => $date_of_leaving != '' ? $date_of_leaving : NULL, 'emp_status_id' => $emp_status_id, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
$user_data['createdby'] = $loginUserId;
$user_data['createddate'] = gmdate("Y-m-d H:i:s");
$user_data['isactive'] = 1;
if ($emp_identity_code != '') {
$emp_id = $emp_identity_code . str_pad($user_model->getMaxEmpId($emp_identity_code), 4, '0', STR_PAD_LEFT);
} else {
$emp_id = '';
}
$user_data['employeeId'] = $emp_id;
$user_id = $user_model->SaveorUpdateUserData($user_data, '');
$emp_data['user_id'] = $user_id;
$emp_data['createdby'] = $loginUserId;
$emp_data['createddate'] = gmdate("Y-m-d H:i:s");
$emp_data['isactive'] = 1;
$employeeModal->SaveorUpdateEmployeeData($emp_data, '');
//end of saving into employee table.
$tableid = $user_id;
$actionflag = 1;
$menuID = ORGANISATIONINFO;
try {
$result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid);
} catch (Exception $e) {
}
$managementUsersData = $deptModel->getDeptHeads();
$opt = '';
foreach ($managementUsersData as $record) {
$opt .= sapp_Global::selectOptionBuilder($record['id'], $record['userfullname']);
}
$this->view->managementUsersData = $opt;
/* Send Mail to the user */
$base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
$view = $this->getHelper('ViewRenderer')->view;
$this->view->emp_name = $userfullname;
$this->view->password = $emppassword;
$this->view->emp_id = $employeeId;
$this->view->base_url = $base_url;
$text = $view->render('mailtemplates/newpassword.phtml');
$options['subject'] = APPLICATION_NAME . ' login Credentials';
$options['header'] = 'Greetings from Sentrifugo';
$options['toEmail'] = $emailaddress;
$options['toName'] = $this->view->emp_name;
$options['message'] = $text;
$result = sapp_Global::_sendEmail($options);
/* END */
$this->view->eventact = 'added';
$close = 'close';
$this->view->popup = $close;
} else {
$messages = $emp_form->getMessages();
foreach ($messages as $key => $val) {
foreach ($val as $key2 => $val2) {
$msgarray[$key] = $val2;
break;
}
}
$this->view->msgarray = $msgarray;
}
}
$this->view->msgarray = $msgarray;
$this->view->report_opt = $report_opt;
$this->view->controllername = $controllername;
$this->view->emp_form = $emp_form;
}
示例8: save
public function save($managerleaverequestform, $appliedleavescount, $employeeemail, $employeeid, $userfullname, $from_date, $to_date, $reason, $businessunitid, $leavetypeid)
{
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$loginUserId = $auth->getStorage()->read()->id;
}
if ($managerleaverequestform->isValid($this->_request->getPost())) {
$id = $this->_request->getParam('id');
$managerstatus = $this->_request->getParam('managerstatus');
$comments = $this->_request->getParam('comments');
$date = new Zend_Date();
$leaverequestmodel = new Default_Model_Leaverequest();
$employeeleavetypesmodel = new Default_Model_Employeeleavetypes();
$actionflag = '';
$tableid = '';
$status = '';
$messagestr = '';
$leavetypetext = '';
$leavetypeArr = $employeeleavetypesmodel->getLeavetypeDataByID($leavetypeid);
if ($managerstatus == 1 && !empty($leavetypeArr)) {
if ($leavetypeArr[0]['leavepredeductable'] == 1) {
$updateemployeeleave = $leaverequestmodel->updateemployeeleaves($appliedleavescount, $employeeid);
}
$status = 2;
$messagestr = "Leave request approved.";
$leavetypetext = $leavetypeArr[0]['leavetype'];
} else {
if ($managerstatus == 2) {
$status = 3;
$messagestr = "Leave request rejected.";
}
}
if ($managerstatus == 1 || $managerstatus == 2) {
$data = array('leavestatus' => $status, 'approver_comments' => $comments, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
if ($id != '') {
$where = array('id=?' => $id);
$actionflag = 2;
} else {
$data['createdby'] = $loginUserId;
$data['createddate'] = gmdate("Y-m-d H:i:s");
$data['isactive'] = 1;
$where = '';
$actionflag = 1;
}
$Id = $leaverequestmodel->SaveorUpdateLeaveRequest($data, $where);
if ($Id == 'update') {
$tableid = $id;
$this->_helper->getHelper("FlashMessenger")->addMessage($messagestr);
} else {
$tableid = $Id;
$this->_helper->getHelper("FlashMessenger")->addMessage($messagestr);
}
/** MAILING CODE **/
if ($to_date == '' || $to_date == NULL) {
$to_date = $from_date;
}
/* Mail to Employee */
$options['header'] = 'Leave Request';
$options['toEmail'] = $employeeemail;
$options['toName'] = $userfullname;
if ($messagestr == 'Leave request approved.') {
$options['subject'] = 'Leave request approved';
$options['message'] = '<div>Hi,</div><div>The below leave(s) has been approved.</div>';
} else {
$options['subject'] = 'Leave request rejected';
$options['message'] = '<div>Hi,</div><div>The below leave(s) has been rejected. </div>';
}
$options['message'] .= '<div>
<table width="100%" cellspacing="0" cellpadding="15" border="0" style="border:3px solid #BBBBBB; font-size:16px; font-family:Arial, Helvetica, sans-serif; margin:30px 0 30px 0;" bgcolor="#ffffff">
<tbody><tr>
<td width="28%" style="border-right:2px solid #BBBBBB;">Employee Name</td>
<td width="72%">' . $userfullname . '</td>
</tr>
<tr bgcolor="#e9f6fc">
<td style="border-right:2px solid #BBBBBB;">No. of Day(s)</td>
<td>' . $appliedleavescount . '</td>
</tr>
<tr>
<td style="border-right:2px solid #BBBBBB;">From</td>
<td>' . $from_date . '</td>
</tr>
<tr bgcolor="#e9f6fc">
<td style="border-right:2px solid #BBBBBB;">To</td>
<td>' . $to_date . '</td>
</tr>
<tr bgcolor="#e9f6fc">
<td style="border-right:2px solid #BBBBBB;">Reason for Leave</td>
<td>' . $reason . '</td>
</tr>
</tbody></table>
</div>
<div style="padding:20px 0 10px 0;">Please <a href="' . BASE_URL . '/index/popup" target="_blank" style="color:#b3512f;">click here</a> to login and check the leave details.</div>';
$result = sapp_Global::_sendEmail($options);
/* END */
/* Mail to HR */
if (defined('LV_HR_' . $businessunitid) && $businessunitid != '') {
$options['header'] = 'Leave Request';
$options['toEmail'] = constant('LV_HR_' . $businessunitid);
$options['toName'] = 'Leave Management';
//.........这里部分代码省略.........
示例9: saveAction
public function saveAction()
{
$auth = Zend_Auth::getInstance();
$loginuserFullName = '';
if ($auth->hasIdentity()) {
$loginUserId = $auth->getStorage()->read()->id;
$loginuserRole = $auth->getStorage()->read()->emprole;
$loginuserGroup = $auth->getStorage()->read()->group_id;
$loginuserProfileImg = $auth->getStorage()->read()->profileimg;
$loginuserEmail = $auth->getStorage()->read()->emailaddress;
$loginuserFullName = $auth->getStorage()->read()->userfullname;
$loginUserEmpId = $auth->getStorage()->read()->employeeId;
}
try {
$appEmpRatingsModel = new Default_Model_Appraisalemployeeratings();
$app_init_model = new Default_Model_Appraisalinit();
$id = $this->_request->getParam('id');
$employee_id = $this->_request->getParam('employee_id');
$initialization_id = $this->_request->getParam('initialization_id');
$config_id = $this->_request->getParam('config_id');
$flag = $this->_request->getParam('flag');
$app_status = $this->_request->getParam('app_status');
$mgr_levels = $this->_request->getParam('mgr_levels');
$ratingsData = $appEmpRatingsModel->getAppRatingsDataByConfgId($config_id, $initialization_id);
$ratingValues = array();
foreach ($ratingsData as $rd) {
$ratingValues[$rd['id']] = $rd['rating_value'];
}
$appData = array('modifiedby' => $loginUserId, 'modifiedby_role' => $loginuserRole, 'modifiedby_group' => $loginuserGroup, 'modifieddate' => gmdate("Y-m-d H:i:s"));
$emp_rating_arr = $this->_request->getParam('emp_rating');
$emp_comment_arr = $this->_request->getParam('emp_comment');
$emp_response = array();
if (sizeof($emp_rating_arr) > 0 || sizeof($emp_comment_arr) > 0) {
foreach ($emp_rating_arr as $qid => $val) {
if (isset($emp_rating_arr[$qid])) {
$rating_id = array_search($emp_rating_arr[$qid], $ratingValues);
} else {
$rating_id = '';
}
$emp_response[$qid] = array('comment' => $emp_comment_arr[$qid], 'rating_id' => $rating_id);
}
}
$appData['employee_response'] = json_encode($emp_response, true);
$curent_level = array_search($app_status, $this->app_status_array);
if ($flag == 'submit') {
$appData['appraisal_status'] = $curent_level + 1;
$history_desc = $this->app_history_disc_array[$curent_level];
$appHistoryData = array('employee_id' => $employee_id, 'pa_initialization_id' => $initialization_id, 'description' => $history_desc, 'desc_emp_id' => $loginUserId, 'desc_emp_name' => $loginuserFullName, 'desc_emp_profileimg' => $loginuserProfileImg, 'createdby' => $loginUserId, 'createddate' => gmdate("Y-m-d H:i:s"), 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
$appHistoryModel = new Default_Model_Appraisalhistory();
$result2 = $appHistoryModel->SaveorUpdateAppraisalHistoryData($appHistoryData);
/* Update employee response column */
$appraisaldata = $app_init_model->getConfigData($initialization_id);
if ($appraisaldata[0]['employee_response'] == 1) {
$initdata = array('employee_response' => 2, 'modifiedby' => $loginUserId, 'modifiedby_role' => $loginuserRole, 'modifiedby_group' => $loginuserGroup, 'modifieddate' => gmdate("Y-m-d H:i:s"));
$initwhere = array('id=?' => $initialization_id);
$app_init_model->SaveorUpdateAppraisalInitData($initdata, $initwhere);
}
/*
* Logs Storing
*/
$menumodel = new Default_Model_Menu();
$actionflag = '';
$tableid = '';
$actionflag = 1;
$menuidArr = $menumodel->getMenuObjID('/appraisalself');
$menuID = $menuidArr[0]['id'];
sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid);
/*
* Logs storing ends
*/
/** Start
* Sending Mails to employees
*/
//to get initialization details using appraisal Id for Business Unit,Department,To Year
$appraisalratingsmodel = new Default_Model_Appraisalratings();
$appraisal_details = $appraisalratingsmodel->getappdata($initialization_id);
if (!empty($appraisal_details)) {
$bunit = $appraisal_details['unitname'];
$dept = $appraisal_details['deptname'];
$to_year = $appraisal_details['to_year'];
}
$dept_str = $dept == '' ? " " : "and <b>{$dept}</b> department";
$emp_id_str = $loginuserRole == SUPERADMINROLE ? " " : "({$loginUserEmpId})";
$app_manager_model = new Default_Model_Appraisalmanager();
$getLineManager = $app_manager_model->getLineMgr($initialization_id, $loginUserId);
if (!empty($getLineManager)) {
$line_mgr = $getLineManager['line_manager_1'];
$employeeDetailsArr = $app_manager_model->getUserDetailsByEmpID($line_mgr);
$employeeDetailsArr = $employeeDetailsArr[0];
// Sending mail to Manager
if (!empty($employeeDetailsArr)) {
$options['subject'] = APPLICATION_NAME . ': Self Appraisal Submitted';
$options['header'] = "Performance Appraisal : {$to_year}";
$options['toEmail'] = $employeeDetailsArr['emailaddress'];
$options['toName'] = $employeeDetailsArr['userfullname'];
$options['message'] = "<div style='padding: 0; text-align: left; font-size:14px; font-family:Arial, Helvetica, sans-serif;'>\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span style='color:#3b3b3b;'>Dear " . $employeeDetailsArr['userfullname'] . ",</span><br />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div style='padding:20px 0 0 0;color:#3b3b3b;'> " . $loginuserFullName . $emp_id_str . " has submitted appraisal form.</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div style='padding:20px 0 10px 0;'>Please <a href=" . BASE_URL . " target='_blank' style='color:#b3512f;'>click here</a> to login to <b>" . APPLICATION_NAME . "</b> and check the appraisal ratings and comments.</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div> ";
$mail_id = sapp_Global::_sendEmail($options);
}
}
//Sending mail to Employee
//.........这里部分代码省略.........
示例10: sendEMails
public function sendEMails($agencyData, $flag)
{
$baseUrl = $this->generateBaseurl();
$agencylistmodel = new Default_Model_Agencylist();
if ($flag == 'activated') {
$emailids = $agencylistmodel->getAllHRManagementEMails();
foreach ($emailids as $email) {
$options['subject'] = APPLICATION_NAME . ' : Agency activated';
$options['header'] = 'Agency activated';
$options['toEmail'] = $email['groupEmail'];
if ($email['group_id'] == 4) {
$salutation = 'Dear HR,';
$options['toName'] = 'HR';
} else {
$salutation = 'Dear Management,';
$options['toName'] = 'Management';
}
$options['message'] = '<div>
<div>' . $salutation . '</div>
<div></div>
' . $agencyData['userfullname'] . ' agency has been activated.
<div></div>
<div style="padding:20px 0 10px 0;">Please <a href="' . $baseUrl . '/index/popup" target="_blank" style="color:#b3512f;">click here</a> to login to your Sentrifugo account.</div>
</div>';
$options['cron'] = 'yes';
$result = sapp_Global::_sendEmail($options);
}
$options['subject'] = APPLICATION_NAME . ' : Agency Activated';
$options['header'] = 'Agency Activated';
$options['toEmail'] = $agencyData['emailaddress'];
$options['toName'] = $agencyData['userfullname'];
$options['message'] = '<div>
<div>Dear ' . $agencyData['userfullname'] . ',</div>
<div></div>
Your agency has been activated. For further details, please contact our HR directly.
<div></div>
<div style="padding:20px 0 10px 0;">Please <a href="' . $baseUrl . '/index/popup" target="_blank" style="color:#b3512f;">click here</a> to login to your Sentrifugo account.</div>
</div>';
$options['cron'] = 'yes';
$result = sapp_Global::_sendEmail($options);
} else {
if ($flag == 'inactivated') {
$emailids = $agencylistmodel->getAllHRManagementEMails();
foreach ($emailids as $email) {
$options['subject'] = APPLICATION_NAME . ' : Agency is deleted';
$options['header'] = 'Agency deleted';
$options['toEmail'] = $email['groupEmail'];
if ($email['group_id'] == 4) {
$salutation = 'Dear HR,';
$options['toName'] = 'HR';
} else {
$salutation = 'Dear Management,';
$options['toName'] = 'Management';
}
$options['message'] = '<div>
<div>' . $salutation . ' </div>
<div></div>
' . $agencyData['userfullname'] . ' agency has been deleted.
<div></div>
<div style="padding:20px 0 10px 0;">Please <a href="' . $baseUrl . '/index/popup" target="_blank" style="color:#b3512f;">click here</a> to login to your Sentrifugo account.</div>
</div>';
$options['cron'] = 'yes';
$result = sapp_Global::_sendEmail($options);
}
$options['subject'] = APPLICATION_NAME . ' :: Agency is deleted';
$options['header'] = 'Agency Deleted';
$options['toEmail'] = $agencyData['emailaddress'];
$options['toName'] = $agencyData['userfullname'];
$options['message'] = '<div>
<div>Dear ' . $agencyData['userfullname'] . ',</div>
<div></div>
We regret to inform you that your agency has been deleted.
<div></div>
</div>';
$options['cron'] = 'yes';
$result = sapp_Global::_sendEmail($options);
}
}
}
示例11: sendmailstoemployees
public function sendmailstoemployees($oldRM, $newRM)
{
$baseUrl = BASE_URL;
$employeeModal = new Default_Model_Employee();
$employessunderEmpId = $employeeModal->getEmployeesUnderRM($oldRM);
/* Send Mails to the employees whose reporting manager is changed */
$oldRMData = $employeeModal->getsingleEmployeeData($oldRM);
$newRMData = $employeeModal->getsingleEmployeeData($newRM);
if (!empty($newRMData)) {
foreach ($employessunderEmpId as $employee) {
$options['subject'] = APPLICATION_NAME . ' : Change of reporting manager';
$options['header'] = 'Change of reporting manager';
$options['toEmail'] = $employee['emailaddress'];
$options['toName'] = $employee['userfullname'];
$options['message'] = '<div>Hello ' . ucfirst($employee['userfullname']) . ',
<div>' . ucfirst($newRMData[0]['userfullname']) . ' is your new reporting manager.</div>
<div style="padding:20px 0 10px 0;">Please <a href="' . $baseUrl . '/index/popup" target="_blank" style="color:#b3512f;">click here</a> to login </div>
</div>';
$result = sapp_Global::_sendEmail($options);
}
}
}
示例12: mail_helper_action
public function mail_helper_action($subject, $message, $summary_data, $to_email)
{
$status = $summary_data['status'];
$disp_arr = array('Closed' => 'Closed', 'Rejected' => 'Rejected');
$display_status = !array_key_exists($status, $disp_arr) ? "Open" : $disp_arr[$status];
$view = $this->getHelper('ViewRenderer')->view;
$base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
$this->view->base_url = $base_url;
$this->view->message = $message;
$this->view->newSubject = $subject;
$this->view->data = $summary_data;
$text = $view->render('mailtemplates/sd_request.phtml');
$options['subject'] = APPLICATION_NAME . ":" . $subject;
$options['header'] = $subject;
$options['toEmail'] = $to_email;
$options['toName'] = '';
$options['message'] = $text;
$options['cron'] = 'yes';
if ($options['toEmail'] != '') {
sapp_Global::_sendEmail($options, "sd_request");
}
}
示例13: cancelleave
public function cancelleave($userid, $recordid)
{
$businessunitid = '';
$from_date = '';
$to_date = '';
$reason = '';
$appliedleavescount = '';
$userfullname = '';
$useremail = '';
$reportingmanagername = '';
$reportingmanageremail = '';
$db = Zend_Db_Table::getDefaultAdapter();
$date = gmdate("Y-m-d H:i:s");
/* Fetching the record to be updated with cancel satus for email purpose and updating the status */
if ($userid != '' && $recordid != '') {
$leave_query = "SELECT l.reason,l.appliedleavescount,DATE_FORMAT(l.from_date,'" . DATEFORMAT_MYSQL . "') as from_date,\n\t\t\t\t\t\t\tDATE_FORMAT(l.to_date,'" . DATEFORMAT_MYSQL . "') as to_date FROM main_leaverequest AS l \n\t\t\t\t\t\t\twhere (l.id=" . $recordid . " and l.user_id =" . $userid . " and l.isactive=1)";
$leave_result = $db->query($leave_query)->fetch();
//echo "<pre>";print_r($leave_result);exit;
if (!empty($leave_result)) {
$from_date = $leave_result['from_date'];
$to_date = $leave_result['to_date'];
if ($to_date == '' || $to_date == NULL) {
$to_date = $from_date;
}
$reason = $leave_result['reason'];
$appliedleavescount = $leave_result['appliedleavescount'];
}
$db->query("update main_leaverequest set leavestatus = 4,modifiedby = " . $userid . ",\n\t\t\t\t\t\t\tmodifieddate = '" . $date . "' where (id=" . $recordid . " and user_id =" . $userid . " and isactive=1 )");
/* END */
$user_query = "SELECT u.userfullname,u.emailaddress,e.businessunit_id,e.reporting_manager FROM main_users AS u \n\t\t\t\t\t\t left join main_employees e on e.user_id=u.id\n\t\t\t\t\t\t WHERE (u.isactive = 1 AND u.id=" . $userid . ")";
$user_result = $db->query($user_query)->fetch();
if (!empty($user_result)) {
$userfullname = $user_result['userfullname'];
$useremail = $user_result['emailaddress'];
$businessunitid = $user_result['businessunit_id'];
$reportingmanagerid = $user_result['reporting_manager'];
}
if ($reportingmanagerid != '') {
$rep_mangr_query = "SELECT u.userfullname,u.emailaddress FROM main_users AS u \n\t\t\t\t\t\t\t\t\tWHERE (u.isactive = 1 AND u.id=" . $reportingmanagerid . ")";
$repmanager_result = $db->query($rep_mangr_query)->fetch();
if (!empty($repmanager_result)) {
$reportingmanagername = $repmanager_result['userfullname'];
$reportingmanageremail = $repmanager_result['emailaddress'];
}
}
if ($userfullname != '' && $useremail != '' && $from_date != '' && $reason != '' && $appliedleavescount != '') {
/* Mail to Employee */
$options['subject'] = 'Leave Request';
$options['header'] = 'Leave Request';
$options['fromEmail'] = DONOTREPLYEMAIL;
$options['fromName'] = DONOTREPLYNAME;
$options['toEmail'] = $useremail;
//$options['cc'] = $hremail;
$options['toName'] = $userfullname;
$options['message'] = '<div>
<div>Name : ' . $userfullname . '</div>
<div> No. of leaves applied : ' . $appliedleavescount . '</div>
<div>From : ' . $from_date . '</div>
<div>To : ' . $to_date . '.</div>
<div> Reason : ' . $reason . '</div>
</div>';
$result = sapp_Global::_sendEmail($options);
/* End */
/* Mail to Reporting Manager */
$options['subject'] = 'Leave Request';
$options['header'] = 'Leave Request';
$options['fromEmail'] = DONOTREPLYEMAIL;
$options['fromName'] = DONOTREPLYNAME;
$options['toEmail'] = $reportingmanageremail;
//$options['cc'] = $hremail;
$options['toName'] = $reportingmanagername;
$options['message'] = '<div>
<div>Name : ' . $userfullname . '</div>
<div> No. of leaves applied : ' . $appliedleavescount . '</div>
<div>From : ' . $from_date . '</div>
<div>To : ' . $to_date . '.</div>
<div> Reason : ' . $reason . '</div>
</div>';
$result = sapp_Global::_sendEmail($options);
/* End */
/* Mail to HR */
if (defined('LV_HR_' . $businessunitid) && $businessunitid != '') {
$options['subject'] = 'Leave Request';
$options['header'] = 'Leave Request';
$options['fromEmail'] = DONOTREPLYEMAIL;
$options['fromName'] = DONOTREPLYNAME;
$options['toEmail'] = constant('LV_HR_' . $businessunitid);
//$options['cc'] = $hremail;
$options['toName'] = 'Leave management';
$options['message'] = '<div>
<div>Name : ' . $userfullname . '</div>
<div> No. of leaves applied : ' . $appliedleavescount . '</div>
<div>From : ' . $from_date . '</div>
<div>To : ' . $to_date . '.</div>
<div> Reason : ' . $reason . '</div>
</div>';
//$options['cron'] = 'yes';
$result = sapp_Global::_sendEmail($options);
}
/*END */
//.........这里部分代码省略.........
示例14: send_req_mails1
public function send_req_mails1($id)
{
$sd_req_model = new Default_Model_Servicerequests();
$summary_data = $sd_req_model->getDataSummary($id);
$cc_req_ids = $sd_req_model->getCC_mails($summary_data['service_desk_conf_id']);
if ($summary_data['status'] == 'Open') {
$total_ids = array($cc_req_ids['request_recievers'], $cc_req_ids['cc_mail_recievers'], $summary_data['createdby']);
} else {
if ($summary_data['status'] == 'Closed') {
$total_ids = array($summary_data['executor_id'], $cc_req_ids['cc_mail_recievers'], $summary_data['createdby']);
} else {
if ($summary_data['status'] == 'To manager approve') {
$total_ids = array($summary_data['executor_id'], $cc_req_ids['cc_mail_recievers'], $summary_data['reporting_manager_id']);
} else {
if (in_array($summary_data['status'], array('To management approve', 'Management approved', 'Management rejected'))) {
$total_ids = array($summary_data['executor_id'], $cc_req_ids['cc_mail_recievers'], $summary_data['approver_1'], $summary_data['approver_2'], $summary_data['approver_3']);
} else {
if ($summary_data['status'] == 'Manager approved' || $summary_data['status'] == 'Manager rejected') {
$total_ids = array($summary_data['executor_id'], $cc_req_ids['cc_mail_recievers'], $summary_data['reporting_manager_id']);
}
}
}
}
}
$total_ids = array_filter($total_ids);
$total_ids = implode(',', $total_ids);
$email_ids = $sd_req_model->getEmailIds($total_ids);
$req_receivers = explode(',', $cc_req_ids['request_recievers']);
$cc = array();
if ($cc_req_ids['cc_mail_recievers'] != '') {
$cc = explode(',', $cc_req_ids['cc_mail_recievers']);
}
$req_receivers[] = $summary_data['createdby'];
$status = $summary_data['status'];
$disp_arr = array('Closed' => 'Closed', 'Rejected' => 'Closed');
$display_status = !in_array($status, $disp_arr) ? "Open" : "Closed";
if (count($req_receivers) > 0) {
foreach ($req_receivers as $rec) {
$base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
$view = $this->getHelper('ViewRenderer')->view;
$this->view->base_url = $base_url;
$this->view->type = "receivers";
$this->view->data = $summary_data;
$text = $view->render('mailtemplates/sdrequest.phtml');
$options['subject'] = "New Online request: Status - " . $display_status;
$options['header'] = 'Online request';
$options['toEmail'] = isset($email_ids[$rec]) ? $email_ids[$rec] : "";
$options['toName'] = '';
$options['message'] = $text;
$options['cron'] = 'yes';
if ($options['toEmail'] != '') {
sapp_Global::_sendEmail($options);
}
}
}
if (count($cc) > 0) {
foreach ($cc as $rec) {
$base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
$view = $this->getHelper('ViewRenderer')->view;
$this->view->base_url = $base_url;
$this->view->type = "receivers";
$this->view->data = $summary_data;
$text = $view->render('mailtemplates/sdrequest.phtml');
$options['subject'] = "New Online request: Status - Open";
$options['header'] = 'Online request';
$options['toEmail'] = $email_ids[$rec];
$options['toName'] = '';
$options['message'] = $text;
$options['cron'] = 'yes';
if ($options['toEmail'] != '') {
sapp_Global::_sendEmail($options);
}
}
}
}
示例15: save
//.........这里部分代码省略.........
try {
$actionflag = '';
$tableid = '';
$data = array('businessunit_id' => $businessunit_id, 'department_id' => $department_id != '' ? $department_id : NULL, 'performance_app_flag' => $performance_app_flag, 'appraisal_mode' => $appraisal_mode, 'appraisal_ratings' => $appraisal_ratings, 'module_flag' => 1, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
if ($id != '') {
/* for Update record */
$where = array('id=?' => $id);
$actionflag = 2;
} else {
/* for Insert new record */
$data['createdby'] = $loginUserId;
$data['createddate'] = gmdate("Y-m-d H:i:s");
$data['isactive'] = 1;
$where = '';
$actionflag = 1;
}
$Id = $appraisalconfigmodel->SaveorUpdateAppraisalConfigData($data, $where);
if ($Id == 'update') {
$tableid = $id;
$this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Appraisal settings updated successfully"));
} else {
$tableid = $Id;
$this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Appraisal settings added successfully"));
}
/*
* Logs Storing
*/
$menuID = APPRAISAL_SETTINGS;
$result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid);
/*
* Logs storing ends
*/
/** Start
* Sending Mails to employees
*/
if ($performance_app_flag == 0) {
$appraisal_details = $appraisalconfigmodel->getBunitDept($businessunit_id, $department_id);
} else {
$appraisal_details = $appraisalconfigmodel->getBunit($businessunit_id);
}
$employeeDetailsArr = $appraisalconfigmodel->getUserDetailsByID($businessunit_id, $department_id);
if (!empty($appraisal_details)) {
$bunit = $appraisal_details['unitname'];
$dept = $appraisal_details['deptname'];
}
$msg_add_update = $Id == 'update' ? "Updated" : "Configured";
$dept_str = $dept == '' ? " " : "and <b>{$dept}</b> department";
$emp_id_str = $loginuserRole == SUPERADMINROLE ? " " : "({$loginUserEmpId})";
//Preparing Employee array for BCc
$empArr = array();
if (!empty($employeeDetailsArr)) {
$empArrList = '';
foreach ($employeeDetailsArr as $emp) {
array_push($empArr, $emp['emailaddress']);
}
}
//Sending mail to Super admin
$options['subject'] = APPLICATION_NAME . ': Performance Appraisal Configuration ' . ucfirst($msg_add_update);
$options['header'] = 'Performance Appraisal';
$options['toEmail'] = SUPERADMIN_EMAIL;
$options['bcc'] = $empArr;
$options['toName'] = 'Super Admin';
$options['message'] = "<div style='padding: 0; text-align: left; font-size:14px; font-family:Arial, Helvetica, sans-serif;'>\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span style='color:#3b3b3b;'>Hi,</span><br />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div style='padding:20px 0 0 0;color:#3b3b3b;'>Performance appraisal settings are {$msg_add_update} for <b>{$bunit}</b> business unit {$dept_str} by " . $loginUsername . $emp_id_str . " </div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div style='padding:20px 0 10px 0;'>Please <a href=" . BASE_URL . " target='_blank' style='color:#b3512f;'>click here</a> to login to <b>" . APPLICATION_NAME . "</b> and check the details.</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div> ";
$mail_id = sapp_Global::_sendEmail($options);
/**
* End
*/
$db->commit();
$this->_redirect('appraisalconfig');
throw new Exception("Some error message");
} catch (Exception $e) {
$db->rollBack();
echo $e->getMessage();
echo $e->getTraceAsString();
return $msgarray;
}
} else {
$messages = $appraisalconfigform->getMessages();
foreach ($messages as $key => $val) {
foreach ($val as $key2 => $val2) {
$msgarray[$key] = $val2;
break;
}
}
if (isset($businessunit_id) && $businessunit_id != '') {
if ($performance_app_flag == 0) {
$departmentlistArr = $departmentsmodel->getDepartmentList($businessunit_id);
if (!empty($departmentlistArr)) {
foreach ($departmentlistArr as $departmentlist) {
$appraisalconfigform->department_id->addMultiOption($departmentlist['id'], utf8_encode($departmentlist['deptname']));
}
}
}
if (isset($department_id) && $department_id != 0 && $department_id != '') {
$appraisalconfigform->setDefault('department_id', $department_id);
}
}
return $msgarray;
}
}