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,70 @@
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
*/
defined('JPATH_PLATFORM') or die;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Factory;
abstract class PhocaMapsBatch
{
public static function item($published, $category = 0)
{
// Create the copy/move options.
$options = array(
HTMLHelper::_('select.option', 'c', Text::_('JLIB_HTML_BATCH_COPY')),
HTMLHelper::_('select.option', 'm', Text::_('JLIB_HTML_BATCH_MOVE'))
);
$db = Factory::getDBO();
if ($category == 1) {
$data = array();
array_unshift($data, HTMLHelper::_('select.option', 0, Text::_('JLIB_HTML_ADD_TO_ROOT'), 'value', 'text'));
} else {
//build the list of categories
$query = 'SELECT a.title AS text, a.id AS value, 0 as catid'
. ' FROM #__phocamaps_map AS a'
// TO DO. ' WHERE a.published = '.(int)$published
. ' ORDER BY a.ordering';
$db->setQuery( $query );
$data = $db->loadObjectList();
//$tree = array();
//$text = '';
//$catId= -1;
//$tree = PhocaGalleryRenderAdmin::CategoryTreeOption($data, $tree, 0, $text, $catId);
}
// Create the batch selector to change select the category by which to move or copy.
$lines = array(
'<label id="batch-choose-action-lbl" for="batch-choose-action">',
Text::_('JLIB_HTML_BATCH_MENU_LABEL'),
'</label>',
'<fieldset id="batch-choose-action" class="combo">',
'<select name="batch[category_id]" class="form-select" id="batch-category-id">',
'<option value="">'.Text::_('JSELECT').'</option>',
/*HtmlHelper::_('select.options', HtmlHelper::_('category.options', $extension, array('published' => (int) $published))),*/
HTMLHelper::_('select.options', $data ),
'</select>',
HTMLHelper::_( 'select.radiolist', $options, 'batch[move_copy]', '', 'value', 'text', 'm'),
'</fieldset>'
);
return implode("\n", $lines);
}
}

View File

@ -0,0 +1 @@
<html><body></body></html>

View File

@ -0,0 +1,38 @@
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
class PhocaMapsSelectMap
{
public static function options()
{
$db = Factory::getDBO();
//build the list of categories
$query = 'SELECT a.title AS text, a.id AS value'
. ' FROM #__phocamaps_map AS a'
. ' WHERE a.published = 1'
. ' ORDER BY a.ordering';
$db->setQuery( $query );
$maps = $db->loadObjectList();
$catId = -1;
$javascript = 'class="form-control" size="1" onchange="submitform( );"';
/*$tree = array();
$text = '';
$tree = PhocaGalleryRenderAdmin::CategoryTreeOption($maps, $tree, 0, $text, $catId);
*/
return $maps;
}
}

View File

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

View File

@ -0,0 +1,154 @@
<?php
/*
* @package Joomla 3.8
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*
* @component Phoca Component
* @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\Filesystem\Folder;
use Joomla\CMS\Installer\Installer;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Factory;
class PhocaMapsHelper
{
public static function strTrimAll($input) {
$output = '';;
$input = trim($input);
for($i=0;$i<strlen($input);$i++) {
if(substr($input, $i, 1) != " ") {
$output .= trim(substr($input, $i, 1));
} else {
$output .= " ";
}
}
return $output;
}
public static function getPhocaVersion($component = 'com_phocamaps') {
$component = 'com_phocamaps';
$folder = JPATH_ADMINISTRATOR . '/components/'.$component;
if (Folder::exists($folder)) {
$xmlFilesInDir = Folder::files($folder, '.xml$');
} else {
$folder = JPATH_SITE . '/components/'.$component;
if (Folder::exists($folder)) {
$xmlFilesInDir = Folder::files($folder, '.xml$');
} else {
$xmlFilesInDir = null;
}
}
$xml_items = array();
if (!empty($xmlFilesInDir))
{
foreach ($xmlFilesInDir as $xmlfile)
{
if ($data = Installer::parseXMLInstallFile($folder.'/'.$xmlfile)) {
foreach($data as $key => $value) {
$xml_items[$key] = $value;
}
}
}
}
if (isset($xml_items['version']) && $xml_items['version'] != '' ) {
return $xml_items['version'];
} else {
return '';
}
}
public static function getAliasName($name) {
}
public static function fixImagePath($description) {
$description = str_replace('<img src="'.Uri::root(true).'/', '', $description);// no double
$description = str_replace('<img src="', '<img src="'.Uri::root(true).'/', $description);
// correct possible problems with full paths
$description = str_replace('<img src="'.Uri::root(true).'/http://', '<img src="http://', $description);
$description = str_replace('<img src="/http://', '<img src="http://', $description);
$description = str_replace('<img src="'.Uri::root(true).'/https://', '<img src="https://', $description);
$description = str_replace('<img src="/https://', '<img src="https://', $description);
return $description;
}
public static function filterValue($string, $type = 'html') {
switch ($type) {
case 'url':
return rawurlencode($string);
break;
case 'number':
return preg_replace( '/[^.0-9]/', '', $string );
break;
case 'number2':
//return preg_replace( '/[^0-9\.,+-]/', '', $string );
return preg_replace( '/[^0-9\.,-]/', '', $string );
break;
case 'alphanumeric':
return preg_replace("/[^a-zA-Z0-9]+/", '', $string);
break;
case 'alphanumeric2':
return preg_replace("/[^\\w-]/", '', $string);// Alphanumeric plus _ -
break;
case 'alphanumeric3':
return preg_replace("/[^\\w.-]/", '', $string);// Alphanumeric plus _ . -
break;
case 'folder':
case 'file':
$string = preg_replace('/[\"\*\/\\\:\<\>\?\'\|]+/', '', $string);
return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
break;
case 'folderpath':
case 'filepath':
$string = preg_replace('/[\"\*\:\<\>\?\'\|]+/', '', $string);
return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
break;
case 'text':
return htmlspecialchars(strip_tags($string), ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
break;
case 'textjs':
return addslashes(strip_tags($string));
break;
case 'html':
default:
return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
break;
}
}
public static function getExtInfo() {
PluginHelper::importPlugin('phocatools');
$results = Factory::getApplication()->triggerEvent('onPhocatoolsOnDisplayInfo', array('NjI5NTcyMjc3MTE3'));
if (isset($results[0]) && $results[0] === true) {
return '';
}
return '<div style="text-align: right; color: rgb(211, 211, 211); clear: both; margin-top: 10px;margin-bottom:10px;">Powered by <a href="https://www.phoca.cz" style="text-decoration: none;" target="_blank" title="Phoca.cz">Phoca</a> <a href="https://www.phoca.cz/phocamaps" style="text-decoration: none;" target="_blank" title="Phoca Maps">Maps</a></div>';
}
}
?>

View File

@ -0,0 +1,34 @@
<?php
/*
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Object\CMSObject;
class PhocaMapsCpHelper
{
public static function getActions()
{
$user = Factory::getUser();
$result = new CMSObject;
$assetName = 'com_phocamaps';
$actions = array(
'core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete'
);
foreach ($actions as $action) {
$result->set($action, $user->authorise($action, $assetName));
}
return $result;
}
}

View File

@ -0,0 +1,137 @@
<?php
/*
* @package Joomla 3.8
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined( '_JEXEC' ) or die( 'Restricted access' );
/* Google Maps Version 3 */
class PhocaMapsIcon
{
function __construct() {}
public static function getIconData($icon) {
// Icon Grey
$i[1]['name'] = 'igrey';
$i[1]['size'] = '20,24';
$i[1]['point1'] = '0,0';
$i[1]['point2'] = '5,30';
$i[1]['sizes'] = '32,24';
$i[1]['point1s']= '0,0';
$i[1]['point2s']= '5,30';
$i[1]['cord'] = '[14,1,16,2,18,3,19,4,19,5,19,6,19,7,18,8,18,9,17,10,16,11,16,12,15,13,14,14,14,15,15,16,17,17,17,18,18,19,17,20,14,21,10,22,7,23,2,23,2,22,2,21,2,20,1,19,1,18,1,17,1,16,1,15,0,14,0,13,0,12,0,11,0,10,0,9,7,8,7,7,8,6,8,5,9,4,9,3,10,2,11,1]';
$i[1]['type'] = 'poly';
// Icon Yellow
$i[2]['name'] = 'iyellow';
$i[2]['size'] = '26,30';
$i[2]['point1'] = '0,0';
$i[2]['point2'] = '5,30';
$i[2]['sizes'] = '41,30';
$i[2]['point1s']= '0,0';
$i[2]['point2s']= '5,30';
$i[2]['cord'] = '[18,1,19,2,21,3,23,4,24,5,24,6,24,7,24,8,23,9,23,10,22,11,22,12,21,13,20,14,20,15,19,16,19,17,18,18,17,19,18,20,20,21,22,22,22,23,22,24,22,25,18,26,15,27,12,28,8,29,4,29,4,28,3,27,3,26,3,25,3,24,3,23,2,22,2,21,2,20,2,19,2,18,1,17,1,16,1,15,1,14,1,13,1,12,1,11,9,10,10,9,10,8,11,7,11,6,12,5,12,4,13,3,14,2,14,1]';
$i[2]['type'] = 'poly';
// Icon Home
$i[3]['name'] = 'ihome';
$i[3]['size'] = '26,26';
$i[3]['point1'] = '0,0';
$i[3]['point2'] = '15,30';
$i[3]['sizes'] = '39,26';
$i[3]['point1s']= '0,0';
$i[3]['point2s']= '15,30';
$i[3]['cord'] = '[13,1,20,2,20,3,20,4,20,5,20,6,20,7,20,8,20,9,21,10,23,11,23,12,23,13,22,14,22,15,22,16,22,17,22,18,22,19,22,20,22,21,22,22,22,23,22,24,2,24,2,23,2,22,2,21,2,20,2,19,2,18,2,17,2,16,2,15,3,14,1,13,1,12,1,11,3,10,4,9,5,8,6,7,7,6,8,5,9,4,10,3,10,2,11,1]';
$i[3]['type'] = 'poly';
// Icon Home
$i[4]['name'] = 'igreen';
$i[4]['size'] = '26,26';
$i[4]['point1'] = '0,0';
$i[4]['point2'] = '15,30';
$i[4]['sizes'] = '39,26';
$i[4]['point1s']= '0,0';
$i[4]['point2s']= '15,30';
$i[4]['cord'] = '[15,2,18,3,19,4,20,5,21,6,22,7,23,8,23,9,23,10,23,11,23,12,23,13,23,14,23,15,23,16,22,17,22,18,21,19,20,20,19,21,17,22,21,23,21,24,16,25,8,25,4,24,4,23,8,22,6,21,5,20,4,19,3,18,3,17,2,16,2,15,2,14,2,13,2,12,2,11,2,10,2,9,2,8,3,7,4,6,5,5,6,4,7,3,10,2]';
$i[4]['type'] = 'poly';
// Icon Star
$i[5]['name'] = 'istar';
$i[5]['size'] = '26,26';
$i[5]['point1'] = '0,0';
$i[5]['point2'] = '15,30';
$i[5]['sizes'] = '39,26';
$i[5]['point1s']= '0,0';
$i[5]['point2s']= '15,30';
$i[5]['cord'] = '[13,0,13,1,13,2,14,3,14,4,15,5,15,6,15,7,21,8,25,9,25,10,23,11,22,12,21,13,20,14,19,15,19,16,19,17,19,18,19,19,19,20,20,21,20,22,20,23,20,24,19,25,6,25,5,24,5,23,5,22,5,21,5,20,5,19,6,18,6,17,6,16,6,15,5,14,4,13,3,12,2,11,0,10,0,9,4,8,9,7,9,6,10,5,10,4,11,3,11,2,12,1,12,0]';
$i[5]['type'] = 'poly';
// Icon Info Home
$i[6]['name'] = 'iinfoh';
$i[6]['size'] = '25,33';
$i[6]['point1'] = '0,0';
$i[6]['point2'] = '11,33';
$i[6]['sizes'] = '42,33';
$i[6]['point1s']= '0,0';
$i[6]['point2s']= '11,33';
$i[6]['cord'] = '[22,0,23,1,24,2,24,3,24,4,24,5,24,6,24,7,24,8,24,9,24,10,24,11,24,12,24,13,24,14,24,15,24,16,24,17,24,18,24,19,24,20,24,21,23,22,22,23,20,24,19,25,18,26,18,27,17,28,16,29,16,30,15,31,15,32,9,32,9,31,8,30,8,29,7,28,6,27,6,26,5,25,4,24,2,23,1,22,0,21,0,20,0,19,0,18,0,17,0,16,0,15,0,14,0,13,0,12,0,11,0,10,0,9,0,8,0,7,0,6,0,5,0,4,0,3,0,2,1,1,2,0]';
$i[6]['type'] = 'poly';
// Icon Info Info
$i[7]['name'] = 'iinfoi';
$i[7]['size'] = '25,33';
$i[7]['point1'] = '0,0';
$i[7]['point2'] = '11,33';
$i[7]['sizes'] = '42,33';
$i[7]['point1s']= '0,0';
$i[7]['point2s']= '11,33';
$i[7]['cord'] = '[22,0,23,1,24,2,24,3,24,4,24,5,24,6,24,7,24,8,24,9,24,10,24,11,24,12,24,13,24,14,24,15,24,16,24,17,24,18,24,19,24,20,24,21,23,22,22,23,20,24,19,25,18,26,18,27,17,28,16,29,16,30,15,31,15,32,9,32,9,31,8,30,8,29,7,28,6,27,6,26,5,25,4,24,2,23,1,22,0,21,0,20,0,19,0,18,0,17,0,16,0,15,0,14,0,13,0,12,0,11,0,10,0,9,0,8,0,7,0,6,0,5,0,4,0,3,0,2,1,1,2,0]';
$i[7]['type'] = 'poly';
// Icon Info Post
$i[8]['name'] = 'iinfop';
$i[8]['size'] = '25,33';
$i[8]['point1'] = '0,0';
$i[8]['point2'] = '11,33';
$i[8]['sizes'] = '42,33';
$i[8]['point1s']= '0,0';
$i[8]['point2s']= '11,33';
$i[8]['cord'] = '[22,0,23,1,24,2,24,3,24,4,24,5,24,6,24,7,24,8,24,9,24,10,24,11,24,12,24,13,24,14,24,15,24,16,24,17,24,18,24,19,24,20,24,21,23,22,22,23,20,24,19,25,18,26,18,27,17,28,16,29,16,30,15,31,15,32,9,32,9,31,8,30,8,29,7,28,6,27,6,26,5,25,4,24,2,23,1,22,0,21,0,20,0,19,0,18,0,17,0,16,0,15,0,14,0,13,0,12,0,11,0,10,0,9,0,8,0,7,0,6,0,5,0,4,0,3,0,2,1,1,2,0]';
$i[8]['type'] = 'poly';
// Icon Info Phone
$i[9]['name'] = 'iinfoph';
$i[9]['size'] = '25,33';
$i[9]['point1'] = '0,0';
$i[9]['point2'] = '11,33';
$i[9]['sizes'] = '42,33';
$i[9]['point1s']= '0,0';
$i[9]['point2s']= '11,33';
$i[9]['cord'] = '[22,0,23,1,24,2,24,3,24,4,24,5,24,6,24,7,24,8,24,9,24,10,24,11,24,12,24,13,24,14,24,15,24,16,24,17,24,18,24,19,24,20,24,21,23,22,22,23,20,24,19,25,18,26,18,27,17,28,16,29,16,30,15,31,15,32,9,32,9,31,8,30,8,29,7,28,6,27,6,26,5,25,4,24,2,23,1,22,0,21,0,20,0,19,0,18,0,17,0,16,0,15,0,14,0,13,0,12,0,11,0,10,0,9,0,8,0,7,0,6,0,5,0,4,0,3,0,2,1,1,2,0]';
$i[9]['type'] = 'poly';
// Icon Info Zoom
$i[10]['name'] = 'iinfoz';
$i[10]['size'] = '25,33';
$i[10]['point1'] = '0,0';
$i[10]['point2'] = '11,33';
$i[10]['sizes'] = '42,33';
$i[10]['point1s']= '0,0';
$i[10]['point2s']= '11,33';
$i[10]['cord'] = '[22,0,23,1,24,2,24,3,24,4,24,5,24,6,24,7,24,8,24,9,24,10,24,11,24,12,24,13,24,14,24,15,24,16,24,17,24,18,24,19,24,20,24,21,23,22,22,23,20,24,19,25,18,26,18,27,17,28,16,29,16,30,15,31,15,32,9,32,9,31,8,30,8,29,7,28,6,27,6,26,5,25,4,24,2,23,1,22,0,21,0,20,0,19,0,18,0,17,0,16,0,15,0,14,0,13,0,12,0,11,0,10,0,9,0,8,0,7,0,6,0,5,0,4,0,3,0,2,1,1,2,0]';
$i[10]['type'] = 'poly';
if(isset($i[$icon])) {
return $i[$icon];
} else {
return false;
}
}
}
?>

View File

@ -0,0 +1,31 @@
<?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\Factory;
use Joomla\CMS\Object\CMSObject;
class PhocaMapsIconsHelper
{
public static function getActions($t, $id = 0) {
$user = Factory::getUser();
$result = new CMSObject;
if (empty($id)) {
$assetName = $t['o'];
} else {
$assetName = $t['o'].'.'.$t['tasks'].'.'.(int) $id;
}
$actions = array('core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete');
foreach ($actions as $action) {
$result->set($action, $user->authorise($action, $assetName));
}
return $result;
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,761 @@
<?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\Component\ComponentHelper;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Form\Form;
class PhocaMapsMapOsm
{
protected $name = 'phocaMap';
protected $id = '';
private $output = array();
public $router = '';
public $maprouterapikey = '';
public $routerserviceurl = '';
public $routerprofile = '';
public $thunderforestmaptype = '';
public $osmmaptype = '';
public $osmmaproutertype = '';
public $currentposition = '';
public $fullscreen = '';
public $search = '';
public $zoomwheel = '';
public $zoomcontrol = '';
public $easyprint = '';
public $markerclustering = 0;
/*var $_map = 'mapPhocaMap';
var $_latlng = 'phocaLatLng';
var $_options = 'phocaOptions';
var $_tst = 'tstPhocaMap';
var $_tstint = 'tstIntPhocaMap';
var $_marker = FALSE;
var $_window = FALSE;
var $_dirdisplay = FALSE;
var $_dirservice = FALSE;
var $_geocoder = FALSE;
var $_iconArray = array();*/
function __construct($id = '') {
$app = Factory::getApplication();
$paramsC = ComponentHelper::getParams('com_phocamaps');
$this->router = $paramsC->get( 'osm_router', 0 );
$this->maprouterapikey = $paramsC->get( 'osm_map_router_api_key', '' );
$this->routerserviceurl = $paramsC->get( 'osm_router_routerserviceurl', '' );
$this->routerprofile = $paramsC->get( 'osm_router_profile', '' );
$this->thunderforestmaptype = $paramsC->get( 'thunderforest_map_type', '' );
$this->osmmaptype = $paramsC->get( 'osm_map_type', '' );
$this->osmmaproutertype = $paramsC->get( 'osm_map_router_type', '' );
$this->currentposition = $paramsC->get( 'osm_current_position', 1 );
$this->fullscreen = $paramsC->get( 'osm_full_screen',1 );
$this->search = $paramsC->get( 'osm_search', 0 );
$this->zoomwheel = $paramsC->get( 'osm_zoom_wheel', 1);
$this->zoomcontrol = $paramsC->get( 'osm_zoom_control', 1 );
$this->easyprint = $paramsC->get( 'osm_easyprint', 0 );
$this->markerclustering = $paramsC->get( 'marker_clustering', 0 );
$this->id = $id;
if ($app->isClient('administrator')) {
$this->fullscreen = 1;
$this->search = 1;
$this->zoomwheel = 1;
$this->zoomcontrol = 1;
$this->currentposition = 1;
}
}
function loadAPI() {
$document = Factory::getDocument();
$document->addScript(Uri::root(true) . '/media/com_phocamaps/js/leaflet/leaflet.js');
$document->addStyleSheet(Uri::root(true) . '/media/com_phocamaps/js/leaflet/leaflet.css');
$document->addScript(Uri::root(true) . '/media/com_phocamaps/js/leaflet-awesome/leaflet.awesome-markers.js');
$document->addStyleSheet(Uri::root(true) . '/media/com_phocamaps/js/leaflet-awesome/leaflet.awesome-markers.css');
$document->addScript(Uri::root(true) . '/media/com_phocamaps/js/leaflet-fullscreen/Leaflet.fullscreen.js');
$document->addStyleSheet(Uri::root(true) . '/media/com_phocamaps/js/leaflet-fullscreen/leaflet.fullscreen.css');
$document->addScript(Uri::root(true) . '/media/com_phocamaps/js/leaflet-control-locate/L.Control.Locate.min.js');
$document->addStyleSheet(Uri::root(true) . '/media/com_phocamaps/js/leaflet-control-locate/L.Control.Locate.css');
$document->addStyleSheet(Uri::root(true) . '/media/com_phocamaps/js/leaflet-control-locate/font-awesome.min.css');
$document->addScript(Uri::root(true) . '/media/com_phocamaps/js/leaflet-omnivore/leaflet-omnivore.js');
$document->addScript(Uri::root(true) . '/media/com_phocamaps/js/leaflet-search/leaflet-search.min.js');
$document->addStyleSheet(Uri::root(true) . '/media/com_phocamaps/js/leaflet-search/leaflet-search.css');
if ($this->router == 1) {
$document->addScript(Uri::root(true) . '/media/com_phocamaps/js/leaflet-routing-machine/leaflet-routing-machine.min.js');
$document->addStyleSheet(Uri::root(true) . '/media/com_phocamaps/js/leaflet-routing-machine/leaflet-routing-machine.css');
$document->addStyleSheet(Uri::root(true) . '/media/com_phocamaps/js/leaflet-geocoder/Control.Geocoder.css');
$document->addScript(Uri::root(true) . '/media/com_phocamaps/js/leaflet-geocoder/Control.Geocoder.js');
}
if ($this->easyprint == 1) {
$document->addScript(Uri::root(true) . '/media/com_phocamaps/js/leaflet-easyprint/bundle.js');
}
if ($this->markerclustering == 1) {
$document->addStyleSheet(Uri::root(true) . '/media/com_phocamaps/js/leaflet-markercluster/MarkerCluster.css');
$document->addStyleSheet(Uri::root(true) . '/media/com_phocamaps/js/leaflet-markercluster/MarkerCluster.Default.css');
$document->addScript(Uri::root(true) . '/media/com_phocamaps/js/leaflet-markercluster/leaflet.markercluster.min.js');
}
}
function loadCoordinatesJS() {
$document = Factory::getDocument();
$document->addScript(Uri::root(true).'/media/com_phocamaps/js/administrator/coordinates.js');
}
function createMap($lat, $lng, $zoom) {
$app = Factory::getApplication();
$opt = array();
if ($this->zoomwheel == 0) {
$opt[] = 'scrollWheelZoom: false,';
}
if ($this->zoomcontrol == 0) {
$opt[] = 'zoomControl: false,';
}
//if ($this->zoomcontrol == 0) {
$opt[] = 'zoomControl: false,';
//}
$options = '{' . implode("\n", $opt) . '}';
$o = array();
$o[]= 'var map'.$this->name.$this->id.' = L.map("'.$this->name.$this->id.'", '.$options.').setView(['.PhocaMapsHelper::filterValue($lat, 'number2').', '.PhocaMapsHelper::filterValue($lng, 'number2').'], '.(int)$zoom.');';
if ($this->zoomcontrol == 1) {
$o[] = 'new L.Control.Zoom({ zoomInTitle: \''.Text::_('COM_PHOCACART_ZOOM_IN_TITLE').'\', zoomOutTitle: \''.Text::_('COM_PHOCACART_ZOOM_OUT_TITLE').'\' }).addTo(map'.$this->name.$this->id.');';
}
if ($this->markerclustering == 1) {
$o[] = 'var markers' . $this->name . $this->id . ' = L.markerClusterGroup();';
}
$this->output[] = implode("\n", $o);
return true;
}
function setMapType() {
$app = Factory::getApplication();
// Possible new parameters
$thunderForestMapType = $this->thunderforestmaptype;
$thunderForestKey = $this->maprouterapikey;
$mapBoxKey = $this->maprouterapikey;
$type = $this->osmmaptype;
$o = array();
if ($type === "osm_de") {
$o[] = 'L.tileLayer(\'https://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png\', {';
$o[] = ' maxZoom: 18,';
$o[] = ' attribution: \'&copy; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>\'';
$o[] = '}).addTo(map'.$this->name.$this->id.');';
} else if ($type === "osm_bw") {
//$o[] = 'L.tileLayer(\'http://{s}.tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png\', {';
$o[] = 'L.tileLayer(\'https://tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png\', {';
$o[] = ' maxZoom: 18,';
$o[] = ' attribution: \'&copy; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>\'';
$o[] = '}).addTo(map'.$this->name.$this->id.');';
} else if ($type === 'thunderforest') {
if ($thunderForestKey == '') {
$app->enqueueMessage(Text::_('COM_PHOCAMAPS_ERROR_API_KEY_NOT_SET'));
return false;
}
if ($thunderForestMapType == '') {
$app->enqueueMessage(Text::_('COM_PHOCAMAPS_ERROR_MAP_TYPE_NOT_SET'));
return false;
}
$o[] = 'L.tileLayer(\'https://{s}.tile.thunderforest.com/'.PhocaMapsHelper::filterValue($thunderForestMapType).'/{z}/{x}/{y}.png?apikey={apikey}\', {';
$o[] = ' maxZoom: 22,';
$o[] = ' apikey: \''.PhocaMapsHelper::filterValue($thunderForestKey).'\',';
$o[] = ' attribution: \'&copy; <a href="https://www.thunderforest.com/" target="_blank">Thunderforest</a>, &copy; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>\'';
$o[] = '}).addTo(map'.$this->name.$this->id.');';
} else if ($type === 'mapbox') {
if ($mapBoxKey == '') {
$app->enqueueMessage(Text::_('COM_PHOCAMAPS_ERROR_API_KEY_NOT_SET'));
return false;
}
$o[] = 'L.tileLayer(\'https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token='.PhocaMapsHelper::filterValue($mapBoxKey).'\', {';
$o[] = ' maxZoom: 18,';
$o[] = ' attribution: \'Map data &copy; <a href="https://openstreetmap.org" target="_blank">OpenStreetMap</a> contributors, \' + ';
$o[] = ' \'<a href="https://creativecommons.org/licenses/by-sa/2.0/" target="_blank" target="_blank">CC-BY-SA</a>, \' + ';
$o[] = ' \'Imagery © <a href="https://mapbox.com" target="_blank">Mapbox</a>\',';
$o[] = ' id: \'mapbox.streets\'';
$o[] = '}).addTo(map'.$this->name.$this->id.');';
} else if ($type === 'opentopomap') {
$o[] = 'L.tileLayer(\'https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png\', {';
$o[] = ' maxZoom: 17,';
$o[] = ' attribution: \'Map data: &copy; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>, <a href="https://viewfinderpanoramas.org" target="_blank">SRTM</a> | Map style: &copy; <a href="https://opentopomap.org" target="_blank">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/" target="_blank">CC-BY-SA</a>)\'';
$o[] = '}).addTo(map'.$this->name.$this->id.');';
} else if ($type === 'google') {
/*
$o[] = 'L.gridLayer.googleMutant({';
$o[] = ' type: googlemapstype,';
$o[] = '}).addTo(map'.$this->name.$this->id.');';
*/
} else if ($type === 'wikimedia') {
$o[] = 'L.tileLayer(\'https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png\', {';
$o[] = ' maxZoom: 18,';
$o[] = ' attribution: \'&copy; <a href="https://wikimediafoundation.org/wiki/Maps_Terms_of_Use" target="_blank">Wikimedia maps</a> | Map data © <a href="https://openstreetmap.org/copyright" target="_blank">OpenStreetMap contributors</a>\'';
$o[] = '}).addTo(map'.$this->name.$this->id.');';
} else if ($type == 'osm_fr') {
$o[] = 'L.tileLayer(\'https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png\', {';
$o[] = ' maxZoom: 20,';
$o[] = ' attribution: \'&copy; <a href="https://www.openstreetmap.fr" target="_blank">Openstreetmap France</a> & <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>\'';
$o[] = '}).addTo(map'.$this->name.$this->id.');';
} else if ($type == 'osm_hot') {
$o[] = 'L.tileLayer(\'https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png\', {';
$o[] = ' maxZoom: 20,';
$o[] = ' attribution: \'&copy; <a href="https://hotosm.org/" target="_blank">Humanitarian OpenStreetMap Team</a> & <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>\'';
$o[] = '}).addTo(map'.$this->name.$this->id.');';
} else {
$o[] = 'L.tileLayer(\'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png\', {';
$o[] = ' maxZoom: 18,';
$o[] = ' attribution: \'&copy; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>\'';
$o[] = '}).addTo(map'.$this->name.$this->id.');';
}
$this->output[] = implode("\n", $o);
return true;
}
public function setMarker($markerId, $title, $description, $lat, $lng, $text = '', $width = '', $height = '', $open = 0, $closeOpenedWindow = 0) {
$o = array();
if($open != 2){
$o[]= 'var marker'.$markerId.' = L.marker(['.PhocaMapsHelper::filterValue($lat, 'number2').', '.PhocaMapsHelper::filterValue($lng, 'number2').'])';
if ($this->markerclustering == 1) {
// marker will be added to layer with cluster function
} else {
$o[] = '.addTo(map'.$this->name.$this->id.');';
}
$o[] = ';';
}
jimport('joomla.filter.output');
$style = '';
if ($width != '') {
$style .= 'width: '.(int)$width.'px;';
}
if ($height != '') {
$style .= 'height: '.(int)$height.'px;';
}
if ($text == '') {
if ($title != ''){
$hStyle = 'font-size:120%;margin: 5px 0px;font-weight:bold;';
$text .= '<div style="'.$hStyle.'">' . addslashes($title) . '</div>';
}
if ($description != '') {
$text .= '<div>'.PhocaMapsHelper::strTrimAll(addslashes($description)).'</div>';
}
}
if ($text != '') {
if ($style != '') {
$text = '<div style="'.$style.'">' . $text . '</div>';
}
$openO = '';
if ($open == 1) {
$openO = '.openPopup()';
}
$o[]= 'marker'.$markerId.'.bindPopup(\''.$text.'\')'.$openO.';';
}
if ($this->markerclustering == 1) {
$o[] = 'markers' . $this->name . $this->id . '.addLayer(marker' . $markerId . ');';
}
$this->output[] = implode("\n", $o);
return true;
}
public function setMarkerClusterer() {
if ($this->markerclustering == 1) {
$o = array();
$o[] = 'map' . $this->name . $this->id . '.addLayer(markers' . $this->name . $this->id . ');';
$this->output[] = implode("\n", $o);
}
}
public function setMarkerIcon($markerId, $icon = 'circle', $markerColor = 'blue', $iconColor = '#ffffff', $prefix = 'fa', $spin = 'false', $extraClasses = '' ) {
$o = $o2 = array();
$o[]= 'var icon'.$markerId.' = new L.AwesomeMarkers.icon({';
$o[]= $o2[] = ' icon: "'.PhocaMapsHelper::filterValue($icon).'",';
$o[]= $o2[] = ' markerColor: "'.PhocaMapsHelper::filterValue($markerColor).'",';
$o[]= $o2[] = ' iconColor: "'.PhocaMapsHelper::filterValue($iconColor).'",';
$o[]= $o2[] = ' prefix: "'.PhocaMapsHelper::filterValue($prefix).'",';
$o[]= $o2[] = ' spin: '.PhocaMapsHelper::filterValue($spin).',';
$o[]= $o2[] = ' extraClasses: "'.PhocaMapsHelper::filterValue($extraClasses).'",';
$o[]= '})';
$o[]= ' marker'.$markerId.'.setIcon(icon'.$markerId.');';
$this->output[] = implode("\n", $o);
return $o2;//return only options;
}
public function inputMarker($latInput, $longInput, $zoomInput = '', $setGPS = 0) {
$o = array();
$o[]= 'function phmInputMarker(lat, lng) {';
$o[]= 'var phLat = jQuery(\'#jform_latitude_id\', window.parent.document);';
$o[]= 'var phLng = jQuery(\'#jform_longitude_id\', window.parent.document);';
$o[]= 'phLat.val(lat);';
$o[]= 'phLng.val(lng);';
if ( $zoomInput != '') {
$o[]= 'var phZoom = jQuery(\'#jform_zoom_id\', window.parent.document);';
$o[]= 'phZoom.val(map'.$this->name.$this->id.'.getZoom());';
$o[]= 'var phmMsg = \'<span class="ph-msg-success">'.Text::_('COM_PHOCAMAPS_LAT_LNG_ZOOM_SET').'</span>\';';
} else {
$o[]= 'var phmMsg = \'<span class="ph-msg-success">'.Text::_('COM_PHOCAMAPS_LAT_LNG_SET').'</span>\';';
}
$o[]= 'jQuery(\'#phmPopupInfo\', window.parent.document).html(phmMsg);';
if ($setGPS == 1) {
$o[]= ' if (window.parent) {setPMGPSLatitudeJForm(lat);}';
$o[]= ' if (window.parent) {setPMGPSLongitudeJForm(lng);}';
}
$o[]= '}';
$this->output[] = implode("\n", $o);
return true;
}
public function moveMarker() {
$o = array();
$o[]= 'function phmMoveMarker(marker, lat, lng) {';
$o[]= ' var newLatLng = new L.LatLng(lat, lng);';
$o[]= ' marker.setLatLng(newLatLng);';
$o[]= '}';
$this->output[] = implode("\n", $o);
return true;
}
public function exportMarker($markerId) {
$o = array();
$o[] = 'map'.$this->name.$this->id.'.on(\'click\', onMapClick);';
$o[] = 'function onMapClick(e) {';
$o[] = ' phmInputMarker(e.latlng.lat, e.latlng.lng);';
$o[] = ' phmMoveMarker(marker'.$markerId.', e.latlng.lat, e.latlng.lng);';
$o[] = '}';
$this->output[] = implode("\n", $o);
return true;
}
public function renderSearch($markerId = '', $position = '') {
if ($this->search == 0) {
return '';
}
$position = $position != '' ? $position : 'topright';
$o = array();
$o[] = 'map'.$this->name.$this->id.'.addControl(new L.Control.Search({';
$o[] = ' url: \'https://nominatim.openstreetmap.org/search?format=json&q={s}\',';
$o[] = ' jsonpParam: \'json_callback\',';
$o[] = ' propertyName: \'display_name\',';
$o[] = ' propertyLoc: [\'lat\',\'lon\'],';
$o[] = ' marker: L.circleMarker([0,0],{radius:30}),';
$o[] = ' autoCollapse: true,';
$o[] = ' autoType: false,';
$o[] = ' minLength: 3,';
$o[] = ' position: \''.$position.'\',';
$o[] = ' textErr: \''.Text::_('COM_PHOCAMAPS_SEARCH_LOCATION_NOT_FOUND').'\',';
$o[] = ' textCancel: \''.Text::_('COM_PHOCAMAPS_SEARCH_CANCEL').'\',';
$o[] = ' textPlaceholder: \''.Text::_('COM_PHOCAMAPS_SEARCH_SEARCH').'\',';
if ($markerId != '') {
$o[] = ' moveToLocation: function(latlng, title, map) {';
$o[] = ' map'.$this->name.$this->id.'.setView(latlng, 7);';// set the zoom first so it will be added to form input
$o[] = ' phmInputMarker(latlng.lat, latlng.lng);';
$o[] = ' phmMoveMarker(marker'.$markerId.', latlng.lat, latlng.lng);';
$o[] = ' }';
}
$o[] = '}));';
$this->output[] = implode("\n", $o);
return true;
}
public function renderFullScreenControl() {
if ($this->fullscreen == 0) {
return false;
}
$o = array();
$o[] = 'map'.$this->name.$this->id.'.addControl(';
$o[] = ' new L.Control.Fullscreen({';
$o[] = ' position: \'topright\',';
$o[] = ' title: {';
$o[] = ' \'false\': \''.Text::_('COM_PHOCAMAPS_VIEW_FULLSCREEN').'\',';
$o[] = ' \'true\': \''.Text::_('COM_PHOCAMAPS_EXIT_FULLSCREEN').'\'';
$o[] = ' }';
$o[] = ' })';
$o[] = ')';
$this->output[] = implode("\n", $o);
return true;
}
public function renderCurrentPosition($markerId = '') {
if ($this->currentposition == 0) {
return false;
}
$o = array();
$o[] = 'L.control.locate({';
$o[] = ' position: \'topright\',';
$o[] = ' strings: {';
$o[] = ' \'title\': \''.Text::_('COM_PHOCAMAPS_CURRENT_POSITION').'\'';
$o[] = ' },';
$o[] = ' locateOptions: {';
$o[] = ' enableHighAccuracy: true,';
$o[] = ' watch: true,';
$o[] = ' },';
/*if ($markerId != '') {
$o[] = ' onlocationfound: function(latlng, title, map) {';
$o[] = ' map'.$this->name.$this->id.'.setView(latlng, 7);';// set the zoom first so it will be added to form input
$o[] = ' phmInputMarker(latlng.lat, latlng.lng);';
$o[] = ' phmMoveMarker(marker'.$markerId.', latlng.lat, latlng.lng);';
$o[] = ' }';
}*/
$o[] = '}).addTo(map'.$this->name.$this->id.');';
if ($markerId != '') {
$o[] = ' map' . $this->name . $this->id . '.on("locationfound", function(e) {';
//$o[] = ' map'.$this->name.$this->id.'.setView(e.latlng, 7);';// set the zoom first so it will be added to form input
$o[] = ' phmInputMarker(e.latitude, e.longitude);';
$o[] = ' phmMoveMarker(marker' . $markerId . ', e.latitude, e.longitude);';
$o[] = ' });';
}
$this->output[] = implode("\n", $o);
return true;
}
public function renderEasyPrint() {
if ($this->easyprint == 0) {
return false;
}
$o = array();
$o[] = 'map'.$this->name.$this->id.'.addControl(';
$o[] = ' new L.easyPrint({';
$o[] = ' hideControlContainer: true,';
$o[] = ' sizeModes: [\'Current\', \'A4Portrait\', \'A4Landscape\'],';
$o[] = ' position: \'topleft\',';
$o[] = ' exportOnly: true';
$o[] = ' })';
$o[] = ');';
$this->output[] = implode("\n", $o);
return true;
}
public function renderRouting($latFrom = 0, $lngFrom = 0, $latTo = 0, $lngTo = 0, $markerId = '', $markerIconOptions = array(), $language = '') {
if ($this->router == 0) {
return false;
}
$o = array();
if ($this->routerserviceurl == '' && $this->maprouterapikey == '') {
$o[] = 'console.log(\'Routing Error: No router or service url set\')';
$this->output[] = implode("\n", $o);
return true;
}
$o[] = 'var routingControl = L.Routing.control({';
$o[] = ' waypoints: [';
if ($latFrom == 0 && $lngFrom == 0 && $latTo != 0 && $lngTo != 0) {
$o[] = ' L.latLng(\'\'),';
} else if ($latFrom == 0 && $lngFrom == 0) {
$o[] = ' L.latLng(\'\'),';
} else {
$o[] = ' L.latLng('.PhocaMapsHelper::filterValue($latFrom, 'number2').', '.PhocaMapsHelper::filterValue($lngFrom, 'number2').'),';
}
if ($latTo == 0 && $lngTo == 0) {
$o[] = ' L.latLng(\'\'),';
} else {
$o[] = ' L.latLng('.PhocaMapsHelper::filterValue($latTo, 'number2').', '.PhocaMapsHelper::filterValue($lngTo, 'number2').')';
}
$o[] = ' ],';
if ($language != '') {
$o[] = ' language: \''.PhocaMapsHelper::filterValue($language, 'text').'\',';
}
if ($markerId != '') {
//$o[] = ' marker: marker'.$markerId.',';
// Don't create new marker for routing (so if we have "TO" address with marker created in map
// don't display any marker
//if (!empty($markerIconOptions)) {
if ($latTo != 0 && $lngTo != 0) {
$o[] = ' createMarker: function(i,wp, n) {';
$o[] = ' var latToMarker = '.PhocaMapsHelper::filterValue($latTo, 'number2').';';
$o[] = ' var lngToMarker = '.PhocaMapsHelper::filterValue($lngTo, 'number2').';';
$o[] = ' if (wp.latLng.lat == latToMarker && wp.latLng.lng == lngToMarker) {';
$o[] = ' return false;';
$o[] = ' } else {';
// Get the same icon as the "To" (End) has
if (!empty($markerIconOptions)) {
$o[] = ' var ma = L.marker(wp.latLng);';
$o[] = ' var ic = new L.AwesomeMarkers.icon({';
foreach($markerIconOptions as $k => $v) {
// Change the icon to circle (e.g. the "To" (End) is set to home, so don't render the same icon for "From" (start) address
if (strpos($v, 'icon:') !== false) {
$v = 'icon: "circle",';
}
$o[] = ' '.$v. "\n";
}
$o[] = ' });';
$o[] = ' ma.setIcon(ic);';
$o[] = ' return ma;';
} else {
$o[] = ' return L.marker(wp.latLng);';
}
$o[] = ' }';
$o[] = ' },';
}
}
$o[] = ' routeWhileDragging: true,';
$o[] = ' geocoder: L.Control.Geocoder.nominatim(),';
$o[] = ' reverseWaypoints: true,';
$o[] = ' showAlternatives: true,';
$o[] = ' collapsible: true,';
$o[] = ' show: false,';
/*
if ($this->routerserviceurl == 'https://api.mapbox.com/directions/v5') {
// DEBUG DEMO - default address of leaflet-routing-machine to debug
} else if ($this->routerserviceurl != '') {
$o[] = ' routerserviceurl: \''.$this->routerserviceurl.'\',';
} else if ($this->osm_map_type == 'mapbox' && $this->maprouterapikey != '') {
$o[] = ' router: L.Routing.mapbox(\''.PhocaMapsHelper::filterValue($this->maprouterapikey).'\'),';
} else {
$o[] = array();
$o[] = 'console.log(\'Routing Error: No router or service url set\')';
$this->output[] = implode("\n", $o);
return true;
}*/
if ($this->routerserviceurl == 'https://api.mapbox.com/directions/v5') {
// DEBUG DEMO - default address of leaflet-routing-machine to debug
} else if ($this->routerserviceurl != '' && $this->maprouterapikey != '' && $this->osmmaproutertype == 'mapbox'){
$o[] = ' routerserviceurl: \''.$this->routerserviceurl.'\',';
$o[] = ' router: L.Routing.mapbox(\''.PhocaMapsHelper::filterValue($this->maprouterapikey).'\',{language: \''.PhocaMapsHelper::filterValue($language, 'text').'\'}),';
} else if ($this->routerserviceurl != '') {
$o[] = ' routerserviceurl: \''.$this->routerserviceurl.'\',';
}
/* else if ($this->osm_map_type == 'mapbox' && $this->maprouterapikey != '') {
$o[] = ' router: L.Routing.mapbox(\''.PhocaMapsHelper::filterValue($this->maprouterapikey).'\'),';
}*/
else {
$o[] = array();
$o[] = 'console.log(\'Routing Error: No router or service url set\')';
$this->output[] = implode("\n", $o);
return true;
}
/*
if ($this->routerserviceurl == 'https://api.mapbox.com/directions/v5') {
// DEBUG DEMO - default address of leaflet-routing-machine to debug
} else if ($this->osm_map_type == 'mapbox' && $this->maprouterapikey != '' && $this->routerserviceurl != '') {
$o[] = ' routerserviceurl: \''.$this->routerserviceurl.'\',';
//$o[] = ' router: L.Routing.mapbox(\''.PhocaMapsHelper::filterValue($this->maprouterapikey).'\'),';
$o[] = ' router: L.Routing.mapbox(\''.PhocaMapsHelper::filterValue($this->maprouterapikey).'\',{language: \''.PhocaMapsHelper::filterValue($language, 'text').'\'}),';
} else if ($this->osm_map_type == 'mapbox' && $this->maprouterapikey != '') {
$o[] = ' router: L.Routing.mapbox(\''.PhocaMapsHelper::filterValue($this->maprouterapikey).'\'),';
} else if ($this->routerserviceurl != '') {
$o[] = ' routerserviceurl: \''.$this->routerserviceurl.'\',';
} else {
$o[] = array();
$o[] = 'console.log(\'Routing Error: No router or service url set\')';
$this->output[] = implode("\n", $o);
return true;
}
*/
if ($this->routerprofile != '') {
$o[] = ' profile: \''.PhocaMapsHelper::filterValue($this->routerprofile).'\',';
}
$o[] = '})';
// $o[] = '.on(\'routingstart\', showSpinner)';
//$o[] = '.on(\'routesfound routingerror\', hideSpinner)';
$o[] = '.addTo(map'.$this->name.$this->id.');';
//$o[] = 'routingControl.hide();';
$this->output[] = implode("\n", $o);
return true;
}
/**
* @param unknown $filename - url of gpx/kml file to load
* @param string $color - optional hex colour value for track (default to blue)
* @param boolean $fitbounds - if true adjust the map centre and zoom to fit the track
* @return boolean
* @desc renderTrack() adds a gpx or kml filename layer
* @author RogerCO added 22/6/2021 for v3.0.12
*/
public function renderTrack($filename, $color = '', $fitbounds = false) {
$ext = parse_url($filename)['path'];
//check we have a gpx or kml file (mime type not defined for these so use extension)
$ext = substr($ext,strrpos($ext,'.'));
if (($ext != '.gpx') && ($ext != '.kml')) {
return false;
}
$mapname = 'map'.$this->name.$this->id;
// colour layer doesn't seem to work for kml files
if (($ext=='.gpx') && $color) {
$this->output[] = " var customLayer = L.geoJson(null, { style: function(feature) {return {color: '".$color."'}; } });";
} else {
$this->output[] = "var customLayer = null;";
}
if ($fitbounds) {
$this->output[] = "var runLayer = omnivore".$ext."('".$filename."', null, customLayer).on('ready', function() {
".$mapname.".fitBounds(runLayer.getBounds());
}).addTo(".$mapname.")";
} else {
$this->output[] = "omnivore".$ext."('".$filename."', null, customLayer).addTo(".$mapname.")";
}
return true;
}
public function renderMap() {
$o = array();
$o[] = 'jQuery(document).ready(function() {';
$o[] = implode("\n", $this->output);
$o[] = '})';
Factory::getDocument()->addScriptDeclaration(implode("\n", $o));
}
}
?>

View File

@ -0,0 +1,31 @@
<?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\Factory;
use Joomla\CMS\Object\CMSObject;
class PhocaMapsMapsHelper
{
public static function getActions($t, $id = 0) {
$user = Factory::getUser();
$result = new CMSObject;
if (empty($id)) {
$assetName = $t['o'];
} else {
$assetName = $t['o'].'.'.$t['tasks'].'.'.(int) $id;
}
$actions = array('core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete');
foreach ($actions as $action) {
$result->set($action, $user->authorise($action, $assetName));
}
return $result;
}
}
?>

View File

@ -0,0 +1,31 @@
<?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\Factory;
use Joomla\CMS\Object\CMSObject;
class PhocaMapsMarkersHelper
{
public static function getActions($t, $id = 0) {
$user = Factory::getUser();
$result = new CMSObject;
if (empty($id)) {
$assetName = $t['o'];
} else {
$assetName = $t['o'].'.'.$t['tasks'].'.'.(int) $id;
}
$actions = array('core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete');
foreach ($actions as $action) {
$result->set($action, $user->authorise($action, $assetName));
}
return $result;
}
}
?>

View File

@ -0,0 +1,36 @@
<?php
/*
* @package Joomla 3.8
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*
* @component Phoca Gallery
* @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\Object\CMSObject;
use Joomla\CMS\Uri\Uri;
class PhocaMapsPath extends CMSObject
{
function __construct() {}
public static function getInstance() {
static $instance;
if (!$instance) {
$instance = new PhocaMapsPath();
$instance->kml_abs = JPATH_ROOT . '/phocamapskml/';
$instance->kml_rel = Uri::base(true) . '/phocamapskml/';
$instance->kml_rel_full = Uri::base() . 'phocamapskml/';
}
return $instance;
}
public static function getPath() {
$instance = PhocaMapsPath::getInstance();
return $instance;
}
}
?>

View File

@ -0,0 +1,107 @@
<?php
/*
* @package Joomla 3.8
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*
* @component Phoca Component
* @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\HTML\HTMLHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
class PhocaMapsRenderAdmin
{
public static function quickIconButton( $link, $image, $text, $imgUrl ) {
return '<div class="thumbnails ph-icon">'
.'<a class="thumbnail ph-icon-inside" href="'.$link.'">'
.HTMLHelper::_('image', $imgUrl . $image, $text )
.'<br /><span>'.$text.'</span></a></div>'. "\n";
}
public static function getLinks() {
$app = Factory::getApplication();
$option = $app->input->get('option');
$oT = strtoupper($option);
$links = array();
switch ($option) {
case 'com_phocamaps':
$links[] = array('Phoca Maps site', 'https://www.phoca.cz/phocamaps');
$links[] = array('Phoca Maps documentation site', 'https://www.phoca.cz/documentation/category/53-phoca-maps-component');
$links[] = array('Phoca Maps download site', 'https://www.phoca.cz/download/category/81-phoca-maps');
break;
}
$links[] = array('Phoca News', 'https://www.phoca.cz/news');
$links[] = array('Phoca Forum', 'https://www.phoca.cz/forum');
$components = array();
$components[] = array('Phoca Gallery','phocagallery', 'pg');
$components[] = array('Phoca Guestbook','phocaguestbook', 'pgb');
$components[] = array('Phoca Download','phocadownload', 'pd');
$components[] = array('Phoca Documentation','phocadocumentation', 'pdc');
$components[] = array('Phoca Favicon','phocafavicon', 'pfv');
$components[] = array('Phoca SEF','phocasef', 'psef');
$components[] = array('Phoca PDF','phocapdf', 'ppdf');
$components[] = array('Phoca Restaurant Menu','phocamenu', 'prm');
$components[] = array('Phoca Maps','phocamaps', 'pm');
$components[] = array('Phoca Font','phocafont', 'pf');
$components[] = array('Phoca Email','phocaemail', 'pe');
$components[] = array('Phoca Install','phocainstall', 'pi');
$components[] = array('Phoca Template','phocatemplate', 'pt');
$components[] = array('Phoca Panorama','phocapanorama', 'pp');
$components[] = array('Phoca Commander','phocacommander', 'pcm');
$components[] = array('Phoca Photo','phocaphoto', 'pcm');
$banners = array();
$banners[] = array('Phoca Restaurant Menu','phocamenu', 'prm');
$banners[] = array('Phoca Cart','phocacart', 'pc');
$o = '';
$o .= '<p>&nbsp;</p>';
$o .= '<h4 style="margin-bottom:5px;">'.Text::_($oT.'_USEFUL_LINKS'). '</h4>';
$o .= '<ul>';
foreach ($links as $k => $v) {
$o .= '<li><a style="text-decoration:underline" href="'.$v[1].'" target="_blank">'.$v[0].'</a></li>';
}
$o .= '</ul>';
$o .= '<div>';
$o .= '<p>&nbsp;</p>';
$o .= '<h4 style="margin-bottom:5px;">'.Text::_($oT.'_USEFUL_TIPS'). '</h4>';
$m = mt_rand(0, 10);
if ((int)$m > 3) {
$o .= '<div>';
$num = range(0,(count($components) - 1 ));
shuffle($num);
for ($i = 0; $i<3; $i++) {
$numO = $num[$i];
$o .= '<div style="float:left;width:33%;margin:0 auto;">';
$o .= '<div><a style="text-decoration:underline;" href="https://www.phoca.cz/'.$components[$numO][1].'" target="_blank">'.HtmlHelper::_('image', 'media/'.$option.'/images/administrator/icon-box-'.$components[$numO][2].'.png', ''). '</a></div>';
$o .= '<div style="margin-top:-10px;"><small><a style="text-decoration:underline;" href="https://www.phoca.cz/'.$components[$numO][1].'" target="_blank">'.$components[$numO][0].'</a></small></div>';
$o .= '</div>';
}
$o .= '<div style="clear:both"></div>';
$o .= '</div>';
} else {
$num = range(0,(count($banners) - 1 ));
shuffle($num);
$numO = $num[0];
$o .= '<div><a href="https://www.phoca.cz/'.$banners[$numO][1].'" target="_blank">'.HTMLHelper::_('image', 'media/'.$option.'/images/administrator/b-'.$banners[$numO][2].'.png', ''). '</a></div>';
}
$o .= '<p>&nbsp;</p>';
$o .= '<h4 style="margin-bottom:5px;">'.Text::_($oT.'_PLEASE_READ'). '</h4>';
$o .= '<div><a style="text-decoration:underline" href="https://www.phoca.cz/phoca-needs-your-help/" target="_blank">'.Text::_($oT.'_PHOCA_NEEDS_YOUR_HELP'). '</a></div>';
$o .= '</div>';
return $o;
}
}

View File

@ -0,0 +1,31 @@
<?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;
class PhocaMapsUtils
{
public static function setVars( $task = '') {
$a = array();
$app = Factory::getApplication();
$a['o'] = htmlspecialchars(strip_tags($app->input->get('option')));
$a['c'] = str_replace('com_', '', $a['o']);
$a['n'] = 'Phoca' . ucfirst(str_replace('com_phoca', '', $a['o']));
$a['l'] = strtoupper($a['o']);
$a['i'] = 'media/'.$a['o'].'/images/administrator/';
$a['ja'] = 'media/'.$a['o'].'/js/administrator/';
$a['jf'] = 'media/'.$a['o'].'/js/';
$a['s'] = 'media/'.$a['o'].'/css/administrator/'.$a['c'].'.css';
$a['css'] = 'media/'.$a['o'].'/css/';
$a['task'] = $a['c'] . htmlspecialchars(strip_tags($task));
$a['tasks'] = $a['task']. 's';
return $a;
}
}
?>

View File

@ -0,0 +1,37 @@
<?php
/**
* @package Phoca Gallery
* @author Jan Pavelka - https://www.phoca.cz
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
* @cms Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*/
defined( '_JEXEC' ) or die( 'Restricted access' );
use Joomla\CMS\Session\Session;
use Phoca\Render\Adminview;
use Joomla\CMS\Factory;
use Joomla\CMS\Version;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Language\Text;
class PhocaMapsRenderAdminView extends AdminView
{
public $view = '';
public $viewtype = 2;
public $option = '';
public $optionLang = '';
public $compatible = false;
public $sidebar = true;
protected $document = false;
public function __construct(){
parent::__construct();
}
}
?>

View File

@ -0,0 +1,47 @@
<?php
/**
* @package Phoca Download
* @author Jan Pavelka - https://www.phoca.cz
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
* @cms Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*/
defined( '_JEXEC' ) or die( 'Restricted access' );
use Joomla\CMS\Version;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Uri\Uri;
// Frontend editor - button plugin
require_once JPATH_ADMINISTRATOR . '/components/com_phocamaps/libraries/autoloadPhoca.php';
use Phoca\Render\Adminviews;
class PhocaMapsRenderAdminViews extends AdminViews
{
public $view = '';
public $viewtype = 1;
public $option = '';
public $optionLang = '';
public $tmpl = '';
public $compatible = false;
public $sidebar = true;
protected $document = false;
public function __construct() {
parent::__construct();
}
}
?>

View File

@ -0,0 +1,33 @@
<?php
/**
* @package Phoca Maps
* @author Jan Pavelka - https://www.phoca.cz
* @copyright Copyright (C) Jan Pavelka https://www.phoca.cz
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 and later
* @cms Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die();
use Joomla\CMS\Component\Router\Rules\MenuRules;
use Joomla\Registry\Registry;
class PhocaMapsRouterrules extends MenuRules
{
public function preprocess(&$query)
{
parent::preprocess($query);
}
protected function buildLookup($language = '*')
{
parent::buildLookup($language);
}
}