primo commit
This commit is contained in:
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@ -0,0 +1,57 @@
|
||||
<?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_BASE') or die;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Form\FormField;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
jimport('joomla.html.html');
|
||||
jimport('joomla.form.formfield');
|
||||
|
||||
class JFormFieldPhocaHead extends FormField
|
||||
{
|
||||
protected $type = 'PhocaHead';
|
||||
protected function getLabel() { return '';}
|
||||
|
||||
protected function getInput() {
|
||||
|
||||
$app = Factory::getApplication();
|
||||
$wa = $app->getDocument()->getWebAssetManager();
|
||||
$option = 'com_phocamaps';
|
||||
$wa->registerAndUseStyle($option . '.options', 'media/' .$option . '/css/administrator/phocamapsoptions.css', array('version' => 'auto'));
|
||||
$wa->registerAndUseStyle($option . '.theme', 'media/' .$option . '/css/administrator/theme-dark.css', array('version' => 'auto'), [], ['template.active']);
|
||||
|
||||
//echo '<div style="clear:both;"></div>';
|
||||
$phocaImage = ( (string)$this->element['phocaimage'] ? $this->element['phocaimage'] : '' );
|
||||
$image = '';
|
||||
|
||||
if ($phocaImage != ''){
|
||||
$image = HTMLHelper::_('image', 'media/com_phocagallery/images/administrator/'. $phocaImage, '' );
|
||||
}
|
||||
|
||||
if ($this->element['default']) {
|
||||
if ($image != '') {
|
||||
return '<div class="ph-options-head">'
|
||||
.'<div>'. $image.' <strong>'. Text::_($this->element['default']) . '</strong></div>'
|
||||
.'</div>';
|
||||
} else {
|
||||
return '<div class="ph-options-head">'
|
||||
.'<strong>'. Text::_($this->element['default']) . '</strong>'
|
||||
.'</div>';
|
||||
}
|
||||
} else {
|
||||
return parent::getLabel();
|
||||
}
|
||||
//echo '<div style="clear:both;"></div>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,47 @@
|
||||
<?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\Form\FormField;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
|
||||
|
||||
class JFormFieldPhocaMapsMap extends FormField
|
||||
{
|
||||
protected $type = 'PhocaMapsMap';
|
||||
|
||||
protected function getInput() {
|
||||
|
||||
$db = Factory::getDBO();
|
||||
|
||||
$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 );
|
||||
$items = $db->loadObjectList();
|
||||
|
||||
$attr = '';
|
||||
$attr .= $this->required ? ' required aria-required="true"' : '';
|
||||
$attr .= $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';
|
||||
$attr .= $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : 'class="form-select"';
|
||||
|
||||
|
||||
|
||||
array_unshift($items, HTMLHelper::_('select.option', '', '- '.Text::_('COM_PHOCAMAPS_SELECT_MAP').' -', 'value', 'text'));
|
||||
|
||||
return HTMLHelper::_('select.genericlist', $items, $this->name, trim($attr), 'value', 'text', $this->value, $this->id );
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,90 @@
|
||||
<?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_BASE') or die;
|
||||
use Joomla\CMS\Form\FormField;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
jimport('joomla.html.html');
|
||||
jimport('joomla.form.formfield');
|
||||
|
||||
class JFormFieldPhocaMapsOrdering extends FormField
|
||||
{
|
||||
|
||||
protected $type = 'PhocaMapsOrdering';
|
||||
|
||||
protected function getInput() {
|
||||
// Initialize variables.
|
||||
$html = array();
|
||||
$attr = '';
|
||||
|
||||
// Get some field values from the form.
|
||||
$id = (int) $this->form->getValue('id');
|
||||
|
||||
if ($this->element['table']) {
|
||||
switch (strtolower($this->element['table'])) {
|
||||
|
||||
case "marker":
|
||||
$whereLabel = 'catid';
|
||||
$whereValue = (int) $this->form->getValue('catid');
|
||||
$table = '#__phocamaps_marker';
|
||||
break;
|
||||
|
||||
default:
|
||||
case "map":
|
||||
$whereLabel = '';
|
||||
$whereValue = '';
|
||||
$table = '#__phocamaps_map';
|
||||
break;
|
||||
|
||||
case "icon":
|
||||
$whereLabel = '';
|
||||
$whereValue = '';
|
||||
$table = '#__phocamaps_icon';
|
||||
break;
|
||||
|
||||
}
|
||||
} else {
|
||||
$whereLabel = '';
|
||||
$whereValue = '';
|
||||
$table = '#__phocamaps_map';
|
||||
}
|
||||
|
||||
// Initialize some field attributes.
|
||||
$attr .= $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
|
||||
$attr .= ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
|
||||
$attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
|
||||
|
||||
// Initialize JavaScript field attributes.
|
||||
$attr .= $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';
|
||||
|
||||
|
||||
|
||||
// Build the query for the ordering list.
|
||||
$query = 'SELECT ordering AS value, title AS text' .
|
||||
' FROM ' . $table;
|
||||
if ($whereLabel != '' && $whereValue != '') {
|
||||
$query .= ' WHERE '.$whereLabel.' = ' . (int) $whereValue;
|
||||
}
|
||||
$query .= ' ORDER BY ordering';
|
||||
|
||||
// Create a read-only list (no name) with a hidden input to store the value.
|
||||
if ((string) $this->element['readonly'] == 'true') {
|
||||
$html[] = HTMLHelper::_('list.ordering', '', $query, trim($attr), $this->value, $id ? 0 : 1);
|
||||
$html[] = '<input type="hidden" name="'.$this->name.'" value="'.$this->value.'"/>';
|
||||
}
|
||||
// Create a regular list.
|
||||
else {
|
||||
$html[] = HTMLHelper::_('list.ordering', $this->name, $query, trim($attr), $this->value, $id ? 0 : 1);
|
||||
}
|
||||
|
||||
return implode($html);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,186 @@
|
||||
<?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_BASE') or die;
|
||||
use Joomla\CMS\Form\FormField;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Object\CMSObject;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
|
||||
jimport('joomla.html.html');
|
||||
jimport('joomla.form.formfield');
|
||||
|
||||
|
||||
class JFormFieldPhocaMapsRadio extends FormField
|
||||
{
|
||||
|
||||
protected $type = 'PhocaMapsRadio';
|
||||
|
||||
protected function getInput()
|
||||
{
|
||||
// Initialize variables.
|
||||
$html = array();
|
||||
|
||||
// Initialize some field attributes.
|
||||
$class = $this->element['class'] ? ' class="radio '.(string) $this->element['class'].'"' : ' class="radio"';
|
||||
|
||||
// Start the radio field output.
|
||||
$html[] = '<fieldset id="'.$this->id.'"'.$class.'>';
|
||||
|
||||
$design = ( (string)$this->element['typedesign'] ? $this->element['typedesign'] : 0 );
|
||||
if ($design == 1) {
|
||||
$options = $this->getOptionsDesign1();
|
||||
}
|
||||
if ($design == 2) {
|
||||
$options = $this->getOptionsDesign2();
|
||||
}
|
||||
|
||||
//$output .= '<input class="text_area" type="radio" name="'.$this->name.'" id="'.$this->id.'_id" value="'.(string) $option['value'].'" '.$checked.' />';
|
||||
|
||||
|
||||
|
||||
// Build the radio field output.
|
||||
|
||||
foreach ($options as $i => $option) {
|
||||
|
||||
// Initialize some option attributes.
|
||||
$checked = ((string) $option->value == (string) $this->value) ? ' checked="checked"' : '';
|
||||
$class = !empty($option->class) ? ' class="'.$option->class.'"' : '';
|
||||
$disabled = !empty($option->disable) ? ' disabled="disabled"' : '';
|
||||
|
||||
// Initialize some JavaScript option attributes.
|
||||
$onclick = !empty($option->onclick) ? ' onclick="'.$option->onclick.'"' : '';
|
||||
|
||||
$html[] = '<div class="form-check"><input class="form-check-input" type="radio" id="'.$this->id.$i.'" name="'.$this->name.'"' .
|
||||
' value="'.htmlspecialchars($option->value, ENT_COMPAT, 'UTF-8').'"'
|
||||
.$checked.$class.$onclick.$disabled.'/>';
|
||||
|
||||
$html[] = '<label class="form-check-label" for="'.$this->id.$i.'">'. Text::_($option->text). ' '.$option->img.'</label>';
|
||||
|
||||
$html[] = '</div>';
|
||||
|
||||
|
||||
|
||||
/*if ($design == 1) {
|
||||
$html[] = '<label for="'.$this->id.$i.'"'.$class.' style="width:auto">'. Text::_($option->text). '</label>'
|
||||
. '<div style="position:relative;float:left;width:30px;margin-left:5px">'.$option->img.'</div><div style="clear:both"></div>';
|
||||
|
||||
}
|
||||
if ($design == 2) {
|
||||
if($option->imgnr % 3 == 0) {
|
||||
$cssPart = '';
|
||||
$htmlPart = '<div style="clear:both"></div>';
|
||||
} else {
|
||||
$cssPart ='margin-right:10px;';
|
||||
$htmlPart = '<div style="clear:both"></div>';
|
||||
}
|
||||
|
||||
$html[] = '<label for="'.$this->id.$i.'" '.$class.' style="width:auto">'. Text::_($option->text). '</label>'
|
||||
. '<div style="position:relative;float:left;margin:0px;padding:0px;margin-left:5em;margin-top: -2em;'.$cssPart.'">'.$option->img.'</div></div>'. $htmlPart;
|
||||
}*/
|
||||
}
|
||||
|
||||
// End the radio field output.
|
||||
$html[] = '</fieldset>';
|
||||
|
||||
return implode($html);
|
||||
}
|
||||
|
||||
|
||||
protected function getOptionsDesign1()
|
||||
{
|
||||
$options = array();
|
||||
|
||||
foreach ($this->element->children() as $option) {
|
||||
|
||||
$tmp = new CMSObject();
|
||||
if ($option->getName() != 'option') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$tmp->value = (string) $option['value'];
|
||||
$tmp->text = trim((string) $option);
|
||||
|
||||
switch((int)$option['value']) {
|
||||
|
||||
case 1: $optName = 'grey'; break;
|
||||
case 2: $optName = 'grey'; break;//$optName = 'greywb';the same but other padding
|
||||
case 3: $optName = 'greyrc'; break;
|
||||
case 4: $optName = 'black'; break;
|
||||
default:
|
||||
case 0: $optName = 'none'; break;
|
||||
}
|
||||
|
||||
if ((int)$option['value'] == 0) {
|
||||
$tmp->img = '';
|
||||
} else {
|
||||
$tmp->img = HTMLHelper::_('image', 'components/com_phocamaps/assets/images/box-'.$optName.'-tl.png', '', array('style' => 'margin:0;padding:0'));
|
||||
}
|
||||
|
||||
//$tmp->class = (string) $option['class'];
|
||||
//$tmp->onclick = (string) $option['onclick'];
|
||||
$options[] = $tmp;
|
||||
}
|
||||
|
||||
reset($options);
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
protected function getOptionsDesign2()
|
||||
{
|
||||
$options = array();
|
||||
|
||||
$i = 1;
|
||||
foreach ($this->element->children() as $option) {
|
||||
|
||||
$tmp = new CMSObject();
|
||||
if ($option->getName() != 'option') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$tmp->value = (string) $option['value'];
|
||||
$tmp->text = trim((string) $option);
|
||||
|
||||
switch((int)$option['value']) {
|
||||
case 1: $optName = 'igrey'; break;
|
||||
case 2: $optName = 'iyellow'; break;
|
||||
case 3: $optName = 'ihome'; break;
|
||||
case 4: $optName = 'igreen'; break;
|
||||
case 5: $optName = 'istar'; break;
|
||||
case 6: $optName = 'iinfoh'; break;
|
||||
case 7: $optName = 'iinfoi'; break;
|
||||
case 8: $optName = 'iinfop'; break;
|
||||
case 9: $optName = 'iinfoph'; break;
|
||||
case 10:$optName = 'iinfoz'; break;
|
||||
default:
|
||||
case 0: $optName = 'default'; break;
|
||||
}
|
||||
|
||||
if ((int)$option['value'] == 0) {
|
||||
$tmp->img = '';
|
||||
$tmp->imgnr = 0;
|
||||
} else {
|
||||
$tmp->img = HTMLHelper::_('image', 'media/com_phocamaps/images/'.$optName.'/image.png', '', array('style' => 'margin:0;padding:0'));
|
||||
$tmp->imgnr = $i;
|
||||
$i++;
|
||||
}
|
||||
|
||||
//$tmp->class = (string) $option['class'];
|
||||
//$tmp->onclick = (string) $option['onclick'];
|
||||
$options[] = $tmp;
|
||||
}
|
||||
|
||||
reset($options);
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
<?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_BASE') or die;
|
||||
use Joomla\CMS\Form\FormField;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
jimport('joomla.form.formfield');
|
||||
|
||||
class JFormFieldPhocaSelectIcon extends FormField
|
||||
{
|
||||
public $type = 'PhocaSelectIcon';
|
||||
|
||||
protected function getInput() {
|
||||
|
||||
$db = Factory::getDBO();
|
||||
|
||||
$query = 'SELECT a.title AS text, a.id AS value'
|
||||
. ' FROM #__phocamaps_icon AS a'
|
||||
. ' WHERE a.published = 1'
|
||||
. ' ORDER BY a.ordering';
|
||||
|
||||
$db->setQuery( $query );
|
||||
$items = $db->loadObjectList();
|
||||
|
||||
array_unshift($items, HTMLHelper::_('select.option', '', '- '.Text::_('COM_PHOCAMAPS_SELECT_ICON').' -', 'value', 'text'));
|
||||
|
||||
return HTMLHelper::_('select.genericlist', $items, $this->name, 'class="form-select"', 'value', 'text', $this->value, $this->id );
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,134 @@
|
||||
<?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_BASE') or die;
|
||||
use Joomla\CMS\Form\FormField;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
jimport('joomla.form.formfield');
|
||||
|
||||
class JFormFieldPhocaSelectMap extends FormField
|
||||
{
|
||||
public $type = 'PhocaSelectMap';
|
||||
|
||||
protected function getInput()
|
||||
{
|
||||
// Initialize variables.
|
||||
$html = array();
|
||||
|
||||
// Initialize some field attributes.
|
||||
$size = $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
|
||||
$maxLength = $this->element['maxlength'] ? ' maxlength="'.(int) $this->element['maxlength'].'"' : '';
|
||||
$class = $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
|
||||
$readonly = ((string) $this->element['readonly'] == 'true') ? ' readonly="readonly"' : '';
|
||||
$disabled = ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
|
||||
|
||||
$maptype = ( (string)$this->element['maptype'] ? $this->element['maptype'] : '' );
|
||||
|
||||
if ($this->id == 'jform_latitude') {
|
||||
// One link for latitude, longitude, zoom
|
||||
$lat = $this->form->getValue('latitude');
|
||||
$lng = $this->form->getValue('longitude');
|
||||
$zoom = $this->form->getValue('zoom');
|
||||
$suffix = '';
|
||||
if ($lat != '') { $suffix .= '&lat='.$lat;}
|
||||
if ($lng != '') { $suffix .= '&lng='.$lng;}
|
||||
if ($zoom != '' && (int)$zoom > 0) { $suffix .= '&zoom='.$zoom;}
|
||||
if ($maptype != '') { $suffix .= '&type='.$maptype;}
|
||||
|
||||
$link = 'index.php?option=com_phocamaps&view=phocamapsgmap&tmpl=component&field='.$this->id. $suffix;
|
||||
|
||||
// Load the modal behavior script.
|
||||
//HTMLHelper::_('behavior.modal', 'a.modal_'.$this->id);
|
||||
|
||||
}
|
||||
|
||||
HTMLHelper::_('jquery.framework');
|
||||
// Initialize JavaScript field attributes.
|
||||
$onchange = (string) $this->element['onchange'];
|
||||
$onchangeOutput = ' onChange="'.(string) $this->element['onchange'].'"';
|
||||
|
||||
$idA = 'pgselectmap';
|
||||
|
||||
// Build the script.
|
||||
$script = array();
|
||||
$script[] = ' function phocaSelectMap_'.$this->id.'(title) {';
|
||||
$script[] = ' document.getElementById("'.$this->id.'_id").value = title;';
|
||||
$script[] = ' '.$onchange;
|
||||
|
||||
// BE AWARE don't close the window here, we are waiting for close button, not immediately closing
|
||||
//$script[] = ' jQuery(\'#'.$idA.'\').modal(\'toggle\');';
|
||||
|
||||
//$script[] = ' SqueezeBox.close();';
|
||||
$script[] = ' }';
|
||||
|
||||
|
||||
// Hide Info box on start
|
||||
if ($this->id == 'jform_latitude') {
|
||||
$script[] = ' jQuery(document).ready(function() {';
|
||||
$script[] = ' jQuery(\'#'.$idA.'\').on(\'shown.bs.modal\', function () {';
|
||||
$script[] = ' jQuery(\'#phmPopupInfo\').html(\'\');';
|
||||
$script[] = ' })';
|
||||
$script[] = ' })';
|
||||
}
|
||||
|
||||
|
||||
// Add the script to the document head.
|
||||
Factory::getDocument()->addScriptDeclaration(implode("\n", $script));
|
||||
|
||||
if ($this->id == 'jform_latitude') {
|
||||
/*$html[] = '<div class="input-append">';
|
||||
$html[] = '<input type="text" id="'.$this->id.'_id" name="'.$this->name.'" value="'. $this->value.'"' .
|
||||
' '.$class.$size.$disabled.$readonly.$onchangeOutput.$maxLength.' />';
|
||||
$html[] = '<a class="modal_'.$this->id.' btn" title="'.Text::_('COM_PHOCAMAPS_FORM_SELECT_COORDINATES').'"'
|
||||
.' href="'.($this->element['readonly'] ? '' : $link).'"'
|
||||
.' rel="{handler: \'iframe\', size: {x: 780, y: 580}}">'
|
||||
. Text::_('COM_PHOCAMAPS_FORM_SELECT_COORDINATES').'</a>';
|
||||
$html[] = '</div>'. "\n";*/
|
||||
|
||||
$html[] = '<div class="input-append input-group">';
|
||||
$html[] = '<span class="input-append input-group"><input type="text" id="' . $this->id . '_id" name="' . $this->name . '"'
|
||||
. ' value="' . $this->value . '" '.$class.$size.$disabled.$readonly.$onchangeOutput.$maxLength.' />';
|
||||
$html[] = '<a href="'.$link.'" role="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#'.$idA.'" title="' . Text::_('COM_PHOCAMAPS_FORM_SELECT_COORDINATES') . '">'
|
||||
. '<span class="icon-list icon-white"></span> '
|
||||
. Text::_('COM_PHOCAMAPS_FORM_SELECT_COORDINATES') . '</a></span>';
|
||||
$html[] = '</div>'. "\n";
|
||||
|
||||
$html[] = HTMLHelper::_(
|
||||
'bootstrap.renderModal',
|
||||
$idA,
|
||||
array(
|
||||
'url' => $link,
|
||||
'title' => Text::_('COM_PHOCAMAPS_FORM_SELECT_COORDINATES'),
|
||||
'width' => '',
|
||||
'height' => '',
|
||||
'modalWidth' => '80',
|
||||
'bodyHeight' => '80',
|
||||
'footer' => '<div id="phmPopupInfo" class="ph-info-modal"></div><button type="button" class="btn" data-bs-dismiss="modal" aria-hidden="true">'
|
||||
. Text::_('COM_PHOCAMAPS_CLOSE') . '</button>'
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
$html[] = '<div class="fltlft">';
|
||||
$html[] = ' <input type="text" id="'.$this->id.'_id" name="'.$this->name.'" value="'. $this->value.'"' .
|
||||
' '.$class.$size.$disabled.$readonly.$onchangeOutput.$maxLength.' />';
|
||||
$html[] = '</div>'. "\n";
|
||||
}
|
||||
|
||||
|
||||
return implode("\n", $html);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
<?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_BASE') or die;
|
||||
use Joomla\CMS\Form\FormField;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
jimport('joomla.form.formfield');
|
||||
|
||||
class JFormFieldPhocaTextWarning extends FormField
|
||||
{
|
||||
protected $type = 'PhocaTextWarning';
|
||||
|
||||
protected function getInput() {
|
||||
|
||||
|
||||
// Initialize some field attributes.
|
||||
$warning = ( (string)$this->element['warningtext'] ? $this->element['warningtext'] : '' );
|
||||
$size = $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
|
||||
$class = $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
|
||||
$maxLength = $this->element['maxlength'] ? ' maxlength="'.(int) $this->element['maxlength'].'"' : '';
|
||||
$readonly = ((string) $this->element['readonly'] == 'true') ? ' readonly="readonly"' : '';
|
||||
$disabled = ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
|
||||
// Initialize JavaScript field attributes.
|
||||
$onchange = $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';
|
||||
|
||||
$value = htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8');
|
||||
|
||||
|
||||
$html ='<input type="text" name="'.$this->name.'" id="'.$this->id.'" value="'.$value.'"'
|
||||
.$class.$size.$disabled.$readonly.$onchange.$maxLength.'/>';
|
||||
|
||||
if ($warning != '') {
|
||||
//$html .= '<div style="margin-left:10px;">'.HtmlHelper::_('image', 'administrator/components/com_phocamaps/assets/images/icon-16-warning.png', '' ) . '</div><div>' . JText::_($warning).'</div>';
|
||||
|
||||
$html .='<div style="position:relative;float:left;width:auto;margin-left:10px">'.HTMLHelper::_('image', 'administrator/components/com_phocamaps/assets/images/icon-16-warning.png', '',array('style' => 'margin:0;padding:0;margin-right:5px;') ).' '.Text::_($warning).'</div><div style="clear:both"></div>';
|
||||
}
|
||||
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
protected function getLabel() {
|
||||
echo '<div class="clearfix"></div>';
|
||||
return parent::getLabel();
|
||||
echo '<div class="clearfix"></div>';
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fieldset addfieldpath="/administrator/components/com_phocamaps/models/fields">
|
||||
<fields name="filter">
|
||||
|
||||
|
||||
<field name="search" type="text" inputmode="search" label="COM_PHOCAMAPS_SEARCH" description="COM_PHOCAMAPS_SEARCH" hint="JSEARCH_FILTER" />
|
||||
|
||||
<field name="published" type="list" label="JOPTION_FILTER_PUBLISHED" description="JOPTION_FILTER_PUBLISHED_DESC" onchange="this.form.submit();" >
|
||||
<option value="">JOPTION_SELECT_PUBLISHED</option>
|
||||
<option value="1">COM_PHOCAMAPS_PUBLISHED</option>
|
||||
<option value="0">COM_PHOCAMAPS_UNPUBLISHED</option>
|
||||
</field>
|
||||
|
||||
|
||||
<input type="hidden" name="form_submited" value="1"/>
|
||||
</fields>
|
||||
|
||||
<fields name="list">
|
||||
<field name="fullordering" type="list" label="COM_PHOCAMAPS_LIST_FULL_ORDERING" description="COM_PHOCAMAPS_LIST_FULL_ORDERING_DESC" onchange="this.form.submit();" default="a.title ASC" validate="options" >
|
||||
<option value="">JGLOBAL_SORT_BY</option>
|
||||
<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
|
||||
<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
|
||||
<option value="a.title ASC">JGLOBAL_TITLE_ASC</option>
|
||||
<option value="a.title DESC">JGLOBAL_TITLE_DESC</option>
|
||||
<option value="a.published ASC" >COM_PHOCAMAPS_PUBLISHED_ASC</option>
|
||||
<option value="a.published DESC" >COM_PHOCAMAPS_PUBLISHED_DESC</option>
|
||||
<option value="a.url ASC">COM_PHOCAMAPS_URL_ASC</option>
|
||||
<option value="a.url DESC">COM_PHOCAMAPS_URL_DESC</option>
|
||||
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
|
||||
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
|
||||
</field>
|
||||
|
||||
<field name="limit" type="limitbox" label="COM_PHOCAMAPS_LIST_LIMIT" description="COM_PHOCAMAPS_LIST_LIMIT_DESC" class="input-mini" default="25" onchange="this.form.submit();" />
|
||||
</fields>
|
||||
</fieldset>
|
||||
</form>
|
||||
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fieldset addfieldpath="/administrator/components/com_phocamaps/models/fields">
|
||||
<fields name="filter">
|
||||
|
||||
|
||||
<field name="search" type="text" inputmode="search" label="COM_PHOCAMAPS_SEARCH" description="COM_PHOCAMAPS_SEARCH" hint="JSEARCH_FILTER" />
|
||||
|
||||
<field name="published" type="list" label="JOPTION_FILTER_PUBLISHED" description="JOPTION_FILTER_PUBLISHED_DESC" onchange="this.form.submit();" >
|
||||
<option value="">JOPTION_SELECT_PUBLISHED</option>
|
||||
<option value="1">COM_PHOCAMAPS_PUBLISHED</option>
|
||||
<option value="0">COM_PHOCAMAPS_UNPUBLISHED</option>
|
||||
</field>
|
||||
|
||||
|
||||
<field name="language" type="contentlanguage" label="JOPTION_FILTER_LANGUAGE" description="JOPTION_FILTER_LANGUAGE_DESC" onchange="this.form.submit();">
|
||||
<option value="">JOPTION_SELECT_LANGUAGE</option>
|
||||
<option value="*">JALL</option>
|
||||
</field>
|
||||
|
||||
<input type="hidden" name="form_submited" value="1"/>
|
||||
</fields>
|
||||
|
||||
<fields name="list">
|
||||
<field name="fullordering" type="list" label="COM_PHOCAMAPS_LIST_FULL_ORDERING" description="COM_PHOCAMAPS_LIST_FULL_ORDERING_DESC" onchange="this.form.submit();" default="a.title ASC" validate="options" >
|
||||
<option value="">JGLOBAL_SORT_BY</option>
|
||||
<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
|
||||
<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
|
||||
<option value="a.title ASC">JGLOBAL_TITLE_ASC</option>
|
||||
<option value="a.title DESC">JGLOBAL_TITLE_DESC</option>
|
||||
<option value="a.published ASC" >COM_PHOCAMAPS_PUBLISHED_ASC</option>
|
||||
<option value="a.published DESC" >COM_PHOCAMAPS_PUBLISHED_DESC</option>
|
||||
<option value="a.language ASC">JGRID_HEADING_LANGUAGE_ASC</option>
|
||||
<option value="a.language DESC">JGRID_HEADING_LANGUAGE_DESC</option>
|
||||
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
|
||||
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
|
||||
</field>
|
||||
|
||||
<field name="limit" type="limitbox" label="COM_PHOCAMAPS_LIST_LIMIT" description="COM_PHOCAMAPS_LIST_LIMIT_DESC" class="input-mini" default="25" onchange="this.form.submit();" />
|
||||
</fields>
|
||||
</fieldset>
|
||||
</form>
|
||||
@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
<fieldset addfieldpath="/administrator/components/com_phocamaps/models/fields">
|
||||
<fields name="filter">
|
||||
|
||||
|
||||
<field name="search" type="text" inputmode="search" label="COM_PHOCAMAPS_SEARCH" description="COM_PHOCAMAPS_SEARCH" hint="JSEARCH_FILTER" />
|
||||
|
||||
<field name="published" type="list" label="JOPTION_FILTER_PUBLISHED" description="JOPTION_FILTER_PUBLISHED_DESC" onchange="this.form.submit();" >
|
||||
<option value="">JOPTION_SELECT_PUBLISHED</option>
|
||||
<option value="1">COM_PHOCAMAPS_PUBLISHED</option>
|
||||
<option value="0">COM_PHOCAMAPS_UNPUBLISHED</option>
|
||||
</field>
|
||||
|
||||
<field name="map_id" type="PhocaMapsMap" label="COM_PHOCAMAPS_FILTER_MAP_LABEL" description="COM_PHOCAMAPS_FILTER_MAP_DESC" onchange="this.form.submit();" />
|
||||
|
||||
|
||||
|
||||
<field name="language" type="contentlanguage" label="JOPTION_FILTER_LANGUAGE" description="JOPTION_FILTER_LANGUAGE_DESC" onchange="this.form.submit();">
|
||||
<option value="">JOPTION_SELECT_LANGUAGE</option>
|
||||
<option value="*">JALL</option>
|
||||
</field>
|
||||
|
||||
<input type="hidden" name="form_submited" value="1"/>
|
||||
</fields>
|
||||
|
||||
<fields name="list">
|
||||
<field name="fullordering" type="list" label="COM_PHOCAMAPS_LIST_FULL_ORDERING" description="COM_PHOCAMAPS_LIST_FULL_ORDERING_DESC" onchange="this.form.submit();" default="a.title ASC" validate="options" >
|
||||
<option value="">JGLOBAL_SORT_BY</option>
|
||||
<option value="a.ordering ASC">JGRID_HEADING_ORDERING_ASC</option>
|
||||
<option value="a.ordering DESC">JGRID_HEADING_ORDERING_DESC</option>
|
||||
<option value="a.title ASC">JGLOBAL_TITLE_ASC</option>
|
||||
<option value="a.title DESC">JGLOBAL_TITLE_DESC</option>
|
||||
<option value="a.catid ASC" >COM_PHOCAMAPS_MAP_ASC</option>
|
||||
<option value="a.catid DESC" >COM_PHOCAMAPS_MAP_DESC</option>
|
||||
<option value="a.published ASC" >COM_PHOCAMAPS_PUBLISHED_ASC</option>
|
||||
<option value="a.published DESC" >COM_PHOCAMAPS_PUBLISHED_DESC</option>
|
||||
<option value="a.language ASC">JGRID_HEADING_LANGUAGE_ASC</option>
|
||||
<option value="a.language DESC">JGRID_HEADING_LANGUAGE_DESC</option>
|
||||
<option value="a.id ASC">JGRID_HEADING_ID_ASC</option>
|
||||
<option value="a.id DESC">JGRID_HEADING_ID_DESC</option>
|
||||
</field>
|
||||
|
||||
<field name="limit" type="limitbox" label="COM_PHOCAMAPS_LIST_LIMIT" description="COM_PHOCAMAPS_LIST_LIMIT_DESC" class="input-mini" default="25" onchange="this.form.submit();" />
|
||||
</fields>
|
||||
</fieldset>
|
||||
</form>
|
||||
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
|
||||
<fieldset addfieldpath="/administrator/components/com_phocamaps/models/fields">
|
||||
|
||||
<field name="id" type="text" default="0" label="JGLOBAL_FIELD_ID_LABEL" required="true" readonly="true" class="readonly" />
|
||||
|
||||
<field name="title" type="text" class="form-control" size="40" label="COM_PHOCAMAPS_FIELD_TITLE_LABEL" description="COM_PHOCAMAPS_FIELD_TITLE_DESC" required="true" />
|
||||
|
||||
|
||||
<field name="alias" type="text" class="form-control" size="40" label="COM_PHOCAMAPS_FIELD_ALIAS_LABEL" description="COM_PHOCAMAPS_FIELD_ALIAS_DESC" />
|
||||
|
||||
|
||||
|
||||
<field name="url" type="text" class="form-control" size="120" label="COM_PHOCAMAPS_FIELD_URL_LABEL" description="COM_PHOCAMAPS_FIELD_URL_DESC" />
|
||||
<field name="object" type="text" class="form-control" size="60" label="COM_PHOCAMAPS_FIELD_ICON_OBJECT_LABEL" description="COM_PHOCAMAPS_FIELD_ICON_OBJECT_DESC" />
|
||||
<field name="urls" type="text" class="form-control" size="120" label="COM_PHOCAMAPS_FIELD_URL_SHADOW_LABEL" description="COM_PHOCAMAPS_FIELD_URL_SHADOW_DESC" />
|
||||
<field name="objects" type="text" class="form-control" size="60" label="COM_PHOCAMAPS_FIELD_ICON_OBJECT_SHADOW_LABEL" description="COM_PHOCAMAPS_FIELD_ICON_OBJECT_SHADOW_DESC" />
|
||||
<field name="objectshape" type="text" class="form-control" size="60" label="COM_PHOCAMAPS_FIELD_ICON_OBJECT_SHAPE_LABEL" description="COM_PHOCAMAPS_FIELD_ICON_OBJECT_SHAPE_DESC" />
|
||||
|
||||
<field name="ordering" type="PhocaMapsOrdering" table="icon" class="form-select" label="COM_PHOCAMAPS_FIELD_ORDERING_LABEL" description="COM_PHOCAMAPS_FIELD_ORDERING_DESC" />
|
||||
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="publish" label="COM_PHOCAMAPS_GROUP_LABEL_PUBLISHING_DETAILS" >
|
||||
|
||||
<field name="published" type="list" label="COM_PHOCAMAPS_FIELD_PUBLISHED_LABEL" description="COM_PHOCAMAPS_FIELD_PUBLISHED_DESC" class="form-select" size="1" default="1">
|
||||
<option value="1">JPUBLISHED</option>
|
||||
<option value="0">JUNPUBLISHED</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</form>
|
||||
@ -0,0 +1,134 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
|
||||
<fieldset addfieldpath="/administrator/components/com_phocamaps/models/fields">
|
||||
|
||||
<field name="id" type="text" default="0" label="JGLOBAL_FIELD_ID_LABEL" required="true" readonly="true" class="readonly" />
|
||||
|
||||
<field name="title" type="text" class="form-control" size="40" label="COM_PHOCAMAPS_FIELD_TITLE_LABEL" description="COM_PHOCAMAPS_FIELD_TITLE_DESC" required="true" />
|
||||
|
||||
<field name="alias" type="text" class="form-control" size="40" label="COM_PHOCAMAPS_FIELD_ALIAS_LABEL" description="COM_PHOCAMAPS_FIELD_ALIAS_DESC" />
|
||||
|
||||
|
||||
<field name="latitude" type="phocaselectmap" maptype="map" label="COM_PHOCAMAPS_FIELD_LATITUDE_LABEL" description="COM_PHOCAMAPS_FIELD_LATITUDE_DESC" class="form-control" size="40" />
|
||||
<field name="longitude" type="phocaselectmap" maptype="map" label="COM_PHOCAMAPS_FIELD_LONGITUDE_LABEL" description="COM_PHOCAMAPS_FIELD_LONGITUDE_DESC" class="form-control" size="40" />
|
||||
<field name="zoom" type="phocaselectmap" maptype="map" label="COM_PHOCAMAPS_FIELD_ZOOM_LABEL" description="COM_PHOCAMAPS_FIELD_ZOOM_DESC" class="form-control" size="40" />
|
||||
|
||||
|
||||
<field name="width" type="text" class="form-control" size="40" label="COM_PHOCAMAPS_FIELD_MAP_WIDTH_LABEL" description="COM_PHOCAMAPS_FIELD_MAP_WIDTH_DESC" />
|
||||
<field name="height" type="text" class="form-control" size="40" label="COM_PHOCAMAPS_FIELD_MAP_HEIGHT_LABEL" description="COM_PHOCAMAPS_FIELD_MAP_HEIGHT_DESC" />
|
||||
<field name="lang" type="text" class="form-control" size="40" label="COM_PHOCAMAPS_FIELD_MAP_LANG_NAME_LABEL" description="COM_PHOCAMAPS_FIELD_MAP_LANG_NAME_DESC" />
|
||||
|
||||
<field name="ordering" type="PhocaMapsOrdering" table="map" class="form-select" label="COM_PHOCAMAPS_FIELD_ORDERING_LABEL" description="COM_PHOCAMAPS_FIELD_ORDERING_DESC" />
|
||||
|
||||
|
||||
<field name="description" type="editor" buttons="true" hide="pagebreak,readmore" class="form-control" label="COM_PHOCAMAPS_FIELD_DESC_LABEL" description="COM_PHOCAMAPS_FIELD_DESC_DESC" filter="\Joomla\CMS\Component\ComponentHelper::filterText" />
|
||||
|
||||
|
||||
<field name="border" type="list" label="COM_PHOCAMAPS_FIELD_BORDER_LABEL" description="COM_PHOCAMAPS_FIELD_BORDER_DESC" class="form-select" size="1" default="1" typedesign="1" >
|
||||
<option value="0">COM_PHOCAMAPS_NONE</option>
|
||||
<option value="1">COM_PHOCAMAPS_GREY</option>
|
||||
<option value="2">COM_PHOCAMAPS_GREYWB</option>
|
||||
<option value="3">COM_PHOCAMAPS_GREYRC</option>
|
||||
<option value="4">COM_PHOCAMAPS_BLACK</option>
|
||||
</field>
|
||||
|
||||
<field name="typeid" type="list" label="COM_PHOCAMAPS_FIELD_MAP_TYPE_LABEL" description="COM_PHOCAMAPS_FIELD_MAP_TYPE_DESC" class="form-select" size="1" default="0" >
|
||||
<option value="0">COM_PHOCAMAPS_ROADMAP</option>
|
||||
<option value="1">COM_PHOCAMAPS_SATELLITE</option>
|
||||
<option value="2">COM_PHOCAMAPS_HYBRID</option>
|
||||
<option value="3">COM_PHOCAMAPS_TERRAIN</option>
|
||||
</field>
|
||||
|
||||
<field name="typecontrol" type="list" label="COM_PHOCAMAPS_FIELD_MAP_TYPE_CONTROL_LABEL" description="COM_PHOCAMAPS_FIELD_MAP_TYPE_CONTROL_DESC" class="form-select" size="1" default="1" >
|
||||
<option value="0">COM_PHOCAMAPS_DISABLE</option>
|
||||
<option value="1">COM_PHOCAMAPS_default</option>
|
||||
<option value="2">COM_PHOCAMAPS_HORIZONTAL_BAR</option>
|
||||
<option value="3">COM_PHOCAMAPS_DROPDOWN_MENU</option>
|
||||
</field>
|
||||
|
||||
<field name="typecontrolposition" type="list" label="COM_PHOCAMAPS_FIELD_MAP_TYPE_CONTROL_POS_LABEL" description="COM_PHOCAMAPS_FIELD_MAP_TYPE_CONTROL_POS_DESC" class="form-select" size="1" default="1" >
|
||||
<option value="1">COM_PHOCAMAPS_TOP</option>
|
||||
<option value="2">COM_PHOCAMAPS_TOP_LEFT</option>
|
||||
<option value="3">COM_PHOCAMAPS_TOP_RIGHT</option>
|
||||
<option value="4">COM_PHOCAMAPS_BOTTOM</option>
|
||||
<option value="5">COM_PHOCAMAPS_BOTTOM_LEFT</option>
|
||||
<option value="6">COM_PHOCAMAPS_BOTTOM_RIGHT</option>
|
||||
<option value="7">COM_PHOCAMAPS_LEFT</option>
|
||||
<option value="8">COM_PHOCAMAPS_RIGHT</option>
|
||||
</field>
|
||||
|
||||
<field name="doubleclickzoom" type="list" label="COM_PHOCAMAPS_FIELD_DOUBLECLICK_ZOOM_LABEL" description="COM_PHOCAMAPS_FIELD_DOUBLECLICK_ZOOM_DESC" class="form-select" size="1" default="1" >
|
||||
<option value="0">COM_PHOCAMAPS_NO</option>
|
||||
<option value="1">COM_PHOCAMAPS_YES</option>
|
||||
</field>
|
||||
|
||||
<field name="scrollwheelzoom" type="list" label="COM_PHOCAMAPS_FIELD_SCROLL_WHEEL_ZOOM_LABEL" description="COM_PHOCAMAPS_FIELD_SCROLL_WHEEL_ZOOM_DESC" class="form-select" size="1" default="1" >
|
||||
<option value="0">COM_PHOCAMAPS_NO</option>
|
||||
<option value="1">COM_PHOCAMAPS_YES</option>
|
||||
</field>
|
||||
|
||||
<field name="gesturehandling" type="list" label="COM_PHOCAMAPS_FIELD_GESTURE_HANDLING_LABEL" description="COM_PHOCAMAPS_FIELD_GESTURE_HANDLING_DESC" class="form-select" size="1" default="" >
|
||||
<option value="">COM_PHOCAMAPS_DISABLED</option>
|
||||
<option value="cooperative">COM_PHOCAMAPS_COOPERATIVE</option>
|
||||
</field>
|
||||
|
||||
<field name="zoomcontrol" type="list" label="COM_PHOCAMAPS_FIELD_NAVIGATION_CONTROL_LABEL" description="COM_PHOCAMAPS_FIELD_NAVIGATION_CONTROL_DESC" class="form-select" size="1" default="1" >
|
||||
<option value="0">COM_PHOCAMAPS_DISABLE</option>
|
||||
<option value="1">COM_PHOCAMAPS_DEFAULT</option>
|
||||
<option value="2">COM_PHOCAMAPS_MINI_ZOOM</option>
|
||||
<option value="3">COM_PHOCAMAPS_ZOOM_PAN</option>
|
||||
<option value="4">COM_PHOCAMAPS_ANDROID</option>
|
||||
</field>
|
||||
|
||||
<field name="scalecontrol" type="list" label="COM_PHOCAMAPS_FIELD_SCALE_CONTROL_LABEL" description="COM_PHOCAMAPS_FIELD_SCALE_CONTROL_DESC" class="form-select" size="1" default="1" >
|
||||
<option value="0">COM_PHOCAMAPS_DISABLE</option>
|
||||
<option value="1">COM_PHOCAMAPS_ENABLE</option>
|
||||
</field>
|
||||
|
||||
<field name="autolocation" type="list" default="0" label="COM_PHOCAMAPS_DISPLAY_CURRENT_LOCATION_LABEL" description="COM_PHOCAMAPS_DISPLAY_CURRENT_LOCATION_DESC">
|
||||
<option value="0">COM_PHOCAMAPS_NO</option>
|
||||
<option value="1">COM_PHOCAMAPS_YES</option>
|
||||
</field>
|
||||
|
||||
<field name="displayroute" type="list" label="COM_PHOCAMAPS_FIELD_DISPLAY_ROUTE_LABEL" description="COM_PHOCAMAPS_FIELD_DISPLAY_ROUTE_DESC" class="form-select" size="1" default="1" >
|
||||
<option value="0">COM_PHOCAMAPS_NO</option>
|
||||
<option value="1">COM_PHOCAMAPS_YES</option>
|
||||
</field>
|
||||
|
||||
|
||||
|
||||
<field name="kmlfile" type="text" class="form-control" size="40" label="COM_PHOCAMAPS_KML_FILE_LABEL" description="COM_PHOCAMAPS_KML_FILE_DESC" />
|
||||
<field name="custom_options" type="text" class="form-control" size="40" label="COM_PHOCAMAPS_CUSTOM_OPTIONS_LABEL" description="COM_PHOCAMAPS_CUSTOM_OPTIONS_DESC" />
|
||||
|
||||
<field name="map_styles" type="textarea" class="form-control" rows="5" label="COM_PHOCAMAPS_MAP_STYLES_LABEL" description="COM_PHOCAMAPS_MAP_STYLES_DESC" />
|
||||
|
||||
|
||||
<field name="trackfiles_osm" type="textarea" class="form-control" rows="5" label="COM_PHOCAMAPS_FIELD_OSM_TRACK_LOG_FILES_LABEL" description="COM_PHOCAMAPS_FIELD_OSM_TRACK_LOG_FILES_DESC" />
|
||||
|
||||
<field name="trackcolors_osm" type="textarea" class="form-control" rows="5" label="COM_PHOCAMAPS_FIELD_OSM_COLORS_FOR_TRACKS_LABEL" description="COM_PHOCAMAPS_FIELD_OSM_COLORS_FOR_TRACKS_DESC" />
|
||||
|
||||
<field name="fitbounds_osm" type="list" label="COM_PHOCAMAPS_FIELD_OSM_FIT_MAP_TO_FIRST_TRACK_LABEL" description="COM_PHOCAMAPS_FIELD_OSM_FIT_MAP_TO_FIRST_TRACK_DESC" >
|
||||
<option value="0">COM_PHOCAMAPS_NO</option>
|
||||
<option value="1">COM_PHOCAMAPS_YES</option>
|
||||
</field>
|
||||
|
||||
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="publish" label="COM_PHOCAMAPS_GROUP_LABEL_PUBLISHING_DETAILS" >
|
||||
|
||||
<field name="published" type="list" label="COM_PHOCAMAPS_FIELD_PUBLISHED_LABEL" description="COM_PHOCAMAPS_FIELD_PUBLISHED_DESC" class="form-select" size="1" default="1">
|
||||
<option value="1">JPUBLISHED</option>
|
||||
<option value="0">JUNPUBLISHED</option>
|
||||
</field>
|
||||
|
||||
<field name="language" type="contentlanguage" label="JFIELD_LANGUAGE_LABEL" description="COM_PHOCAMAPS_FIELD_LANGUAGE_MAP_DESC" class="form-select">
|
||||
<option value="*">JALL</option>
|
||||
</field>
|
||||
|
||||
</fieldset>
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
@ -0,0 +1,107 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<form>
|
||||
|
||||
<fieldset addfieldpath="/administrator/components/com_phocamaps/models/fields">
|
||||
|
||||
<field name="id" type="text" default="0" label="JGLOBAL_FIELD_ID_LABEL" required="true" readonly="true" class="readonly" />
|
||||
|
||||
<field name="title" type="text" class="form-control" size="40" label="COM_PHOCAMAPS_FIELD_TITLE_LABEL" description="COM_PHOCAMAPS_FIELD_TITLE_DESC" required="true" />
|
||||
|
||||
<field name="alias" type="text" class="form-control" size="40" label="COM_PHOCAMAPS_FIELD_ALIAS_LABEL" description="COM_PHOCAMAPS_FIELD_ALIAS_DESC" />
|
||||
|
||||
|
||||
<field name="latitude" type="phocaselectmap" maptype="marker" label="COM_PHOCAMAPS_FIELD_LATITUDE_LABEL" description="COM_PHOCAMAPS_FIELD_LATITUDE_DESC" class="form-control" size="40" onchange="setPMGPSLatitudeJForm(this.value);" />
|
||||
<field name="longitude" type="phocaselectmap" maptype="marker" label="COM_PHOCAMAPS_FIELD_LONGITUDE_LABEL" description="COM_PHOCAMAPS_FIELD_LONGITUDE_DESC" class="form-control" size="40" onchange="setPMGPSLongitudeJForm(this.value);" />
|
||||
|
||||
<field name="gpslatitude" type="phocaselectmap" class="form-control pmreadonly" size="40" label="COM_PHOCAMAPS_FIELD_GPS_LATITUDE_LABEL" description="COM_PHOCAMAPS_FIELD_GPS_LATITUDE_DESC" readonly="true" />
|
||||
<field name="gpslongitude" type="phocaselectmap" class="form-control pmreadonly" size="40" label="COM_PHOCAMAPS_FIELD_GPS_LONGITUDE_LABEL" description="COM_PHOCAMAPS_FIELD_GPS_LONGITUDE_DESC" readonly="true" />
|
||||
|
||||
|
||||
<field name="catid" type="phocamapsmap" default="" label="COM_PHOCAMAPS_FIELD_SELECT_MAP_LABEL" description="COM_PHOCAMAPS_FIELD_SELECT_MAP_LABEL" required="true" class="form-select" />
|
||||
|
||||
<!--
|
||||
<field name="markerwindow" type="list" label="COM_PHOCAMAPS_FIELD_OPEN_MARKER_WINDOW_LABEL" description="COM_PHOCAMAPS_FIELD_OPEN_MARKER_WINDOW_DESC" class="form-control" size="1" default="0" >
|
||||
<option value="0">COM_PHOCAMAPS_NO</option>
|
||||
<option value="1">COM_PHOCAMAPS_YES</option>
|
||||
</field>-->
|
||||
|
||||
<field name="markerwindow" type="list" label="COM_PHOCAMAPS_FIELD_MARKER_WINDOW_LABEL" description="COM_PHOCAMAPS_FIELD_MARKER_WINDOW_DESC" class="form-select" size="1" default="0" >
|
||||
<option value="0">COM_PHOCAMAPS_CLOSED</option>
|
||||
<option value="1">COM_PHOCAMAPS_OPENED</option>
|
||||
<option value="2">COM_PHOCAMAPS_HIDDEN</option>
|
||||
</field>
|
||||
|
||||
<field name="contentwidth" type="text" class="form-control" size="40" label="COM_PHOCAMAPS_MARKER_CONTENT_WIDTH_LABEL" description="COM_PHOCAMAPS_MARKER_CONTENT_WIDTH_DESC" />
|
||||
<field name="contentheight" type="text" class="form-control" size="40" label="COM_PHOCAMAPS_MARKER_CONTENT_HEIGHT_LABEL" description="COM_PHOCAMAPS_MARKER_CONTENT_HEIGHT_DESC" />
|
||||
|
||||
<field name="displaygps" type="list" label="COM_PHOCAMAPS_FIELD_DISPLAY_GPS_LABEL" description="COM_PHOCAMAPS_FIELD_DISPLAY_GPS_DESC" class="form-select" size="1" default="0" >
|
||||
<option value="0">COM_PHOCAMAPS_NO</option>
|
||||
<option value="1">COM_PHOCAMAPS_YES</option>
|
||||
</field>
|
||||
|
||||
|
||||
|
||||
<field name="ordering" type="PhocaMapsOrdering" table="map" class="form-select" label="COM_PHOCAMAPS_FIELD_ORDERING_LABEL" description="COM_PHOCAMAPS_FIELD_ORDERING_DESC" />
|
||||
|
||||
|
||||
<field name="description" type="editor" buttons="true" hide="pagebreak,readmore" class="form-control" label="COM_PHOCAMAPS_FIELD_DESC_LABEL" description="COM_PHOCAMAPS_FIELD_DESC_DESC" filter="\Joomla\CMS\Component\ComponentHelper::filterText" />
|
||||
|
||||
|
||||
|
||||
<field name="icon" type="phocamapsradio" label="COM_PHOCAMAPS_FIELD_MARKER_ICON_LABEL" description="COM_PHOCAMAPS_FIELD_MARKER_ICON_DESC" class="form-control" size="1" default="0" typedesign="2" >
|
||||
<option value="0">COM_PHOCAMAPS_DEFAULT</option>
|
||||
<option value="1">COM_PHOCAMAPS_IGREY</option>
|
||||
<option value="2">COM_PHOCAMAPS_IYELLOW</option>
|
||||
<option value="3">COM_PHOCAMAPS_IHOME</option>
|
||||
<option value="4">COM_PHOCAMAPS_IGREEN</option>
|
||||
<option value="5">COM_PHOCAMAPS_ISTAR</option>
|
||||
<option value="6">COM_PHOCAMAPS_IINFOH</option>
|
||||
<option value="7">COM_PHOCAMAPS_IINFOI</option>
|
||||
<option value="8">COM_PHOCAMAPS_IINFOP</option>
|
||||
<option value="9">COM_PHOCAMAPS_IINFOPH</option>
|
||||
<option value="10">COM_PHOCAMAPS_IINFOZ</option>
|
||||
</field>
|
||||
|
||||
<field name="iconext" type="phocaselecticon" label="COM_PHOCAMAPS_FIELD_MARKER_ICON_EXT_LABEL" description="COM_PHOCAMAPS_FIELD_MARKER_ICON_EXT_DESC" class="form-select" size="1" default="0" />
|
||||
|
||||
|
||||
<field name="osm_icon" type="text" default="circle" class="form-control" size="40" label="COM_PHOCAMAPS_MARKER_ICON_OSM_LABEL" description="COM_PHOCAMAPS_MARKER_ICON_OSM_DESC" />
|
||||
|
||||
<field name="osm_marker_color" type="list" label="COM_PHOCAMAPS_FIELD_MARKER_COLOR_OSM_LABEL" description="COM_PHOCAMAPS_FIELD_MARKER_COLOR_OSM_DESC" class="form-select" size="1" default="blue" >
|
||||
<option value="red">red</option>
|
||||
<option value="darkred">darkred</option>
|
||||
<option value="orange">orange</option>
|
||||
<option value="green">green</option>
|
||||
<option value="darkgreen">darkgreen</option>
|
||||
<option value="blue">blue</option>
|
||||
<option value="purple">purple</option>
|
||||
<option value="darkpurple">darkpurple</option>
|
||||
<option value="cadetblue">cadetblue</option>
|
||||
</field>
|
||||
<field name="osm_icon_color" type="text" default="#ffffff" class="form-control" size="40" label="COM_PHOCAMAPS_ICON_COLOR_OSM_LABEL" description="COM_PHOCAMAPS_ICON_COLOR_OSM_DESC" />
|
||||
|
||||
<field name="osm_icon_prefix" type="text" default="fa" class="form-control" size="40" label="COM_PHOCAMAPS_ICON_PREFIX_OSM_LABEL" description="COM_PHOCAMAPS_ICON_PREFIX_OSM_DESC" />
|
||||
<field name="osm_icon_spin" type="list" label="COM_PHOCAMAPS_FIELD_ICON_SPIN_OSM_LABEL" description="COM_PHOCAMAPS_FIELD_ICON_SPIN_OSM_DESC" class="form-select" size="1" default="0" >
|
||||
<option value="0">COM_PHOCAMAPS_NO</option>
|
||||
<option value="1">COM_PHOCAMAPS_YES</option>
|
||||
</field>
|
||||
|
||||
<field name="osm_icon_class" type="textarea" default="" class="form-control" size="40" label="COM_PHOCAMAPS_ICON_CLASS_OSM_LABEL" description="COM_PHOCAMAPS_ICON_CLASS_OSM_DESC" />
|
||||
|
||||
|
||||
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="publish" label="COM_PHOCAMAPS_GROUP_LABEL_PUBLISHING_DETAILS" >
|
||||
|
||||
<field name="published" type="list" label="COM_PHOCAMAPS_FIELD_PUBLISHED_LABEL" description="COM_PHOCAMAPS_FIELD_PUBLISHED_DESC" class="form-select" size="1" default="1">
|
||||
<option value="1">JPUBLISHED</option>
|
||||
<option value="0">JUNPUBLISHED</option>
|
||||
</field>
|
||||
<field name="language" type="contentlanguage" label="JFIELD_LANGUAGE_LABEL" description="COM_PHOCAMAPS_FIELD_LANGUAGE_MARKER_DESC" class="form-select">
|
||||
<option value="*">JALL</option>
|
||||
</field>
|
||||
|
||||
</fieldset>
|
||||
|
||||
</form>
|
||||
1
administrator/components/com_phocamaps/models/index.html
Normal file
1
administrator/components/com_phocamaps/models/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@ -0,0 +1,84 @@
|
||||
<?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\Application\ApplicationHelper;
|
||||
use Joomla\CMS\MVC\Model\AdminModel;
|
||||
use Joomla\CMS\Table\Table;
|
||||
use Joomla\CMS\Factory;
|
||||
jimport('joomla.application.component.modeladmin');
|
||||
|
||||
class PhocaMapsCpModelPhocaMapsIcon extends AdminModel
|
||||
{
|
||||
protected $option = 'com_phocamaps';
|
||||
protected $text_prefix = 'com_phocamaps';
|
||||
|
||||
protected function canDelete($record) {
|
||||
return parent::canDelete($record);
|
||||
}
|
||||
|
||||
protected function canEditState($record) {
|
||||
return parent::canEditState($record);
|
||||
}
|
||||
|
||||
public function getTable($type = 'PhocamapsIcon', $prefix = 'Table', $config = array()){
|
||||
return Table::getInstance($type, $prefix, $config);
|
||||
}
|
||||
|
||||
public function getForm($data = array(), $loadData = true) {
|
||||
|
||||
$app = Factory::getApplication();
|
||||
$form = $this->loadForm('com_phocamaps.phocamapsicon', 'phocamapsicon', array('control' => 'jform', 'load_data' => $loadData));
|
||||
if (empty($form)) {
|
||||
return false;
|
||||
}
|
||||
return $form;
|
||||
}
|
||||
|
||||
protected function loadFormData() {
|
||||
// Check the session for previously entered form data.
|
||||
$data = Factory::getApplication()->getUserState('com_phocamaps.edit.phocamapsicon.data', array());
|
||||
|
||||
if (empty($data)) {
|
||||
$data = $this->getItem();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function prepareTable($table) {
|
||||
jimport('joomla.filter.output');
|
||||
$date = Factory::getDate();
|
||||
$user = Factory::getUser();
|
||||
|
||||
$table->title = htmlspecialchars_decode($table->title, ENT_QUOTES);
|
||||
$table->alias = ApplicationHelper::stringURLSafe($table->alias);
|
||||
|
||||
if (empty($table->alias)) {
|
||||
$table->alias = ApplicationHelper::stringURLSafe($table->title);
|
||||
}
|
||||
|
||||
if (empty($table->id)) {
|
||||
// Set the values
|
||||
// Set ordering to the last item if not set
|
||||
if (empty($table->ordering)) {
|
||||
$db = Factory::getDbo();
|
||||
$db->setQuery('SELECT MAX(ordering) FROM #__phocamaps_icon');
|
||||
$max = $db->loadResult();
|
||||
$table->ordering = $max+1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Set the values
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
152
administrator/components/com_phocamaps/models/phocamapsicons.php
Normal file
152
administrator/components/com_phocamaps/models/phocamapsicons.php
Normal file
@ -0,0 +1,152 @@
|
||||
<?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\MVC\Model\ListModel;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
jimport('joomla.application.component.modellist');
|
||||
|
||||
class PhocaMapsCpModelPhocaMapsIcons extends ListModel
|
||||
{
|
||||
protected $option = 'com_phocamaps';
|
||||
|
||||
public function __construct($config = array())
|
||||
{
|
||||
if (empty($config['filter_fields'])) {
|
||||
$config['filter_fields'] = array(
|
||||
'id', 'a.id',
|
||||
'title', 'a.title',
|
||||
'alias', 'a.alias',
|
||||
'url','a.url',
|
||||
'checked_out', 'a.checked_out',
|
||||
'checked_out_time', 'a.checked_out_time',
|
||||
'state', 'a.state',
|
||||
'access', 'a.access', 'access_level',
|
||||
'ordering', 'a.ordering',
|
||||
'language', 'a.language',
|
||||
//'hits', 'a.hits',
|
||||
'published','a.published'
|
||||
);
|
||||
}
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
protected function populateState($ordering = NULL, $direction = NULL)
|
||||
{
|
||||
// Initialise variables.
|
||||
$app = Factory::getApplication('administrator');
|
||||
|
||||
// Load the filter state.
|
||||
$search = $app->getUserStateFromRequest($this->context.'.filter.search', 'filter_search');
|
||||
$this->setState('filter.search', $search);
|
||||
|
||||
/* $accessId = $app->getUserStateFromRequest($this->context.'.filter.access', 'filter_access', null, 'int');
|
||||
$this->setState('filter.access', $accessId);*/
|
||||
|
||||
$state = $app->getUserStateFromRequest($this->context.'.filter.published', 'filter_published', '', 'string');
|
||||
$this->setState('filter.published', $state);
|
||||
|
||||
$language = $app->getUserStateFromRequest($this->context.'.filter.language', 'filter_language', '');
|
||||
$this->setState('filter.language', $language);
|
||||
|
||||
// Load the parameters.
|
||||
$params = ComponentHelper::getParams('com_phocamaps');
|
||||
$this->setState('params', $params);
|
||||
|
||||
// List state information.
|
||||
parent::populateState('a.title', 'asc');
|
||||
}
|
||||
|
||||
protected function getStoreId($id = '')
|
||||
{
|
||||
// Compile the store id.
|
||||
$id .= ':'.$this->getState('filter.search');
|
||||
//$id .= ':'.$this->getState('filter.access');
|
||||
$id .= ':'.$this->getState('filter.published');
|
||||
$id .= ':'.$this->getState('filter.icon_id');
|
||||
|
||||
return parent::getStoreId($id);
|
||||
}
|
||||
|
||||
protected function getListQuery()
|
||||
{
|
||||
|
||||
// Create a new query object.
|
||||
$db = $this->getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Select the required fields from the table.
|
||||
$query->select(
|
||||
$this->getState(
|
||||
'list.select',
|
||||
'a.*'
|
||||
)
|
||||
);
|
||||
$query->from('`#__phocamaps_icon` AS a');
|
||||
|
||||
// Join over the language
|
||||
$query->select('l.title AS language_title');
|
||||
$query->join('LEFT', '`#__languages` AS l ON l.lang_code = a.language');
|
||||
|
||||
// Join over the users for the checked out user.
|
||||
$query->select('uc.name AS editor');
|
||||
$query->join('LEFT', '#__users AS uc ON uc.id=a.checked_out');
|
||||
|
||||
|
||||
// Filter by access level.
|
||||
/* if ($access = $this->getState('filter.access')) {
|
||||
$query->where('a.access = '.(int) $access);
|
||||
}*/
|
||||
|
||||
// Filter by published state.
|
||||
$published = $this->getState('filter.published');
|
||||
if (is_numeric($published)) {
|
||||
$query->where('a.published = '.(int) $published);
|
||||
}
|
||||
else if ($published === '') {
|
||||
$query->where('(a.published IN (0, 1))');
|
||||
}
|
||||
|
||||
|
||||
// Filter by search in title
|
||||
$search = $this->getState('filter.search');
|
||||
if (!empty($search))
|
||||
{
|
||||
if (stripos($search, 'id:') === 0) {
|
||||
$query->where('a.id = '.(int) substr($search, 3));
|
||||
}
|
||||
else
|
||||
{
|
||||
$search = $db->Quote('%'.$db->escape($search, true).'%');
|
||||
$query->where('( a.title LIKE '.$search.' OR a.alias LIKE '.$search.')');
|
||||
}
|
||||
}
|
||||
|
||||
// Add the list ordering clause.
|
||||
//$orderCol = $this->state->get('list.ordering');
|
||||
//$orderDirn = $this->state->get('list.direction');
|
||||
$orderCol = $this->state->get('list.ordering', 'title');
|
||||
$orderDirn = $this->state->get('list.direction', 'asc');
|
||||
if ($orderCol != 'a.ordering') {
|
||||
$orderCol = 'a.ordering';
|
||||
}
|
||||
$query->order($db->escape($orderCol.' '.$orderDirn));
|
||||
|
||||
//echo nl2br(str_replace('#__', 'jos_', $query->__toString()));
|
||||
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
399
administrator/components/com_phocamaps/models/phocamapsmap.php
Normal file
399
administrator/components/com_phocamaps/models/phocamapsmap.php
Normal file
@ -0,0 +1,399 @@
|
||||
<?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\Application\ApplicationHelper;
|
||||
use Joomla\CMS\MVC\Model\AdminModel;
|
||||
use Joomla\CMS\Table\Table;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
jimport('joomla.application.component.modeladmin');
|
||||
|
||||
use Joomla\String\StringHelper;
|
||||
|
||||
class PhocaMapsCpModelPhocaMapsMap extends AdminModel
|
||||
{
|
||||
|
||||
protected $option = 'com_phocamaps';
|
||||
protected $text_prefix = 'com_phocamaps';
|
||||
|
||||
protected function canDelete($record)
|
||||
{
|
||||
//$user = JFactory::getUser();
|
||||
return parent::canDelete($record);
|
||||
}
|
||||
|
||||
protected function canEditState($record)
|
||||
{
|
||||
//$user = JFactory::getUser();
|
||||
return parent::canEditState($record);
|
||||
}
|
||||
|
||||
public function getTable($type = 'PhocamapsMap', $prefix = 'Table', $config = array())
|
||||
{
|
||||
return Table::getInstance($type, $prefix, $config);
|
||||
}
|
||||
|
||||
public function getForm($data = array(), $loadData = true) {
|
||||
|
||||
$app = Factory::getApplication();
|
||||
$form = $this->loadForm('com_phocamaps.phocamapsmap', 'phocamapsmap', array('control' => 'jform', 'load_data' => $loadData));
|
||||
if (empty($form)) {
|
||||
return false;
|
||||
}
|
||||
return $form;
|
||||
}
|
||||
|
||||
protected function loadFormData()
|
||||
{
|
||||
// Check the session for previously entered form data.
|
||||
$data = Factory::getApplication()->getUserState('com_phocamaps.edit.phocamapsmap.data', array());
|
||||
|
||||
if (empty($data)) {
|
||||
$data = $this->getItem();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function prepareTable($table)
|
||||
{
|
||||
jimport('joomla.filter.output');
|
||||
$date = Factory::getDate();
|
||||
$user = Factory::getUser();
|
||||
|
||||
$table->title = htmlspecialchars_decode($table->title, ENT_QUOTES);
|
||||
$table->alias = ApplicationHelper::stringURLSafe($table->alias);
|
||||
|
||||
if (empty($table->alias)) {
|
||||
$table->alias = ApplicationHelper::stringURLSafe($table->title);
|
||||
}
|
||||
|
||||
if (empty($table->id)) {
|
||||
// Set the values
|
||||
//$table->created = $date->toSql();
|
||||
|
||||
// Set ordering to the last item if not set
|
||||
if (empty($table->ordering)) {
|
||||
$db = Factory::getDbo();
|
||||
$db->setQuery('SELECT MAX(ordering) FROM #__phocamaps_map');
|
||||
$max = $db->loadResult();
|
||||
|
||||
$table->ordering = $max+1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Set the values
|
||||
//$table->modified = $date->toSql();
|
||||
//$table->modified_by = $user->get('id');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function getReorderConditions($table = null)
|
||||
{
|
||||
$condition = array();
|
||||
//$condition[] = 'parent_id = '. (int) $table->parent_id;
|
||||
//$condition[] = 'state >= 0';
|
||||
return $condition;
|
||||
}
|
||||
|
||||
protected function batchCopy($value, $pks, $contexts)
|
||||
{
|
||||
$categoryId = (int) $value;
|
||||
$app = Factory::getApplication();
|
||||
|
||||
$table = $this->getTable();
|
||||
$db = $this->getDbo();
|
||||
$i = 0;
|
||||
|
||||
// Check that the category exists
|
||||
if ($categoryId) {
|
||||
$categoryTable = Table::getInstance('PhocaMapsMap', 'Table');
|
||||
|
||||
if (!$categoryTable->load($categoryId)) {
|
||||
if ($error = $categoryTable->getError()) {
|
||||
// Fatal error
|
||||
throw new Exception($error, 500);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_BATCH_MOVE_CATEGORY_NOT_FOUND'), 500);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if (empty($categoryId)) {
|
||||
if (!isset($categoryId)) {
|
||||
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_BATCH_MOVE_CATEGORY_NOT_FOUND'), 500);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check that the user has create permission for the component
|
||||
$extension = Factory::getApplication()->input->getCmd('option');
|
||||
$user = Factory::getUser();
|
||||
if (!$user->authorise('core.create', $extension)) {
|
||||
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_CREATE'), 500);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Parent exists so we let's proceed
|
||||
while (!empty($pks))
|
||||
{
|
||||
// Pop the first ID off the stack
|
||||
$pk = array_shift($pks);
|
||||
|
||||
$table->reset();
|
||||
|
||||
// Check that the row actually exists
|
||||
if (!$table->load($pk)) {
|
||||
if ($error = $table->getError()) {
|
||||
// Fatal error
|
||||
throw new Exception($error, 500);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
// Not fatal error
|
||||
|
||||
$app->enqueueMessage(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Alter the title & alias
|
||||
$data = $this->generateNewTitle($categoryId, $table->alias, $table->title);
|
||||
$table->title = $data['0'];
|
||||
$table->alias = $data['1'];
|
||||
|
||||
// Reset the ID because we are making a copy
|
||||
$table->id = 0;
|
||||
|
||||
// New category ID
|
||||
//$table->parent_id = $categoryId;
|
||||
|
||||
// Ordering
|
||||
$table->ordering = $this->increaseOrdering($categoryId);
|
||||
|
||||
$table->hits = 0;
|
||||
|
||||
// Check the row.
|
||||
if (!$table->check()) {
|
||||
throw new Exception($table->getError(), 500);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Store the row.
|
||||
if (!$table->store()) {
|
||||
throw new Exception($table->getError(), 500);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the new item ID
|
||||
$newId = $table->get('id');
|
||||
|
||||
// Add the new ID to the array
|
||||
$newIds[$pk] = $newId;
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Clean the cache
|
||||
$this->cleanCache();
|
||||
|
||||
return $newIds;
|
||||
}
|
||||
|
||||
protected function batchMove($value, $pks, $contexts)
|
||||
{
|
||||
$categoryId = (int) $value;
|
||||
$app = Factory::getApplication();
|
||||
$table = $this->getTable();
|
||||
//$db = $this->getDbo();
|
||||
|
||||
// Check that the category exists
|
||||
if ($categoryId) {
|
||||
$categoryTable = Table::getInstance('PhocaMapsMap', 'Table');
|
||||
if (!$categoryTable->load($categoryId)) {
|
||||
if ($error = $categoryTable->getError()) {
|
||||
// Fatal error
|
||||
throw new Exception($error, 500);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_BATCH_MOVE_CATEGORY_NOT_FOUND'), 500);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if (empty($categoryId)) {
|
||||
if (!isset($categoryId)) {
|
||||
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_BATCH_MOVE_CATEGORY_NOT_FOUND'), 500);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check that user has create and edit permission for the component
|
||||
$extension = Factory::getApplication()->input->getCmd('option');
|
||||
$user = Factory::getUser();
|
||||
if (!$user->authorise('core.create', $extension)) {
|
||||
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_CREATE'), 500);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$user->authorise('core.edit', $extension)) {
|
||||
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'), 500);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Parent exists so we let's proceed
|
||||
foreach ($pks as $pk)
|
||||
{
|
||||
// Check that the row actually exists
|
||||
if (!$table->load($pk)) {
|
||||
if ($error = $table->getError()) {
|
||||
// Fatal error
|
||||
throw new Exception($error, 500);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
// Not fatal error
|
||||
$app->enqueueMessage(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk), 'error');
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Set the new category ID
|
||||
//$table->parent_id = $categoryId;
|
||||
|
||||
// Check the row.
|
||||
if (!$table->check()) {
|
||||
throw new Exception($table->getError(), 500);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Store the row.
|
||||
if (!$table->store()) {
|
||||
throw new Exception($table->getError(), 500);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Clean the cache
|
||||
$this->cleanCache();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function increaseOrdering($categoryId) {
|
||||
|
||||
$ordering = 1;
|
||||
$this->_db->setQuery('SELECT MAX(ordering) FROM #__phocamaps_map');
|
||||
$max = $this->_db->loadResult();
|
||||
$ordering = $max + 1;
|
||||
return $ordering;
|
||||
}
|
||||
|
||||
|
||||
public function batch($commands, $pks, $contexts)
|
||||
{
|
||||
|
||||
// Sanitize user ids.
|
||||
$pks = array_unique($pks);
|
||||
ArrayHelper::toInteger($pks);
|
||||
|
||||
// Remove any values of zero.
|
||||
if (array_search(0, $pks, true)) {
|
||||
unset($pks[array_search(0, $pks, true)]);
|
||||
}
|
||||
|
||||
if (empty($pks)) {
|
||||
throw new Exception(Text::_('JGLOBAL_NO_ITEM_SELECTED'), 500);
|
||||
return false;
|
||||
}
|
||||
|
||||
$done = false;
|
||||
|
||||
if (!empty($commands['assetgroup_id'])) {
|
||||
if (!$this->batchAccess($commands['assetgroup_id'], $pks)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$done = true;
|
||||
}
|
||||
|
||||
|
||||
//PHOCAEDIT - because parent it is 0
|
||||
//if (!empty($commands['category_id'])) {
|
||||
if (isset($commands['category_id']))
|
||||
{
|
||||
$cmd = ArrayHelper::getValue($commands, 'move_copy', 'c');
|
||||
|
||||
if ($cmd == 'c')
|
||||
{
|
||||
$result = $this->batchCopy($commands['category_id'], $pks, $contexts);
|
||||
if (is_array($result))
|
||||
{
|
||||
$pks = $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
elseif ($cmd == 'm' && !$this->batchMove($commands['category_id'], $pks, $contexts))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
$done = true;
|
||||
}
|
||||
|
||||
if (!empty($commands['language_id']))
|
||||
{
|
||||
if (!$this->batchLanguage($commands['language_id'], $pks, $contexts))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$done = true;
|
||||
}
|
||||
|
||||
if (!$done) {
|
||||
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'), 500);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Clear the cache
|
||||
$this->cleanCache();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected function generateNewTitle($category_id, $alias, $title)
|
||||
{
|
||||
// Alter the title & alias
|
||||
$table = $this->getTable();
|
||||
while ($table->load(array('alias' => $alias)))
|
||||
{
|
||||
$title = StringHelper::increment($title);
|
||||
$alias = StringHelper::increment($alias, 'dash');
|
||||
// Joomla! 3.5
|
||||
//$title = StringHelper::increment($title);
|
||||
//$alias = StringHelper::increment($alias, 'dash');
|
||||
}
|
||||
|
||||
return array($title, $alias);
|
||||
}
|
||||
}
|
||||
?>
|
||||
162
administrator/components/com_phocamaps/models/phocamapsmaps.php
Normal file
162
administrator/components/com_phocamaps/models/phocamapsmaps.php
Normal file
@ -0,0 +1,162 @@
|
||||
<?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\MVC\Model\ListModel;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
jimport('joomla.application.component.modellist');
|
||||
|
||||
class PhocaMapsCpModelPhocaMapsMaps extends ListModel
|
||||
{
|
||||
protected $option = 'com_phocamaps';
|
||||
|
||||
public function __construct($config = array())
|
||||
{
|
||||
if (empty($config['filter_fields'])) {
|
||||
$config['filter_fields'] = array(
|
||||
'id', 'a.id',
|
||||
'title', 'a.title',
|
||||
'alias', 'a.alias',
|
||||
'checked_out', 'a.checked_out',
|
||||
'checked_out_time', 'a.checked_out_time',
|
||||
'state', 'a.state',
|
||||
'access', 'a.access', 'access_level',
|
||||
'ordering', 'a.ordering',
|
||||
'language', 'a.language',
|
||||
'hits', 'a.hits',
|
||||
'published','a.published'
|
||||
);
|
||||
}
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
protected function populateState($ordering = NULL, $direction = NULL)
|
||||
{
|
||||
// Initialise variables.
|
||||
$app = Factory::getApplication('administrator');
|
||||
|
||||
// Load the filter state.
|
||||
$search = $app->getUserStateFromRequest($this->context.'.filter.search', 'filter_search');
|
||||
$this->setState('filter.search', $search);
|
||||
|
||||
/* $accessId = $app->getUserStateFromRequest($this->context.'.filter.access', 'filter_access', null, 'int');
|
||||
$this->setState('filter.access', $accessId);*/
|
||||
|
||||
$state = $app->getUserStateFromRequest($this->context.'.filter.published', 'filter_published', '', 'string');
|
||||
$this->setState('filter.published', $state);
|
||||
|
||||
$language = $app->getUserStateFromRequest($this->context.'.filter.language', 'filter_language', '');
|
||||
$this->setState('filter.language', $language);
|
||||
|
||||
// Load the parameters.
|
||||
$params = ComponentHelper::getParams('com_phocamaps');
|
||||
$this->setState('params', $params);
|
||||
|
||||
// List state information.
|
||||
parent::populateState($ordering, $direction);
|
||||
}
|
||||
|
||||
protected function getStoreId($id = '')
|
||||
{
|
||||
// Compile the store id.
|
||||
$id .= ':'.$this->getState('filter.search');
|
||||
//$id .= ':'.$this->getState('filter.access');
|
||||
$id .= ':'.$this->getState('filter.published');
|
||||
$id .= ':'.$this->getState('filter.map_id');
|
||||
|
||||
return parent::getStoreId($id);
|
||||
}
|
||||
|
||||
protected function getListQuery()
|
||||
{
|
||||
/*
|
||||
$query = 'SELECT a.*, u.name AS editor '
|
||||
.' FROM #__phocamaps_map AS a '
|
||||
.' LEFT JOIN #__users AS u ON u.id = a.checked_out '
|
||||
. $where
|
||||
. $orderby;
|
||||
*/
|
||||
// Create a new query object.
|
||||
$db = $this->getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Select the required fields from the table.
|
||||
$query->select(
|
||||
$this->getState(
|
||||
'list.select',
|
||||
'a.*'
|
||||
)
|
||||
);
|
||||
$query->from('`#__phocamaps_map` AS a');
|
||||
|
||||
// Join over the language
|
||||
$query->select('l.title AS language_title');
|
||||
$query->join('LEFT', '`#__languages` AS l ON l.lang_code = a.language');
|
||||
|
||||
// Join over the users for the checked out user.
|
||||
$query->select('uc.name AS editor');
|
||||
$query->join('LEFT', '#__users AS uc ON uc.id=a.checked_out');
|
||||
|
||||
|
||||
// Filter by access level.
|
||||
/* if ($access = $this->getState('filter.access')) {
|
||||
$query->where('a.access = '.(int) $access);
|
||||
}*/
|
||||
|
||||
// Filter by published state.
|
||||
$published = $this->getState('filter.published');
|
||||
if (is_numeric($published)) {
|
||||
$query->where('a.published = '.(int) $published);
|
||||
}
|
||||
else if ($published === '') {
|
||||
$query->where('(a.published IN (0, 1))');
|
||||
}
|
||||
|
||||
|
||||
// Filter by search in title
|
||||
$search = $this->getState('filter.search');
|
||||
if (!empty($search))
|
||||
{
|
||||
if (stripos($search, 'id:') === 0) {
|
||||
$query->where('a.id = '.(int) substr($search, 3));
|
||||
}
|
||||
else
|
||||
{
|
||||
$search = $db->Quote('%'.$db->escape($search, true).'%');
|
||||
$query->where('( a.title LIKE '.$search.' OR a.alias LIKE '.$search.')');
|
||||
}
|
||||
}
|
||||
|
||||
// Filter on the language.
|
||||
if ($language = $this->getState('filter.language')) {
|
||||
$query->where('a.language = ' . $db->quote($language));
|
||||
}
|
||||
|
||||
// Add the list ordering clause.
|
||||
//$orderCol = $this->state->get('list.ordering');
|
||||
//$orderDirn = $this->state->get('list.direction');
|
||||
$orderCol = $this->state->get('list.ordering', 'title');
|
||||
$orderDirn = $this->state->get('list.direction', 'asc');
|
||||
if ($orderCol != 'a.ordering') {
|
||||
$orderCol = 'a.ordering';
|
||||
}
|
||||
$query->order($db->escape($orderCol.' '.$orderDirn));
|
||||
|
||||
//echo nl2br(str_replace('#__', 'jos_', $query->__toString()));
|
||||
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,303 @@
|
||||
<?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\MVC\Model\AdminModel;
|
||||
use Joomla\CMS\Table\Table;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Application\ApplicationHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
jimport('joomla.application.component.modeladmin');
|
||||
|
||||
|
||||
class PhocaMapsCpModelPhocaMapsMarker extends AdminModel
|
||||
{
|
||||
protected $option = 'com_phocamaps';
|
||||
protected $text_prefix = 'com_phocamaps';
|
||||
|
||||
protected function canDelete($record)
|
||||
{
|
||||
//$user = JFactory::getUser();
|
||||
return parent::canDelete($record);
|
||||
}
|
||||
|
||||
protected function canEditState($record)
|
||||
{
|
||||
//$user = JFactory::getUser();
|
||||
return parent::canEditState($record);
|
||||
}
|
||||
|
||||
public function getTable($type = 'PhocaMapsMarker', $prefix = 'Table', $config = array())
|
||||
{
|
||||
return Table::getInstance($type, $prefix, $config);
|
||||
}
|
||||
|
||||
public function getForm($data = array(), $loadData = true) {
|
||||
|
||||
$app = Factory::getApplication();
|
||||
$form = $this->loadForm('com_phocamaps.phocamapsmarker', 'phocamapsmarker', array('control' => 'jform', 'load_data' => $loadData));
|
||||
if (empty($form)) {
|
||||
return false;
|
||||
}
|
||||
return $form;
|
||||
}
|
||||
|
||||
protected function loadFormData()
|
||||
{
|
||||
// Check the session for previously entered form data.
|
||||
$data = Factory::getApplication()->getUserState('com_phocamaps.edit.phocamapsmarker.data', array());
|
||||
|
||||
if (empty($data)) {
|
||||
$data = $this->getItem();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function prepareTable($table)
|
||||
{
|
||||
jimport('joomla.filter.output');
|
||||
$date = Factory::getDate();
|
||||
$user = Factory::getUser();
|
||||
|
||||
$table->title = htmlspecialchars_decode($table->title, ENT_QUOTES);
|
||||
$table->alias = ApplicationHelper::stringURLSafe($table->alias);
|
||||
|
||||
if (empty($table->alias)) {
|
||||
$table->alias = ApplicationHelper::stringURLSafe($table->title);
|
||||
}
|
||||
|
||||
if (empty($table->id)) {
|
||||
// Set the values
|
||||
//$table->created = $date->toSql();
|
||||
|
||||
// Set ordering to the last item if not set
|
||||
if (empty($table->ordering)) {
|
||||
$db = Factory::getDbo();
|
||||
$db->setQuery('SELECT MAX(ordering) FROM #__phocamaps_marker WHERE catid='.(int)$table->catid);
|
||||
$max = $db->loadResult();
|
||||
|
||||
$table->ordering = $max+1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Set the values
|
||||
//$table->modified = $date->toSql();
|
||||
//$table->modified_by = $user->get('id');
|
||||
}
|
||||
}
|
||||
|
||||
protected function getReorderConditions($table = null)
|
||||
{
|
||||
$condition = array();
|
||||
$condition[] = 'catid = '.(int) $table->catid;
|
||||
return $condition;
|
||||
}
|
||||
|
||||
protected function batchCopy($value, $pks, $contexts)
|
||||
{
|
||||
$categoryId = (int) $value;
|
||||
$app = Factory::getApplication();
|
||||
|
||||
$table = $this->getTable();
|
||||
$db = $this->getDbo();
|
||||
$i = 0;
|
||||
|
||||
// Check that the category exists
|
||||
if ($categoryId) {
|
||||
$categoryTable = Table::getInstance('PhocaMapsMap', 'Table');
|
||||
|
||||
if (!$categoryTable->load($categoryId)) {
|
||||
if ($error = $categoryTable->getError()) {
|
||||
// Fatal error
|
||||
throw new Exception($error, 500);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_BATCH_MOVE_CATEGORY_NOT_FOUND'), 500);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if (empty($categoryId)) {
|
||||
if (!isset($categoryId)) {
|
||||
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_BATCH_MOVE_CATEGORY_NOT_FOUND'), 500);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check that the user has create permission for the component
|
||||
$extension = Factory::getApplication()->input->getCmd('option');
|
||||
$user = Factory::getUser();
|
||||
if (!$user->authorise('core.create', $extension)) {
|
||||
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_CREATE'), 500);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Parent exists so we let's proceed
|
||||
while (!empty($pks))
|
||||
{
|
||||
// Pop the first ID off the stack
|
||||
$pk = array_shift($pks);
|
||||
|
||||
$table->reset();
|
||||
|
||||
// Check that the row actually exists
|
||||
if (!$table->load($pk)) {
|
||||
if ($error = $table->getError()) {
|
||||
// Fatal error
|
||||
throw new Exception($error, 500);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
// Not fatal error
|
||||
//throw new Exception(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk), 500);
|
||||
$app->enqueueMessage(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk), 'error');
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Alter the title & alias
|
||||
$data = $this->generateNewTitle($categoryId, $table->alias, $table->title);
|
||||
$table->title = $data['0'];
|
||||
$table->alias = $data['1'];
|
||||
|
||||
// Reset the ID because we are making a copy
|
||||
$table->id = 0;
|
||||
|
||||
// Set the new category ID
|
||||
$table->catid = $categoryId;
|
||||
|
||||
// Ordering
|
||||
$table->ordering = $this->increaseOrdering($categoryId);
|
||||
|
||||
$table->hits = 0;
|
||||
|
||||
// Check the row.
|
||||
if (!$table->check()) {
|
||||
throw new Exception($table->getError(), 500);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Store the row.
|
||||
if (!$table->store()) {
|
||||
throw new Exception($table->getError(), 500);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the new item ID
|
||||
$newId = $table->get('id');
|
||||
|
||||
// Add the new ID to the array
|
||||
$newIds[$pk] = $newId;
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Clean the cache
|
||||
$this->cleanCache();
|
||||
|
||||
return $newIds;
|
||||
}
|
||||
|
||||
protected function batchMove($value, $pks, $contexts)
|
||||
{
|
||||
$categoryId = (int) $value;
|
||||
$app = Factory::getApplication();
|
||||
|
||||
$table = $this->getTable();
|
||||
//$db = $this->getDbo();
|
||||
|
||||
// Check that the category exists
|
||||
if ($categoryId) {
|
||||
$categoryTable = Table::getInstance('PhocaMapsMap', 'Table');
|
||||
if (!$categoryTable->load($categoryId)) {
|
||||
if ($error = $categoryTable->getError()) {
|
||||
// Fatal error
|
||||
throw new Exception($error, 500);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_BATCH_MOVE_CATEGORY_NOT_FOUND'), 500);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if (empty($categoryId)) {
|
||||
if (!isset($categoryId)) {
|
||||
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_BATCH_MOVE_CATEGORY_NOT_FOUND'), 500);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check that user has create and edit permission for the component
|
||||
$extension = Factory::getApplication()->input->getCmd('option');
|
||||
$user = Factory::getUser();
|
||||
if (!$user->authorise('core.create', $extension)) {
|
||||
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_CREATE'), 500);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$user->authorise('core.edit', $extension)) {
|
||||
throw new Exception(Text::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'), 500);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Parent exists so we let's proceed
|
||||
foreach ($pks as $pk)
|
||||
{
|
||||
// Check that the row actually exists
|
||||
if (!$table->load($pk)) {
|
||||
if ($error = $table->getError()) {
|
||||
// Fatal error
|
||||
throw new Exception($error, 500);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
// Not fatal error
|
||||
//throw new Exception(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
|
||||
$app->enqueueMessage(Text::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk), 'error');
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Set the new category ID
|
||||
$table->catid = $categoryId;
|
||||
|
||||
// Check the row.
|
||||
if (!$table->check()) {
|
||||
throw new Exception($table->getError(), 500);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Store the row.
|
||||
if (!$table->store()) {
|
||||
throw new Exception($table->getError(), 500);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Clean the cache
|
||||
$this->cleanCache();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function increaseOrdering($categoryId) {
|
||||
|
||||
$ordering = 1;
|
||||
$this->_db->setQuery('SELECT MAX(ordering) FROM #__phocamaps_marker WHERE catid='.(int)$categoryId);
|
||||
$max = $this->_db->loadResult();
|
||||
$ordering = $max + 1;
|
||||
return $ordering;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -0,0 +1,177 @@
|
||||
<?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\MVC\Model\ListModel;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
jimport('joomla.application.component.modellist');
|
||||
|
||||
class PhocaMapsCpModelPhocaMapsMarkers extends ListModel
|
||||
{
|
||||
protected $option = 'com_phocamaps';
|
||||
|
||||
public function __construct($config = array())
|
||||
{
|
||||
if (empty($config['filter_fields'])) {
|
||||
$config['filter_fields'] = array(
|
||||
'id', 'a.id',
|
||||
'title', 'a.title',
|
||||
'alias', 'a.alias',
|
||||
'catid', 'a.catid',
|
||||
'map_id', 'map_id',
|
||||
'checked_out', 'a.checked_out',
|
||||
'checked_out_time', 'a.checked_out_time',
|
||||
'state', 'a.state',
|
||||
'access', 'a.access', 'access_level',
|
||||
'ordering', 'a.ordering',
|
||||
'language', 'a.language',
|
||||
'hits', 'a.hits',
|
||||
'published','a.published'
|
||||
);
|
||||
}
|
||||
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
protected function populateState($ordering = NULL, $direction = NULL)
|
||||
{
|
||||
// Initialise variables.
|
||||
$app = Factory::getApplication('administrator');
|
||||
|
||||
// Load the filter state.
|
||||
$search = $app->getUserStateFromRequest($this->context.'.filter.search', 'filter_search');
|
||||
$this->setState('filter.search', $search);
|
||||
|
||||
/* $accessId = $app->getUserStateFromRequest($this->context.'.filter.access', 'filter_access', null, 'int');
|
||||
$this->setState('filter.access', $accessId);*/
|
||||
|
||||
$mapId = $app->getUserStateFromRequest($this->context.'.filter.map_id', 'filter_map_id', null, 'int');
|
||||
|
||||
$this->setState('filter.map_id', $mapId);
|
||||
|
||||
$state = $app->getUserStateFromRequest($this->context.'.filter.published', 'filter_published', '', 'string');
|
||||
$this->setState('filter.published', $state);
|
||||
|
||||
$language = $app->getUserStateFromRequest($this->context.'.filter.language', 'filter_language', '');
|
||||
$this->setState('filter.language', $language);
|
||||
|
||||
// Load the parameters.
|
||||
$params = ComponentHelper::getParams('com_phocamaps');
|
||||
$this->setState('params', $params);
|
||||
|
||||
// List state information.
|
||||
parent::populateState('a.title', 'asc');
|
||||
}
|
||||
|
||||
protected function getStoreId($id = '')
|
||||
{
|
||||
// Compile the store id.
|
||||
$id .= ':'.$this->getState('filter.search');
|
||||
//$id .= ':'.$this->getState('filter.access');
|
||||
$id .= ':'.$this->getState('filter.published');
|
||||
$id .= ':'.$this->getState('filter.marker_id');
|
||||
$id .= ':'.$this->getState('filter.map_id');
|
||||
|
||||
return parent::getStoreId($id);
|
||||
}
|
||||
|
||||
protected function getListQuery()
|
||||
{
|
||||
/*
|
||||
$query = 'SELECT a.*, u.name AS editor, cc.title AS catidname '
|
||||
.' FROM #__phocamaps_marker AS a '
|
||||
.' LEFT JOIN #__phocamaps_map AS cc ON cc.id = a.catid '
|
||||
.' LEFT JOIN #__users AS u ON u.id = a.checked_out '
|
||||
. $where
|
||||
. $orderby;
|
||||
*/
|
||||
// Create a new query object.
|
||||
$db = $this->getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Select the required fields from the table.
|
||||
$query->select(
|
||||
$this->getState(
|
||||
'list.select',
|
||||
'a.*'
|
||||
)
|
||||
);
|
||||
$query->from('`#__phocamaps_marker` AS a');
|
||||
|
||||
// Join over the language
|
||||
$query->select('l.title AS language_title');
|
||||
$query->join('LEFT', '`#__languages` AS l ON l.lang_code = a.language');
|
||||
|
||||
// Join over the users for the checked out user.
|
||||
$query->select('uc.name AS editor');
|
||||
$query->join('LEFT', '#__users AS uc ON uc.id=a.checked_out');
|
||||
|
||||
|
||||
// Filter by access level.
|
||||
/* if ($access = $this->getState('filter.access')) {
|
||||
$query->where('a.access = '.(int) $access);
|
||||
}*/
|
||||
|
||||
$query->select('c.title AS map_title, c.id AS map_id');
|
||||
$query->join('LEFT', '#__phocamaps_map AS c ON c.id = a.catid');
|
||||
|
||||
// Filter by published state.
|
||||
$published = $this->getState('filter.published');
|
||||
if (is_numeric($published)) {
|
||||
$query->where('a.published = '.(int) $published);
|
||||
}
|
||||
else if ($published === '') {
|
||||
$query->where('(a.published IN (0, 1))');
|
||||
}
|
||||
|
||||
// Filter by category.
|
||||
$mapId = $this->getState('filter.map_id');
|
||||
if (is_numeric($mapId) && (int)$mapId > 0) {
|
||||
$query->where('a.catid = ' . (int) $mapId);
|
||||
}
|
||||
|
||||
|
||||
// Filter by search in title
|
||||
$search = $this->getState('filter.search');
|
||||
if (!empty($search))
|
||||
{
|
||||
if (stripos($search, 'id:') === 0) {
|
||||
$query->where('a.id = '.(int) substr($search, 3));
|
||||
}
|
||||
else
|
||||
{
|
||||
$search = $db->Quote('%'.$db->escape($search, true).'%');
|
||||
$query->where('( a.title LIKE '.$search.' OR a.alias LIKE '.$search.')');
|
||||
}
|
||||
}
|
||||
|
||||
// Filter on the language.
|
||||
if ($language = $this->getState('filter.language')) {
|
||||
$query->where('a.language = ' . $db->quote($language));
|
||||
}
|
||||
|
||||
//$orderCol = $this->state->get('list.ordering');
|
||||
//$orderDirn = $this->state->get('list.direction');
|
||||
$orderCol = $this->state->get('list.ordering', 'title');
|
||||
$orderDirn = $this->state->get('list.direction', 'asc');
|
||||
if ($orderCol == 'a.ordering' || $orderCol == 'map_title') {
|
||||
$orderCol = 'map_title '.$orderDirn.', a.ordering';
|
||||
}
|
||||
$query->order($db->escape($orderCol.' '.$orderDirn));
|
||||
|
||||
//echo nl2br(str_replace('#__', 'jos_', $query->__toString()));
|
||||
return $query;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user