Moved Core Table class to be used all over JCB.
This commit is contained in:
parent
9f5c7deec8
commit
1c7515d0f5
@ -140,14 +140,14 @@ TODO
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 13th November, 2022
|
||||
+ *Last Build*: 20th November, 2022
|
||||
+ *Version*: 3.1.12
|
||||
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
+ *Line count*: **334311**
|
||||
+ *Line count*: **334395**
|
||||
+ *Field count*: **2004**
|
||||
+ *File count*: **2183**
|
||||
+ *Folder count*: **381**
|
||||
+ *File count*: **2186**
|
||||
+ *Folder count*: **382**
|
||||
|
||||
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com).
|
||||
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||
|
@ -140,14 +140,14 @@ TODO
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 13th November, 2022
|
||||
+ *Last Build*: 20th November, 2022
|
||||
+ *Version*: 3.1.12
|
||||
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
+ *Line count*: **334311**
|
||||
+ *Line count*: **334395**
|
||||
+ *Field count*: **2004**
|
||||
+ *File count*: **2183**
|
||||
+ *Folder count*: **381**
|
||||
+ *File count*: **2186**
|
||||
+ *Folder count*: **382**
|
||||
|
||||
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com).
|
||||
> Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||
|
@ -613,6 +613,10 @@ const buttonUpdateAllStyleDisplay = async (value) => {
|
||||
* JS Function to execute (A) on search/replace text change , (B) on search options changes
|
||||
*/
|
||||
const startSearch = (field, forced = false) => {
|
||||
// check if we have an Enter click
|
||||
if (field && typeof field.code !== 'undefined' && field.code === "Enter") {
|
||||
forced = true;
|
||||
}
|
||||
// get replace value if set
|
||||
const replaceValue = replaceObject.value;
|
||||
if (replaceValue.length > 0) {
|
||||
|
@ -329,8 +329,8 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
tableLengthObject = document.getElementById("search_results_table_length");
|
||||
|
||||
showSearch();
|
||||
<?php if (strlen($this->urlvalues['search_value']) > 2): ?>
|
||||
startSearch();
|
||||
<?php if (strlen($this->urlvalues['search_value']) > 0): ?>
|
||||
startSearch(null, true);
|
||||
<?php endif; ?>
|
||||
});
|
||||
</script>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="component" version="4" method="upgrade">
|
||||
<name>COM_COMPONENTBUILDER</name>
|
||||
<creationDate>13th November, 2022</creationDate>
|
||||
<creationDate>20th November, 2022</creationDate>
|
||||
<author>Llewellyn van der Merwe</author>
|
||||
<authorEmail>joomla@vdm.io</authorEmail>
|
||||
<authorUrl>https://dev.vdm.io</authorUrl>
|
||||
|
@ -29,11 +29,11 @@ abstract class BaseRegistry extends JoomlaRegistry implements \JsonSerializable,
|
||||
*
|
||||
* @param string $path Registry path (e.g. joomla.content.showauthor)
|
||||
*
|
||||
* @return \ArrayIterator This object represented as an ArrayIterator.
|
||||
* @return \ArrayIterator|null This object represented as an ArrayIterator.
|
||||
*
|
||||
* @since 3.4.0
|
||||
*/
|
||||
public function _($path)
|
||||
public function _(string $path): ?\ArrayIterator
|
||||
{
|
||||
$data = $this->extract($path);
|
||||
|
||||
|
@ -23,6 +23,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Service\Power;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Service\Component;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Service\Extension;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Service\Field;
|
||||
use VDM\Joomla\Componentbuilder\Interfaces\Factoryinterface;
|
||||
|
||||
|
||||
/**
|
||||
@ -30,7 +31,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Service\Field;
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
abstract class Factory
|
||||
abstract class Factory implements Factoryinterface
|
||||
{
|
||||
/**
|
||||
* Global Compiler Container
|
||||
|
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/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
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Interfaces;
|
||||
|
||||
|
||||
use Joomla\DI\Container;
|
||||
|
||||
|
||||
/**
|
||||
* The Basic Factory Interface
|
||||
*/
|
||||
interface Factoryinterface
|
||||
{
|
||||
/**
|
||||
* Get any class from the compiler container
|
||||
*
|
||||
* @param string $key The container class key
|
||||
*
|
||||
* @return Mixed
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public static function _(string $key);
|
||||
|
||||
/**
|
||||
* Get a the global compiler container
|
||||
*
|
||||
* @return Container
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public static function getContainer(): Container;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,89 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/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
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Interfaces;
|
||||
|
||||
|
||||
/**
|
||||
* The Table Interface
|
||||
*/
|
||||
interface Tableinterface
|
||||
{
|
||||
/**
|
||||
* Get any value from a item/field/column of an area/view/table
|
||||
* Example: $this->get('table_name', 'field_name', 'value_key');
|
||||
* Get an item/field/column of an area/view/table
|
||||
* Example: $this->get('table_name', 'field_name');
|
||||
* Get all items/fields/columns of an area/view/table
|
||||
* Example: $this->get('table_name');
|
||||
* Get all areas/views/tables with all their item/field/column details
|
||||
* Example: $this->get();
|
||||
*
|
||||
* @param string $table The table
|
||||
* @param string|null $field The field
|
||||
* @param string|null $key The value key
|
||||
*
|
||||
* @return mixed
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get(string $table, ?string $field = null, ?string $key = null);
|
||||
|
||||
/**
|
||||
* Get title field from an area/view/table
|
||||
*
|
||||
* @param string|null $table The area
|
||||
*
|
||||
* @return ?array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function title(string $table): ?array;
|
||||
|
||||
/**
|
||||
* Get title field name
|
||||
*
|
||||
* @param string|null $table The area
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function titleName(string $table): string;
|
||||
|
||||
/**
|
||||
* Get all tables
|
||||
*
|
||||
* @return array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function tables(): array;
|
||||
|
||||
/**
|
||||
* Check if a table (and field) exist
|
||||
*
|
||||
* @param string|null $table The area
|
||||
* @param string|null $field The area
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function exist(string $table, ?string $field = null): bool;
|
||||
|
||||
/**
|
||||
* Get all fields of an area/view/table
|
||||
*
|
||||
* @param string|null $table The area
|
||||
*
|
||||
* @return ?array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function fields(string $table): ?array;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
@ -16,7 +16,7 @@ use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Componentbuilder\Search\Factory;
|
||||
use VDM\Joomla\Componentbuilder\Search\Config;
|
||||
use VDM\Joomla\Componentbuilder\Search\Table;
|
||||
use VDM\Joomla\Componentbuilder\Table;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -21,7 +21,7 @@ use VDM\Joomla\Componentbuilder\Search\Agent\Find;
|
||||
use VDM\Joomla\Componentbuilder\Search\Agent\Replace;
|
||||
use VDM\Joomla\Componentbuilder\Search\Agent\Search;
|
||||
use VDM\Joomla\Componentbuilder\Search\Agent\Update;
|
||||
use VDM\Joomla\Componentbuilder\Search\Table;
|
||||
use VDM\Joomla\Componentbuilder\Table;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -15,7 +15,7 @@ namespace VDM\Joomla\Componentbuilder\Search\Database;
|
||||
use Joomla\CMS\Factory as JoomlaFactory;
|
||||
use VDM\Joomla\Componentbuilder\Search\Factory;
|
||||
use VDM\Joomla\Componentbuilder\Search\Config;
|
||||
use VDM\Joomla\Componentbuilder\Search\Table;
|
||||
use VDM\Joomla\Componentbuilder\Table;
|
||||
use VDM\Joomla\Componentbuilder\Search\Model\Get as Model;
|
||||
use VDM\Joomla\Componentbuilder\Search\Interfaces\GetInterface;
|
||||
|
||||
|
@ -15,7 +15,7 @@ namespace VDM\Joomla\Componentbuilder\Search\Database;
|
||||
use Joomla\CMS\Factory as JoomlaFactory;
|
||||
use VDM\Joomla\Componentbuilder\Search\Factory;
|
||||
use VDM\Joomla\Componentbuilder\Search\Config;
|
||||
use VDM\Joomla\Componentbuilder\Search\Table;
|
||||
use VDM\Joomla\Componentbuilder\Table;
|
||||
use VDM\Joomla\Componentbuilder\Search\Model\Set as Model;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Componentbuilder\Search\Interfaces\SetInterface;
|
||||
|
@ -17,6 +17,7 @@ use VDM\Joomla\Componentbuilder\Search\Service\Search;
|
||||
use VDM\Joomla\Componentbuilder\Search\Service\Model;
|
||||
use VDM\Joomla\Componentbuilder\Search\Service\Database;
|
||||
use VDM\Joomla\Componentbuilder\Search\Service\Agent;
|
||||
use VDM\Joomla\Componentbuilder\Interfaces\Factoryinterface;
|
||||
|
||||
|
||||
/**
|
||||
@ -24,7 +25,7 @@ use VDM\Joomla\Componentbuilder\Search\Service\Agent;
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
abstract class Factory
|
||||
abstract class Factory implements Factoryinterface
|
||||
{
|
||||
/**
|
||||
* Global Compiler Container
|
||||
@ -42,7 +43,7 @@ abstract class Factory
|
||||
* @return Mixed
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public static function _($key)
|
||||
public static function _(string $key)
|
||||
{
|
||||
return self::getContainer()->get($key);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ namespace VDM\Joomla\Componentbuilder\Search\Service;
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use VDM\Joomla\Componentbuilder\Search\Config;
|
||||
use VDM\Joomla\Componentbuilder\Search\Table;
|
||||
use VDM\Joomla\Componentbuilder\Table;
|
||||
use VDM\Joomla\Componentbuilder\Search\Interfaces\SearchTypeInterface as SearchEngine;
|
||||
use VDM\Joomla\Componentbuilder\Search\Engine\Regex;
|
||||
use VDM\Joomla\Componentbuilder\Search\Engine\Basic;
|
||||
@ -85,9 +85,7 @@ class Search implements ServiceProviderInterface
|
||||
*/
|
||||
public function getTable(Container $container): Table
|
||||
{
|
||||
return new Table(
|
||||
$container->get('Config')
|
||||
);
|
||||
return new Table();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -9,22 +9,21 @@
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Search;
|
||||
namespace VDM\Joomla\Componentbuilder;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Search\Factory;
|
||||
use VDM\Joomla\Componentbuilder\Search\Config;
|
||||
use VDM\Joomla\Componentbuilder\Interfaces\Tableinterface;
|
||||
|
||||
|
||||
/**
|
||||
* Search Table
|
||||
* JCB Tables
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Table
|
||||
class Table implements Tableinterface
|
||||
{
|
||||
/**
|
||||
* All areas/views/tables with their field details to SEARCH
|
||||
* All areas/views/tables with their field details
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
@ -2832,26 +2831,6 @@ class Table
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Search Config
|
||||
*
|
||||
* @var Config
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Config|null $config The search config object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Config $config = null)
|
||||
{
|
||||
$this->config = $config ?: Factory::_('Config');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get any value from a item/field/column of an area/view/table
|
||||
* Example: $this->get('table_name', 'field_name', 'value_key');
|
||||
@ -2860,23 +2839,17 @@ class Table
|
||||
* Get all items/fields/columns of an area/view/table
|
||||
* Example: $this->get('table_name');
|
||||
* Get all areas/views/tables with all their item/field/column details
|
||||
* Example: $this->get();
|
||||
* Example: $this->get('All');
|
||||
*
|
||||
* @param string|null $table The table
|
||||
* @param string $table The table
|
||||
* @param string|null $field The field
|
||||
* @param string|null $key The value key
|
||||
*
|
||||
* @return mixed
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function get(?string $table = null, ?string $field = null, ?string $key = null)
|
||||
public function get(string $table, ?string $field = null, ?string $key = null)
|
||||
{
|
||||
// load the table
|
||||
if (empty($table) && is_string($field))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
// return the item/field/column of an area/view/table
|
||||
if (is_string($field) && is_string($key))
|
||||
{
|
||||
@ -2897,7 +2870,7 @@ class Table
|
||||
return null;
|
||||
}
|
||||
// return an area/view/table
|
||||
elseif (is_string($table))
|
||||
elseif ($table !== 'All')
|
||||
{
|
||||
if (isset($this->tables[$table]))
|
||||
{
|
||||
@ -2913,19 +2886,13 @@ class Table
|
||||
/**
|
||||
* Get title field from an area/view/table
|
||||
*
|
||||
* @param string|null $table The area
|
||||
* @param string $table The area
|
||||
*
|
||||
* @return ?array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function title(?string $table = null): ?array
|
||||
public function title(string $table): ?array
|
||||
{
|
||||
// load the table
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
// return the title item/field/column of an area/view/table
|
||||
if (($table = $this->get($table)) !== null)
|
||||
{
|
||||
@ -2945,19 +2912,13 @@ class Table
|
||||
/**
|
||||
* Get title field name
|
||||
*
|
||||
* @param string|null $table The area
|
||||
* @param string $table The area
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function titleName(?string $table = null): string
|
||||
public function titleName(string $table): string
|
||||
{
|
||||
// load the table
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
// return the title name of an area/view/table
|
||||
if (($field = $this->title($table)) !== null)
|
||||
{
|
||||
@ -2983,21 +2944,15 @@ class Table
|
||||
/**
|
||||
* Check if a table (and field) exist
|
||||
*
|
||||
* @param string|null $table The area
|
||||
* @param string $table The area
|
||||
* @param string|null $field The area
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function exist(?string $table = null, ?string $field = null): bool
|
||||
public function exist(string $table, ?string $field = null): bool
|
||||
{
|
||||
// load the table
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
if (is_string($table) && isset($this->tables[$table]))
|
||||
if (isset($this->tables[$table]))
|
||||
{
|
||||
// if we have a field
|
||||
if (is_string($field))
|
||||
@ -3019,19 +2974,13 @@ class Table
|
||||
/**
|
||||
* Get all fields of an area/view/table
|
||||
*
|
||||
* @param string|null $table The area
|
||||
* @param string $table The area
|
||||
*
|
||||
* @return ?array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function fields(?string $table = null): ?array
|
||||
public function fields(string $table): ?array
|
||||
{
|
||||
// load the table
|
||||
if (empty($table))
|
||||
{
|
||||
$table = $this->config->table_name;
|
||||
}
|
||||
|
||||
// return all fields of an area/view/table
|
||||
if (($table = $this->get($table)) !== null)
|
||||
{
|
Loading…
Reference in New Issue
Block a user