本文整理匯總了PHP中Default_Model_Users::getEmpDetailsByEmailAddress方法的典型用法代碼示例。如果您正苦於以下問題:PHP Default_Model_Users::getEmpDetailsByEmailAddress方法的具體用法?PHP Default_Model_Users::getEmpDetailsByEmailAddress怎麽用?PHP Default_Model_Users::getEmpDetailsByEmailAddress使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Default_Model_Users
的用法示例。
在下文中一共展示了Default_Model_Users::getEmpDetailsByEmailAddress方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: sendpasswordAction
public function sendpasswordAction()
{
$ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext->addActionContext('sendpassword', 'json')->initContext();
$emailaddress = $this->_request->getParam('emailaddress');
$user = new Default_Model_Users();
$result['result'] = '';
$result['message'] = '';
if ($emailaddress) {
$isvalidemail = filter_var($emailaddress, FILTER_VALIDATE_EMAIL);
}
if ($emailaddress == '') {
$result['result'] = 'error';
$result['message'] = 'Please enter email.';
} else {
if ($emailaddress != $isvalidemail) {
$result['result'] = 'error';
$result['message'] = 'Please enter valid email.';
} else {
$emailexists = $user->getEmailAddressCount($emailaddress);
$emailcount = $emailexists[0]['emailcount'];
$username = $emailexists[0]['userfullname'];
if ($emailcount > 0) {
$generatedPswd = uniqid();
$encodedPswd = md5($generatedPswd);
$user->updatePwd($encodedPswd, $emailaddress);
$options['subject'] = APPLICATION_NAME . ' Password Change';
$options['header'] = APPLICATION_NAME . ' Password';
$options['toName'] = $username;
$options['toEmail'] = $emailaddress;
$options['message'] = "<div>Hello " . $username . ",</div>\n\t\t\t\t\t\t\t\t\t\t\t\t<div>Your password for " . APPLICATION_NAME . " application has been changed. Following is the new password <b>" . $generatedPswd . "</b>.</div>";
$res = sapp_Mail::_email($options);
if ($res === true) {
$result['result'] = 'success';
$result['message'] = 'New password is sent to given E-mail';
} else {
$result['result'] = 'error';
$result['message'] = 'Problem sending email. Try again later.';
}
} else {
$empdetailsbyemailaddress = $user->getEmpDetailsByEmailAddress($emailaddress);
if (!empty($empdetailsbyemailaddress)) {
$username = $empdetailsbyemailaddress[0]['userfullname'];
$status = $empdetailsbyemailaddress[0]['isactive'];
$isaccountlock = $empdetailsbyemailaddress[0]['emptemplock'];
if ($status == 0) {
$result['result'] = 'error';
$result['message'] = 'Employee has been inactivated from the organization.';
} else {
if ($status == 2) {
$result['result'] = 'error';
$result['message'] = 'Employee has resigned from the organization.';
} else {
if ($status == 3) {
$result['result'] = 'error';
$result['message'] = 'Employee has left the organization.';
} else {
if ($status == 4) {
$result['result'] = 'error';
$result['message'] = 'Employee has been suspended from the organization.';
} else {
if ($status == 5) {
$result['result'] = 'error';
$result['message'] = 'Employee deleted.';
} else {
if ($isaccountlock == 1) {
$result['result'] = 'error';
$result['message'] = 'Employee has been locked.';
}
}
}
}
}
}
} else {
if ($emailcount == 0) {
$result['result'] = 'error';
$result['message'] = 'Email does not exist.';
}
}
}
}
}
$this->_helper->json($result);
}