$filter_data['selected_group_options'] = Misc::arrayIntersectByKey((array) $filter_data['group_ids'], $group_options); //Get branches $blf = new BranchListFactory(); $blf->getByCompanyId($current_company->getId()); $branch_options = Misc::prependArray($all_array_option, $blf->getArrayByListFactory($blf, FALSE, TRUE)); $filter_data['src_branch_options'] = Misc::arrayDiffByKey((array) $filter_data['branch_ids'], $branch_options); $filter_data['selected_branch_options'] = Misc::arrayIntersectByKey((array) $filter_data['branch_ids'], $branch_options); //Get departments $dlf = new DepartmentListFactory(); $dlf->getByCompanyId($current_company->getId()); $department_options = Misc::prependArray($all_array_option, $dlf->getArrayByListFactory($dlf, FALSE, TRUE)); $filter_data['src_department_options'] = Misc::arrayDiffByKey((array) $filter_data['department_ids'], $department_options); $filter_data['selected_department_options'] = Misc::arrayIntersectByKey((array) $filter_data['department_ids'], $department_options); //Get employee titles $utlf = new UserTitleListFactory(); $utlf->getByCompanyId($current_company->getId()); $user_title_options = Misc::prependArray($all_array_option, $utlf->getArrayByListFactory($utlf, FALSE, TRUE)); $filter_data['src_user_title_options'] = Misc::arrayDiffByKey((array) $filter_data['user_title_ids'], $user_title_options); $filter_data['selected_user_title_options'] = Misc::arrayIntersectByKey((array) $filter_data['user_title_ids'], $user_title_options); //Deduction PSEA accounts $psealf = new PayStubEntryAccountListFactory(); $filter_data['deduction_pay_stub_entry_account_options'] = $psealf->getByCompanyIdAndStatusIdAndTypeIdArray($current_company->getId(), 10, array(20, 30, 40), TRUE); $filter_data['earning_pay_stub_entry_account_options'] = $psealf->getByCompanyIdAndStatusIdAndTypeIdArray($current_company->getId(), 10, array(10, 40), TRUE); $filter_data['income_pay_stub_entry_account_options'] = $psealf->getByCompanyIdAndStatusIdAndTypeIdArray($current_company->getId(), 10, array(10, 30, 40), TRUE); //Get employee list //$filter_data['user_options'] = UserListFactory::getByCompanyIdArray( $current_company->getId(), FALSE ); //Quarters $filter_data['year_options'] = $year_options; $setup_data['state_options'] = $state_options; $saved_report_options = $ugdlf->getByUserIdAndScriptArray($current_user->getId(), $_SERVER['SCRIPT_NAME']); $generic_data['saved_report_options'] = $saved_report_options;
if ($dlf->getRecordCount() > 0) { foreach ($dlf as $d_obj) { $department_options[$d_obj->getId()] = $d_obj->getName(); $department_manual_id_options[$d_obj->getId()] = $d_obj->getManualId(); } } //$department_options = (array)$dlf->getArrayByListFactory( $dlf, FALSE, TRUE ); unset($dlf, $d_obj); //Get groups $uglf = new UserGroupListFactory(); $uglf->getByCompanyId($mapped_row['company_id']); $group_options = (array) $uglf->getArrayByListFactory($uglf, FALSE, TRUE); unset($uglf); //Get job titles $utlf = new UserTitleListFactory(); $utlf->getByCompanyId($mapped_row['company_id']); $title_options = (array) $utlf->getArrayByListFactory($utlf, FALSE, TRUE); unset($utlf); $uf->setCompany(Misc::importCallInputParseFunction('company_id', $mapped_row['company_id'], $filtered_import_map['company_id']['default_value'], $filtered_import_map['company_id']['parse_hint'])); } if (isset($mapped_row['status_id']) and $mapped_row['status_id'] != '') { $uf->setStatus(Misc::importCallInputParseFunction('status_id', $mapped_row['status_id'], $filtered_import_map['status_id']['default_value'], $filtered_import_map['status_id']['parse_hint'])); } if (isset($mapped_row['currency_id']) and $mapped_row['currency_id'] != '') { $uf->setCurrency(Misc::importCallInputParseFunction('currency_id', $mapped_row['currency_id'], $filtered_import_map['currency_id']['default_value'], $filtered_import_map['currency_id']['parse_hint'])); } if (isset($mapped_row['employee_number']) and $mapped_row['employee_number'] != '') { $uf->setEmployeeNumber(Misc::importCallInputParseFunction('employee_number', $mapped_row['employee_number'], $filtered_import_map['employee_number']['default_value'], $filtered_import_map['employee_number']['parse_hint'])); } else { $ulf = new UserListFactory(); $ulf->getHighestEmployeeNumberByCompanyId($mapped_row['company_id']);
} else { $delete = FALSE; } $utlf = new UserTitleListFactory(); foreach ($ids as $id) { $utlf->GetByIdAndCompanyId($id, $current_company->getId()); foreach ($utlf as $title_obj) { $title_obj->setDeleted($delete); $title_obj->Save(); } } Redirect::Page(URLBuilder::getURL(NULL, 'UserTitleList.php')); break; default: $sort_array = NULL; if ($sort_column != '') { $sort_array = array(Misc::trimSortPrefix($sort_column) => $sort_order); } $utlf = new UserTitleListFactory(); $utlf->getByCompanyId($current_company->getId(), $current_user_prefs->getItemsPerPage(), $page, NULL, $sort_array); $pager = new Pager($utlf); foreach ($utlf as $title_obj) { $titles[] = array('id' => $title_obj->GetId(), 'name' => $title_obj->getName(), 'deleted' => $title_obj->getDeleted()); } $smarty->assign_by_ref('titles', $titles); $smarty->assign_by_ref('sort_column', $sort_column); $smarty->assign_by_ref('sort_order', $sort_order); $smarty->assign_by_ref('paging_data', $pager->getPageVariables()); break; } $smarty->display('users/UserTitleList.tpl');
function getByCompanyIdArray($company_id) { $utlf = new UserTitleListFactory(); $utlf->getByCompanyId($company_id); $title_list[0] = '--'; foreach ($utlf as $title_obj) { $title_list[$title_obj->getID()] = $title_obj->getName(); } return $title_list; }