本文整理汇总了PHP中Option::getByKey方法的典型用法代码示例。如果您正苦于以下问题:PHP Option::getByKey方法的具体用法?PHP Option::getByKey怎么用?PHP Option::getByKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Option
的用法示例。
在下文中一共展示了Option::getByKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUserGenericStatus
/**
* Get user generic status data for one or more .
* @param array $data filter data
* @return array
*/
function getUserGenericStatus($data = NULL, $disable_paging = FALSE)
{
$data = $this->initializeFilterAndPager($data, $disable_paging);
$user_id = $this->getCurrentUserObject()->getId();
if ($data['filter_data']['batch_id'] != '') {
$batch_id = $data['filter_data']['batch_id'];
$ugslf = TTnew('UserGenericStatusListFactory');
$ugslf->getByUserIdAndBatchId($user_id, $batch_id, $data['filter_items_per_page'], $data['filter_page'], NULL, $data['filter_sort']);
Debug::Text('Record Count: ' . $ugslf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
if ($ugslf->getRecordCount() > 0) {
//$status_count_arr = $ugslf->getStatusCountArrayByUserIdAndBatchId( $user_id, $batch_id );
$this->getProgressBarObject()->start($this->getAMFMessageID(), $ugslf->getRecordCount());
$this->setPagerObject($ugslf);
foreach ($ugslf as $ugs_obj) {
$rows[] = array('id' => $ugs_obj->getId(), 'user_id' => $ugs_obj->getUser(), 'batch_id' => $ugs_obj->getBatchId(), 'status_id' => $ugs_obj->getStatus(), 'status' => Option::getByKey($ugs_obj->getStatus(), $ugs_obj->getOptions('status')), 'label' => $ugs_obj->getLabel(), 'description' => $ugs_obj->getDescription(), 'link' => $ugs_obj->getLink(), 'deleted' => $ugs_obj->getDeleted());
$this->getProgressBarObject()->set($this->getAMFMessageID(), $ugslf->getCurrentRow());
}
$this->getProgressBarObject()->stop($this->getAMFMessageID());
return $this->returnHandler($rows);
} else {
return $this->returnHandler(TRUE);
//No records returned.
}
} else {
return $this->returnHandler(TRUE);
//No records returned.
}
}
示例2: array
$day_total_time['total_time'] += $udt_obj->getTotalTime();
}
if ($filter_system_time != 1 and $udt_obj->getStatus() == 10) {
continue;
}
if ($udt_obj->getJob() != FALSE) {
$job = $job_options[$udt_obj->getJob()];
} else {
$job = 'No Job';
}
if ($udt_obj->getJobItem() != FALSE) {
$job_item = $job_item_options[$udt_obj->getJobItem()];
} else {
$job_item = TTi18n::gettext('No Task');
}
$rows[] = array('id' => $udt_obj->getId(), 'status_id' => $udt_obj->getStatus(), 'status' => Option::getByKey($udt_obj->getStatus(), $udt_obj->getOptions('status')), 'type_id' => $udt_obj->getType(), 'type' => Option::getByKey($udt_obj->getType(), $udt_obj->getOptions('type')), 'branch_id' => $udt_obj->getBranch(), 'branch' => $branch_options[$udt_obj->getBranch()], 'department_id' => $udt_obj->getDepartment(), 'department' => $department_options[$udt_obj->getDepartment()], 'job_id' => $udt_obj->getJob(), 'job' => $job, 'job_item_id' => $udt_obj->getJobItem(), 'job_item' => $job_item, 'quantity' => (int) $udt_obj->getQuantity(), 'bad_quantity' => (int) $udt_obj->getBadQuantity(), 'absence_policy_id' => $udt_obj->getAbsencePolicyID(), 'absence_policy' => $absence_policy_options[$udt_obj->getAbsencePolicyID()], 'over_time_policy_id' => $udt_obj->getOverTimePolicyID(), 'over_time_policy' => $over_time_policy_options[$udt_obj->getOverTimePolicyID()], 'premium_policy_id' => $udt_obj->getPremiumPolicyID(), 'premium_policy' => $premium_policy_options[$udt_obj->getPremiumPolicyID()], 'total_time' => $udt_obj->getTotalTime(), 'override' => $udt_obj->getOverride(), 'deleted' => $udt_obj->getDeleted());
}
$day_total_time['difference'] = $day_total_time['worked_time'] - $day_total_time['total_time'];
//var_dump($day_total_time);
$user_options = UserListFactory::getByCompanyIdArray($current_company->getId(), FALSE);
$smarty->assign_by_ref('user_options', $user_options);
$smarty->assign_by_ref('rows', $rows);
$smarty->assign_by_ref('day_total_time', $day_total_time);
$smarty->assign_by_ref('user_date_id', $user_date_id);
$smarty->assign_by_ref('filter_user_id', $user_id);
$smarty->assign_by_ref('filter_date', $filter_date);
$smarty->assign_by_ref('filter_system_time', $filter_system_time);
$smarty->assign_by_ref('sort_column', $sort_column);
$smarty->assign_by_ref('sort_order', $sort_order);
$smarty->assign_by_ref('paging_data', $pager->getPageVariables());
}
示例3: foreach
foreach ($data_a as $pay_period_id => $data_b) {
$rows[$x]['user_id'] = $user_obj->getId();
$rows[$x]['full_name'] = $user_obj->getFullName(TRUE);
$rows[$x]['employee_number'] = $user_obj->getEmployeeNumber();
$rows[$x]['status'] = Option::getByKey($user_obj->getStatus(), $user_obj->getOptions('status'));
//$rows[$x]['province'] = Option::getByKey($user_obj->getProvince(), $user_obj->getCompanyObject()->getOptions('province', $user_obj->getCountry() ) );
//$rows[$x]['country'] = Option::getByKey($user_obj->getCountry(), $user_obj->getCompanyObject()->getOptions('country') );
$rows[$x]['province'] = $user_obj->getProvince();
$rows[$x]['country'] = $user_obj->getCountry();
$rows[$x]['pay_period_id'] = $pay_period_id;
$rows[$x]['pay_period_order'] = Option::getByKey($pay_period_id, $pay_period_end_dates, NULL);
$rows[$x]['pay_period'] = Option::getByKey($pay_period_id, $pay_period_options, NULL);
$rows[$x]['title'] = Option::getByKey($user_obj->getTitle(), $title_options, NULL);
$rows[$x]['group'] = Option::getByKey($user_obj->getGroup(), $group_options, NULL);
$rows[$x]['default_branch'] = Option::getByKey($user_obj->getDefaultBranch(), $branch_options, NULL);
$rows[$x]['default_department'] = Option::getByKey($user_obj->getDefaultDepartment(), $department_options, NULL);
if ($verified_time_sheets !== NULL and isset($verified_time_sheets[$user_id][$pay_period_id])) {
if ($verified_time_sheets[$user_id][$pay_period_id] == 50) {
$rows[$x]['verified_time_sheet'] = TTi18n::gettext('Yes');
} elseif ($verified_time_sheets[$user_id][$pay_period_id] == 30 or $verified_time_sheets[$user_id][$pay_period_id] == 45) {
$rows[$x]['verified_time_sheet'] = TTi18n::gettext('Pending');
} else {
$rows[$x]['verified_time_sheet'] = TTi18n::gettext('Declined');
}
} else {
$rows[$x]['verified_time_sheet'] = TTi18n::gettext('No');
}
if (isset($pending_requests[$pay_period_id])) {
$rows[$x]['pending_request'] = $pending_requests[$pay_period_id];
} else {
$rows[$x]['pending_request'] = 0;
示例4: getObjectAsArray
function getObjectAsArray($include_columns = NULL, $permission_children_ids = FALSE)
{
$uf = TTnew('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 'first_name':
case 'last_name':
if ($this->getColumn('user_id') > 0) {
$data[$variable] = $this->getColumn($variable);
} else {
$data[$variable] = TTi18n::getText('OPEN');
}
break;
case 'user_id':
//Make sure getUser() returns the proper user_id, otherwise mass edit will always assign shifts to OPEN employee.
//We have to make sure the 'user_id' function map is FALSE as well, so we don't get a SQL error when getting the empty record set.
$data[$variable] = $this->tmp_data['user_id'] = $this->getColumn($variable);
break;
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':
case 'job':
case 'job_item':
$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', strtotime($this->getColumn('date_stamp')));
break;
case 'start_date_stamp':
$data[$variable] = TTDate::getAPIDate('DATE', $this->getStartTime());
//Include both date+time
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_stamp':
$data[$variable] = $this->getStartTime();
//Include start date/time in epoch format for sorting...
break;
case 'end_time_stamp':
$data[$variable] = $this->getEndTime();
//Include end date/time in epoch format for sorting...
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->getPermissionColumns($data, $this->getColumn('user_id'), $this->getCreatedBy(), $permission_children_ids, $include_columns);
$this->getCreatedAndUpdatedColumns($data, $include_columns);
}
return $data;
}
示例5: getAllArray
function getAllArray()
{
$hlf = new HelpListFactory();
$hlf->getAll();
$help_list[0] = '--';
foreach ($hlf as $help) {
$help_list[$help->getID()] = '(' . $help->getID() . ') [' . Option::getByKey($help->getType(), $help->getOptions('type')) . '] ' . $help->getHeading();
}
return $help_list;
}
示例6: PunchListFactory
$plf = new PunchListFactory();
//$plf->getByPunchControlId( $pc_obj->getId() );
$plf->getById($id);
if ($plf->getRecordCount() > 0) {
$p_obj = $plf->getCurrent();
} else {
$punch_data = NULL;
}
//Get Station data.
$station_data = FALSE;
$slf = new StationListFactory();
if ($p_obj->getStation() != FALSE) {
$slf->getById($p_obj->getStation());
if ($slf->getRecordCount() > 0) {
$s_obj = $slf->getCurrent();
$station_data = array('id' => $s_obj->getId(), 'type_id' => $s_obj->getType(), 'type' => Option::getByKey($s_obj->getType(), $s_obj->getOptions('type')), 'station_id' => $s_obj->getStation(), 'source' => $s_obj->getSource(), 'description' => Misc::TruncateString($s_obj->getDescription(), 20));
}
}
$pc_data = array('id' => $pc_obj->getId(), 'user_date_id' => $pc_obj->getUserDateId(), 'user_id' => $pc_obj->getUserDateObject()->getUser(), 'user_full_name' => $pc_obj->getUserDateObject()->getUserObject()->getFullName(), 'pay_period_id' => $pc_obj->getUserDateObject()->getPayPeriod(), 'branch_id' => $pc_obj->getBranch(), 'department_id' => $pc_obj->getDepartment(), 'job_id' => $pc_obj->getJob(), 'job_item_id' => $pc_obj->getJobItem(), 'quantity' => (double) $pc_obj->getQuantity(), 'bad_quantity' => (double) $pc_obj->getBadQuantity(), 'note' => $pc_obj->getNote(), 'other_id1' => $pc_obj->getOtherID1(), 'other_id2' => $pc_obj->getOtherID2(), 'other_id3' => $pc_obj->getOtherID3(), 'other_id4' => $pc_obj->getOtherID4(), 'other_id5' => $pc_obj->getOtherID5(), 'punch_id' => $p_obj->getId(), 'status_id' => $p_obj->getStatus(), 'type_id' => $p_obj->getType(), 'station_id' => $p_obj->getStation(), 'station_data' => $station_data, 'time_stamp' => $p_obj->getTimeStamp(), 'date_stamp' => $p_obj->getTimeStamp(), 'original_time_stamp' => $p_obj->getOriginalTimeStamp(), 'actual_time_stamp' => $p_obj->getActualTimeStamp(), 'longitude' => $p_obj->getLongitude(), 'latitude' => $p_obj->getLatitude(), 'created_date' => $p_obj->getCreatedDate(), 'created_by' => $p_obj->getCreatedBy(), 'created_by_name' => (string) $ulf->getFullNameById($p_obj->getCreatedBy()), 'updated_date' => $p_obj->getUpdatedDate(), 'updated_by' => $p_obj->getUpdatedBy(), 'updated_by_name' => (string) $ulf->getFullNameById($p_obj->getUpdatedBy()), 'deleted_date' => $p_obj->getDeletedDate(), 'deleted_by' => $p_obj->getDeletedBy());
}
} elseif ($action != 'submit') {
Debug::Text(' ID was NOT passed: ' . $id, __FILE__, __LINE__, __METHOD__, 10);
//UserID has to be set at minimum
if ($punch_control_id != '') {
Debug::Text(' Punch Control ID was passed: ' . $punch_control_id, __FILE__, __LINE__, __METHOD__, 10);
//Get previous punch, and default timestamp to that.
$plf = new PunchListFactory();
$plf->getPreviousPunchByPunchControlID($punch_control_id);
if ($plf->getRecordCount() > 0) {
$prev_punch_obj = $plf->getCurrent();
$time_stamp = $prev_punch_obj->getTimeStamp() + 3600;
示例7: getObjectTypeDisplay
function getObjectTypeDisplay()
{
$object_type_ids = $this->getObjectType();
$object_types = $this->getOptions('short_object_type');
$retval = array();
foreach ($object_type_ids as $object_type_id) {
$retval[] = Option::getByKey($object_type_id, $object_types);
}
sort($retval);
//Maintain consistent order.
return implode(',', $retval);
}
示例8: getObjectAsArray
function getObjectAsArray($include_columns = NULL)
{
$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 'status':
$function = 'get' . $variable;
if (method_exists($this, $function)) {
$data[$variable] = Option::getByKey($this->{$function}(), $this->getOptions($variable));
}
break;
case 'start_time':
case 'end_time':
//$data[$variable] = ( defined('TIMETREX_API') ) ? TTDate::getAPIDate( 'TIME', TTDate::strtotime( $this->$function() ) ) : $this->$function();
$data[$variable] = defined('TIMETREX_API') ? TTDate::getAPIDate('TIME', TTDate::strtotime($this->{$function}())) : $this->{$function}();
//Need to include the raw_start_time,raw_end_time columns that are in EPOCH format so getShiftsByStartDateAndEndDate() can convert them as needed.
$data['raw_' . $variable] = $this->{$function}();
break;
case 'sun':
case 'mon':
case 'tue':
case 'wed':
case 'thu':
case 'fri':
case 'sat':
//For backwards compatibility, put all days inside the "days" array, AS WELL as in their own column for the API to use.
if (method_exists($this, $function)) {
$data['days'][$variable] = $this->{$function}();
}
default:
if (method_exists($this, $function)) {
$data[$variable] = $this->{$function}();
}
break;
}
}
}
$this->getCreatedAndUpdatedColumns($data, $include_columns);
}
return $data;
}
示例9: _getData
function _getData($format = NULL)
{
$this->tmp_data = array('schedule' => array(), 'user' => array(), 'total_shift' => array());
$columns = $this->getColumnDataConfig();
$filter_data = $this->getFilterConfig();
if ($this->getPermissionObject()->Check('schedule', 'view') == FALSE or $this->getPermissionObject()->Check('wage', 'view') == FALSE) {
$hlf = TTnew('HierarchyListFactory');
$permission_children_ids = $wage_permission_children_ids = $hlf->getHierarchyChildrenByCompanyIdAndUserIdAndObjectTypeID($this->getUserObject()->getCompany(), $this->getUserObject()->getID());
Debug::Arr($permission_children_ids, 'Permission Children Ids:', __FILE__, __LINE__, __METHOD__, 10);
} else {
//Get Permission Hierarchy Children first, as this can be used for viewing, or editing.
$permission_children_ids = array();
$wage_permission_children_ids = array();
}
if ($this->getPermissionObject()->Check('schedule', 'view') == FALSE) {
if ($this->getPermissionObject()->Check('schedule', 'view_child') == FALSE) {
$permission_children_ids = array();
}
if ($this->getPermissionObject()->Check('schedule', 'view_own')) {
$permission_children_ids[] = $this->getUserObject()->getID();
}
$filter_data['permission_children_ids'] = $permission_children_ids;
}
//Get Wage Permission Hierarchy Children first, as this can be used for viewing, or editing.
if ($this->getPermissionObject()->Check('wage', 'view') == TRUE) {
$wage_permission_children_ids = TRUE;
} elseif ($this->getPermissionObject()->Check('wage', 'view') == FALSE) {
if ($this->getPermissionObject()->Check('wage', 'view_child') == FALSE) {
$wage_permission_children_ids = array();
}
if ($this->getPermissionObject()->Check('wage', 'view_own')) {
$wage_permission_children_ids[] = $this->getUserObject()->getID();
}
}
//Debug::Text(' Permission Children: '. count($permission_children_ids) .' Wage Children: '. count($wage_permission_children_ids), __FILE__, __LINE__, __METHOD__,10);
//Debug::Arr($permission_children_ids, 'Permission Children: '. count($permission_children_ids), __FILE__, __LINE__, __METHOD__,10);
//Debug::Arr($wage_permission_children_ids, 'Wage Children: '. count($wage_permission_children_ids), __FILE__, __LINE__, __METHOD__,10);
if ($this->getUserObject()->getCompanyObject()->getProductEdition() >= TT_PRODUCT_CORPORATE) {
$jlf = TTnew('JobListFactory');
$job_status_options = $jlf->getOptions('status');
} else {
$job_status_options = array();
}
$pay_period_ids = array();
if (strpos($format, 'schedule') === FALSE) {
//Avoid running these queries when printing out the schedule.
$slf = TTnew('ScheduleListFactory');
$slf->getScheduleSummaryReportByCompanyIdAndArrayCriteria($this->getUserObject()->getCompany(), $filter_data, NULL, NULL, NULL, array('last_name' => 'asc'));
//Sort by last name mainly for the PDF schedule for printing.
Debug::Text(' Total Rows: ' . $slf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
$this->getProgressBarObject()->start($this->getAMFMessageID(), $slf->getRecordCount(), NULL, TTi18n::getText('Retrieving Data...'));
if ($slf->getRecordCount() > 0) {
foreach ($slf as $key => $s_obj) {
$hourly_rate = 0;
if ($wage_permission_children_ids === TRUE or in_array($s_obj->getColumn('user_id'), $wage_permission_children_ids)) {
$hourly_rate = $s_obj->getColumn('user_wage_hourly_rate');
}
$date_stamp_epoch = TTDate::strtotime($s_obj->getColumn('date_stamp'));
$shift_arr = array('user_id' => $s_obj->getColumn('user_id'), 'status_id' => $s_obj->getColumn('status_id'), 'group' => $s_obj->getColumn('group'), 'default_branch' => $s_obj->getColumn('default_branch'), 'default_department' => $s_obj->getColumn('default_department'), 'branch' => $s_obj->getColumn('branch'), 'department' => $s_obj->getColumn('department'), 'job' => $s_obj->getColumn('job'), 'job_status_id' => Option::getByKey($s_obj->getColumn('job_status_id'), $job_status_options, NULL), 'job_manual_id' => $s_obj->getColumn('job_manual_id'), 'job_description' => $s_obj->getColumn('job_description'), 'job_branch' => $s_obj->getColumn('job_branch'), 'job_department' => $s_obj->getColumn('job_department'), 'job_group' => $s_obj->getColumn('job_group'), 'job_item' => $s_obj->getColumn('job_item'), 'quantity' => $s_obj->getColumn('quantity'), 'bad_quantity' => $s_obj->getColumn('bad_quantity'), 'total_time' => $s_obj->getColumn('total_time'), 'total_time_wage' => Misc::MoneyFormat(bcmul(TTDate::getHours($s_obj->getColumn('total_time')), $hourly_rate), FALSE), 'total_time_wage_burden' => Misc::MoneyFormat(bcmul(TTDate::getHours($s_obj->getColumn('total_time')), bcmul($hourly_rate, bcdiv($s_obj->getColumn('user_labor_burden_percent'), 100))), FALSE), 'total_time_wage_with_burden' => Misc::MoneyFormat(bcmul(TTDate::getHours($s_obj->getColumn('total_time')), bcmul($hourly_rate, bcadd(bcdiv($s_obj->getColumn('user_labor_burden_percent'), 100), 1))), FALSE), 'other_id1' => $s_obj->getColumn('other_id1'), 'other_id2' => $s_obj->getColumn('other_id2'), 'other_id3' => $s_obj->getColumn('other_id3'), 'other_id4' => $s_obj->getColumn('other_id4'), 'other_id5' => $s_obj->getColumn('other_id5'), 'date_stamp' => $date_stamp_epoch, 'schedule_policy' => $s_obj->getColumn('schedule_policy'), 'absence_policy' => $s_obj->getColumn('absence_policy'), 'schedule_status' => Option::getByKey($s_obj->getStatus(), $s_obj->getOptions('status'), NULL), 'start_time' => TTDate::strtotime($s_obj->getColumn('start_time')), 'end_time' => TTDate::strtotime($s_obj->getColumn('end_time')), 'user_wage_id' => $s_obj->getColumn('user_wage_id'), 'hourly_rate' => Misc::MoneyFormat($hourly_rate, FALSE), 'pay_period_start_date' => strtotime($s_obj->getColumn('pay_period_start_date')), 'pay_period_end_date' => strtotime($s_obj->getColumn('pay_period_end_date')), 'pay_period_transaction_date' => strtotime($s_obj->getColumn('pay_period_transaction_date')), 'pay_period' => strtotime($s_obj->getColumn('pay_period_transaction_date')), 'pay_period_id' => $s_obj->getColumn('pay_period_id'), 'schedule_note' => $s_obj->getColumn('note'), 'total_shift' => 1);
unset($hourly_rate);
$this->tmp_data['schedule'][$s_obj->getColumn('user_id')][] = $shift_arr;
$this->getProgressBarObject()->set($this->getAMFMessageID(), $key);
}
}
//Debug::Arr($this->tmp_data['schedule'], 'Schedule Raw Data: ', __FILE__, __LINE__, __METHOD__,10);
//Debug::Arr($this->form_data, 'Schedule Raw Data: ', __FILE__, __LINE__, __METHOD__,10);
}
unset($filter_data['status_id']);
//This is for schedule status, not user status.
//If we're printing the schedule, make sure we include the required columns.
if (in_array($format, $this->special_output_format)) {
$this->config['columns_data']['first_name'] = TRUE;
$this->config['columns_data']['last_name'] = TRUE;
}
//Get user data for joining.
$ulf = TTnew('UserListFactory');
$ulf->getAPISearchByCompanyIdAndArrayCriteria($this->getUserObject()->getCompany(), $filter_data);
Debug::Text(' User Total Rows: ' . $ulf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
$this->getProgressBarObject()->start($this->getAMFMessageID(), $ulf->getRecordCount(), NULL, TTi18n::getText('Retrieving Data...'));
foreach ($ulf as $key => $u_obj) {
$this->tmp_data['user'][$u_obj->getId()] = $this->form_data['user'][$u_obj->getId()] = (array) $u_obj->getObjectAsArray($this->getColumnDataConfig());
$this->getProgressBarObject()->set($this->getAMFMessageID(), $key);
}
//Add OPEN user to the list so it can printed on schedules.
$this->tmp_data['user'][0] = $this->form_data['user'][0] = array('first_name' => TTi18n::getText('OPEN'), 'last_name' => '');
//Debug::Arr($this->tmp_data['user'], 'User Raw Data: ', __FILE__, __LINE__, __METHOD__,10);
return TRUE;
}
示例10: TTnew
}
$af->FailTransaction();
}
Redirect::Page(URLBuilder::getURL(array('refresh' => TRUE), '../CloseWindow.php'));
break;
default:
if ((int) $id > 0) {
Debug::Text(' ID was passed: ' . $id, __FILE__, __LINE__, __METHOD__, 10);
$rlf = TTnew('RequestListFactory');
$rlf->getByIDAndCompanyID($id, $current_company->getId());
if ($rlf->getRecordCount() == 1) {
foreach ($rlf as $r_obj) {
//Debug::Arr($station,'Department', __FILE__, __LINE__, __METHOD__,10);
$hierarchy_type_id = $r_obj->getHierarchyTypeID();
$type_id = $r_obj->getType();
$data = array('id' => $r_obj->getId(), 'user_date_id' => $r_obj->getId(), 'user_id' => $r_obj->getUserDateObject()->getUser(), 'user_full_name' => $r_obj->getUserDateObject()->getUserObject()->getFullName(), 'date_stamp' => $r_obj->getUserDateObject()->getDateStamp(), 'type' => Option::getByKey($r_obj->getType(), $rlf->getOptions('type')), 'type_id' => $r_obj->getType(), 'hierarchy_type_id' => $r_obj->getHierarchyTypeID(), 'status_id' => $r_obj->getStatus(), 'authorized' => $r_obj->getAuthorized(), 'created_date' => $r_obj->getCreatedDate(), 'created_by' => $r_obj->getCreatedBy(), 'updated_date' => $r_obj->getUpdatedDate(), 'updated_by' => $r_obj->getUpdatedBy(), 'deleted_date' => $r_obj->getDeletedDate(), 'deleted_by' => $r_obj->getDeletedBy());
}
//Get Next Request to authorize:
if ($permission->Check('request', 'authorize') and $selected_level != NULL and count($request_queue_ids) <= 1) {
Debug::Text('Get Request Queue: ', __FILE__, __LINE__, __METHOD__, 10);
$ulf = TTnew('UserListFactory');
$hlf = TTnew('HierarchyListFactory');
$hllf = TTnew('HierarchyLevelListFactory');
$request_levels = $hllf->getLevelsAndHierarchyControlIDsByUserIdAndObjectTypeID($current_user->getId(), $hierarchy_type_id);
//Debug::Arr( $request_levels, 'Request Levels', __FILE__, __LINE__, __METHOD__,10);
if (isset($selected_level) and isset($request_levels[$selected_level])) {
$request_selected_level = $request_levels[$selected_level];
Debug::Text(' Switching Levels to Level: ' . key($request_selected_level), __FILE__, __LINE__, __METHOD__, 10);
} elseif (isset($request_levels[1])) {
$request_selected_level = $request_levels[1];
} else {
示例11: BranchListFactory
$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));
$ulf = new UserListFactory();
$user_options = $ulf->getByCompanyIdArray($current_company->getID(), FALSE);
foreach ($plf as $p_obj) {
//Debug::Text('Status ID: '. $r_obj->getStatus() .' Status: '. $status_options[$r_obj->getStatus()], __FILE__, __LINE__, __METHOD__,10);
$user_obj = $ulf->getById($p_obj->getColumn('user_id'))->getCurrent();
$rows[] = array('id' => $p_obj->getColumn('punch_id'), 'punch_control_id' => $p_obj->getPunchControlId(), 'user_id' => $p_obj->getColumn('user_id'), 'first_name' => $user_obj->getFirstName(), 'last_name' => $user_obj->getLastName(), 'title' => Option::getByKey($user_obj->getTitle(), $title_options), 'group' => Option::getByKey($user_obj->getGroup(), $group_options), 'default_branch' => Option::getByKey($user_obj->getDefaultBranch(), $branch_options), 'default_department' => Option::getByKey($user_obj->getDefaultDepartment(), $department_options), 'branch_id' => $p_obj->getColumn('branch_id'), 'branch' => Option::getByKey($p_obj->getColumn('branch_id'), $branch_options), 'department_id' => $p_obj->getColumn('department_id'), 'department' => Option::getByKey($p_obj->getColumn('department_id'), $department_options), 'status_id' => Option::getByKey($p_obj->getStatus(), $punch_status_options), 'type_id' => Option::getByKey($p_obj->getType(), $punch_type_options), 'date_stamp' => TTDate::getDate('DATE', TTDate::strtotime($p_obj->getColumn('date_stamp'))), 'job_id' => $p_obj->getColumn('job_id'), 'job_name' => $p_obj->getColumn('job_name'), 'job_group_id' => $p_obj->getColumn('job_group_id'), 'job_item_id' => $p_obj->getColumn('job_item_id'), 'time_stamp' => TTDate::getDate('DATE+TIME', $p_obj->getTimeStamp()), 'is_owner' => $permission->isOwner($p_obj->getCreatedBy(), $current_user->getId()), 'is_child' => $permission->isChild($p_obj->getColumn('user_id'), $permission_children_ids));
}
$smarty->assign_by_ref('rows', $rows);
$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['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['pay_period_options'] = Misc::prependArray($all_array_option, $pay_period_options);
$filter_data['punch_status_options'] = Misc::prependArray($all_array_option, $punch_status_options);
$filter_data['punch_type_options'] = Misc::prependArray($all_array_option, $punch_type_options);
$filter_data['saved_search_options'] = $ugdlf->getArrayByListFactory($ugdlf->getByUserIdAndScript($current_user->getId(), $_SERVER['SCRIPT_NAME']), FALSE);
示例12: addLog
function addLog($log_action)
{
$object_type = Option::getByKey($this->getObjectType(), Misc::TrimSortPrefix($this->getOptions('object_type')));
return TTLog::addEntry($this->getHierarchyControl(), $log_action, TTi18n::getText('Object') . ': ' . $object_type, NULL, $this->getTable());
}
示例13: _getData
function _getData($format = NULL)
{
$this->tmp_data = array('user' => array(), 'log' => array());
$columns = $this->getColumnDataConfig();
$filter_data = $this->getFilterConfig();
if ($this->getPermissionObject()->Check('user', 'view') == FALSE) {
$hlf = TTnew('HierarchyListFactory');
$permission_children_ids = $hlf->getHierarchyChildrenByCompanyIdAndUserIdAndObjectTypeID($this->getUserObject()->getCompany(), $this->getUserObject()->getID());
Debug::Arr($permission_children_ids, 'Permission Children Ids:', __FILE__, __LINE__, __METHOD__, 10);
} else {
//Get Permission Hierarchy Children first, as this can be used for viewing, or editing.
$permission_children_ids = array();
}
if ($this->getPermissionObject()->Check('user', 'view') == FALSE) {
if ($this->getPermissionObject()->Check('user', 'view_child') == FALSE) {
$permission_children_ids = array();
}
if ($this->getPermissionObject()->Check('user', 'view_own')) {
$permission_children_ids[] = $this->getUserObject()->getID();
}
$filter_data['permission_children_ids'] = $permission_children_ids;
}
//Get user data for joining.
$ulf = TTnew('UserListFactory');
$ulf->getAPISearchByCompanyIdAndArrayCriteria($this->getUserObject()->getCompany(), $filter_data);
Debug::Text(' User Rows: ' . $ulf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
$this->getProgressBarObject()->start($this->getAMFMessageID(), $ulf->getRecordCount(), NULL, TTi18n::getText('Retrieving Data...'));
foreach ($ulf as $key => $u_obj) {
$this->tmp_data['user'][$u_obj->getId()] = (array) $u_obj->getObjectAsArray($columns);
$this->tmp_data['user'][$u_obj->getId()]['user_status'] = Option::getByKey($u_obj->getStatus(), $u_obj->getOptions('status'));
$this->getProgressBarObject()->set($this->getAMFMessageID(), $key);
}
//Debug::Arr($this->tmp_data['user'], 'TMP User Data: ', __FILE__, __LINE__, __METHOD__,10);
//Get system log data for joining.
if (count($this->tmp_data['user']) > 0) {
$filter_data['user_id'] = array_keys($this->tmp_data['user']);
//Filter only selected users, otherwise too many rows can be returned that wont be displayed.
$llf = TTnew('LogListFactory');
$llf->getSearchByCompanyIdAndArrayCriteria($this->getUserObject()->getCompany(), $filter_data, 5000);
Debug::Text(' Log Rows: ' . $llf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
$this->getProgressBarObject()->start($this->getAMFMessageID(), $llf->getRecordCount(), NULL, TTi18n::getText('Retrieving Data...'));
foreach ($llf as $key => $l_obj) {
$this->tmp_data['log'][$l_obj->getUser()][] = array_merge((array) $l_obj->getObjectAsArray($columns), array('total_log' => 1));
$this->getProgressBarObject()->set($this->getAMFMessageID(), $key);
}
//Debug::Arr($this->tmp_data['log'], 'TMP Log Data: ', __FILE__, __LINE__, __METHOD__,10);
}
return TRUE;
}
示例14: getArrayByListFactory
function getArrayByListFactory($lf, $include_blank = TRUE, $include_disabled = TRUE)
{
if (!is_object($lf)) {
return FALSE;
}
if ($include_blank == TRUE) {
$list[0] = '--';
}
foreach ($lf as $obj) {
if ($obj->getStatus() != 10) {
$status = '(' . Option::getByKey($obj->getStatus(), $obj->getOptions('status')) . ') ';
} else {
$status = NULL;
}
if ($include_disabled == TRUE or $include_disabled == FALSE and $obj->getStatus() == 10) {
$list[$obj->getID()] = $status . $obj->getName();
}
}
if (isset($list)) {
return $list;
}
return FALSE;
}
示例15: getMapURL
static function getMapURL($address1, $address2, $city, $province, $postal_code, $country, $service = 'google', $service_params = array())
{
if ($address1 == '' and $address2 == '') {
return FALSE;
}
$url = NULL;
//Expand the country code to the full country name?
if (strlen($country) == 2) {
$cf = TTnew('CompanyFactory');
$long_country = Option::getByKey($country, $cf->getOptions('country'));
if ($long_country != '') {
$country = $long_country;
}
}
if ($service == 'google') {
$base_url = 'maps.google.com/?z=16&q=';
$url = $base_url . urlencode($address1 . ' ' . $city . ' ' . $province . ' ' . $postal_code . ' ' . $country);
}
if ($url != '') {
return 'http://' . $url;
}
return FALSE;
}