本文整理汇总了PHP中Misc::getFullName方法的典型用法代码示例。如果您正苦于以下问题:PHP Misc::getFullName方法的具体用法?PHP Misc::getFullName怎么用?PHP Misc::getFullName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Misc
的用法示例。
在下文中一共展示了Misc::getFullName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getScheduleArray
function getScheduleArray($filter_data, $permission_children_ids = NULL)
{
global $current_user, $current_user_prefs;
//Get all schedule data by general filter criteria.
//Debug::Arr($filter_data, 'Filter Data: ', __FILE__, __LINE__, __METHOD__, 10);
if (!isset($filter_data['start_date']) or $filter_data['start_date'] == '') {
return FALSE;
}
if (!isset($filter_data['end_date']) or $filter_data['end_date'] == '') {
return FALSE;
}
$filter_data['start_date'] = TTDate::getBeginDayEpoch($filter_data['start_date']);
$filter_data['end_date'] = TTDate::getEndDayEpoch($filter_data['end_date']);
$schedule_shifts_index = array();
$branch_options = array();
//No longer needed, use SQL instead.
$department_options = array();
//No longer needed, use SQL instead.
$apf = TTnew('AbsencePolicyFactory');
$absence_policy_paid_type_options = $apf->getOptions('paid_type');
$max_i = 0;
$slf = TTnew('ScheduleListFactory');
$slf->getSearchByCompanyIdAndArrayCriteria($current_user->getCompany(), $filter_data);
Debug::text('Found Scheduled Rows: ' . $slf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
//Debug::Arr($absence_policy_paid_type_options, 'Paid Absences: ', __FILE__, __LINE__, __METHOD__, 10);
if ($slf->getRecordCount() > 0) {
$this->getProgressBarObject()->start($this->getAMFMessageID(), $slf->getRecordCount(), NULL, TTi18n::getText('Processing Committed Shifts...'));
$i = 0;
foreach ($slf as $s_obj) {
//Debug::text('Schedule ID: '. $s_obj->getId() .' User ID: '. $s_obj->getColumn('user_id') .' Start Time: '. $s_obj->getStartTime(), __FILE__, __LINE__, __METHOD__, 10);
if ($s_obj->getAbsencePolicyID() > 0) {
$absence_policy_name = $s_obj->getColumn('absence_policy');
} else {
$absence_policy_name = NULL;
//Must be NULL for it to appear as "N/A" in legacy interface.
}
$hourly_rate = Misc::MoneyFormat($s_obj->getColumn('user_wage_hourly_rate'), FALSE);
if ($s_obj->getAbsencePolicyID() > 0 and is_object($s_obj->getAbsencePolicyObject()) and in_array($s_obj->getAbsencePolicyObject()->getType(), $absence_policy_paid_type_options) == FALSE) {
//UnPaid Absence.
$total_time_wage = Misc::MoneyFormat(0);
} else {
$total_time_wage = Misc::MoneyFormat(bcmul(TTDate::getHours($s_obj->getColumn('total_time')), $hourly_rate), FALSE);
}
//$iso_date_stamp = TTDate::getISODateStamp($s_obj->getStartTime());
$iso_date_stamp = TTDate::getISODateStamp(strtotime($s_obj->getColumn('date_stamp')));
//$schedule_shifts[$iso_date_stamp][$s_obj->getColumn('user_id').$s_obj->getStartTime()] = array(
$schedule_shifts[$iso_date_stamp][$i] = array('id' => (int) $s_obj->getID(), 'pay_period_id' => (int) $s_obj->getColumn('pay_period_id'), 'user_id' => (int) $s_obj->getColumn('user_id'), 'user_created_by' => (int) $s_obj->getColumn('user_created_by'), 'user_full_name' => $s_obj->getColumn('user_id') > 0 ? Misc::getFullName($s_obj->getColumn('first_name'), NULL, $s_obj->getColumn('last_name'), FALSE, FALSE) : TTi18n::getText('OPEN'), 'first_name' => $s_obj->getColumn('user_id') > 0 ? $s_obj->getColumn('first_name') : TTi18n::getText('OPEN'), 'last_name' => $s_obj->getColumn('last_name'), 'title_id' => $s_obj->getColumn('title_id'), 'title' => $s_obj->getColumn('title'), 'group_id' => $s_obj->getColumn('group_id'), 'group' => $s_obj->getColumn('group'), 'default_branch_id' => $s_obj->getColumn('default_branch_id'), 'default_branch' => $s_obj->getColumn('default_branch'), 'default_department_id' => $s_obj->getColumn('default_department_id'), 'default_department' => $s_obj->getColumn('default_department'), 'job_id' => $s_obj->getColumn('job_id'), 'job' => $s_obj->getColumn('job'), 'job_status_id' => $s_obj->getColumn('job_status_id'), 'job_manual_id' => $s_obj->getColumn('job_manual_id'), 'job_branch_id' => $s_obj->getColumn('job_branch_id'), 'job_department_id' => $s_obj->getColumn('job_department_id'), 'job_group_id' => $s_obj->getColumn('job_group_id'), 'job_item_id' => $s_obj->getColumn('job_item_id'), 'job_item' => $s_obj->getColumn('job_item'), 'type_id' => 10, 'status_id' => (int) $s_obj->getStatus(), 'date_stamp' => TTDate::getAPIDate('DATE', strtotime($s_obj->getColumn('date_stamp'))), 'start_date_stamp' => defined('TIMETREX_API') ? TTDate::getAPIDate('DATE', $s_obj->getStartTime()) : $s_obj->getStartTime(), 'start_date' => defined('TIMETREX_API') ? TTDate::getAPIDate('DATE+TIME', $s_obj->getStartTime()) : $s_obj->getStartTime(), 'end_date' => defined('TIMETREX_API') ? TTDate::getAPIDate('DATE+TIME', $s_obj->getEndTime()) : $s_obj->getEndTime(), 'start_time' => defined('TIMETREX_API') ? TTDate::getAPIDate('TIME', $s_obj->getStartTime()) : $s_obj->getStartTime(), 'end_time' => defined('TIMETREX_API') ? TTDate::getAPIDate('TIME', $s_obj->getEndTime()) : $s_obj->getEndTime(), 'start_time_stamp' => $s_obj->getStartTime(), 'end_time_stamp' => $s_obj->getEndTime(), 'total_time' => $s_obj->getTotalTime(), 'hourly_rate' => $hourly_rate, 'total_time_wage' => $total_time_wage, 'note' => $s_obj->getColumn('note'), 'schedule_policy_id' => (int) $s_obj->getSchedulePolicyID(), 'absence_policy_id' => (int) $s_obj->getAbsencePolicyID(), 'absence_policy' => $absence_policy_name, 'branch_id' => (int) $s_obj->getBranch(), 'branch' => $s_obj->getColumn('branch'), 'department_id' => (int) $s_obj->getDepartment(), 'department' => $s_obj->getColumn('department'), 'created_by_id' => $s_obj->getCreatedBy(), 'created_date' => $s_obj->getCreatedDate(), 'updated_date' => $s_obj->getUpdatedDate());
//Make sure we add in permission columns.
$this->getPermissionColumns($schedule_shifts[$iso_date_stamp][$i], (int) $s_obj->getColumn('user_id'), $s_obj->getCreatedBy(), $permission_children_ids);
//$schedule_shifts_index[$iso_date_stamp][$s_obj->getColumn('user_id')][] = $s_obj->getColumn('user_id').$s_obj->getStartTime();
$schedule_shifts_index[$iso_date_stamp][$s_obj->getColumn('user_id')][] = $i;
unset($absence_policy_name);
$this->getProgressBarObject()->set($this->getAMFMessageID(), $slf->getCurrentRow());
$i++;
}
$max_i = $i;
unset($i);
$this->getProgressBarObject()->stop($this->getAMFMessageID());
//Debug::Arr($schedule_shifts, 'Committed Schedule Shifts: ', __FILE__, __LINE__, __METHOD__, 10);
//Debug::Arr($schedule_shifts_index, 'Committed Schedule Shifts Index: ', __FILE__, __LINE__, __METHOD__, 10);
} else {
$schedule_shifts = array();
}
unset($slf);
//Get holidays
//FIXME: What if there are two holiday policies, one that defaults to working, and another that defaults to not working, and they are assigned
//to two different groups of employees? For that matter what if the holiday policy isn't assigned to a specific user at all.
$holiday_data = array();
$hlf = TTnew('HolidayListFactory');
$hlf->getByCompanyIdAndStartDateAndEndDate($current_user->getCompany(), $filter_data['start_date'], $filter_data['end_date']);
Debug::text('Found Holiday Rows: ' . $hlf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
foreach ($hlf as $h_obj) {
if (is_object($h_obj->getHolidayPolicyObject()) and is_object($h_obj->getHolidayPolicyObject()->getAbsencePolicyObject())) {
$holiday_data[TTDate::getISODateStamp($h_obj->getDateStamp())] = array('status_id' => (int) $h_obj->getHolidayPolicyObject()->getDefaultScheduleStatus(), 'absence_policy_id' => $h_obj->getHolidayPolicyObject()->getAbsencePolicyID(), 'type_id' => $h_obj->getHolidayPolicyObject()->getAbsencePolicyObject()->getType(), 'absence_policy' => $h_obj->getHolidayPolicyObject()->getAbsencePolicyObject()->getName());
} else {
$holiday_data[TTDate::getISODateStamp($h_obj->getDateStamp())] = array('status_id' => 10);
//Working
}
}
unset($hlf);
$recurring_schedule_shifts = array();
$open_shift_conflict_index = array();
$rstlf = TTnew('RecurringScheduleTemplateListFactory');
//Order for this is critcal to working with OPEN shifts. OPEN shifts (user_id=0) must come last, so it can find all conflicting shifts that will override it.
//Also order by start_time so earlier shifts come first and therefore are the first to be overridden.
$rstlf->getSearchByCompanyIdAndArrayCriteria($current_user->getCompany(), $filter_data, NULL, NULL, NULL, array('c.start_date' => 'asc', 'cb.user_id' => 'desc', 'a.week' => 'asc', 'a.start_time' => 'asc'));
Debug::text('Found Recurring Schedule Template Rows: ' . $rstlf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
if ($rstlf->getRecordCount() > 0) {
$this->getProgressBarObject()->start($this->getAMFMessageID(), $rstlf->getRecordCount(), NULL, TTi18n::getText('Processing Recurring Shifts...'));
foreach ($rstlf as $rst_obj) {
//Debug::text('Recurring Schedule Template ID: '. $rst_obj->getID() , __FILE__, __LINE__, __METHOD__, 10);
$rst_obj->getShifts($filter_data['start_date'], $filter_data['end_date'], $holiday_data, $branch_options, $department_options, $max_i, $schedule_shifts, $schedule_shifts_index, $open_shift_conflict_index, $permission_children_ids);
$this->getProgressBarObject()->set($this->getAMFMessageID(), $rstlf->getCurrentRow());
}
$this->getProgressBarObject()->stop($this->getAMFMessageID());
} else {
Debug::text('DID NOT find Recurring Schedule for this time period: ', __FILE__, __LINE__, __METHOD__, 10);
}
unset($rstlf, $rst_obj, $open_shift_conflict_index);
//Debug::Arr($schedule_shifts, 'Schedule Shifts: ', __FILE__, __LINE__, __METHOD__, 10);
//.........这里部分代码省略.........
示例2: Pager
$mclf->getByCompanyIdAndUserIdAndFolder($current_user->getCompany(), $current_user->getId(), $filter_folder_id, $current_user_prefs->getItemsPerPage(), $page, NULL, $sort_array);
$pager = new Pager($mclf);
if ($mclf->getRecordCount() > 0) {
$object_name_options = $mclf->getOptions('object_name');
foreach ($mclf as $message) {
//Get user info
$user_id = NULL;
$user_full_name = NULL;
if ($filter_folder_id == 10) {
//Inbox
$user_id = $message->getColumn('from_user_id');
$user_full_name = Misc::getFullName($message->getColumn('from_first_name'), $message->getColumn('from_middle_name'), $message->getColumn('from_last_name'));
} else {
//Sent
$user_id = $message->getColumn('to_user_id');
$user_full_name = Misc::getFullName($message->getColumn('to_first_name'), $message->getColumn('to_middle_name'), $message->getColumn('to_last_name'));
}
$messages[] = array('id' => $message->getId(), 'parent_id' => $message->getParent(), 'object_type_id' => $message->getObjectType(), 'object_type' => Option::getByKey($message->getObjectType(), $object_name_options), 'object_id' => $message->getObject(), 'status_id' => $message->getStatus(), 'subject' => $message->getSubject(), 'body' => $message->getBody(), 'user_id' => $user_id, 'user_full_name' => $user_full_name, 'created_date' => $message->getCreatedDate(), 'created_by' => $message->getCreatedBy(), 'updated_date' => $message->getUpdatedDate(), 'updated_by' => $message->getUpdatedBy(), 'deleted_date' => $message->getDeletedDate(), 'deleted_by' => $message->getDeletedBy());
}
}
$smarty->assign_by_ref('messages', $messages);
$smarty->assign_by_ref('require_ack', $require_ack);
$smarty->assign_by_ref('show_ack_column', $show_ack_column);
$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->assign_by_ref('mf', $mf);
$smarty->assign_by_ref('folder_options', $folder_options);
$smarty->assign_by_ref('filter_folder_id', $filter_folder_id);
示例3: getShifts
//.........这里部分代码省略.........
if ($this->getColumn('user_id') > 0 and isset($shifts_index[$iso_date_stamp][$this->getColumn('user_id')])) {
//User has previous recurring schedule shifts, check for overlap.
//Loop over each employees shift for this day and check for conflicts
foreach ($shifts_index[$iso_date_stamp][$this->getColumn('user_id')] as $shift_key) {
if (isset($shifts[$iso_date_stamp][$shift_key])) {
//Must use parseDateTime() when called from the API due to date formats that strtotime() fails on.
if (TTDate::isTimeOverLap(defined('TIMETREX_API') ? TTDate::parseDateTime($shifts[$iso_date_stamp][$shift_key]['start_date']) : $shifts[$iso_date_stamp][$shift_key]['start_date'], defined('TIMETREX_API') ? TTDate::parseDateTime($shifts[$iso_date_stamp][$shift_key]['end_date']) : $shifts[$iso_date_stamp][$shift_key]['end_date'], $start_time, $end_time) == TRUE) {
//Debug::text(' Found overlapping recurring schedules! User ID: '. $this->getColumn('user_id') .' Start Time: '. $start_time,__FILE__, __LINE__, __METHOD__, 10);
continue 2;
}
}
}
unset($shift_key);
} elseif ($this->getColumn('user_id') == 0 and isset($shifts_index[$iso_date_stamp])) {
//Debug::text(' Checking OPEN shift conflicts... Date: '. $iso_date_stamp,__FILE__, __LINE__, __METHOD__, 10);
//Check all OPEN shifts for conflicts.
//This is special, since there can be multiple open shifts for the same branch,department,job,task, so we need to check if are conflicts with *any* employee.
//Do we allow conflicting shifts between committed and recurring OPEN shifts? For example what if there are two open shifts on the same day
//6AM-3PM (x2) and they want to override one of those shifts to 7AM-4PM? If we use this check:
// ( $shifts[$iso_date_stamp][$shift_key]['user_id'] > 0 OR ( isset($shifts[$iso_date_stamp][$shift_key]['id']) AND $shifts[$iso_date_stamp][$shift_key]['id'] > 0 ) )
//That allows committed OPEN shifts to override recurring open shifts, which is great, but it prevents adding additional open shifts that may
//also overlap unless they override all recurring shifts first. I think this is the trade-off we have to make as its more likely that they
//will adjust an open shift time rather than add/remove specific shifts. Removing recurring OPEN shifts can be done by making them ABSENT.
//This will also affect when recurring OPEN shifts are committed by preventing the shifts from doubling up.
foreach ($shifts_index[$iso_date_stamp] as $tmp_index_user_id => $tmp_index_arr) {
foreach ($tmp_index_arr as $shift_key) {
$tmp_start_date = defined('TIMETREX_API') ? TTDate::parseDateTime($shifts[$iso_date_stamp][$shift_key]['start_date']) : $shifts[$iso_date_stamp][$shift_key]['start_date'];
$tmp_end_date = defined('TIMETREX_API') ? TTDate::parseDateTime($shifts[$iso_date_stamp][$shift_key]['end_date']) : $shifts[$iso_date_stamp][$shift_key]['end_date'];
if (($shifts[$iso_date_stamp][$shift_key]['user_id'] > 0 or isset($shifts[$iso_date_stamp][$shift_key]['id']) and $shifts[$iso_date_stamp][$shift_key]['id'] > 0) and (!isset($open_shift_conflict_index['open'][$this->getID()][$shift_key]) and (isset($shifts[$iso_date_stamp][$shift_key]['id']) and !isset($open_shift_conflict_index['scheduled'][$shifts[$iso_date_stamp][$shift_key]['id']]))) and $this->getColumn('schedule_branch_id') == $shifts[$iso_date_stamp][$shift_key]['branch_id'] and $this->getColumn('schedule_department_id') == $shifts[$iso_date_stamp][$shift_key]['department_id'] and $this->getColumn('job_id') == $shifts[$iso_date_stamp][$shift_key]['job_id'] and $this->getColumn('job_item_id') == $shifts[$iso_date_stamp][$shift_key]['job_item_id'] and ($tmp_start_date == $start_time and $tmp_end_date == $end_time)) {
//Debug::text(' Found OPEN shift conflict... Skipping...! Shift Key: '. $shift_key,__FILE__, __LINE__, __METHOD__, 10);
//We need to track each shift_key that caused a conflict so it can't cause another conflict later on.
// Make sure we just track it on a per template basis though, otherwise the same $shift_key from a previous template can affect other templates.
// The above issue would show up as OPEN shifts not being overridden.
//We also need to track which scheduled shift that caused a conflict so it can't cause another one later on.
// This prevents a single scheduled shift from overriding multiple OPEN shifts of different times.
//However we need to be smarter about which shifts override which OPEN shifts...
// So if there are two open shifts, 10AM-4PM and 3:50PM-9PM, a 10AM-4PM scheduled shift overrides the OPEN shift that best fits it (10AM to 4PM, *not* 3:50-9PM)
// For now require an exact match to override an OPEN shift, if we start using partial schedules it gets much more complicated.
// Or we could introduce a hardcoded "fudge factor" setting (ie: 5 mins) that is always used instead.
$open_shift_conflict_index['open'][$this->getID()][$shift_key] = TRUE;
$open_shift_conflict_index['scheduled'][$shifts[$iso_date_stamp][$shift_key]['id']] = TRUE;
continue 3;
}
unset($tmp_start_date, $tmp_end_date);
}
}
unset($tmp_index_user_id, $tmp_index_arr);
}
//This check has to occurr after the committed schedule check, otherwise no committed schedules will appear.
if ($this->getColumn('recurring_schedule_control_start_date') != '' and $i < TTDate::strtotime($this->getColumn('recurring_schedule_control_start_date')) or $this->getColumn('recurring_schedule_control_end_date') != '' and $i > TTDate::strtotime($this->getColumn('recurring_schedule_control_end_date'))) {
//Debug::text('Skipping due to Recurring Schedule Start/End date: ID: '. $this->getColumn('id') .' User ID: '. $this->getColumn('user_id') .' I: '. $i .' Start Date: '. $this->getColumn('recurring_schedule_control_start_date') .' ('. TTDate::strtotime( $this->getColumn('recurring_schedule_control_start_date') ) .') End Date: '. $this->getColumn('recurring_schedule_control_end_date') ,__FILE__, __LINE__, __METHOD__, 10);
continue;
}
//Debug::text(' Start Date: '. TTDate::getDate('DATE+TIME', $start_time) .' End Date: '. TTDate::getDate('DATE+TIME', $end_time),__FILE__, __LINE__, __METHOD__, 10);
$status_id = $this->getColumn('status_id');
$absence_policy_id = $this->getColumn('absence_policy_id');
$absence_policy_type_id = $this->getColumn('absence_policy_type_id');
$absence_policy = $this->getColumn('absence_policy') != '' ? $this->getColumn('absence_policy') : NULL;
//Must be NULL to be converted to N/A
if (isset($holiday_data[$iso_date_stamp])) {
//We have to assume they are eligible, because we really won't know
//if they will have worked enough days or not. We could assume they
//work whatever their schedule is, but chances are they will be eligible then anyways.
//Debug::text(' Found Holiday on this day...',__FILE__, __LINE__, __METHOD__, 10);
$status_id = $holiday_data[$iso_date_stamp]['status_id'];
if (isset($holiday_data[$iso_date_stamp]['absence_policy_id'])) {
$absence_policy_id = $holiday_data[$iso_date_stamp]['absence_policy_id'];
$absence_policy_type_id = $holiday_data[$iso_date_stamp]['type_id'];
$absence_policy = $holiday_data[$iso_date_stamp]['absence_policy'];
}
}
$hourly_rate = Misc::MoneyFormat($this->getColumn('user_wage_hourly_rate'), FALSE);
if ($absence_policy_id > 0 and in_array($absence_policy_type_id, $absence_policy_paid_type_options) == FALSE) {
//UnPaid Absence.
$total_time_wage = Misc::MoneyFormat(0);
} else {
$total_time_wage = Misc::MoneyFormat(bcmul(TTDate::getHours($this->getTotalTime()), $hourly_rate), FALSE);
}
//Debug::text('I: '. $i .' N: '. $n .' User ID: '. $this->getColumn('user_id') .' Current Date: '. TTDate::getDate('DATE+TIME', $i) .' Current Week: '. $current_week .' Start Time: '. TTDate::getDate('DATE+TIME', $start_time ) .' Absence Policy: '. $absence_policy,__FILE__, __LINE__, __METHOD__, 10);
//$shifts[$iso_date_stamp][$this->getColumn('user_id').$start_time] = array(
$shifts[$iso_date_stamp][$n] = array('pay_period_id' => FALSE, 'user_id' => (int) $this->getColumn('user_id'), 'user_created_by' => $this->getColumn('user_created_by'), 'user_full_name' => $this->getColumn('user_id') > 0 ? Misc::getFullName($this->getColumn('first_name'), NULL, $this->getColumn('last_name'), FALSE, FALSE) : TTi18n::getText('OPEN'), 'first_name' => $this->getColumn('first_name'), 'last_name' => $this->getColumn('last_name'), 'title_id' => $this->getColumn('title_id'), 'title' => $this->getColumn('title'), 'group_id' => $this->getColumn('group_id'), 'group' => $this->getColumn('group'), 'default_branch_id' => $this->getColumn('default_branch_id'), 'default_branch' => $this->getColumn('default_branch'), 'default_department_id' => $this->getColumn('default_department_id'), 'default_department' => $this->getColumn('default_department'), 'job_id' => $this->getJob(), 'job' => $this->getColumn('job'), 'job_status_id' => $this->getColumn('job_status_id'), 'job_manual_id' => $this->getColumn('job_manual_id'), 'job_branch_id' => $this->getColumn('job_branch_id'), 'job_department_id' => $this->getColumn('job_department_id'), 'job_group_id' => $this->getColumn('job_group_id'), 'job_item_id' => $this->getJobItem(), 'job_item' => $this->getColumn('job_item'), 'type_id' => 20, 'status_id' => $status_id, 'date_stamp' => TTDate::getAPIDate('DATE', strtotime($iso_date_stamp)), 'start_date_stamp' => defined('TIMETREX_API') ? TTDate::getAPIDate('DATE', $start_time) : $start_time, 'start_date' => defined('TIMETREX_API') ? TTDate::getAPIDate('DATE+TIME', $start_time) : $start_time, 'end_date' => defined('TIMETREX_API') ? TTDate::getAPIDate('DATE+TIME', $end_time) : $end_time, 'start_time' => defined('TIMETREX_API') ? TTDate::getAPIDate('TIME', $start_time) : $start_time, 'end_time' => defined('TIMETREX_API') ? TTDate::getAPIDate('TIME', $end_time) : $end_time, 'start_time_stamp' => $start_time, 'end_time_stamp' => $end_time, 'total_time' => $this->getTotalTime(), 'hourly_rate' => $hourly_rate, 'total_time_wage' => $total_time_wage, 'note' => FALSE, 'schedule_policy_id' => $this->getSchedulePolicyID(), 'absence_policy_id' => $absence_policy_id, 'absence_policy' => $absence_policy, 'branch_id' => $this->getColumn('schedule_branch_id'), 'branch' => $this->getColumn('schedule_branch'), 'department_id' => $this->getColumn('schedule_department_id'), 'department' => $this->getColumn('schedule_department'), 'created_by_id' => $this->getColumn('recurring_schedule_control_created_by'), 'created_date' => $this->getCreatedDate(), 'updated_date' => $this->getUpdatedDate());
//Make sure we add in permission columns.
$this->getPermissionColumns($shifts[$iso_date_stamp][$n], (int) $this->getColumn('user_id'), $this->getColumn('recurring_schedule_control_created_by'), $permission_children_ids);
//$shifts_index[$iso_date_stamp][$this->getColumn('user_id')][] = $this->getColumn('user_id').$start_time;
$shifts_index[$iso_date_stamp][$this->getColumn('user_id')][] = $n;
$n++;
}
unset($open_shift_multiplier);
unset($start_time, $end_time);
} else {
//Debug::text(' NOT active shift on this day... ID: '. $this->getColumn('id') .' User ID: '. $this->getColumn('user_id') .' Start Time: '. TTDate::getDate('DATE+TIME', $i),__FILE__, __LINE__, __METHOD__, 10);
}
}
}
if (isset($shifts)) {
//Debug::Arr($shifts, 'Template Shifts: ',__FILE__, __LINE__, __METHOD__, 10);
return $shifts;
}
return FALSE;
}
示例4: getCreatedAndUpdatedColumns
function getCreatedAndUpdatedColumns(&$data, $include_columns = NULL)
{
//Update array in-place.
if ($include_columns == NULL or isset($include_columns['created_by_id']) and $include_columns['created_by_id'] == TRUE) {
$data['created_by_id'] = $this->getCreatedBy();
}
if ($include_columns == NULL or isset($include_columns['created_by']) and $include_columns['created_by'] == TRUE) {
$data['created_by'] = Misc::getFullName($this->getColumn('created_by_first_name'), $this->getColumn('created_by_middle_name'), $this->getColumn('created_by_last_name'));
}
if ($include_columns == NULL or isset($include_columns['created_date']) and $include_columns['created_date'] == TRUE) {
$data['created_date'] = TTDate::getAPIDate('DATE+TIME', $this->getCreatedDate());
}
if ($include_columns == NULL or isset($include_columns['updated_by_id']) and $include_columns['updated_by_id'] == TRUE) {
$data['updated_by_id'] = $this->getUpdatedBy();
}
if ($include_columns == NULL or isset($include_columns['updated_by']) and $include_columns['updated_by'] == TRUE) {
$data['updated_by'] = Misc::getFullName($this->getColumn('updated_by_first_name'), $this->getColumn('updated_by_middle_name'), $this->getColumn('updated_by_last_name'));
}
if ($include_columns == NULL or isset($include_columns['updated_date']) and $include_columns['updated_date'] == TRUE) {
$data['updated_date'] = TTDate::getAPIDate('DATE+TIME', $this->getUpdatedDate());
}
return TRUE;
}
示例5: getScheduleArray
function getScheduleArray($filter_data)
{
global $current_user, $current_user_prefs;
//Get all schedule data by general filter criteria.
Debug::Arr($filter_data, 'Filter Data: ', __FILE__, __LINE__, __METHOD__, 10);
if (!isset($filter_data['start_date']) or $filter_data['start_date'] == '') {
return FALSE;
}
if (!isset($filter_data['end_date']) or $filter_data['end_date'] == '') {
return FALSE;
}
$filter_data['start_date'] = TTDate::getBeginDayEpoch($filter_data['start_date']);
$filter_data['end_date'] = TTDate::getEndDayEpoch($filter_data['end_date']);
$blf = new BranchListFactory();
$branch_options = $blf->getByCompanyIdArray($current_user->getCompany(), FALSE);
$dlf = new DepartmentListFactory();
$department_options = $dlf->getByCompanyIdArray($current_user->getCompany(), FALSE);
$slf = new ScheduleListFactory();
$slf->getSearchByCompanyIdAndArrayCriteria($current_user->getCompany(), $filter_data);
Debug::text('Found Scheduled Rows: ' . $slf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
if ($slf->getRecordCount() > 0) {
foreach ($slf as $s_obj) {
Debug::text('Schedule ID: ' . $s_obj->getId() . ' User ID: ' . $s_obj->getColumn('user_id') . ' Start Time: ' . $s_obj->getStartTime(), __FILE__, __LINE__, __METHOD__, 10);
if (is_object($s_obj->getAbsencePolicyObject())) {
$absence_policy_name = (string) $s_obj->getAbsencePolicyObject()->getName();
} else {
$absence_policy_name = 'N/A';
}
$iso_date_stamp = TTDate::getISODateStamp($s_obj->getStartTime());
$schedule_shifts[$iso_date_stamp][$s_obj->getColumn('user_id') . $s_obj->getStartTime()] = array('id' => (int) $s_obj->getID(), 'user_id' => (int) $s_obj->getColumn('user_id'), 'user_created_by' => (int) $s_obj->getColumn('user_created_by'), 'user_full_name' => Misc::getFullName($s_obj->getColumn('first_name'), NULL, $s_obj->getColumn('last_name'), FALSE, FALSE), 'first_name' => $s_obj->getColumn('first_name'), 'last_name' => $s_obj->getColumn('last_name'), 'status_id' => (int) $s_obj->getStatus(), 'date_stamp' => TTDate::getAPIDate('DATE', TTDate::parseDateTime($s_obj->getColumn('date_stamp'))), 'start_date' => defined('TIMETREX_API') ? TTDate::getAPIDate('DATE+TIME', $s_obj->getStartTime()) : $s_obj->getStartTime(), 'end_date' => defined('TIMETREX_API') ? TTDate::getAPIDate('DATE+TIME', $s_obj->getEndTime()) : $s_obj->getEndTime(), 'start_time' => defined('TIMETREX_API') ? TTDate::getAPIDate('TIME', $s_obj->getStartTime()) : $s_obj->getStartTime(), 'end_time' => defined('TIMETREX_API') ? TTDate::getAPIDate('TIME', $s_obj->getEndTime()) : $s_obj->getEndTime(), 'total_time' => $s_obj->getTotalTime(), 'schedule_policy_id' => (int) $s_obj->getSchedulePolicyID(), 'absence_policy_id' => (int) $s_obj->getAbsencePolicyID(), 'absence_policy' => $absence_policy_name, 'branch_id' => (int) $s_obj->getBranch(), 'branch' => Option::getByKey($s_obj->getBranch(), $branch_options, NULL), 'department_id' => (int) $s_obj->getDepartment(), 'department' => Option::getByKey($s_obj->getDepartment(), $department_options, NULL));
$schedule_shifts_index[$iso_date_stamp][$s_obj->getColumn('user_id')][] = $s_obj->getColumn('user_id') . $s_obj->getStartTime();
unset($absence_policy_name);
}
//Debug::Arr($schedule_shifts, 'Committed Schedule Shifts: ', __FILE__, __LINE__, __METHOD__, 10);
//Debug::Arr($schedule_shifts_index, 'Committed Schedule Shifts Index: ', __FILE__, __LINE__, __METHOD__, 10);
} else {
$schedule_shifts = array();
}
unset($slf);
//Get holidays
//FIXME: What if there are two holiday policies, one that defaults to working, and another that defaults to not working, and they are assigned
//to two different groups of employees? For that matter what if the holiday policy isn't assigned to a specific user at all.
$holiday_data = array();
$hlf = new HolidayListFactory();
$hlf->getByCompanyIdAndStartDateAndEndDate($current_user->getCompany(), $filter_data['start_date'], $filter_data['end_date']);
Debug::text('Found Holiday Rows: ' . $hlf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
foreach ($hlf as $h_obj) {
if (is_object($h_obj->getHolidayPolicyObject()) and is_object($h_obj->getHolidayPolicyObject()->getAbsencePolicyObject())) {
$holiday_data[TTDate::getISODateStamp($h_obj->getDateStamp())] = array('status_id' => (int) $h_obj->getHolidayPolicyObject()->getDefaultScheduleStatus(), 'absence_policy_id' => $h_obj->getHolidayPolicyObject()->getAbsencePolicyID(), 'absence_policy' => $h_obj->getHolidayPolicyObject()->getAbsencePolicyObject()->getName());
} else {
$holiday_data[TTDate::getISODateStamp($h_obj->getDateStamp())] = array('status_id' => 10);
//Working
}
}
unset($hlf);
$recurring_schedule_shifts = array();
$recurring_schedule_shifts_index = array();
$rstlf = new RecurringScheduleTemplateListFactory();
$rstlf->getSearchByCompanyIdAndArrayCriteria($current_user->getCompany(), $filter_data);
Debug::text('Found Recurring Schedule Template Rows: ' . $rstlf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
if ($rstlf->getRecordCount() > 0) {
foreach ($rstlf as $rst_obj) {
//Debug::text('Recurring Schedule Template ID: '. $rst_obj->getID() , __FILE__, __LINE__, __METHOD__, 10);
$rst_obj->getShifts($filter_data['start_date'], $filter_data['end_date'], $holiday_data, $branch_options, $department_options, &$schedule_shifts, &$schedule_shifts_index);
}
} else {
Debug::text('DID NOT find Recurring Schedule for this time period: ', __FILE__, __LINE__, __METHOD__, 10);
}
//Debug::Arr($schedule_shifts, 'Schedule Shifts: ', __FILE__, __LINE__, __METHOD__, 10);
unset($schedule_shifts_index, $recurring_schedule_shifts_index);
if (isset($schedule_shifts)) {
return $schedule_shifts;
}
return FALSE;
}
示例6: getFullName
function getFullName($reverse = FALSE, $include_middle = TRUE)
{
return Misc::getFullName($this->getFirstName(), $this->getMiddleInitial(), $this->getLastName(), $reverse, $include_middle);
}
示例7: getObjectAsArray
function getObjectAsArray($include_columns = NULL, $permission_children_ids = FALSE)
{
$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 'type':
case 'term':
case 'severity':
case 'status':
$function = 'get' . $variable;
if (method_exists($this, $function)) {
$data[$variable] = Option::getByKey($this->{$function}(), $this->getOptions($variable));
}
break;
case 'user':
$data[$variable] = Misc::getFullName($this->getColumn('user_first_name'), NULL, $this->getColumn('user_last_name'), FALSE, FALSE);
break;
case 'reviewer_user':
$data[$variable] = Misc::getFullName($this->getColumn('reviewer_user_first_name'), NULL, $this->getColumn('reviewer_user_last_name'), FALSE, FALSE);
break;
case 'start_date':
$data['start_date'] = TTDate::getAPIDate('DATE', $this->getStartDate());
break;
case 'end_date':
$data['end_date'] = TTDate::getAPIDate('DATE', $this->getEndDate());
break;
case 'due_date':
$data['due_date'] = TTDate::getAPIDate('DATE', $this->getDueDate());
break;
default:
if (method_exists($this, $function)) {
$data[$variable] = $this->{$function}();
}
break;
}
}
}
$this->getPermissionColumns($data, $this->getUser(), $this->getCreatedBy(), $permission_children_ids, $include_columns);
$this->getCreatedAndUpdatedColumns($data, $include_columns);
}
return $data;
}
示例8: getFullName
function getFullName($reverse = FALSE, $include_middle = TRUE)
{
return Misc::getFullName($this->getFirstName(), $this->getMiddleInitial(), $this->getLastName(), $reverse, $include_middle);
/*
if ( $this->getFirstName() != '' AND $this->getLastName() != '' ) {
if ( $reverse === TRUE ) {
$retval = $this->getLastName() .', '. $this->getFirstName();
if ( $include_middle == TRUE AND $this->getMiddleInitial() != '' ) {
$retval .= ' '.$this->getMiddleInitial().'.';
}
} else {
$retval = $this->getFirstName() .' '. $this->getLastName();
}
return $retval;
}
return FALSE;
*/
}
示例9: _getData
function _getData($format = NULL)
{
$this->tmp_data = array('punch' => array(), 'user' => array(), 'verified_timesheet' => array());
$columns = $this->getColumnDataConfig();
$filter_data = $this->getFilterConfig();
if ($this->getPermissionObject()->Check('punch', '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('punch', 'view') == FALSE) {
if ($this->getPermissionObject()->Check('punch', 'view_child') == FALSE) {
$permission_children_ids = array();
}
if ($this->getPermissionObject()->Check('punch', '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);
$slf = TTnew('StationListFactory');
$station_type_options = $slf->getOptions('type');
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();
$plf = TTnew('PunchListFactory');
$punch_type_options = $plf->getOptions('type');
$plf->getPunchSummaryReportByCompanyIdAndArrayCriteria($this->getUserObject()->getCompany(), $filter_data);
Debug::Text(' Total Rows: ' . $plf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
$this->getProgressBarObject()->start($this->getAMFMessageID(), $plf->getRecordCount(), NULL, TTi18n::getText('Retrieving Data...'));
if ($plf->getRecordCount() > 0) {
foreach ($plf as $key => $p_obj) {
$pay_period_ids[$p_obj->getColumn('pay_period_id')] = TRUE;
if (!isset($this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')])) {
$hourly_rate = 0;
if ($wage_permission_children_ids === TRUE or in_array($p_obj->getColumn('user_id'), $wage_permission_children_ids)) {
$hourly_rate = $p_obj->getColumn('hourly_rate');
}
$actual_time_diff = (int) $p_obj->getColumn('actual_total_time') - (int) $p_obj->getColumn('total_time');
$this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')] = array('user_id' => $p_obj->getColumn('user_id'), 'user_group' => $p_obj->getColumn('group'), 'branch' => $p_obj->getColumn('branch'), 'department' => $p_obj->getColumn('department'), 'job' => $p_obj->getColumn('job'), 'job_status_id' => $p_obj->getColumn('job_status_id'), 'job_status' => Option::getByKey($p_obj->getColumn('job_status_id'), $job_status_options, NULL), 'job_manual_id' => $p_obj->getColumn('job_manual_id'), 'job_description' => $p_obj->getColumn('job_description'), 'job_branch' => $p_obj->getColumn('job_branch'), 'job_department' => $p_obj->getColumn('job_department'), 'job_group' => $p_obj->getColumn('job_group'), 'job_item' => $p_obj->getColumn('job_item'), 'job_other_id1' => $p_obj->getColumn('job_other_id1'), 'job_other_id2' => $p_obj->getColumn('job_other_id2'), 'job_other_id3' => $p_obj->getColumn('job_other_id3'), 'job_other_id4' => $p_obj->getColumn('job_other_id4'), 'job_other_id5' => $p_obj->getColumn('job_other_id5'), 'quantity' => $p_obj->getColumn('quantity'), 'bad_quantity' => $p_obj->getColumn('bad_quantity'), 'note' => $p_obj->getColumn('note'), 'total_time' => $p_obj->getColumn('total_time'), 'total_time_wage' => Misc::MoneyFormat(bcmul(TTDate::getHours($p_obj->getColumn('total_time')), $hourly_rate), FALSE), 'total_time_wage_burden' => Misc::MoneyFormat(bcmul(TTDate::getHours($p_obj->getColumn('total_time')), bcmul($hourly_rate, bcdiv($p_obj->getColumn('labor_burden_percent'), 100))), FALSE), 'total_time_wage_with_burden' => Misc::MoneyFormat(bcmul(TTDate::getHours($p_obj->getColumn('total_time')), bcmul($hourly_rate, bcadd(bcdiv($p_obj->getColumn('labor_burden_percent'), 100), 1))), FALSE), 'actual_total_time' => $p_obj->getColumn('actual_total_time'), 'actual_total_time_diff' => $actual_time_diff, 'actual_total_time_wage' => Misc::MoneyFormat(bcmul(TTDate::getHours($p_obj->getColumn('actual_total_time')), $hourly_rate), FALSE), 'actual_total_time_diff_wage' => Misc::MoneyFormat(bcmul(TTDate::getHours($actual_time_diff), $hourly_rate)), 'other_id1' => $p_obj->getColumn('other_id1'), 'other_id2' => $p_obj->getColumn('other_id2'), 'other_id3' => $p_obj->getColumn('other_id3'), 'other_id4' => $p_obj->getColumn('other_id4'), 'other_id5' => $p_obj->getColumn('other_id5'), 'date_stamp' => TTDate::strtotime($p_obj->getColumn('date_stamp')), 'in_time_stamp' => NULL, 'in_actual_time_stamp' => NULL, 'in_type' => NULL, 'out_time_stamp' => NULL, 'out_actual_time_stamp' => NULL, 'out_type' => NULL, 'user_wage_id' => $p_obj->getColumn('user_wage_id'), 'hourly_rate' => Misc::MoneyFormat($hourly_rate, FALSE), 'tainted' => 0, 'tainted_status' => NULL, 'in_station_type' => NULL, 'in_station_station_id' => NULL, 'in_station_source' => NULL, 'in_station_description' => NULL, 'out_station_type' => NULL, 'out_station_station_id' => NULL, 'out_station_source' => NULL, 'out_station_description' => NULL, 'pay_period_start_date' => strtotime($p_obj->getColumn('pay_period_start_date')), 'pay_period_end_date' => strtotime($p_obj->getColumn('pay_period_end_date')), 'pay_period_transaction_date' => strtotime($p_obj->getColumn('pay_period_transaction_date')), 'pay_period' => strtotime($p_obj->getColumn('pay_period_transaction_date')), 'pay_period_id' => $p_obj->getColumn('pay_period_id'), 'total_punch' => 0, 'total_tainted_punch' => 0);
}
if ($p_obj->getColumn('status_id') == 10) {
$this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['in_time_stamp'] = TTDate::strtotime($p_obj->getColumn('punch_time_stamp'));
$this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['in_type'] = Option::getByKey($p_obj->getColumn('type_id'), $punch_type_options, NULL);
$this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['in_actual_time_stamp'] = TTDate::strtotime($p_obj->getColumn('punch_actual_time_stamp'));
$this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['in_station_type'] = Option::getByKey($p_obj->getColumn('station_type_id'), $station_type_options, '--');
$this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['in_station_station_id'] = $p_obj->getColumn('station_station_id');
$this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['in_station_source'] = $p_obj->getColumn('station_source');
$this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['in_station_description'] = $p_obj->getColumn('station_description');
$this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['in_created_date'] = TTDate::strtotime($p_obj->getColumn('punch_created_date'));
$this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['in_created_by'] = Misc::getFullName($p_obj->getColumn('punch_created_by_first_name'), $p_obj->getColumn('punch_created_by_middle_name'), $p_obj->getColumn('punch_created_by_last_name'), FALSE, FALSE);
$this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['in_updated_date'] = TTDate::strtotime($p_obj->getColumn('punch_updated_date'));
$this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['in_updated_by'] = Misc::getFullName($p_obj->getColumn('punch_updated_by_first_name'), $p_obj->getColumn('punch_updated_by_middle_name'), $p_obj->getColumn('punch_updated_by_last_name'), FALSE, FALSE);
$this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['total_punch']++;
} else {
$this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['out_time_stamp'] = TTDate::strtotime($p_obj->getColumn('punch_time_stamp'));
$this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['out_type'] = Option::getByKey($p_obj->getColumn('type_id'), $punch_type_options, NULL);
$this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['out_actual_time_stamp'] = TTDate::strtotime($p_obj->getColumn('punch_actual_time_stamp'));
$this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['out_station_type'] = Option::getByKey($p_obj->getColumn('station_type_id'), $station_type_options, '--');
$this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['out_station_station_id'] = $p_obj->getColumn('station_station_id');
$this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['out_station_source'] = $p_obj->getColumn('station_source');
$this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['out_station_description'] = $p_obj->getColumn('station_description');
$this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['out_created_date'] = TTDate::strtotime($p_obj->getColumn('punch_created_date'));
$this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['out_created_by'] = Misc::getFullName($p_obj->getColumn('punch_created_by_first_name'), $p_obj->getColumn('punch_created_by_middle_name'), $p_obj->getColumn('punch_created_by_last_name'), FALSE, FALSE);
$this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['out_updated_date'] = TTDate::strtotime($p_obj->getColumn('punch_updated_date'));
$this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['out_updated_by'] = Misc::getFullName($p_obj->getColumn('punch_updated_by_first_name'), $p_obj->getColumn('punch_updated_by_middle_name'), $p_obj->getColumn('punch_updated_by_last_name'), FALSE, FALSE);
$this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['total_punch']++;
}
if ($p_obj->getTainted() == TRUE) {
$this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['tainted'] = 1;
$this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['total_tainted_punch']++;
if ($this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['tainted_status'] !== NULL) {
$this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['tainted_status'] = TTi18n::getText('Both (In&Out)');
} else {
if ($p_obj->getColumn('status_id') == 10) {
$this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['tainted_status'] = TTi18n::getText('In');
} else {
$this->tmp_data['punch'][$p_obj->getColumn('user_id')][$p_obj->getColumn('punch_control_id')]['tainted_status'] = TTi18n::getText('Out');
}
//.........这里部分代码省略.........
示例10: getShifts
function getShifts($start_date, $end_date, &$holiday_data = array(), &$branch_options = array(), &$department_options = array(), &$shifts = array(), &$shifts_index = array())
{
//Debug::text('Start Date: '. TTDate::getDate('DATE+TIME', $start_date) .' End Date: '. TTDate::getDate('DATE+TIME', $end_date), __FILE__, __LINE__, __METHOD__, 10);
$recurring_schedule_control_start_date = TTDate::strtotime($this->getColumn('recurring_schedule_control_start_date'));
//Debug::text('Recurring Schedule Control Start Date: '. TTDate::getDate('DATE+TIME', $recurring_schedule_control_start_date),__FILE__, __LINE__, __METHOD__, 10);
$current_template_week = $this->getColumn('remapped_week');
$max_week = $this->getColumn('max_week');
//Debug::text('Template Week: '. $current_template_week .' Max Week: '. $this->getColumn('max_week') .' ReMapped Week: '. $this->getColumn('remapped_week') ,__FILE__, __LINE__, __METHOD__, 10);
if ($recurring_schedule_control_start_date == '') {
return FALSE;
}
//Get week of start_date
$start_date_week = TTDate::getWeek($recurring_schedule_control_start_date, 0);
//Start week on Sunday to match Recurring Schedule.
//Debug::text('Week of Start Date: '. $start_date_week ,__FILE__, __LINE__, __METHOD__, 10);
for ($i = $start_date; $i <= $end_date; $i += 86400 + 43200) {
//Handle DST by adding 12hrs to the date to get the mid-day epoch, then forcing it back to the beginning of the day.
$i = TTDate::getBeginDayEpoch($i);
if ($this->getColumn('hire_date') != '' and $i <= $this->getColumn('hire_date') or $this->getColumn('termination_date') != '' and $i > $this->getColumn('termination_date')) {
//Debug::text('Skipping due to Hire/Termination date: User ID: '. $this->getColumn('user_id') .' I: '. $i .' Hire Date: '. $this->getColumn('hire_date') .' Termination Date: '. $this->getColumn('termination_date') ,__FILE__, __LINE__, __METHOD__, 10);
continue;
}
$current_week = TTDate::getWeek($i, 0);
//Start week on Sunday to match Recurring Schedule.
//Debug::text('I: '. $i .' User ID: '. $this->getColumn('user_id') .' Current Date: '. TTDate::getDate('DATE+TIME', $i) .' Current Week: '. $current_week,__FILE__, __LINE__, __METHOD__, 10);
$template_week = abs($current_week - $start_date_week) % $max_week + 1;
//Debug::text('Template Week: '. $template_week .' Max Week: '. $max_week,__FILE__, __LINE__, __METHOD__, 10);
if ($template_week == $current_template_week) {
//Debug::text('Current Date: '. TTDate::getDate('DATE+TIME', $i) .' Current Week: '. $current_week,__FILE__, __LINE__, __METHOD__, 10);
//Debug::text(' Template Week: '. $template_week .' Max Week: '. $max_week,__FILE__, __LINE__, __METHOD__, 10);
if ($this->isActiveShiftDay($i)) {
//Debug::text(' Active Shift on this day...',__FILE__, __LINE__, __METHOD__, 10);
$iso_date_stamp = TTDate::getISODateStamp($i);
$start_time = TTDate::getTimeLockedDate($this->getStartTime(), $i);
$end_time = TTDate::getTimeLockedDate($this->getEndTime(), $i);
if ($end_time < $start_time) {
//Spans the day boundary, add 86400 to end_time
$end_time = $end_time + 86400;
//Debug::text(' Schedule spans day boundary, bumping endtime to next day: ',__FILE__, __LINE__, __METHOD__, 10);
}
if (isset($shifts_index[$iso_date_stamp][$this->getColumn('user_id')])) {
//User has previous recurring schedule shifts, check for overlap.
//Loop over each employees shift for this day and check for conflicts
foreach ($shifts_index[$iso_date_stamp][$this->getColumn('user_id')] as $shift_key) {
if (isset($shifts[$iso_date_stamp][$shift_key])) {
if (TTDate::isTimeOverLap($shifts[$iso_date_stamp][$shift_key]['start_time'], $shifts[$iso_date_stamp][$shift_key]['end_time'], $start_time, $end_time) == TRUE) {
//Debug::text(' Found overlapping recurring schedules! User ID: '. $this->getColumn('user_id') .' Start Time: '. $start_time,__FILE__, __LINE__, __METHOD__, 10);
continue 2;
}
}
}
unset($shift_key);
}
//This check has to occurr after the committed schedule check, otherwise no committed schedules will appear.
if ($this->getColumn('recurring_schedule_control_start_date') != '' and $i < TTDate::strtotime($this->getColumn('recurring_schedule_control_start_date')) or $this->getColumn('recurring_schedule_control_end_date') != '' and $i > TTDate::strtotime($this->getColumn('recurring_schedule_control_end_date'))) {
//Debug::text('Skipping due to Recurring Schedule Start/End date: ID: '. $this->getColumn('id') .' User ID: '. $this->getColumn('user_id') .' I: '. $i .' Start Date: '. $this->getColumn('recurring_schedule_control_start_date') .' ('. TTDate::strtotime( $this->getColumn('recurring_schedule_control_start_date') ) .') End Date: '. $this->getColumn('recurring_schedule_control_end_date') ,__FILE__, __LINE__, __METHOD__, 10);
continue;
}
//Debug::text(' Start Date: '. TTDate::getDate('DATE+TIME', $start_time) .' End Date: '. TTDate::getDate('DATE+TIME', $end_time),__FILE__, __LINE__, __METHOD__, 10);
$status_id = 10;
//Working
$absence_policy_id = FALSE;
$absence_policy = NULL;
if (isset($holiday_data[$iso_date_stamp])) {
//We have to assume they are eligible, because we really won't know
//if they will have worked enough days or not. We could assume they
//work whatever their schedule is, but chances are they will be eligible then anyways.
Debug::text(' Found Holiday on this day...', __FILE__, __LINE__, __METHOD__, 10);
$status_id = $holiday_data[$iso_date_stamp]['status_id'];
if (isset($holiday_data[$iso_date_stamp]['absence_policy_id'])) {
$absence_policy_id = $holiday_data[$iso_date_stamp]['absence_policy_id'];
$absence_policy = $holiday_data[$iso_date_stamp]['absence_policy'];
}
}
//Debug::text('I: '. $i .' User ID: '. $this->getColumn('user_id') .' Current Date: '. TTDate::getDate('DATE+TIME', $i) .' Current Week: '. $current_week .' Start Time: '. TTDate::getDate('DATE+TIME', $start_time ),__FILE__, __LINE__, __METHOD__, 10);
$shifts[$iso_date_stamp][$this->getColumn('user_id') . $start_time] = array('user_id' => $this->getColumn('user_id'), 'user_full_name' => Misc::getFullName($this->getColumn('first_name'), NULL, $this->getColumn('last_name'), FALSE, FALSE), 'user_created_by' => $this->getColumn('user_created_by'), 'status_id' => $status_id, 'date_stamp' => TTDate::getAPIDate('DATE', $start_time), 'start_date' => defined('TIMETREX_API') ? TTDate::getAPIDate('DATE+TIME', $start_time) : $start_time, 'end_date' => defined('TIMETREX_API') ? TTDate::getAPIDate('DATE+TIME', $end_time) : $end_time, 'start_time' => defined('TIMETREX_API') ? TTDate::getAPIDate('TIME', $start_time) : $start_time, 'end_time' => defined('TIMETREX_API') ? TTDate::getAPIDate('TIME', $end_time) : $end_time, 'total_time' => $this->getTotalTime(), 'schedule_policy_id' => $this->getSchedulePolicyID(), 'absence_policy_id' => $absence_policy_id, 'absence_policy' => $absence_policy, 'branch_id' => $this->getColumn('schedule_branch_id'), 'branch' => Option::getByKey($this->getColumn('schedule_branch_id'), $branch_options, NULL), 'department_id' => $this->getColumn('schedule_department_id'), 'department' => Option::getByKey($this->getColumn('schedule_department_id'), $department_options, NULL), 'job_id' => $this->getJob(), 'job_item_id' => $this->getJobItem());
$shifts_index[$iso_date_stamp][$this->getColumn('user_id')][] = $this->getColumn('user_id') . $start_time;
unset($start_time, $end_time);
} else {
//Debug::text(' NOT active shift on this day... ID: '. $this->getColumn('id') .' User ID: '. $this->getColumn('user_id') .' Start Time: '. TTDate::getDate('DATE+TIME', $i),__FILE__, __LINE__, __METHOD__, 10);
}
}
}
if (isset($shifts)) {
//Debug::Arr($shifts, 'Template Shifts: ',__FILE__, __LINE__, __METHOD__, 10);
return $shifts;
}
return FALSE;
}