本文整理汇总了PHP中TTDate::getHumanTimeSince方法的典型用法代码示例。如果您正苦于以下问题:PHP TTDate::getHumanTimeSince方法的具体用法?PHP TTDate::getHumanTimeSince怎么用?PHP TTDate::getHumanTimeSince使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TTDate
的用法示例。
在下文中一共展示了TTDate::getHumanTimeSince方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
if (isset($user_wage_rows[$u_obj->getID()])) {
$tmp_user_wage_rows = $user_wage_rows[$u_obj->getID()];
} else {
$tmp_user_wage_rows = NULL;
}
if (isset($user_attendance_rows[$u_obj->getID()])) {
$tmp_user_attendance_rows = $user_attendance_rows[$u_obj->getID()];
} else {
$tmp_user_attendance_rows = NULL;
}
if (isset($user_exception_rows[$u_obj->getID()])) {
$tmp_user_exception_rows = $user_exception_rows[$u_obj->getID()];
} else {
$tmp_user_exception_rows = NULL;
}
$row_arr = array('id' => $u_obj->getId(), 'employee_number' => $u_obj->getEmployeeNumber(), 'user_name' => $u_obj->getUserName(), 'phone_id' => $u_obj->getPhoneID(), 'ibutton_id' => $u_obj->getIButtonID(), 'full_name' => $u_obj->getFullName(TRUE), 'first_name' => $u_obj->getFirstName(), 'middle_name' => $u_obj->getMiddleName(), 'last_name' => $u_obj->getLastName(), 'title' => Option::getByKey($u_obj->getTitle(), $user_titles), 'default_branch' => Option::getByKey($u_obj->getDefaultBranch(), $branch_options), 'default_department' => Option::getByKey($u_obj->getDefaultDepartment(), $department_options), 'sex' => Option::getByKey($u_obj->getSex(), $u_obj->getOptions('sex')), 'address1' => $u_obj->getAddress1(), 'address2' => $u_obj->getAddress2(), 'city' => $u_obj->getCity(), 'province' => $u_obj->getProvince(), 'country' => $u_obj->getCountry(), 'postal_code' => $u_obj->getPostalCode(), 'work_phone' => $u_obj->getWorkPhone(), 'home_phone' => $u_obj->getHomePhone(), 'mobile_phone' => $u_obj->getMobilePhone(), 'fax_phone' => $u_obj->getFaxPhone(), 'home_email' => $u_obj->getHomeEmail(), 'work_email' => $u_obj->getWorkEmail(), 'birth_date' => $u_obj->getBirthDate(), 'birth_date_since' => $u_obj->getAge(), 'sin' => $u_obj->getSIN(), 'hire_date' => $u_obj->getHireDate(), 'hire_date_since' => TTDate::getHumanTimeSince($u_obj->getHireDate()), 'termination_date' => $u_obj->getTerminationDate(), 'user_wage_rows' => $tmp_user_wage_rows, 'user_attendance_rows' => $tmp_user_attendance_rows, 'user_exception_rows' => $tmp_user_exception_rows);
$rows[] = $row_arr;
unset($tmp_user_wage_rows);
}
$rows = Sort::Multisort($rows, Misc::trimSortPrefix($filter_data['primary_sort']), Misc::trimSortPrefix($filter_data['secondary_sort']), $filter_data['primary_sort_dir'], $filter_data['secondary_sort_dir']);
}
foreach ($filter_data['column_ids'] as $column_key) {
$filter_columns[$column_key] = $columns[$column_key];
}
if ($action == 'export') {
if (isset($rows) and isset($filter_columns)) {
Debug::Text('Exporting as CSV', __FILE__, __LINE__, __METHOD__, 10);
$data = Misc::Array2CSV($rows, $filter_columns);
Misc::FileDownloadHeader('report.csv', 'application/csv', strlen($data));
echo $data;
} else {
示例2:
$tmp_rows[$x]['title'] = Option::getByKey($user_obj->getTitle(), $title_options, NULL);
$tmp_rows[$x]['group'] = Option::getByKey($user_obj->getGroup(), $group_options);
$tmp_rows[$x]['default_branch'] = Option::getByKey($user_obj->getDefaultBranch(), $branch_options, NULL);
$tmp_rows[$x]['default_department'] = Option::getByKey($user_obj->getDefaultDepartment(), $department_options, NULL);
$sin_number = NULL;
if ($permission->Check('user', 'view_sin') == TRUE) {
$sin_number = $user_obj->getSIN();
} else {
$sin_number = $user_obj->getSecureSIN();
}
$tmp_rows[$x]['sin'] = $sin_number;
$tmp_rows[$x]['birth_date_order'] = $user_obj->getBirthDate();
$tmp_rows[$x]['birth_date'] = TTDate::getDate('DATE', $user_obj->getBirthDate());
$tmp_rows[$x]['hire_date_order'] = $user_obj->getHireDate();
$tmp_rows[$x]['hire_date'] = TTDate::getDate('DATE', $user_obj->getHireDate());
$tmp_rows[$x]['since_hire_date'] = TTDate::getHumanTimeSince($user_obj->getHireDate());
$tmp_rows[$x]['termination_date_order'] = $user_obj->getTerminationDate();
$tmp_rows[$x]['termination_date'] = TTDate::getDate('DATE', $user_obj->getTerminationDate());
if (isset($ba_obj)) {
$tmp_rows[$x]['institution'] = $ba_obj->getInstitution();
$tmp_rows[$x]['transit'] = $ba_obj->getTransit();
$tmp_rows[$x]['account'] = $ba_obj->getAccount();
} else {
$tmp_rows[$x]['institution'] = NULL;
$tmp_rows[$x]['transit'] = NULL;
$tmp_rows[$x]['account'] = NULL;
}
$tmp_rows[$x]['currency'] = $tmp_rows[$x]['current_currency'] = Option::getByKey($raw_row['currency_id'], $currency_options);
if ($currency_convert_to_base == TRUE) {
$tmp_rows[$x]['current_currency'] = Option::getByKey($base_currency_obj->getId(), $currency_options);
}
示例3: columnFormatter
//.........这里部分代码省略.........
break;
case 'time_stamp':
$retval = TTDate::getDate('DATE+TIME', $value);
break;
case 'boolean':
if ($value == TRUE) {
$retval = TTi18n::getText('Yes');
} else {
$retval = TTi18n::getText('No');
}
default:
break;
}
} elseif ($format == 'xml') {
//Use standard XML formats whenever possible.
switch ($type) {
case 'report_date':
$column = strpos($column, 'custom_column') === FALSE ? $column : $column . '-' . 'date_stamp';
$retval = TTDate::getReportDates($column, $value, TRUE, $this->getUserObject());
break;
case 'currency':
case 'percent':
case 'numeric':
//Don't format above types.
break;
case 'time_unit':
$retval = TTDate::getHours($value);
//Force to hours always.
break;
case 'date_stamp':
$retval = date('Y-m-d', $value);
////type="xs:date"
break;
case 'time':
$retval = date('H:i:s', $value);
//type="xs:time"
break;
case 'time_stamp':
$retval = date('c', $value);
//type="xs:dateTime"
break;
case 'boolean':
if ($value == TRUE) {
$retval = TTi18n::getText('Yes');
} else {
$retval = TTi18n::getText('No');
}
default:
break;
}
} else {
switch ($type) {
case 'report_date':
$column = strpos($column, 'custom_column') === FALSE ? $column : $column . '-' . 'date_stamp';
$retval = TTDate::getReportDates($column, $value, TRUE, $this->getUserObject());
break;
case 'currency':
if (is_object($this->getCurrencyObject())) {
//Set MIN decimals to 2 and max to the currency rounding.
$retval = $this->getCurrencyObject()->getSymbol() . TTi18n::formatNumber($value, TRUE, 2, $this->getCurrencyObject()->getRoundDecimalPlaces());
} else {
$retval = TTi18n::formatCurrency($value);
}
break;
case 'percent':
$retval = TTi18n::formatNumber($value, TRUE) . '%';
break;
case 'numeric':
$retval = TTi18n::formatNumber($value, TRUE);
break;
case 'time_unit':
$retval = TTDate::getTimeUnit($value);
break;
case 'date_stamp':
$retval = TTDate::getDate('DATE', $value);
break;
case 'time':
$retval = TTDate::getDate('TIME', $value);
break;
case 'time_stamp':
$retval = TTDate::getDate('DATE+TIME', $value);
break;
case 'boolean':
if ($value == TRUE) {
$retval = TTi18n::getText('Yes');
} else {
$retval = TTi18n::getText('No');
}
break;
case 'time_since':
$retval = TTDate::getHumanTimeSince($value);
break;
default:
break;
}
}
//Debug::Text('Column: '. $column .' Value: '. $value .' Type: '. $type .' Retval: '. $retval, __FILE__, __LINE__, __METHOD__,10);
return $retval;
}
}