예제 #1
0
 /**
  * Check if the Index is part of the range
  *
  * @param Index     $index
  * @param \DateTime $rangeStart
  * @param \DateTime $rangeEnd
  *
  * @see IndexRepository::addTimeFrameConstraints
  *
  * @return bool
  */
 public static function isIndexInRange($index, \DateTime $rangeStart, \DateTime $rangeEnd)
 {
     $indexStart = $index->getStartDateComplete();
     $indexEnd = $index->getEndDateComplete();
     // start in
     if ($indexStart >= $rangeStart && $indexStart <= $rangeEnd) {
         return true;
     }
     // end in
     if ($indexEnd >= $rangeStart && $indexEnd <= $rangeEnd) {
         return true;
     }
     // around range
     if ($indexStart <= $rangeStart && $indexEnd >= $rangeEnd) {
         return true;
     }
     return false;
 }
예제 #2
0
 /**
  * @param string $base
  * @param Index  $index
  *
  * @return string
  */
 protected function generateRealUrl($base, Index $index)
 {
     $datePart = $index->isAllDay() ? 'Y-m-d' : 'Y-m-d-h-i';
     /** @var \tx_realurl_advanced $realUrl */
     $realUrl = GeneralUtility::makeInstance('tx_realurl_advanced');
     $configuration = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DEFAULT']['pagePath'];
     if (is_array($configuration)) {
         ObjectAccess::setProperty($realUrl, 'conf', $configuration, true);
     }
     return $realUrl->encodeTitle($base . '-' . $index->getStartDateComplete()->format($datePart));
 }