/**
  * Save current timestamp to session
  *
  * @param QueryResultInterface $forms
  * @param array $settings
  * @return void
  */
 public static function saveFormStartInSession($forms, array $settings)
 {
     $form = $forms->getFirst();
     if ($form !== null && self::sessionCheckEnabled($settings)) {
         self::getTyposcriptFrontendController()->fe_user->setKey('ses', 'powermailFormstart' . $form->getUid(), time());
         self::getTyposcriptFrontendController()->storeSessionData();
     }
 }
 /**
  * Save current timestamp to session
  *
  * @param QueryResultInterface $forms
  * @param array $settings
  * @return void
  */
 public static function saveFormStartInSession($forms, array $settings)
 {
     $form = $forms->getFirst();
     if ($form !== null && self::sessionCheckEnabled($settings)) {
         /** @var TypoScriptFrontendController $typoScriptFrontendController */
         $typoScriptFrontendController = $GLOBALS['TSFE'];
         $typoScriptFrontendController->fe_user->setKey('ses', 'powermailFormstart' . $form->getUid(), time());
         $typoScriptFrontendController->storeSessionData();
     }
 }
Beispiel #3
0
 /**
  * Get center from query result based on center of all coordinates. If only one
  * is found this is used. In case none was found the center based on the request
  * gets calculated
  *
  * @param \TYPO3\CMS\Extbase\Persistence\QueryResultInterface $queryResult
  *
  * @return Model\Location
  */
 protected function getCenterOfQueryResult($queryResult)
 {
     if ($queryResult->count() == 1) {
         return $queryResult->getFirst();
     } elseif (!$queryResult->count()) {
         return $this->getCenter();
     }
     /** @var Model\Location $center */
     $center = $this->objectManager->get('Evoweb\\StoreFinder\\Domain\\Model\\Location');
     $x = $y = $z = 0;
     /** @var Model\Location $location */
     foreach ($queryResult as $location) {
         $x += cos($location->getLatitude()) * cos($location->getLongitude());
         $y += cos($location->getLatitude()) * sin($location->getLongitude());
         $z += sin($location->getLatitude());
     }
     $x /= $queryResult->count();
     $y /= $queryResult->count();
     $z /= $queryResult->count();
     $center->setLongitude(atan2($y, $x));
     $center->setLatitude(atan2($z, sqrt($x * $x + $y * $y)));
     return $center;
 }