Removes the custom component field from JCB. Made some filters to be multiple selection in site & component list view. Adds the combo field more correctly to JCB.
This commit is contained in:
@ -1,57 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import the list field type
|
||||
jimport('joomla.form.helper');
|
||||
JFormHelper::loadFieldClass('list');
|
||||
|
||||
/**
|
||||
* Components Form Field class for the Componentbuilder component
|
||||
*/
|
||||
class JFormFieldComponents extends JFormFieldList
|
||||
{
|
||||
/**
|
||||
* The components field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'components';
|
||||
|
||||
/**
|
||||
* Method to get a list of options for a list input.
|
||||
*
|
||||
* @return array An array of JHtml options.
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
$db = JFactory::getDBO();
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(array('a.id','a.system_name'),array('id','components_system_name')));
|
||||
$query->from($db->quoteName('#__componentbuilder_joomla_component', 'a'));
|
||||
$query->where($db->quoteName('a.published') . ' >= 1');
|
||||
$query->order('a.system_name ASC');
|
||||
$db->setQuery((string)$query);
|
||||
$items = $db->loadObjectList();
|
||||
$options = array();
|
||||
if ($items)
|
||||
{
|
||||
foreach($items as $item)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', $item->id, $item->components_system_name);
|
||||
}
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
@ -17,16 +17,16 @@ jimport('joomla.form.helper');
|
||||
JFormHelper::loadFieldClass('list');
|
||||
|
||||
/**
|
||||
* Component Form Field class for the Componentbuilder component
|
||||
* Joomlacomponent Form Field class for the Componentbuilder component
|
||||
*/
|
||||
class JFormFieldComponent extends JFormFieldList
|
||||
class JFormFieldJoomlacomponent extends JFormFieldList
|
||||
{
|
||||
/**
|
||||
* The component field type.
|
||||
* The joomlacomponent field type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'component';
|
||||
public $type = 'joomlacomponent';
|
||||
|
||||
/**
|
||||
* Override to add new button
|
@ -35,23 +35,23 @@ class JFormFieldJoomlacomponents extends JFormFieldList
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
$db = JFactory::getDBO();
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(array('a.id','a.system_name'),array('id','joomla_component_system_name')));
|
||||
$query->from($db->quoteName('#__componentbuilder_joomla_component', 'a'));
|
||||
$query->order('a.system_name ASC');
|
||||
$db->setQuery((string)$query);
|
||||
$items = $db->loadObjectList();
|
||||
$options = array();
|
||||
if ($items)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', '', 'Select an option');
|
||||
foreach($items as $item)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', $item->id, $item->joomla_component_system_name);
|
||||
}
|
||||
}
|
||||
$db = JFactory::getDBO();
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(array('a.id','a.system_name'),array('id','components_system_name')));
|
||||
$query->from($db->quoteName('#__componentbuilder_joomla_component', 'a'));
|
||||
$query->where($db->quoteName('a.published') . ' >= 1');
|
||||
$query->order('a.system_name ASC');
|
||||
$db->setQuery((string)$query);
|
||||
$items = $db->loadObjectList();
|
||||
$options = array();
|
||||
if ($items)
|
||||
{
|
||||
foreach($items as $item)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', $item->id, $item->components_system_name);
|
||||
}
|
||||
}
|
||||
|
||||
return $options;
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,6 @@ class JFormFieldJoomlacomponentsfilterauthor extends JFormFieldList
|
||||
|
||||
$results = $db->loadColumn();
|
||||
$_filter = array();
|
||||
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_AUTHOR') . ' -');
|
||||
|
||||
if ($results)
|
||||
{
|
||||
|
@ -51,7 +51,6 @@ class JFormFieldJoomlacomponentsfiltercompanyname extends JFormFieldList
|
||||
|
||||
$results = $db->loadColumn();
|
||||
$_filter = array();
|
||||
$_filter[] = JHtml::_('select.option', '', '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_COMPANYNAME') . ' -');
|
||||
|
||||
if ($results)
|
||||
{
|
||||
|
@ -93,9 +93,9 @@
|
||||
default="componentbuilder custom_code"
|
||||
/>
|
||||
<!-- Dynamic Fields. -->
|
||||
<!-- Component Field. Type: Component. (custom) -->
|
||||
<!-- Component Field. Type: Joomlacomponent. (custom) -->
|
||||
<field
|
||||
type="component"
|
||||
type="joomlacomponent"
|
||||
name="component"
|
||||
label="COM_COMPONENTBUILDER_CUSTOM_CODE_COMPONENT_LABEL"
|
||||
class="list_class"
|
||||
|
@ -31,7 +31,7 @@
|
||||
onchange="this.form.submit();"
|
||||
/>
|
||||
<field
|
||||
type="component"
|
||||
type="joomlacomponent"
|
||||
name="component"
|
||||
label="COM_COMPONENTBUILDER_CUSTOM_CODE_COMPONENT_LABEL"
|
||||
multiple="false"
|
||||
|
@ -34,14 +34,16 @@
|
||||
type="joomlacomponentsfiltercompanyname"
|
||||
name="companyname"
|
||||
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_COMPANYNAME_LABEL"
|
||||
multiple="false"
|
||||
class="multipleJoomlacomponentsfiltercompanyname"
|
||||
multiple="true"
|
||||
onchange="this.form.submit();"
|
||||
/>
|
||||
<field
|
||||
type="joomlacomponentsfilterauthor"
|
||||
name="author"
|
||||
label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_AUTHOR_LABEL"
|
||||
multiple="false"
|
||||
class="multipleJoomlacomponentsfilterauthor"
|
||||
multiple="true"
|
||||
onchange="this.form.submit();"
|
||||
/>
|
||||
<input type="hidden" name="form_submited" value="1"/>
|
||||
|
@ -34,7 +34,8 @@
|
||||
type="maingets"
|
||||
name="main_get"
|
||||
label="COM_COMPONENTBUILDER_SITE_VIEW_MAIN_GET_LABEL"
|
||||
multiple="false"
|
||||
class="multipleMaingets"
|
||||
multiple="true"
|
||||
onchange="this.form.submit();"
|
||||
/>
|
||||
<field
|
||||
|
@ -127,9 +127,9 @@
|
||||
default="0"
|
||||
button="true"
|
||||
/>
|
||||
<!-- Components Field. Type: Components. (custom) -->
|
||||
<!-- Components Field. Type: Joomlacomponents. (custom) -->
|
||||
<field
|
||||
type="components"
|
||||
type="joomlacomponents"
|
||||
name="components"
|
||||
label="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATION_COMPONENTS_LABEL"
|
||||
class="list_class span12"
|
||||
|
@ -2284,6 +2284,29 @@ class ComponentbuilderModelJoomla_components extends JModelList
|
||||
{
|
||||
$query->where('a.companyname = ' . $db->quote($db->escape($_companyname)));
|
||||
}
|
||||
elseif (ComponentbuilderHelper::checkArray($_companyname))
|
||||
{
|
||||
// Secure the array for the query
|
||||
$_companyname = array_map( function ($val) use(&$db) {
|
||||
if (is_numeric($val))
|
||||
{
|
||||
if (is_float($val))
|
||||
{
|
||||
return (float) $val;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (int) $val;
|
||||
}
|
||||
}
|
||||
elseif (ComponentbuilderHelper::checkString($val))
|
||||
{
|
||||
return $db->quote($db->escape($val));
|
||||
}
|
||||
}, $_companyname);
|
||||
// Filter by the Companyname Array.
|
||||
$query->where('a.companyname IN (' . implode(',', $_companyname) . ')');
|
||||
}
|
||||
// Filter by Author.
|
||||
$_author = $this->getState('filter.author');
|
||||
if (is_numeric($_author))
|
||||
@ -2301,6 +2324,29 @@ class ComponentbuilderModelJoomla_components extends JModelList
|
||||
{
|
||||
$query->where('a.author = ' . $db->quote($db->escape($_author)));
|
||||
}
|
||||
elseif (ComponentbuilderHelper::checkArray($_author))
|
||||
{
|
||||
// Secure the array for the query
|
||||
$_author = array_map( function ($val) use(&$db) {
|
||||
if (is_numeric($val))
|
||||
{
|
||||
if (is_float($val))
|
||||
{
|
||||
return (float) $val;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (int) $val;
|
||||
}
|
||||
}
|
||||
elseif (ComponentbuilderHelper::checkString($val))
|
||||
{
|
||||
return $db->quote($db->escape($val));
|
||||
}
|
||||
}, $_author);
|
||||
// Filter by the Author Array.
|
||||
$query->where('a.author IN (' . implode(',', $_author) . ')');
|
||||
}
|
||||
|
||||
// Add the list ordering clause.
|
||||
$orderCol = $this->state->get('list.ordering', 'a.id');
|
||||
@ -2526,8 +2572,30 @@ class ComponentbuilderModelJoomla_components extends JModelList
|
||||
$id .= ':' . $this->getState('filter.ordering');
|
||||
$id .= ':' . $this->getState('filter.created_by');
|
||||
$id .= ':' . $this->getState('filter.modified_by');
|
||||
$id .= ':' . $this->getState('filter.companyname');
|
||||
$id .= ':' . $this->getState('filter.author');
|
||||
// Check if the value is an array
|
||||
$_companyname = $this->getState('filter.companyname');
|
||||
if (ComponentbuilderHelper::checkArray($_companyname))
|
||||
{
|
||||
$id .= ':' . implode(':', $_companyname);
|
||||
}
|
||||
// Check if this is only an number or string
|
||||
elseif (is_numeric($_companyname)
|
||||
|| ComponentbuilderHelper::checkString($_companyname))
|
||||
{
|
||||
$id .= ':' . $_companyname;
|
||||
}
|
||||
// Check if the value is an array
|
||||
$_author = $this->getState('filter.author');
|
||||
if (ComponentbuilderHelper::checkArray($_author))
|
||||
{
|
||||
$id .= ':' . implode(':', $_author);
|
||||
}
|
||||
// Check if this is only an number or string
|
||||
elseif (is_numeric($_author)
|
||||
|| ComponentbuilderHelper::checkString($_author))
|
||||
{
|
||||
$id .= ':' . $_author;
|
||||
}
|
||||
$id .= ':' . $this->getState('filter.system_name');
|
||||
$id .= ':' . $this->getState('filter.name_code');
|
||||
$id .= ':' . $this->getState('filter.short_description');
|
||||
|
@ -317,6 +317,29 @@ class ComponentbuilderModelSite_views extends JModelList
|
||||
{
|
||||
$query->where('a.main_get = ' . $db->quote($db->escape($_main_get)));
|
||||
}
|
||||
elseif (ComponentbuilderHelper::checkArray($_main_get))
|
||||
{
|
||||
// Secure the array for the query
|
||||
$_main_get = array_map( function ($val) use(&$db) {
|
||||
if (is_numeric($val))
|
||||
{
|
||||
if (is_float($val))
|
||||
{
|
||||
return (float) $val;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (int) $val;
|
||||
}
|
||||
}
|
||||
elseif (ComponentbuilderHelper::checkString($val))
|
||||
{
|
||||
return $db->quote($db->escape($val));
|
||||
}
|
||||
}, $_main_get);
|
||||
// Filter by the Main_get Array.
|
||||
$query->where('a.main_get IN (' . implode(',', $_main_get) . ')');
|
||||
}
|
||||
// Filter by Add_php_ajax.
|
||||
$_add_php_ajax = $this->getState('filter.add_php_ajax');
|
||||
if (is_numeric($_add_php_ajax))
|
||||
@ -536,7 +559,18 @@ class ComponentbuilderModelSite_views extends JModelList
|
||||
$id .= ':' . $this->getState('filter.ordering');
|
||||
$id .= ':' . $this->getState('filter.created_by');
|
||||
$id .= ':' . $this->getState('filter.modified_by');
|
||||
$id .= ':' . $this->getState('filter.main_get');
|
||||
// Check if the value is an array
|
||||
$_main_get = $this->getState('filter.main_get');
|
||||
if (ComponentbuilderHelper::checkArray($_main_get))
|
||||
{
|
||||
$id .= ':' . implode(':', $_main_get);
|
||||
}
|
||||
// Check if this is only an number or string
|
||||
elseif (is_numeric($_main_get)
|
||||
|| ComponentbuilderHelper::checkString($_main_get))
|
||||
{
|
||||
$id .= ':' . $_main_get;
|
||||
}
|
||||
$id .= ':' . $this->getState('filter.add_php_ajax');
|
||||
$id .= ':' . $this->getState('filter.add_custom_button');
|
||||
$id .= ':' . $this->getState('filter.system_name');
|
||||
|
Reference in New Issue
Block a user