本文整理汇总了PHP中TYPO3\CMS\Backend\Utility\BackendUtility::time方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendUtility::time方法的具体用法?PHP BackendUtility::time怎么用?PHP BackendUtility::time使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Backend\Utility\BackendUtility
的用法示例。
在下文中一共展示了BackendUtility::time方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEventList
/**
* Get event list
*
* @param $events
*
* @return string
*/
protected function getEventList($events)
{
$items = [];
foreach ($events as $event) {
$startDateStamp = $event['start_date'] instanceof \DateTime ? $event['start_date']->getTimestamp() : $event['start_date'];
$startDate = strftime('%a %d.%m.%G', $startDateStamp);
$endDateStamp = $event['end_date'] instanceof \DateTime ? $event['end_date']->getTimestamp() : $event['end_date'];
$endDate = strftime('%a %d.%m.%G', $endDateStamp);
$entry = $startDate . ' - ' . $endDate;
if (!$event['all_day']) {
$start = BackendUtility::time($event['start_time'], false);
if ((int) $event['end_time'] === AbstractTimeTable::DAY_END) {
$end = '"' . TranslateUtility::get('openEndTime') . '"';
} else {
$end = BackendUtility::time($event['end_time'], false);
}
$entry .= ' (' . $start . ' - ' . $end . ')';
}
$items[] = $entry;
}
if (!sizeof($items)) {
$items[] = TranslateUtility::get('noEvents');
}
return '<ul><li>' . implode('</li><li>', $items) . '</li></ul>';
}
示例2: getEventList
/**
* Get event list
*
* @param $events
*
* @return string
*/
protected function getEventList($events)
{
$items = [];
foreach ($events as $event) {
$entry = date('d.m.Y', $event['start_date']) . ' - ' . date('d.m.Y', $event['end_date']);
if (!$event['all_day']) {
$start = BackendUtility::time($event['start_time'], false);
$end = BackendUtility::time($event['end_time'], false);
$entry .= ' (' . $start . ' - ' . $end . ')';
}
$items[] = $entry;
}
if (!sizeof($items)) {
$items[] = LocalizationUtility::translate('noEvents', 'calendarize');
}
return '<ul><li>' . implode('</li><li>', $items) . '</li></ul>';
}
示例3: getEventList
/**
* Get event list
*
* @param $events
*
* @return string
*/
protected function getEventList($events)
{
$items = array();
foreach ($events as $event) {
$entry = date('d.m.Y', $event['start_date']) . ' - ' . date('d.m.Y', $event['end_date']);
if (!$event['all_day']) {
// @todo the times seems to be COMPLETE timestamps in TYPO3 7.x?!?!
$start = BackendUtility::time($event['start_time'], FALSE);
$end = BackendUtility::time($event['end_time'], FALSE);
$entry .= ' (' . $start . ' - ' . $end . ')';
}
$items[] = $entry;
}
if (!sizeof($items)) {
$items[] = LocalizationUtility::translate('noEvents', 'calendarize');
}
return '<ul><li>' . implode('</li><li>', $items) . '</li></ul>';
}
示例4: getConfigurationTitleTime
/**
* Get the title for a configuration time
*
* @param $row
*
* @return string
*/
protected function getConfigurationTitleTime($row)
{
$title = '';
if ($row['start_date']) {
$dateStart = date('d.m.Y', $row['start_date']);
$dateEnd = date('d.m.Y', $row['end_date']);
$title .= $dateStart;
if ($dateStart != $dateEnd) {
$title .= ' - ' . $dateEnd;
}
}
if ($row['all_day']) {
$title .= ' ' . LocalizationUtility::translate('tx_calendarize_domain_model_index.all_day', 'calendarize');
} elseif ($row['start_time']) {
$title .= '<br />' . BackendUtility::time($row['start_time'], FALSE);
$title .= ' - ' . BackendUtility::time($row['end_time'], FALSE);
}
if ($row['frequency'] && $row['frequency'] !== Configuration::FREQUENCY_NONE) {
$title .= '<br /><i>' . LocalizationUtility::translate('configuration.frequency.' . $row['frequency'], 'calendarize') . '</i>';
}
return $title;
}
示例5: getRecordTitleForInputType
/**
* Returns the record title for input fields
*
* @param mixed $value Current database value of this field
* @param array $fieldConfig TCA field configuration
* @return string
*/
protected function getRecordTitleForInputType($value, $fieldConfig)
{
if (!isset($value)) {
return '';
}
$title = $value;
if (GeneralUtility::inList($fieldConfig['eval'], 'date')) {
if (isset($fieldConfig['dbType']) && $fieldConfig['dbType'] === 'date') {
$value = $value === '0000-00-00' ? 0 : (int) strtotime($value);
} else {
$value = (int) $value;
}
if (!empty($value)) {
$ageSuffix = '';
// Generate age suffix as long as not explicitly suppressed
if (!isset($fieldConfig['disableAgeDisplay']) || (bool) $fieldConfig['disableAgeDisplay'] === false) {
$ageDelta = $GLOBALS['EXEC_TIME'] - $value;
$calculatedAge = BackendUtility::calcAge(abs($ageDelta), $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears'));
$ageSuffix = ' (' . ($ageDelta > 0 ? '-' : '') . $calculatedAge . ')';
}
$title = BackendUtility::date($value) . $ageSuffix;
}
} elseif (GeneralUtility::inList($fieldConfig['eval'], 'time')) {
if (!empty($value)) {
$title = BackendUtility::time((int) $value, false);
}
} elseif (GeneralUtility::inList($fieldConfig['eval'], 'timesec')) {
if (!empty($value)) {
$title = BackendUtility::time((int) $value);
}
} elseif (GeneralUtility::inList($fieldConfig['eval'], 'datetime')) {
// Handle native date/time field
if (isset($fieldConfig['dbType']) && $fieldConfig['dbType'] === 'datetime') {
$value = $value === '0000-00-00 00:00:00' ? 0 : (int) strtotime($value);
} else {
$value = (int) $value;
}
if (!empty($value)) {
$title = BackendUtility::datetime($value);
}
}
return $title;
}
示例6: getConfigurationTitleTime
/**
* Get the title for a configuration time
*
* @param $row
*
* @return string
*/
protected function getConfigurationTitleTime($row)
{
$title = '';
if ($row['start_date']) {
$dateStart = strftime('%a %d.%m.%G', $row['start_date']);
$dateEnd = strftime('%a %d.%m.%G', $row['end_date'] ?: $row['start_date']);
$title .= $dateStart;
if ($dateStart != $dateEnd) {
$title .= ' - ' . $dateEnd;
}
}
if ($row['all_day']) {
$title .= ' ' . TranslateUtility::get('tx_calendarize_domain_model_index.all_day');
} elseif ($row['start_time']) {
$title .= '<br />' . BackendUtility::time($row['start_time'], false);
$title .= ' - ' . BackendUtility::time($row['end_time'], false);
}
if ($row['frequency'] && $row['frequency'] !== Configuration::FREQUENCY_NONE) {
$title .= '<br /><i>' . TranslateUtility::get('configuration.frequency.' . $row['frequency']) . '</i>';
}
return $title;
}
示例7: getConfigurationTitleTime
/**
* Get the title for a configuration time
*
* @param $row
*
* @return string
*/
protected function getConfigurationTitleTime($row)
{
$title = '';
if ($row['start_date']) {
$dateStart = date('d.m.Y', $row['start_date']);
$dateEnd = date('d.m.Y', $row['end_date'] ?: $row['start_date']);
$title .= $dateStart;
if ($dateStart != $dateEnd) {
$title .= ' - ' . $dateEnd;
}
}
if ($row['all_day']) {
$title .= ' ' . TranslateUtility::get('tx_calendarize_domain_model_index.all_day');
} elseif ($row['start_time']) {
$title .= '<br />' . BackendUtility::time($row['start_time'], false);
$title .= ' - ' . BackendUtility::time($row['end_time'], false);
}
$frequency = is_array($row['frequency']) ? $row['frequency'][0] : $row['frequency'];
// The new FormEngine prepare the select as array
if ($frequency && $frequency !== Configuration::FREQUENCY_NONE) {
$title .= '<br /><i>' . TranslateUtility::get('configuration.frequency.' . $row['frequency']) . '</i>';
}
return $title;
}