本文整理汇总了PHP中TTDate::getDate方法的典型用法代码示例。如果您正苦于以下问题:PHP TTDate::getDate方法的具体用法?PHP TTDate::getDate怎么用?PHP TTDate::getDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TTDate
的用法示例。
在下文中一共展示了TTDate::getDate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_getDate
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
function smarty_function_getDate($params, &$smarty)
{
$type = $params['type'];
$epoch = $params['epoch'];
$nodst = $params['nodst'];
//var_dump($epoch);
//echo "Epoch: $epoch<br>\n";
$default = $params['default'];
//var_dump($default);
if ($default == 'TRUE') {
$default = '--';
} else {
$default = NULL;
}
if ((int) $epoch == 0) {
return $default;
}
$retval = TTDate::getDate($type, $epoch, $nodst);
return $retval;
}
示例2: smarty_function_calendar
//.........这里部分代码省略.........
}
if (empty($params['month'])) {
trigger_error('mandatory param is empty: month', E_USER_ERROR);
}
// The 'day' param is optional.
// End input validation
$url_format = $params['url_format'];
$year = $params['year'];
$month = $params['month'];
$day = $params['day'];
if ($day != '') {
$selected_date = mktime(0, 0, 0, $month, $day, $year);
}
$prev_month_end = mktime(0, 0, 0, $month, 0, $year);
$next_month_begin = mktime(0, 0, 0, $month + 1, 1, $year);
$month_name = strftime('%B', mktime(0, 0, 0, $month, 1, $year));
$prev_month_abbrev = strftime('%b', $prev_month_end);
$prev_month_end_info = getdate($prev_month_end);
$prev_month = $prev_month_end_info['mon'];
$prev_month_year = $prev_month_end_info['year'];
$prev_month_url = strftime("{$url_format}", $prev_month_end);
$next_month_abbrev = strftime('%b', $next_month_begin);
$next_month_url = strftime("{$url_format}", $next_month_begin);
// TODO: make "week starts on" configurable: Monday vs. Sunday
$day_of_week_abbrevs = array();
for ($i = 0; $i < 7; $i++) {
$day_of_week_abbrevs[] = smarty_function_calendar__day_of_week_abbrev($i);
}
// Build a two-dimensional array of UNIX timestamps.
$calendar = array();
// Start the first row with the final day(s) of the previous month.
$week = array();
$month_begin = mktime(0, 0, 0, $month, 1, $year);
$month_begin_day_of_week = strftime('%w', $month_begin);
$days_in_prev_month = smarty_function_calendar__days_in_month($prev_month, $prev_month_year);
for ($day_of_week = 0; $day_of_week < $month_begin_day_of_week; $day_of_week++) {
$day = $days_in_prev_month - $month_begin_day_of_week + $day_of_week;
$week[] = mktime(0, 0, 0, $month - 1, $day, $year);
}
// Fill in the days of the selected month.
$days_in_month = smarty_function_calendar__days_in_month($month, $year);
for ($i = 1; $i <= $days_in_month; $i++) {
if ($day_of_week == 7) {
$calendar[] = $week;
// re-initialize $day_of_week and $week
$day_of_week = 0;
unset($week);
$week = array();
}
$week[] = mktime(0, 0, 0, $month, $i, $year);
$day_of_week++;
}
// Fill out the last row with the first day(s) of the next month.
for ($i = 1; $day_of_week < 7; $i++, $day_of_week++) {
$week[] = mktime(0, 0, 0, $month + 1, $i, $year);
}
$calendar[] = $week;
// Generate the URL for today, which will be null if $selected_date is
// today.
$today = getdate();
$today_date = mktime(0, 0, 0, $today['mon'], $today['mday'], $today['year']);
if ($selected_date == $today_date) {
$today_url = '';
} else {
$today_url = strftime($url_format, $today_date);
}
/*
$calendar_smarty = new Smarty;
// Copy the configuration of the enclosing Smarty template.
$calendar_smarty->template_dir = $smarty->template_dir;
$calendar_smarty->compile_dir = $smarty->compile_dir;
$calendar_smarty->config_dir = $smarty->config_dir;
$calendar_smarty->plugins_dir = $smarty->plugins_dir;
$calendar_smarty->debugging = $smarty->debugging;
$calendar_smarty->compile_check = $smarty->compile_check;
$calendar_smarty->force_compile = $smarty->force_compile;
$calendar_smarty->cache_dir = $smarty->cache_dir;
$calendar_smarty->cache_dir = $smarty->cache_dir;
$calendar_smarty->cache_lifetime = $smarty->cache_lifetime;
*/
$smarty->assign('url_format', $url_format);
$smarty->assign('month_name', $month_name);
$smarty->assign('selected_date', $selected_date);
$smarty->assign('month', $month);
$smarty->assign('year', $year);
$smarty->assign('prev_month_end', $prev_month_end);
$smarty->assign('prev_month_abbrev', $prev_month_abbrev);
$smarty->assign('next_month_begin', $next_month_begin);
$smarty->assign('next_month_abbrev', $next_month_abbrev);
$smarty->assign('day_of_week_abbrevs', $day_of_week_abbrevs);
$smarty->assign('calendar', $calendar);
$smarty->assign('today_url', $today_url);
$smarty->assign('show_date', $params['show_date']);
$smarty->assign('show_time', $params['show_time']);
$smarty->assign('time', $params['time']);
$smarty->assign('form_element', $params['form_element']);
$smarty->assign('date', TTDate::getDate('DATE', $selected_date));
$smarty->display('calendar:month');
}
示例3: setClientLog
function setClientLog($data)
{
global $config_vars;
if (!is_array($data) or count($data) == 0) {
return FALSE;
}
ksort($data);
$base_dir = $config_vars['path']['log'] . DIRECTORY_SEPARATOR . 'client' . DIRECTORY_SEPARATOR;
$upload_time = time();
Debug::Text('Setting Log Lines: ' . count($data), __FILE__, __LINE__, __METHOD__, 10);
//Binary data could be coming in through this. Eric should Base64 encode his end
//And Decode it here.
//Log all data to log files based on station IDs. If no station id (ie: no probes plugged in)
//Use IP address and send to a "generic" log.
foreach ($data as $row_key => $row) {
//Debug::Text('Row Key: '. $row_key .' Date/Time: '. TTDate::getDate('DATE+TIME', $row['epoch']) .' Verbosity: '. $row['verbosity'] .' Station ID: '. $row['station_id'] .' Text: '. $row['msg'], __FILE__, __LINE__, __METHOD__,10);
if ($row['station_id'] == '') {
$station_id = 'no_station_id';
} else {
$station_id = $row['station_id'];
}
$retarr[$station_id][] = '[' . TTDate::getDate('DATE+TIME', $row['epoch']) . '] (' . $row['verbosity'] . ') - ' . $row['msg'] . "\n";
}
foreach ($retarr as $station_id => $line_arr) {
array_unshift($line_arr, '---------------- Data Uploaded By: ' . $_SERVER['REMOTE_ADDR'] . ' At: ' . TTDate::getDate('DATE+TIME', $upload_time) . ' ----------------' . "\n");
Debug::Text('Station ID: ' . $station_id, __FILE__, __LINE__, __METHOD__, 10);
if ($station_id != 'no_station_id') {
//Get Company Short name for station_id
$slf = new StationListFactory();
$slf->getByStationID($station_id);
if ($slf->getRecordCount() > 0) {
$s_obj = $slf->getCurrent();
$company_name = $s_obj->getCompanyObject()->getShortName();
//FIXME: Check to make sure the company is still active before proceeding.
} else {
$company_name = 'no_company';
}
unset($slf, $s_obj);
} else {
$company_name = 'no_company';
}
$dir = $base_dir . preg_replace('/[^a-zA-Z0-9]/', '', escapeshellarg(trim($company_name))) . DIRECTORY_SEPARATOR;
//Remove all non-alphanumeric chars.
if (!file_exists($dir)) {
mkdir($dir);
}
$file_name = $dir . $station_id;
Debug::Text('Company Name: ' . $company_name . ' File Name: ' . $file_name, __FILE__, __LINE__, __METHOD__, 10);
file_put_contents($file_name, $line_arr, FILE_APPEND);
unset($company_name);
}
return TRUE;
}
示例4: postSave
function postSave()
{
if ($this->getEnableTimeSheetVerificationCheck()) {
//Check to see if schedule is verified, if so unverify it on modified punch.
//Make sure exceptions are calculated *after* this so TimeSheet Not Verified exceptions can be triggered again.
if (is_object($this->getUserDateObject()) and is_object($this->getUserDateObject()->getPayPeriodObject()) and is_object($this->getUserDateObject()->getPayPeriodObject()->getPayPeriodScheduleObject()) and $this->getUserDateObject()->getPayPeriodObject()->getPayPeriodScheduleObject()->getTimeSheetVerifyType() != 10) {
//Find out if timesheet is verified or not.
$pptsvlf = TTnew('PayPeriodTimeSheetVerifyListFactory');
$pptsvlf->getByPayPeriodIdAndUserId($this->getUserDateObject()->getPayPeriod(), $this->getUserDateObject()->getUser());
if ($pptsvlf->getRecordCount() > 0) {
//Pay period is verified, delete all records and make log entry.
//These can be added during the maintenance jobs, so the audit records are recorded as user_id=0, check those first.
Debug::text('Pay Period is verified, deleting verification records: ' . $pptsvlf->getRecordCount() . ' User ID: ' . $this->getUserDateObject()->getUser() . ' Pay Period ID: ' . $this->getUserDateObject()->getPayPeriod(), __FILE__, __LINE__, __METHOD__, 10);
foreach ($pptsvlf as $pptsv_obj) {
TTLog::addEntry($pptsv_obj->getId(), 500, TTi18n::getText('Schedule Modified After Verification') . ': ' . UserListFactory::getFullNameById($this->getUserDateObject()->getUser()) . ' ' . TTi18n::getText('Schedule') . ': ' . TTDate::getDate('DATE', $this->getStartTime()), NULL, $pptsvlf->getTable());
$pptsv_obj->setDeleted(TRUE);
if ($pptsv_obj->isValid()) {
$pptsv_obj->Save();
}
}
}
}
}
if ($this->getEnableReCalculateDay() == TRUE) {
//Calculate total time. Mainly for docked.
//Calculate entire week as Over Schedule (Weekly) OT policy needs to be reapplied if the schedule changes.
if (is_object($this->getUserDateObject()) and $this->getUserDateObject()->getUser() > 0) {
//When shifts are assigned to different days, we need to calculate both days the schedule touches, as the shift could be assigned to either of them.
UserDateTotalFactory::smartReCalculate($this->getUserDateObject()->getUser(), array($this->getUserDateID(), $this->getOldUserDateID(), UserDateFactory::findOrInsertUserDate($this->getUserDateObject()->getUser(), $this->getStartTime()), UserDateFactory::findOrInsertUserDate($this->getUserDateObject()->getUser(), $this->getEndTime())), TRUE, FALSE);
}
}
return TRUE;
}
示例5: strtotime
$data['start_full_time_stamp'] = NULL;
$data['end_full_time_stamp'] = NULL;
}
if ($data['start_date_stamp'] != '') {
$data['start_date_stamp'] = TTDate::parseDateTime($data['start_date_stamp']);
}
if ($data['end_date_stamp'] != '') {
$data['end_date_stamp'] = TTDate::parseDateTime($data['end_date_stamp']);
}
if ($data['start_time'] != '') {
$data['parsed_start_time'] = TTDate::strtotime($data['start_time'], $data['start_date_stamp']);
}
if ($data['end_time'] != '') {
Debug::Text('End Time: ' . $data['end_time'] . ' Date Stamp: ' . $data['start_date_stamp'], __FILE__, __LINE__, __METHOD__, 10);
$data['parsed_end_time'] = strtotime($data['end_time'], $data['start_date_stamp']);
Debug::Text('bEnd Time: ' . $data['end_time'] . ' - ' . TTDate::getDate('DATE+TIME', $data['end_time']), __FILE__, __LINE__, __METHOD__, 10);
}
}
//Get Permission Hierarchy Children first, as this can be used for viewing, or editing.
$hlf = TTnew('HierarchyListFactory');
$permission_children_ids = $hlf->getHierarchyChildrenByCompanyIdAndUserIdAndObjectTypeID($current_company->getId(), $current_user->getId());
//Debug::Arr($permission_children_ids,'Permission Children Ids:', __FILE__, __LINE__, __METHOD__,10);
$filter_data = array();
if ($permission->Check('schedule', 'edit') == FALSE) {
if ($permission->Check('schedule', 'edit_child')) {
$filter_data['permission_children_ids'] = $permission_children_ids;
}
if ($permission->Check('schedule', 'edit_own')) {
$filter_data['permission_children_ids'][] = $current_user->getId();
}
}
示例6: elseif
//-1 from end time to handle a 12:00AM end time without going to next day.
Debug::text(' aSchedule Spans the Day boundary!', __FILE__, __LINE__, __METHOD__, 10);
$day_schedule_shift['span_day'] = TRUE;
$min_hour = 0;
$max_hour = 24;
}
if ($day_schedule_shift['span_day'] == TRUE) {
//Cut shift into two days.
$tmp_schedule_shift_day1 = $tmp_schedule_shift_day2 = $day_schedule_shift;
$tmp_schedule_shift_day1['span_day_split'] = TRUE;
$tmp_schedule_shift_day1['end_time'] = TTDate::getEndDayEpoch($day_schedule_shift['start_time']) + 1;
$tmp_schedule_shift_day2['start_time'] = TTDate::getBeginDayEpoch($day_schedule_shift['end_time']);
$tmp_schedule_shift_day2['span_day_split'] = FALSE;
$tmp_schedule_shifts[$day_epoch][$day_schedule_shift['branch']][$day_schedule_shift['department']][$day_schedule_shift['user_id']][] = $tmp_schedule_shift_day1;
$tmp_schedule_shifts[$tmp_schedule_shift_day2['start_time']][$day_schedule_shift['branch']][$day_schedule_shift['department']][$day_schedule_shift['user_id']][] = $tmp_schedule_shift_day2;
Debug::text(' Shift SPans the Day Boundary: First End Date: ' . TTDate::getDate('DATE+TIME', $tmp_schedule_shift_day1['end_time']) . ' Second Start Date: ' . TTDate::getDate('DATE+TIME', $tmp_schedule_shift_day2['start_time']), __FILE__, __LINE__, __METHOD__, 10);
} else {
$tmp_schedule_shifts[$day_epoch][$day_schedule_shift['branch']][$day_schedule_shift['department']][$day_schedule_shift['user_id']][] = $day_schedule_shift;
}
//$schedule_shifts[$day_epoch][] = $day_schedule_shift;
if ($day_schedule_shift['status_id'] == 10) {
//Working
if (isset($schedule_shift_totals[$day_epoch]['total_time'])) {
$schedule_shift_totals[$day_epoch]['total_time'] += $day_schedule_shift['total_time'];
} else {
$schedule_shift_totals[$day_epoch]['total_time'] = $day_schedule_shift['total_time'];
}
$schedule_shift_totals[$day_epoch]['users'][] = $day_schedule_shift['user_id'];
} elseif ($day_schedule_shift['status_id'] == 20) {
//Absent
if (isset($schedule_shift_totals[$day_epoch]['absent_total_time'])) {
示例7: InitProgressBar
InitProgressBar();
$init_progress_bar = FALSE;
}
$progress_bar->setValue(0);
$progress_bar->display();
$apf = TTnew('AccrualPolicyFactory');
$aplf = TTnew('AccrualPolicyListFactory');
$aplf->getByIdAndCompanyId((int) $data['accrual_policy_id'], $current_company->getId());
if ($aplf->getRecordCount() > 0) {
foreach ($aplf as $ap_obj) {
$aplf->StartTransaction();
TTLog::addEntry($current_user->getId(), 500, 'Recalculate Accrual Policy: ' . $ap_obj->getName() . ' Start Date: ' . TTDate::getDate('TIME', $data['start_date']) . ' End Date: ' . TTDate::getDate('TIME', $data['end_date']) . ' Total Days: ' . round($total_days), $current_user->getId(), $ap_obj->getTable());
$x = 0;
for ($i = $start_date; $i < $end_date; $i += 86400) {
//$i = TTDate::getBeginDayEpoch( $i ); //This causes infinite loops during DST transitions.
Debug::Text('Recalculating Accruals for Date: ' . TTDate::getDate('DATE+TIME', TTDate::getBeginDayEpoch($i)), __FILE__, __LINE__, __METHOD__, 10);
$ap_obj->addAccrualPolicyTime(TTDate::getBeginDayEpoch($i), $offset);
$progress_bar->setValue(Misc::calculatePercent($x, $total_days));
$progress_bar->display();
$x++;
}
//$aplf->FailTransaction();
$aplf->CommitTransaction();
}
}
$progress_bar->setValue(100);
$progress_bar->display();
}
}
break;
default:
示例8: scheduleFooter
function scheduleFooter()
{
global $config_vars;
$margins = $this->pdf->getMargins();
//Don't scale footer text lines as they aren't that important anyways.
$this->pdf->SetFont($this->config['other']['default_font'], '', 8);
//Save x,y and restore after footer is set.
$x = $this->pdf->getX();
$y = $this->pdf->getY();
//Jump to end of page.
if ($this->pdf->getPageHeight() - $margins['bottom'] - $margins['top'] - 15 > $y) {
$this->pdf->setY($this->pdf->getPageHeight() - $margins['bottom'] - $margins['top'] - 15);
}
$company_obj = $this->getUserObject()->getCompanyObject();
if (is_object($company_obj) and $company_obj->getProductEdition() > 10) {
if ($config_vars['other']['force_ssl'] == 1) {
$protocol = 'https';
} else {
$protocol = 'http';
}
$url = $protocol . '://' . Misc::getHostName() . Environment::getBaseURL() . 'ical/ical.php';
$this->pdf->Cell($this->pdf->getPageWidth() - $margins['right'] - $margins['left'], 5, TTi18n::getText('Synchronize this schedule to your desktop/mobile phone calendar application') . ': ' . $url, 1, 0, 'C', 0, NULL, 1);
$this->pdf->Ln();
}
$this->pdf->SetFont($this->config['other']['default_font'], '', 8);
$this->pdf->Cell($this->pdf->getPageWidth() - $margins['right'], 5, TTi18n::getText('Page') . ' ' . $this->pdf->PageNo() . ' of ' . $this->pdf->getAliasNbPages(), 0, 0, 'C', 0);
$this->pdf->Ln();
$this->pdf->SetFont($this->config['other']['default_font'], '', 6);
$this->pdf->Cell($this->pdf->getPageWidth() - $margins['right'], 5, TTi18n::gettext('Report Generated By') . ' ' . APPLICATION_NAME . ' v' . APPLICATION_VERSION . ' @ ' . TTDate::getDate('DATE+TIME', $this->start_time), 0, 0, 'C', 0);
$this->pdf->setX($x);
$this->pdf->setY($y);
return TRUE;
}
示例9: foreach
//5000 row limit.
$llf->getSearchByCompanyIdAndArrayCriteria($current_company->getId(), $filter_data, 5000);
if ($llf->getRecordCount() > 0) {
$x = 0;
foreach ($llf as $l_obj) {
$user_obj = $ulf->getById($l_obj->getUser())->getCurrent();
$tmp_action = Option::getByKey($l_obj->getAction(), $log_action_options);
$table_name = Option::getByKey($l_obj->getTableName(), $log_table_name_options);
if ($tmp_action != '' and $table_name != '') {
$link = $l_obj->getLink();
if ($link !== FALSE) {
$function = '<a href="' . $link . '" target="_blank">View</a>';
} else {
$function = NULL;
}
$rows[$x] = array('user_id' => $l_obj->getUser(), 'full_name' => $user_obj->getFullName(), 'action_id' => $l_obj->getAction(), 'action' => $tmp_action, 'table_name_id' => $l_obj->getTableName(), 'table_name' => $table_name, 'date' => TTDate::getDate('DATE+TIME', $l_obj->getDate()), 'description' => $l_obj->getDescription(), 'function' => $function);
} else {
Debug::Text('Skipping Action: ' . $l_obj->getAction() . ' or Table Name: ' . $l_obj->getTableName(), __FILE__, __LINE__, __METHOD__, 10);
}
unset($tmp_action);
$x++;
}
}
if (Misc::isSystemLoadValid() == FALSE) {
echo TTi18n::getText('Please try again later...');
exit;
}
if (isset($rows)) {
foreach ($rows as $row) {
$tmp_rows[] = $row;
}
示例10: getScheduleTotalTime
/**
* Get schedule total time
* @param integer $start Start date epoch
* @param integer $end End date epoch
* @param integer $schedule_policy_id Schedule policy ID
* @return array
*/
function getScheduleTotalTime($start, $end, $schedule_policy_id = NULL)
{
Debug::text('Calculating total time for scheduled shift... Start: ' . $start . ' End: ' . $end, __FILE__, __LINE__, __METHOD__, 10);
if ($start == '') {
return FALSE;
}
if ($end == '') {
return FALSE;
}
$sf = TTnew('ScheduleFactory');
//Prefix the current date to the template, this avoids issues with parsing 24hr clock only, ie: 0600
$date_epoch = time();
$sf->setStartTime(TTDate::parseDateTime(TTDate::getDate('DATE', $date_epoch) . ' ' . $start));
$sf->setEndTime(TTDate::parseDateTime(TTDate::getDate('DATE', $date_epoch) . ' ' . $end));
$sf->setSchedulePolicyId($schedule_policy_id);
$sf->preSave();
return $this->returnHandler($sf->getTotalTime());
}
示例11: ShiftAmendmentListFactory
$shift_amendment_node_data = $hlf->getByHierarchyControlIdAndUserId($shift_amendment_hierarchy_id, $shift_amendment_user_id);
//Get current level IDs
$shift_amendment_current_level_user_ids = $hlf->getCurrentLevelIdArrayByHierarchyControlIdAndUserId($shift_amendment_hierarchy_id, $shift_amendment_user_id);
Debug::Arr($shift_amendment_current_level_user_ids, 'Shift Amendment Current Level Ids', __FILE__, __LINE__, __METHOD__, 10);
//Get Parents
$shift_amendment_parent_level_user_ids = $hlf->getParentLevelIdArrayByHierarchyControlIdAndUserId($shift_amendment_hierarchy_id, $shift_amendment_user_id);
Debug::Arr($shift_amendment_parent_level_user_ids, 'Shift Amendment Parent Level Ids', __FILE__, __LINE__, __METHOD__, 10);
//Get Children
$shift_amendment_child_level_user_ids = $hlf->getChildLevelIdArrayByHierarchyControlIdAndUserId($shift_amendment_hierarchy_id, $shift_amendment_user_id);
Debug::Arr($shift_amendment_child_level_user_ids, 'Shift Amendment Child Level Ids', __FILE__, __LINE__, __METHOD__, 10);
if (!($shift_amendment_current_level_user_ids === FALSE and $shift_amendment_parent_level_user_ids === FALSE and $shift_amendment_child_level_user_ids === FALSE)) {
$salf = new ShiftAmendmentListFactory();
$salf->getByUserIdListAndStatusAndNotAuthorized($shift_amendment_child_level_user_ids, 30, $shift_amendment_parent_level_user_ids, $shift_amendment_current_level_user_ids);
foreach ($salf as $shift_amendment) {
$shift_amendment_user_data = $ulf->getById($shift_amendment->getScheduleShiftObject()->getUser())->getCurrent();
$shift_amendments[] = array('id' => $shift_amendment->getId(), 'user_id' => $shift_amendment_user_data->getId(), 'user_full_name' => $shift_amendment_user_data->getFullName(), 'name' => TTDate::getDate('DATE+TIME', $shift_amendment->getStartDate()), 'description' => TTDate::getDate('DATE+TIME', $shift_amendment->getStartDate()) . ' - ' . TTDate::getDate('DATE+TIME', $shift_amendment->getEndDate()));
}
//Debug::Arr( $shift_amendments, 'Shift Amendments', __FILE__, __LINE__, __METHOD__,10);
if (isset($shift_amendments)) {
$pending_amendments['Shift Amendments'] = $shift_amendments;
}
}
unset($shift_amendment_user_id, $shift_amendments);
}
$body = NULL;
if (isset($pending_amendments)) {
$total_count = 0;
foreach ($pending_amendments as $pending_amendment_group => $pending_amendment_rows) {
$row_count = count($pending_amendment_rows);
$body .= "\t\t\t" . $pending_amendment_group . ' (' . $row_count . ')' . "\n";
$body .= "----------------------------------------------------------------------\n";
示例12: 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);
示例13: postSave
function postSave()
{
if ($this->getEnableInitialPayPeriods() == TRUE and $this->getCreateInitialPayPeriods() == TRUE) {
$ppslf = new PayPeriodScheduleListFactory();
$pay_period_schedule_obj = $ppslf->getById($this->getId())->getCurrent();
$pay_period_schedule_obj->createNextPayPeriod($pay_period_schedule_obj->getAnchorDate());
Debug::text('New Pay Period Schdule, creating pay periods start from (' . $pay_period_schedule_obj->getAnchorDate() . '): ' . TTDate::getDate('DATE+TIME', $pay_period_schedule_obj->getAnchorDate()), __FILE__, __LINE__, __METHOD__, 10);
//Create pay periods up until now, at most 104.
for ($i = 0; $i <= 104; $i++) {
if ($pay_period_schedule_obj->createNextPayPeriod() == FALSE) {
Debug::text('createNextPayPeriod returned false, stopping loop.', __FILE__, __LINE__, __METHOD__, 10);
break;
}
}
}
$this->CommitTransaction();
return TRUE;
}
示例14: getJSCalendarPayPeriodArray
function getJSCalendarPayPeriodArray($include_all_pay_period_schedules = FALSE)
{
global $current_company, $current_user;
if (!is_object($current_company)) {
return FALSE;
}
if ($include_all_pay_period_schedules == TRUE) {
$cache_id = 'JSCalendarPayPeriodArray_' . $current_company->getId() . '_0';
} else {
$cache_id = 'JSCalendarPayPeriodArray_' . $current_company->getId() . '_' . $current_user->getId();
}
if (!is_object($current_company)) {
return FALSE;
}
if (!is_object($current_user)) {
return FALSE;
}
$retarr = $this->getCache($cache_id);
if ($retarr === FALSE) {
$pplf = new PayPeriodListFactory();
if ($include_all_pay_period_schedules == TRUE) {
$pplf->getByCompanyId($current_company->getId(), 13);
$cache_id = 'JSCalendarPayPeriodArray_' . $current_company->getId() . '_0';
} else {
$pplf->getByUserId($current_user->getId(), 13);
$cache_id = 'JSCalendarPayPeriodArray_' . $current_company->getId() . '_' . $current_user->getId();
}
$retarr = FALSE;
if ($pplf->getRecordCount() > 0) {
foreach ($pplf as $pp_obj) {
//$retarr['start_date'][] = TTDate::getDate('Ymd', $pp_obj->getStartDate() );
$retarr['end_date'][] = TTDate::getDate('Ymd', $pp_obj->getEndDate());
$retarr['transaction_date'][] = TTDate::getDate('Ymd', $pp_obj->getTransactionDate());
}
}
$this->saveCache($retarr, $cache_id);
}
return $retarr;
}
示例15: getData
function getData()
{
global $cache;
$country = $this->getCountry();
$state = $this->getProvince();
$district = $this->getDistrict();
$epoch = $this->getDate();
$federal_status = $this->getFederalFilingStatus();
if ($federal_status == '') {
$federal_status = 10;
}
$state_status = $this->getStateFilingStatus();
if ($state_status == '') {
$state_status = 10;
}
$district_status = $this->getDistrictFilingStatus();
if ($epoch == NULL or $epoch == '') {
//$year = date('Y');
$epoch = TTDate::getTime();
}
Debug::text('bUsing (' . $state . '/' . $district . ') values from: ' . TTDate::getDate('DATE+TIME', $epoch), __FILE__, __LINE__, __METHOD__, 10);
$cache_id = $country . $state . $district . $epoch . $federal_status . $state_status . $district_status;
if (is_string($cache->get($cache_id, $this->table))) {
$this->income_tax_rates = unserialize($cache->get($cache_id, $this->table));
} else {
$this->income_tax_rates = FALSE;
}
if ($this->income_tax_rates === FALSE) {
//There were issues with this query when provincial taxes were updated but not federal
//We need to basically make a union query that queries the latest federal taxes separate
//from the provincial
$query = 'select country,state,district,status,income,rate,constant,effective_date
from ' . $this->table . '
where
(
effective_date = ( select effective_date
from ' . $this->table . '
where effective_date <= ' . $epoch . '
AND country = ' . $this->db->qstr($country) . '
AND state is NULL
AND ( status = 0
OR status = ' . $federal_status . ' )
ORDER BY effective_date DESC
LIMIT 1) )
AND
( ( country = ' . $this->db->qstr($country) . '
and state is NULL
and ( status = 0 OR status = ' . $federal_status . ') ) )
OR
(
effective_date = ( select effective_date
from ' . $this->table . '
where effective_date <= ' . $epoch . '
AND country = ' . $this->db->qstr($country) . '
AND state = ' . $this->db->qstr($state) . '
AND ( status = 0
OR status = ' . $state_status . ' )
ORDER BY effective_date DESC
LIMIT 1) )
AND
( country = ' . $this->db->qstr($country) . '
and state = ' . $this->db->qstr($state) . '
and district is NULL
and ( status = 0 OR status = ' . $state_status . ') )
OR
(
effective_date = ( select effective_date
from ' . $this->table . '
where effective_date <= ' . $epoch . '
AND country = ' . $this->db->qstr($country) . '
AND state = ' . $this->db->qstr($state) . '
AND district = ' . $this->db->qstr($district) . '
AND ( status = 0
OR status = ' . $district_status . ' )
ORDER BY effective_date DESC
LIMIT 1) )
AND
( country = ' . $this->db->qstr($country) . '
and state = ' . $this->db->qstr($state) . '
and district = ' . $this->db->qstr($district) . '
and ( status = 0 OR status = ' . $district_status . ') )
ORDER BY state desc, district desc, income asc, rate asc';
//Debug::text('Query: '. $query , __FILE__, __LINE__, __METHOD__,10);
try {
$rs = $this->db->Execute($query);
} catch (Exception $e) {
throw new DBError($e);
}
$rows = $rs->GetRows();
$prev_income = 0;
$prev_rate = 0;
$prev_constant = 0;
foreach ($rows as $key => $arr) {
if ($arr['district'] != NULL) {
$type = 'district';
} elseif ($arr['state'] != NULL) {
$type = 'state';
} else {
$type = 'federal';
}
//.........这里部分代码省略.........