function getAddressArray() { if (!isset(self::$addressArray) && $this->value) { self::$addressArray = GetLatLngFromGoogleUsingAddress::get_placemark_as_array($this->value); } if (isset(self::$addressArray["Longitude"]) && isset(self::$addressArray["Latitude"])) { if (floatval(self::$addressArray["Longitude"]) && floatval(self::$addressArray["Latitude"])) { return self::$addressArray; } } return false; }
function findnearaddress($data, $form) { $address = Convert::raw2sql($data["Address"]); $className = Convert::raw2sql($data["ClassName"]); $pointArray = GetLatLngFromGoogleUsingAddress::get_placemark_as_array($address); $this->address = $pointArray["FullAddress"]; if (!isset($pointArray["Longitude"]) || !isset($pointArray["Latitude"])) { GoogleMapSearchRecord::create_new($address, $this->owner->ID, false); $form->addErrorMessage('Address', _t("GoogleMapLocationsDOD.ADDRESSNOTFOUND", "Sorry, address could not be found..."), 'warning'); $this->redirectBack(); return; } else { GoogleMapSearchRecord::create_new(Convert::raw2sql($address), $this->owner->ID, true); } $lng = $pointArray["Longitude"]; $lat = $pointArray["Latitude"]; //$form->Fields()->fieldByName("Address")->setValue($pointArray["address"]); //does not work .... //$this->owner->addMap($action = "showsearchpoint", "Your search",$lng, $lat); $this->owner->addMap($action = "showaroundmexml", "Closests to your search", $lng, $lat, $className); return array(); }
function findGooglePoints($doNotWrite) { if ($this) { if ($this->Address && !$this->Manual) { $newData = GetLatLngFromGoogleUsingAddress::get_placemark_as_array($this->Address); } elseif ($this->Latitude && $this->Longitude && $this->Manual) { $newData = GetLatLngFromGoogleUsingAddress::get_placemark_as_array($this->Latitude . "," . $this->Longitude); } if (isset($newData) && is_array($newData)) { $this->addDataFromArray($newData, $doNotWrite); } } }