Your IP : 216.73.216.240
<?php
/*------------------------------------------------------------------------
# com_zhgooglemap - Zh GoogleMap
# ------------------------------------------------------------------------
# author: Dmitry Zhuk
# copyright: Copyright (C) 2011 zhuk.cc. All Rights Reserved.
# license: http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
# website: http://zhuk.cc
# Technical Support Forum: http://forum.zhuk.cc/
-------------------------------------------------------------------------*/
// No direct access
defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
JHtml::_('formbehavior.chosen', 'select');
$document = JFactory::getDocument();
// Map Types
$maptypes = $this->mapTypeList;
$urlProtocol = "http";
if ($this->httpsprotocol != "")
{
if ((int)$this->httpsprotocol == 0)
{
$urlProtocol = 'https';
}
}
$mainScriptBegin = $urlProtocol.'://maps.googleapis.com/maps/api/js?';
$mainScriptMiddle = "";
$mainScriptEnd = "";
if ($this->mapapiversion != "")
{
if ($mainScriptMiddle == "")
{
$mainScriptMiddle = 'v='.$this->mapapiversion;
}
else
{
$mainScriptMiddle .= '&v='.$this->mapapiversion;
}
}
if ($this->mapapikey4map != "")
{
if ($mainScriptMiddle == "")
{
$mainScriptMiddle = 'key='.$this->mapapikey4map;
}
else
{
$mainScriptMiddle .= '&key='.$this->mapapikey4map;
}
}
$mainScriptBegin .= $mainScriptMiddle;
$mainScriptLibrary ="";
if (1==1)
{
if ($mainScriptLibrary == "")
{
$mainScriptLibrary .= '&libraries=places';
}
else
{
$mainScriptLibrary .= ',places';
}
}
$mainScriptBegin .= $mainScriptLibrary;
$mainScript = $mainScriptBegin . $mainScriptEnd;
$document->addScript($mainScript);
// Load for contact translation
$currentLanguage = JFactory::getLanguage();
$currentLangTag = $currentLanguage->getTag();
$currentLanguage->load('com_contact', JPATH_ADMINISTRATOR, $currentLangTag, true);
$imgpath = JURI::root() .'administrator/components/com_zhgooglemap/assets/icons/';
$utilspath = JURI::root() .'administrator/components/com_zhgooglemap/assets/utils/';
?>
<form action="<?php echo JRoute::_('index.php?option=com_zhgooglemap&layout=edit&id='.(int) $this->item->id); ?>" method="post" name="adminForm" id="adminForm" class="form-validate">
<div class="span12 form-horizontal">
<div class="tabbable">
<ul class="nav nav-pills">
<li class="active"><a href="#tab0" data-toggle="tab"><?php echo JText::_( 'COM_ZHGOOGLEMAP_MAPMARKER_MARKER' ); ?></a></li>
<li><a href="#tab1" data-toggle="tab"><?php echo JText::_( 'COM_ZHGOOGLEMAP_MAPMARKER_DETAIL' ); ?></a></li>
<li><a href="#tab2" data-toggle="tab"><?php echo JText::_('COM_ZHGOOGLEMAP_MAPMARKER_DETAIL_APPEARANCE'); ?></a></li>
<li><a href="#tab4" data-toggle="tab"><?php echo JText::_('COM_ZHGOOGLEMAP_MAPMARKER_DETAIL_INTEGRATION'); ?></a></li>
<?php
$fieldSets = $this->form->getFieldsets('params');
foreach ($fieldSets as $name => $fieldSet) :
?>
<li><a href="#params-<?php echo $name;?>" data-toggle="tab"><?php echo JText::_($fieldSet->label);?></a></li>
<?php endforeach; ?>
</ul>
</div>
<div class="tab-content">
<div class="tab-pane active" id="tab0">
<div>
<fieldset class="adminform">
<?php foreach($this->form->getFieldset('markermain') as $field):
if ($field->id == 'jform_mapid')
{
?>
<div class="control-label">
<?php
echo $field->label;
?>
</div>
<div class="controls">
<?php
array_unshift($this->mapList, JHTML::_('select.option', '', JText::_( 'COM_ZHGOOGLEMAP_MAPMARKER_FILTER_MAP'), 'value', 'text'));
echo JHTML::_( 'select.genericlist', $this->mapList, 'jform[mapid]', 'class="inputbox span5 required" size="1"', 'value', 'text', (int)$this->item->mapid, 'jform_mapid');
//echo $field->label;
//echo $field->input;
?>
</div>
<?php
}
else
{?>
<div class="control-group">
<?php
?>
<div class="control-label">
<?php
echo $field->label;
?>
</div>
<div class="controls">
<?php
echo $field->input;
?>
</div>
<?php
?>
</div>
<?php }?>
<?php endforeach; ?>
</fieldset>
<div>
<div id="mapDivWrapper" style="margin:0;padding:0;width:100%;height:450px">
<div id="placesDivAC" tyle="margin:0;padding:0;width:100%;height:50px">
<input id="searchTextField" type="text" size="200" class="span5">
<?php echo ' <button id="findAddressButton" onclick="Do_Find(); return false;">'.JText::_('COM_ZHGOOGLEMAP_MAPMARKER_DETAIL_DOFINDBUTTON').'</button>'; ?>
</div>
<div id="GMapsID" style="margin:0;padding:0;width:100%;height:400px">
<?php
$document->addStyleSheet(JURI::root() .'administrator/components/com_zhgooglemap/assets/css/admin.css');
$mapDefLat = $this->mapDefLat;
$mapDefLng = $this->mapDefLng;
$mapMapTypeGoogle = $this->mapMapTypeGoogle;
$mapMapTypeOSM = $this->mapMapTypeOSM;
$mapMapTypeCustom = $this->mapMapTypeCustom;
//Script begin
$scripttext = '<script type="text/javascript" >//<![CDATA[' ."\n";
$scripttext .= 'var initialLocation;' ."\n";
$scripttext .= 'var spblocation;' ."\n";
$scripttext .= 'var browserSupportFlag = new Boolean();' ."\n";
$scripttext .= 'var map;' ."\n";
$scripttext .= 'var infowindow;' ."\n";
$scripttext .= 'var marker;' ."\n";
$scripttext .= 'var geocoder;' ."\n";
$scripttext .= 'var inputPlacesAC;' ."\n";
$scripttext .= 'function initialize() {' ."\n";
$scripttext .= 'infowindow = new google.maps.InfoWindow();' ."\n";
$scripttext .= 'geocoder = new google.maps.Geocoder();'."\n";
if ($mapDefLat != "" && $mapDefLng !="")
{
$scripttext .= 'spblocation = new google.maps.LatLng('.$mapDefLat.', '.$mapDefLng.');' ."\n";
}
else
{
$scripttext .= 'spblocation = new google.maps.LatLng(59.9388, 30.3158);' ."\n";
}
$scripttext .= 'var myOptions = {' ."\n";
$scripttext .= ' zoom: 14,' ."\n";
$scripttext .= ' mapTypeId: google.maps.MapTypeId.ROADMAP,' ."\n";
$scripttext .= ' panControl: true,' ."\n";
$scripttext .= ' scrollwheel: false,' ."\n";
$scripttext .= ' zoomControl: true,' ."\n";
$scripttext .= ' zoomControlOptions: {' ."\n";
$scripttext .= ' position: google.maps.ControlPosition.LEFT_TOP,' ."\n";
$scripttext .= ' style: google.maps.ZoomControlStyle.DEFAULT' ."\n";
$scripttext .= ' },' ."\n";
$scripttext .= ' mapTypeControl: true,' ."\n";
$scripttext .= ' mapTypeControlOptions: {' ."\n";
$scripttext .= ' mapTypeIds: [' ."\n";
$curr_maptype_list = '';
if ((int)$mapMapTypeGoogle != 0
|| ((int)$mapMapTypeCustom == 0
&& (int)$mapMapTypeOSM == 0))
{
$curr_maptype_list .= ' google.maps.MapTypeId.ROADMAP,' ."\n";
$curr_maptype_list .= ' google.maps.MapTypeId.TERRAIN,' ."\n";
$curr_maptype_list .= ' google.maps.MapTypeId.SATELLITE,' ."\n";
$curr_maptype_list .= ' google.maps.MapTypeId.HYBRID' ."\n";
}
if ((int)$mapMapTypeOSM != 0)
{
if ($curr_maptype_list == '')
{
$curr_maptype_list .= ' \'osm\'' ."\n";
}
else
{
$curr_maptype_list .= ' ,\'osm\'' ."\n";
}
}
if ((int)$mapMapTypeCustom != 0)
{
// Custom Map Type - part 0 (add to list) - begin
foreach ($maptypes as $key => $currentmaptype)
{
if ($currentmaptype->gettileurl != "")
{
if ($curr_maptype_list == '')
{
$curr_maptype_list .= ' \'customMapType'.$currentmaptype->id.'\'' ."\n";
}
else
{
$curr_maptype_list .= ' ,\'customMapType'.$currentmaptype->id.'\'' ."\n";
}
}
}
// Custom Map Type - part 0 (add to list) - end
}
$scripttext .= $curr_maptype_list;
$scripttext .= ' ]' ."\n";
$scripttext .= ' },' ."\n";
$scripttext .= ' scaleControl: false,' ."\n";
$scripttext .= ' streetViewControl: false,' ."\n";
$scripttext .= ' rotateControl: false,' ."\n";
$scripttext .= ' overviewMapControl: true' ."\n";
$scripttext .= ' };' ."\n";
if ((int)$mapMapTypeOSM != 0)
{
$scripttext .= ' var openStreetType = new google.maps.ImageMapType({' ."\n";
$scripttext .= ' getTileUrl: function(ll, z) {' ."\n";
$scripttext .= ' var X = ll.x % (1 << z); // wrap' ."\n";
$scripttext .= ' return "'.$urlProtocol.'://tile.openstreetmap.org/" + z + "/" + X + "/" + ll.y + ".png";' ."\n";
$scripttext .= ' },' ."\n";
$scripttext .= ' tileSize: new google.maps.Size(256, 256),' ."\n";
$scripttext .= ' isPng: true,' ."\n";
$scripttext .= ' maxZoom: 18,' ."\n";
$scripttext .= ' name: "OSM",' ."\n";
$scripttext .= ' alt: "'.JText::_('COM_ZHGOOGLEMAP_MAP_OPENSTREETLAYER').'"' ."\n";
$scripttext .= '}); ' ."\n";
}
if ((int)$mapMapTypeCustom != 0)
{
// Custom Map Type - part 1 (define) - begin
foreach ($maptypes as $key => $currentmaptype)
{
if ($currentmaptype->gettileurl != "")
{
$scripttext .= ' var customMapType'.$currentmaptype->id.' = new google.maps.ImageMapType({' ."\n";
$scripttext .= ' getTileUrl: '.$currentmaptype->gettileurl.',' ."\n";
$scripttext .= ' tileSize: new google.maps.Size('.$currentmaptype->tilewidth.', '.$currentmaptype->tileheight.'),' ."\n";
if ((int)$currentmaptype->ispng == 1)
{
$scripttext .= ' isPng: true,' ."\n";
}
else
{
$scripttext .= ' isPng: false,' ."\n";
}
if ((int)$currentmaptype->minzoom != 0)
{
$scripttext .= ' minZoom: '.(int)$currentmaptype->minzoom.',' ."\n";
}
if ((int)$currentmaptype->maxzoom != 0)
{
$scripttext .= ' maxZoom: '.(int)$currentmaptype->maxzoom.',' ."\n";
}
if ($currentmaptype->opacity != "")
{
$scripttext .= ' opacity: '.$currentmaptype->opacity.','."\n";
}
$scripttext .= ' name: "'.str_replace('"','', $currentmaptype->title).'",' ."\n";
$scripttext .= ' alt: "'.str_replace('"','', $currentmaptype->description).'",' ."\n";
$scripttext .= '}); ' ."\n";
// Add projection
if ($currentmaptype->fromlatlngtopoint != "" && $currentmaptype->frompointtolatlng != "")
{
$scripttext .= $currentmaptype->projectionglobal."\n";
$scripttext .= ' function customMapTypeProjection'.$currentmaptype->id.'() {'."\n";
$scripttext .= $currentmaptype->projectiondefinition."\n";
$scripttext .= ' }'."\n";
$scripttext .= ' customMapTypeProjection'.$currentmaptype->id.'.prototype.fromLatLngToPoint = ';
$scripttext .= $currentmaptype->fromlatlngtopoint."\n";
$scripttext .= ';'."\n";
$scripttext .= ' customMapTypeProjection'.$currentmaptype->id.'.prototype.fromPointToLatLng = ';
$scripttext .= $currentmaptype->frompointtolatlng."\n";
$scripttext .= ';'."\n";
$scripttext .= ' customMapType'.$currentmaptype->id.'.projection = new customMapTypeProjection'.$currentmaptype->id.'();' ."\n";
}
}
}
// Custom Map Type - part 1 (define) - end
}
$scripttext .= ' map = new google.maps.Map(document.getElementById("GMapsID"), myOptions);' ."\n";
if ((int)$mapMapTypeOSM != 0)
{
$scripttext .= ' map.mapTypes.set(\'osm\', openStreetType);' ."\n";
if (((int)$mapMapTypeOSM == 2)
|| ((int)$mapMapTypeGoogle == 0
&& (int)$mapMapTypeCustom == 0))
{
$scripttext .= ' map.setMapTypeId(\'osm\');' ."\n";
}
}
if ((int)$mapMapTypeCustom != 0)
{
// Custom Map Type - part 2 (bind) - begin
foreach ($maptypes as $key => $currentmaptype)
{
if ($currentmaptype->gettileurl != "")
{
$scripttext .= ' map.mapTypes.set(\'customMapType'.$currentmaptype->id.'\', customMapType'.$currentmaptype->id.');' ."\n";
if (((int)$mapMapTypeCustom == 2)
|| ((int)$mapMapTypeGoogle == 0
&& (int)$mapMapTypeOSM == 0))
{
$scripttext .= ' map.setMapTypeId(\'customMapType'.$currentmaptype->id.'\', customMapType'.$currentmaptype->id.');' ."\n";
}
}
}
// Custom Map Type - part 2 (bind) - end
}
if (isset($this->item->latitude) && isset($this->item->longitude)
&& ($this->item->latitude != "") && ($this->item->longitude !="")
)
{
$scripttext .= 'initialLocation = new google.maps.LatLng('.$this->item->latitude.', ' .$this->item->longitude.');' ."\n";
$scripttext .= ' map.setCenter(initialLocation);' ."\n";
$scripttext .= ' marker = new google.maps.Marker({' ."\n";
$scripttext .= ' position: initialLocation, ' ."\n";
$scripttext .= ' draggable:true, ' ."\n";
$scripttext .= ' map: map, ' ."\n";
$scripttext .= ' animation: google.maps.Animation.DROP,' ."\n";
// Replace to new, because all charters are shown
//$scripttext .= ' title:"'.htmlspecialchars(str_replace('\\', '/', $this->item->title) , ENT_QUOTES, 'UTF-8').'"' ."\n";
$scripttext .= ' title:"'.str_replace('\\', '/', str_replace('"', '\'\'', $this->item->title)).'"' ."\n";
$scripttext .= ' });'."\n";
$scripttext .= ' google.maps.event.addListener(marker, \'drag\', function(event) {' ."\n";
$scripttext .= ' document.forms.adminForm.jform_longitude.value = event.latLng.lng();' ."\n";
$scripttext .= ' document.forms.adminForm.jform_latitude.value = event.latLng.lat();' ."\n";
$scripttext .= ' });' ."\n";
$scripttext .= ' google.maps.event.addListener(map, \'click\', function(event) {' ."\n";
$scripttext .= ' marker.setPosition(event.latLng);' ."\n";
$scripttext .= ' document.forms.adminForm.jform_longitude.value = event.latLng.lng();' ."\n";
$scripttext .= ' document.forms.adminForm.jform_latitude.value = event.latLng.lat();' ."\n";
$scripttext .= ' });' ."\n";
}
else
{
if (isset($this->item->addresstext) and ($this->item->addresstext!= ""))
{
$scripttext .= ' geocoder.geocode( { \'address\': "'.$this->item->addresstext.'"}, function(results, status) {'."\n";
$scripttext .= ' if (status == google.maps.GeocoderStatus.OK) {'."\n";
$scripttext .= ' initialLocation = new google.maps.LatLng(results[0].geometry.location.lat(), results[0].geometry.location.lng());' ."\n";
//$scripttext .= ' alert("Geocode was successful");'."\n";
//$scripttext .= ' alert("latlng="+latlng'. $currentmarker->id.');'."\n";
$scripttext .= ' map.setCenter(initialLocation);' ."\n";
$scripttext .= ' marker = new google.maps.Marker({' ."\n";
$scripttext .= ' position: initialLocation, ' ."\n";
$scripttext .= ' draggable:true, ' ."\n";
$scripttext .= ' map: map, ' ."\n";
$scripttext .= ' animation: google.maps.Animation.DROP,' ."\n";
// Replace to new, because all charters are shown
//$scripttext .= ' title:"'.htmlspecialchars(str_replace('\\', '/', $this->item->title) , ENT_QUOTES, 'UTF-8').'"' ."\n";
$scripttext .= ' title:"'.str_replace('\\', '/', str_replace('"', '\'\'', $this->item->title)).'"' ."\n";
$scripttext .= ' });'."\n";
$scripttext .= ' google.maps.event.addListener(marker, \'drag\', function(event) {' ."\n";
$scripttext .= ' document.forms.adminForm.jform_longitude.value = event.latLng.lng();' ."\n";
$scripttext .= ' document.forms.adminForm.jform_latitude.value = event.latLng.lat();' ."\n";
$scripttext .= ' });' ."\n";
$scripttext .= ' google.maps.event.addListener(map, \'click\', function(event) {' ."\n";
$scripttext .= ' marker.setPosition(event.latLng);' ."\n";
$scripttext .= ' document.forms.adminForm.jform_longitude.value = event.latLng.lng();' ."\n";
$scripttext .= ' document.forms.adminForm.jform_latitude.value = event.latLng.lat();' ."\n";
$scripttext .= ' });' ."\n";
$scripttext .= ' }'."\n";
$scripttext .= ' else'."\n";
$scripttext .= ' {'."\n";
$scripttext .= ' alert("'.JText::_('COM_ZHGOOGLEMAP_MAPMARKER_GEOCODING_ERROR_REASON').': " + status + "\n" + "'.JText::_('COM_ZHGOOGLEMAP_MAPMARKER_GEOCODING_ERROR_ADDRESS').': '.$this->item->addresstext.'");'."\n";
$scripttext .= ' initialLocation = spblocation;' ."\n";
$scripttext .= ' map.setCenter(initialLocation);' ."\n";
$scripttext .= ' marker = new google.maps.Marker({' ."\n";
$scripttext .= ' position: initialLocation, ' ."\n";
$scripttext .= ' draggable:true, ' ."\n";
$scripttext .= ' map: map, ' ."\n";
$scripttext .= ' animation: google.maps.Animation.DROP,' ."\n";
// Replace to new, because all charters are shown
//$scripttext .= ' title:"'.htmlspecialchars(str_replace('\\', '/', $this->item->title) , ENT_QUOTES, 'UTF-8').'"' ."\n";
$scripttext .= ' title:"'.str_replace('\\', '/', str_replace('"', '\'\'', $this->item->title)).'"' ."\n";
$scripttext .= ' });'."\n";
$scripttext .= ' google.maps.event.addListener(marker, \'drag\', function(event) {' ."\n";
$scripttext .= ' document.forms.adminForm.jform_longitude.value = event.latLng.lng();' ."\n";
$scripttext .= ' document.forms.adminForm.jform_latitude.value = event.latLng.lat();' ."\n";
$scripttext .= ' });' ."\n";
$scripttext .= ' google.maps.event.addListener(map, \'click\', function(event) {' ."\n";
$scripttext .= ' marker.setPosition(event.latLng);' ."\n";
$scripttext .= ' document.forms.adminForm.jform_longitude.value = event.latLng.lng();' ."\n";
$scripttext .= ' document.forms.adminForm.jform_latitude.value = event.latLng.lat();' ."\n";
$scripttext .= ' });' ."\n";
$scripttext .= ' }'."\n";
$scripttext .= '});'."\n";
}
else
{
$scripttext .= 'initialLocation = spblocation;' ."\n";
$scripttext .= ' map.setCenter(initialLocation);' ."\n";
$scripttext .= ' marker = new google.maps.Marker({' ."\n";
$scripttext .= ' position: initialLocation, ' ."\n";
$scripttext .= ' draggable:true, ' ."\n";
$scripttext .= ' map: map, ' ."\n";
$scripttext .= ' animation: google.maps.Animation.DROP,' ."\n";
// Replace to new, because all charters are shown
//$scripttext .= ' title:"'.htmlspecialchars(str_replace('\\', '/', $this->item->title) , ENT_QUOTES, 'UTF-8').'"' ."\n";
$scripttext .= ' title:"'.str_replace('\\', '/', str_replace('"', '\'\'', $this->item->title)).'"' ."\n";
$scripttext .= ' });'."\n";
$scripttext .= ' google.maps.event.addListener(marker, \'drag\', function(event) {' ."\n";
$scripttext .= ' document.forms.adminForm.jform_longitude.value = event.latLng.lng();' ."\n";
$scripttext .= ' document.forms.adminForm.jform_latitude.value = event.latLng.lat();' ."\n";
$scripttext .= ' });' ."\n";
$scripttext .= ' google.maps.event.addListener(map, \'click\', function(event) {' ."\n";
$scripttext .= ' marker.setPosition(event.latLng);' ."\n";
$scripttext .= ' document.forms.adminForm.jform_longitude.value = event.latLng.lng();' ."\n";
$scripttext .= ' document.forms.adminForm.jform_latitude.value = event.latLng.lat();' ."\n";
$scripttext .= ' });' ."\n";
$scripttext .= ' // Try W3C Geolocation method (Preferred)' ."\n";
$scripttext .= ' if(navigator.geolocation) {' ."\n";
$scripttext .= ' browserSupportFlag = true;' ."\n";
$scripttext .= ' navigator.geolocation.getCurrentPosition(function(position) {' ."\n";
$scripttext .= ' initialLocation = new google.maps.LatLng(position.coords.latitude,position.coords.longitude);' ."\n";
$scripttext .= ' map.setCenter(initialLocation);' ."\n";
$scripttext .= ' marker.setPosition(initialLocation);' ."\n";
//$scripttext .= ' contentString = "Location found using W3C standard";' ."\n";
//$scripttext .= ' infowindow.setContent(contentString);' ."\n";
//$scripttext .= ' infowindow.setPosition(initialLocation);' ."\n";
//$scripttext .= ' infowindow.open(map);' ."\n";
$scripttext .= ' }, function() {' ."\n";
$scripttext .= ' handleNoGeolocation(browserSupportFlag);' ."\n";
$scripttext .= ' });' ."\n";
$scripttext .= ' } else if (google.gears) {' ."\n";
$scripttext .= ' // Try Google Gears Geolocation' ."\n";
$scripttext .= ' browserSupportFlag = true;' ."\n";
$scripttext .= ' var geo = google.gears.factory.create(\'beta.geolocation\');' ."\n";
$scripttext .= ' geo.getCurrentPosition(function(position) {' ."\n";
$scripttext .= ' initialLocation = new google.maps.LatLng(position.latitude,position.longitude);' ."\n";
$scripttext .= ' map.setCenter(initialLocation);' ."\n";
$scripttext .= ' marker.setPosition(initialLocation);' ."\n";
//$scripttext .= ' contentString = "Location found using Google Gears";' ."\n";
//$scripttext .= ' infowindow.setContent(contentString);' ."\n";
//$scripttext .= ' infowindow.setPosition(initialLocation);' ."\n";
//$scripttext .= ' infowindow.open(map);' ."\n";
$scripttext .= ' }, function() {' ."\n";
$scripttext .= ' handleNoGeolocation(browserSupportFlag);' ."\n";
$scripttext .= ' });' ."\n";
$scripttext .= ' } else {' ."\n";
$scripttext .= ' // Browser doesn\'t support Geolocation' ."\n";
$scripttext .= ' browserSupportFlag = false;' ."\n";
$scripttext .= ' handleNoGeolocation(browserSupportFlag);' ."\n";
$scripttext .= ' }' ."\n";
}
}
// Places Begin
$scripttext .= ' inputPlacesAC = document.getElementById(\'searchTextField\');' ."\n";
$scripttext .= ' var autocompletePlaces = new google.maps.places.Autocomplete(inputPlacesAC);' ."\n";
$scripttext .= ' autocompletePlaces.bindTo(\'bounds\', map);' ."\n";
$scripttext .= ' google.maps.event.addListener(autocompletePlaces, \'place_changed\', function() {' ."\n";
$scripttext .= ' var place = autocompletePlaces.getPlace();' ."\n";
$scripttext .= ' var markerPlacesACText = place.name;' ."\n";
$scripttext .= ' if (place.geometry.viewport) ' ."\n";
$scripttext .= ' {' ."\n";
$scripttext .= ' map.fitBounds(place.geometry.viewport);' ."\n";
$scripttext .= ' } ' ."\n";
$scripttext .= ' else ' ."\n";
$scripttext .= ' {' ."\n";
$scripttext .= ' map.setCenter(place.geometry.location);' ."\n";
$scripttext .= ' map.setZoom(17);' ."\n";
$scripttext .= ' }' ."\n";
$scripttext .= ' marker.setPosition(place.geometry.location);' ."\n";
$scripttext .= ' marker.setTitle(markerPlacesACText);' ."\n";
// For normal render marker after move
$scripttext .= ' marker.setMap(map);' ."\n";
$scripttext .= ' document.forms.adminForm.jform_longitude.value = place.geometry.location.lng();' ."\n";
$scripttext .= ' document.forms.adminForm.jform_latitude.value = place.geometry.location.lat();' ."\n";
$scripttext .= ' });' ."\n";
// Places End
// end initialize
$scripttext .= '};' ."\n";
$scripttext .= 'function handleNoGeolocation(errorFlag) {' ."\n";
$scripttext .= ' if (errorFlag == true) {' ."\n";
$scripttext .= ' initialLocation = spblocation;' ."\n";
//$scripttext .= ' contentString = "Error: The Geolocation service failed.";' ."\n";
$scripttext .= ' } else {' ."\n";
$scripttext .= ' initialLocation = spblocation;' ."\n";
//$scripttext .= ' contentString = "Error: Your browser doesn\'t support geolocation.";' ."\n";
$scripttext .= ' }' ."\n";
$scripttext .= ' map.setCenter(initialLocation);' ."\n";
$scripttext .= ' marker.setPosition(initialLocation);' ."\n";
//$scripttext .= ' infowindow.setContent(contentString);' ."\n";
//$scripttext .= ' infowindow.setPosition(initialLocation);' ."\n";
//$scripttext .= ' infowindow.open(map);' ."\n";
$scripttext .= '};' ."\n";
// Find button
$scripttext .= 'function Do_Find() {';
//$scripttext .= 'var findAddressButton = document.getElementById(\'findAddressButton\');' ."\n";
//$scripttext .= 'google.maps.event.addDomListener(findAddressButton, \'click\', function() {' ."\n";
$scripttext .= ' geocoder.geocode( { \'address\': inputPlacesAC.value}, function(results, status) {'."\n";
$scripttext .= ' if (status == google.maps.GeocoderStatus.OK) {'."\n";
$scripttext .= ' var latlngFind = new google.maps.LatLng(results[0].geometry.location.lat(), results[0].geometry.location.lng());' ."\n";
$scripttext .= ' map.setCenter(latlngFind);' ."\n";
$scripttext .= ' map.setZoom(17);' ."\n";
$scripttext .= ' marker.setPosition(latlngFind);' ."\n";
$scripttext .= ' marker.setTitle(inputPlacesAC.value);' ."\n";
// For normal render marker after move
$scripttext .= ' marker.setMap(map);' ."\n";
$scripttext .= ' document.forms.adminForm.jform_longitude.value = latlngFind.lng();' ."\n";
$scripttext .= ' document.forms.adminForm.jform_latitude.value = latlngFind.lat();' ."\n";
$scripttext .= ' }'."\n";
$scripttext .= ' else'."\n";
$scripttext .= ' {'."\n";
$scripttext .= ' alert("'.JText::_('COM_ZHGOOGLEMAP_MAPMARKER_GEOCODING_ERROR_REASON').': " + status + "\n" + "'.JText::_('COM_ZHGOOGLEMAP_MAPMARKER_GEOCODING_ERROR_ADDRESS').': "+inputPlacesAC.value);'."\n";
$scripttext .= ' }'."\n";
$scripttext .= '});'."\n";
//$scripttext .= '});' ."\n";
$scripttext .= '};' ."\n";
$scripttext .= ' function addLoadEvent(func) {' ."\n";
$scripttext .= ' var oldonload = window.onload;' ."\n";
$scripttext .= ' if (typeof window.onload != \'function\') {' ."\n";
$scripttext .= ' window.onload = func;' ."\n";
$scripttext .= ' } else {' ."\n";
$scripttext .= ' window.onload = function() {' ."\n";
$scripttext .= ' if (oldonload) {' ."\n";
$scripttext .= ' oldonload();' ."\n";
$scripttext .= ' }' ."\n";
$scripttext .= ' func();' ."\n";
$scripttext .= ' }' ."\n";
$scripttext .= ' }' ."\n";
$scripttext .= '} ' ."\n";
$scripttext .= 'addLoadEvent(initialize);' ."\n";
$scripttext .= '//]]></script>' ."\n";
// Script end
echo $scripttext;
?>
</div>
<?php
$credits ='<div>'."\n";
if ((int)$mapMapTypeOSM != 0)
{
$credits .= 'OSM '.JText::_('COM_ZHGOOGLEMAP_MAP_POWEREDBY').': ';
$credits .= '<a href="'.$urlProtocol.'://www.openstreetmap.org/" target="_blank">OpenStreetMap</a>'."\n";
}
$credits .='</div>'."\n";
echo $credits;
?>
</div>
</div>
</div>
</div>
<div class="tab-pane" id="tab1">
<fieldset class="adminform">
<?php foreach($this->form->getFieldset('details') as $field): ?>
<div class="control-group">
<?php
if ($field->id == 'jform_markergroup')
{
?>
<div class="control-label">
<?php
echo $field->label;
?>
</div>
<div class="controls">
<?php
array_unshift($this->markerGroupList, JHTML::_('select.option', '', JText::_( 'COM_ZHGOOGLEMAP_MAPMARKER_FILTER_PLACEMARK_GROUP'), 'value', 'text'));
echo JHTML::_( 'select.genericlist', $this->markerGroupList, 'jform[markergroup]', 'class="inputbox span5" size="1"', 'value', 'text', (int)$this->item->markergroup, 'jform_markergroup');
//echo $field->label;
//echo $field->input;
?>
</div>
<?php
}
else if ($field->id == 'jform_descriptionhtml')
{
?>
<div class="control-label">
<?php
echo '<div class="clr"></div>';
echo $field->label;
?>
</div>
<div class="controls">
<?php
echo '<div class="clr"></div>';
echo $field->input;
?>
</div>
<?php
}
else if ($field->id == 'jform_descriptionfullhtml')
{
?>
<div class="control-label">
<?php
echo '<div class="clr"></div>';
echo $field->label;
?>
</div>
<div class="controls">
<?php
echo '<div class="clr"></div>';
echo $field->input;
?>
</div>
<?php
}
else if ($field->id == 'jform_hoverhtml')
{
?>
<div class="control-label">
<?php
echo '<div class="clr"></div>';
echo $field->label;
?>
</div>
<div class="controls">
<?php
echo '<div class="clr"></div>';
echo $field->input;
?>
</div>
<?php
}
else if ($field->id == 'jform_rating_value')
{
?>
<div class="control-label">
<?php
echo $field->label;
?>
</div>
<div class="controls">
<?php
echo "<div>";
$val_cnt_max = 5;
$val_main = $this->item->rating_value;
$val_int = floor($val_main);
if ($val_main > $val_cnt_max)
{
$val_main = $val_cnt_max;
$val_int = $val_cnt_max;
}
$val_cnt = 0;
if ($val_main == 0)
{
echo '<img name="image'.$val_cnt.'" src="'.$utilspath .'star5_00.png" alt="" />';
$val_cnt++;
}
else if ($val_int == 0 && $val_main > 0)
{
echo '<img name="image'.$val_cnt.'" src="'.$utilspath .'star5_05.png" alt="" />';
$val_cnt++;
}
else
{
for ($i=0; $i<$val_int; $i++)
{
echo '<img name="image'.$val_cnt.'" src="'.$utilspath .'star5_10.png" alt="" />';
$val_cnt++;
}
if (ceil(($val_main-$val_int)*10)>4)
{
echo '<img name="image'.$val_cnt.'" src="'.$utilspath .'star5_05.png" alt="" />';
$val_cnt++;
}
}
for ($i=$val_cnt; $i < $val_cnt_max; $i++)
{
echo '<img name="image'.$val_cnt.'" src="'.$utilspath .'star5_00.png" alt="" />';
}
echo "</div>";
echo $field->input;
?>
</div>
<?php
}
else if ($field->id == 'jform_ordering')
{
}
else if ($field->id == 'jform_catid')
{
if ($this->categoryListType == 1)
{
?>
<div class="control-label">
<?php
echo $field->label;
?>
</div>
<div class="controls">
<?php
array_unshift($this->categoryList, JHTML::_('select.option', '', JText::_( 'JOPTION_SELECT_CATEGORY'), 'value', 'text'));
echo JHTML::_( 'select.genericlist', $this->categoryList, 'jform[catid]', 'class="inputbox span5" size="1"', 'value', 'text', (int)$this->item->catid, 'jform_catid');
//echo $field->label;
//echo $field->input;
?>
</div>
<?php
}
else
{
?>
<div class="control-label">
<?php
echo $field->label;
?>
</div>
<div class="controls">
<?php
echo $field->input;
?>
</div>
<?php
}
}
else
{
?>
<div class="control-label">
<?php
echo $field->label;
?>
</div>
<div class="controls">
<?php
echo $field->input;
?>
</div>
<?php
}
?>
</div>
<?php endforeach; ?>
</fieldset>
</div>
<div class="tab-pane" id="tab2">
<fieldset class="adminform">
<?php foreach($this->form->getFieldset('markeradvanced') as $field): ?>
<div class="control-group">
<?php
if ($field->id == 'jform_icontype')
{
?>
<div class="control-label">
<?php
echo $field->label;
?>
</div>
<div class="controls">
<?php
$iconTypeJS = " onchange=\"javascript:
if (document.forms.adminForm.jform_icontype.options[selectedIndex].value!='')
{document.image.src='".$imgpath."' + document.forms.adminForm.jform_icontype.options[selectedIndex].value.replace(/#/g,'%23') + '.png'}
else
{document.image.src=''}\"";
$scriptPosition = ' name=';
echo str_replace($scriptPosition, $iconTypeJS.$scriptPosition, $field->input);
echo '<img name="image" src="'.$imgpath .str_replace("#", "%23", $this->item->icontype).'.png" alt="" />';
echo '<div class="clr"></div>';
echo '<a class="btn btn-primary" href="'.$urlProtocol.'://wiki.zhuk.cc/index.php?title=Zh_GoogleMap_Credits_Icons" target="_blank">'.JText::_( 'COM_ZHGOOGLEMAP_MAP_TERMSOFUSE_ICONS' ).' <img src="'.$utilspath.'info.png" alt="'.JText::_( 'COM_ZHGOOGLEMAP_MAP_TERMSOFUSE_ICONS' ).'" style="margin: 0;" /></a>';
echo '<div class="clr"></div>';
echo '<br />';
?>
</div>
<?php
}
else
{
?>
<div class="control-label">
<?php
echo $field->label;
?>
</div>
<div class="controls">
<?php
echo $field->input;
?>
</div>
<?php
}
?>
</div>
<?php endforeach; ?>
</fieldset>
</div>
<div class="tab-pane" id="tab4">
<fieldset class="adminform">
<?php foreach($this->form->getFieldset('integration') as $field): ?>
<div class="control-group">
<?php
if ($field->id == 'jform_contactid')
{
?>
<div class="control-label">
<?php
echo $field->label;
?>
</div>
<div class="controls">
<?php
//array_unshift($this->contactList, JHTML::_('select.option', '', JText::_( 'COM_ZHGOOGLEMAP_MAPMARKER_FILTER_CONTACT'), 'value', 'text'));
//echo JHTML::_( 'select.genericlist', $this->contactList, 'jform[contactid]', 'class="inputbox" size="1"', 'value', 'text', (int)$this->item->contactid, 'jform_contactid');
echo $field->input;
?>
</div>
<?php
}
/*
By default datatype now not text - user
else if ($field->id == 'jform_createdbyuser')
{
?>
<div class="control-label">
<?php
echo $field->label;
?>
</div>
<div class="controls">
<?php
array_unshift($this->userList, JHTML::_('select.option', '', JText::_( 'COM_ZHGOOGLEMAP_MAPMARKER_FILTER_USER'), 'value', 'text'));
echo JHTML::_( 'select.genericlist', $this->userList, 'jform[createdbyuser]', 'class="inputbox" size="1"', 'value', 'text', (int)$this->item->createdbyuser, 'jform_createdbyuser');
//echo $field->input;
?>
</div>
<?php
}
*/
else
{
?>
<div class="control-label">
<?php
echo $field->label;
?>
</div>
<div class="controls">
<?php
echo $field->input;
?>
</div>
<?php
}
?>
</div>
<?php endforeach; ?>
<?php foreach($this->form->getFieldset('integration_article') as $field): ?>
<div class="control-group">
<?php
if ($field->id == 'jform_articleid')
{
?>
<div class="control-label">
<?php
echo $field->label;
?>
</div>
<div class="controls">
<?php
echo $field->input;
?>
</div>
<?php
}
else
{
?>
<div class="control-label">
<?php
echo $field->label;
?>
</div>
<div class="controls">
<?php
echo $field->input;
?>
</div>
<?php
}
?>
</div>
<?php endforeach; ?>
</fieldset>
</div>
<?php echo $this->loadTemplate('params'); ?>
</div>
<div class="row-fluid">
<input type="hidden" name="task" value="mapmarker.edit" />
<?php echo JHtml::_('form.token'); ?>
</div>
</div>
</form>