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::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 setApplyFrequencyMonth($value) { $value = trim($value); if ($value == 0 or $this->Validator->inArrayKey('apply_frequency_month', $value, TTi18n::gettext('Incorrect frequency month'), TTDate::getMonthOfYearArray())) { $this->data['apply_frequency_month'] = $value; return TRUE; } return FALSE; }
function setMilestoneRolloverMonth($value) { $value = trim($value); if ($value == 0 or $this->Validator->inArrayKey('milestone_rollover_month', $value, TTi18n::gettext('Incorrect milestone rollover month'), TTDate::getMonthOfYearArray())) { $this->data['milestone_rollover_month'] = $value; return TRUE; } return FALSE; }
} $obj->setName('new_version'); if ($latest_version == FALSE or $latest_tax_engine_version == FALSE or $latest_tax_data_version == FALSE) { $obj->setValue(1); $data['new_version'] = 1; } else { $obj->setValue(0); $data['new_version'] = 0; } if ($obj->isValid()) { $obj->Save(); } default: $data['product_edition'] = Option::getByKey(getTTProductEdition(), $current_company->getOptions('product_edition')); //Get Employee counts for this month, and last month $month_of_year_arr = TTDate::getMonthOfYearArray(); //This month if (isset($ytd) and $ytd == 1) { $begin_month_epoch = strtotime('-2 years'); } else { $begin_month_epoch = TTDate::getBeginMonthEpoch(TTDate::getBeginMonthEpoch(time()) - 86400); } $cuclf = new CompanyUserCountListFactory(); $cuclf->getMonthlyMinAvgMaxByCompanyIdAndStartDateAndEndDate($current_company->getId(), $begin_month_epoch, TTDate::getEndMonthEpoch(time()), NULL, NULL, NULL, array('date_stamp' => 'desc')); if ($cuclf->getRecordCount() > 0) { foreach ($cuclf as $cuc_obj) { $data['user_counts'][] = array('label' => $month_of_year_arr[TTDate::getMonth(TTDate::strtotime($cuc_obj->getColumn('date_stamp')))] . ' ' . TTDate::getYear(TTDate::strtotime($cuc_obj->getColumn('date_stamp'))), 'max_active_users' => $cuc_obj->getColumn('max_active_users'), 'max_inactive_users' => $cuc_obj->getColumn('max_inactive_users'), 'max_deleted_users' => $cuc_obj->getColumn('max_deleted_users')); } } $cjlf = new CronJobListFactory(); $cjlf->getMostRecentlyRun();
/** * Get about data . * */ function getAboutData($ytd = 0, $all_companies = FALSE) { global $config_vars; $clf = new CompanyListFactory(); $sslf = new SystemSettingListFactory(); $system_settings = $sslf->getAllArray(); $clf->getByID(PRIMARY_COMPANY_ID); if ($clf->getRecordCount() == 1) { $primary_company = $clf->getCurrent(); } $current_user = $this->getCurrentUserObject(); if (isset($primary_company) and PRIMARY_COMPANY_ID == $current_user->getCompany()) { $current_company = $primary_company; } else { $current_company = $clf->getByID($current_user->getCompany())->getCurrent(); } //$current_user_prefs = $current_user->getUserPreferenceObject(); $data = $system_settings; if (isset($data['new_version']) and $data['new_version'] == TRUE) { $data['new_version'] = TRUE; } else { $data['new_version'] = FALSE; } $data['product_edition'] = Option::getByKey(DEPLOYMENT_ON_DEMAND == TRUE ? $current_company->getProductEdition() : getTTProductEdition(), $current_company->getOptions('product_edition')); $data['application_name'] = APPLICATION_NAME; $data['organization_url'] = ORGANIZATION_URL; //Get Employee counts for this month, and last month $month_of_year_arr = TTDate::getMonthOfYearArray(); //This month if (isset($ytd) and $ytd == 1) { $begin_month_epoch = strtotime('-2 years'); } else { $begin_month_epoch = TTDate::getBeginMonthEpoch(TTDate::getBeginMonthEpoch(time()) - 86400); } $cuclf = TTnew('CompanyUserCountListFactory'); if (isset($config_vars['other']['primary_company_id']) and $current_company->getId() == $config_vars['other']['primary_company_id'] and $all_companies == TRUE) { $cuclf->getTotalMonthlyMinAvgMaxByCompanyStatusAndStartDateAndEndDate(10, $begin_month_epoch, TTDate::getEndMonthEpoch(time()), NULL, NULL, NULL, array('date_stamp' => 'desc')); } else { $cuclf->getMonthlyMinAvgMaxByCompanyIdAndStartDateAndEndDate($current_company->getId(), $begin_month_epoch, TTDate::getEndMonthEpoch(time()), NULL, NULL, NULL, array('date_stamp' => 'desc')); } Debug::Text('Company User Count Rows: ' . $cuclf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10); if ($cuclf->getRecordCount() > 0) { foreach ($cuclf as $cuc_obj) { $data['user_counts'][] = array('label' => $month_of_year_arr[TTDate::getMonth(TTDate::strtotime($cuc_obj->getColumn('date_stamp')))] . ' ' . TTDate::getYear(TTDate::strtotime($cuc_obj->getColumn('date_stamp'))), 'max_active_users' => $cuc_obj->getColumn('max_active_users'), 'max_inactive_users' => $cuc_obj->getColumn('max_inactive_users'), 'max_deleted_users' => $cuc_obj->getColumn('max_deleted_users')); } } if (isset($data['user_counts']) == FALSE) { $data['user_counts'] = array(); } $cjlf = TTnew('CronJobListFactory'); $cjlf->getMostRecentlyRun(); if ($cjlf->getRecordCount() > 0) { $cj_obj = $cjlf->getCurrent(); $data['cron'] = array('last_run_date' => $cj_obj->getLastRunDate() == FALSE ? TTi18n::getText('Never') : TTDate::getDate('DATE+TIME', $cj_obj->getLastRunDate())); } $data['show_license_data'] = FALSE; if ((DEPLOYMENT_ON_DEMAND == FALSE and $current_company->getId() == 1 or isset($config_vars['other']['primary_company_id']) and $current_company->getId() == $config_vars['other']['primary_company_id']) and getTTProductEdition() > 10) { if (!isset($system_settings['license'])) { $system_settings['license'] = NULL; } $data['show_license_data'] = TRUE; //Set this so the license upload area at least shows up regardles of edition. $data['license_data'] = array(); $license = new TTLicense(); $retval = $license->validateLicense($system_settings['license']); if ($retval == TRUE) { $data['license_data'] = array('organization_name' => $license->getOrganizationName(), 'major_version' => $license->getMajorVersion(), 'minor_version' => $license->getMinorVersion(), 'product_name' => $license->getProductName(), 'active_employee_licenses' => $license->getActiveEmployeeLicenses(), 'issue_date' => TTDate::getDate('DATE', $license->getIssueDate()), 'expire_date' => $license->getExpireDate(), 'expire_date_display' => TTDate::getDate('DATE', $license->getExpireDate()), 'registration_key' => $license->getRegistrationKey(), 'message' => $license->getFullErrorMessage($retval), 'retval' => $retval); } } //Debug::Arr($data, 'Data: ', __FILE__, __LINE__, __METHOD__,10); return $this->returnHandler($data); }