Added new filters to admin, and custom admin, and site list view. gh-651

This commit is contained in:
Llewellyn van der Merwe 2021-01-19 00:10:59 +02:00
parent 30cb1a531a
commit 60f4e8af32
Signed by: Llewellyn
GPG Key ID: EFC0C720A240551C
12 changed files with 524 additions and 21 deletions

View File

@ -147,7 +147,7 @@ TODO
+ *Version*: 2.12.5
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **292985**
+ *Line count*: **293488**
+ *Field count*: **1611**
+ *File count*: **1934**
+ *Folder count*: **322**

View File

@ -147,7 +147,7 @@ TODO
+ *Version*: 2.12.5
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **292985**
+ *Line count*: **293488**
+ *Field count*: **1611**
+ *File count*: **1934**
+ *Folder count*: **322**

View File

@ -2110,7 +2110,7 @@ abstract class ComponentbuilderHelper
// get the extension values
foreach ($extensions as $extension => $label)
{
${$extension} = self::getExtensionTypeIdSystemName($extension);
${$extension} = self::getByTypeTheIdsSystemNames($extension);
}
$xml = new DOMDocument();
@ -2151,9 +2151,9 @@ abstract class ComponentbuilderHelper
}
/**
* get extentions ids and system names
* get by type the ids and system names
**/
public static function getExtensionTypeIdSystemName($type, $limiter = null)
public static function getByTypeTheIdsSystemNames($type, $limiter = null)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
@ -2212,13 +2212,22 @@ abstract class ComponentbuilderHelper
}
/**
* get any extension field IDs
* get any area linked IDs
*/
public static function getExtensionFieldIDs($extension, $type)
public static function getAreaLinkedIDs($extension, $type)
{
// yes we use switches
switch ($type)
{
case 'joomla_component_admin_views':
return self::getComponentAdminViewsIDs($extension);
break;
case 'joomla_component_custom_admin_views':
return self::getComponentCustomAdminViewsIDs($extension);
break;
case 'joomla_component_site_views':
return self::getComponentSiteViewsIDs($extension);
break;
case 'joomla_component':
return self::getComponentFieldsIDs($extension);
break;
@ -2237,6 +2246,105 @@ abstract class ComponentbuilderHelper
}
}
/**
* get a component admin views IDs
*/
public static function getComponentAdminViewsIDs($id)
{
// get all this components views
$adminviewIds = array();
// get the views of this component
if ($addViews = self::getVar('component_admin_views', (int) $id, 'joomla_component', 'addadmin_views'))
{
if (self::checkJson($addViews))
{
$addViews = json_decode($addViews, true);
if (self::checkArray($addViews))
{
foreach($addViews as $addView)
{
if (isset($addView['adminview']))
{
$adminviewIds[(int) $addView['adminview']] = (int) $addView['adminview'];
}
}
}
}
}
// check that we have fields
if (self::checkArray($adminviewIds))
{
return array_values($adminviewIds);
}
return false;
}
/**
* get a component custom admin views IDs
*/
public static function getComponentCustomAdminViewsIDs($id)
{
// get all this components views
$adminviewIds = array();
// get the views of this component
if ($addViews = self::getVar('component_custom_admin_views', (int) $id, 'joomla_component', 'addcustom_admin_views'))
{
if (self::checkJson($addViews))
{
$addViews = json_decode($addViews, true);
if (self::checkArray($addViews))
{
foreach($addViews as $addView)
{
if (isset($addView['customadminview']))
{
$adminviewIds[(int) $addView['customadminview']] = (int) $addView['customadminview'];
}
}
}
}
}
// check that we have fields
if (self::checkArray($adminviewIds))
{
return array_values($adminviewIds);
}
return false;
}
/**
* get a component site views IDs
*/
public static function getComponentSiteViewsIDs($id)
{
// get all this components views
$adminviewIds = array();
// get the views of this component
if ($addViews = self::getVar('component_site_views', (int) $id, 'joomla_component', 'addsite_views'))
{
if (self::checkJson($addViews))
{
$addViews = json_decode($addViews, true);
if (self::checkArray($addViews))
{
foreach($addViews as $addView)
{
if (isset($addView['siteview']))
{
$adminviewIds[(int) $addView['siteview']] = (int) $addView['siteview'];
}
}
}
}
}
// check that we have fields
if (self::checkArray($adminviewIds))
{
return array_values($adminviewIds);
}
return false;
}
/**
* get a component fields IDs
*/

View File

@ -8082,6 +8082,7 @@ COM_COMPONENTBUILDER_NOT_SET="not set"
COM_COMPONENTBUILDER_NOT_TRANSLATED_IN="Not translated in"
COM_COMPONENTBUILDER_NO_ACCESS_GRANTED="No Access Granted!"
COM_COMPONENTBUILDER_NO_ADMIN_VIEWS_FOUND="No Admin Views Found"
COM_COMPONENTBUILDER_NO_COMPONENTS_FOUND="No Components Found"
COM_COMPONENTBUILDER_NO_COMPONENTS_WERE_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_AGAIN="No components were selected, please make a selection and try again!"
COM_COMPONENTBUILDER_NO_COMPONENT_DETAILS_FOUND_SO_IT_IS_NOT_SAFE_TO_CONTINUE="No component details found, so it is not safe to continue!"
COM_COMPONENTBUILDER_NO_COMPONENT_WAS_SELECTED_PLEASE_MAKE_A_SELECTION_OF_ONE_COMPONENT_AND_TRY_AGAIN="No component was selected, please make a selection of one component and try again!"
@ -8285,6 +8286,7 @@ COM_COMPONENTBUILDER_SELECT_ADMIN_VIEW="Select Admin View"
COM_COMPONENTBUILDER_SELECT_AN_OPTION="Select an option"
COM_COMPONENTBUILDER_SELECT_A_PROPERTY="Select a property"
COM_COMPONENTBUILDER_SELECT_A_SNIPPET="select a snippet"
COM_COMPONENTBUILDER_SELECT_COMPONENT="Select Component"
COM_COMPONENTBUILDER_SELECT_EXTENSION="Select Extension"
COM_COMPONENTBUILDER_SELECT_THE_COMPONENT_TO_COMPILE="Select the component to compile"
COM_COMPONENTBUILDER_SELECT_THE_COMPONENT_YOUR_WOULD_LIKE_TO_IMPORT="Select the component your would like to import."

View File

@ -42,6 +42,51 @@ class ComponentbuilderModelAdmin_views extends JModelList
}
parent::__construct($config);
}
/**
* Get the filter form - Override the parent method
*
* @param array $data data
* @param boolean $loadData load current data
*
* @return \JForm|boolean The \JForm object or false on error
*
* @since JCB 2.12.5
*/
public function getFilterForm($data = array(), $loadData = true)
{
// load form from the parent class
$form = parent::getFilterForm($data, $loadData);
// Create the "joomla_component" filter
$attributes = array(
'name' => 'joomla_component',
'type' => 'list',
'onchange' => 'this.form.submit();',
);
$options = array(
'' => '- ' . JText::_('COM_COMPONENTBUILDER_NO_COMPONENTS_FOUND') . ' -'
);
// check if we have joomla components
if (($joomla_components = ComponentbuilderHelper::getByTypeTheIdsSystemNames('joomla_component')) !== false)
{
$options = array(
'' => '- ' . JText::_('COM_COMPONENTBUILDER_SELECT_COMPONENT') . ' -'
);
// make sure we do not lose the key values in normal merge
$options = $options + $joomla_components;
}
$form->setField(ComponentbuilderHelper::getFieldXML($attributes, $options),'filter');
$form->setValue(
'joomla_component',
'filter',
$this->state->get("filter.joomla_component")
);
array_push($this->filter_fields, 'joomla_component');
return $form;
}
/**
@ -301,6 +346,25 @@ class ComponentbuilderModelAdmin_views extends JModelList
// From the componentbuilder_item table
$query->from($db->quoteName('#__componentbuilder_admin_view', 'a'));
// do not use these filters in the export method
if (!isset($_export) || !$_export)
{
// Filtering "joomla components"
$filter_joomla_component = $this->state->get("filter.joomla_component");
if ($filter_joomla_component !== null && !empty($filter_joomla_component))
{
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($filter_joomla_component, 'joomla_component_admin_views')) !== false)
{
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $ids) . ')');
}
else
{
// there is none
$query->where($db->quoteName('a.id') . ' = ' . 0);
}
}
}
// Filter by published state
$published = $this->getState('filter.published');
if (is_numeric($published))
@ -516,6 +580,25 @@ class ComponentbuilderModelAdmin_views extends JModelList
{
$query->where('a.id IN (' . implode(',',$pks) . ')');
}
// do not use these filters in the export method
if (!isset($_export) || !$_export)
{
// Filtering "joomla components"
$filter_joomla_component = $this->state->get("filter.joomla_component");
if ($filter_joomla_component !== null && !empty($filter_joomla_component))
{
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($filter_joomla_component, 'joomla_component_admin_views')) !== false)
{
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $ids) . ')');
}
else
{
// there is none
$query->where($db->quoteName('a.id') . ' = ' . 0);
}
}
}
// Implement View Level Access
if (!$user->authorise('core.options', 'com_componentbuilder'))
{

View File

@ -40,6 +40,51 @@ class ComponentbuilderModelCustom_admin_views extends JModelList
}
parent::__construct($config);
}
/**
* Get the filter form - Override the parent method
*
* @param array $data data
* @param boolean $loadData load current data
*
* @return \JForm|boolean The \JForm object or false on error
*
* @since JCB 2.12.5
*/
public function getFilterForm($data = array(), $loadData = true)
{
// load form from the parent class
$form = parent::getFilterForm($data, $loadData);
// Create the "joomla_component" filter
$attributes = array(
'name' => 'joomla_component',
'type' => 'list',
'onchange' => 'this.form.submit();',
);
$options = array(
'' => '- ' . JText::_('COM_COMPONENTBUILDER_NO_COMPONENTS_FOUND') . ' -'
);
// check if we have joomla components
if (($joomla_components = ComponentbuilderHelper::getByTypeTheIdsSystemNames('joomla_component')) !== false)
{
$options = array(
'' => '- ' . JText::_('COM_COMPONENTBUILDER_SELECT_COMPONENT') . ' -'
);
// make sure we do not lose the key values in normal merge
$options = $options + $joomla_components;
}
$form->setField(ComponentbuilderHelper::getFieldXML($attributes, $options),'filter');
$form->setValue(
'joomla_component',
'filter',
$this->state->get("filter.joomla_component")
);
array_push($this->filter_fields, 'joomla_component');
return $form;
}
/**
@ -240,6 +285,25 @@ class ComponentbuilderModelCustom_admin_views extends JModelList
// From the componentbuilder_item table
$query->from($db->quoteName('#__componentbuilder_custom_admin_view', 'a'));
// do not use these filters in the export method
if (!isset($_export) || !$_export)
{
// Filtering "joomla components"
$filter_joomla_component = $this->state->get("filter.joomla_component");
if ($filter_joomla_component !== null && !empty($filter_joomla_component))
{
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($filter_joomla_component, 'joomla_component_custom_admin_views')) !== false)
{
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $ids) . ')');
}
else
{
// there is none
$query->where($db->quoteName('a.id') . ' = ' . 0);
}
}
}
// From the componentbuilder_dynamic_get table.
$query->select($db->quoteName('g.name','main_get_name'));
$query->join('LEFT', $db->quoteName('#__componentbuilder_dynamic_get', 'g') . ' ON (' . $db->quoteName('a.main_get') . ' = ' . $db->quoteName('g.id') . ')');
@ -309,6 +373,29 @@ class ComponentbuilderModelCustom_admin_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))
@ -402,6 +489,25 @@ class ComponentbuilderModelCustom_admin_views extends JModelList
{
$query->where('a.id IN (' . implode(',',$pks) . ')');
}
// do not use these filters in the export method
if (!isset($_export) || !$_export)
{
// Filtering "joomla components"
$filter_joomla_component = $this->state->get("filter.joomla_component");
if ($filter_joomla_component !== null && !empty($filter_joomla_component))
{
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($filter_joomla_component, 'joomla_component_custom_admin_views')) !== false)
{
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $ids) . ')');
}
else
{
// there is none
$query->where($db->quoteName('a.id') . ' = ' . 0);
}
}
}
// Implement View Level Access
if (!$user->authorise('core.options', 'com_componentbuilder'))
{
@ -528,7 +634,18 @@ class ComponentbuilderModelCustom_admin_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');

View File

@ -81,7 +81,7 @@ class ComponentbuilderModelFields extends JModelList
'' => '- ' . JText::_('COM_COMPONENTBUILDER_NO_ADMIN_VIEWS_FOUND') . ' -'
);
// check if we have admin views (and limit to an extension if it is set)
if (($admin_views = ComponentbuilderHelper::getExtensionTypeIdSystemName('admin_view', $this->state->get("filter.extension"))) !== false)
if (($admin_views = ComponentbuilderHelper::getByTypeTheIdsSystemNames('admin_view', $this->state->get("filter.extension"))) !== false)
{
$options = array(
'' => '- ' . JText::_('COM_COMPONENTBUILDER_SELECT_ADMIN_VIEW') . ' -'
@ -378,7 +378,7 @@ class ComponentbuilderModelFields extends JModelList
{
// column name, and id
$type_extension = explode('__', $filter_extension);
if (($ids = ComponentbuilderHelper::getExtensionFieldIDs($type_extension[1], $type_extension[0])) !== false)
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($type_extension[1], $type_extension[0])) !== false)
{
$field_ids = $ids;
}
@ -394,7 +394,7 @@ class ComponentbuilderModelFields extends JModelList
$filter_admin_view = $this->state->get("filter.admin_view");
if ($get_ids && $filter_admin_view !== null && !empty($filter_admin_view))
{
if (($ids = ComponentbuilderHelper::getExtensionFieldIDs($filter_admin_view, 'admin_view')) !== false)
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($filter_admin_view, 'admin_view')) !== false)
{
// view will return less fields, so we ignore the component
$field_ids = $ids;
@ -643,7 +643,7 @@ class ComponentbuilderModelFields extends JModelList
{
// column name, and id
$type_extension = explode('__', $filter_extension);
if (($ids = ComponentbuilderHelper::getExtensionFieldIDs($type_extension[1], $type_extension[0])) !== false)
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($type_extension[1], $type_extension[0])) !== false)
{
$field_ids = $ids;
}
@ -659,7 +659,7 @@ class ComponentbuilderModelFields extends JModelList
$filter_admin_view = $this->state->get("filter.admin_view");
if ($get_ids && $filter_admin_view !== null && !empty($filter_admin_view))
{
if (($ids = ComponentbuilderHelper::getExtensionFieldIDs($filter_admin_view, 'admin_view')) !== false)
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($filter_admin_view, 'admin_view')) !== false)
{
// view will return less fields, so we ignore the component
$field_ids = $ids;

View File

@ -276,7 +276,7 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
{
// column name, and id
$type_extension = explode('__', $filter_extension);
if (($ids = ComponentbuilderHelper::getExtensionFieldIDs($type_extension[1], $type_extension[0])) !== false)
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($type_extension[1], $type_extension[0])) !== false)
{
$field_ids = $ids;
}
@ -292,7 +292,7 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
$filter_admin_view = $this->state->get("filter.admin_view");
if ($get_ids && $filter_admin_view !== null && !empty($filter_admin_view))
{
if (($ids = ComponentbuilderHelper::getExtensionFieldIDs($filter_admin_view, 'admin_view')) !== false)
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($filter_admin_view, 'admin_view')) !== false)
{
// view will return less fields, so we ignore the component
$field_ids = $ids;

View File

@ -34,7 +34,8 @@
type="maingets"
name="main_get"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_MAIN_GET_LABEL"
multiple="false"
class="multipleMaingets"
multiple="true"
onchange="this.form.submit();"
/>
<field

View File

@ -41,6 +41,51 @@ class ComponentbuilderModelSite_views extends JModelList
}
parent::__construct($config);
}
/**
* Get the filter form - Override the parent method
*
* @param array $data data
* @param boolean $loadData load current data
*
* @return \JForm|boolean The \JForm object or false on error
*
* @since JCB 2.12.5
*/
public function getFilterForm($data = array(), $loadData = true)
{
// load form from the parent class
$form = parent::getFilterForm($data, $loadData);
// Create the "joomla_component" filter
$attributes = array(
'name' => 'joomla_component',
'type' => 'list',
'onchange' => 'this.form.submit();',
);
$options = array(
'' => '- ' . JText::_('COM_COMPONENTBUILDER_NO_COMPONENTS_FOUND') . ' -'
);
// check if we have joomla components
if (($joomla_components = ComponentbuilderHelper::getByTypeTheIdsSystemNames('joomla_component')) !== false)
{
$options = array(
'' => '- ' . JText::_('COM_COMPONENTBUILDER_SELECT_COMPONENT') . ' -'
);
// make sure we do not lose the key values in normal merge
$options = $options + $joomla_components;
}
$form->setField(ComponentbuilderHelper::getFieldXML($attributes, $options),'filter');
$form->setValue(
'joomla_component',
'filter',
$this->state->get("filter.joomla_component")
);
array_push($this->filter_fields, 'joomla_component');
return $form;
}
/**
@ -248,6 +293,25 @@ class ComponentbuilderModelSite_views extends JModelList
// From the componentbuilder_item table
$query->from($db->quoteName('#__componentbuilder_site_view', 'a'));
// do not use these filters in the export method
if (!isset($_export) || !$_export)
{
// Filtering "joomla components"
$filter_joomla_component = $this->state->get("filter.joomla_component");
if ($filter_joomla_component !== null && !empty($filter_joomla_component))
{
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($filter_joomla_component, 'joomla_component_site_views')) !== false)
{
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $ids) . ')');
}
else
{
// there is none
$query->where($db->quoteName('a.id') . ' = ' . 0);
}
}
}
// From the componentbuilder_dynamic_get table.
$query->select($db->quoteName('g.name','main_get_name'));
$query->join('LEFT', $db->quoteName('#__componentbuilder_dynamic_get', 'g') . ' ON (' . $db->quoteName('a.main_get') . ' = ' . $db->quoteName('g.id') . ')');
@ -433,6 +497,25 @@ class ComponentbuilderModelSite_views extends JModelList
{
$query->where('a.id IN (' . implode(',',$pks) . ')');
}
// do not use these filters in the export method
if (!isset($_export) || !$_export)
{
// Filtering "joomla components"
$filter_joomla_component = $this->state->get("filter.joomla_component");
if ($filter_joomla_component !== null && !empty($filter_joomla_component))
{
if (($ids = ComponentbuilderHelper::getAreaLinkedIDs($filter_joomla_component, 'joomla_component_site_views')) !== false)
{
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $ids) . ')');
}
else
{
// there is none
$query->where($db->quoteName('a.id') . ' = ' . 0);
}
}
}
// Implement View Level Access
if (!$user->authorise('core.options', 'com_componentbuilder'))
{

View File

@ -15,6 +15,7 @@ defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.multiselect');
JHtml::_('dropdown.init');
JHtml::_('formbehavior.chosen', '.multipleMaingets', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_MAIN_GET') . ' -'));
JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_COMPONENTBUILDER_FILTER_SELECT_ACCESS') . ' -'));
JHtml::_('formbehavior.chosen', 'select');
if ($this->saveOrder)

View File

@ -2107,7 +2107,7 @@ abstract class ComponentbuilderHelper
// get the extension values
foreach ($extensions as $extension => $label)
{
${$extension} = self::getExtensionTypeIdSystemName($extension);
${$extension} = self::getByTypeTheIdsSystemNames($extension);
}
$xml = new DOMDocument();
@ -2148,9 +2148,9 @@ abstract class ComponentbuilderHelper
}
/**
* get extentions ids and system names
* get by type the ids and system names
**/
public static function getExtensionTypeIdSystemName($type, $limiter = null)
public static function getByTypeTheIdsSystemNames($type, $limiter = null)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
@ -2209,13 +2209,22 @@ abstract class ComponentbuilderHelper
}
/**
* get any extension field IDs
* get any area linked IDs
*/
public static function getExtensionFieldIDs($extension, $type)
public static function getAreaLinkedIDs($extension, $type)
{
// yes we use switches
switch ($type)
{
case 'joomla_component_admin_views':
return self::getComponentAdminViewsIDs($extension);
break;
case 'joomla_component_custom_admin_views':
return self::getComponentCustomAdminViewsIDs($extension);
break;
case 'joomla_component_site_views':
return self::getComponentSiteViewsIDs($extension);
break;
case 'joomla_component':
return self::getComponentFieldsIDs($extension);
break;
@ -2234,6 +2243,105 @@ abstract class ComponentbuilderHelper
}
}
/**
* get a component admin views IDs
*/
public static function getComponentAdminViewsIDs($id)
{
// get all this components views
$adminviewIds = array();
// get the views of this component
if ($addViews = self::getVar('component_admin_views', (int) $id, 'joomla_component', 'addadmin_views'))
{
if (self::checkJson($addViews))
{
$addViews = json_decode($addViews, true);
if (self::checkArray($addViews))
{
foreach($addViews as $addView)
{
if (isset($addView['adminview']))
{
$adminviewIds[(int) $addView['adminview']] = (int) $addView['adminview'];
}
}
}
}
}
// check that we have fields
if (self::checkArray($adminviewIds))
{
return array_values($adminviewIds);
}
return false;
}
/**
* get a component custom admin views IDs
*/
public static function getComponentCustomAdminViewsIDs($id)
{
// get all this components views
$adminviewIds = array();
// get the views of this component
if ($addViews = self::getVar('component_custom_admin_views', (int) $id, 'joomla_component', 'addcustom_admin_views'))
{
if (self::checkJson($addViews))
{
$addViews = json_decode($addViews, true);
if (self::checkArray($addViews))
{
foreach($addViews as $addView)
{
if (isset($addView['customadminview']))
{
$adminviewIds[(int) $addView['customadminview']] = (int) $addView['customadminview'];
}
}
}
}
}
// check that we have fields
if (self::checkArray($adminviewIds))
{
return array_values($adminviewIds);
}
return false;
}
/**
* get a component site views IDs
*/
public static function getComponentSiteViewsIDs($id)
{
// get all this components views
$adminviewIds = array();
// get the views of this component
if ($addViews = self::getVar('component_site_views', (int) $id, 'joomla_component', 'addsite_views'))
{
if (self::checkJson($addViews))
{
$addViews = json_decode($addViews, true);
if (self::checkArray($addViews))
{
foreach($addViews as $addView)
{
if (isset($addView['siteview']))
{
$adminviewIds[(int) $addView['siteview']] = (int) $addView['siteview'];
}
}
}
}
}
// check that we have fields
if (self::checkArray($adminviewIds))
{
return array_values($adminviewIds);
}
return false;
}
/**
* get a component fields IDs
*/