本文整理汇总了PHP中UserFactory::getOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP UserFactory::getOptions方法的具体用法?PHP UserFactory::getOptions怎么用?PHP UserFactory::getOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserFactory
的用法示例。
在下文中一共展示了UserFactory::getOptions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UserFactory
function getGeneralLedgerReportByCompanyIdAndArrayCriteria($company_id, $filter_data, $limit = NULL, $page = NULL, $where = NULL, $order = NULL)
{
if (isset($filter_data['punch_branch_ids'])) {
$filter_data['punch_branch_id'] = $filter_data['punch_branch_ids'];
}
if (isset($filter_data['punch_department_ids'])) {
$filter_data['punch_department_id'] = $filter_data['punch_department_ids'];
}
if (isset($filter_data['branch_ids'])) {
$filter_data['branch_id'] = $filter_data['branch_ids'];
}
if (isset($filter_data['department_ids'])) {
$filter_data['department_id'] = $filter_data['department_ids'];
}
$uf = new UserFactory();
$udf = new UserDateFactory();
$bf = new BranchFactory();
$df = new DepartmentFactory();
$ppf_b = new PayPeriodFactory();
$uwf = new UserWageFactory();
$pcf = new PunchControlFactory();
$pf = new PunchFactory();
$otpf = new OverTimePolicyFactory();
$apf = new AbsencePolicyFactory();
$ppf = new PremiumPolicyFactory();
if (getTTProductEdition() >= TT_PRODUCT_CORPORATE) {
$jf = new JobFactory();
$jif = new JobItemFactory();
}
$ph = array('company_id' => $company_id);
//Make it so employees with 0 hours still show up!! Very important!
//Order dock hours first, so it can be deducted from regular time.
$query = '
select
b.user_id as user_id,
ppf.id as pay_period_id,
ppf.start_date as pay_period_start_date,
ppf.end_date as pay_period_end_date,
ppf.transaction_date as pay_period_transaction_date,
b.date_stamp as date_stamp,
a.branch_id,
a.department_id,
a.job_id as job_id,
a.job_item_id as job_item_id,
a.status_id as status_id,
a.type_id as type_id,
a.over_time_policy_id as over_time_policy_id,
a.absence_policy_id as absence_policy_id,
sum(total_time) as total_time,
sum(actual_total_time) as actual_total_time,
sum(quantity) as quantity,
sum(bad_quantity) as bad_quantity
from ' . $this->getTable() . ' as a
LEFT JOIN ' . $udf->getTable() . ' as b ON a.user_date_id = b.id
LEFT JOIN ' . $uf->getTable() . ' as uf ON b.user_id = uf.id
LEFT JOIN ' . $bf->getTable() . ' as bf ON a.branch_id = bf.id
LEFT JOIN ' . $df->getTable() . ' as df ON a.department_id = df.id
LEFT JOIN ' . $ppf_b->getTable() . ' as ppf ON b.pay_period_id = ppf.id ';
if (getTTProductEdition() >= TT_PRODUCT_CORPORATE) {
$query .= '
LEFT JOIN ' . $jf->getTable() . ' as jf ON a.job_id = jf.id
LEFT JOIN ' . $jif->getTable() . ' as jif ON a.job_item_id = jif.id ';
}
$query .= ' LEFT JOIN ' . $otpf->getTable() . ' as m ON (a.over_time_policy_id = m.id AND m.deleted = 0)
LEFT JOIN ' . $apf->getTable() . ' as o ON (a.absence_policy_id = o.id AND o.deleted = 0)
LEFT JOIN ' . $ppf->getTable() . ' as q ON (a.premium_policy_id = q.id AND q.deleted = 0)
where uf.company_id = ? ';
$query .= isset($filter_data['permission_children_ids']) ? $this->getWhereClauseSQL('uf.id', $filter_data['permission_children_ids'], 'numeric_list', $ph) : NULL;
$query .= isset($filter_data['include_user_id']) ? $this->getWhereClauseSQL('uf.id', $filter_data['include_user_id'], 'numeric_list', $ph) : NULL;
$query .= isset($filter_data['exclude_user_id']) ? $this->getWhereClauseSQL('uf.id', $filter_data['include_user_id'], 'not_numeric_list', $ph) : NULL;
if (isset($filter_data['user_status']) and trim($filter_data['user_status']) != '' and !isset($filter_data['user_status_id'])) {
$filter_data['user_status_id'] = Option::getByFuzzyValue($filter_data['user_status'], $uf->getOptions('status'));
}
$query .= isset($filter_data['user_status_id']) ? $this->getWhereClauseSQL('uf.status_id', $filter_data['user_status_id'], 'numeric_list', $ph) : NULL;
if (isset($filter_data['include_user_subgroups']) and (bool) $filter_data['include_user_subgroups'] == TRUE) {
$uglf = new UserGroupListFactory();
$filter_data['user_group_id'] = $uglf->getByCompanyIdAndGroupIdAndSubGroupsArray($company_id, $filter_data['user_group_id'], TRUE);
}
$query .= isset($filter_data['user_group_id']) ? $this->getWhereClauseSQL('uf.group_id', $filter_data['user_group_id'], 'numeric_list', $ph) : NULL;
$query .= isset($filter_data['default_branch_id']) ? $this->getWhereClauseSQL('uf.default_branch_id', $filter_data['default_branch_id'], 'numeric_list', $ph) : NULL;
$query .= isset($filter_data['default_department_id']) ? $this->getWhereClauseSQL('uf.default_department_id', $filter_data['default_department_id'], 'numeric_list', $ph) : NULL;
$query .= isset($filter_data['user_title_id']) ? $this->getWhereClauseSQL('uf.title_id', $filter_data['user_title_id'], 'numeric_list', $ph) : NULL;
$query .= isset($filter_data['punch_branch_id']) ? $this->getWhereClauseSQL('a.branch_id', $filter_data['punch_branch_id'], 'numeric_list', $ph) : NULL;
$query .= isset($filter_data['punch_department_id']) ? $this->getWhereClauseSQL('a.department_id', $filter_data['punch_department_id'], 'numeric_list', $ph) : NULL;
$query .= isset($filter_data['pay_period_id']) ? $this->getWhereClauseSQL('b.pay_period_id', $filter_data['pay_period_id'], 'numeric_list', $ph) : NULL;
if (isset($filter_data['job_status']) and trim($filter_data['job_status']) != '' and !isset($filter_data['job_status_id'])) {
$filter_data['job_status_id'] = Option::getByFuzzyValue($filter_data['job_status'], $jf->getOptions('status'));
}
$query .= isset($filter_data['job_status_id']) ? $this->getWhereClauseSQL('jf.status_id', $filter_data['job_status_id'], 'numeric_list', $ph) : NULL;
$query .= isset($filter_data['job_group_id']) ? $this->getWhereClauseSQL('jf.group_id', $filter_data['job_group_id'], 'numeric_list', $ph) : NULL;
$query .= isset($filter_data['include_job_id']) ? $this->getWhereClauseSQL('a.job_id', $filter_data['include_job_id'], 'numeric_list', $ph) : NULL;
$query .= isset($filter_data['exclude_job_id']) ? $this->getWhereClauseSQL('a.job_id', $filter_data['exclude_job_id'], 'not_numeric_list', $ph) : NULL;
$query .= isset($filter_data['job_item_group_id']) ? $this->getWhereClauseSQL('jif.group_id', $filter_data['job_item_group_id'], 'numeric_list', $ph) : NULL;
$query .= isset($filter_data['include_job_item_id']) ? $this->getWhereClauseSQL('a.job_item_id', $filter_data['include_job_item_id'], 'numeric_list', $ph) : NULL;
$query .= isset($filter_data['exclude_job_item_id']) ? $this->getWhereClauseSQL('a.job_item_id', $filter_data['exclude_job_item_id'], 'not_numeric_list', $ph) : NULL;
//.........这里部分代码省略.........
示例2: getObjectAsArray
function getObjectAsArray($include_columns = NULL)
{
$uf = new UserFactory();
$variable_function_map = $this->getVariableToFunctionMap();
if (is_array($variable_function_map)) {
foreach ($variable_function_map as $variable => $function_stub) {
if ($include_columns == NULL or isset($include_columns[$variable]) and $include_columns[$variable] == TRUE) {
$function = 'get' . $function_stub;
switch ($variable) {
case 'user_id':
case 'first_name':
case 'last_name':
case 'user_status_id':
case 'group_id':
case 'group':
case 'title_id':
case 'title':
case 'default_branch_id':
case 'default_branch':
case 'default_department_id':
case 'default_department':
case 'schedule_policy_id':
case 'schedule_policy':
case 'pay_period_id':
case 'branch':
case 'department':
$data[$variable] = $this->getColumn($variable);
break;
case 'status':
$function = 'get' . $variable;
if (method_exists($this, $function)) {
$data[$variable] = Option::getByKey($this->{$function}(), $this->getOptions($variable));
}
break;
case 'user_status':
$data[$variable] = Option::getByKey((int) $this->getColumn('user_status_id'), $uf->getOptions('status'));
break;
case 'date_stamp':
$data[$variable] = TTDate::getAPIDate('DATE', TTDate::parseDateTime($this->getColumn('date_stamp')));
break;
case 'start_date':
$data[$variable] = TTDate::getAPIDate('DATE+TIME', $this->getStartTime());
//Include both date+time
break;
case 'end_date':
$data[$variable] = TTDate::getAPIDate('DATE+TIME', $this->getEndTime());
//Include both date+time
break;
case 'start_time':
case 'end_time':
if (method_exists($this, $function)) {
$data[$variable] = TTDate::getAPIDate('TIME', $this->{$function}());
//Just include time, so Mass Edit sees similar times without dates
}
break;
default:
if (method_exists($this, $function)) {
$data[$variable] = $this->{$function}();
}
break;
}
}
}
$this->getCreatedAndUpdatedColumns(&$data, $include_columns);
}
return $data;
}