Back to PhocaGalleryRenderMaposm class

Method renderSearch

public
renderSearch
(mixed $markerId = '', mixed $position = '')

Method renderSearch - Source code

public function renderSearch($markerId = '', $position = '')
{
    $position = $position != '' ? $position : 'topright';
    $o = array();
    $o[] = 'map' . $this->name . $this->id . '.addControl(new L.Control.Search({';
    $o[] = '	url: \'https://nominatim.openstreetmap.org/search?format=json&q={s}\',';
    $o[] = '	jsonpParam: \'json_callback\',';
    $o[] = '	propertyName: \'display_name\',';
    $o[] = '	propertyLoc: [\'lat\',\'lon\'],';
    $o[] = '	marker: L.circleMarker([0,0],{radius:30}),';
    $o[] = '	autoCollapse: true,';
    $o[] = '	autoType: false,';
    $o[] = '	minLength: 3,';
    $o[] = '	position: \'' . $position . '\',';
    if ($markerId != '') {
        $o[] = '	moveToLocation: function(latlng, title, map) {';
        $o[] = '		phmInputMarker(latlng.lat, latlng.lng);';
        $o[] = '		phmMoveMarker(marker' . $markerId . ', latlng.lat, latlng.lng);';
        $o[] = '		map' . $this->name . $this->id . '.setView(latlng, 7);';
        // set the zoom
        $o[] = '	}';
    }
    $o[] = '}));';
    $this->output[] = implode("\n", $o);
    return true;
}