| Current Path : /home/zieirix/www/plugins/system/jaosmap/assets/elements/ |
| Current File : /home/zieirix/www/plugins/system/jaosmap/assets/elements/jamap.php |
<?php
/**
* ------------------------------------------------------------------------
* JA Open Street Map
* ------------------------------------------------------------------------
* Copyright (C) 2004-2018 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
* @license - Copyrighted Commercial Software
* Author: J.O.O.M Solutions Co., Ltd
* Websites: http://www.joomlart.com - http://www.joomlancers.com
* This file may not be redistributed in whole or significant part.
* ------------------------------------------------------------------------
*/
// Ensure this file is being included by a parent file
defined('_JEXEC') or die('Restricted access');
jimport('joomla.form.formfield');
/**
*
* JA Fetch for Map
* @author JoomlArt
*
*/
class JFormFieldJamap extends JFormField
{
/**
* Element name
*
* @access protected
* @var string
*/
var $_type = 'Jamap';
/**
*
* Construction Fetch
*/
function getInput()
{
$func = (string) $this->element['function'];
if(!$func) {
$func = 'mapkey';
}
if(method_exists($this, $func)) {
return call_user_func_array(array($this, $func), array());
}
return null;
}
/**
* return - map_key, function="@map_key"
*/
function mapkey()
{
//popup
JHtml::_('JABehavior.jquery');
JHtml::_('behavior.modal');
JHtml::_('jquery.framework');
$doc = JFactory::getDocument();
$doc->addScriptOptions('jaosmap', array('juri_root' => JUri::root()));
$doc->addStyleSheet(Juri::root() . 'plugins/system/jaosmap/assets/leaflet/leaflet.css');
$doc->addScript(Juri::root() . 'plugins/system/jaosmap/assets/leaflet/leaflet.js');
$doc->addStyleSheet(Juri::root() . 'plugins/system/jaosmap/assets/leaflet-routing-machine/leaflet-routing-machine.css');
$doc->addScript(Juri::root() . 'plugins/system/jaosmap/assets/leaflet-routing-machine/leaflet-routing-machine.min.js');
$doc->addStyleSheet(Juri::root() . 'plugins/system/jaosmap/assets/tingle/tingle.min.css');
$doc->addScript(Juri::root() . 'plugins/system/jaosmap/assets/tingle/tingle.min.js');
$doc->addScript(JUri::root() . 'plugins/system/jaosmap/assets/jaosmap.js');
$path = JUri::root(true).'/plugins/system/jaosmap/assets/';
$doc->addStyleSheet($path . 'style.css?v=1');
$doc->addScript($path . 'jagencode.js?v=1');
return '';
}
/**
* return - map_code, function="map_code"
*/
function mapcode()
{
$paramname = $this->name;
if (version_compare(JVERSION, '4.0', 'ge'))
$id = 'jform_params_code_container';
else
$id = $this->name;
$cols = (isset($this->element['cols']) && $this->element['cols'] != '') ? 'cols="' . intval($this->element['cols']) . '"' : '';
$rows = (isset($this->element['rows']) && $this->element['rows'] != '') ? 'rows="' . intval($this->element['rows']) . '"' : '';
$value = $this->value ? $this->value : (string) $this->element['default'];
$html = "";
$html .= "\n\t<div>";
$html .= "\n\t<a name=\"mapPreview\"></a>";
$html .= "\n\t<textarea name=\"{$paramname}\" id=\"{$id}\" style=\"width:100%; max-width:650px; height: 100px;\" >{$value}</textarea><br />";
$html .= "\n\t" . '<a href="javascript:;" onclick="CopyToClipboard(\'' . $id . '\');">' . JText::_('SELECT_ALL') . '</a>';
$html .= "\n\t" . ' | ';
$html .= "\n\t" . '<a id="jaMapPreview" href="#mapPreview" >' . JText::_('PREVIEW_MAP') . '</a>';
$html .= '<div id="map-preview-container"></div>';
$html .= '</div>';
if (version_compare(JVERSION, '4.0', 'ge')) {
$html .= '
<!-- Modal -->
<div class="modal fade" id="previewModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body" id="previewBody">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>';
}
return $html;
}
}