Mobile hotspots view version
I edit in file "components/com_hotspots/views/hotspots/tmpl/default.php".
<?php
/**
* Hotspots - Frontend
* @package Joomla!
* @Copyright (C) 2009 Yves Hoppe - lunajoom.de
* @All rights reserved
* @Joomla! is Free Software
* @Released under GNU/GPL License :
www.gnu.org/copyleft/gpl.html
* @version $Revision: 0.9.4 beta $
**/
defined( '_JEXEC' ) or die ( 'Restricted access' );
$imgsrc = "components/com_hotspots/images/hotspots/";
?>
<!-- START Hotspots 0.9.3 beta by lunajoom.de -->
<?php
if (HotspotsHelper::getSettings(show_componentheading, 1) == 1)
{
?>
<div class="componentheading"><?php echo "Mobile Maps";//$this->hotspot->name; ?></div>
<?php
}
?>
<div class="hs_autordate">
<?php
$autor = showautor($this->hotspot->autor);
$postdate = showdate($this->hotspot->postdate);
if ($autor != "" && $postdate != "")
echo JTEXT::_('Posted by') . ' ' . $autor . ' ' . JTEXT::_('on') . ' ' . $postdate;
elseif ($autor != "" && $postdate == "")
echo JTEXT::_('Posted by') . ' ' . $autor;
elseif ($autor == "" && $postdate != "")
echo JTEXT::_('Posted on') . ' ' . $postdate;
?>
</div>
<div style="float:right;margin:10px;">
<?php
echo "<img src=\"$imgsrc" . $this->hotspot->picture . "\" title = \"" . $this->hotspot->name . "\" />";
?>
</div>
<p>
<?php
echo showAdress($this->hotspot->street, $this->hotspot->plz, $this->hotspot->town, $this->hotspot->country);
?>
</p>
<p><br />
<?php
$plugintext = JHTML::_('content.prepare', $this->hotspot->description, $params);
echo $plugintext;
?>
</p>
<br />
<?php
// Develop by Mr.Padungsak Wichaidit
// Develop data 30/09/2009
// Hotspots google maps mobile vertion
// hs_catinfo();
?>
</div>
<div id="map_canvas" style="width:100%; height: 300px;">
<?php
if (JRequest::getVar( 'gmlat' ) != "" && JRequest::getVar( 'gmlng' ) != ""){
$gmlat = JRequest::getVar( 'gmlat' );
$gmlng = JRequest::getVar( 'gmlng' );
} else {
$gmlat = $this->hotspot->gmlat;
$gmlng = $this->hotspot->gmlng;
}
//function getbrowser()
if (_MJ == 1) {
if (JRequest::getVar( 'lang' ) == "en"){
$lang_zoom_in="ZOOM IN";
$lang_zoom_out="ZOOM OUT";
$lang_up="UP";
$lang_down="DOWN";
$lang_left="LEFT";
$lang_right="RIGHT";
} else {
$lang_zoom_in="ขยาย";
$lang_zoom_out="ย่อ";
$lang_up="เลื่อนขึ้น";
$lang_down="เลื่อนลง";
$lang_left="เลื่อนซ้าย";
$lang_right="เลื่อนขวา";
}
switch (JRequest::getVar( 'maptype' )) {
case 'terrain':
$maptype = 'terrain';
break;
case 'satellite':
$maptype = 'satellite';
break;
case 'hybrid':
$maptype = 'hybrid';
break;
default:
$maptype = 'roadmap';
break;
}
switch (JRequest::getVar( 'zoom' )) {
case '0':
$m_point = '40';
break;
case '1':
$m_point = '20';
break;
case '2':
$m_point = '8';
break;
case '3':
$m_point = '5';
break;
case '4':
$m_point = '3';
break;
case '5':
$m_point = '2';
break;
case '6':
$m_point = '0.8';
break;
case '7':
$m_point = '0.4';
break;
case '8':
$m_point = '0.2';
break;
case '9':
$m_point = '0.08';
break;
case '10':
$m_point = '0.05';
break;
case '11':
$m_point = '0.02';
break;
case '12':
$m_point = '0.01';
break;
case '13':
$m_point = '0.008';
break;
case '14':
$m_point = '0.004';
break;
case '15':
$m_point = '0.002';
break;
case '16':
$m_point = '0.0008';
break;
case '17':
$m_point = '0.0005';
break;
case '18':
$m_point = '0.0002';
break;
case '19':
$m_point = '0.0001';
break;
case '20':
$m_point = '0.00009';
break;
default:
$m_point = '0.008';
break;
}
if ($maptype == 'roadmap' || $maptype == 'satellite'){
$typecheck = "&mobile=true";
} else {
$typecheck = "";
}
if (JRequest::getVar( 'zoom_io' ) == ""){
if (JRequest::getVar( 'zoom' ) != ""){
$zoom = JRequest::getVar( 'zoom' );
} else {
$zoom = 13;
}
} else if (JRequest::getVar( 'zoom_io' ) == "1"){
$zoom = JRequest::getVar( 'zoom' ) + 1;
} else if (JRequest::getVar( 'zoom_io' ) == "0"){
$zoom = JRequest::getVar( 'zoom' ) - 1;
}
if ($maptype == "terrain"){
if ($zoom <= "0"){
$zoom = 0;
} else if ($zoom >= "14"){
$zoom = 14;
}
if ($maptype == "roadmap"){
if ($zoom <= "0"){
$zoom = 0;
} else if ($zoom >= "21"){
$zoom = 20;
}
}
} else {
if ($zoom <= "0"){
$zoom = 0;
} else if ($zoom >= "19"){
$zoom = 18;
}
}
if (JRequest::getVar( 'move_up_or_down' ) == ""){
if (JRequest::getVar( 'up_or_down' ) != ""){
$up_or_down = JRequest::getVar( 'up_or_down' );
} else {
$up_or_down = $gmlat;
}
} else if (JRequest::getVar( 'move_up_or_down' ) == "1"){
$up_or_down = JRequest::getVar( 'up_or_down' ) + $m_point;
} else if (JRequest::getVar( 'move_up_or_down' ) == "0"){
$up_or_down = JRequest::getVar( 'up_or_down' ) - $m_point;
}
if (JRequest::getVar( 'move_left_or_right' ) == ""){
if (JRequest::getVar( 'left_or_right' ) != ""){
$left_or_right = JRequest::getVar( 'left_or_right' );
} else {
$left_or_right = $gmlng;
}
} else if (JRequest::getVar( 'move_left_or_right' ) == "1"){
$left_or_right = JRequest::getVar( 'left_or_right' ) + $m_point;
} else if (JRequest::getVar( 'move_left_or_right' ) == "0"){
$left_or_right = JRequest::getVar( 'left_or_right' ) - $m_point;
}
?>
<!--
Joomla Google maps mobile version only
Develop by Mr.Padungsak Wichaidit
Develop date 30/09/2009
-->
<?php
echo "<center>";
echo "<a href='index.php?option=com_hotspots&view=hotspot&Itemid=".JRequest::getVar( 'Itemid' )."&lang=".JRequest::getVar( 'lang' )."&zoom=".$zoom."&move_up_or_down=1&up_or_down=".$up_or_down."&left_or_right=".$left_or_right."&maptype=".$maptype."&gmlat=".$gmlat."&gmlng=".$gmlng."'>".$lang_up."</a> || ";
echo "<a href='index.php?option=com_hotspots&view=hotspot&Itemid=".JRequest::getVar( 'Itemid' )."&lang=".JRequest::getVar( 'lang' )."&zoom=".$zoom."&move_up_or_down=0&up_or_down=".$up_or_down."&left_or_right=".$left_or_right."&maptype=".$maptype."&gmlat=".$gmlat."&gmlng=".$gmlng."'>".$lang_down."</a> :: ";
echo "<a href='index.php?option=com_hotspots&view=hotspot&Itemid=".JRequest::getVar( 'Itemid' )."&lang=".JRequest::getVar( 'lang' )."&zoom=".$zoom."&up_or_down=".$up_or_down."&move_left_or_right=0&left_or_right=".$left_or_right."&maptype=".$maptype."&gmlat=".$gmlat."&gmlng=".$gmlng."'>".$lang_left."</a> || ";
echo "<a href='index.php?option=com_hotspots&view=hotspot&Itemid=".JRequest::getVar( 'Itemid' )."&lang=".JRequest::getVar( 'lang' )."&zoom=".$zoom."&up_or_down=".$up_or_down."&move_left_or_right=1&left_or_right=".$left_or_right."&maptype=".$maptype."&gmlat=".$gmlat."&gmlng=".$gmlng."'>".$lang_right."</a> ";
echo "<br><br>";
echo "<img src='
maps.google.com/maps/api/staticmap?center=".$up_or_down.",".$left_or_right."&zoom=".$zoom."&size=200x200&maptype=".$maptype.$typecheck."&key=".HotspotsHelper::getSettings(api_key)."&sensor=false&markers=color:red|label:.|".$gmlat.",".$gmlng."' title ='map'><br><br>";
echo "<a href='index.php?option=com_hotspots&view=hotspot&Itemid=".JRequest::getVar( 'Itemid' )."&lang=".JRequest::getVar( 'lang' )."&zoom_io=1&zoom=".$zoom."&up_or_down=".$up_or_down."&left_or_right=".$left_or_right."&maptype=".$maptype."&gmlat=".$gmlat."&gmlng=".$gmlng."'>".$lang_zoom_in."</a> || ";
echo "<a href='index.php?option=com_hotspots&view=hotspot&Itemid=".JRequest::getVar( 'Itemid' )."&lang=".JRequest::getVar( 'lang' )."&zoom_io=0&zoom=".$zoom."&up_or_down=".$up_or_down."&left_or_right=".$left_or_right."&maptype=".$maptype."&gmlat=".$gmlat."&gmlng=".$gmlng."'>".$lang_zoom_out."</a>";
echo "<br><br>";
echo "<a href='index.php?option=com_hotspots&view=hotspot&Itemid=".JRequest::getVar( 'Itemid' )."&lang=".JRequest::getVar( 'lang' )."&zoom=".$zoom."&up_or_down=".$up_or_down."&left_or_right=".$left_or_right."&maptype=roadmap&gmlat=".$gmlat."&gmlng=".$gmlng."'>ROADMAP</a> || ";
echo "<a href='index.php?option=com_hotspots&view=hotspot&Itemid=".JRequest::getVar( 'Itemid' )."&lang=".JRequest::getVar( 'lang' )."&zoom=".$zoom."&up_or_down=".$up_or_down."&left_or_right=".$left_or_right."&maptype=terrain&gmlat=".$gmlat."&gmlng=".$gmlng."'>TERRAIN</a> || ";
echo "<a href='index.php?option=com_hotspots&view=hotspot&Itemid=".JRequest::getVar( 'Itemid' )."&lang=".JRequest::getVar( 'lang' )."&zoom=".$zoom."&up_or_down=".$up_or_down."&left_or_right=".$left_or_right."&maptype=satellite&gmlat=".$gmlat."&gmlng=".$gmlng."'>SATELLITE</a> || ";
echo "<a href='index.php?option=com_hotspots&view=hotspot&Itemid=".JRequest::getVar( 'Itemid' )."&lang=".JRequest::getVar( 'lang' )."&zoom=".$zoom."&up_or_down=".$up_or_down."&left_or_right=".$left_or_right."&maptype=hybrid&gmlat=".$gmlat."&gmlng=".$gmlng."'>HYBRID</a> ";
echo "</center>";
echo "</div>";
} else {
// End
?>
</div>
<?php
echo "<script type='text/javascript'>";
echo "var num = null;\n";
echo "var maxNum = null;\n";
echo "var bounds;\n";
echo "var map;\n";
echo "var markers = [];\n";
echo "bounds = new GLatLngBounds();\n";
echo "var highlightCircle = null;\n";
echo "var currentMarker = null;\n";
echo "function initialize() {\n";
echo "map = new GMap2(document.getElementById(\"map_canvas\"));\n";
hs_createmarker();
echo "map.setCenter(new GLatLng(" . $gmlat . "," . $gmlng . "), 11);\n";
maptype();
gmcontrols();
hs_listener();
echo "map.addControl(mapControl);\n";
$html = html_desc($this->hotspot->id, 1);
echo "markerOptions = {};\n\n";
echo "var point = new GLatLng(" . $gmlat . ", " . $gmlng . ");\n";
echo "map.addOverlay(createMarker(point, " . $this->hotspot->id . ", \"" . $html . "\", markerOptions));\n";
echo "}";
echo "</script>";
} // End develop
if ($this->hotid != "")
{
?>
<p align="right">
<a href="<?php echo $this->backlink; ?>" title="<?php echo $this->hotspot->name; ?>"><?php echo JTEXT::_('Back to Hotspots'); ?></a>
</p>
<?php
}
?>
<script type='text/javascript'>
// Onload Work around - thx to Dean Edwards, more about:
dean.edwards.name/weblog/2006/06/again/
function init() {
// quit if this function has already been called
if (arguments.callee.done) return;
// flag this function so we don't do the same thing twice
arguments.callee.done = true;
initialize();
};
if (document.addEventListener) {
document.addEventListener("DOMContentLoaded", init, false);
}
/*@cc_on @*/
/*@if (@_win32)
document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
var script = document.getElementById("__ie_onload");
script.onreadystatechange = function() {
if (this.readyState == "complete") {
init(); // call the onload handler
}
};
/*@end @*/
</script>
<br />
<?php
if (HotspotsHelper::getSettings(josc_support, '0') == 1)
{
?>
<!-- START joomlacomment INSERT -->
<div class="" style="">
<?php
$option = JRequest::getCMD('option');
require_once(JPATH_BASE . DS . 'administrator' . DS . 'components' . DS . 'com_comment' . DS . 'plugin' . DS . $option . DS . 'josc_com_hotspots.php');
?>
</div>
<!-- END OF joomlacomment INSERT -->
<?php
}
?>
<br /><div style="margin:10px;">
<hr />
<div id="small_menu" style="width: 100%;"><?php hs_mobilecategories($hs_catid); ?></div>
<hr /></div>
<?php
echo ftDisp();
// End develop by Mr.Padungsak
?>
<!-- End Hotspots by lunajoom.de -->
<!--** This code coupled with the mobileJoomla. **-->