| Server IP : 54.36.91.62 / Your IP : 216.73.217.112 Web Server : Apache System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : coopiak ( 151928) PHP Version : 8.3.23 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/coopiak/dansnotreville-fr/plugins/system/nrframework/NRFramework/Widgets/ |
Upload File : |
<?php
/**
* @author Tassos Marinos <info@tassos.gr>
* @link https://www.tassos.gr
* @copyright Copyright © 2023 Tassos All Rights Reserved
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
*/
namespace NRFramework\Widgets;
defined('_JEXEC') or die;
class MapEditor extends OpenStreetMap
{
/**
* Widget default options
*
* @var array
*/
protected $_widget_options = [
// Whether autocomplete is enabled for the address field
'autocomplete' => false,
// Whether to show the map
'show_map' => true,
/**
* Set whether & where to display the address input.
*
* Available values:
* - before_map: Show it before the map
* - true/after_map: Show it after the map
* - false: Hide the address field
*/
'show_address' => 'after_map',
// The address value
'address' => '',
/**
* Markers
*/
// Show the markers list
'show_markers_list' => false,
// Max markers allowed
'max_markers' => 1
];
public function __construct($options = [])
{
$this->widget_options = array_merge($this->widget_options, $this->_widget_options);
parent::__construct($options);
$this->prepare();
}
private function prepare()
{
// We do not show the map
if (!$this->options['show_map'])
{
$this->options['css_class'] .= ' no-map';
}
// Hide "Clear" button if no markers exists
if (empty($this->options['markers']))
{
$this->options['css_class'] .= ' clear-is-hidden';
}
if ((!$this->options['pro'] && count($this->options['markers']) >= 1) || ($this->options['max_markers'] !== 0 && count($this->options['markers']) >= $this->options['max_markers']))
{
$this->options['css_class'] .= ' markers-limit-reached';
}
\JText::script('NR_ARE_YOU_SURE_YOU_WANT_TO_DELETE_ALL_MARKERS');
\JText::script('NR_ARE_YOU_SURE_YOU_WANT_TO_DELETE_THIS_MARKER');
\JText::script('NR_ADD_MARKER');
\JText::script('NR_EDIT_MARKER');
\JText::script('NR_DELETE_MARKER');
\JText::script('NR_UNKNOWN_LOCATION');
}
/**
* Loads media files
*
* @return void
*/
public function loadMedia()
{
if ($this->options['show_map'])
{
parent::loadMedia();
\JHtml::stylesheet('plg_system_nrframework/vendor/leaflet.contextmenu.min.css', ['relative' => true, 'version' => 'auto']);
\JHtml::script('plg_system_nrframework/vendor/leaflet.contextmenu.min.js', ['relative' => true, 'version' => 'auto']);
}
\JHtml::stylesheet('plg_system_nrframework/widgets/mapeditor.css', ['relative' => true, 'version' => 'auto']);
\JHtml::script('plg_system_nrframework/widgets/mapeditor.js', ['relative' => true, 'version' => 'auto']);
}
}