reg2005
Захожу иногда

Репутация: +1/-0
Offline
Сообщений: 9
|
 |
« : 28.02.2011, 13:08:37 » |
|
Здравствуйте! Делаю каталог организаций на SOBI2. Решил поставить карту, но карты яндекса и Google не устраивают тем что нет прорисовки нужных мне посёлков. Наткнулся на проект Open street map - то что надо, искомые объекты там прорисованы, а если нет то можно обрисовать самому. Вообщем далее с помощью Угольникова Сергея - webmap-blog.ru отобразил карту со слоем OSM. Сначала меняем код showGoogleMaps из файла entry.functions.php на: function showGoogleMaps($mySobi, $config) {
if( !$config->useGoogleMaps) { return null; }
$title = $config->jsAddSlashes( $mySobi->title ); $GeoPos = $config->getGeoPosition( $mySobi->id ); if( $GeoPos['lat'] && $GeoPos['long'] && is_numeric( $GeoPos['lat'] ) && is_numeric( $GeoPos['lat'] ) ) { ?> <div style="width: <?php echo $config->googleMapsWidth; ?>px; height: <?php echo $config->googleMapsHeight; ?>px;" id="sobi2GoogleMaps"></div> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> //<![CDATA[ function initialize() { var myLatlng = new Google.maps.LatLng(<?php echo $GeoPos['lat']; ?>, <?php echo $GeoPos['long']; ?>); var myOptions = { zoom: <?php echo $config->googleMapsZoom; ?>, center: myLatlng, mapTypeControl: false, navigationControl: true, navigationControlOptions: {style: Google.maps.NavigationControlStyle.SMALL}, mapTypeId: Google.maps.MapTypeId.ROADMAP } var map = new Google.maps.Map(document.getElementById("sobi2GoogleMaps"), myOptions); // Задаем слой с OSM var openStreet = new Google.maps.ImageMapType({ getTileUrl: function(ll, z) { var X = ll.x % (1 << z); // wrap return "http://tile.openstreetmap.org/" + z + "/" + X + "/" + ll.y + ".png"; }, tileSize: new Google.maps.Size(256, 256), isPng: true, maxZoom: 18, name: "OSM", alt: "Слой с Open Streetmap" }); //Добавляем слои к карте map.mapTypes.set('osm', openStreet); map.setMapTypeId('osm'); map.setOptions({ mapTypeControlOptions: { mapTypeIds: [ 'osm', Google.maps.MapTypeId.ROADMAP, Google.maps.MapTypeId.TERRAIN, Google.maps.MapTypeId.SATELLITE, Google.maps.MapTypeId.HYBRID ], style: Google.maps.MapTypeControlStyle.DROPDOWN_MENU } }); var marker = new Google.maps.Marker({ position: myLatlng, map: map, title:"<?php echo _SOBI2_GOOGLEMAPS_LABEL; ?>" });
} Google.maps.event.addDomListener(window,'load', initialize); //]]> </script> <?php } elseif ((strlen(trim($GeoPos['lat'])) && strlen(trim($GeoPos['long']))) && (!is_numeric($GeoPos['lat']) || !is_numeric($GeoPos['lat']))) { trigger_error("HTML_SOBI::showGoogleMaps(): Given cooordinates ({$GeoPos['lat']}, {$GeoPos['long']}) are not correct. Please enter float values"); } } function waySearchUrl( $waySearchLink ) { $config =& sobi2Config::getInstance(); if($config->useWaySearch) { echo $waySearchLink; } } }
Далее добавляем поле field_fetchcoordinates в менеджере полей (тип поля text_code) и вставляем туда код: <script src="http://maps.google.com/maps?file=api&v=1&key={googleApiKey}" type="text/javascript"></script>; <div id="map" style="width: 400px; height: 300px"></div> <script type="text/javascript"> //<![CDATA[ var start_latitude = "52.4777619318499"; var start_longitude = "-1.89788818359375"; var zoomlevel_add = 11; var zoomlevel_edit = 3; var map = new GMap(document.getElementById("map")); map.addControl(new GSmallMapControl()); //Custom function for fetchng tiles from OSM server CustomGetTileUrl=function(a,b){ return 'http://a.tile.openstreetmap.org/'+b+'/'+a.x+'/'+a.y+'.png'; }
var copyright = new GCopyright(1,
new GLatLngBounds(new GLatLng(53.8136257,-3.0981445),
new GLatLng(53.8654855,-2.9663944) ), 17, "");
var copyrightCollection = new GCopyrightCollection('');
copyrightCollection.addCopyright(copyright);
var tilelayers = [new GTileLayer(copyrightCollection,1,17)];
tilelayers[0].getTileUrl = CustomGetTileUrl;
var osmmap = new GMapType(tilelayers, G_SATELLITE_MAP.getProjection(), "OSM");
map.addMapType(osmmap); var latitude = document.getElementById('field_latitude').value; if (latitude == "") latitude = start_latitude; var longitude = document.getElementById('field_longitude').value; if (longitude == "") longitude = start_longitude; if (latitude == start_latitude) zoomlevel = zoomlevel_add; else zoomlevel = zoomlevel_edit; // center and zoom to the lat/long in the form map.setCenter(new GLatLng(longitude,latitude), zoomlevel, osmmap); GEvent.addListener(map, 'click', function(overlay, point) { if (point) { document.getElementById('field_latitude').value = point.y; document.getElementById('field_longitude').value = point.x; } } ); //]]> </script>
Теперь создаём поля "широта (field_latitude)" "Долгота (field_longitude)". И пробуем! Данный скрипт я позже немного модифицировал, теперь в форме добавления при выборе посёлка карта автоматически отображает это посёлок.
|
|
|
|
|
Записан
|
|
|
|
| |
|
marozz1k
|
 |
« Ответ #1 : 14.05.2011, 12:21:38 » |
|
Очень нужны эти карты, но не выходит. Яндекс карты как-то сразу заработали а с этими вообще всё перепробывал, делал как вы написали, вот эффект 
|
|
|
|
|
Записан
|
|
|
|
reg2005
Захожу иногда

Репутация: +1/-0
Offline
Сообщений: 9
|
 |
« Ответ #2 : 14.05.2011, 13:11:17 » |
|
А при добавлении в каталог карта отображается? Если да то проблему надо искать в файле enty.functions.php. И еще возможно вы не получили Google maps API-key. Его нужно ввести в настройках компонента.
|
|
|
|
|
Записан
|
|
|
|
|
marozz1k
|
 |
« Ответ #3 : 14.05.2011, 15:27:24 » |
|
я не понял что такое "при добавлении в каталог" я SOBI2 установил 2 дня назад, еще не разбирался особо, API-key получил ввёл, так что не изза него. В entry.functions.php я нашел где начинается функция Google , выделил до конца файла и заменил вашей. Попробуйте если не сложно http://33strausa.ru/index.php/sobi2.html
|
|
|
|
« Последнее редактирование: 14.05.2011, 15:33:19 от marozz1k »
|
Записан
|
|
|
|
|
marozz1k
|
 |
« Ответ #4 : 14.05.2011, 15:36:26 » |
|
код файла entry.function.php <?php /** * @version $Id: entry.functions.php 5471 2010-09-01 06:40:13Z Sigrid Suski $ * @package: Sigsiu Online Business Index 2 (Sobi2) * =================================================== * @author * Name: Sigrid & Radek Suski, Sigsiu.NET GmbH * Email: sobi[at]sigsiu.net * Url: http://www.sigsiu.net * =================================================== * @copyright Copyright (C) 2006 - 2010 Sigsiu.NET GmbH (http://www.sigsiu.net). All rights reserved. * @license see http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU/GPL. * You can use, redistribute this file and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation. */ defined( '_SOBI2_' ) || exit("Restricted access"); class sobiSpecFunc { /** * executing mambots for a field * @author Mnhas * @link http://minimus.dmkhost.net * @param string $text * @global array $_MAMBOTS * @return string */ function execMambots( $text ) { if( class_exists( 'JPluginHelper' ) ) { return sobiSpecFunc::execJPlugins( $text ); } global $_MAMBOTS; $config =& sobi2Config::getInstance(); $database = $config->getDb();
$defaultItemId = $config->sobi2Itemid;
// define ItemId for which you will execute mambots if ( isset($_REQUEST['Itemid']) ) { $n_ItemId = $_REQUEST['Itemid']; } else { $n_ItemId = $defaultItemId; }
//prepare content: set $row main text variable; $row = new stdClass(); $row->text = $text;
//initialize $params variable $menu =& sobi2bridge::jMenu( $database ); $menu->load( $n_ItemId ); $params =& sobi2bridge::jParams( $menu->params );
$_MAMBOTS->loadBotGroup("content"); //call on function onPrepareContent of all mambots in the group content //pass parameters '1'=published, $row, $params to those functions $args = array( 1, &$row, &$params ); $_MAMBOTS->trigger( 'onPrepareContent', $args, false ); //store parsed content in the original variable; $text = $row->text; return $text; } /** * executing Joomla 1.5 plugins for a field * @author Radek Suski * @param string $text * @return string */ function execJPlugins( $text ) { $row = new stdClass(); $row->text = $text; JPluginHelper::importPlugin( 'content' ); $dispatcher =& JDispatcher::getInstance(); $mainframe =& JFactory::getApplication( 'site' ); $params =& $mainframe->getParams( 'com_content' ); $results = $dispatcher->trigger( 'onPrepareContent', array ( &$row, & $params, 0 ) ); $text = $row->text; return $text; } /** * Returning array or string of selected categories * * @param SOBI2 $mySobi * @return array */ function getMyCategories( $mySobi, $string = false, $wholePath = false ) { $config =& sobi2Config::getInstance(); $database = &$config->getDb(); if( $wholePath && $string ) { sobi2Config::import( "category.class" ); $catSep = $config->key( "frontpage", "entry_show_cat_func_cat_sep", "<br/>" ); $pathSep = $config->key( "frontpage", "entry_show_cat_func_path_sep", " >> " ); $catsString = null; $mySobiCategories = array_flip( $mySobi->myCategories ); foreach ( $mySobiCategories as $cid ) { $cats = array(); $config->getParentCats( $cid, $cats ); if( is_array( $cats ) && !empty( $cats ) ) { $catParts = array(); foreach ( $cats as $catid ) { $category = new sobi2Category( $catid ); $url = sobi2Config::sef( "index.php?option=com_sobi2&catid={$category->catid}&Itemid={$config->sobi2Itemid}" ); $catParts[] = "<a href=\"{$url}\" title=\"{$category->name}\">{$category->name}</a>"; } $catParts = array_reverse( $catParts ); $catsString .= implode( $pathSep, $catParts ); } $catsString .= $catSep; } return $catsString; } else { $cids = is_array( $mySobi->myCategories ) && !empty( $mySobi->myCategories )? implode(" , ", array_flip( $mySobi->myCategories ) ) : null; if( !$cids ) { return null; } $selectedCats = array(); $catsString = array(); $query = "SELECT name, icon, catid, introtext FROM `#__sobi2_categories` AS cat WHERE catid IN ({$cids}) AND cat.published = 1"; $database->setQuery($query); $database->query(); $categories = $database->loadObjectList(); if ($database->getErrorNum()) { trigger_error("HTML_SOBI::getMyCategories(): DB reports: ".$database->stderr(), E_USER_WARNING); } foreach ($categories as $category) { $category->name = stripslashes(stripslashes($category->name)); $category->introtext = stripslashes($category->introtext); if($category->icon) { $img = "<img src=\"{$config->liveSite}{$config->catImagesFolder}{$category->icon}\" alt=\"{$category->name}\" title=\"{$category->introtext}\" />"; } else { $img = null; } $href = sobi2Config::sef("index.php?option=com_sobi2&catid={$category->catid}&Itemid={$config->sobi2Itemid}"); $selectedCats[] = array('name' => $category->name, 'href' => $href, 'icon' => $img, 'introtext' => $category->introtext); $catsString[] = "<a href=\"{$href}\" title=\"{$category->introtext}\">{$category->name}</a>"; } if(!$string) { return $selectedCats; } return implode( " | ", $catsString ); } } /** * displaying hits * * @param sobi2Config $config * @param SOBI2 $mySobi */ function showHits($config,$mySobi) { if($config->showHits) { if( $config->key( "details_view", "show_hits_label", true ) ) { echo _SOBI2_HITS." ".$mySobi->hits; } else { echo $mySobi->hits; } } } /** * displaying added date * * @param sobi2Config $config * @param SOBI2 $mySobi */ function addedDate($config,$mySobi) { if($config->showAddedDate) { $date = date( $config->key( "details_view", "added_date_format", "F j, Y, g:i a" ), strtotime( $mySobi->publish_up ) ); if( $config->key( "details_view", "show_added_date_label", true ) ) { echo _SOBI2_DATE_ADDED." ".$date; } else { echo $date; } } } /** * displaying selected tags for an entry * * @param array $metaKeys * @param int $count * @return string */ function showTags($metaKeys, $count = 5) { $config =& sobi2Config::getInstance(); if( is_a( $metaKeys, "sobi2" ) ) { $metaKeys = $metaKeys->metakey; } if(!$metaKeys || empty($metaKeys)) { return null; } $tags = explode(",",$metaKeys); if( $config->key( "details_view", "show_tagged_label", true ) ) { $string = _SOBI2_ENTRY_TAGGED_WITH; } else { $string = null; } for ($i = 0; $i < $count; $i++) { if(isset($tags[$i]) && !empty($tags[$i])) { $tag = trim($tags[$i]); $href = sobi2Config::sef("index.php?option=com_sobi2&tag={$tag}&Itemid={$config->sobi2Itemid}"); $title = _SOBI2_ENTRIES_TAGGED_WITH." '{$tag}'"; $string .= "<a href=\"{$href}\" title=\"{$title}\">{$tag}</a>"; if($i != $count && isset($tags[$i + 1]) && !empty($tags[$i +1 ])) { $string .= ", "; } } else { break; } } return $string; } /** * @param SOBI2 $mySobi * @param int $days */ function newLabel( $mySobi, $days = 3 ) { if(strtotime($mySobi->publish_up) > mktime() - ($days * 86400)) { return '<span class="sobiNewLabel">'._SOBI2_NEW_LABEL.'</span>'; } } /** * @param SOBI2 $mySobi * @param int $days */ function updatedLabel( $mySobi, $days = 3 ) { if(strtotime($mySobi->lastUpdate) > mktime() - ($days * 86400)) { return '<span class="sobiUpdatedLabel">'._SOBI2_UPDATED_LABEL.'</span>'; } } /** * @param SOBI2 $mySobi * @param int $hits */ function hotLabel( $mySobi, $hits = 500 ) { if($mySobi->hits > $hits) { return '<span class="sobiHotLabel">'._SOBI2_HOT_LABEL.'</span>'; } } /** * @param SOBI2 $mySobi * @param string $name */ function userHref( $mySobi, $name = "real" ) { if(!$mySobi->owner) { return null; } $config =& sobi2Config::getInstance(); $db =& $config->getDb(); $user =& sobi2bridge::jUser( $db ); $user->load( $mySobi->owner ); $userLink = "index.php?option=com_sobi2&sobi2Task=usersListing&uid={$mySobi->owner}&Itemid={$config->sobi2Itemid}"; $userLink = sobi2Config::sef( $userLink ); if( $name == 'real' ) { $uname = $user->name; } else { $uname = $user->username; } $title = str_replace( array( "%username%" ,"%name%" ), array( $user->username, $user->name ), _SOBI2_USER_OWN_LISTING ); $userLink = "<a href=\"{$userLink}\" title=\"{$title}\">{$uname}</a>"; return $userLink; } /** * @param SOBI2 $mySobi * @param string $name */ function userCBHref( $mySobi, $name = "real" ) { if(!$mySobi->owner) { return null; } if( !sobi2Config::translatePath( "components|com_comprofiler|comprofiler", "root" ) ) { trigger_error( "Community Builder seems not to be installed.", E_USER_WARNING ); return self::userHref( $mySobi, $name ); } $config =& sobi2Config::getInstance(); $db =& $config->getDb(); $user =& sobi2bridge::jUser( $db ); $user->load( $mySobi->owner ); if( !( class_exists( 'JFactory' ) ) ) { $query = "SELECT `id` FROM `#__menu` WHERE `link` LIKE '%index.php?option=com_comprofiler%' AND `type` = 'components' AND `published` = '1' LIMIT 1"; } else { $query = "SELECT `id` FROM `#__menu` WHERE `link` LIKE '%index.php?option=com_comprofiler%' AND `type` = 'component' AND `published` = '1' LIMIT 1"; } $db->setQuery( $query ); $mid = $db->loadResult(); if( $mid && is_int( $mid ) ) { $mid = "&Itemid={$mid}"; } else { $mid = null; } $userLink = "index.php?option=com_comprofiler&task=userProfile&user={$user->id}{$mid}"; $userLink = sobi2Config::sef( $userLink ); if( $name == "real") { $uname = $user->name; } else { $uname = $user->username; } $title = str_replace( array( "%username%" ,"%name%" ), array( $user->username, $user->name ), _SOBI2_USER_OWN_LISTING ); $userLink = "<a href=\"{$userLink}\" title=\"{$title}\">{$uname}</a>"; return $userLink; } /** * Enter description here... * * @param string $txt */ function replace( $txt, $key = null ) { static $def = array(); if( empty( $def ) ) { $config =& sobi2Config::getInstance(); if( $file = sobi2Config::translatePath( $config->key( "string", "replace_definion", null ), "front", true, ".ini" ) ) { $def = parse_ini_file( $file ); } else { trigger_error( "Cannot find replace definition file", E_USER_WARNING ); return $txt; } } if( !$key ) { foreach ( $def as $replace => $with ) { $txt = preg_replace( "/\b{$replace}\b/", $with, $txt ); } } else { if( key_exists( $key, $def ) ) { $txt = preg_replace( "/\b{$def[$key]}\b/", $with, $txt ); //$txt = sobi2_ereg_replace( "[[:<:]]{$def[$key]}[[:>:]]", $with, $txt ); } else { trigger_error( "Replacement key '{$key}' does not exist ", E_USER_WARNING ); } } return $txt; } function addedDateOnly($config,$mySobi) { if($config->showAddedDate) { echo _SOBI2_DATE_ADDED." ".date("j.n.Y",strtotime ($mySobi->publish_up)); } } /** * Enter description here... * * @param sobiField $field * @param SOBI2 $mySobi */ function countClick( $field, $mySobi, $showCounter = true ) { $config =& sobi2Config::getInstance(); $database =& $config->getDb(); $value = null; $count = null; static $script = false; if( $field->isUrl && strlen( $field->data ) ) { $onclick = "onclick=\"SobiCC( {$mySobi->id}, {$field->fieldid} );\""; $field->data_int = $field->data_int ? $field->data_int : 0; if( $showCounter ) { $count = str_replace( '%count%', $field->data_int, _CCOUNT_VISITED ); } if( $field->isUrl == 1 ) { $value = "<a href=\"{$field->data}\" {$onclick} title=\"{$mySobi->title}\" target=\"_blank\">{$field->label}{$count}</a>"; } elseif( $field->isUrl == 2 ) { $value = "<a href=\"mailto:{$field->data}\" {$onclick} title=\"{$mySobi->title}\" target=\"_blank\">{$field->label}{$count}</a>"; } } if( !$script ) { $script = true; $config->addCustomScript( 'function SobiCC( sid, fid ) { url = "index2.php?option=com_sobi2&no_html=1&sobi2&sobi2Task=countVisit&fid="+fid+"&sid="+sid+"&Itemid='.$config->sobi2Itemid.'"; if ( window.XMLHttpRequest ) { SCCReq = new XMLHttpRequest(); if ( SCCReq.overrideMimeType ) { SCCReq.overrideMimeType( "text/xml" ); } } else if ( window.ActiveXObject ) { try { SCCReq = new ActiveXObject( "Msxml2.XMLHTTP" ); } catch ( e ) { try { SCCReq = new ActiveXObject( "Microsoft.XMLHTTP" ); } catch ( e ) {} } } SCCReq.open( "GET",url , true ); SCCReq.setRequestHeader( "Content-type", "application/x-www-form-urlencoded" ); SCCReq.setRequestHeader( "Connection", "close" ); SCCReq.send( null ); } ' ); } return $value; } /** * Enter description here... * * @param sobiField $field * @param SOBI2 $mySobi */ function toQuickEdit( $field, $mySobi ) { $config =& sobi2Config::getInstance(); $database = &$config->getDb(); $sobi2Frontend = &$config->getFrontend(); $my =& $config->getUser(); static $loaded = false; static $admFields = array(); $onclick = null; $data = $field->data; if( ( ($my->id != 0 && $my->id == $mySobi->owner && $config->allowUserToEditEntry ) || $config->checkPerm() ) && $config->key( "details_view", "allow_quick_edit" ) ) { if( !$config->checkPerm() && !$loaded ) { $query = "SELECT fieldid FROM `#__sobi2_fields` WHERE displayed = 1"; $database->setQuery( $query ); $admFields = $database->loadResultArray(); if ($database->getErrorNum()) { trigger_error("DB reports: ".$database->stderr(), E_USER_WARNING); } $fieldsIgnore = $config->key("details_view","quickedit_fields_ignore"); if( strlen($fieldsIgnore) ) { // $fieldsIgnore = explode(",", $fieldsIgnore ); array_push($admFields,$fieldsIgnore); } } if( !in_array( $field->fieldid, $admFields ) ) { $t = _JS_SOBI2_QFIELD_DBL_CLK_TO_EDIT; $onclick = "ondblclick=\"sobiEditField('sobi2Details_{$field->fieldname}', {$field->fieldid})\" title=\"{$t}\""; } } $data = "\n\t\t<span {$onclick} id=\"sobi2Details_{$field->fieldname}\">{$data}</span>"; return $data; }
/** * PHP Function to Locally store website images from http://www.thumshots.org * Code is free. No guarantees or warranties. * Based on code by Daniel Schulman * @param string $url * @param string $alt * @param string $style * @param string $params * @return string */ function getThumbshotsOrg( $url, $alt = '', $style = 'border-style:none;', $params = null ) { $config =& sobi2Config::getInstance(); //Where Thumbnail images are stored locally $subDir = $config->key( "thumshots.org", "subdir_name", "thumbs" ); $defImg = $config->key( "thumshots.org", "no_thumb" ); $local_thumb_dir = sobi2Config::translateDirPath( "{$config->imagesFolder}|{$subDir}", "root", false ); //How many days till check if new thumbnail $days_to_keep = $config->key( "thumshots.org", "days_to_keep", 60 );; //To use if no thumbnail exists $return_img = sobi2Config::translatePath( "{$config->imagesFolder}|{$subDir}|{$defImg}", "root", false, '' );
if( !file_exists( $local_thumb_dir ) ) { sobi2Config::sobiMakePath( $local_thumb_dir ); }
if ( substr( $url, 0, 4 )!= 'http' ) { $url = 'http://' . $url; //Make sure URL proper } $url = urlencode( $url ); $fname = str_replace( array( '%3A', '%2F', '%3F', '%3D', '%26' ), '_', $url ); $full_img_path = sobi2Config::translatePath( "{$config->imagesFolder}|{$subDir}|{$fname}", "root", false, '.jpg' );
if( file_exists( $full_img_path ) ) { //check age $diff =( time() - filemtime( $full_img_path) ) /60 /60 /24 ; if ( $diff > $days_to_keep ) { unlink( $full_img_path ); } else { $return_img = "{$config->liveSite}/{$config->imagesFolder}/{$subDir}/{$fname}.jpg"; } } if( !file_exists( $full_img_path ) ) { //get from thumbshots.org $buff = file_get_contents( "http://open.thumbshots.org/image.pxf?url={$url}" ); if( strlen( $buff ) ) { $fp = fopen( $full_img_path, "wb" ); fwrite( $fp,$buff ); fclose( $fp ); $return_img = "{$config->liveSite}/{$config->imagesFolder}/{$subDir}/{$fname}.jpg"; } } $html = "<img src=\"{$return_img}\" style=\"{$style}\" alt=\"{$alt}\" {$params} />"; return $html; } function createWaySearchUrl( $sobi2Id ) { $config =& sobi2Config::getInstance(); if(!$config->useWaySearch) { return null; } $waySearchLink = $config->waySearchUrl; $fields = array(); $counter = 0; sobi2Config::import("field.class"); foreach ( $config->waySearchFields as $k => $fid ) { if( $fid ) { $field = new sobiField( $fid, $sobi2Id ); $fields[ $k ] = urlencode( $config->getSobiStr( $field->data ) ); if( !empty( $field->data ) ) { $counter++; } } } if( $counter < $config->key( "url", "way_search_min_fields", 2 ) ) { return null; } $WSstreet = isset($fields['STREET'])? $fields['STREET'] : null; $WScity = isset($fields['CITY'])? $fields['CITY'] : null; $WSpostcode = isset($fields['ZIPCODE'])? $fields['ZIPCODE'] : null; $WScounty = isset($fields['COUNTY'])? $fields['COUNTY'] : null; $WSfstate = isset($fields['FEDSTATE'])? $fields['FEDSTATE'] : null; $WScountry = isset($fields['COUNTRY'])? $fields['COUNTRY'] : null; $waySearchLink = str_replace( array( "STREET", "CITY", "ZIPCODE", "COUNTY", "FEDSTATE", "COUNTRY" ), array( $WSstreet, $WScity, $WSpostcode, $WScounty, $WSfstate, $WScountry ), $waySearchLink ); $waySearchLink = str_replace('&', '&', $waySearchLink ); $waySearchLink = str_replace('\\', null, $waySearchLink ); $waySearchLink = html_entity_decode( $waySearchLink ); $waySearchLink = "<span class=\"sobi2WaySearch\"><a href=\"{$waySearchLink}\" class=\"sobi2WaySearch\" target=\"_blank\">{$config->waySearchLabel}</a></span>"; return $waySearchLink; } /** * * @param SOBI2 $mySobi * @param sobi2config $config * @return string */ function showGoogleMaps($mySobi, $config) {
if( !$config->useGoogleMaps) { return null; }
$title = $config->jsAddSlashes( $mySobi->title ); $GeoPos = $config->getGeoPosition( $mySobi->id ); if( $GeoPos['lat'] && $GeoPos['long'] && is_numeric( $GeoPos['lat'] ) && is_numeric( $GeoPos['lat'] ) ) { ?> <div style="width: <?php echo $config->googleMapsWidth; ?>px; height: <?php echo $config->googleMapsHeight; ?>px;" id="sobi2GoogleMaps"></div> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> //<![CDATA[ function initialize() { var myLatlng = new Google.maps.LatLng(<?php echo $GeoPos['lat']; ?>, <?php echo $GeoPos['long']; ?>); var myOptions = { zoom: <?php echo $config->googleMapsZoom; ?>, center: myLatlng, mapTypeControl: false, navigationControl: true, navigationControlOptions: {style: Google.maps.NavigationControlStyle.SMALL}, mapTypeId: Google.maps.MapTypeId.ROADMAP } var map = new Google.maps.Map(document.getElementById("sobi2GoogleMaps"), myOptions); // Задаем слой с OSM var openStreet = new Google.maps.ImageMapType({ getTileUrl: function(ll, z) { var X = ll.x % (1 << z); // wrap return "http://tile.openstreetmap.org/" + z + "/" + X + "/" + ll.y + ".png"; }, tileSize: new Google.maps.Size(256, 256), isPng: true, maxZoom: 18, name: "OSM", alt: "Слой с Open Streetmap" }); //Добавляем слои к карте map.mapTypes.set('osm', openStreet); map.setMapTypeId('osm'); map.setOptions({ mapTypeControlOptions: { mapTypeIds: [ 'osm', Google.maps.MapTypeId.ROADMAP, Google.maps.MapTypeId.TERRAIN, Google.maps.MapTypeId.SATELLITE, Google.maps.MapTypeId.HYBRID ], style: Google.maps.MapTypeControlStyle.DROPDOWN_MENU } }); var marker = new Google.maps.Marker({ position: myLatlng, map: map, title:"<?php echo _SOBI2_GOOGLEMAPS_LABEL; ?>" });
} Google.maps.event.addDomListener(window,'load', initialize); //]]> </script> <?php } elseif ((strlen(trim($GeoPos['lat'])) && strlen(trim($GeoPos['long']))) && (!is_numeric($GeoPos['lat']) || !is_numeric($GeoPos['lat']))) { trigger_error("HTML_SOBI::showGoogleMaps(): Given cooordinates ({$GeoPos['lat']}, {$GeoPos['long']}) are not correct. Please enter float values"); } } function waySearchUrl( $waySearchLink ) { $config =& sobi2Config::getInstance(); if($config->useWaySearch) { echo $waySearchLink; } } } ?> поле field_fetchcoordinates всё правильно сделал. проверил // Под спойлер убирайте большой код
|
|
|
|
« Последнее редактирование: 14.05.2011, 16:18:09 от SyncMaster »
|
Записан
|
|
|
|
reg2005
Захожу иногда

Репутация: +1/-0
Offline
Сообщений: 9
|
 |
« Ответ #5 : 15.05.2011, 16:21:13 » |
|
Найди исходный entry.functions.php и глянь до конца ли идет код функции Google. Я сейчас не имею возможности глянуть ориг. файл. Предпологаю что ты мог при замене удалить нужный код.
|
|
|
|
|
Записан
|
|
|
|
reg2005
Захожу иногда

Репутация: +1/-0
Offline
Сообщений: 9
|
 |
« Ответ #6 : 15.05.2011, 16:26:05 » |
|
И ещё, щас смотрел на твой сайт через FireBug код карты отображается но русские слова в вопросиках, так что прекодируй entry.functions.php в utf-8 ("notepad++" тебе в помощь), и перепроверь все ли поля ты создал, если да то отредактируй все записи и отметь на карте точки.
|
|
|
|
|
Записан
|
|
|
|
|
marozz1k
|
 |
« Ответ #7 : 15.05.2011, 16:50:14 » |
|
до конца функция вроде идет, вот оригинальный ... <?php /** * @version $Id: entry.functions.php 5471 2010-09-01 06:40:13Z Sigrid Suski $ * @package: Sigsiu Online Business Index 2 (Sobi2) * =================================================== * @author * Name: Sigrid & Radek Suski, Sigsiu.NET GmbH * Email: sobi[at]sigsiu.net * Url: http://www.sigsiu.net * =================================================== * @copyright Copyright (C) 2006 - 2010 Sigsiu.NET GmbH (http://www.sigsiu.net). All rights reserved. * @license see http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU/GPL. * You can use, redistribute this file and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation. */ defined( '_SOBI2_' ) || exit("Restricted access"); class sobiSpecFunc { /** * executing mambots for a field * @author Mnhas * @link http://minimus.dmkhost.net * @param string $text * @global array $_MAMBOTS * @return string */ function execMambots( $text ) { if( class_exists( 'JPluginHelper' ) ) { return sobiSpecFunc::execJPlugins( $text ); } global $_MAMBOTS; $config =& sobi2Config::getInstance(); $database = $config->getDb();
$defaultItemId = $config->sobi2Itemid;
// define ItemId for which you will execute mambots if ( isset($_REQUEST['Itemid']) ) { $n_ItemId = $_REQUEST['Itemid']; } else { $n_ItemId = $defaultItemId; }
//prepare content: set $row main text variable; $row = new stdClass(); $row->text = $text;
//initialize $params variable $menu =& sobi2bridge::jMenu( $database ); $menu->load( $n_ItemId ); $params =& sobi2bridge::jParams( $menu->params );
$_MAMBOTS->loadBotGroup("content"); //call on function onPrepareContent of all mambots in the group content //pass parameters '1'=published, $row, $params to those functions $args = array( 1, &$row, &$params ); $_MAMBOTS->trigger( 'onPrepareContent', $args, false ); //store parsed content in the original variable; $text = $row->text; return $text; } /** * executing Joomla 1.5 plugins for a field * @author Radek Suski * @param string $text * @return string */ function execJPlugins( $text ) { $row = new stdClass(); $row->text = $text; JPluginHelper::importPlugin( 'content' ); $dispatcher =& JDispatcher::getInstance(); $mainframe =& JFactory::getApplication( 'site' ); $params =& $mainframe->getParams( 'com_content' ); $results = $dispatcher->trigger( 'onPrepareContent', array ( &$row, & $params, 0 ) ); $text = $row->text; return $text; } /** * Returning array or string of selected categories * * @param SOBI2 $mySobi * @return array */ function getMyCategories( $mySobi, $string = false, $wholePath = false ) { $config =& sobi2Config::getInstance(); $database = &$config->getDb(); if( $wholePath && $string ) { sobi2Config::import( "category.class" ); $catSep = $config->key( "frontpage", "entry_show_cat_func_cat_sep", "<br/>" ); $pathSep = $config->key( "frontpage", "entry_show_cat_func_path_sep", " >> " ); $catsString = null; $mySobiCategories = array_flip( $mySobi->myCategories ); foreach ( $mySobiCategories as $cid ) { $cats = array(); $config->getParentCats( $cid, $cats ); if( is_array( $cats ) && !empty( $cats ) ) { $catParts = array(); foreach ( $cats as $catid ) { $category = new sobi2Category( $catid ); $url = sobi2Config::sef( "index.php?option=com_sobi2&catid={$category->catid}&Itemid={$config->sobi2Itemid}" ); $catParts[] = "<a href=\"{$url}\" title=\"{$category->name}\">{$category->name}</a>"; } $catParts = array_reverse( $catParts ); $catsString .= implode( $pathSep, $catParts ); } $catsString .= $catSep; } return $catsString; } else { $cids = is_array( $mySobi->myCategories ) && !empty( $mySobi->myCategories )? implode(" , ", array_flip( $mySobi->myCategories ) ) : null; if( !$cids ) { return null; } $selectedCats = array(); $catsString = array(); $query = "SELECT name, icon, catid, introtext FROM `#__sobi2_categories` AS cat WHERE catid IN ({$cids}) AND cat.published = 1"; $database->setQuery($query); $database->query(); $categories = $database->loadObjectList(); if ($database->getErrorNum()) { trigger_error("HTML_SOBI::getMyCategories(): DB reports: ".$database->stderr(), E_USER_WARNING); } foreach ($categories as $category) { $category->name = stripslashes(stripslashes($category->name)); $category->introtext = stripslashes($category->introtext); if($category->icon) { $img = "<img src=\"{$config->liveSite}{$config->catImagesFolder}{$category->icon}\" alt=\"{$category->name}\" title=\"{$category->introtext}\" />"; } else { $img = null; } $href = sobi2Config::sef("index.php?option=com_sobi2&catid={$category->catid}&Itemid={$config->sobi2Itemid}"); $selectedCats[] = array('name' => $category->name, 'href' => $href, 'icon' => $img, 'introtext' => $category->introtext); $catsString[] = "<a href=\"{$href}\" title=\"{$category->introtext}\">{$category->name}</a>"; } if(!$string) { return $selectedCats; } return implode( " | ", $catsString ); } } /** * displaying hits * * @param sobi2Config $config * @param SOBI2 $mySobi */ function showHits($config,$mySobi) { if($config->showHits) { if( $config->key( "details_view", "show_hits_label", true ) ) { echo _SOBI2_HITS." ".$mySobi->hits; } else { echo $mySobi->hits; } } } /** * displaying added date * * @param sobi2Config $config * @param SOBI2 $mySobi */ function addedDate($config,$mySobi) { if($config->showAddedDate) { $date = date( $config->key( "details_view", "added_date_format", "F j, Y, g:i a" ), strtotime( $mySobi->publish_up ) ); if( $config->key( "details_view", "show_added_date_label", true ) ) { echo _SOBI2_DATE_ADDED." ".$date; } else { echo $date; } } } /** * displaying selected tags for an entry * * @param array $metaKeys * @param int $count * @return string */ function showTags($metaKeys, $count = 5) { $config =& sobi2Config::getInstance(); if( is_a( $metaKeys, "sobi2" ) ) { $metaKeys = $metaKeys->metakey; } if(!$metaKeys || empty($metaKeys)) { return null; } $tags = explode(",",$metaKeys); if( $config->key( "details_view", "show_tagged_label", true ) ) { $string = _SOBI2_ENTRY_TAGGED_WITH; } else { $string = null; } for ($i = 0; $i < $count; $i++) { if(isset($tags[$i]) && !empty($tags[$i])) { $tag = trim($tags[$i]); $href = sobi2Config::sef("index.php?option=com_sobi2&tag={$tag}&Itemid={$config->sobi2Itemid}"); $title = _SOBI2_ENTRIES_TAGGED_WITH." '{$tag}'"; $string .= "<a href=\"{$href}\" title=\"{$title}\">{$tag}</a>"; if($i != $count && isset($tags[$i + 1]) && !empty($tags[$i +1 ])) { $string .= ", "; } } else { break; } } return $string; } /** * @param SOBI2 $mySobi * @param int $days */ function newLabel( $mySobi, $days = 3 ) { if(strtotime($mySobi->publish_up) > mktime() - ($days * 86400)) { return '<span class="sobiNewLabel">'._SOBI2_NEW_LABEL.'</span>'; } } /** * @param SOBI2 $mySobi * @param int $days */ function updatedLabel( $mySobi, $days = 3 ) { if(strtotime($mySobi->lastUpdate) > mktime() - ($days * 86400)) { return '<span class="sobiUpdatedLabel">'._SOBI2_UPDATED_LABEL.'</span>'; } } /** * @param SOBI2 $mySobi * @param int $hits */ function hotLabel( $mySobi, $hits = 500 ) { if($mySobi->hits > $hits) { return '<span class="sobiHotLabel">'._SOBI2_HOT_LABEL.'</span>'; } } /** * @param SOBI2 $mySobi * @param string $name */ function userHref( $mySobi, $name = "real" ) { if(!$mySobi->owner) { return null; } $config =& sobi2Config::getInstance(); $db =& $config->getDb(); $user =& sobi2bridge::jUser( $db ); $user->load( $mySobi->owner ); $userLink = "index.php?option=com_sobi2&sobi2Task=usersListing&uid={$mySobi->owner}&Itemid={$config->sobi2Itemid}"; $userLink = sobi2Config::sef( $userLink ); if( $name == 'real' ) { $uname = $user->name; } else { $uname = $user->username; } $title = str_replace( array( "%username%" ,"%name%" ), array( $user->username, $user->name ), _SOBI2_USER_OWN_LISTING ); $userLink = "<a href=\"{$userLink}\" title=\"{$title}\">{$uname}</a>"; return $userLink; } /** * @param SOBI2 $mySobi * @param string $name */ function userCBHref( $mySobi, $name = "real" ) { if(!$mySobi->owner) { return null; } if( !sobi2Config::translatePath( "components|com_comprofiler|comprofiler", "root" ) ) { trigger_error( "Community Builder seems not to be installed.", E_USER_WARNING ); return self::userHref( $mySobi, $name ); } $config =& sobi2Config::getInstance(); $db =& $config->getDb(); $user =& sobi2bridge::jUser( $db ); $user->load( $mySobi->owner ); if( !( class_exists( 'JFactory' ) ) ) { $query = "SELECT `id` FROM `#__menu` WHERE `link` LIKE '%index.php?option=com_comprofiler%' AND `type` = 'components' AND `published` = '1' LIMIT 1"; } else { $query = "SELECT `id` FROM `#__menu` WHERE `link` LIKE '%index.php?option=com_comprofiler%' AND `type` = 'component' AND `published` = '1' LIMIT 1"; } $db->setQuery( $query ); $mid = $db->loadResult(); if( $mid && is_int( $mid ) ) { $mid = "&Itemid={$mid}"; } else { $mid = null; } $userLink = "index.php?option=com_comprofiler&task=userProfile&user={$user->id}{$mid}"; $userLink = sobi2Config::sef( $userLink ); if( $name == "real") { $uname = $user->name; } else { $uname = $user->username; } $title = str_replace( array( "%username%" ,"%name%" ), array( $user->username, $user->name ), _SOBI2_USER_OWN_LISTING ); $userLink = "<a href=\"{$userLink}\" title=\"{$title}\">{$uname}</a>"; return $userLink; } /** * Enter description here... * * @param string $txt */ function replace( $txt, $key = null ) { static $def = array(); if( empty( $def ) ) { $config =& sobi2Config::getInstance(); if( $file = sobi2Config::translatePath( $config->key( "string", "replace_definion", null ), "front", true, ".ini" ) ) { $def = parse_ini_file( $file ); } else { trigger_error( "Cannot find replace definition file", E_USER_WARNING ); return $txt; } } if( !$key ) { foreach ( $def as $replace => $with ) { $txt = preg_replace( "/\b{$replace}\b/", $with, $txt ); } } else { if( key_exists( $key, $def ) ) { $txt = preg_replace( "/\b{$def[$key]}\b/", $with, $txt ); //$txt = sobi2_ereg_replace( "[[:<:]]{$def[$key]}[[:>:]]", $with, $txt ); } else { trigger_error( "Replacement key '{$key}' does not exist ", E_USER_WARNING ); } } return $txt; } function addedDateOnly($config,$mySobi) { if($config->showAddedDate) { echo _SOBI2_DATE_ADDED." ".date("j.n.Y",strtotime ($mySobi->publish_up)); } } /** * Enter description here... * * @param sobiField $field * @param SOBI2 $mySobi */ function countClick( $field, $mySobi, $showCounter = true ) { $config =& sobi2Config::getInstance(); $database =& $config->getDb(); $value = null; $count = null; static $script = false; if( $field->isUrl && strlen( $field->data ) ) { $onclick = "onclick=\"SobiCC( {$mySobi->id}, {$field->fieldid} );\""; $field->data_int = $field->data_int ? $field->data_int : 0; if( $showCounter ) { $count = str_replace( '%count%', $field->data_int, _CCOUNT_VISITED ); } if( $field->isUrl == 1 ) { $value = "<a href=\"{$field->data}\" {$onclick} title=\"{$mySobi->title}\" target=\"_blank\">{$field->label}{$count}</a>"; } elseif( $field->isUrl == 2 ) { $value = "<a href=\"mailto:{$field->data}\" {$onclick} title=\"{$mySobi->title}\" target=\"_blank\">{$field->label}{$count}</a>"; } } if( !$script ) { $script = true; $config->addCustomScript( 'function SobiCC( sid, fid ) { url = "index2.php?option=com_sobi2&no_html=1&sobi2&sobi2Task=countVisit&fid="+fid+"&sid="+sid+"&Itemid='.$config->sobi2Itemid.'"; if ( window.XMLHttpRequest ) { SCCReq = new XMLHttpRequest(); if ( SCCReq.overrideMimeType ) { SCCReq.overrideMimeType( "text/xml" ); } } else if ( window.ActiveXObject ) { try { SCCReq = new ActiveXObject( "Msxml2.XMLHTTP" ); } catch ( e ) { try { SCCReq = new ActiveXObject( "Microsoft.XMLHTTP" ); } catch ( e ) {} } } SCCReq.open( "GET",url , true ); SCCReq.setRequestHeader( "Content-type", "application/x-www-form-urlencoded" ); SCCReq.setRequestHeader( "Connection", "close" ); SCCReq.send( null ); } ' ); } return $value; } /** * Enter description here... * * @param sobiField $field * @param SOBI2 $mySobi */ function toQuickEdit( $field, $mySobi ) { $config =& sobi2Config::getInstance(); $database = &$config->getDb(); $sobi2Frontend = &$config->getFrontend(); $my =& $config->getUser(); static $loaded = false; static $admFields = array(); $onclick = null; $data = $field->data; if( ( ($my->id != 0 && $my->id == $mySobi->owner && $config->allowUserToEditEntry ) || $config->checkPerm() ) && $config->key( "details_view", "allow_quick_edit" ) ) { if( !$config->checkPerm() && !$loaded ) { $query = "SELECT fieldid FROM `#__sobi2_fields` WHERE displayed = 1"; $database->setQuery( $query ); $admFields = $database->loadResultArray(); if ($database->getErrorNum()) { trigger_error("DB reports: ".$database->stderr(), E_USER_WARNING); } $fieldsIgnore = $config->key("details_view","quickedit_fields_ignore"); if( strlen($fieldsIgnore) ) { // $fieldsIgnore = explode(",", $fieldsIgnore ); array_push($admFields,$fieldsIgnore); } } if( !in_array( $field->fieldid, $admFields ) ) { $t = _JS_SOBI2_QFIELD_DBL_CLK_TO_EDIT; $onclick = "ondblclick=\"sobiEditField('sobi2Details_{$field->fieldname}', {$field->fieldid})\" title=\"{$t}\""; } } $data = "\n\t\t<span {$onclick} id=\"sobi2Details_{$field->fieldname}\">{$data}</span>"; return $data; }
/** * PHP Function to Locally store website images from http://www.thumshots.org * Code is free. No guarantees or warranties. * Based on code by Daniel Schulman * @param string $url * @param string $alt * @param string $style * @param string $params * @return string */ function getThumbshotsOrg( $url, $alt = '', $style = 'border-style:none;', $params = null ) { $config =& sobi2Config::getInstance(); //Where Thumbnail images are stored locally $subDir = $config->key( "thumshots.org", "subdir_name", "thumbs" ); $defImg = $config->key( "thumshots.org", "no_thumb" ); $local_thumb_dir = sobi2Config::translateDirPath( "{$config->imagesFolder}|{$subDir}", "root", false ); //How many days till check if new thumbnail $days_to_keep = $config->key( "thumshots.org", "days_to_keep", 60 );; //To use if no thumbnail exists $return_img = sobi2Config::translatePath( "{$config->imagesFolder}|{$subDir}|{$defImg}", "root", false, '' );
if( !file_exists( $local_thumb_dir ) ) { sobi2Config::sobiMakePath( $local_thumb_dir ); }
if ( substr( $url, 0, 4 )!= 'http' ) { $url = 'http://' . $url; //Make sure URL proper } $url = urlencode( $url ); $fname = str_replace( array( '%3A', '%2F', '%3F', '%3D', '%26' ), '_', $url ); $full_img_path = sobi2Config::translatePath( "{$config->imagesFolder}|{$subDir}|{$fname}", "root", false, '.jpg' );
if( file_exists( $full_img_path ) ) { //check age $diff =( time() - filemtime( $full_img_path) ) /60 /60 /24 ; if ( $diff > $days_to_keep ) { unlink( $full_img_path ); } else { $return_img = "{$config->liveSite}/{$config->imagesFolder}/{$subDir}/{$fname}.jpg"; } } if( !file_exists( $full_img_path ) ) { //get from thumbshots.org $buff = file_get_contents( "http://open.thumbshots.org/image.pxf?url={$url}" ); if( strlen( $buff ) ) { $fp = fopen( $full_img_path, "wb" ); fwrite( $fp,$buff ); fclose( $fp ); $return_img = "{$config->liveSite}/{$config->imagesFolder}/{$subDir}/{$fname}.jpg"; } } $html = "<img src=\"{$return_img}\" style=\"{$style}\" alt=\"{$alt}\" {$params} />"; return $html; } function createWaySearchUrl( $sobi2Id ) { $config =& sobi2Config::getInstance(); if(!$config->useWaySearch) { return null; } $waySearchLink = $config->waySearchUrl; $fields = array(); $counter = 0; sobi2Config::import("field.class"); foreach ( $config->waySearchFields as $k => $fid ) { if( $fid ) { $field = new sobiField( $fid, $sobi2Id ); $fields[ $k ] = urlencode( $config->getSobiStr( $field->data ) ); if( !empty( $field->data ) ) { $counter++; } } } if( $counter < $config->key( "url", "way_search_min_fields", 2 ) ) { return null; } $WSstreet = isset($fields['STREET'])? $fields['STREET'] : null; $WScity = isset($fields['CITY'])? $fields['CITY'] : null; $WSpostcode = isset($fields['ZIPCODE'])? $fields['ZIPCODE'] : null; $WScounty = isset($fields['COUNTY'])? $fields['COUNTY'] : null; $WSfstate = isset($fields['FEDSTATE'])? $fields['FEDSTATE'] : null; $WScountry = isset($fields['COUNTRY'])? $fields['COUNTRY'] : null; $waySearchLink = str_replace( array( "STREET", "CITY", "ZIPCODE", "COUNTY", "FEDSTATE", "COUNTRY" ), array( $WSstreet, $WScity, $WSpostcode, $WScounty, $WSfstate, $WScountry ), $waySearchLink ); $waySearchLink = str_replace('&', '&', $waySearchLink ); $waySearchLink = str_replace('\\', null, $waySearchLink ); $waySearchLink = html_entity_decode( $waySearchLink ); $waySearchLink = "<span class=\"sobi2WaySearch\"><a href=\"{$waySearchLink}\" class=\"sobi2WaySearch\" target=\"_blank\">{$config->waySearchLabel}</a></span>"; return $waySearchLink; } /** * * @param SOBI2 $mySobi * @param sobi2config $config * @return string */ function showGoogleMaps($mySobi, $config) {
if( !$config->useGoogleMaps || !isset( $config->googleMapsApiKey ) ) { return null; } $map_url = $config->key( "google_maps", "google_map_url", "http://maps.google.com"); $map_api_version = $config->key("google_maps", "google_map_apiversion", "2");
$title = $config->jsAddSlashes( $mySobi->title ); $GeoPos = $config->getGeoPosition( $mySobi->id ); if( $GeoPos['lat'] && $GeoPos['long'] && is_numeric( $GeoPos['lat'] ) && is_numeric( $GeoPos['lat'] ) ) { ?> <div style="width: <?php echo $config->googleMapsWidth; ?>px; height: <?php echo $config->googleMapsHeight; ?>px;" id="sobi2GoogleMaps"></div> <script src="<?php echo $map_url?>/maps?file=api&v=<?php echo $map_api_version?>&key=<?php echo $config->googleMapsApiKey ?>" type="text/javascript"></script> <script type="text/javascript"> //<![CDATA[ function loadmap(){ if (GBrowserIsCompatible()) { var center = new GLatLng(<?php echo $GeoPos['lat']; ?>, <?php echo $GeoPos['long']; ?>); //var SobiGeoMap = new GMap2(document.getElementById("sobi2GoogleMaps")); var SobiGeoMap = new GMap2(document.getElementById("sobi2GoogleMaps"), { size: new GSize(<?php echo $config->googleMapsWidth; ?>, <?php echo $config->googleMapsHeight; ?>) } ); <?php if( $config->key( "google_maps", "small_map_control", true ) ) { echo "SobiGeoMap.addControl(new GSmallMapControl());\n"; } if( $config->key( "google_maps", "map_type_control", false ) ) { // echo "SobiGeoMap.addControl(new GMapTypeControl());\n"; echo "var mapControl = new GHierarchicalMapTypeControl();"; echo "SobiGeoMap.addMapType(G_PHYSICAL_MAP);";
// Set up map type menu relationships echo "mapControl.clearRelationships();"; echo "mapControl.addRelationship(G_SATELLITE_MAP, G_HYBRID_MAP, '"._SOBI2_GOOGLEMAPS_LABEL."', true);";
echo "SobiGeoMap.addControl(mapControl);"; } if( $config->key( "google_maps", "large_map_control", false ) ) { echo "SobiGeoMap.addControl(new GLargeMapControl());\n"; } if( $config->key( "google_maps", "small_zoom_control", false ) ) { echo "SobiGeoMap.addControl(new GSmallZoomControl());\n"; } if( $config->key( "google_maps", "scale_control", false ) ) { echo "SobiGeoMap.addControl(new GScaleControl());\n"; } if( $config->key( "google_maps", "overview_map_control", false ) ) { echo "SobiGeoMap.addControl(new GOverviewMapControl());\n"; } if( !$config->googleMapsBubble) { echo "var marker = new GMarker(center);\n"; } else { echo "var marker = new DirectionMarker(center, '{$title}', '{$title}'); \n"; } echo "SobiGeoMap.setCenter(center, {$config->googleMapsZoom}); \n"; echo "SobiGeoMap.addOverlay(marker); \n"; if( $config->googleMapsBubble == 2 ) { echo "marker.openInfo(); \n"; } if( $mtype = $config->key( "google_maps", "map_type", false ) ) { echo "SobiGeoMap.setMapType({$mtype}); \n"; } echo "\n}\n}\n"; ?> if(window.attachEvent){ window.attachEvent('onload', loadmap); } else if(window.addEventListener){ window.addEventListener('load', loadmap, false); } <?php if( $config->googleMapsBubble){ ?> function extend(subclass, superclass) { function Dummy() {} Dummy.prototype = superclass.prototype; subclass.prototype = new Dummy(); subclass.prototype.constructor = subclass; subclass.superclass = superclass; subclass.superproto = superclass.prototype; } extend( DirectionMarker, GMarker); function DirectionMarker( point, name, HTML ){ DirectionMarker.superclass.call(this, point); this.point = point; this.name = name; this.html = HTML + '<form action="http://maps.google.com/maps" method="get" target="_blank" onsubmit="DirectionMarker.submit(this);return false;">' + '<br /><?php echo _SOBI2_GOOGLEMAPS_DIR ?><input type="radio" checked name="dir" value="to"> <b><?php echo _SOBI2_GOOGLEMAPS_TO; ?></b> <input type="radio" name="dir" value="from"><b><?php echo _SOBI2_GOOGLEMAPS_FROM; ?></b>' + '<br /><?php echo _SOBI2_GOOGLEMAPS_ADDR ?><input type="text" class="inputbox" size="20" name="saddr" id="saddr" value="" /><br />' + '<input value="<?php echo _SOBI2_GOOGLEMAPS_GET_DIR ?>" class="button" type="submit" style="margin-top: 2px;">' + '<input type="hidden" name="daddr" value="' + this.point.y + ',' + this.point.x + "(" + this.name + ")" + '"/></form>'; // The info window version with the "to here" form open GEvent.addListener(this, "click", function() { this.openInfoWindowHtml('<div style="white-space:nowrap; text-align: left;">'+this.html+'</div>'); }); } DirectionMarker.prototype.openInfo = function() { this.openInfoWindowHtml('<div style="white-space:nowrap; text-align: left;">'+this.html+'</div>'); } DirectionMarker.submit = function( formObj ){ if(formObj.dir[1].checked ){ tmp = formObj.daddr.value; formObj.daddr.value = formObj.saddr.value; formObj.saddr.value = tmp; } formObj.submit(); } <?php } ?> //]]> </script> <?php } elseif ((strlen(trim($GeoPos['lat'])) && strlen(trim($GeoPos['long']))) && (!is_numeric($GeoPos['lat']) || !is_numeric($GeoPos['lat']))) { trigger_error("HTML_SOBI::showGoogleMaps(): Given cooordinates ({$GeoPos['lat']}, {$GeoPos['long']}) are not correct. Please enter float values"); } } function waySearchUrl( $waySearchLink ) { $config =& sobi2Config::getInstance(); if($config->useWaySearch) { echo $waySearchLink; } } } ?> блин я вообще не понимаю че делать , как отметить точки на карте если её нету?  (( перекодировал. так там все файлы в анси оО И поля проверил, все правильные
|
|
|
|
« Последнее редактирование: 15.05.2011, 17:05:28 от marozz1k »
|
Записан
|
|
|
|
reg2005
Захожу иногда

Репутация: +1/-0
Offline
Сообщений: 9
|
 |
« Ответ #8 : 21.05.2011, 00:04:37 » |
|
Ну даже незаню, эксперементируй!
|
|
|
|
|
Записан
|
|
|
|
|
marozz1k
|
 |
« Ответ #9 : 22.05.2011, 23:32:48 » |
|
а можно не в тему вопрос. Есть ли возможность подключения карт kosmosnimki.ru или нет?
|
|
|
|
|
Записан
|
|
|
|
reg2005
Захожу иногда

Репутация: +1/-0
Offline
Сообщений: 9
|
 |
« Ответ #10 : 23.05.2011, 16:55:13 » |
|
Советую пообщаться со специалистом на которого я сослался в первом посте, я думаю он ответит на ваш вопрос!
|
|
|
|
|
Записан
|
|
|
|
slava-yun
Захожу иногда

Репутация: +0/-0
Offline
Сообщений: 16
|
 |
« Ответ #11 : 27.12.2011, 19:13:33 » |
|
помогите с прокладкой маршрута http://citiway.ru/
|
|
|
|
|
Записан
|
|
|
|
disperato
Захожу иногда

Репутация: +0/-0
Offline
Пол: 
Сообщений: 21
Разработчик расширений для Joomla 1.7, 2.5
|
 |
« Ответ #12 : 23.01.2012, 14:11:40 » |
|
помогите с прокладкой маршрута http://citiway.ru/
<!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <title>Google Maps API v3 Directions Example</title> <script type="text/javascript" src="http://maps.google.ru/maps/api/js?sensor=false&language=ru"></script> </head> <body style="font-family: Arial; font-size: 12px;"> <div style="width: 600px;"> <div id="map" style="width:100%; height: 400px; float: left;"></div> <div id="panel" style="width: 100%;" ></div> </div> <script type="text/javascript"> var directionsService = new Google.maps.DirectionsService(); var directionsDisplay = new Google.maps.DirectionsRenderer(); var map = new Google.maps.Map(document.getElementById('map'), { zoom:7, mapTypeId: Google.maps.MapTypeId.ROADMAP }); directionsDisplay.setMap(map); directionsDisplay.setPanel(document.getElementById('panel')); var request = { origin: 'Москва', destination: 'Санкт-Петербург', travelMode: Google.maps.DirectionsTravelMode.DRIVING }; directionsService.route(request, function(response, status) { if (status == Google.maps.DirectionsStatus.OK) { directionsDisplay.setDirections(response); } }); </script> </body> </html>
|
|
|
|
|
Записан
|
|
|
|
|