本文整理汇总了PHP中TTDate类的典型用法代码示例。如果您正苦于以下问题:PHP TTDate类的具体用法?PHP TTDate怎么用?PHP TTDate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TTDate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_gettimeunit
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
function smarty_function_gettimeunit($params, &$smarty)
{
$value = $params['value'];
$default = $params['default'];
$abs = $params['abs'];
//var_dump($default);
if ($default == 'TRUE') {
$default = 'N/A';
} elseif ($default == '0') {
if ($value === FALSE or $value === NULL) {
$value = 0;
}
} else {
$default = NULL;
}
if ($abs == 'TRUE') {
$value = abs($value);
}
//var_dump($value);
//Make sure the default is set to TRUE to get "N/A"
if ($value === FALSE or $value === NULL) {
return $default;
}
$retval = TTDate::getTimeUnit($value);
return $retval;
}
示例2: getHolidayDefaultData
/**
* Get default holiday data for creating new holidayes.
* @return array
*/
function getHolidayDefaultData()
{
$company_obj = $this->getCurrentCompanyObject();
Debug::Text('Getting holiday default data...', __FILE__, __LINE__, __METHOD__, 10);
$data = array('company_id' => $company_obj->getId(), 'date_stamp' => TTDate::getAPIDate('DATE', TTDate::getTime()));
return $this->returnHandler($data);
}
示例3: __construct
public function __construct()
{
global $db, $cache;
$this->tax_table_file = dirname(__FILE__) . '/CAPayrollDeductionTest2009.csv';
require_once Environment::getBasePath() . '/classes/payroll_deduction/PayrollDeduction.class.php';
TTDate::setTimeZone('PST');
}
示例4: __construct
public function __construct()
{
global $db, $cache;
require_once Environment::getBasePath() . '/classes/payroll_deduction/PayrollDeduction.class.php';
$this->company_id = PRIMARY_COMPANY_ID;
TTDate::setTimeZone('PST');
}
示例5: getRecurringScheduleControlDefaultData
/**
* Get default recurring_schedule_control data for creating new recurring_schedule_controles.
* @return array
*/
function getRecurringScheduleControlDefaultData()
{
$company_obj = $this->getCurrentCompanyObject();
Debug::Text('Getting recurring_schedule_control default data...', __FILE__, __LINE__, __METHOD__, 10);
$data = array('company_id' => $company_obj->getId(), 'start_week' => 1, 'start_date' => TTDate::getAPIDate('DATE', TTDate::getBeginWeekEpoch(TTDate::getTime())), 'end_date' => NULL);
return $this->returnHandler($data);
}
示例6: parse_effective_date
function parse_effective_date($input, $default_value = NULL, $parse_hint = NULL)
{
if (isset($parse_hint) and $parse_hint != '') {
TTDate::setDateFormat($parse_hint);
}
return TTDate::parseDateTime($input);
}
示例7: getPayrollDeductionObject
function getPayrollDeductionObject()
{
if (!isset($this->payroll_deduction_obj)) {
require_once Environment::getBasePath() . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . 'payroll_deduction' . DIRECTORY_SEPARATOR . 'PayrollDeduction.class.php';
$this->payroll_deduction_obj = new PayrollDeduction('CA', NULL);
$this->payroll_deduction_obj->setDate(TTDate::getTimeStamp($this->year, 12, 31));
}
return $this->payroll_deduction_obj;
}
示例8: getDateStamp
function getDateStamp($raw = FALSE)
{
if (isset($this->data['date_stamp'])) {
if ($raw === TRUE) {
return $this->data['date_stamp'];
} else {
return TTDate::strtotime($this->data['date_stamp']);
}
}
return FALSE;
}
示例9: __construct
public function __construct()
{
global $db, $cache;
require_once '../includes/global.inc.php';
require_once Environment::getBasePath() . '/classes/payroll_deduction/PayrollDeduction.class.php';
$profiler = new Profiler(true);
Debug::setBufferOutput(FALSE);
Debug::setEnable(TRUE);
TTDate::setTimeZone('PST');
if (PRODUCTION != FALSE) {
echo "DO NOT RUN ON A PRODUCTION SERVER<br>\n";
exit;
}
}
示例10: setCrumb
static function setCrumb($name, $url = NULL)
{
global $db, $current_user;
//
// If bread crumbs "seem" like they are getting overwritten, make sure the
// setCrumb function is being called ONLY in the default section of the switch statement. NOT THE TOP.
//
if ($url == '') {
$url = $_SERVER['REQUEST_URI'];
}
if (!is_object($current_user)) {
return FALSE;
}
Debug::text('Dropping Bread Crumb: ' . $name . ' URL: ' . $url, __FILE__, __LINE__, __METHOD__, 10);
$ph = array('user_id' => $current_user->getId(), 'name' => $name);
//Determine if we should update or insert bread crumb.
$query = 'select name
FROM bread_crumb
WHERE user_id = ?
AND name = ?
LIMIT 1';
try {
$rs = $db->Execute($query, $ph);
} catch (Exception $e) {
throw new DBError($e);
}
if ($rs->RecordCount() == 1) {
$ph = array('url' => $url, 'created_date' => TTDate::getTime(), 'user_id' => $current_user->getId(), 'name' => $name);
$query = 'UPDATE bread_crumb
SET url = ?,
created_date = ?
WHERE user_id = ?
AND name = ?';
} else {
$ph = array('user_id' => $current_user->getId(), 'name' => $name, 'url' => $url, 'created_date' => TTDate::getTime());
$query = 'insert into bread_crumb (user_id,name,url,created_date)
VALUES(
?,
?,
?,
?
)';
}
try {
$db->Execute($query, $ph);
} catch (Exception $e) {
throw new DBError($e);
}
return TRUE;
}
示例11: getROEDefaultData
/**
* Get default roe data for creating new roe.
* @return array
*/
function getROEDefaultData($user_id = NULL)
{
$company_obj = $this->getCurrentCompanyObject();
if ($user_id > 0) {
//Debug::Text('Current User Id: '.$user_id, __FILE__, __LINE__, __METHOD__,10);
$rf = new ROEFactory();
$first_date = $rf->calculateFirstDate($user_id);
$last_date = $rf->calculateLastDate($user_id);
$pay_period = $rf->calculatePayPeriodType($user_id, $last_date);
Debug::Text('Getting roe default data...', __FILE__, __LINE__, __METHOD__, 10);
$data = array('company_id' => $company_obj->getId(), 'user_id' => $user_id, 'pay_period_type_id' => $pay_period['pay_period_type_id'], 'first_date' => TTDate::getAPIDate('DATE', $first_date), 'last_date' => TTDate::getAPIDate('DATE', $last_date), 'pay_period_end_date' => TTDate::getAPIDate('DATE', $pay_period['pay_period_end_date']));
} else {
$data = array('company_id' => $company_obj->getId());
}
return $this->returnHandler($data);
}
示例12: postInstall
function postInstall()
{
Debug::text('postInstall: ' . $this->getVersion(), __FILE__, __LINE__, __METHOD__, 9);
//New Pay Period Schedule format, update any current schedules.
$ppslf = new PayPeriodScheduleListFactory();
$ppslf->getAll();
Debug::text('Found Pay Period Schedules: ' . $ppslf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 9);
if ($ppslf->getRecordCount() > 0) {
foreach ($ppslf as $pps_obj) {
if ($pps_obj->getType() == 10 or $pps_obj->getType() == 20) {
$pps_obj->setStartDayOfWeek(TTDate::getDayOfWeek(TTDate::strtotime($pps_obj->getColumn('anchor_date'))));
$pps_obj->setTransactionDate(floor((TTDate::strtotime($pps_obj->getColumn('primary_transaction_date')) - TTDate::strtotime($pps_obj->getColumn('primary_date'))) / 86400) + 1);
} elseif ($pps_obj->getType() == 30) {
$pps_obj->setPrimaryDayOfMonth(TTDate::getDayOfMonth(TTDate::strtotime($pps_obj->getColumn('anchor_date'))) + 1);
if ($pps_obj->getColumn('primary_transaction_date_ldom') == 1) {
$pps_obj->setPrimaryTransactionDayOfMonth(-1);
} else {
$pps_obj->setPrimaryTransactionDayOfMonth(TTDate::getDayOfMonth(TTDate::strtotime($pps_obj->getColumn('primary_transaction_date'))));
}
$pps_obj->setSecondaryDayOfMonth(TTDate::getDayOfMonth(TTDate::strtotime($pps_obj->getColumn('primary_date'))));
if ($pps_obj->getColumn('secondary_transaction_date_ldom') == 1) {
$pps_obj->setSecondaryTransactionDayOfMonth(-1);
} else {
$pps_obj->setSecondaryTransactionDayOfMonth(TTDate::getDayOfMonth(TTDate::strtotime($pps_obj->getColumn('secondary_transaction_date'))));
}
} elseif ($pps_obj->getType() == 50) {
$pps_obj->setPrimaryDayOfMonth(TTDate::getDayOfMonth(TTDate::strtotime($pps_obj->getColumn('anchor_date'))));
if ($pps_obj->getColumn('primary_transaction_date_ldom') == 1) {
$pps_obj->setPrimaryTransactionDayOfMonth(-1);
} else {
$pps_obj->setPrimaryTransactionDayOfMonth(TTDate::getDayOfMonth(TTDate::strtotime($pps_obj->getColumn('primary_transaction_date'))));
}
}
if ($pps_obj->getColumn('transaction_date_bd') == 1 or $pps_obj->getColumn('secondary_transaction_date_bd') == 1) {
$pps_obj->setTransactionDateBusinessDay(TRUE);
}
if ($pps_obj->isValid()) {
$pps_obj->Save();
}
}
}
return TRUE;
}
示例13: 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;
}
示例14: isActiveLengthOfService
function isActiveLengthOfService($u_obj, $epoch)
{
if ($this->getMinimumLengthOfServiceUnit() == 50 or $this->getMaximumLengthOfServiceUnit() == 50) {
//Hour based length of service, get users hours up until this period.
$worked_time = TTDate::getHours($this->getWorkedTimeByUserIdAndEndDate($u_obj->getId(), $epoch));
Debug::Text(' Worked Time: ' . $worked_time . 'hrs', __FILE__, __LINE__, __METHOD__, 10);
}
$employed_days = TTDate::getDays($epoch - $u_obj->getHireDate());
Debug::Text(' Employed Days: ' . $employed_days, __FILE__, __LINE__, __METHOD__, 10);
$minimum_length_of_service_result = FALSE;
$maximum_length_of_service_result = FALSE;
//Check minimum length of service
if ($this->getMinimumLengthOfService() == 0 or $this->getMinimumLengthOfServiceUnit() == 50 and $worked_time >= $this->getMinimumLengthOfService() or $this->getMinimumLengthOfServiceUnit() != 50 and $employed_days >= $this->getMinimumLengthOfServiceDays()) {
$minimum_length_of_service_result = TRUE;
}
//Check maximum length of service.
if ($this->getMaximumLengthOfService() == 0 or $this->getMaximumLengthOfServiceUnit() == 50 and $worked_time <= $this->getMaximumLengthOfService() or $this->getMaximumLengthOfServiceUnit() != 50 and $employed_days <= $this->getMaximumLengthOfServiceDays()) {
$maximum_length_of_service_result = TRUE;
}
Debug::Text(' Min Result: : ' . (int) $minimum_length_of_service_result . ' Max Result: ' . (int) $maximum_length_of_service_result, __FILE__, __LINE__, __METHOD__, 10);
if ($minimum_length_of_service_result == TRUE and $maximum_length_of_service_result == TRUE) {
return TRUE;
}
return FALSE;
}
示例15: getObjectAsArray
function getObjectAsArray($include_columns = NULL, $permission_children_ids = FALSE)
{
$uf = TTnew('UserFactory');
$variable_function_map = $this->getVariableToFunctionMap();
if (is_array($variable_function_map)) {
foreach ($variable_function_map as $variable => $function_stub) {
if ($include_columns == NULL or isset($include_columns[$variable]) and $include_columns[$variable] == TRUE) {
$function = 'get' . $function_stub;
switch ($variable) {
case 'first_name':
case 'last_name':
if ($this->getColumn('user_id') > 0) {
$data[$variable] = $this->getColumn($variable);
} else {
$data[$variable] = TTi18n::getText('OPEN');
}
break;
case 'user_id':
//Make sure getUser() returns the proper user_id, otherwise mass edit will always assign shifts to OPEN employee.
//We have to make sure the 'user_id' function map is FALSE as well, so we don't get a SQL error when getting the empty record set.
$data[$variable] = $this->tmp_data['user_id'] = $this->getColumn($variable);
break;
case 'user_status_id':
case 'group_id':
case 'group':
case 'title_id':
case 'title':
case 'default_branch_id':
case 'default_branch':
case 'default_department_id':
case 'default_department':
case 'schedule_policy_id':
case 'schedule_policy':
case 'pay_period_id':
case 'branch':
case 'department':
case 'job':
case 'job_item':
$data[$variable] = $this->getColumn($variable);
break;
case 'status':
$function = 'get' . $variable;
if (method_exists($this, $function)) {
$data[$variable] = Option::getByKey($this->{$function}(), $this->getOptions($variable));
}
break;
case 'user_status':
$data[$variable] = Option::getByKey((int) $this->getColumn('user_status_id'), $uf->getOptions('status'));
break;
case 'date_stamp':
$data[$variable] = TTDate::getAPIDate('DATE', strtotime($this->getColumn('date_stamp')));
break;
case 'start_date_stamp':
$data[$variable] = TTDate::getAPIDate('DATE', $this->getStartTime());
//Include both date+time
break;
case 'start_date':
$data[$variable] = TTDate::getAPIDate('DATE+TIME', $this->getStartTime());
//Include both date+time
break;
case 'end_date':
$data[$variable] = TTDate::getAPIDate('DATE+TIME', $this->getEndTime());
//Include both date+time
break;
case 'start_time_stamp':
$data[$variable] = $this->getStartTime();
//Include start date/time in epoch format for sorting...
break;
case 'end_time_stamp':
$data[$variable] = $this->getEndTime();
//Include end date/time in epoch format for sorting...
break;
case 'start_time':
case 'end_time':
if (method_exists($this, $function)) {
$data[$variable] = TTDate::getAPIDate('TIME', $this->{$function}());
//Just include time, so Mass Edit sees similar times without dates
}
break;
default:
if (method_exists($this, $function)) {
$data[$variable] = $this->{$function}();
}
break;
}
}
}
$this->getPermissionColumns($data, $this->getColumn('user_id'), $this->getCreatedBy(), $permission_children_ids, $include_columns);
$this->getCreatedAndUpdatedColumns($data, $include_columns);
}
return $data;
}