static function getOptions($name, $interval = 1) { $all_array_option = array('*' => TTi18n::getText('-- All --')); $retval = FALSE; switch ($name) { case 'minute': for ($i = 0; $i <= 59; $i += $interval) { $retval[$i] = $i; } $retval = Misc::prependArray($all_array_option, $retval); break; case 'hour': for ($i = 0; $i <= 23; $i += $interval) { $retval[$i] = $i; } $retval = Misc::prependArray($all_array_option, $retval); break; case 'day_of_month': $retval = Misc::prependArray($all_array_option, TTDate::getDayOfMonthArray()); break; case 'month': $retval = Misc::prependArray($all_array_option, TTDate::getMonthOfYearArray()); break; case 'day_of_week': $retval = Misc::prependArray($all_array_option, TTDate::getDayOfWeekArray()); break; } return $retval; }
//Debug::Arr($station,'Department', __FILE__, __LINE__, __METHOD__,10); $pay_period_schedule_data = array('id' => $pay_period_schedule->getId(), 'company_id' => $pay_period_schedule->getCompany(), 'name' => $pay_period_schedule->getName(), 'description' => $pay_period_schedule->getDescription(), 'type' => $pay_period_schedule->getType(), 'start_week_day_id' => $pay_period_schedule->getStartWeekDay(), 'start_day_of_week' => $pay_period_schedule->getStartDayOfWeek(), 'transaction_date' => $pay_period_schedule->getTransactionDate(), 'primary_day_of_month' => $pay_period_schedule->getPrimaryDayOfMonth(), 'secondary_day_of_month' => $pay_period_schedule->getSecondaryDayOfMonth(), 'primary_transaction_day_of_month' => $pay_period_schedule->getPrimaryTransactionDayOfMonth(), 'secondary_transaction_day_of_month' => $pay_period_schedule->getSecondaryTransactionDayOfMonth(), 'transaction_date_bd' => $pay_period_schedule->getTransactionDateBusinessDay(), 'anchor_date' => $pay_period_schedule->getAnchorDate(), 'annual_pay_periods' => $pay_period_schedule->getAnnualPayPeriods(), 'day_start_time' => $pay_period_schedule->getDayStartTime(), 'time_zone' => $pay_period_schedule->getTimeZone(), 'new_day_trigger_time' => $pay_period_schedule->getNewDayTriggerTime(), 'maximum_shift_time' => $pay_period_schedule->getMaximumShiftTime(), 'shift_assigned_day_id' => $pay_period_schedule->getShiftAssignedDay(), 'timesheet_verify_type_id' => $pay_period_schedule->getTimeSheetVerifyType(), 'timesheet_verify_before_end_date' => $pay_period_schedule->getTimeSheetVerifyBeforeEndDate(), 'timesheet_verify_before_transaction_date' => $pay_period_schedule->getTimeSheetVerifyBeforeTransactionDate(), 'timesheet_verify_notice_before_transaction_date' => $pay_period_schedule->getTimeSheetVerifyNoticeBeforeTransactionDate(), 'timesheet_verify_notice_email' => $pay_period_schedule->getTimeSheetVerifyNoticeEmail(), 'user_ids' => $pay_period_schedule->getUser(), 'deleted' => $pay_period_schedule->getDeleted(), 'created_date' => $pay_period_schedule->getCreatedDate(), 'created_by' => $pay_period_schedule->getCreatedBy(), 'updated_date' => $pay_period_schedule->getUpdatedDate(), 'updated_by' => $pay_period_schedule->getUpdatedBy(), 'deleted_date' => $pay_period_schedule->getDeletedDate(), 'deleted_by' => $pay_period_schedule->getDeletedBy()); } } elseif ($action != 'submit') { $pay_period_schedule_data = array('anchor_date' => TTDate::getBeginMonthEpoch(time()), 'day_start_time' => 0, 'new_day_trigger_time' => 3600 * 4, 'maximum_shift_time' => 3600 * 16, 'time_zone' => $current_user_prefs->getTimeZone(), 'type' => 20, 'timesheet_verify_type_id' => 10, 'timesheet_verify_before_end_date' => 0, 'timesheet_verify_before_transaction_date' => 0, 'annual_pay_periods' => 0); } //Select box options; $pay_period_schedule_data['type_options'] = $ppsf->getOptions('type'); $pay_period_schedule_data['start_week_day_options'] = $ppsf->getOptions('start_week_day'); $pay_period_schedule_data['shift_assigned_day_options'] = $ppsf->getOptions('shift_assigned_day'); $pay_period_schedule_data['timesheet_verify_type_options'] = $ppsf->getOptions('timesheet_verify_type'); $pay_period_schedule_data['time_zone_options'] = $ppsf->getTimeZoneOptions(); $pay_period_schedule_data['transaction_date_bd_options'] = $ppsf->getOptions('transaction_date_business_day'); $pay_period_schedule_data['day_of_week_options'] = TTDate::getDayOfWeekArray(); $pay_period_schedule_data['transaction_date_options'] = Misc::prependArray(array(0 => '0'), TTDate::getDayOfMonthArray()); $pay_period_schedule_data['day_of_month_options'] = TTDate::getDayOfMonthArray(); $pay_period_schedule_data['day_of_month_options'][-1] = TTi18n::gettext('- Last Day Of Month -'); $pay_period_schedule_data['user_options'] = UserListFactory::getByCompanyIdArray($current_company->getId(), FALSE, TRUE); if (isset($pay_period_schedule_data['user_ids']) and is_array($pay_period_schedule_data['user_ids'])) { $tmp_user_options = UserListFactory::getByCompanyIdArray($current_company->getId(), FALSE, TRUE); foreach ($pay_period_schedule_data['user_ids'] as $user_id) { if (isset($tmp_user_options[$user_id])) { $filter_user_options[$user_id] = $tmp_user_options[$user_id]; } } unset($user_id); } $smarty->assign_by_ref('filter_user_options', $filter_user_options); $smarty->assign_by_ref('pay_period_schedule_data', $pay_period_schedule_data); break; }
function setSecondaryTransactionDayOfMonth($val) { $val = trim($val); $key = Option::getByValue($val, TTDate::getDayOfMonthArray()); if ($key !== FALSE) { $val = $key; } if ($val == -1 or $this->Validator->inArrayKey('secondary_transaction_day_of_month', $val, TTi18n::gettext('Incorrect secondary transaction day of month'), TTDate::getDayOfMonthArray())) { $this->data['secondary_transaction_day_of_month'] = $val; return TRUE; } return FALSE; }
Debug::Text('Lowest ID: ' . $row_keys[0], __FILE__, __LINE__, __METHOD__, 10); $lowest_id = $row_keys[0]; if ($lowest_id < 0) { $next_blank_id = $lowest_id - 1; } else { $next_blank_id = -1; } Debug::Text('Next Blank ID: ' . $next_blank_id, __FILE__, __LINE__, __METHOD__, 10); $data['milestone_rows'][$next_blank_id] = array('id' => $next_blank_id, 'length_of_service' => 0, 'accrual_rate' => 0, 'minimum_time' => 0, 'maximum_time' => 0); } elseif ($action != 'submit' and $action != 'change_type') { $data = array('type_id' => 10, 'minimum_employed_days' => 0, 'recalculate_start_date' => TTDate::getBeginMonthEpoch(time()), 'recalculate_end_date' => TTDate::getEndMonthEpoch(time()), 'milestone_rows' => array(-1 => array('id' => -1, 'length_of_service' => 0, 'accrual_rate' => '0.0000', 'minimum_time' => 0, 'maximum_time' => 0))); } else { if ($data['type_id'] == 20) { $data['recalculate_start_date'] = TTDate::getBeginMonthEpoch(time()); $data['recalculate_end_date'] = TTDate::getEndMonthEpoch(time()); } } //print_r($data); //Select box options; $data['type_options'] = $apf->getOptions('type'); $data['apply_frequency_options'] = $apf->getOptions('apply_frequency'); $data['month_options'] = TTDate::getMonthOfYearArray(); $data['day_of_month_options'] = TTDate::getDayOfMonthArray(); $data['day_of_week_options'] = TTDate::getDayOfWeekArray(); $data['length_of_service_unit_options'] = $apmf->getOptions('length_of_service_unit'); $smarty->assign_by_ref('data', $data); break; } $smarty->assign_by_ref('apf', $apf); $smarty->assign_by_ref('apmf', $apmf); $smarty->display('policy/EditAccrualPolicy.tpl');
function setApplyFrequencyDayOfMonth($value) { $value = trim($value); if ($value == 0 or $this->Validator->inArrayKey('apply_frequency_day_of_month', $value, TTi18n::gettext('Incorrect frequency day of month'), TTDate::getDayOfMonthArray())) { $this->data['apply_frequency_day_of_month'] = $value; return TRUE; } return FALSE; }
function setMilestoneRolloverDayOfMonth($value) { $value = trim($value); if ($value == 0 or $this->Validator->inArrayKey('milestone_rollover_day_of_month', $value, TTi18n::gettext('Incorrect milestone rollover day of month'), TTDate::getDayOfMonthArray())) { $this->data['milestone_rollover_day_of_month'] = $value; return TRUE; } return FALSE; }