primo commit

This commit is contained in:
2024-12-17 17:34:10 +01:00
commit e650f8df99
16435 changed files with 2451012 additions and 0 deletions

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<view title="_COM_PHOCAMAPS_MAPS_GROUP">
<message>
<![CDATA[COM_PHOCAMAPS_MAPS_GROUP_DESC]]>
</message>
</view>
</metadata>

View File

@ -0,0 +1,218 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
$app = Factory::getApplication();
if ($app->input->get( 'print', '', 'int' ) == 1 || $app->input->get( 'tmpl', '', 'string' ) == 'component') {
$foutput = '<div style="clear:both"></div>';
echo '<div id="phocamaps" class="phocamaps'.$this->t['p']->get( 'pageclass_sfx' ).'">';
} else {
echo '<div id="phocamaps" class="phocamaps'.$this->t['p']->get( 'pageclass_sfx' ).'">';
if ( $this->t['p']->def( 'show_page_heading', 1 ) ) {
echo '<h1>'. $this->t['p']->get('page_heading') . '</h1>';
}
$foutput = PhocaMapsHelper::getExtInfo();
}
if ((!isset($this->map->longitude))
|| (!isset($this->map->latitude))
|| (isset($this->map->longitude) && $this->map->longitude == '')
|| (isset($this->map->latitude) && $this->map->latitude == '')) {
echo '<p>' . Text::_('COM_PHOCAMAPS_GOOGLE_MAPS_ERROR_FRONT') . '</p>';
} else {
echo $this->t['description'];
$id = '';
$map = new PhocaMapsMap($id);
//$map->loadAPI();
$map->loadGeoXMLJS();
$map->loadBase64JS();
// Map Box
if ($this->t['border'] == '') {
echo '<div class="phocamaps-box" align="center" style="'.$this->t['stylesite'].'">';
if ($this->t['fullwidth'] == 1) {
echo '<div id="phocaMap'.$id.'" style="margin:0;padding:0;width:100%;height:'.$this->map->height.'"></div>';
} else {
echo '<div id="phocaMap'.$id.'" style="margin:0;padding:0;width:'.$this->map->width.';height:'.$this->map->height.'"></div>';
}
echo '</div>';
} else {
echo '<div class="phocamaps-box phocamaps-box-border'.$this->t['border'].'" align="center" style="'.$this->t['stylesite'].'">';
if ($this->t['fullwidth'] == 1) {
echo '<div id="phocaMap'.$id.'" class="phocamaps-map" style="width:100%;height:'.$this->map->height.'"></div>';
} else {
echo '<div id="phocaMap'.$id.'" class="phocamaps-map" style="width:'.$this->map->width.';height:'.$this->map->height.'"></div>';
}
echo '</div>';
//echo '</div></div></div></div></div>';
}
// Direction
if ($this->t['displaydir']) {
$countMarker = count($this->marker);
$form = '';
if ((int)$countMarker > 1) {
$form .= ' ' . Text::_('COM_PHOCAMAPS_TO').': <select name="pmto'.$id.'" id="toPMAddress'.$id.'">';
foreach ($this->marker as $key => $markerV) {
if ((isset($markerV->longitude) && $markerV->longitude != '')
&& (isset($markerV->latitude) && $markerV->latitude != '')) {
$form .= '<option value="'.$markerV->latitude.','.$markerV->longitude.'">'.$markerV->title.'</option>';
}
}
$form .= '</select>';
} else if ((int)$countMarker == 1) {
foreach ($this->marker as $key => $markerV) {
if ((isset($markerV->longitude) && $markerV->longitude != '')
&& (isset($markerV->latitude) && $markerV->latitude != '')) {
$form .= '<input name="pmto'.$id.'" id="toPMAddress'.$id.'" type="hidden" value="'.$markerV->latitude.','.$markerV->longitude.'" />';
}
}
}
if ($form != '') {
echo '<div class="pmroute">';
echo '<form class="form-inline input-group" action="#" onsubmit="setPhocaDir'.$id.'(this.pmfrom'.$id.'.value, this.pmto'.$id.'.value); return false;">';
echo Text::_('COM_PHOCAMAPS_FROM_ADDRESS').': <input class="pm-input-route input form-control" type="text" size="30" id="fromPMAddress'.$id.'" name="pmfrom'.$id.'" value=""/>';
echo $form;
echo ' <input name="pmsubmit'.$id.'" type="submit" class="pm-input-route-btn btn btn-primary" value="'.Text::_('COM_PHOCAMAPS_GET_ROUTE').'" />';
echo '</form></div>';
echo '<div id="phocaDir'.$id.'">';
if ($this->t['display_print_route'] == 1) {
echo '<div id="phocaMapsPrintIcon'.$id.'" style="display:none"></div>';
}
echo '</div>';
}
}
// $id is not used anymore as this is added in methods of Phoca Maps Class
// e.g. 'phocaMap' will be not 'phocaMap'.$id as the id will be set in methods
echo $map->startJScData();
echo $map->addAjaxAPI('maps', '3', $this->t['params']);
echo $map->addAjaxAPI('search', '1', $this->t['paramssearch']);
echo $map->createMap('phocaMap', 'mapPhocaMap', 'phocaLatLng', 'phocaOptions','tstPhocaMap', 'tstIntPhocaMap', FALSE, FALSE, $this->t['displaydir']);
echo $map->cancelEventFunction();
echo $map->checkMapFunction();
echo $map->startMapFunction();
echo $map->setLatLng( $this->map->latitude, $this->map->longitude );
echo $map->startMapOptions();
echo $map->setMapOption('zoom', $this->map->zoom).','."\n";
echo $map->setCenterOpt().','."\n";
echo $map->setTypeControlOpt($this->map->typecontrol, $this->map->typecontrolposition).','."\n";
echo $map->setNavigationControlOpt($this->map->zoomcontrol).','."\n";
echo $map->setMapOption('scaleControl', $this->map->scalecontrol, TRUE ).','."\n";
if (isset($this->map->gestureHandling) && $this->map->gestureHandling != '') {
echo $map->setMapOption('gestureHandling', '"' . $this->map->gesturehandling . '"').','."\n";
} else {
echo $map->setMapOption('scrollwheel', $this->map->scrollwheelzoom, TRUE).','."\n";
}
echo $map->setMapOption('disableDoubleClickZoom', $this->map->disabledoubleclickzoom).','."\n";
// echo $map->setMapOption('googleBar', $this->map->googlebar).','."\n";// Not ready yet
// echo $map->setMapOption('continuousZoom', $this->map->continuouszoom).','."\n";// Not ready yet
if (isset($this->map->map_styles)) {
echo $map->setMapOption('styles', $this->map->map_styles).','."\n";
}
echo $map->setMapTypeOpt($this->map->typeid)."\n";
if (isset($this->map->custom_options)) {
echo $map->endMapOptions($this->map->custom_options);
} else {
echo $map->endMapOptions();
}
if ($this->t['close_opened_window'] == 1) {
echo $map->setCloseOpenedWindow();
}
echo $map->setMap();
// Markers
jimport('joomla.filter.output');
if (isset($this->marker) && !empty($this->marker)) {
$iconArray = array(); // add information about created icons to array and check it so no duplicity icons js code will be created
foreach ($this->marker as $key => $markerV) {
if ((isset($markerV->longitude) && $markerV->longitude != '')
&& (isset($markerV->latitude) && $markerV->latitude != '')) {
//$hStyle = 'font-size:120%;margin: 5px 0px;font-weight:bold;';
// style="'.$hStyle.'
$text = '<div class="pmMarkerTitle">' . addslashes($markerV->title) . '</div>';
// Try to correct images in description
$markerV->description = PhocaMapsHelper::fixImagePath($markerV->description);
$markerV->description = str_replace('@', '&#64;', $markerV->description);
$text .= '<div>'. PhocaMapsHelper::strTrimAll(addslashes($markerV->description)).'</div>';
if ($markerV->displaygps == 1) {
$text .= '<div class="pmgps"><table border="0"><tr><td><strong>'. Text::_('COM_PHOCAMAPS_GPS') . ': </strong></td>'
.'<td>'.PhocaMapsHelper::strTrimAll(addslashes($markerV->gpslatitude)).'</td></tr>'
.'<tr><td></td>'
.'<td>'.PhocaMapsHelper::strTrimAll(addslashes($markerV->gpslongitude)).'</td></tr></table></div>';
}
if(empty($markerV->icon)) {
$markerV->icon = 0;
}
if(empty($markerV->title)){
$markerV->title = '';
}
if(empty($markerV->description)){
$markerV->description = '';
}
$iconOutput = $map->setMarkerIcon($markerV->icon, $markerV->iconext, $markerV->iurl, $markerV->iobject, $markerV->iurls, $markerV->iobjects, $markerV->iobjectshape);
echo $map->outputMarkerJs($iconOutput['js'], $markerV->icon, $markerV->iconext);
echo $map->setMarker($markerV->id,$markerV->title,$markerV->description,$markerV->latitude, $markerV->longitude, $iconOutput['icon'], $iconOutput['iconid'], $text, $markerV->contentwidth, $markerV->contentheight, $markerV->markerwindow, $iconOutput['iconshadow'], $iconOutput['iconshape'], $this->t['close_opened_window'] );
}
}
echo $map->setMarkerClusterer();
}
if ($this->t['load_kml']) {
echo $map->setKMLFile($this->t['load_kml']);
}
if ($this->t['displaydir']) {
echo $map->setDirectionDisplayService('phocaDir');
}
if(isset($this->map->scrollwheelzoom) && $this->map->scrollwheelzoom != 0){
echo $map->setListener();
}
echo $map->endMapFunction();
if ($this->t['displaydir']) {
echo $map->setDirectionFunction($this->t['display_print_route'], $this->map->id, $this->map->alias, $this->t['lang']);
}
echo $map->setInitializeFunctionSpecificMap();
echo $map->setInitializeFunction();
echo $map->endJScData();
echo $map->loadAPI('', $this->map->lang);// must be loaded as last
}
echo $foutput;
echo '</div>';
?>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_PHOCAMAPS_MAPS_LAYOUT">
<message>
<![CDATA[COM_PHOCAMAPS_MAPS_LAYOUT_DESC]]>
</message>
</layout>
<name>COM_PHOCAMAPS_MAPS_LAYOUT</name>
<description>COM_PHOCAMAPS_MAPS_LAYOUT_DESC</description>
<fields name="request">
<fieldset name="request" addfieldpath="/administrator/components/com_phocamaps/models/fields">
<field name="id" class="form-select" type="phocamapsmap" default="0" label="COM_PHOCAMAPS_SELECT_MAP" description="COM_PHOCAMAPS_SELECT_MAP" required="true" />
</fieldset>
</fields>
</metadata>

View File

@ -0,0 +1,279 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
// Possible solution when the OSM is displayed in hidden part like in tabs:
// Add to JS following:
//$o[]= 'jQuery(\'.phTabs ul li a\').click(function(){ setTimeout(function() { map'.$this->name.$this->id.'.invalidateSize(); }, 0);});';
$app = Factory::getApplication();
if ($app->input->get( 'print', '', 'int' ) == 1 || $app->input->get( 'tmpl', '', 'string' ) == 'component') {
$foutput = '<div style="clear:both"></div>';
echo '<div id="phocamaps" class="phocamaps'.$this->t['p']->get( 'pageclass_sfx' ).'">';
} else {
echo '<div id="phocamaps" class="phocamaps'.$this->t['p']->get( 'pageclass_sfx' ).'">';
if ( $this->t['p']->def( 'show_page_heading', 1 ) ) {
echo '<h1>'. $this->t['p']->get('page_heading') . '</h1>';
}
$foutput = PhocaMapsHelper::getExtInfo();
}
if ((!isset($this->map->longitude))
|| (!isset($this->map->latitude))
|| (isset($this->map->longitude) && $this->map->longitude == '')
|| (isset($this->map->latitude) && $this->map->latitude == '')) {
echo '<p>' . Text::_('COM_PHOCAMAPS_MAP_ERROR_FRONT') . '</p>';
} else {
echo $this->t['description'];
$id = uniqid();
$map = new PhocaMapsMapOsm($id);
//$map->loadAPI();
//$map->loadGeoXMLJS();
//$map->loadBase64JS();
$map->loadAPI();
$map->loadCoordinatesJS();
// Map Box
if ($this->t['border'] == '') {
echo '<div class="phocamaps-box" align="center" style="'.$this->t['stylesite'].'">';
if ($this->t['fullwidth'] == 1) {
echo '<div id="phocaMap'.$id.'" style="margin:0;padding:0;width:100%;height:'.$this->map->height.'"></div>';
} else {
echo '<div id="phocaMap'.$id.'" style="margin:0;padding:0;width:'.$this->map->width.';height:'.$this->map->height.'"></div>';
}
echo '</div>';
} else {
//echo '<div id="phocamaps-box"><div class="pmbox'.$this->t['border'].'" '. $this->t['stylesitewidth'].'><div><div><div>';
echo '<div class="phocamaps-box phocamaps-box-border'.$this->t['border'].'" align="center" style="'.$this->t['stylesite'].'">';
if ($this->t['fullwidth'] == 1) {
echo '<div id="phocaMap'.$id.'" class="phocamaps-map" style="width:100%;height:'.$this->map->height.'"></div>';
} else {
echo '<div id="phocaMap'.$id.'" class="phocamaps-map" style="width:'.$this->map->width.';height:'.$this->map->height.'"></div>';
}
echo '<div class="phocamaps-box" align="center" style="'.$this->t['stylesite'].'"></div>';
echo '</div>';
//echo '</div></div></div></div></div>';
}
// Direction
/* if ($this->t['displaydir']) {
$countMarker = count($this->marker);
$form = '';
if ((int)$countMarker > 1) {
$form .= ' ' . Text::_('COM_PHOCAMAPS_TO').': <select name="pmto'.$id.'" id="toPMAddress'.$id.'">';
foreach ($this->marker as $key => $markerV) {
if ((isset($markerV->longitude) && $markerV->longitude != '')
&& (isset($markerV->latitude) && $markerV->latitude != '')) {
$form .= '<option value="'.$markerV->latitude.','.$markerV->longitude.'">'.$markerV->title.'</option>';
}
}
$form .= '</select>';
} else if ((int)$countMarker == 1) {
foreach ($this->marker as $key => $markerV) {
if ((isset($markerV->longitude) && $markerV->longitude != '')
&& (isset($markerV->latitude) && $markerV->latitude != '')) {
$form .= '<input name="pmto'.$id.'" id="toPMAddress'.$id.'" type="hidden" value="'.$markerV->latitude.','.$markerV->longitude.'" />';
}
}
}
if ($form != '') {
echo '<div class="pmroute">';
echo '<form class="form-inline" action="#" onsubmit="setPhocaDir'.$id.'(this.pmfrom'.$id.'.value, this.pmto'.$id.'.value); return false;">';
echo Text::_('COM_PHOCAMAPS_FROM_ADDRESS').': <input class="pm-input-route input" type="text" size="30" id="fromPMAddress'.$id.'" name="pmfrom'.$id.'" value=""/>';
echo $form;
echo ' <input name="pmsubmit'.$id.'" type="submit" class="pm-input-route-btn btn" value="'.Text::_('COM_PHOCAMAPS_GET_ROUTE').'" />';
echo '</form></div>';
echo '<div id="phocaDir'.$id.'">';
if ($this->t['display_print_route'] == 1) {
echo '<div id="phocaMapsPrintIcon'.$id.'" style="display:none"></div>';
}
echo '</div>';
}
} */
// $id is not used anymore as this is added in methods of Phoca Maps Class
// e.g. 'phocaMap' will be not 'phocaMap'.$id as the id will be set in methods
/* echo $map->startJScData();
echo $map->addAjaxAPI('maps', '3', $this->t['params']);
echo $map->addAjaxAPI('search', '1', $this->t['paramssearch']);
echo $map->createMap('phocaMap', 'mapPhocaMap', 'phocaLatLng', 'phocaOptions','tstPhocaMap', 'tstIntPhocaMap', FALSE, FALSE, $this->t['displaydir']);
echo $map->cancelEventFunction();
echo $map->checkMapFunction();
echo $map->startMapFunction();
echo $map->setLatLng( $this->map->latitude, $this->map->longitude );
echo $map->startMapOptions();
echo $map->setMapOption('zoom', $this->map->zoom).','."\n";
echo $map->setCenterOpt().','."\n";
echo $map->setTypeControlOpt($this->map->typecontrol, $this->map->typecontrolposition).','."\n";
echo $map->setNavigationControlOpt($this->map->zoomcontrol).','."\n";
echo $map->setMapOption('scaleControl', $this->map->scalecontrol, TRUE ).','."\n";
echo $map->setMapOption('scrollwheel', $this->map->scrollwheelzoom, TRUE).','."\n";
echo $map->setMapOption('disableDoubleClickZoom', $this->map->disabledoubleclickzoom).','."\n";
// echo $map->setMapOption('googleBar', $this->map->googlebar).','."\n";// Not ready yet
// echo $map->setMapOption('continuousZoom', $this->map->continuouszoom).','."\n";// Not ready yet
echo $map->setMapOption('styles', $this->map->map_styles).','."\n";
echo $map->setMapTypeOpt($this->map->typeid)."\n";
echo $map->endMapOptions($this->map->custom_options);
if ($this->t['close_opened_window'] == 1) {
echo $map->setCloseOpenedWindow();
}
echo $map->setMap();*/
$map->createMap($this->map->latitude, $this->map->longitude, $this->map->zoom);
$map->setMapType();
// Markers
jimport('joomla.filter.output');
$i = 0;
if (isset($this->marker) && !empty($this->marker)) {
$iconArray = array(); // add information about created icons to array and check it so no duplicity icons js code will be created
foreach ($this->marker as $key => $markerV) {
if ((isset($markerV->longitude) && $markerV->longitude != '')
&& (isset($markerV->latitude) && $markerV->latitude != '')) {
if ($i == 0) {
// Get info about first marker to use it in routing plan
$firstMarker = $markerV;
}
//$hStyle = 'font-size:120%;margin: 5px 0px;font-weight:bold;';
//$text = '<div style="'.$hStyle.'">' . addslashes($markerV->title) . '</div>';
$text = '<div class="pmMarkerTitle">' . addslashes($markerV->title) . '</div>';
// Try to correct images in description
$markerV->description = PhocaMapsHelper::fixImagePath($markerV->description);
$markerV->description = str_replace('@', '&#64;', $markerV->description);
$text .= '<div>'. PhocaMapsHelper::strTrimAll(addslashes($markerV->description)).'</div>';
if ($markerV->displaygps == 1) {
$text .= '<div class="pmgps"><table border="0"><tr><td><strong>'. Text::_('COM_PHOCAMAPS_GPS') . ': </strong></td>'
.'<td>'.PhocaMapsHelper::strTrimAll(addslashes($markerV->gpslatitude)).'</td></tr>'
.'<tr><td></td>'
.'<td>'.PhocaMapsHelper::strTrimAll(addslashes($markerV->gpslongitude)).'</td></tr></table></div>';
}
if(empty($markerV->icon)) {
$markerV->icon = 0;
}
if(empty($markerV->title)){
$markerV->title = '';
}
if(empty($markerV->description)){
$markerV->description = '';
}
/*$iconOutput = $map->setMarkerIcon($markerV->icon, $markerV->iconext, $markerV->iurl, $markerV->iobject, $markerV->iurls, $markerV->iobjects, $markerV->iobjectshape);
echo $map->outputMarkerJs($iconOutput['js'], $markerV->icon, $markerV->iconext);
echo $map->setMarker($markerV->id,$markerV->title,$markerV->description,$markerV->latitude, $markerV->longitude, $iconOutput['icon'], $iconOutput['iconid'], $text, $markerV->contentwidth, $markerV->contentheight, $markerV->markerwindow, $iconOutput['iconshadow'], $iconOutput['iconshape'], $this->t['close_opened_window'] );*/
$map->setMarker($id . 'm'.$markerV->id, $markerV->title, $markerV->description, $markerV->latitude, $markerV->longitude, $text, $markerV->contentwidth, $markerV->contentheight, $markerV->markerwindow, $this->t['close_opened_window']);
$markerIconOptions = array();
if (isset($markerV->osm_icon) && $markerV->osm_icon != '') {
$markerIconOptions = $map->setMarkerIcon($id . 'm'.$markerV->id, $markerV->osm_icon, $markerV->osm_marker_color, $markerV->osm_icon_color, $markerV->osm_icon_prefix, $markerV->osm_icon_spin, $markerV->osm_icon_class);
}
if ($i == 0) {
// Get info about first marker to use it in routing plan
// so we get the same icons for markers in Options like the first marker has
$firstMarker->markericonoptions = $markerIconOptions;
}
$i++;
}
}
$map->setMarkerClusterer();
}
/*if ($this->t['load_kml']) {
echo $map->setKMLFile($this->t['load_kml']);
}
if ($this->t['displaydir']) {
echo $map->setDirectionDisplayService('phocaDir');
}
if(isset($this->map->scrollwheelzoom) && $this->map->scrollwheelzoom != 0){
echo $map->setListener();
}
echo $map->endMapFunction();
if ($this->t['displaydir']) {
echo $map->setDirectionFunction($this->t['display_print_route'], $this->map->id, $this->map->alias, $this->t['lang']);
}
echo $map->setInitializeFunctionSpecificMap();
echo $map->setInitializeFunction();
echo $map->endJScData();
echo $map->loadAPI();// must be loaded as last*/
$map->renderFullScreenControl();
$map->renderCurrentPosition();
$map->renderSearch('', 'topleft');
// Get Lat and Lng TO (first marker)
$lat = $lng = 0;
$mId = '';
$markerIconOptions = array();
if (isset($firstMarker->latitude)) {
$lat = $firstMarker->latitude;
}
if (isset($firstMarker->longitude)) {
$lng = $firstMarker->longitude;
}
if (isset($firstMarker->id)) {
$mId = $id . 'm'.$firstMarker->id;
}
if (isset($firstMarker->markericonoptions)) {
$markerIconOptions = $firstMarker->markericonoptions;
}
if (!empty($this->t['tracks'])) {
foreach ($this->t['tracks'] as $ky=>$trk) {
$fitbounds = $ky==0 ? $this->t['fitbounds'] : false;
if (isset($trk['file'])) {
$map->renderTrack($trk['file'], $trk['color'], $fitbounds);
}
}
}
$map->renderRouting(0,0,$lat,$lng, $mId, $markerIconOptions, $this->map->lang);
$map->renderEasyPrint();
$map->renderMap();
}
echo $foutput;
echo '</div>';
?>

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,313 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('_JEXEC') or die();
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;
jimport( 'joomla.application.component.view');
class PhocaMapsViewMap extends HtmlView
{
protected $t;
protected $map;
protected $marker;
function display($tpl = null) {
$document = Factory::getDocument();
$app = Factory::getApplication();
$this->t['p'] = $app->getParams();
// PLUGIN WINDOW - we get information from plugin
$get = array();
$get['tmpl'] = $app->input->get( 'tmpl', '', 'string' );
HTMLHelper::_('jquery.framework', false);
HTMLHelper::stylesheet('media/com_phocamaps/css/phocamaps.css' );
if (File::exists(JPATH_SITE.'/media/com_phocamaps/css/custom.css')) {
HTMLHelper::stylesheet('media/com_phocamaps/css/custom.css' );
}
$this->t['enable_kml'] = $this->t['p']->get( 'enable_kml', 0 );
$this->t['display_print_route'] = $this->t['p']->get( 'display_print_route', 1 );
$this->t['close_opened_window'] = $this->t['p']->get( 'close_opened_window', 0 );
$this->t['load_api_ssl'] = (int)$this->t['p']->get( 'load_api_ssl', 0 );
$this->t['map_type'] = (int)$this->t['p']->get( 'map_type', 2 );
// Moved to marker table
//$this->t['width_marker_content'] = $this->t['p']->get( 'width_marker_content', '' );
//$this->t['height_marker_content'] = $this->t['p']->get( 'height_marker_content', '' );
//$this->t['open_marker_window'] = $this->t['p']->get( 'open_marker_window', 0 );
// MODEL
$model = $this->getModel();
$item = $model->getData();
$this->map = $item['map'];
$this->marker = $item['marker'];
if( (!isset($this->map)) || (isset($this->map) && $this->map == null) ) {
echo '<div id="phocamaps"><div class="error">'.Text::_('COM_PHOCAMAPS_WARNING_SELECT_MAP').'</div></div>';
return true;
}
// Plugin information
$this->t['pluginmap'] = 0;
if (isset($get['tmpl']) && $get['tmpl'] == 'component') {
$this->t['pluginmap'] = 1;
// NO SCROLLBAR if windows is called by plugin but if there is a route form, display it
if (isset($this->map->displayroute) && $this->map->displayroute == 1) {
$document->addCustomTag( "<style type=\"text/css\"> \n"
." html,body, .contentpane{background:#ffffff;text-align:left;} \n"
." </style> \n");
} else {
$document->addCustomTag( "<style type=\"text/css\"> \n"
." html,body, .contentpane{overflow:hidden;background:#ffffff;} \n"
." </style> \n");
}
}
// Display Description
$this->t['description'] = '';
if (isset($this->map->description) && $this->map->description != '' && $this->t['pluginmap'] == 0) {
$this->t['description'] = '<div class="pm-desc">'.$this->map->description.'</div>';
}
// Check Width and Height
$this->t['fullwidth'] = 0;
if (!isset($this->map->width)) {
$this->map->width = '100%';
}
if (isset($this->map->width) && (int)$this->map->width < 1) {
$this->t['fullwidth'] = 1;
}
if (!isset($this->map->height) || (isset($this->map->height) && (int)$this->map->height < 1)) {
$this->map->height = '50vh';
}
if ($get['tmpl'] == 'component') {
// Modal window
$this->map->height = '95vh';
}
if (is_numeric($this->map->width)) {
$this->map->width = $this->map->width . 'px';
}
if (is_numeric($this->map->height)) {
$this->map->height = $this->map->height . 'px';
}
if (!isset($this->map->zoom) || (isset($this->map->zoom) && (int)$this->map->zoom < 1)) {
$this->map->zoom = 2;
}
// Map Langugage
$this->t['params'] = '';
if (!isset($this->map->lang) || (isset($this->map->lang) && $this->map->lang == '')) {
$this->t['params'] = '';
$this->t['paramssearch'] = '';
$this->t['lang'] = '';
} else {
//$this->t['params'] = '{"language":"'.$this->map->lang.'", "other_params":"sensor=false"}';
$this->t['params'] = '{other_params:"language='.$this->map->lang.'"}';
$this->t['paramssearch'] = '{"language":"'.$this->map->lang.'"}';
$this->t['lang'] = $this->map->lang;
}
// Design
$this->t['border'] = '';
if (isset($this->map->border)) {
switch ($this->map->border) {
case 1:
$this->t['border'] = '-grey';
break;
case 2:
$this->t['border'] = '-greywb';
break;
case 3:
$this->t['border'] = '-greyrc';
break;
case 4:
$this->t['border'] = '-black';
break;
}
}
// Plugin - no border
if ($this->t['pluginmap'] == 1) {
$this->t['border'] = '';
$this->t['stylesite'] = 'margin:10px;';
} else {
$this->t['stylesite'] = 'margin:0;padding:0;margin-top:10px;';
}
$this->t['stylesitewidth'] = '';
if ($this->t['fullwidth'] == 1) {
$this->t['stylesitewidth'] = 'style="width:100%"';
}
// Parameters
if (isset($this->map->continuouszoom) && (int)$this->map->continuouszoom == 1) {
$this->map->continuouszoom = 1;
} else {
$this->map->continuouszoom = 0;
}
if (isset($this->map->doubleclickzoom) && (int)$this->map->doubleclickzoom == 1) {
$this->map->disabledoubleclickzoom = 0;
} else {
$this->map->disabledoubleclickzoom = 1;
}
if (isset($this->map->gesturehandling) && (int)$this->map->gesturehandling != '') {
$this->map->scrollwheelzoom = 0;
}
if (isset($this->map->scrollwheelzoom) && (int)$this->map->scrollwheelzoom == 1) {
$this->map->scrollwheelzoom = 1;
} else {
$this->map->scrollwheelzoom = 0;
}
// Since 1.1.0 zoomcontrol is alias for navigationcontrol
if (empty($this->map->zoomcontrol)) {
$this->map->zoomcontrol = 0;
}
if (empty($this->map->scalecontrol)) {
$this->map->scalecontrol = 0;
}
if (empty($this->map->typecontrol)) {
$this->map->typecontrol = 0;
}
if (empty($this->map->typecontrolposition)) {
$this->map->typecontrolposition = 0;
}
if (empty($this->map->typeid)) {
$this->map->typeid = 0;
}
// Display Direction
$this->t['displaydir'] = 0;
if (isset($this->map->displayroute) && $this->map->displayroute == 1) {
if (isset($this->marker) && !empty($this->marker)) {
$this->t['displaydir'] = 1;
}
}
// KML Support
$this->t['load_kml'] = FALSE;
if($this->t['enable_kml'] == 1) {
jimport( 'joomla.filesystem.folder' );
jimport( 'joomla.filesystem.file' );
$path = PhocaMapsPath::getPath();
if (isset($this->map->kmlfile) && File::exists($path->kml_abs . $this->map->kmlfile)) {
$this->t['load_kml'] = $path->kml_rel_full . $this->map->kmlfile;
}
}
//OSM tracks
if ($this->t['map_type'] == 2) {
$this->t['fitbounds'] = $this->map->fitbounds_osm;
$textarea = $this->map->trackfiles_osm;
$textarea = str_replace(array("\r\n", "\n", "\r"),'',$textarea);
$tracks = explode(",",$textarea);
$textarea = $this->map->trackcolors_osm;
$textarea = str_replace(array("\r\n", "\n", "\r"),'',$textarea);
//$colors = explode(",",$textarea);
$colors = array_map('trim', explode(',', $textarea));
$tracksA = array();
foreach ($tracks as $k => $v) {
$v = trim($v);
$ext = pathinfo($v,PATHINFO_EXTENSION);
if (($ext != 'gpx') && ($ext != 'kml')) {
$v = '';
} else {
//if no path specified add default path (hardcoded to /phocamapskml for now)
if (strpos($v,'/') === false) {
$v = 'phocamapskml/'.$v;
}
$v = trim($v,'/');
$tracksA[$k] = array();
$tracksA[$k]['file'] = File::exists(JPATH_ROOT.'/'.$v) ? Uri::base().$v : '';
$tracksA[$k]['color'] = isset($colors[$k]) ? $colors[$k] : '';
}
}
$this->t['tracks'] = $tracksA;
} else {
$this->t['tracks'] = array();
}
$this->_prepareDocument();
if ($this->t['map_type'] == 2) {
parent::display('osm');
} else {
parent::display($tpl);
}
}
protected function _prepareDocument() {
$app = Factory::getApplication();
$menus = $app->getMenu();
$menu = $menus->getActive();
$pathway = $app->getPathway();
$title = null;
if ($menu) {
$this->t['p']->def('page_heading', $this->t['p']->get('page_title', $menu->title));
} else {
$this->t['p']->def('page_heading', Text::_('JGLOBAL_ARTICLES'));
}
// get page title
$title = $this->t['p']->get('page_title', '');
// if no title is set take the sitename only
if (empty($title)) {
$title = $app->get('sitename');
}
// else add the title before or after the sitename
elseif ($app->get('sitename_pagetitles', 0) == 1) {
$title = Text::sprintf('JPAGETITLE', $app->get('sitename'), $title);
}
elseif ($app->get('sitename_pagetitles', 0) == 2) {
$title = Text::sprintf('JPAGETITLE', $title, $app->get('sitename'));
}
$this->document->setTitle($title);
$this->document->setDescription($this->t['p']->get('menu-meta_description', ''));
$this->document->setMetadata('keywords', $this->t['p']->get('menu-meta_keywords', ''));
if ($app->get('MetaTitle') == '1' && $this->t['p']->get('menupage_title', '')) {
$this->document->setMetaData('title', $this->t['p']->get('page_title', ''));
}
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<view hidden="true" />
</metadata>

View File

@ -0,0 +1,32 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('_JEXEC') or die('Restricted access');
echo '<div id="phocamapsprintroute">';
$id = '';
$map = new PhocaMapsMap();
echo $map->getIconPrintScreen();
//$map->loadAPI();
//$map->loadAPI();
echo $map->startJScData();
echo $map->addAjaxAPI('maps', '3.x', $this->t['params']);
echo $map->createDirection(1);
echo $map->setDirectionFunction();
echo $map->directionInitializeFunctionSpecificMap($this->t['from'], $this->t['to']);
echo $map->directionInitializeFunction();
echo $map->endJScData();
echo $map->loadAPI('', $this->t['lang']);// must be loaded as last
echo '<div id="directionsPanel'.$id.'" ></div>';
echo PhocaMapsHelper::getExtInfo();
echo '</div>';

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,47 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('_JEXEC') or die();
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Filesystem\File;
jimport( 'joomla.application.component.view');
class PhocaMapsViewRoute extends HtmlView
{
protected $t;
function display($tpl = null) {
//$document = Factory::getDocument();
$app = Factory::getApplication();
$this->t['p'] = $app->getParams();
HTMLHelper::stylesheet('media/com_phocamaps/css/phocamaps.css' );
if (File::exists(JPATH_SITE.'/media/com_phocamaps/css/custom.css')) {
HTMLHelper::stylesheet('media/com_phocamaps/css/custom.css' );
}
//$this->t['printview'] = $app->input->get('print', 0, 'get', 'int');
$this->t['id'] = $app->input->get('id', '', 'int');
$this->t['from'] = $app->input->get('from', '', 'string');
$this->t['to'] = $app->input->get('to', '', 'string');
$this->t['lang'] = $app->input->get('lang', '', 'string');
$this->t['load_api_ssl']= (int)$this->t['p']->get( 'load_api_ssl', 0 );
// Map params - language not used
if ($this->t['lang'] == '') {
$this->t['params'] = '';
} else {
//$this->t['params'] = '{"language":"'.$item['map']->lang.'", "other_params":"sensor=false"}';
$this->t['params'] = '{other_params:"language='.$this->t['lang'].'"}';
}
parent::display($tpl);
}
}
?>