本文整理匯總了PHP中Default_Model_Usermanagement::SaveorUpdateUserData方法的典型用法代碼示例。如果您正苦於以下問題:PHP Default_Model_Usermanagement::SaveorUpdateUserData方法的具體用法?PHP Default_Model_Usermanagement::SaveorUpdateUserData怎麽用?PHP Default_Model_Usermanagement::SaveorUpdateUserData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Default_Model_Usermanagement
的用法示例。
在下文中一共展示了Default_Model_Usermanagement::SaveorUpdateUserData方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: save
public function save($employeeform)
{
$emproleStr = '';
$roleArr = array();
$empgroupStr = '';
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$loginUserId = $auth->getStorage()->read()->id;
}
$usersModel = new Default_Model_Usermanagement();
$employeeModal = new Default_Model_Employee();
$requimodel = new Default_Model_Requisition();
$candidate_model = new Default_Model_Candidatedetails();
$orgInfoModel = new Default_Model_Organisationinfo();
$unitid = '';
$deptid = '';
$errorflag = 'true';
$msgarray = array();
$id = $this->_request->getParam('id');
$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);
$office_number = $this->_request->getParam('office_number', null);
$office_faxnumber = $this->_request->getParam('office_faxnumber', null);
$date_of_joining = $this->_request->getParam('date_of_joining', null);
$date_of_joining = sapp_Global::change_date($date_of_joining, 'database');
$isvalidorgstartdate = $orgInfoModel->validateEmployeeJoiningDate($date_of_joining, $unitid, $deptid);
if (!empty($isvalidorgstartdate)) {
$msgarray['date_of_joining'] = 'Employee joining date should be greater than organization start date.';
$errorflag = 'false';
}
if ($employeeform->isValid($this->_request->getPost()) && $errorflag == 'true') {
$id = $this->_request->getParam('id');
$emp_status_id = $this->_request->getParam('emp_status_id', null);
$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);
$firstname = trim($this->_getParam('firstname', null));
$lastname = trim($this->_getParam('lastname', null));
$userfullname = $firstname . ' ' . $lastname;
$emprole = $this->_getParam('emprole', null);
//roleid_group_id
if ($emprole != "") {
$roleArr = explode('_', $emprole);
if (!empty($roleArr)) {
$emproleStr = $roleArr[0];
$empgroupStr = $roleArr[0];
}
}
$emailaddress = $this->_getParam('emailaddress', null);
//end of user table
$date = new Zend_Date();
$menumodel = new Default_Model_Menu();
$empstatusarray = array(8, 9, 10);
$actionflag = '';
$tableid = '';
$trDb = Zend_Db_Table::getDefaultAdapter();
// starting transaction
$trDb->beginTransaction();
try {
$emppassword = sapp_Global::generatePassword();
$user_data = array('emprole' => $emproleStr, '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' => $id == '' ? $modeofentry : "", 'selecteddate' => $date_of_joining, 'candidatereferredby' => 0, 'userstatus' => 'old');
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']);
} 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;
}
//.........這裏部分代碼省略.........
示例2: 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)) {
//.........這裏部分代碼省略.........
示例3: sessiontourAction
public function sessiontourAction()
{
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$loginUserId = $auth->getStorage()->read()->id;
}
$usermanagementModel = new Default_Model_Usermanagement();
$status = $usermanagementModel->SaveorUpdateUserData(array('tourflag' => 1), "id=" . $loginUserId);
if ($status == 'update') {
$auth->getStorage()->read()->tourflag = 1;
}
$this->_helper->json($status);
}
示例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: changeRM
public function changeRM($oldRM, $newRM, $status, $ishead)
{
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$loginUserId = $auth->getStorage()->read()->id;
}
$db = Zend_Db_Table::getDefaultAdapter();
$db->beginTransaction();
$oldRMData = $this->getsingleEmployeeData($oldRM);
try {
if ($status == 'active') {
$data = array('isactive' => 1, 'emptemplock' => 0, 'modifieddate' => gmdate("Y-m-d H:i:s"), 'modifiedby' => $loginUserId);
$Query1 = "UPDATE main_employees SET isactive = 1, modifieddate = '" . gmdate("Y-m-d H:i:s") . "', modifiedby = " . $loginUserId . " WHERE user_id=" . $oldRM . " ;";
$db->query($Query1);
} else {
if ($status == 'inactive') {
$data = array('isactive' => 0, 'emptemplock' => 1, 'modifieddate' => gmdate("Y-m-d H:i:s"), 'modifiedby' => $loginUserId);
}
}
$where = "id = " . $oldRM;
$user_model = new Default_Model_Usermanagement();
$result = $user_model->SaveorUpdateUserData($data, $where);
if ($status == 'inactive') {
$empQuery1 = "UPDATE main_employees SET reporting_manager = " . $newRM . ", modifieddate = '" . gmdate("Y-m-d H:i:s") . "', modifiedby = " . $loginUserId . " WHERE reporting_manager=" . $oldRM . " and isactive = 1 AND user_id <> " . $newRM . ";";
$empQuery2 = "UPDATE main_employees SET reporting_manager = " . $oldRMData[0]['reporting_manager'] . ", modifieddate = '" . gmdate("Y-m-d H:i:s") . "', modifiedby = " . $loginUserId . " WHERE reporting_manager=" . $oldRM . " and isactive = 1 AND user_id = " . $newRM . ";";
if ($ishead == '1') {
$orgQuery1 = "UPDATE main_employees SET is_orghead = 0,isactive = 0, reporting_manager= " . $newRM . ", modifieddate = '" . gmdate("Y-m-d H:i:s") . "', modifiedby = " . $loginUserId . " WHERE user_id=" . $oldRM . " ;";
$db->query($orgQuery1);
$orgQuery2 = "UPDATE main_employees SET is_orghead = 1,reporting_manager= 0, modifieddate = '" . gmdate("Y-m-d H:i:s") . "', modifiedby = " . $loginUserId . " WHERE user_id=" . $newRM . " ;";
$db->query($orgQuery2);
}
$db->query($empQuery1);
$db->query($empQuery2);
}
$db->commit();
return 'success';
} catch (Exception $e) {
return 'failed';
$db->rollBack();
}
}
示例6: 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;
}
示例7: 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;
}
}
示例8: deleteAction
/**
* This action is used to delete roles and their child data.
* @parameters
* @param objid = id of role.
*
* @return String success/failure message
*/
public function deleteAction()
{
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$loginUserId = $auth->getStorage()->read()->id;
}
$baseUrl = $this->generateBaseurl();
$id = $this->_request->getParam('objid');
$messages['message'] = '';
$actionflag = 3;
$agencyuser = 'no';
$Id = '';
if ($id) {
$user_model = new Default_Model_Usermanagement();
$menumodel = new Default_Model_Menu();
$agencylistmodel = new Default_Model_Agencylist();
$agencyroles = $agencylistmodel->getagencyrole();
$userData = $user_model->getUserDataById($id);
$user_role = $userData['emprole'];
foreach ($agencyroles as $agrole) {
if ($agrole['id'] == $user_role) {
$agencyuser = 'yes';
}
}
$data = array('isactive' => 0, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
$where = array('id=?' => $id);
$Id = $user_model->SaveorUpdateUserData($data, $where);
if ($agencyuser == 'yes') {
$agencyData = $user_model->getAgencyData($id);
$user_model->deleteAllagencydetails($agencyData['agencyid'], $loginUserId);
$emailids = $agencylistmodel->getAllHRManagementEMails();
$this->sendEMails($agencyData, 'inactivated');
}
if ($Id == 'update') {
$objidArr = $menumodel->getMenuObjID('/roles');
$objID = $objidArr[0]['id'];
$result = sapp_Global::logManager($objID, $actionflag, $loginUserId, $id);
$messages['message'] = 'User deleted successfully';
$messages['msgtype'] = 'success';
} else {
$messages['message'] = 'User cannot be deleted';
$messages['msgtype'] = 'error';
}
} else {
$messages['message'] = 'User cannot be deleted';
$messages['msgtype'] = 'error';
}
$this->_helper->json($messages);
}