/** * 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>'; }
/** * 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>'; }
/** * 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>'; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }