本文整理汇总了PHP中Default_Model_Usermanagement类的典型用法代码示例。如果您正苦于以下问题:PHP Default_Model_Usermanagement类的具体用法?PHP Default_Model_Usermanagement怎么用?PHP Default_Model_Usermanagement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Default_Model_Usermanagement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save($requisitionform, $data)
{
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$loginUserId = $auth->getStorage()->read()->id;
$loginuserGroup = $auth->getStorage()->read()->group_id;
}
$requi_model = new Default_Model_Requisition();
$user_model = new Default_Model_Usermanagement();
$jobtitleModel = new Default_Model_Jobtitles();
$appr_mail = '';
$appr_per = '';
if ($requisitionform->isValid($this->_request->getPost())) {
$trDb = Zend_Db_Table::getDefaultAdapter();
// starting transaction
$trDb->beginTransaction();
try {
$id = (int) $this->_getParam('id', null);
$requisition_code = $this->_getParam('requisition_code', null);
$onboard_date = $this->_getParam('onboard_date', null);
$business_unit = $this->_getParam('business_unit', null);
$department = $this->_getParam('department', null);
$jobtitle = $this->_getParam('jobtitle', null);
$position_id = $this->_getParam('position_id', null);
$reporting_id = $this->_getParam('reporting_id', null);
$req_no_positions = $this->_getParam('req_no_positions', null);
$jobdescription = $this->_getParam('jobdescription', null);
$req_skills = $this->_getParam('req_skills', null);
$req_qualification = $this->_getParam('req_qualification', null);
$req_exp_years = $this->_getParam('req_exp_years', null);
$emp_type = $this->_getParam('emp_type', null);
$req_priority = $this->_getParam('req_priority', null);
$additional_info = $this->_getParam('additional_info', null);
$req_status = $this->_getParam('req_status', null);
$approver1 = $this->_getParam('approver1', null);
$approver2 = $this->_getParam('approver2', null);
$approver3 = $this->_getParam('approver3', null);
$aflag = $this->_getParam('aflag', null);
$edit_flag = $this->_getParam('edit_flag', null);
$edit_order = $this->_getParam('edit_order', null);
$aorder = $this->_getParam('aorder', null);
//1= approver1,2=approver2,3=approver3
if ($aflag != '' && $aflag == 'approver') {
if ($req_status == 3) {
$data = array('modifiedby' => trim($loginUserId), 'modifiedon' => gmdate("Y-m-d H:i:s"), 'appstatus' . $aorder => $req_status, 'req_status' => $req_status);
} else {
if ($aorder == 1) {
if ($approver2 != '') {
$data = array('appstatus1' => $req_status, 'appstatus2' => 'Initiated');
$appr_mail = $approver2;
$appr_per = $approver1;
} else {
$data = array('appstatus1' => $req_status, 'req_status' => $req_status);
$appr_mail = 'approved';
}
} else {
if ($aorder == 2) {
if ($approver3 != '') {
$data = array('appstatus2' => $req_status, 'appstatus3' => 'Initiated');
$appr_mail = $approver3;
$appr_per = $approver2;
} else {
$data = array('appstatus2' => $req_status, 'req_status' => $req_status);
$appr_mail = 'approved';
}
} else {
if ($aorder == 3) {
$data = array('appstatus3' => $req_status, 'req_status' => $req_status);
$appr_mail = 'approved';
}
}
}
$data['modifiedby'] = trim($loginUserId);
$data['modifiedon'] = gmdate("Y-m-d H:i:s");
}
} else {
$data = array('requisition_code' => trim($requisition_code), 'onboard_date' => sapp_Global::change_date(trim($onboard_date), 'database'), 'position_id' => trim($position_id), 'reporting_id' => trim($reporting_id), 'businessunit_id' => trim($business_unit), 'department_id' => trim($department), 'req_no_positions' => trim($req_no_positions), 'jobdescription' => trim($jobdescription), 'jobtitle' => trim($jobtitle), 'req_skills' => trim($req_skills), 'req_qualification' => trim($req_qualification), 'req_exp_years' => trim($req_exp_years), 'emp_type' => trim($emp_type), 'req_priority' => trim($req_priority), 'additional_info' => trim($additional_info), 'approver1' => $approver1, 'approver2' => $approver2 == '' ? null : $approver2, 'approver3' => $approver3 == '' ? null : $approver3, 'req_status' => 'Initiated', 'appstatus1' => 'Initiated', 'appstatus2' => null, 'appstatus3' => null, 'isactive' => 1, 'createdby' => trim($loginUserId), 'modifiedby' => trim($loginUserId), 'createdon' => gmdate("Y-m-d H:i:s"), 'modifiedon' => gmdate("Y-m-d H:i:s"));
if ($loginuserGroup == MANAGER_GROUP) {
$data['reporting_id'] = $loginUserId;
}
if ($edit_flag != '' && $edit_flag == 'yes') {
if ($edit_order == 1) {
$data = array('modifiedby' => trim($loginUserId), 'modifiedon' => gmdate("Y-m-d H:i:s"), 'approver2' => $approver2 == '' ? null : $approver2, 'approver3' => $approver3 == '' ? null : $approver3, 'appstatus2' => 'Initiated');
if ($approver2 == '') {
$data['appstatus2'] = null;
} else {
$appr_per = $edit_order;
$appr_mail = $approver2;
}
}
if ($edit_order == 2) {
$data = array('modifiedby' => trim($loginUserId), 'modifiedon' => gmdate("Y-m-d H:i:s"), 'approver3' => $approver3 == '' ? null : $approver3, 'appstatus3' => 'Initiated');
if ($approver3 == '') {
$data['appstatus3'] = null;
} else {
$appr_per = $edit_order;
$appr_mail = $approver3;
}
}
}
//.........这里部分代码省略.........
示例2: getactiveuserdataAction
public function getactiveuserdataAction()
{
$search_arr = array();
$search_arr['createddate'] = $this->_getParam('createddate', null);
$search_arr['u.emprole'] = $this->_getParam('emprole', null);
$search_arr['u.isactive'] = $this->_getParam('isactive', null);
$search_arr['logindatetime'] = $this->_getParam('logindatetime', null);
$page_no = $this->_getParam('page_no', 1);
$per_page = $this->_getParam('per_page', PERPAGE);
$sort_name = $this->_getParam('sort_name', null);
$sort_type = $this->_getParam('sort_type', null);
$cols_param_arr = $this->_getParam('cols_arr', array());
$user_model = new Default_Model_Usermanagement();
$user_data_org = $user_model->getdata_user_report($search_arr, $per_page, $page_no, $sort_name, $sort_type);
$page_cnt = $user_data_org['page_cnt'];
$user_data = $user_data_org['rows'];
$columns_arr = array('userfullname' => 'Name', 'rolename' => 'Role', 'emailaddress' => 'Email', 'employeeId' => 'ID', 'lastlog' => 'Last Login', 'isactive' => 'Status', 'createdate' => 'Created On');
if (count($cols_param_arr) == 0) {
$cols_param_arr = $columns_arr;
}
$this->view->user_data = $user_data;
$this->view->per_page = $per_page;
$this->view->page_no = $page_no;
$this->view->sort_name = $sort_name;
$this->view->sort_type = $sort_type;
$this->view->cols_param_arr = $cols_param_arr;
$this->view->page_cnt = $page_cnt;
$this->view->columns_arr = $columns_arr;
}
示例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: modeempOnchange
/**
* This function acts as a service for onchange of mode of employment to get candidates or referers.
* @param array $params_arr = array of parameters
* @return array Array of options.
*/
public function modeempOnchange($params_arr)
{
$result = array();
$status = 0;
$message = "Invalid mode of employment.";
if (isset($params_arr['role_id']) && $params_arr['role_id'] != '' && isset($params_arr['group_id']) && $params_arr['group_id'] != '' && isset($params_arr['modeofentry']) && $params_arr['modeofentry'] != '' && isset($params_arr['userid']) && $params_arr['userid'] != '') {
$role_id = $params_arr['role_id'];
$group_id = $params_arr['group_id'];
$userid = $params_arr['userid'];
$modeofentry = $params_arr['modeofentry'];
if ($role_id == SUPERADMINROLE || $group_id == MANAGEMENT_GROUP || $group_id == HR_GROUP) {
$privilege_flag = sapp_Global::_checkprivileges(EMPLOYEE, $group_id, $role_id, 'add');
if ($privilege_flag == 'Yes') {
if ($modeofentry == "Interview" || $modeofentry == 'Other') {
$candidate_model = new Default_Model_Candidatedetails();
$candidate_options = $candidate_model->getCandidatesNamesForUsers();
$candidate_str = sapp_Global::selectOptionBuilder("", "Select Candidate");
//echo "<pre>";print_r($candidate_options);echo "</pre>";
if (!empty($candidate_options)) {
$status = 1;
$message = "success";
foreach ($candidate_options as $id => $name) {
$candidate_str .= sapp_Global::selectOptionBuilder($id, $name);
}
} else {
$status = 0;
$message = "No selected candidates.";
}
$result['candidates'] = $candidate_str;
} else {
if ($modeofentry == "Reference") {
$user_model = new Default_Model_Usermanagement();
$referedby_options = $user_model->getRefferedByForUsers();
$refered_str = sapp_Global::selectOptionBuilder("", "Select Referred By");
//echo "<pre>";print_r($candidate_options);echo "</pre>";
if (!empty($referedby_options)) {
$status = 1;
$message = "success";
foreach ($referedby_options as $id => $name) {
$refered_str .= sapp_Global::selectOptionBuilder($id, $name);
}
} else {
$status = 0;
$message = "Employees are not added yet.";
}
$result['referred_by'] = $refered_str;
}
}
}
}
}
return array('status' => $status, 'message' => $message, 'result' => $result);
}
示例5: 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)) {
//.........这里部分代码省略.........
示例6: requisition_cvupload_emails
/**
* Send Emails
* @param type $RequisitionCode
* @param type $action
*/
public function requisition_cvupload_emails($requisition_id, $action, $candDetails)
{
$user_model = new Default_Model_Usermanagement();
$requi_model = new Default_Model_Requisition();
#$identity_code_model = new Default_Model_Identitycodes();
#$candiate_model = new Default_Model_Candidatedetails();
//Requisition Summary Data
$requisition_data = $requi_model->getrequisitiondetails($requisition_id);
if (isset($requisition_data)) {
$reqDetails = sprintf("%s-%s-%s (%s)", $requisition_data['businessunit_name'], $requisition_data['department_name'], $requisition_data['jobtitle_name'], $requisition_data['requisition_code']);
$RequisitionCode = $requisition_data["requisition_code"];
$requisition_recruiters_data = $requi_model->GetRequisitionRecruiterEmailaddress($RequisitionCode);
//HRExecutive Details
$hrexecutive_person_data = $user_model->getUserDataById($requisition_data["hrexecutive_id"]);
//Requester Details
$Raisedby_person_data = $user_model->getUserDataById($requisition_data["createdby"]);
//Reporting Manager Details
$Reportedto_person_data = $user_model->getUserDataById($requisition_data["reporting_id"]);
//HR Group
$mail_arr[0]['name'] = 'HR';
$mail_arr[0]['email'] = constant('REQ_HR_0');
$mail_arr[0]['type'] = 'CandidateCV';
//Requester
$mail_arr[1]['name'] = $Raisedby_person_data['userfullname'];
$mail_arr[1]['email'] = $Raisedby_person_data['emailaddress'];
$mail_arr[1]['type'] = 'CandidateCV';
//HR Executive
$mail_arr[2]['name'] = $hrexecutive_person_data['userfullname'];
$mail_arr[2]['email'] = $hrexecutive_person_data['emailaddress'];
$mail_arr[2]['type'] = 'CandidateCV';
//Reporting Manager
$mail_arr[3]['name'] = $Reportedto_person_data['userfullname'];
$mail_arr[3]['email'] = $Reportedto_person_data['emailaddress'];
$mail_arr[3]['type'] = 'CandidateCV';
//Management Group
$mail_arr[4]['name'] = 'Management';
$mail_arr[4]['email'] = constant('REQ_MGMT_0');
$mail_arr[4]['type'] = 'CandidateCV';
$emailCnt = 5;
foreach ($requisition_recruiters_data as $requisition_recruiters_data1) {
$mail_arr[$emailCnt]['name'] = $requisition_recruiters_data1['userfullname'];
$mail_arr[$emailCnt]['email'] = $requisition_recruiters_data1['emailaddress'];
$mail_arr[$emailCnt]['type'] = 'CandidateCV';
$emailCnt = $emailCnt + 1;
}
$appr_str = $hrexecutive_person_data['userfullname'];
$jobtitle_name = $requisition_data["jobtitle_name"];
for ($ii = 0; $ii < count($mail_arr); $ii++) {
$subjMsg = 'Uploaded CV modified for requisition.';
if ($action == "New") {
$subjMsg = 'New CV uploaded to requisition.';
}
if ($action == "Update") {
$subjMsg = 'Uploaded CV modified for requisition.';
}
$base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
$view = $this->getHelper('ViewRenderer')->view;
$this->view->emp_name = $mail_arr[$ii]['name'];
$this->view->subjMsg = $subjMsg;
$this->view->base_url = $base_url;
$this->view->type = $mail_arr[$ii]['type'];
$this->view->requisition_details = $reqDetails;
$this->view->candidate_details = $candDetails;
$text = $view->render('mailtemplates/requisition.phtml');
$options['subject'] = APPLICATION_NAME . ':' . $subjMsg;
$options['header'] = 'Requisition Status';
$options['toEmail'] = $mail_arr[$ii]['email'];
$options['toName'] = $mail_arr[$ii]['name'];
$options['message'] = $text;
$options['cron'] = 'yes';
if ($options['toEmail'] != '') {
sapp_Global::_sendEmail($options, "requisition", REQUISITIONMODULESENDEMAIL);
}
}
}
}
示例7: 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);
}
示例8: 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();
}
}
示例9: save
public function save($form, $data)
{
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$loginUserId = $auth->getStorage()->read()->id;
}
$cand_model = new Default_Model_Candidatedetails();
$requi_model = new Default_Model_Requisition();
$interview_model = new Default_Model_Interviewdetails();
$user_model = new Default_Model_Usermanagement();
$interview_round_model = new Default_Model_Interviewrounddetails();
$cand_status = $this->_getParam('cand_status', null);
$interview_status = $this->_getParam('interview_status', null);
$flag = 'true';
if ($interview_status == 'On hold' && $cand_status != 'On hold') {
$msgarray['statusErr'] = 'Since the interview status is onhold, the candidate status should be onhold.';
$flag = 'false';
}
if ($interview_status == 'Completed' && ($cand_status != 'Disqualified' && $cand_status != 'Shortlisted')) {
$msgarray['statusErr'] = 'Since interview status is completed, the candidate status can be either disqualified or shortlisted.';
$flag = 'false';
}
if ($interview_status == 'In process' && ($cand_status == 'Disqualified' || $cand_status == 'Shortlisted')) {
$msgarray['statusErr'] = 'Since the interview status is in process, the candidate cannot be shortlisted or disqualified.';
$flag = 'false';
}
if ($form->isValid($this->_request->getPost()) && $flag != 'false') {
$id = $this->_getParam('id', null);
$requisition_id = $this->_getParam('req_id', null);
$candidate_id = $this->_getParam('candidate_name', null);
$interviewer_id = $this->_getParam('interviewer_id', null);
$int_location = $this->_getParam('int_location', null);
$country = $this->_getParam('country', null);
$state = $this->_getParam('state', null);
$city = $this->_getParam('city', null);
$interview_mode = $this->_getParam('interview_mode', null);
$interview_time = $this->_getParam('interview_time', null);
$interview_date = $this->_getParam('interview_date', null);
$interview_round = $this->_getParam('interview_round', null);
if (!isset($candidate_id)) {
$candidate_id = $data['id'];
}
if (empty($data)) {
$getExistingCandidateRecord = $interview_model->getCandidateInInterviewProcess(trim($candidate_id));
if ($getExistingCandidateRecord > 0) {
$this->_helper->FlashMessenger()->setNamespace('success')->addMessage('Interview already scheduled for this candidate.');
$this->_redirect('/scheduleinterviews');
}
}
if (empty($data)) {
$idata = array('req_id' => $requisition_id, 'candidate_id' => trim($candidate_id), 'interview_status' => trim($interview_status), 'isactive' => 1, 'createdby' => trim($loginUserId), 'modifiedby' => trim($loginUserId), 'createddate' => gmdate("Y-m-d H:i:s"), 'modifieddate' => gmdate("Y-m-d H:i:s"));
$idata['interview_status'] = 'In process';
$iwhere = "";
$actionflag = 1;
$iresult = $interview_model->SaveorUpdateInterviewData($idata, $iwhere);
if ($id == '') {
$tableid = $iresult;
}
if ($iresult != '') {
$irdata = array('interview_id' => $iresult, 'req_id' => $requisition_id, 'candidate_id' => $candidate_id, 'interviewer_id' => $interviewer_id, 'interview_time' => sapp_Global::change_time(trim($interview_time), 'database'), 'interview_date' => sapp_Global::change_date($interview_date, 'database'), 'interview_mode' => $interview_mode, 'interview_round_number' => 1, 'interview_round' => trim($interview_round), 'int_location' => trim($int_location), 'int_country' => trim(intval($country)), 'int_state' => trim(intval($state)), 'int_city' => trim(intval($city)), 'isactive' => 1, 'createdby' => trim($loginUserId), 'modifiedby' => trim($loginUserId), 'createddate' => gmdate("Y-m-d H:i:s"), 'modifieddate' => gmdate("Y-m-d H:i:s"));
$ir_result = $interview_round_model->SaveorUpdateInterviewroundData($irdata, '');
$requisition_data = $requi_model->getRequisitionDataById($requisition_id);
$cand_data = $cand_model->getCandidateById($candidate_id);
$report_person_data = $user_model->getUserDataById($interviewer_id);
$mail_arr = array('HR' => defined('REQ_HR_' . $requisition_data['businessunit_id']) ? constant('REQ_HR_' . $requisition_data['businessunit_id']) : "", $report_person_data['userfullname'] => $report_person_data['emailaddress']);
foreach ($mail_arr as $ename => $email) {
$base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
$view = $this->getHelper('ViewRenderer')->view;
$this->view->emp_name = $ename;
$this->view->base_url = $base_url;
$this->view->candidate_name = $cand_data['candidate_name'];
$this->view->interview_type = $interview_mode;
$this->view->interview_location = $int_location;
$this->view->interview_date = $interview_date;
$this->view->interview_time = sapp_Global::change_time($interview_time, 'view');
$this->view->requisition_code = $requisition_data['requisition_code'];
$text = $view->render('mailtemplates/interviewrounds.phtml');
$options['subject'] = APPLICATION_NAME . ': Interview schedule';
$options['header'] = 'Interview schedule';
$options['toEmail'] = $email;
$options['toName'] = $ename;
$options['message'] = $text;
$options['cron'] = 'yes';
sapp_Global::_sendEmail($options);
}
$candData = array('cand_status' => 'Scheduled', 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s"));
$where = "id = " . $candidate_id;
$candResult = $cand_model->SaveorUpdateCandidateData($candData, $where);
}
} else {
$idata = array('interview_status' => trim($interview_status), 'isactive' => 1, 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s"));
$iwhere = "id = " . $id;
$tableid = $id;
$actionflag = 2;
$iresult = $interview_model->SaveorUpdateInterviewData($idata, $iwhere);
$candData = array('cand_status' => 'Scheduled', 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s"));
if ($cand_status && $cand_status != '0') {
$candData['cand_status'] = $cand_status;
}
$where = "id = " . $candidate_id;
//.........这里部分代码省略.........
示例10: hrexecutive_to_requisition_emails
/**
*
* @param array $data
* @param type $requisition_code
* @param type $hrExecutiveID
*/
public function hrexecutive_to_requisition_emails($data, $requisition_code, $hrExecutiveID)
{
$user_model = new Default_Model_Usermanagement();
$requi_model = new Default_Model_Requisition();
$identity_code_model = new Default_Model_Identitycodes();
//for requisition code
$identity_codes = $identity_code_model->getIdentitycodesRecord();
$irequistion_code = isset($identity_codes[0]) ? $identity_codes[0]['requisition_code'] : "";
if ($irequistion_code != '') {
$req_id = $requi_model->getMaxReqCode($irequistion_code . "/");
} else {
$req_id = '';
}
$data['requisition_code'] = $req_id;
//end of requisition code
$Raisedby_person_data = $user_model->getUserDataById($data['createdby']);
$business_unit = $data['businessunit_id'];
//HR Group
$mail_arr[0]['name'] = 'HR';
$mail_arr[0]['email'] = constant('REQ_HR_0');
$mail_arr[0]['type'] = 'HR';
//Management Group
$mail_arr[1]['name'] = 'Management';
$mail_arr[1]['email'] = constant('REQ_MGMT_0');
$mail_arr[1]['type'] = 'Management';
//Requester
$mail_arr[2]['name'] = $Raisedby_person_data['userfullname'];
$mail_arr[2]['email'] = $Raisedby_person_data['emailaddress'];
$mail_arr[2]['type'] = 'Raise';
$currEmailCount = 3;
foreach ($hrExecutiveID as $ipid) {
$hrexecutive_person_data = $user_model->getUserDataById($ipid);
$mail_arr[$currEmailCount]['name'] = $hrexecutive_person_data['userfullname'];
$mail_arr[$currEmailCount]['email'] = $hrexecutive_person_data['emailaddress'];
$mail_arr[$currEmailCount]['type'] = 'HRExecutive';
$currEmailCount = $currEmailCount + 1;
}
#$appr_str = $hrexecutive_person_data['userfullname'];
$appr_str = $Raisedby_person_data['userfullname'];
for ($ii = 0; $ii < count($mail_arr); $ii++) {
$base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
$view = $this->getHelper('ViewRenderer')->view;
$this->view->emp_name = $mail_arr[$ii]['name'];
$this->view->base_url = $base_url;
$this->view->type = $mail_arr[$ii]['type'];
$this->view->jobtitle = "";
//Job doesnt require for this emails
$this->view->requisition_code = $requisition_code;
$this->view->approver_str = $appr_str;
$this->view->raised_name = $Raisedby_person_data['userfullname'];
$text = $view->render('mailtemplates/requisition.phtml');
$options['subject'] = APPLICATION_NAME . ':' . $requisition_code . '-Recruiter allocated for requisition.';
$options['header'] = 'Requisition Status';
$options['toEmail'] = $mail_arr[$ii]['email'];
$options['toName'] = $mail_arr[$ii]['name'];
$options['message'] = $text;
//$options['cron'] = 'yes';
if ($options['toEmail'] != '') {
sapp_Global::_sendEmail($options, "requisition", REQUISITIONMODULESENDEMAIL);
}
}
}
示例11: save
public function save($form)
{
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$loginUserId = $auth->getStorage()->read()->id;
$loginuserGroup = $auth->getStorage()->read()->group_id;
}
$requi_model = new Default_Model_Requisition();
$round_model = new Default_Model_Interviewrounddetails();
$intrvwModel = new Default_Model_Interviewdetails();
$user_model = new Default_Model_Usermanagement();
$cand_model = new Default_Model_Candidatedetails();
$intrvwId = $this->getRequest()->getParam('unitId');
if ($form->isValid($this->_request->getPost())) {
$reqData = $intrvwModel->getReqByintrvwID($intrvwId);
if (!empty($reqData)) {
$reqId = $reqData['req_id'];
$candid = $reqData['candidate_id'];
$id = $this->getRequest()->getParam('id');
$interview_id = $intrvwId;
$interviewer_id = $this->getRequest()->getParam('interviewer_id');
$interview_round = $this->getRequest()->getParam('interview_round');
$interview_mode = $this->getRequest()->getParam('interview_mode');
$int_location = $this->getRequest()->getParam('int_location');
$interview_time = $this->getRequest()->getParam('interview_time');
$interview_date = $this->getRequest()->getParam('interview_date');
$interview_feedback = $this->getRequest()->getParam('interview_feedback');
$interview_comments = $this->getRequest()->getParam('interview_comments');
$round_status = $this->getRequest()->getParam('round_status', null);
$hid_round_status = $this->getRequest()->getParam('hid_round_status', null);
$data = array('candidate_id' => $candid, 'req_id' => $reqId, 'interview_id' => trim($intrvwId), 'interviewer_id' => trim($interviewer_id), 'interview_mode' => trim($interview_mode), 'int_location' => trim($int_location), 'int_country' => trim($this->_getParam('country', null)), 'int_state' => trim($this->_getParam('state', null)), 'int_city' => trim($this->_getParam('city', null)), 'interview_time' => sapp_Global::change_time(trim($interview_time), 'database'), 'interview_date' => sapp_Global::change_date(trim($interview_date), 'database'), 'interview_round' => trim($interview_round), 'interview_feedback' => trim($interview_feedback), 'interview_comments' => trim($interview_comments), 'round_status' => trim($round_status), 'isactive' => 1, 'createdby' => trim($loginUserId), 'modifiedby' => trim($loginUserId), 'createddate' => gmdate("Y-m-d H:i:s"), 'modifieddate' => gmdate("Y-m-d H:i:s"));
$roundnumberData = $intrvwModel->getinterviewroundnumber($interview_id);
$roundnumber = $roundnumberData['interview_round_number'];
$data['interview_round_number'] = $roundnumber + 1;
$where = "";
$actionflag = 1;
if ($id != '') {
unset($data['createdby']);
unset($data['createdon']);
unset($data['isactive']);
unset($data['interview_round_number']);
$where = array("id = " . $id);
$tableid = $id;
$actionflag = 2;
if ($hid_round_status != '') {
$data = array();
$data['round_status'] = trim($round_status);
}
}
if ($loginuserGroup == MANAGER_GROUP || $loginuserGroup == SYSTEMADMIN_GROUP || $loginuserGroup == EMPLOYEE_GROUP || ($loginuserGroup == HR_GROUP || $loginuserGroup == MANAGEMENT_GROUP) && $interviewer_id == $loginUserId) {
unset($data['interviewer_id']);
unset($data['interview_mode']);
unset($data['int_location']);
unset($data['int_country']);
unset($data['int_state']);
unset($data['int_city']);
unset($data['interview_time']);
unset($data['interview_date']);
unset($data['interview_round']);
}
$result = $round_model->SaveorUpdateInterviewroundData($data, $where);
if ($id == '') {
//start of mailing
$requisition_data = $requi_model->getRequisitionDataById($reqId);
$cand_data = $cand_model->getCandidateById($candid);
$report_person_data = $user_model->getUserDataById($interviewer_id);
$mail_arr = array('HR' => defined('REQ_HR_' . $requisition_data['businessunit_id']) ? constant('REQ_HR_' . $requisition_data['businessunit_id']) : "", $report_person_data['userfullname'] => $report_person_data['emailaddress']);
foreach ($mail_arr as $ename => $email) {
$base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
$view = $this->getHelper('ViewRenderer')->view;
$this->view->emp_name = $ename;
$this->view->base_url = $base_url;
$this->view->candidate_name = $cand_data['candidate_name'];
$this->view->interview_type = $interview_mode;
$this->view->interview_location = $int_location;
$this->view->interview_date = $interview_date;
$this->view->interview_time = sapp_Global::change_time($interview_time, 'view');
$this->view->requisition_code = $requisition_data['requisition_code'];
$text = $view->render('mailtemplates/interviewrounds.phtml');
$options['subject'] = APPLICATION_NAME . ': Interview schedule';
$options['header'] = 'Interview schedule';
$options['toEmail'] = $email;
$options['toName'] = $ename;
$options['message'] = $text;
$options['cron'] = 'yes';
sapp_Global::_sendEmail($options);
}
//end of mailing
$tableid = $result;
$this->view->eventact = 'scheduled';
} else {
if ($loginuserGroup == MANAGER_GROUP || $loginuserGroup == SYSTEMADMIN_GROUP || $loginuserGroup == EMPLOYEE_GROUP || $loginuserGroup == MANAGEMENT_GROUP) {
$requisition_data = $requi_model->getRequisitionDataById($reqId);
$cand_data = $cand_model->getCandidateById($candid);
$round_data = $round_model->getSingleRoundData($id);
$report_person_data = $user_model->getUserDataById($loginUserId);
$mail_arr = array('HR' => defined('REQ_HR_' . $requisition_data['businessunit_id']) ? constant('REQ_HR_' . $requisition_data['businessunit_id']) : "", $report_person_data['userfullname'] => $report_person_data['emailaddress']);
foreach ($mail_arr as $ename => $email) {
$base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
$view = $this->getHelper('ViewRenderer')->view;
//.........这里部分代码省略.........
示例12: save
public function save($form)
{
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$loginUserId = $auth->getStorage()->read()->id;
$loginuserGroup = $auth->getStorage()->read()->group_id;
}
$candidatesmodel = new Default_Model_Shortlistedcandidates();
$cand_model = new Default_Model_Candidatedetails();
$requimodel = new Default_Model_Requisition();
$user_model = new Default_Model_Usermanagement();
if ($form->isValid($this->_request->getPost())) {
$id = $this->getRequest()->getParam('id');
$status = $this->getRequest()->getParam('selectionstatus');
$txtReason = $this->getRequest()->getParam('txtReason');
$txtJoiningDate = $this->getRequest()->getParam('txtJoiningDate');
$candidateData = $candidatesmodel->getcandidateData($id);
$req_id = $candidateData['requisition_id'];
$selsctionopt = array('0' => 'Select status', '1' => 'Selected', '2' => 'Rejected', '3' => 'Offered', '4' => 'Offer Accepted', '5' => 'Joined', '6' => 'On Hold', '7' => 'Offer Declined', '8' => 'Yet to offer');
//validation
if ($status == "4" && $txtJoiningDate == "") {
$this->_helper->getHelper("FlashMessenger")->addMessage(array("failure" => "Joining Date required."));
$messages = $form->getMessages();
foreach ($messages as $key => $val) {
foreach ($val as $key2 => $val2) {
$msgarray[$key] = $val2;
break;
}
}
return $msgarray;
} else {
if (($status == "7" || $status == "2" || $status == "6" || $status == "8") && $txtReason == "") {
$this->_helper->getHelper("FlashMessenger")->addMessage(array("failure" => "Comments required."));
$messages = $form->getMessages();
foreach ($messages as $key => $val) {
foreach ($val as $key2 => $val2) {
$msgarray[$key] = $val2;
break;
}
}
return $msgarray;
} else {
if ($txtReason == '' && $txtJoiningDate == '') {
$data = array('cand_status' => $selsctionopt[$status], 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s"));
} else {
if ($txtReason == '' && $txtJoiningDate != '') {
$data = array('cand_status' => $selsctionopt[$status], 'joiningdate' => sapp_Global::change_date(trim($txtJoiningDate), 'database'), 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s"));
} else {
if ($txtReason != '' && $txtJoiningDate == '') {
$data = array('cand_status' => $selsctionopt[$status], 'comments' => $txtReason, 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s"));
} else {
$data = array('cand_status' => $selsctionopt[$status], 'comments' => $txtReason, 'joiningdate' => sapp_Global::change_date(trim($txtJoiningDate), 'database'), 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s"));
}
}
}
$where = "id = " . $id;
$result = $candidatesmodel->SaveorUpdateCandidateDetails($data, $where);
//if (($status == '1' || $status == 'Selected' ) && ($result != '')) {
//increment selected members count
$requimodel->incrementselected_members($req_id);
//start of mailing
$cand_data = $cand_model->getCandidateById($id);
$requisition_data = $requimodel->getRequisitionDataById($req_id);
$requisition_data_view = $requimodel->getReqDataForView($req_id);
$report_person_data = $user_model->getUserDataById($requisition_data['reporting_id']);
$requester_person_data = $user_model->getUserDataById($requisition_data['createdby']);
/* $mail_arr = array(
'HR' => defined('REQ_HR_' . $requisition_data['businessunit_id']) ? constant('REQ_HR_' . $requisition_data['businessunit_id']) : "",
'Management' => defined("REQ_MGMT_" . $requisition_data['businessunit_id']) ? constant("REQ_MGMT_" . $requisition_data['businessunit_id']) : "",
$report_person_data['userfullname'] => $report_person_data['emailaddress']
);
$cstat_arr = array(
'0' => 'Select status',
'1' => 'Selected',
'2' => 'Rejected'
); */
//HR Group
$mail_arr[0]['name'] = 'HR';
$mail_arr[0]['email'] = constant('REQ_HR_0');
$mail_arr[0]['type'] = 'CandidateFinalChange';
//Requester
$mail_arr[1]['name'] = $requester_person_data['userfullname'];
$mail_arr[1]['email'] = $requester_person_data['emailaddress'];
$mail_arr[1]['type'] = 'CandidateFinalChange';
//Management Group
$mail_arr[2]['name'] = 'Management';
$mail_arr[2]['email'] = constant('REQ_MGMT_0');
$mail_arr[2]['type'] = 'CandidateFinalChange';
//Reporting Manager
$mail_arr[3]['name'] = $report_person_data['userfullname'];
$mail_arr[3]['email'] = $report_person_data['emailaddress'];
$mail_arr[3]['type'] = 'CandidateFinalChange';
for ($ii = 0; $ii < count($mail_arr); $ii++) {
$base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
$view = $this->getHelper('ViewRenderer')->view;
$this->view->emp_name = $mail_arr[$ii]['name'];
$this->view->type = $mail_arr[$ii]['type'];
$this->view->base_url = $base_url;
$this->view->requisition_data = $requisition_data_view[0];
$this->view->candidate_details = $cand_data;
//.........这里部分代码省略.........
示例13: save
public function save($form)
{
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$loginUserId = $auth->getStorage()->read()->id;
$loginuserGroup = $auth->getStorage()->read()->group_id;
}
$candidatesmodel = new Default_Model_Shortlistedcandidates();
$cand_model = new Default_Model_Candidatedetails();
$requimodel = new Default_Model_Requisition();
$user_model = new Default_Model_Usermanagement();
if ($form->isValid($this->_request->getPost())) {
$id = $this->getRequest()->getParam('id');
$status = $this->getRequest()->getParam('selectionstatus');
$candidateData = $candidatesmodel->getcandidateData($id);
$req_id = $candidateData['requisition_id'];
$data = array('cand_status' => trim($status), 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s"));
$where = "id = " . $id;
$result = $candidatesmodel->SaveorUpdateCandidateDetails($data, $where);
if (($status == '2' || $status == 'Selected') && $result != '') {
//increment selected members count
$requimodel->incrementselected_members($req_id);
//start of mailing
$cand_data = $cand_model->getCandidateById($id);
$requisition_data = $requimodel->getRequisitionDataById($req_id);
$report_person_data = $user_model->getUserDataById($requisition_data['reporting_id']);
$mail_arr = array('HR' => defined('REQ_HR_' . $requisition_data['businessunit_id']) ? constant('REQ_HR_' . $requisition_data['businessunit_id']) : "", 'Management' => defined("REQ_MGMT_" . $requisition_data['businessunit_id']) ? constant("REQ_MGMT_" . $requisition_data['businessunit_id']) : "", $report_person_data['userfullname'] => $report_person_data['emailaddress']);
$cstat_arr = array('0' => 'Select status', '2' => 'Selected', '3' => 'Rejected');
foreach ($mail_arr as $ename => $email) {
$base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl();
$view = $this->getHelper('ViewRenderer')->view;
$this->view->emp_name = $ename;
$this->view->base_url = $base_url;
$this->view->requisition_code = $requisition_data['requisition_code'];
$this->view->candidate_name = $cand_data['candidate_name'];
$this->view->status = $cstat_arr[$status];
$text = $view->render('mailtemplates/selectedcandidates.phtml');
$options['subject'] = APPLICATION_NAME . ': Candidate ' . $cstat_arr[$status];
$options['header'] = 'Candidate ' . $cstat_arr[$status];
$options['toEmail'] = $email;
$options['toName'] = $ename;
$options['message'] = $text;
$options['cron'] = 'yes';
sapp_Global::_sendEmail($options);
}
//end of mailing
}
$actionflag = 2;
$tableid = $id;
$menumodel = new Default_Model_Menu();
$objidArr = $menumodel->getMenuObjID('/shortlistedcandidates');
$objID = $objidArr[0]['id'];
$result = sapp_Global::logManager($objID, $actionflag, $loginUserId, $tableid);
$this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Request updated successfully."));
$this->_redirect('/shortlistedcandidates');
} else {
$messages = $form->getMessages();
foreach ($messages as $key => $val) {
foreach ($val as $key2 => $val2) {
$msgarray[$key] = $val2;
break;
}
}
return $msgarray;
}
}
示例14: 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;
}
$id = $this->_request->getParam('objid');
$messages['message'] = '';
$actionflag = 3;
if ($id) {
$roles_model = new Default_Model_Roles();
$user_model = new Default_Model_Usermanagement();
$user_cnt = $user_model->getUserCntByRole($id);
if ($user_cnt == 0) {
$previleges_model = new Default_Model_Privileges();
$menumodel = new Default_Model_Menu();
$data = array('isactive' => 0, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
$where = array('id=?' => $id);
$Id = $roles_model->SaveorUpdateRolesData($data, $where);
if ($Id == 'update') {
sapp_Global::generateAccessControl();
$prev_data = array('isactive' => 0, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"));
$where_prev = "role = " . $id;
$previleges_model->SaveorUpdatePrivilegesData($prev_data, $where_prev);
$objidArr = $menumodel->getMenuObjID('/roles');
$objID = $objidArr[0]['id'];
$result = sapp_Global::logManager($objID, $actionflag, $loginUserId, $id);
$messages['message'] = 'Role deleted successfully';
$messages['msgtype'] = 'success';
} else {
$messages['message'] = 'Role cannot be deleted as Employees with the role exist.';
$messages['msgtype'] = 'error';
}
} else {
$messages['message'] = 'Role cannot be deleted as Employees with the role exist.';
$messages['msgtype'] = 'error';
}
} else {
$messages['message'] = 'Role cannot be deleted as Employees with the role exist.';
$messages['msgtype'] = 'error';
}
$this->_helper->json($messages);
}
示例15: addorgheadAction
public function addorgheadAction()
{
Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/");
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$loginUserId = $auth->getStorage()->read()->id;
$loginuserRole = $auth->getStorage()->read()->emprole;
$loginuserGroup = $auth->getStorage()->read()->group_id;
}
$org_id = $this->_request->getParam('orgid', null);
$msgarray = array();
$prevorgheadId = '';
$posted_prevorghead_rm = '';
try {
$user_model = new Default_Model_Usermanagement();
$orgInfoModel = new Default_Model_Organisationinfo();
$countriesModel = new Default_Model_Countries();
$statesmodel = new Default_Model_States();
$citiesmodel = new Default_Model_Cities();
$role_model = new Default_Model_Roles();
$prefixModel = new Default_Model_Prefix();
$identity_code_model = new Default_Model_Identitycodes();
$jobtitlesModel = new Default_Model_Jobtitles();
$employeeModal = new Default_Model_Employee();
$positionsmodel = new Default_Model_Positions();
$form = new Default_Form_Organisationhead();
$form->setAttrib('action', BASE_URL . 'organisationinfo/addorghead/orgid/' . $org_id);
$identity_codes = $identity_code_model->getIdentitycodesRecord();
$role_data = $role_model->getRolesList_orginfo();
$flag = 'true';
$emp_identity_code = isset($identity_codes[0]) ? $identity_codes[0]['employee_code'] : "";
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 = '';
$msgarray['employeeId'] = 'Identity codes are not configured yet.';
$flag = 'false';
}
$form->employeeId->setValue($emp_id);
$form->emprole->addMultiOptions(array('' => 'Select Role') + $role_data);
if (empty($role_data)) {
$msgarray['emprole'] = 'Roles are not added yet.';
$flag = 'false';
}
$prefixData = $prefixModel->getPrefixList();
$form->prefix_id->addMultiOption('', 'Select Prefix');
if (!empty($prefixData)) {
foreach ($prefixData as $prefixres) {
$form->prefix_id->addMultiOption($prefixres['id'], $prefixres['prefix']);
}
} else {
$msgarray['prefix_id'] = 'Prefixes are not configured yet.';
}
$jobtitleData = $jobtitlesModel->getJobTitleList();
if (!empty($jobtitleData)) {
foreach ($jobtitleData as $jobtitleres) {
$form->jobtitle_id->addMultiOption($jobtitleres['id'], $jobtitleres['jobtitlename']);
}
} else {
$msgarray['jobtitle_id'] = 'Job titles are not configured yet.';
$msgarray['position_id'] = 'Positions are not configured yet.';
}
$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;
//.........这里部分代码省略.........