$filter_data['selected_user_title_options'] = Misc::arrayIntersectByKey((array) $filter_data['user_title_ids'], $user_title_options); if ($current_company->getProductEdition() == 20) { $jlf = new JobListFactory(); //Get include job list. $jlf->getByCompanyId($current_company->getId()); $job_options = Misc::prependArray(array('0' => TTi18n::gettext('- No Job -')), $jlf->getArrayByListFactory($jlf, FALSE, TRUE)); $filter_data['job_manual_id_options'] = $jlf->getManualIDArrayByListFactory($jlf, TRUE); $filter_data['src_include_job_options'] = Misc::arrayDiffByKey((array) $filter_data['include_job_ids'], $job_options); $filter_data['selected_include_job_options'] = Misc::arrayIntersectByKey((array) $filter_data['include_job_ids'], $job_options); //Get exclude job list $exclude_job_options = Misc::prependArray($all_array_option, $jlf->getArrayByListFactory($jlf, FALSE, TRUE)); $filter_data['src_exclude_job_options'] = Misc::arrayDiffByKey((array) $filter_data['exclude_job_ids'], $job_options); $filter_data['selected_exclude_job_options'] = Misc::arrayIntersectByKey((array) $filter_data['exclude_job_ids'], $job_options); //Get Job Groups $jglf = new JobGroupListFactory(); $nodes = FastTree::FormatArray($jglf->getByCompanyIdArray($current_company->getId()), 'TEXT', TRUE); $job_group_options = Misc::prependArray($all_array_option, $jglf->getArrayByNodes($nodes, FALSE, TRUE)); $filter_data['src_job_group_options'] = Misc::arrayDiffByKey((array) $filter_data['job_group_ids'], $job_group_options); $filter_data['selected_job_group_options'] = Misc::arrayIntersectByKey((array) $filter_data['job_group_ids'], $job_group_options); //Get Job Items $jilf = new JobItemListFactory(); $jilf->getByCompanyId($current_company->getId()); $job_item_options = Misc::prependArray(array('-1' => TTi18n::gettext('-- All --'), '0' => TTi18n::gettext('- No Task -')), $jilf->getArrayByListFactory($jilf, FALSE, TRUE)); $filter_data['src_job_item_options'] = Misc::arrayDiffByKey((array) $filter_data['job_item_ids'], $job_item_options); $filter_data['selected_job_item_options'] = Misc::arrayIntersectByKey((array) $filter_data['job_item_ids'], $job_item_options); } //Get column list $filter_data['src_column_options'] = Misc::arrayDiffByKey((array) $filter_data['column_ids'], $columns); $filter_data['selected_column_options'] = Misc::arrayIntersectByKey((array) $filter_data['column_ids'], $columns); //$filter_data['refresh_options'] = array( 0 => TTi18n::gettext('- Disabled -'), 60 => TTi18n::gettext('1 minute'), 300 => TTi18n::gettext('5 minutes'), 600 => TTi18n::gettext('10 minutes'), 1800 => TTi18n::gettext('30 minutes'), 3600 => TTi18n::gettext('60 minutes') ); //Get primary/secondary order list
//Get include employee list. $ulf->getSearchByCompanyIdAndArrayCriteria($current_company->getId(), array('permission_children_ids' => $permission_children_ids)); $user_options = $ulf->getArrayByListFactory($ulf, FALSE, TRUE); $filter_data['src_include_user_options'] = Misc::arrayDiffByKey((array) $filter_data['include_user_ids'], $user_options); $filter_data['selected_include_user_options'] = Misc::arrayIntersectByKey((array) $filter_data['include_user_ids'], $user_options); //Get exclude employee list $exclude_user_options = Misc::prependArray($all_array_option, $ulf->getArrayByListFactory($ulf, FALSE, TRUE)); $filter_data['src_exclude_user_options'] = Misc::arrayDiffByKey((array) $filter_data['exclude_user_ids'], $user_options); $filter_data['selected_exclude_user_options'] = Misc::arrayIntersectByKey((array) $filter_data['exclude_user_ids'], $user_options); //Get employee status list. $user_status_options = Misc::prependArray($all_array_option, $ulf->getOptions('status')); $filter_data['src_user_status_options'] = Misc::arrayDiffByKey((array) $filter_data['user_status_ids'], $user_status_options); $filter_data['selected_user_status_options'] = Misc::arrayIntersectByKey((array) $filter_data['user_status_ids'], $user_status_options); //Get Employee Groups $uglf = TTnew('UserGroupListFactory'); $group_options = Misc::prependArray($all_array_option, $uglf->getArrayByNodes(FastTree::FormatArray($uglf->getByCompanyIdArray($current_company->getId()), 'TEXT', TRUE))); $filter_data['src_group_options'] = Misc::arrayDiffByKey((array) $filter_data['group_ids'], $group_options); $filter_data['selected_group_options'] = Misc::arrayIntersectByKey((array) $filter_data['group_ids'], $group_options); //Get branches $blf = TTnew('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); $filter_data['src_punch_branch_options'] = Misc::arrayDiffByKey((array) $filter_data['punch_branch_ids'], $branch_options); $filter_data['selected_punch_branch_options'] = Misc::arrayIntersectByKey((array) $filter_data['punch_branch_ids'], $branch_options); //Get departments $dlf = TTnew('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);
Redirect::Page(URLBuilder::getURL(NULL, 'EditUserGroup.php', FALSE)); break; case 'delete' or 'undelete': if (strtolower($action) == 'delete') { $delete = TRUE; } else { $delete = FALSE; } $uglf = TTnew('UserGroupListFactory'); foreach ($ids as $id) { $uglf->getById($id); foreach ($uglf as $obj) { $obj->setDeleted($delete); $obj->Save(); } } Redirect::Page(URLBuilder::getURL(NULL, 'UserGroupList.php')); break; default: $uglf = TTnew('UserGroupListFactory'); $nodes = FastTree::FormatArray($uglf->getByCompanyIdArray($current_company->getId()), 'HTML'); //For some reason smarty prints out a blank row if nodes is false. if ($nodes !== FALSE) { $smarty->assign_by_ref('rows', $nodes); } $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/UserGroupList.tpl');
$filter_data['permission_children_ids'][] = $current_user->getId(); } } $rsclf->getSearchByCompanyIdAndArrayCriteria($current_company->getId(), $filter_data, $current_user_prefs->getItemsPerPage(), $page, NULL, $sort_array); $pager = new Pager($rsclf); $utlf = new UserTitleListFactory(); $utlf->getByCompanyId($current_company->getId()); $title_options = $utlf->getArrayByListFactory($utlf, FALSE, TRUE); $blf = new BranchListFactory(); $blf->getByCompanyId($current_company->getId()); $branch_options = $blf->getArrayByListFactory($blf, FALSE, TRUE); $dlf = new DepartmentListFactory(); $dlf->getByCompanyId($current_company->getId()); $department_options = $dlf->getArrayByListFactory($dlf, FALSE, TRUE); $uglf = new UserGroupListFactory(); $group_options = $uglf->getArrayByNodes(FastTree::FormatArray($uglf->getByCompanyIdArray($current_company->getId()), 'TEXT', TRUE)); $rstclf = new RecurringScheduleTemplateControlListFactory(); $template_options = $rstclf->getByCompanyIdArray($current_company->getId(), FALSE, TRUE); foreach ($rsclf as $rsc_obj) { $user_id = $rsc_obj->getColumn('user_id'); $ulf = new UserListFactory(); $ulf->getByID($user_id); if ($ulf->getRecordCount() == 1) { $u_obj = $ulf->getCurrent(); } else { //Skip this row. Debug::Text('Skipping Row: User ID: ' . $user_id, __FILE__, __LINE__, __METHOD__, 10); continue; } $rows[] = array('id' => $rsc_obj->getId(), 'user_id' => $user_id, 'name' => $rsc_obj->getColumn('name'), 'description' => $rsc_obj->getColumn('description'), 'start_week' => $rsc_obj->getStartWeek(), 'start_date' => $rsc_obj->getStartDate(), 'end_date' => $rsc_obj->getEndDate(), 'first_name' => $u_obj->getFirstName(), 'middle_name' => $u_obj->getMiddleName(), 'last_name' => $u_obj->getLastName(), 'user_full_name' => $u_obj->getFullName(TRUE), 'is_owner' => $permission->isOwner($u_obj->getCreatedBy(), $u_obj->getId()), 'is_child' => $permission->isChild($u_obj->getId(), $permission_children_ids), 'deleted' => $rsc_obj->getDeleted()); }
* $Date: 2008-01-24 14:33:21 -0800 (Thu, 24 Jan 2008) $ */ require_once '../../includes/global.inc.php'; require_once Environment::getBasePath() . 'includes/Interface.inc.php'; //Debug::setVerbosity( 11 ); if (!$permission->Check('hierarchy', 'enabled') or !($permission->Check('hierarchy', 'edit') or $permission->Check('hierarchy', 'edit_own'))) { $permission->Redirect(FALSE); //Redirect } $smarty->assign('title', TTi18n::gettext($title = 'Edit Hierarchy')); // See index.php /* * Get FORM variables */ extract(FormVariables::GetVariables(array('action', 'hierarchy_id', 'id', 'old_id', 'user_data'))); $ft = new FastTree($fast_tree_options); $ft->setTree($hierarchy_id); $hf = new HierarchyFactory(); $redirect = 0; $action = Misc::findSubmitButton(); switch ($action) { case 'submit': //Debug::setVerbosity( 11 ); Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10); if (isset($user_data['user_id'])) { foreach ($user_data['user_id'] as $user_id) { if (isset($id) and $id != '') { $hf->setId($id); } $hf->setHierarchyControl($hierarchy_id); $hf->setPreviousUser($old_id);
$ugf->setParent($data['parent_id']); $ugf->setName($data['name']); if ($ugf->isValid()) { $ugf->Save(); Redirect::Page(URLBuilder::getURL(NULL, 'UserGroupList.php')); break; } default: $uglf = TTnew('UserGroupListFactory'); $nodes = FastTree::FormatArray($uglf->getByCompanyIdArray($current_company->getId()), 'TEXT', TRUE); foreach ($nodes as $node) { $parent_list_options[$node['id']] = $node['text']; } $smarty->assign_by_ref('parent_list_options', $parent_list_options); if (isset($id)) { BreadCrumb::setCrumb($title); //Get parent data $ft = new FastTree($fast_tree_user_group_options); $ft->setTree($current_company->getID()); //$uwlf->GetByUserIdAndCompanyId($current_user->getId(), $current_company->getId() ); $uglf->getById($id); foreach ($uglf as $group_obj) { $parent_id = $ft->getParentID($group_obj->getId()); $data = array('id' => $group_obj->getId(), 'previous_parent_id' => $parent_id, 'parent_id' => $parent_id, 'name' => $group_obj->getName(), 'created_date' => $group_obj->getCreatedDate(), 'created_by' => $group_obj->getCreatedBy(), 'updated_date' => $group_obj->getUpdatedDate(), 'updated_by' => $group_obj->getUpdatedBy(), 'deleted_date' => $group_obj->getDeletedDate(), 'deleted_by' => $group_obj->getDeletedBy()); } } $smarty->assign_by_ref('data', $data); break; } $smarty->assign_by_ref('ugf', $ugf); $smarty->display('users/EditUserGroup.tpl');
$delete = FALSE; } foreach ($ids as $id) { Debug::Text(' Deleting ID: ' . $id, __FILE__, __LINE__, __METHOD__, 10); $hf = new HierarchyListFactory(); $hf->setUser($id); $hf->setHierarchyControl($hierarchy_id); $hf->Delete(); } //FIXME: Get parent ID of each node we're deleting and clear the cache based on the hierarchy_id and it instead if (isset($hf) and is_object($hf)) { $hf->removeCache(NULL, $hf->getTable(TRUE)); //On delete we have to delete the entire group. } unset($hf); Redirect::Page(URLBuilder::getURL(array('hierarchy_id' => $hierarchy_id), 'HierarchyList.php')); break; default: BreadCrumb::setCrumb($title); $hlf = new HierarchyListFactory(); //$nodes = $hlf->FormatArray( $hlf->getByHierarchyControlId( $hierarchy_id ), 'HTML' ); //$nodes = FastTree::FormatArray( $hlf->getByHierarchyControlId( $hierarchy_id ), 'HTML' ); $nodes = FastTree::FormatArray($hlf->getByCompanyIdAndHierarchyControlId($current_company->getId(), $hierarchy_id), 'HTML'); //For some reason smarty prints out a blank row if nodes is false. if ($nodes !== FALSE) { $smarty->assign_by_ref('users', $nodes); } break; } $smarty->assign_by_ref('hierarchy_id', $hierarchy_id); $smarty->display('hierarchy/HierarchyList.tpl');
/** * Get QualificationGroup data for one or more QualificationGroupes. * @param array $data filter data * @return array */ function getQualificationGroup($data = NULL, $disable_paging = FALSE, $mode = 'flat') { if (!$this->getPermissionObject()->Check('qualification', 'enabled') or !($this->getPermissionObject()->Check('qualification', 'view') or $this->getPermissionObject()->Check('qualification', 'view_own') or $this->getPermissionObject()->Check('qualification', 'view_child'))) { //return $this->getPermissionObject()->PermissionDenied(); $data['filter_columns'] = $this->handlePermissionFilterColumns(isset($data['filter_columns']) ? $data['filter_columns'] : NULL, Misc::trimSortPrefix($this->getOptions('list_columns'))); } $data = $this->initializeFilterAndPager($data, $disable_paging); $data['filter_data']['permission_children_ids'] = $this->getPermissionObject()->getPermissionChildren('qualification', 'view'); $qglf = TTnew('QualificationGroupListFactory'); if ($mode == 'flat') { $qglf->getAPISearchByCompanyIdAndArrayCriteria($this->getCurrentCompanyObject()->getId(), $data['filter_data'], $data['filter_items_per_page'], $data['filter_page'], NULL, $data['filter_sort']); Debug::Text('Record Count: ' . $qglf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10); if ($qglf->getRecordCount() > 0) { $this->getProgressBarObject()->start($this->getAMFMessageID(), $qglf->getRecordCount()); $this->setPagerObject($qglf); foreach ($qglf as $ug_obj) { $retarr[] = $ug_obj->getObjectAsArray($data['filter_columns'], $data['filter_data']['permission_children_ids']); $this->getProgressBarObject()->set($this->getAMFMessageID(), $qglf->getCurrentRow()); } $this->getProgressBarObject()->stop($this->getAMFMessageID()); return $this->returnHandler($retarr); } } else { $nodes = $qglf->getByCompanyIdArray($this->getCurrentCompanyObject()->getId()); //Debug::Arr($nodes, ' Nodes: ', __FILE__, __LINE__, __METHOD__, 10); Debug::Text('Record Count: ' . count($nodes), __FILE__, __LINE__, __METHOD__, 10); if (isset($nodes)) { //$retarr = $uglf->getArrayByNodes( FastTree::FormatArray( $nodes, 'PLAIN_TEXT', TRUE) ); $retarr = FastTree::FormatFlexArray($nodes); Debug::Arr($retarr, ' Data: ', __FILE__, __LINE__, __METHOD__, 10); //There seems to be a bug with Flex here that if getQualification() and getQualificationGroup() are called at the same time //if this function returns an array with the keys out of order (1, 5, 10, rather then 0,1,3,4,5) Flex just sees //some empty object. //Not sure why this is happening with just this function, but the workaround for now is to call getQualificationGroup() //in a separate call to the server. //This could have something to do with the array having 0 => ... as the first entry, which we ran into a issue //in ExceptionPolicyFactory with getOptions('email_notification') return $this->returnHandler($retarr); } } return $this->returnHandler(TRUE); //No records returned. }
$utlf = new UserTitleListFactory(); $user_titles = $utlf->getByCompanyIdArray($company_id); $user_data['title_options'] = $user_titles; //Get Permission Groups $pclf = new PermissionControlListFactory(); $pclf->getByCompanyId($company_id); $user_data['permission_control_options'] = $pclf->getArrayByListFactory($pclf, FALSE); //Get pay period schedules $ppslf = new PayPeriodScheduleListFactory(); $pay_period_schedules = $ppslf->getByCompanyIDArray($company_id); $user_data['pay_period_schedule_options'] = $pay_period_schedules; $pglf = new PolicyGroupListFactory(); $policy_groups = $pglf->getByCompanyIDArray($company_id); $user_data['policy_group_options'] = $policy_groups; $uglf = new UserGroupListFactory(); $user_data['group_options'] = $uglf->getArrayByNodes(FastTree::FormatArray($uglf->getByCompanyIdArray($company_id), 'TEXT', TRUE)); //Get other field names $oflf = new OtherFieldListFactory(); $user_data['other_field_names'] = $oflf->getByCompanyIdAndTypeIdArray($company_id, 10); $user_data['hierarchy_object_type_options'] = $hierarchy_object_type_options; $user_data['hierarchy_control_options'] = $hierarchy_control_options; //Company list. if ($permission->Check('company', 'view')) { $user_data['company_options'] = CompanyListFactory::getAllArray(); } else { $user_data['company_options'] = array($company_id => $current_company->getName()); } $filter_data = NULL; extract(UserGenericDataFactory::getSearchFormData($saved_search_id, NULL)); if ($permission->Check('user', 'edit') == FALSE) { $filter_data['permission_children_ids'] = $permission_children_ids;