예제 #1
0
 /**
  * Checks whether there's a time set (begin time !== 00:00).
  * If there's no date/time set, the result will be FALSE.
  *
  * @return bool TRUE if we have a begin time, FALSE otherwise
  */
 protected function hasTime(tx_seminars_Model_AbstractTimeSpan $timeSpan)
 {
     if (!$timeSpan->hasBeginDate()) {
         return FALSE;
     }
     return $this->getTimeFromTimestamp($timeSpan->getBeginDateAsUnixTimeStamp()) !== '00:00';
 }
예제 #2
0
 /**
  * Gets the date.
  * Returns a localized string "will be announced" if there's no date set.
  *
  * Returns just one day if the timespan takes place on only one day.
  * Returns a date range if the timespan takes several days.
  *
  * @param tx_seminars_Model_AbstractTimeSpan $timeSpan the timespan to get the date for
  * @param string $dash the character or HTML entity used to separate start date and end date
  *
  * @return string the timespan date
  */
 public function render(tx_seminars_Model_AbstractTimeSpan $timeSpan, $dash = '–')
 {
     if (!$timeSpan->hasBeginDate()) {
         return $this->translator->translate('message_willBeAnnounced');
     }
     $beginDate = $timeSpan->getBeginDateAsUnixTimeStamp();
     $endDate = $timeSpan->getEndDateAsUnixTimeStamp();
     // Is the timespan open-ended or does it span one day only?
     if (!$timeSpan->hasEndDate() || $this->isSameDay($beginDate, $endDate)) {
         return $this->getAsDateFormatYmd($beginDate);
     }
     if ($this->configuration->getAsBoolean('abbreviateDateRanges')) {
         $formattedBeginDate = $this->getAsAbbreviatedDateRange($beginDate, $endDate, $dash);
     } else {
         $formattedBeginDate = $this->getAsDateFormatYmd($beginDate);
     }
     return $formattedBeginDate . $dash . $this->getAsDateFormatYmd($endDate);
 }