本文整理匯總了PHP中Default_Model_Employee::SaveorUpdateEmployeeData方法的典型用法代碼示例。如果您正苦於以下問題:PHP Default_Model_Employee::SaveorUpdateEmployeeData方法的具體用法?PHP Default_Model_Employee::SaveorUpdateEmployeeData怎麽用?PHP Default_Model_Employee::SaveorUpdateEmployeeData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Default_Model_Employee
的用法示例。
在下文中一共展示了Default_Model_Employee::SaveorUpdateEmployeeData方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: save
//.........這裏部分代碼省略.........
$user_where = "id = " . $user_id;
unset($user_data['candidatereferredby']);
unset($user_data['userstatus']);
unset($user_data['emppassword']);
unset($user_data['employeeId']);
unset($user_data['modeofentry']);
} else {
$user_data['createdby'] = $loginUserId;
$user_data['createddate'] = gmdate("Y-m-d H:i:s");
$user_data['isactive'] = 1;
$where = '';
$actionflag = 1;
$user_where = '';
$identity_code_model = new Default_Model_Identitycodes();
$identity_codes = $identity_code_model->getIdentitycodesRecord();
$emp_identity_code = isset($identity_codes[0]) ? $identity_codes[0]['employee_code'] : "";
if ($emp_identity_code != '') {
$emp_id = $emp_identity_code . str_pad($usersModel->getMaxEmpId($emp_identity_code), 4, '0', STR_PAD_LEFT);
} else {
$emp_id = '';
}
$user_data['employeeId'] = $emp_id;
}
$user_status = $usersModel->SaveorUpdateUserData($user_data, $user_where);
if ($id == '') {
$user_id = $user_status;
}
$data = array('user_id' => $user_id, 'reporting_manager' => $reporting_manager, 'emp_status_id' => $emp_status_id, 'businessunit_id' => $businessunit_id, 'department_id' => $department_id, 'jobtitle_id' => $jobtitle_id, 'position_id' => $position_id, 'prefix_id' => $prefix_id, 'extension_number' => $extension_number != '' ? $extension_number : NULL, 'office_number' => $office_number != '' ? $office_number : NULL, 'office_faxnumber' => $office_faxnumber != '' ? $office_faxnumber : NULL, 'date_of_joining' => $date_of_joining, 'date_of_leaving' => $date_of_leaving != '' ? $date_of_leaving : NULL, 'years_exp' => $years_exp == '' ? null : $years_exp, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
if ($id == '') {
$data['createdby'] = $loginUserId;
$data['createddate'] = gmdate("Y-m-d H:i:s");
$data['isactive'] = 1;
}
$Id = $employeeModal->SaveorUpdateEmployeeData($data, $where);
$statuswhere = array('id=?' => $user_id);
if ($id != '') {
if (in_array($emp_status_id, $empstatusarray)) {
$isactivestatus = '';
if ($emp_status_id == 8) {
$isactivestatus = 2;
} else {
if ($emp_status_id == 9) {
$isactivestatus = 3;
} else {
if ($emp_status_id == 10) {
$isactivestatus = 4;
}
}
}
$statusdata = array('isactive' => $isactivestatus);
$empstatusId = $usersModel->SaveorUpdateUserData($statusdata, $statuswhere);
$employeeModal->SaveorUpdateEmployeeData($statusdata, "user_id = " . $user_id);
} else {
$edata = $usersModel->getUserDataById($id);
$statusdata = array('isactive' => 1);
if ($edata['isactive'] != 0) {
if ($edata['emptemplock'] == 1) {
$statusdata = array('isactive' => 0);
}
$empstatusId = $usersModel->SaveorUpdateUserData($statusdata, $statuswhere);
$employeeModal->SaveorUpdateEmployeeData($statusdata, "user_id = " . $user_id);
}
}
}
if ($Id == 'update') {
$tableid = $id;
示例2: editAction
//.........這裏部分代碼省略.........
if ($deptname != '' && $unitid != '') {
if (!preg_match('/^[a-zA-Z.\\- ?]+$/', $deptname)) {
$msgarray['deptname'] = "Please enter valid department name.";
$flag = 'false';
} else {
$checkExists = $deptModel->checkExistance($deptname, $unitid, $id);
if ($checkExists != 0) {
$msgarray['deptname'] = "Department name already exists.";
$flag = 'false';
}
}
} else {
$flag = 'false';
}
$start_date = $this->_request->getParam('start_date', null);
$start_date = sapp_Global::change_date($start_date, 'database');
if ($deptform->isValid($this->_request->getPost()) && $flag == 'true') {
$deptname = $this->_request->getParam('deptname');
$deptcode = $this->_request->getParam('deptcode');
$description = $this->_request->getParam('description');
$country = $this->_request->getParam('country');
$state = intval($this->_request->getParam('state'));
$city = $this->_request->getParam('city');
$address1 = $this->_request->getParam('address1');
$address2 = $this->_request->getParam('address2');
$address3 = $this->_request->getParam('address3');
$unitid = $this->_request->getParam('unitid');
$timezone = $this->_request->getParam('timezone');
$depthead = $this->_request->getParam('depthead');
$deptcodeExistance = $deptModel->checkCodeDuplicates($deptcode, $id);
if (!$deptcodeExistance) {
$date = new Zend_Date();
$actionflag = '';
$tableid = '';
$data = array('deptname' => trim($deptname), 'deptcode' => trim($deptcode), 'description' => trim($description), 'startdate' => $start_date != '' ? $start_date : NULL, 'country' => trim($country), 'state' => trim($state), 'city' => trim($city), 'address1' => trim($address1), 'address2' => trim($address2), 'address3' => trim($address3), 'timezone' => trim($timezone), 'unitid' => $unitid, 'depthead' => trim($depthead), 'modifiedby' => $loginUserId, 'modifieddate' => $date->get('yyyy-MM-dd HH:mm:ss'));
if ($id != '') {
$where = array('id=?' => $id);
$actionflag = 2;
} else {
$data['createdby'] = $loginUserId;
$data['createddate'] = $date->get('yyyy-MM-dd HH:mm:ss');
$data['isactive'] = 1;
$where = '';
$actionflag = 1;
}
$Id = $deptModel->SaveorUpdateDepartmentsUnits($data, $where);
/* Updating business unit and department for org head*/
$emp_data = array('businessunit_id' => $unitid, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
$emp_where = array('user_id=?' => $depthead);
if ($Id == 'update') {
$tableid = $id;
$emp_data['department_id'] = $id;
$this->_helper->getHelper("FlashMessenger")->addMessage("Department updated successfully.");
} else {
$tableid = $Id;
$emp_data['department_id'] = $Id;
$this->_helper->getHelper("FlashMessenger")->addMessage("Department added successfully.");
}
$employeeModal->SaveorUpdateEmployeeData($emp_data, $emp_where);
$menuID = DEPARTMENTS;
$result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid);
$this->_redirect('departments');
} else {
$msgarray['message'] = 'A Department, with the given code, already exists.';
$msgarray['msgtype'] = 'error';
$this->view->messages = $msgarray;
}
} else {
$messages = $deptform->getMessages();
foreach ($messages as $key => $val) {
foreach ($val as $key2 => $val2) {
$msgarray[$key] = $val2;
break;
}
if (empty($allCountriesData)) {
$msgarray['country'] = 'Countries are not configured yet.';
}
if (empty($allStatesData)) {
$msgarray['state'] = 'States are not configured yet.';
}
if (empty($allCitiesData)) {
$msgarray['city'] = 'Cities are not configured yet.';
}
if (empty($allBusinessunitsData)) {
$msgarray['unitid'] = 'Business units are not added yet.';
}
if (empty($allTimezoneData)) {
$msgarray['timezone'] = 'Time zones are not configured yet.';
}
}
$this->view->msgarray = $msgarray;
}
}
} else {
$orgdata = 'noorgdata';
$this->view->orgdata = $orgdata;
}
$this->view->popConfigPermission = $popConfigPermission;
$this->view->organisationHead = $organisationHead;
}
示例3: updateempdetails
public function updateempdetails($employeeform)
{
$emproleStr = '';
$roleArr = array();
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$loginUserId = $auth->getStorage()->read()->id;
}
$usersModel = new Default_Model_Usermanagement();
$employeeModal = new Default_Model_Employee();
$businessunit_id = $this->_request->getParam('businessunit_id', null);
$department_id = $this->_request->getParam('department_id', null);
$reporting_manager = $this->_request->getParam('reporting_manager', null);
$jobtitle_id = $this->_request->getParam('jobtitle_id', null);
$position_id = $this->_request->getParam('position_id', null);
$user_id = $this->_getParam('user_id', null);
$prefix_id = $this->_getParam('prefix_id', null);
$extension_number = $this->_getParam('extension_number', null);
if ($employeeform->isValid($this->_request->getPost())) {
$id = $this->_request->getParam('id');
$emp_status_id = $this->_request->getParam('emp_status_id', null);
$date_of_joining = $this->_request->getParam('date_of_joining', null);
$date_of_joining = sapp_Global::change_date($date_of_joining, 'database');
$date_of_leaving = $this->_request->getParam('date_of_leaving', null);
$date_of_leaving = sapp_Global::change_date($date_of_leaving, 'database');
$years_exp = $this->_request->getParam('years_exp');
//FOR USER table
$employeeId = $this->_getParam('employeeId', null);
$modeofentry = $this->_getParam('modeofentry', null);
$hid_modeofentry = $this->_getParam('hid_modeofentry', null);
$other_modeofentry = $this->_getParam('other_modeofentry', null);
$userfullname = $this->_getParam('userfullname', null);
$candidatereferredby = $this->_getParam('candidatereferredby', null);
$rccandidatename = $this->_getParam('rccandidatename', null);
$emprole = $this->_getParam('emprole', null);
//roleid_group_id
if ($emprole != "") {
$roleArr = explode('_', $emprole);
if (!empty($roleArr)) {
$emproleStr = $roleArr[0];
}
}
$emailaddress = $this->_getParam('emailaddress', null);
$tmp_name = $this->_request->getParam('tmp_emp_name', null);
$act_inact = $this->_request->getParam("act_inact", null);
//end of user table
$date = new Zend_Date();
$menumodel = new Default_Model_Menu();
$empstatusarray = array(8, 9, 10);
$actionflag = '';
$tableid = '';
if ($modeofentry == 'Direct' || $hid_modeofentry == 'Direct') {
$candidate_key = 'userfullname';
$candidate_value = $userfullname;
$emp_name = $userfullname;
$candidate_flag = 'no';
} else {
$candidate_key = 'rccandidatename';
$candidate_value = $rccandidatename;
$emp_name = $tmp_name;
$candidate_flag = 'yes';
}
$trDb = Zend_Db_Table::getDefaultAdapter();
// starting transaction
$trDb->beginTransaction();
try {
$emppassword = sapp_Global::generatePassword();
$user_data = array('emprole' => $emproleStr, $candidate_key => $candidate_value, 'emailaddress' => $emailaddress, 'modifiedby' => $loginUserId, 'modifieddate' => Zend_Registry::get('currentdate'), 'emppassword' => md5($emppassword), 'employeeId' => $employeeId, 'modeofentry' => $id == '' ? $modeofentry : "", 'selecteddate' => $date_of_joining, 'candidatereferredby' => $candidatereferredby, 'userstatus' => 'old', 'other_modeofentry' => $other_modeofentry);
if ($id != '') {
$where = array('user_id=?' => $user_id);
$actionflag = 2;
$user_where = "id = " . $user_id;
unset($user_data['candidatereferredby']);
unset($user_data['userstatus']);
unset($user_data['emppassword']);
unset($user_data['employeeId']);
unset($user_data['modeofentry']);
unset($user_data['other_modeofentry']);
} else {
$data['createdby'] = $loginUserId;
$data['createddate'] = gmdate("Y-m-d H:i:s");
$data['isactive'] = 1;
$user_data['createdby'] = $loginUserId;
$user_data['createddate'] = gmdate("Y-m-d H:i:s");
$user_data['isactive'] = 1;
if ($modeofentry != 'Direct') {
$user_data['userfullname'] = $emp_name;
}
$where = '';
$actionflag = 1;
$user_where = '';
}
$user_status = $usersModel->SaveorUpdateUserData($user_data, $user_where);
if ($id == '') {
$user_id = $user_status;
}
$data = array('user_id' => $user_id, 'reporting_manager' => $reporting_manager, 'emp_status_id' => $emp_status_id, 'businessunit_id' => $businessunit_id, 'department_id' => $department_id, 'jobtitle_id' => $jobtitle_id, 'position_id' => $position_id, 'prefix_id' => $prefix_id, 'extension_number' => $extension_number, 'date_of_joining' => $date_of_joining, 'date_of_leaving' => $date_of_leaving != '' ? $date_of_leaving : NULL, 'years_exp' => $years_exp == '' ? null : $years_exp, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
$Id = $employeeModal->SaveorUpdateEmployeeData($data, $where);
$statuswhere = array('id=?' => $user_id);
if (in_array($emp_status_id, $empstatusarray)) {
//.........這裏部分代碼省略.........
示例4: process_emp_excel
//.........這裏部分代碼省略.........
return array('status' => 'error', 'msg' => $err_msg);
}
$err_msg = "";
for ($i = 2; $i <= $sizeOfWorksheet; $i++) {
$rowData_org = $sheet->rangeToArray('A' . $i . ':' . $highestColumn . $i, NULL, TRUE, TRUE);
$rowData = $rowData_org[0];
$rowData_cpy = $rowData;
foreach ($rowData_cpy as $rkey => $rvalue) {
$rowData[$rkey] = trim($rvalue);
}
$ex_prefix_arr[] = $rowData[0];
//$ex_fullname_arr[] = $rowData[1];
$ex_firstname_arr[] = $rowData[1];
$ex_lastname_arr[] = $rowData[2];
$ex_role_arr[] = $rowData[3];
$ex_email_arr[$i] = $rowData[4];
$ex_bu_arr[] = $rowData[5];
$ex_dep_arr[] = $rowData[6];
$ex_rm_arr[] = $rowData[7];
$ex_jt_arr[] = $rowData[8];
$ex_pos_arr[] = $rowData[9];
$ex_es_arr[] = $rowData[10];
$ex_doj_arr[] = $rowData[11];
$ex_dol_arr[] = $rowData[12];
$ex_exp_arr[] = $rowData[13];
$ex_ext_arr[] = $rowData[14];
$ex_wn_arr[] = $rowData[15];
$ex_fax_arr[] = $rowData[16];
$tot_rec_cnt++;
}
foreach ($ex_email_arr as $key1 => $value1) {
$d = 0;
foreach ($ex_email_arr as $key2 => $value2) {
if ($key1 != $key2 && $value1 == $value2) {
$err_msg = "Duplicate email entry at row " . $key2 . ".";
$d++;
break;
}
}
if ($d > 0) {
break;
}
}
if (!empty($err_msg)) {
return array('status' => 'error', 'msg' => $err_msg);
}
//end of validations
//start of saving
if ($tot_rec_cnt > 0) {
for ($i = 2; $i <= $sizeOfWorksheet; $i++) {
$emp_id = $emp_identity_code . str_pad($usersModel->getMaxEmpId($emp_identity_code), 4, '0', STR_PAD_LEFT);
$rowData_org = $sheet->rangeToArray('A' . $i . ':' . $highestColumn . $i, NULL, TRUE, TRUE);
$rowData = $rowData_org[0];
$rowData_cpy = $rowData;
foreach ($rowData_cpy as $rkey => $rvalue) {
$rowData[$rkey] = trim($rvalue);
}
$emppassword = sapp_Global::generatePassword();
$date = new DateTime($rowData[11]);
$date_of_joining = $date->format('Y-m-d');
$date_of_leaving = "";
if ($rowData[12] != '') {
$ldate = new DateTime($rowData[12]);
$date_of_leaving = $ldate->format('Y-m-d');
}
$userfullname = $rowData[1] . ' ' . $rowData[2];
$user_data = array('emprole' => $roles_arr[strtolower($rowData[3])], 'userfullname' => $userfullname, 'firstname' => $rowData[1], 'lastname' => $rowData[2], 'emailaddress' => $rowData[4], 'jobtitle_id' => $job_arr[strtolower($rowData[8])], 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"), 'emppassword' => md5($emppassword), 'employeeId' => $emp_id, 'modeofentry' => "Direct", 'selecteddate' => $date_of_joining, 'userstatus' => 'old');
$user_data['createdby'] = $loginUserId;
$user_data['createddate'] = gmdate("Y-m-d H:i:s");
$user_data['isactive'] = 1;
$user_id = $usersModel->SaveorUpdateUserData($user_data, '');
$data = array('user_id' => $user_id, 'reporting_manager' => $users_arr[strtolower($rowData[7])], 'emp_status_id' => $emp_stat_arr[strtolower($rowData[10])], 'businessunit_id' => !empty($rowData[4]) ? $bu_arr[strtolower($rowData[5])] : 0, 'department_id' => !empty($rowData[5]) ? $dep_arr[strtolower($rowData[6])] : null, 'jobtitle_id' => $job_arr[strtolower($rowData[8])], 'position_id' => $positions_arr[strtolower($rowData[9])], 'prefix_id' => $prefix_arr[strtolower($rowData[0])], 'extension_number' => $rowData[13] != '' ? $rowData[14] : NULL, 'office_number' => $rowData[14] != '' ? $rowData[15] : NULL, 'office_faxnumber' => $rowData[15] != '' ? $rowData[16] : NULL, 'date_of_joining' => $date_of_joining, 'date_of_leaving' => $date_of_leaving != '' ? $date_of_leaving : NULL, 'years_exp' => $rowData[13] == '' ? null : $rowData[13], 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
$data['createdby'] = $loginUserId;
$data['createddate'] = gmdate("Y-m-d H:i:s");
$data['isactive'] = 1;
$emp_model->SaveorUpdateEmployeeData($data, '');
$text = "<div style='padding: 0; text-align: left; font-size:14px; font-family:Arial, Helvetica, sans-serif;'>\t\t\t\t\n\t<span style='color:#3b3b3b;'>Hello " . ucfirst($userfullname) . ",</span><br />\n\t\n\t<div style='padding:20px 0 0 0;color:#3b3b3b;'>You have been added to " . APPLICATION_NAME . ". The login credentials for your Sentrifugo account are:</div>\n\t\n\t<div style='padding:20px 0 0 0;color:#3b3b3b;'>Username: <strong>" . $emp_id . "</strong></div>\n\t<div style='padding:5px 0 0 0;color:#3b3b3b;'>Password: <strong>" . $emppassword . "</strong></div>\n\t\n\t<div style='padding:20px 0 10px 0;'>Please <a href='" . DOMAIN . "index/popup' target='_blank' style='color:#b3512f;'>click here</a> to login to your Sentrifugo account.</div>\n\n</div>";
$options['subject'] = APPLICATION_NAME . ': Login Credentials';
$options['header'] = 'Greetings from Sentrifugo';
$options['toEmail'] = $rowData[4];
$options['toName'] = $userfullname;
$options['message'] = $text;
$options['cron'] = 'yes';
$result = sapp_Global::_sendEmail($options);
}
//end of for loop
$trDb->commit();
return array('status' => "success", 'msg' => 'Employees saved successfully.');
} else {
return array('status' => 'error', 'msg' => "No records to save.");
}
//end of saving
} catch (Exception $e) {
$trDb->rollBack();
return array('status' => 'error', 'msg' => "Something went wrong,please try again.");
}
} else {
return array('status' => 'error', 'msg' => "No records to save.");
}
}
示例5: 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;
}
示例6: addorgheadAction
//.........這裏部分代碼省略.........
}
$form->position_id->addMultiOption('', 'Select a Position');
if (isset($_POST['jobtitle_id']) && $_POST['jobtitle_id'] != '') {
$jobtitle_id = $_POST['jobtitle_id'];
$positionlistArr = $positionsmodel->getPositionList($jobtitle_id);
if (sizeof($positionlistArr) > 0) {
foreach ($positionlistArr as $positionlistres) {
$form->position_id->addMultiOption($positionlistres['id'], $positionlistres['positionname']);
}
}
}
if (isset($_POST['prevorghead_rm']) && $_POST['prevorghead_rm'] != '') {
$posted_prevorghead_rm = $_POST['prevorghead_rm'];
}
$orgheadsData = $employeeModal->getEmployeesForOrgHead();
$emp_data = $employeeModal->fetchRow("is_orghead = 1");
if (!empty($emp_data)) {
$user_data = $user_model->fetchRow("id = " . $emp_data->user_id);
if (!empty($user_data)) {
$prevorgheadId = $user_data->id;
} else {
$form->removeElement('prevorghead_rm');
}
} else {
$form->removeElement('prevorghead_rm');
}
if ($this->getRequest()->getPost()) {
if ($form->isValid($this->_request->getPost()) && $flag != 'false') {
$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_head', null), 'database');
$employeeId = $this->_request->getParam('employeeId', null);
$emprole = $this->_request->getParam('emprole', null);
$emailaddress = $this->_request->getParam('emailaddress', null);
$emppassword = sapp_Global::generatePassword();
$first_name = trim($this->_request->getParam('firstname_orghead', null));
$last_name = trim($this->_request->getParam('lastname_orghead', null));
//$userfullname = trim($this->_request->getParam('orghead',null));
$userfullname = $first_name . ' ' . $last_name;
$prefix_id = $this->_request->getParam('prefix_id', null);
$user_id = $this->_request->getParam('user_id', null);
$prevorghead_rm = $this->_request->getParam('prevorghead_rm', null);
$prevheadid = $this->_request->getParam('prevheadid', null);
$user_data = array('emprole' => $emprole, 'firstname' => $first_name, 'lastname' => $last_name, 'userfullname' => $userfullname, 'emailaddress' => $emailaddress, 'jobtitle_id' => $jobtitle_id, 'emppassword' => md5($emppassword), 'employeeId' => $employeeId, 'selecteddate' => $date_of_joining, 'userstatus' => 'old', 'modeofentry' => 'Direct', 'createdby' => $loginUserId, 'createddate' => gmdate("Y-m-d H:i:s"), 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"), 'isactive' => 1);
$emp_data = array('jobtitle_id' => $jobtitle_id, 'position_id' => $position_id, 'prefix_id' => $prefix_id, 'reporting_manager' => 0, 'date_of_joining' => $date_of_joining, 'createdby' => $loginUserId, 'createddate' => gmdate("Y-m-d H:i:s"), 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"), 'isactive' => 1, 'is_orghead' => 1);
$org_data = array('modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
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;
$db = Zend_Db_Table::getDefaultAdapter();
$db->beginTransaction();
try {
$user_id = $user_model->SaveorUpdateUserData($user_data, '');
$emp_data['user_id'] = $user_id;
$employeeModal->SaveorUpdateEmployeeData($emp_data, '');
if (isset($prevheadid) && $prevheadid != '') {
$org_data['orghead'] = $user_id;
$orgwhere = array('id=?' => $org_id);
$orgInfoModel->SaveorUpdateData($org_data, $orgwhere);
$orgInfoModel->changeOrgHead($prevheadid, $user_id, $prevorghead_rm);
$this->sendmailstoemployees($prevheadid, $user_id);
}
$tableid = $user_id;
$actionflag = 1;
$menuID = EMPLOYEE;
try {
$result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid);
} catch (Exception $e) {
echo $e->getMessage();
}
$close = 'close';
$this->view->popup = $close;
$this->view->eventact = 'added';
$db->commit();
} catch (Exception $e) {
$db->rollBack();
}
} else {
$messages = $form->getMessages();
foreach ($messages as $key => $val) {
foreach ($val as $key2 => $val2) {
$msgarray[$key] = $val2;
break;
}
}
}
}
$this->view->prevorgheadId = $prevorgheadId;
$this->view->form = $form;
$this->view->msgarray = $msgarray;
$this->view->orgheadsData = $orgheadsData;
$this->view->posted_prevorghead_rm = $posted_prevorghead_rm;
} catch (Exception $e) {
echo $e->getMessage();
die;
}
}