/** * @param Hotel $hotel * @return bool|string */ public function gmapHotel(Hotel $hotel, $marker, $width = 258, $height = 180) { $dir = $this->imageDir . 'hotel'; $imagePath = sprintf('%s/%s-%s-%s.png', $dir, $hotel->getId(), $width, $height); if (!file_exists($dir)) { $this->filesystem->mkdir($dir); } if (!file_exists($imagePath)) { $gmapImage = sprintf('http://maps.googleapis.com/maps/api/staticmap?center=%s,%s&zoom=14&size=%sx%s&markers=%s%s,%s&sensor=false', $hotel->getLatitude(), $hotel->getLongitude(), $width, $height, $marker ? sprintf('icon:%s%%7C', $marker) : '', $hotel->getLatitude(), $hotel->getLongitude()); file_put_contents($imagePath, file_get_contents($gmapImage)); } $webPath = strstr($imagePath, 'web/'); return substr($webPath, 4); }
/** * @param Hotel $hotel * @return bool|string */ public function generateHotelUrl(Hotel $hotel, $lang = null, $absolute = false, $rate = null) { $brand = $hotel->getBrand()->getArtsysId(); $city = ($hotel->getCity() and $hotel->getCity()->getSlug()) ? $hotel->getCity()->getSlug() : 'null'; $region = ($hotel->getRegion() and $hotel->getRegion()->getSlug()) ? $hotel->getRegion()->getSlug() : 'null'; $country = ($hotel->getRegion() and $hotel->getRegion()->getCountry() and $hotel->getRegion()->getCountry()->getSlug()) ? $hotel->getRegion()->getCountry()->getSlug() : 'null'; $slug = $hotel->getSlug() ? $hotel->getSlug() : ''; if ($lang === null) { $lang = $this->context->get('language'); } if ($rate and !is_object($rate)) { $rate = $this->entityManager->getRepository('SehBundle:Reservit\\Rate')->find($rate); } $rateSlug = null; if ($rate) { $rateSlug = sprintf('%s-%s', $this->translator->trans('seo.url.hotel.special_rate.prefix'), $rate->getSlug()); } if ($brand && $slug) { if ($brand == 'PDJ') { return $this->router->generate('hotel_pdj', array('region' => $region, 'city' => $city, 'slug' => $slug, 'rateSlug' => $rateSlug, 'locale' => $lang), $absolute); } elseif ($brand == 'IH') { return $this->router->generate('hotel_ih', array('region' => $region, 'city' => $city, 'slug' => $slug, 'rateSlug' => $rateSlug, 'locale' => $lang), $absolute); } elseif ($brand == 'QYS') { return $this->router->generate('hotel_qys', array('country' => $country, 'region' => $region, 'city' => $city, 'slug' => $slug, 'rateSlug' => $rateSlug, 'locale' => $lang), $absolute); } elseif ($brand == 'RDS') { return $this->router->generate('hotel_rds', array('country' => $country, 'region' => $region, 'slug' => $slug, 'rateSlug' => $rateSlug, 'locale' => $lang), $absolute); } } return false; }
/** * @param ImportedHotel $source * @param Hotel $destination * @return mixed */ public function map($source, $destination) { $destination->setName($source->getName()); $destination->setCommercialName($source->getName()); $destination->setRealName($source->getOfficialName() ?: $source->getName()); $destination->setOfficialName($source->getOfficialName()); $destination->setCodeAdherent($source->getCodeAdherent()); $destination->setReservitId($source->getReservitId()); $destination->setNameContact($source->getMainContact()); $destination->setCurrency($source->getCurrency()); $destination->setAdherent($source->getAdherent()); $destination->setActiveFromArtsys($source->getStatus()); $location = $source->getLocation(); if ($location) { $destination->setAddress($location->getAddress1()); $destination->setAdditionalAddress($location->getAddress2()); $destination->setZipCode($location->getZipCode()); $destination->setAddressContact($location->getAddress1()); $destination->setCityContact($location->getCity()); $destination->setLatitude($location->getLatitude()); $destination->setLongitude($location->getLongitude()); } $communication = $source->getCommunication(); if ($communication) { $destination->setTelContact($communication->getPhone()); $destination->setFaxContact($communication->getFax()); $destination->setEmailContact($communication->getReceptionEmail()); $destination->setWebsite($communication->getWebsite()); } $features = $source->getFeatures(); if ($features) { $destination->setStars($features->getStars()); $destination->setYearlyClosing($features->getYearlyClosing()); $destination->setWeeklyClosing($features->getWeeklyClosing()); $destination->setAlwaysOpen($features->getAlwaysOpen()); $destination->setReceptionSchedule($features->getReceptionTime()); $destination->setNbRooms($features->getTotalRooms() ?: $features->getNbRooms()); $destination->setNbSuites($features->getNbSuites()); $destination->setNbFloors($features->getNbFloors()); $destination->setCheckinTimeFromArtsys($features->getCheckInTime()); $destination->setCheckoutTimeFromArtsys($features->getCheckOutTime()); $destination->setBirds($features->getBirds()); } $legal = $source->getLegal(); if ($legal) { $destination->setVatNumber($legal->getVatNumber()); } $other = $source->getOther(); if ($other) { $destination->setLang($other->getLanguage()); $destination->setSurroundingsDescription($other->getDescription()); $destination->setForSale($other->getForSale() ?: false); } $info = $source->getInformation(); if ($info) { $destination->setSehBox($info->getReservIt()); } return $destination; }
/** * @param Hotel $hotel */ public function addHotel($hotel) { $hotel->addRate($this); if (!$this->hotels->contains($hotel)) { $this->hotels->add($hotel); } return $this; }
/** * @param Hotel $hotel * * @return $this */ public function removeHotel($hotel) { $this->hotelType->deleteById($hotel->getId()); }