/** * Add calculated coordinate for hash * * @param Model\Constraint|Model\Location $address * @param array $fields * * @throws \TYPO3\CMS\Core\Exception * @return void */ public function addCoordinateForAddress($address, $fields) { $coordinate = array('latitude' => $address->getLatitude(), 'longitude' => $address->getLongitude()); $hash = $this->getHashForAddressWithFields($address, $fields); if (count($fields) <= 3) { $this->setValueInCacheTable($hash, $coordinate); } else { $this->setValueInSession($hash, $coordinate); } }
/** * Set zoom level for map based on radius * * @param Model\Location|Model\Constraint $location * @param Model\Constraint $constraint * * @return Model\Location */ public function setZoomLevel($location, Model\Constraint $constraint) { $radius = $constraint->getRadius(); if ($radius > 500 && $radius <= 1000) { $zoom = 12; } elseif ($radius < 2) { $zoom = 2; } elseif ($radius < 3) { $zoom = 3; } elseif ($radius < 5) { $zoom = 4; } elseif ($radius <= 25) { $zoom = 7; } elseif ($radius <= 100) { $zoom = 9; } elseif ($radius <= 500) { $zoom = 11; } else { $zoom = 13; } $location->setZoom(18 - $zoom); return $location; }
/** * Add limit to query parts * * @param \Evoweb\StoreFinder\Domain\Model\Constraint $constraint * @param array $queryParts * @return array */ protected function addLimitQueryParts($constraint, $queryParts) { $limit = (int) $this->settings['limit']; $page = 0; if ($constraint->getLimit()) { $limit = $constraint->getLimit(); } if ($constraint->getPage()) { $page = $constraint->getPage() * $limit; } if ($limit) { $queryParts['LIMIT'] = $page . ',' . $limit; } return $queryParts; }