예제 #1
0
 //Get include employee list.
 $ulf->getByCompanyId($current_company->getId());
 $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 = new 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 = 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
         $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());
 }
예제 #3
0
switch ($action) {
    case 'submit':
        Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10);
        $ugf->setId($data['id']);
        $ugf->setCompany($current_company->getId());
        $ugf->setPreviousParent($previous_parent_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 = new 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());
            }
예제 #4
0
        Redirect::Page(URLBuilder::getURL(NULL, 'EditUserGroup.php', FALSE));
        break;
    case 'delete' or 'undelete':
        if (strtolower($action) == 'delete') {
            $delete = TRUE;
        } else {
            $delete = FALSE;
        }
        $uglf = new 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 = new 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');
예제 #5
0
 $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;