本文整理汇总了PHP中UserListFactory::getArrayByListFactory方法的典型用法代码示例。如果您正苦于以下问题:PHP UserListFactory::getArrayByListFactory方法的具体用法?PHP UserListFactory::getArrayByListFactory怎么用?PHP UserListFactory::getArrayByListFactory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserListFactory
的用法示例。
在下文中一共展示了UserListFactory::getArrayByListFactory方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
if ($action != 'submit' and !is_array($data)) {
Debug::Text(' ID was NOT passed: ' . $id, __FILE__, __LINE__, __METHOD__, 10);
$user_id = NULL;
$user_date_id = NULL;
$user_full_name = NULL;
$user_default_branch = NULL;
$user_default_department = NULL;
$pay_period_is_locked = FALSE;
$time_stamp = $start_date_stamp = $end_date_stamp = TTDate::getBeginDayEpoch(TTDate::getTime()) + 3600 * 12;
//Noon
$data = array('start_date_stamp' => $start_date_stamp, 'end_date_stamp' => $end_date_stamp, 'start_time' => strtotime('08:00 AM'), 'parsed_start_time' => strtotime('08:00 AM'), 'end_time' => strtotime('05:00 PM'), 'parsed_end_time' => strtotime('05:00 PM'), 'total_time' => 3600 * 9, 'branch_id' => $user_default_branch, 'department_id' => $user_default_department, 'dow' => array(1 => TRUE, 2 => TRUE, 3 => TRUE, 4 => TRUE, 5 => TRUE));
}
//var_dump($data);
$ulf = TTnew('UserListFactory');
$ulf->getSearchByCompanyIdAndArrayCriteria($current_company->getId(), $filter_data);
$src_user_options = UserListFactory::getArrayByListFactory($ulf, FALSE, FALSE);
$user_options = Misc::arrayDiffByKey((array) $filter_user_id, $src_user_options);
$filter_user_options = Misc::arrayIntersectByKey((array) $filter_user_id, $src_user_options);
$prepend_array_option = array(0 => '--', -1 => TTi18n::gettext('-- Default --'));
$splf = TTnew('SchedulePolicyListFactory');
$schedule_policy_options = $splf->getByCompanyIdArray($current_company->getId());
$aplf = TTnew('AbsencePolicyListFactory');
$absence_policy_options = $aplf->getByCompanyIdArray($current_company->getId());
$blf = TTnew('BranchListFactory');
$blf->getByCompanyId($current_company->getId());
$branch_options = Misc::prependArray($prepend_array_option, $blf->getArrayByListFactory($blf, FALSE, TRUE));
$dlf = TTnew('DepartmentListFactory');
$dlf->getByCompanyId($current_company->getId());
$department_options = Misc::prependArray($prepend_array_option, $dlf->getArrayByListFactory($dlf, FALSE, TRUE));
if ($current_company->getProductEdition() >= 20) {
$jlf = TTnew('JobListFactory');
示例2: array
} else {
Debug::Text('Default Settings!', __FILE__, __LINE__, __METHOD__, 10);
//Default selections
$filter_data['user_status_ids'] = array(-1);
$filter_data['branch_ids'] = array(-1);
$filter_data['department_ids'] = array(-1);
$filter_data['user_title_ids'] = array(-1);
$filter_data['group_ids'] = array(-1);
}
}
$filter_data = Misc::preSetArrayValues($filter_data, array('include_user_ids', 'exclude_user_ids', 'user_status_ids', 'group_ids', 'branch_ids', 'department_ids', 'user_title_ids', 'pay_period_ids', 'column_ids'), NULL);
$ulf = new UserListFactory();
$all_array_option = array('-1' => TTi18n::gettext('-- All --'));
//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);
示例3: foreach
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());
}
$all_array_option = array('-1' => TTi18n::gettext('-- Any --'));
$ulf->getSearchByCompanyIdAndArrayCriteria($current_company->getId(), $filter_data);
$filter_data['user_options'] = Misc::prependArray($all_array_option, UserListFactory::getArrayByListFactory($ulf, FALSE, TRUE));
//Select box options;
$filter_data['template_options'] = Misc::prependArray($all_array_option, $template_options);
$filter_data['branch_options'] = Misc::prependArray($all_array_option, $branch_options);
$filter_data['department_options'] = Misc::prependArray($all_array_option, $department_options);
$filter_data['title_options'] = Misc::prependArray($all_array_option, $title_options);
$filter_data['group_options'] = Misc::prependArray($all_array_option, $group_options);
$filter_data['status_options'] = Misc::prependArray($all_array_option, $ulf->getOptions('status'));
$filter_data['saved_search_options'] = $ugdlf->getArrayByListFactory($ugdlf->getByUserIdAndScript($current_user->getId(), $_SERVER['SCRIPT_NAME']), FALSE);
//Get column list
$filter_data['src_column_options'] = Misc::arrayDiffByKey((array) $filter_data['columns'], $columns);
$filter_data['selected_column_options'] = Misc::arrayIntersectByKey((array) $filter_data['columns'], $columns);
$filter_data['sort_options'] = Misc::trimSortPrefix($columns);
$filter_data['sort_direction_options'] = Misc::getSortDirectionArray(TRUE);
foreach ($filter_data['columns'] as $column_key) {
$filter_columns[Misc::trimSortPrefix($column_key)] = $columns[$column_key];
示例4: HierarchyListFactory
case 'search':
Debug::Text('Search!', __FILE__, __LINE__, __METHOD__, 10);
$hlf = new HierarchyListFactory();
$permission_children_ids = $hlf->getHierarchyChildrenByCompanyIdAndUserIdAndObjectTypeID($current_company->getId(), $current_user->getId());
Debug::Arr($permission_children_ids, 'Permission Children Ids:', __FILE__, __LINE__, __METHOD__, 10);
if ($permission->Check('user', 'view') == FALSE) {
if ($permission->Check('user', 'view_child')) {
$data['permission_children_ids'] = $permission_children_ids;
}
if ($permission->Check('user', 'view_own')) {
$data['permission_children_ids'][] = $current_user->getId();
}
}
$ulf->getSearchByCompanyIdAndArrayCriteria($current_company->getId(), $data);
//$ulf->getSearchByCompanyIdAndBranchIdAndDepartmentIdAndStatusId( $current_company->getId(), $data['branch_id'], $data['department_id'], $data['status_id']);
$data['user_options'] = $ulf->getArrayByListFactory($ulf, FALSE);
if (is_array($data['user_options'])) {
$data['filter_user_ids'] = array_keys($data['user_options']);
$data['total_users'] = count($data['user_options']);
}
//var_dump($filter_user_ids);
//var_dump($filter_user_ids);
default:
if (isset($current_company)) {
$uglf = new UserGroupListFactory();
$group_options = $uglf->getArrayByNodes(FastTree::FormatArray($uglf->getByCompanyIdArray($current_company->getId()), 'TEXT', TRUE));
$blf = new BranchListFactory();
$branch_options = $blf->getByCompanyIdArray($current_company->getId());
$dlf = new DepartmentListFactory();
$department_options = $dlf->getByCompanyIdArray($current_company->getId());
}
示例5: PolicyGroupListFactory
$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;
}
$ulf->getSearchByCompanyIdAndArrayCriteria($company_id, $filter_data);
$user_data['user_options'] = UserListFactory::getArrayByListFactory($ulf, FALSE, TRUE);
$smarty->assign_by_ref('user_data', $user_data);
$smarty->assign_by_ref('saved_search_id', $saved_search_id);
$smarty->assign_by_ref('incomplete', $incomplete);
$smarty->assign_by_ref('data_saved', $data_saved);
break;
}
$smarty->assign_by_ref('uf', $uf);
$smarty->display('users/EditUser.tpl');
示例6: postInstall
function postInstall()
{
global $cache;
Debug::text('postInstall: ' . $this->getVersion(), __FILE__, __LINE__, __METHOD__, 9);
Debug::text('l: ' . $this->getVersion(), __FILE__, __LINE__, __METHOD__, 9);
/*
Take permission groups we put into memory from preInstall and create them now,
after schema has been updated.
*/
if (isset($this->permission_groups) and is_array($this->permission_groups)) {
//Create permission groups and assign proper employees to each.
//Debug::Arr($this->permission_groups, 'All Permission Groups: ', __FILE__, __LINE__, __METHOD__,9);
foreach ($this->permission_groups as $company_id => $permission_group_data) {
//Get all active users for this company, so we can assign them
//to the default permission group.
$ulf = new UserListFactory();
$ulf->getByCompanyId($company_id);
$all_user_ids = array_keys((array) $ulf->getArrayByListFactory($ulf, FALSE, TRUE));
$assigned_user_ids = array();
foreach ($permission_group_data as $group_name => $permission_data) {
Debug::text('zGroup Name: ' . $group_name, __FILE__, __LINE__, __METHOD__, 10);
$pcf = new PermissionControlFactory();
$pcf->StartTransaction();
$pcf->setCompany($company_id);
$pcf->setName(ucfirst($group_name));
$pcf->setDescription('Automatically Created By Installer');
if ($pcf->isValid()) {
$pcf_id = $pcf->Save(FALSE);
if (strtolower($group_name) == 'default') {
//Assign all unassigned users to this permission group.
$tmp_user_ids = array_merge((array) $this->permission_group_users[$company_id][$group_name], array_diff($all_user_ids, $assigned_user_ids));
//Debug::Arr($all_user_ids, 'Default Group All User IDs:', __FILE__, __LINE__, __METHOD__, 10);
//Debug::Arr($assigned_user_ids, 'Default Group All User IDs:', __FILE__, __LINE__, __METHOD__, 10);
//Debug::Arr($tmp_user_ids, 'Default Group User IDs:', __FILE__, __LINE__, __METHOD__, 10);
$pcf->setUser($tmp_user_ids);
unset($tmp_user_ids);
} else {
if (isset($this->permission_group_users[$company_id][$group_name]) and is_array($this->permission_group_users[$company_id][$group_name])) {
$pcf->setUser($this->permission_group_users[$company_id][$group_name]);
$assigned_user_ids = array_merge($assigned_user_ids, $this->permission_group_users[$company_id][$group_name]);
}
}
if (is_array($permission_data)) {
$pcf->setPermission($permission_data);
}
}
//$pcf->FailTransaction();
$pcf->CommitTransaction();
}
unset($all_user_ids, $assigned_user_ids);
}
}
return TRUE;
}