Merge pull request 'Update' (#1) from ohrionmartin/subform-power:master into master

Reviewed-on: #1
This commit is contained in:
2024-08-20 12:35:09 +00:00
93 changed files with 859 additions and 299 deletions

8
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

8
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/subform-power.iml" filepath="$PROJECT_DIR$/.idea/subform-power.iml" />
</modules>
</component>
</project>

22
.idea/php.xml generated Normal file
View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MessDetectorOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PHPCSFixerOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PHPCodeSnifferOptionsConfiguration">
<option name="highlightLevel" value="WARNING" />
<option name="transferred" value="true" />
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="7.4">
<option name="suggestChangeDefaultLanguageLevel" value="false" />
</component>
<component name="PhpStanOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PsalmOptionsConfiguration">
<option name="transferred" value="true" />
</component>
</project>

8
.idea/subform-power.iml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@@ -1,4 +1,4 @@
# Subform Power (1.0.0)
# Subform Power (1.0.1)
Demonstration of subform super power
@@ -8,38 +8,38 @@ Demonstration of subform super power
+ *Author*: [Oh Martin](mailto:oh@nampharm.com.na)
+ *Name*: [Subform Power](https://nampharm.com.na)
+ *First Build*: 24th May, 2024
+ *Last Build*: 28th June, 2024
+ *Version*: 1.0.0
+ *Last Build*: 20th August, 2024
+ *Version*: 1.0.1
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
## Build Time
**69 Hours** or **9 Eight Hour Days** (actual time the author saved -
**71 Hours** or **9 Eight Hour Days** (actual time the author saved -
due to [Automated Component Builder](https://www.joomlacomponentbuilder.com))
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> never making one mistake or taking any coffee break.)
+ *Line count*: **24593**
+ *File count*: **229**
+ *Folder count*: **78**
+ *Line count*: **25284**
+ *File count*: **234**
+ *Folder count*: **81**
**45 Hours** or **5 Eight Hour Days** (the actual time the author spent)
**46 Hours** or **6 Eight Hour Days** (the actual time the author spent)
> (with the following break down:
> **debugging @17hours** = codingtime / 4;
> **debugging @18hours** = codingtime / 4;
> **planning @10hours** = codingtime / 7;
> **mapping @7hours** = codingtime / 10;
> **office @11hours** = codingtime / 6;)
> **office @12hours** = codingtime / 6;)
**114 Hours** or **14 Eight Hour Days**
**117 Hours** or **15 Eight Hour Days**
(a total of the realistic time frame for this project)
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> with the normal everyday realities at the office, that includes the component planning, mapping & debugging.)
Project duration: **2.8 weeks** or **0.6 months**
Project duration: **3 weeks** or **0.6 months**
> This **component** was build with a Joomla [Automated Component Builder](https://www.joomlacomponentbuilder.com).
> Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io)

View File

@@ -0,0 +1,65 @@
<?php
/*----------------------------------------------------------------------------------| www.vdm.io |----/
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage SubformpowerInstallerPowerloader.php
@author Oh Martin <https://nampharm.com.na>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die;
// register additional namespace
spl_autoload_register(function ($class) {
// project-specific base directories and namespace prefix
$search = [
'libraries/jcb_powers/JCB.Joomla' => 'JCB\\Joomla'
];
// Start the search and load if found
$found = false;
$found_base_dir = "";
$found_len = 0;
foreach ($search as $base_dir => $prefix)
{
// does the class use the namespace prefix?
$len = strlen($prefix);
if (strncmp($prefix, $class, $len) === 0)
{
// we have a match so load the values
$found = true;
$found_base_dir = $base_dir;
$found_len = $len;
// done here
break;
}
}
// check if we found a match
if (!$found)
{
// not found so move to the next registered autoloader
return;
}
// get the relative class name
$relative_class = substr($class, $found_len);
// replace the namespace prefix with the base directory, replace namespace
// separators with directory separators in the relative class name, append
// with .php
$file = __DIR__ . '/' . $found_base_dir . '/src' . str_replace('\\', '/', $relative_class) . '.php';
// if the file exists, require it
if (file_exists($file))
{
require $file;
}
});

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage SubformpowerInstallerScript.php
@@ -23,7 +23,6 @@ use Joomla\CMS\Language\Text;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Installer\InstallerAdapter;
use Joomla\CMS\Installer\InstallerScriptInterface;
use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Log\Log;
use Joomla\CMS\Version;
use Joomla\CMS\HTML\HTMLHelper as Html;
@@ -43,7 +42,6 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
/**
* The CMS Application.
*
* @var CMSApplication
* @since 4.4.2
*/
protected $app;
@@ -58,7 +56,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
/**
* The version number of the extension.
*
* @var string
* @var string
* @since 3.6
*/
protected $release;
@@ -66,7 +64,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
/**
* The table the parameters are stored in.
*
* @var string
* @var string
* @since 3.6
*/
protected $paramTable;
@@ -74,7 +72,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
/**
* The extension name. This should be set in the installer script.
*
* @var string
* @var string
* @since 3.6
*/
protected $extension;
@@ -82,7 +80,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
/**
* A list of files to be deleted
*
* @var array
* @var array
* @since 3.6
*/
protected $deleteFiles = [];
@@ -90,7 +88,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
/**
* A list of folders to be deleted
*
* @var array
* @var array
* @since 3.6
*/
protected $deleteFolders = [];
@@ -98,7 +96,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
/**
* A list of CLI script files to be copied to the cli directory
*
* @var array
* @var array
* @since 3.6
*/
protected $cliScriptFiles = [];
@@ -106,7 +104,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
/**
* Minimum PHP version required to install the extension
*
* @var string
* @var string
* @since 3.6
*/
protected $minimumPhp;
@@ -114,7 +112,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
/**
* Minimum Joomla! version required to install the extension
*
* @var string
* @var string
* @since 3.6
*/
protected $minimumJoomla;
@@ -168,7 +166,6 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
* @param InstallerAdapter $adapter The adapter calling this method
*
* @return boolean True on success
*
* @since 4.2.0
*/
public function install(InstallerAdapter $adapter): bool {return true;}
@@ -190,7 +187,6 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
* @param InstallerAdapter $adapter The adapter calling this method
*
* @return boolean True on success
*
* @since 4.2.0
*/
public function uninstall(InstallerAdapter $adapter): bool
@@ -226,7 +222,6 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
* @param InstallerAdapter $adapter The adapter calling this method
*
* @return boolean True on success
*
* @since 4.2.0
*/
public function preflight(string $type, InstallerAdapter $adapter): bool
@@ -271,7 +266,6 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
* @param InstallerAdapter $adapter The adapter calling this method
*
* @return boolean True on success
*
* @since 4.2.0
*/
public function postflight(string $type, InstallerAdapter $adapter): bool
@@ -311,11 +305,11 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
// rules
'',
// fieldMappings
'{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","symbol":"symbol","country":"country","guid":"guid"}}',
'{"common": {"core_content_item_id": "id","core_title": "ext_number","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"ext_number":"ext_number","symbol":"symbol","country":"country","guid":"guid"}}',
// router
'',
// contentHistoryOptions
'{"formFile": "administrator/components/com_subformpower/forms/currency.xml","hideFields": ["asset_id","checked_out","checked_out_time"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "country","targetTable": "#__subformpower_country","targetColumn": "guid","displayColumn": "name"}]}'
'{"formFile": "administrator/components/com_subformpower/forms/currency.xml","hideFields": ["asset_id","checked_out","checked_out_time"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits","ext_number"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "country","targetTable": "#__subformpower_country","targetColumn": "guid","displayColumn": "name"}]}'
);
@@ -364,11 +358,11 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
// rules
'',
// fieldMappings
'{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","symbol":"symbol","country":"country","guid":"guid"}}',
'{"common": {"core_content_item_id": "id","core_title": "ext_number","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"ext_number":"ext_number","symbol":"symbol","country":"country","guid":"guid"}}',
// router
'',
// contentHistoryOptions
'{"formFile": "administrator/components/com_subformpower/forms/currency.xml","hideFields": ["asset_id","checked_out","checked_out_time"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "country","targetTable": "#__subformpower_country","targetColumn": "guid","displayColumn": "name"}]}'
'{"formFile": "administrator/components/com_subformpower/forms/currency.xml","hideFields": ["asset_id","checked_out","checked_out_time"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","version","hits","ext_number"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "country","targetTable": "#__subformpower_country","targetColumn": "guid","displayColumn": "name"}]}'
);
@@ -376,7 +370,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
echo '<div style="background-color: #fff;" class="alert alert-info"><a target="_blank" href="https://nampharm.com.na" title="Subform Power">
<img src="components/com_subformpower/assets/images/vdm-component.jpg"/>
</a>
<h3>Upgrade to Version 1.0.0 Was Successful! Let us know if anything is not working as expected.</h3></div>';
<h3>Upgrade to Version 1.0.1 Was Successful! Let us know if anything is not working as expected.</h3></div>';
}
// move CLI files
@@ -388,11 +382,84 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
return true;
}
/**
* Remove folders with files (with ignore options)
*
* @param string $dir The path to the folder to remove.
* @param array|null $ignore The folders and files to ignore and not remove.
*
* @return bool True if all specified files/folders are removed, false otherwise.
* @since 3.2.2
*/
protected function removeFolder(string $dir, ?array $ignore = null): bool
{
if (!is_dir($dir))
{
return false;
}
$it = new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS);
$it = new \RecursiveIteratorIterator($it, \RecursiveIteratorIterator::CHILD_FIRST);
// Remove trailing slash
$dir = rtrim($dir, '/');
foreach ($it as $file)
{
$filePath = $file->getPathname();
$relativePath = str_replace($dir . '/', '', $filePath);
if ($ignore !== null && in_array($relativePath, $ignore, true))
{
continue;
}
if ($file->isDir())
{
Folder::delete($filePath);
}
else
{
File::delete($filePath);
}
}
// Delete the root folder if there are no ignored files/folders left
if ($ignore === null || $this->isDirEmpty($dir, $ignore))
{
return Folder::delete($dir);
}
return true;
}
/**
* Check if a directory is empty considering ignored files/folders.
*
* @param string $dir The path to the folder to check.
* @param array $ignore The folders and files to ignore.
*
* @return bool True if the directory is empty or contains only ignored items, false otherwise.
* @since 3.2.1
*/
protected function isDirEmpty(string $dir, array $ignore): bool
{
$it = new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS);
foreach ($it as $file)
{
$relativePath = str_replace($dir . '/', '', $file->getPathname());
if (!in_array($relativePath, $ignore, true))
{
return false;
}
}
return true;
}
/**
* Remove the files and folders in the given array from
*
* @return void
*
* @since 3.6
*/
protected function removeFiles()
@@ -424,7 +491,6 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
* Moves the CLI scripts into the CLI folder in the CMS
*
* @return void
*
* @since 3.6
*/
protected function moveCliFiles()
@@ -455,7 +521,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
* @param string $contentHistoryOptions
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function setContentType(
string $typeTitle,
@@ -517,7 +583,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
* @param string $textPrefix
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function setActionLogConfig(
string $typeTitle,
@@ -570,7 +636,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
* Set action logs extensions integration
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function setActionLogsExtensions(): void
{
@@ -611,7 +677,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
* @param string $rules The component rules
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function setAssetsRules(string $rules): void
{
@@ -649,7 +715,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
* @param string $params The component rules
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function setExtensionsParams(string $params): void
{
@@ -692,7 +758,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
* @param string $dataType This datatype we will change the rules column to if it to small.
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function setDatabaseAssetsRulesFix(int $accessWorseCase, string $dataType): void
{
@@ -727,7 +793,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
* @param bool $fields The switch to also remove related field data
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeViewData(string $context, bool $fields = false): void
{
@@ -750,7 +816,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
* @param string $context The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeContentTypes(string $context): void
{
@@ -807,7 +873,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
* @param string $context The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeFields(string $context): void
{
@@ -869,7 +935,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
* @param array $ids The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeFieldsValues(string $context, array $ids): void
{
@@ -900,7 +966,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
* @param string $context The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeFieldsGroups(string $context): void
{
@@ -955,7 +1021,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
* @param string $context The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeViewHistory(string $context): void
{
@@ -987,7 +1053,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
* @param array $ids The type ids
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeUcmBase(array $ids): void
{
@@ -1020,7 +1086,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
* @param string $context The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeUcmContent(string $context): void
{
@@ -1052,7 +1118,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
* @param string $context The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeContentItemTagMap(string $context): void
{
@@ -1087,7 +1153,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
* @param string $context The view context
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeActionLogConfig(string $context): void
{
@@ -1117,7 +1183,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
* Remove Asset Table Integrated
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeAssetData(): void
{
@@ -1145,7 +1211,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
* Remove action logs extensions integrated
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeActionLogsExtensions(): void
{
@@ -1175,7 +1241,7 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
* Remove remove database fix (if possible)
*
* @return void
* @since 4.4.2
* @since 4.4.2
*/
protected function removeDatabaseAssetsRulesFix(): void
{
@@ -1206,6 +1272,44 @@ class Com_SubformpowerInstallerScript implements InstallerScriptInterface
}
}
/**
* Ensures that a class in the namespace is available.
* If the class is not already loaded, it attempts to load it via the specified autoloader.
*
* @param string $className The fully qualified name of the class to check.
*
* @return bool True if the class exists or was successfully loaded, false otherwise.
* @since 4.0.1
*/
protected function classExists(string $className): bool
{
if (class_exists($className, true))
{
return true;
}
// Autoloaders to check
$autoloaders = [
__DIR__ . '/SubformpowerInstallerPowerloader.php',
JPATH_ADMINISTRATOR . '/components/com_subformpower/src/Helper/PowerloaderHelper.php'
];
foreach ($autoloaders as $autoloader)
{
if (file_exists($autoloader))
{
require_once $autoloader;
if (class_exists($className, true))
{
return true;
}
}
}
return false;
}
/**
* Method to move folders into place.
*

View File

@@ -1,4 +1,4 @@
# Subform Power (1.0.0)
# Subform Power (1.0.1)
Demonstration of subform super power
@@ -8,38 +8,38 @@ Demonstration of subform super power
+ *Author*: [Oh Martin](mailto:oh@nampharm.com.na)
+ *Name*: [Subform Power](https://nampharm.com.na)
+ *First Build*: 24th May, 2024
+ *Last Build*: 28th June, 2024
+ *Version*: 1.0.0
+ *Last Build*: 20th August, 2024
+ *Version*: 1.0.1
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
## Build Time
**69 Hours** or **9 Eight Hour Days** (actual time the author saved -
**71 Hours** or **9 Eight Hour Days** (actual time the author saved -
due to [Automated Component Builder](https://www.joomlacomponentbuilder.com))
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> never making one mistake or taking any coffee break.)
+ *Line count*: **24593**
+ *File count*: **229**
+ *Folder count*: **78**
+ *Line count*: **25284**
+ *File count*: **234**
+ *Folder count*: **81**
**45 Hours** or **5 Eight Hour Days** (the actual time the author spent)
**46 Hours** or **6 Eight Hour Days** (the actual time the author spent)
> (with the following break down:
> **debugging @17hours** = codingtime / 4;
> **debugging @18hours** = codingtime / 4;
> **planning @10hours** = codingtime / 7;
> **mapping @7hours** = codingtime / 10;
> **office @11hours** = codingtime / 6;)
> **office @12hours** = codingtime / 6;)
**114 Hours** or **14 Eight Hour Days**
**117 Hours** or **15 Eight Hour Days**
(a total of the realistic time frame for this project)
> (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**,
> with the normal everyday realities at the office, that includes the component planning, mapping & debugging.)
Project duration: **2.8 weeks** or **0.6 months**
Project duration: **3 weeks** or **0.6 months**
> This **component** was build with a Joomla [Automated Component Builder](https://www.joomlacomponentbuilder.com).
> Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io)

View File

@@ -2,8 +2,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage admin.css

View File

@@ -2,8 +2,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage countries.css

View File

@@ -2,8 +2,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage country.css

View File

@@ -2,8 +2,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage currencies.css

View File

@@ -2,8 +2,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage currency.css

View File

@@ -2,8 +2,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage dashboard.css

View File

@@ -2,8 +2,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage admin.js

View File

@@ -69,6 +69,41 @@
class="readonly"
/>
</fieldset>
<fieldset
name="export_text_only_config"
label="COM_SUBFORMPOWER_CONFIG_EXPORT_TEXT_ONLY_TAB_LABEL"
description="COM_SUBFORMPOWER_CONFIG_EXPORT_TEXT_ONLY_TAB_DESCRIPTION">
<!-- Export Text Only Field. Type: Radio. (joomla) -->
<field
type="radio"
name="export_text_only"
label="COM_SUBFORMPOWER_CONFIG_EXPORT_TEXT_ONLY_LABEL"
description="COM_SUBFORMPOWER_CONFIG_EXPORT_TEXT_ONLY_DESCRIPTION"
class="btn-group btn-group-yesno"
default="0">
<!-- Option Set. -->
<option value="1">
COM_SUBFORMPOWER_CONFIG_ACTIVATE</option>
<option value="0">
COM_SUBFORMPOWER_CONFIG_DEACTIVATE</option>
</field>
<!-- Strict_permission_per_field Field. Type: Radio. (joomla) -->
<field
type="radio"
name="strict_permission_per_field"
label="COM_SUBFORMPOWER_CONFIG_STRICT_PERMISSION_PER_FIELD_LABEL"
description="COM_SUBFORMPOWER_CONFIG_STRICT_PERMISSION_PER_FIELD_DESCRIPTION"
class="btn-group btn-group-yesno"
default="1">
<!-- Option Set. -->
<option value="1">
COM_SUBFORMPOWER_CONFIG_ACTIVATE</option>
<option value="0">
COM_SUBFORMPOWER_CONFIG_DEACTIVATE</option>
</field>
</fieldset>
<fieldset
name="permissions"
label="JCONFIG_PERMISSIONS_LABEL"

View File

@@ -189,15 +189,15 @@
default="0"
filter="STRING"
/>
<!-- Name Field. Type: Text. (joomla) -->
<!-- Ext_number Field. Type: Number. (joomla) -->
<field
type="text"
name="name"
label="COM_SUBFORMPOWER_COUNTRY_NAME_LABEL"
default=""
description="COM_SUBFORMPOWER_COUNTRY_NAME_DESCRIPTION"
message="COM_SUBFORMPOWER_COUNTRY_NAME_MESSAGE"
hint="COM_SUBFORMPOWER_COUNTRY_NAME_HINT"
type="number"
name="ext_number"
label="COM_SUBFORMPOWER_COUNTRY_EXT_NUMBER_LABEL"
default="9000"
min="1"
max="40"
step="5"
/>
<!-- Symbol Field. Type: Text. (joomla) -->
<field

View File

@@ -97,15 +97,15 @@
default="subformpower currency"
/>
<!-- Dynamic Fields. -->
<!-- Name Field. Type: Text. (joomla) -->
<!-- Ext_number Field. Type: Number. (joomla) -->
<field
type="text"
name="name"
label="COM_SUBFORMPOWER_CURRENCY_NAME_LABEL"
default=""
description="COM_SUBFORMPOWER_CURRENCY_NAME_DESCRIPTION"
message="COM_SUBFORMPOWER_CURRENCY_NAME_MESSAGE"
hint="COM_SUBFORMPOWER_CURRENCY_NAME_HINT"
type="number"
name="ext_number"
label="COM_SUBFORMPOWER_CURRENCY_EXT_NUMBER_LABEL"
default="9000"
min="1"
max="40"
step="5"
/>
<!-- Symbol Field. Type: Text. (joomla) -->
<field

View File

@@ -84,6 +84,7 @@ COM_SUBFORMPOWER_COUNTRY_DETAILS="Details"
COM_SUBFORMPOWER_COUNTRY_EDIT="Editing the Country"
COM_SUBFORMPOWER_COUNTRY_ERROR_UNIQUE_ALIAS="Another Country has the same alias."
COM_SUBFORMPOWER_COUNTRY_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Country has the same alias ."
COM_SUBFORMPOWER_COUNTRY_EXT_NUMBER_LABEL="Extension"
COM_SUBFORMPOWER_COUNTRY_GUID_DESCRIPTION="Globally Unique Identifier"
COM_SUBFORMPOWER_COUNTRY_GUID_HINT="Auto Generated"
COM_SUBFORMPOWER_COUNTRY_GUID_LABEL="GUID"
@@ -156,7 +157,7 @@ COM_SUBFORMPOWER_CURRENCIES_EDIT_STATE_DESC="Allows the users in this group to u
COM_SUBFORMPOWER_CURRENCIES_EDIT_VERSION="Currencies Edit Version"
COM_SUBFORMPOWER_CURRENCIES_EDIT_VERSION_DESC="Allows the users in this group to edit versions of version currencies"
COM_SUBFORMPOWER_CURRENCIES_EMPTYSTATE_BUTTON_ADD="Add your first currency"
COM_SUBFORMPOWER_CURRENCIES_EMPTYSTATE_CONTENT="currency view (dynamic build)"
COM_SUBFORMPOWER_CURRENCIES_EMPTYSTATE_CONTENT="currency view"
COM_SUBFORMPOWER_CURRENCIES_EMPTYSTATE_TITLE="No currencies have been created yet."
COM_SUBFORMPOWER_CURRENCIES_EXPORT="Currencies Export"
COM_SUBFORMPOWER_CURRENCIES_EXPORT_DESC="Allows the users in this group to export export currencies"
@@ -195,6 +196,7 @@ COM_SUBFORMPOWER_CURRENCY_DETAILS="Details"
COM_SUBFORMPOWER_CURRENCY_EDIT="Editing the Currency"
COM_SUBFORMPOWER_CURRENCY_ERROR_UNIQUE_ALIAS="Another Currency has the same alias."
COM_SUBFORMPOWER_CURRENCY_ERROR_UNIQUE_ALIAS_TRASHED="A trashed Currency has the same alias ."
COM_SUBFORMPOWER_CURRENCY_EXT_NUMBER_LABEL="Extension"
COM_SUBFORMPOWER_CURRENCY_GUID_DESCRIPTION="Globally Unique Identifier"
COM_SUBFORMPOWER_CURRENCY_GUID_HINT="Auto Generated"
COM_SUBFORMPOWER_CURRENCY_GUID_LABEL="GUID"
@@ -203,10 +205,6 @@ COM_SUBFORMPOWER_CURRENCY_MODIFIED_BY_DESC="The last user that modified this Cur
COM_SUBFORMPOWER_CURRENCY_MODIFIED_BY_LABEL="Modified By"
COM_SUBFORMPOWER_CURRENCY_MODIFIED_DATE_DESC="The date this Currency was modified."
COM_SUBFORMPOWER_CURRENCY_MODIFIED_DATE_LABEL="Modified Date"
COM_SUBFORMPOWER_CURRENCY_NAME_DESCRIPTION="The name is set here."
COM_SUBFORMPOWER_CURRENCY_NAME_HINT="Name Here!"
COM_SUBFORMPOWER_CURRENCY_NAME_LABEL="Name"
COM_SUBFORMPOWER_CURRENCY_NAME_MESSAGE="Error! Please add some name here."
COM_SUBFORMPOWER_CURRENCY_NEW="A New Currency"
COM_SUBFORMPOWER_CURRENCY_ORDERING_LABEL="Ordering"
COM_SUBFORMPOWER_CURRENCY_PERMISSION="Permissions"

View File

@@ -1,5 +1,13 @@
COM_SUBFORMPOWER="Subform Power"
COM_SUBFORMPOWER_CONFIGURATION="Subform Power Configuration"
COM_SUBFORMPOWER_CONFIG_ACTIVATE="Activate"
COM_SUBFORMPOWER_CONFIG_DEACTIVATE="Deactivate"
COM_SUBFORMPOWER_CONFIG_EXPORT_TEXT_ONLY_DESCRIPTION="This option enables the export of string/text instead of linked IDs in all admin views that have an export option."
COM_SUBFORMPOWER_CONFIG_EXPORT_TEXT_ONLY_LABEL="Export Text Only"
COM_SUBFORMPOWER_CONFIG_EXPORT_TEXT_ONLY_TAB_DESCRIPTION="Here are some extra option to adjust the export behaviour of admin views."
COM_SUBFORMPOWER_CONFIG_EXPORT_TEXT_ONLY_TAB_LABEL="Export Options"
COM_SUBFORMPOWER_CONFIG_STRICT_PERMISSION_PER_FIELD_DESCRIPTION="Use strict permissions per/field in the export methods where there are fields permissions in a view."
COM_SUBFORMPOWER_CONFIG_STRICT_PERMISSION_PER_FIELD_LABEL="Use Strict Permission per/field"
COM_SUBFORMPOWER_COUNTRIES_ACCESS="Countries Access"
COM_SUBFORMPOWER_COUNTRIES_ACCESS_DESC="Allows the users in this group to access access countries"
COM_SUBFORMPOWER_COUNTRIES_BATCH_USE="Countries Batch Use"

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage currencies_fullwidth.php
@@ -72,7 +72,7 @@ $can = SubformpowerHelper::getActions('currency');
<thead>
<tr>
<th data-toggle="true">
<?php echo Text::_('COM_SUBFORMPOWER_CURRENCY_NAME_LABEL'); ?>
<?php echo Text::_('COM_SUBFORMPOWER_CURRENCY_EXT_NUMBER_LABEL'); ?>
</th>
<th data-hide="phone">
<?php echo Text::_('COM_SUBFORMPOWER_CURRENCY_SYMBOL_LABEL'); ?>
@@ -100,12 +100,12 @@ $can = SubformpowerHelper::getActions('currency');
<tr>
<td>
<?php if ($canDo->get('currency.edit')): ?>
<a href="<?php echo $edit; ?>&id=<?php echo $item->id; ?><?php echo $ref; ?>"><?php echo $displayData->escape($item->name); ?></a>
<a href="<?php echo $edit; ?>&id=<?php echo $item->id; ?><?php echo $ref; ?>"><?php echo $displayData->escape($item->ext_number); ?></a>
<?php if ($item->checked_out): ?>
<?php echo Html::_('jgrid.checkedout', $i, $userChkOut->name, $item->checked_out_time, 'currencies.', $canCheckin); ?>
<?php endif; ?>
<?php else: ?>
<?php echo $displayData->escape($item->name); ?>
<?php echo $displayData->escape($item->ext_number); ?>
<?php endif; ?>
</td>
<td>

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage details_above.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage details_left.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage details_right.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage more_stuff_fullwidth.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage publishing.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage publlshing.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage details_above.php
@@ -35,7 +35,7 @@ $fields_tab_layout = 'fields_' . $layout_path_array[1];
// get the fields
$fields = $displayData->get($fields_tab_layout) ?: [
'name'
'ext_number'
];
// Ensure $fields is treated as an array and count its size.

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage details_left.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage details_right.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage publishing.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage publlshing.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage provider.php

View File

@@ -37,8 +37,8 @@ CREATE TABLE IF NOT EXISTS `#__subformpower_currency` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.',
`country` VARCHAR(36) NOT NULL DEFAULT '',
`ext_number` INT(10) NOT NULL DEFAULT 0,
`guid` VARCHAR(36) NOT NULL DEFAULT '',
`name` VARCHAR(255) NOT NULL DEFAULT '',
`symbol` VARCHAR(255) NULL DEFAULT '',
`params` TEXT NULL,
`published` TINYINT(3) NOT NULL DEFAULT 1,
@@ -53,7 +53,7 @@ CREATE TABLE IF NOT EXISTS `#__subformpower_currency` (
`access` INT(10) unsigned NOT NULL DEFAULT 0,
`ordering` INT(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
KEY `idx_name` (`name`),
KEY `idx_ext_number` (`ext_number`),
KEY `idx_country` (`country`),
KEY `idx_guid` (`guid`),
KEY `idx_access` (`access`),

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage CountriesController.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage CountryController.php
@@ -338,7 +338,7 @@ class CountryController extends FormController
* Function that allows child controller access to model data
* after the data has been saved.
*
* @param BaseDatabaseModel &$model The data model object.
* @param BaseDatabaseModel $model The data model object.
* @param array $validData The validated data.
*
* @return void

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage CurrenciesController.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage CurrencyController.php
@@ -338,7 +338,7 @@ class CurrencyController extends FormController
* Function that allows child controller access to model data
* after the data has been saved.
*
* @param BaseDatabaseModel &$model The data model object.
* @param BaseDatabaseModel $model The data model object.
* @param array $validData The validated data.
*
* @return void

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage DisplayController.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage ImportController.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage SubformpowerController.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage SubformpowerComponent.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage CountriesField.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage CountriesfilterisoField.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage CountriesfilterisothreeField.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage CountriesfilternumcodeField.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage CountriesfilterphonecodeField.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage CurrenciesfiltersymbolField.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage HeaderCheck.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage PowerloaderHelper.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage SubformpowerHelper.php
@@ -31,7 +31,7 @@ use Joomla\CMS\Language\Text;
use Joomla\CMS\Access\Access;
use Joomla\CMS\Access\Rules as AccessRules;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Filesystem\File;
use Joomla\Filesystem\File;
use Joomla\CMS\Language\Language;
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\CMS\Object\CMSObject;
@@ -43,9 +43,6 @@ use Joomla\Database\DatabaseInterface;
use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
use PhpOffice\PhpSpreadsheet\IOFactory;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
use JCB\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use JCB\Joomla\Utilities\ObjectHelper;
use JCB\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage CountriesModel.php
@@ -421,6 +421,8 @@ class CountriesModel extends ListModel
{
$query->where('a.id IN (' . implode(',',$pks) . ')');
}
// Get global switch to activate text only export
$export_text_only = ComponentHelper::getParams('com_subformpower')->get('export_text_only', 0);
// Implement View Level Access
if (!$user->authorise('core.options', 'com_subformpower'))
{

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage CountryModel.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage CurrenciesModel.php
@@ -350,6 +350,16 @@ class CurrenciesModel extends ListModel
{
$query->where('a.id IN (' . implode(',',$pks) . ')');
}
// Get global switch to activate text only export
$export_text_only = ComponentHelper::getParams('com_subformpower')->get('export_text_only', 0);
// Add these queries only if text only is required
if ($export_text_only)
{
// From the subformpower_country table.
$query->select($db->quoteName(['g.name','g.id'],['country','country_id']));
$query->join('LEFT', $db->quoteName('#__subformpower_country', 'g') . ' ON (' . $db->quoteName('a.country') . ' = ' . $db->quoteName('g.guid') . ')');
}
// Implement View Level Access
if (!$user->authorise('core.options', 'com_subformpower'))
{

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage CurrencyModel.php
@@ -70,7 +70,7 @@ class CurrencyModel extends AdminModel
'country'
),
'above' => array(
'name'
'ext_number'
)
)
);
@@ -697,9 +697,9 @@ class CurrencyModel extends AdminModel
}
// Only for strings
if (UtilitiesStringHelper::check($this->table->name) && !is_numeric($this->table->name))
if (UtilitiesStringHelper::check($this->table->ext_number) && !is_numeric($this->table->ext_number))
{
$this->table->name = $this->generateUnique('name',$this->table->name);
$this->table->ext_number = $this->generateUnique('ext_number',$this->table->ext_number);
}
// insert all set values

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage ImportModel.php
@@ -21,8 +21,8 @@ namespace JCB\Component\Subformpower\Administrator\Model;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Filesystem\Folder;
use Joomla\Filesystem\File;
use Joomla\Filesystem\Folder;
use Joomla\CMS\Filesystem\Path;
use Joomla\CMS\Filter\OutputFilter;
use Joomla\CMS\Installer\InstallerHelper;

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage SubformpowerModel.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage GuidRule.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage CountryTable.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage CurrencyTable.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage HtmlView.php
@@ -25,6 +25,7 @@ use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\User\User;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
@@ -46,6 +47,62 @@ use JCB\Joomla\Utilities\StringHelper;
*/
class HtmlView extends BaseHtmlView
{
/**
* The items from the model
*
* @var mixed
* @since 3.10.11
*/
public mixed $items;
/**
* The state object
*
* @var mixed
* @since 3.10.11
*/
public mixed $state;
/**
* The styles url array
*
* @var array
* @since 5.0.0
*/
protected array $styles;
/**
* The scripts url array
*
* @var array
* @since 5.0.0
*/
protected array $scripts;
/**
* The actions object
*
* @var object
* @since 3.10.11
*/
public object $canDo;
/**
* The return here base64 url
*
* @var string
* @since 3.10.11
*/
public string $return_here;
/**
* The user object.
*
* @var User
* @since 3.10.11
*/
public User $user;
/**
* Countries view display method
*
@@ -62,7 +119,7 @@ class HtmlView extends BaseHtmlView
$this->state = $this->get('State');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->user ??= Factory::getApplication()->getIdentity();
$this->user ??= $this->getCurrentUser();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage HtmlView.php
@@ -25,6 +25,7 @@ use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\User\User;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
@@ -45,6 +46,86 @@ use JCB\Joomla\Utilities\StringHelper;
*/
class HtmlView extends BaseHtmlView
{
/**
* The item from the model
*
* @var mixed
* @since 3.10.11
*/
public mixed $item;
/**
* The state object
*
* @var mixed
* @since 3.10.11
*/
public mixed $state;
/**
* The form from the model
*
* @var mixed
* @since 3.10.11
*/
public mixed $form;
/**
* The toolbar object
*
* @var Toolbar
* @since 3.10.11
*/
public Toolbar $toolbar;
/**
* The styles url array
*
* @var array
* @since 5.0.0
*/
protected array $styles;
/**
* The scripts url array
*
* @var array
* @since 5.0.0
*/
protected array $scripts;
/**
* The actions object
*
* @var object
* @since 3.10.11
*/
public object $canDo;
/**
* The origin referral view name
*
* @var string
* @since 3.10.11
*/
public string $ref;
/**
* The origin referral item id
*
* @var int
* @since 3.10.11
*/
public int $refid;
/**
* The referral url suffix values
*
* @var string
* @since 3.10.11
*/
public string $referral;
/**
* Country view display method
*
@@ -59,7 +140,7 @@ class HtmlView extends BaseHtmlView
$this->params = ComponentHelper::getParams('com_subformpower');
$this->useCoreUI = true;
// Assign the variables
$this->form = $this->get('Form');
$this->form ??= $this->get('Form');
$this->item = $this->get('Item');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage HtmlView.php
@@ -25,6 +25,7 @@ use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\User\User;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
@@ -46,6 +47,62 @@ use JCB\Joomla\Utilities\StringHelper;
*/
class HtmlView extends BaseHtmlView
{
/**
* The items from the model
*
* @var mixed
* @since 3.10.11
*/
public mixed $items;
/**
* The state object
*
* @var mixed
* @since 3.10.11
*/
public mixed $state;
/**
* The styles url array
*
* @var array
* @since 5.0.0
*/
protected array $styles;
/**
* The scripts url array
*
* @var array
* @since 5.0.0
*/
protected array $scripts;
/**
* The actions object
*
* @var object
* @since 3.10.11
*/
public object $canDo;
/**
* The return here base64 url
*
* @var string
* @since 3.10.11
*/
public string $return_here;
/**
* The user object.
*
* @var User
* @since 3.10.11
*/
public User $user;
/**
* Currencies view display method
*
@@ -62,7 +119,7 @@ class HtmlView extends BaseHtmlView
$this->state = $this->get('State');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->user ??= Factory::getApplication()->getIdentity();
$this->user ??= $this->getCurrentUser();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage HtmlView.php
@@ -25,6 +25,7 @@ use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\User\User;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
@@ -45,6 +46,86 @@ use JCB\Joomla\Utilities\StringHelper;
*/
class HtmlView extends BaseHtmlView
{
/**
* The item from the model
*
* @var mixed
* @since 3.10.11
*/
public mixed $item;
/**
* The state object
*
* @var mixed
* @since 3.10.11
*/
public mixed $state;
/**
* The form from the model
*
* @var mixed
* @since 3.10.11
*/
public mixed $form;
/**
* The toolbar object
*
* @var Toolbar
* @since 3.10.11
*/
public Toolbar $toolbar;
/**
* The styles url array
*
* @var array
* @since 5.0.0
*/
protected array $styles;
/**
* The scripts url array
*
* @var array
* @since 5.0.0
*/
protected array $scripts;
/**
* The actions object
*
* @var object
* @since 3.10.11
*/
public object $canDo;
/**
* The origin referral view name
*
* @var string
* @since 3.10.11
*/
public string $ref;
/**
* The origin referral item id
*
* @var int
* @since 3.10.11
*/
public int $refid;
/**
* The referral url suffix values
*
* @var string
* @since 3.10.11
*/
public string $referral;
/**
* Currency view display method
*
@@ -59,7 +140,7 @@ class HtmlView extends BaseHtmlView
$this->params = ComponentHelper::getParams('com_subformpower');
$this->useCoreUI = true;
// Assign the variables
$this->form = $this->get('Form');
$this->form ??= $this->get('Form');
$this->item = $this->get('Item');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage HtmlView.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage HtmlView.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage default.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage default_body.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage default_foot.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage default_head.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage default_toolbar.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage emptystate.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage default.php
@@ -111,14 +111,10 @@ defined('_JEXEC') or die;
<?php echo Html::_('uitab.addTab', 'countryTab', 'permissions', Text::_('COM_SUBFORMPOWER_COUNTRY_PERMISSION', true)); ?>
<div class="row">
<div class="col-md-12">
<fieldset class="adminform">
<div class="adminformlist">
<?php foreach ($this->form->getFieldset('accesscontrol') as $field): ?>
<div>
<?php echo $field->label; echo $field->input;?>
</div>
<div class="clearfix"></div>
<?php endforeach; ?>
<fieldset id="fieldset-rules" class="options-form">
<legend><?php echo Text::_('COM_SUBFORMPOWER_COUNTRY_PERMISSION'); ?></legend>
<div>
<?php echo $this->form->getInput('rules'); ?>
</div>
</fieldset>
</div>

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage default.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage default_body.php
@@ -76,12 +76,12 @@ $edit = "index.php?option=com_subformpower&view=currencies&task=currency.edit";
<td class="nowrap">
<div class="name">
<?php if ($canDo->get('currency.edit')): ?>
<a href="<?php echo $edit; ?>&id=<?php echo $item->id; ?>"><?php echo $this->escape($item->name); ?></a>
<a href="<?php echo $edit; ?>&id=<?php echo $item->id; ?>"><?php echo $this->escape($item->ext_number); ?></a>
<?php if ($item->checked_out): ?>
<?php echo Html::_('jgrid.checkedout', $i, $userChkOut->name, $item->checked_out_time, 'currencies.', $canCheckin); ?>
<?php endif; ?>
<?php else: ?>
<?php echo $this->escape($item->name); ?>
<?php echo $this->escape($item->ext_number); ?>
<?php endif; ?>
</div>
</td>

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage default_foot.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage default_head.php
@@ -42,7 +42,7 @@ defined('_JEXEC') or die;
</th>
<?php endif; ?>
<th class="nowrap" >
<?php echo Text::_('COM_SUBFORMPOWER_CURRENCY_NAME_LABEL'); ?>
<?php echo Text::_('COM_SUBFORMPOWER_CURRENCY_EXT_NUMBER_LABEL'); ?>
</th>
<th class="nowrap hidden-phone" >
<?php echo Html::_('searchtools.sort', 'COM_SUBFORMPOWER_CURRENCY_SYMBOL_LABEL', 'a.symbol', $this->listDirn, $this->listOrder); ?>

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage default_toolbar.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage emptystate.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage default.php
@@ -89,14 +89,10 @@ defined('_JEXEC') or die;
<?php echo Html::_('uitab.addTab', 'currencyTab', 'permissions', Text::_('COM_SUBFORMPOWER_CURRENCY_PERMISSION', true)); ?>
<div class="row">
<div class="col-md-12">
<fieldset class="adminform">
<div class="adminformlist">
<?php foreach ($this->form->getFieldset('accesscontrol') as $field): ?>
<div>
<?php echo $field->label; echo $field->input;?>
</div>
<div class="clearfix"></div>
<?php endforeach; ?>
<fieldset id="fieldset-rules" class="options-form">
<legend><?php echo Text::_('COM_SUBFORMPOWER_CURRENCY_PERMISSION'); ?></legend>
<div>
<?php echo $this->form->getInput('rules'); ?>
</div>
</fieldset>
</div>

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage default.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage default.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage default_main.php

View File

@@ -3,8 +3,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage default_vdm.php

View File

@@ -46,7 +46,7 @@ final class MultiSubform implements MultiSubformInterface
/**
* Get a subform items
*
* @param array $getMap The the map to get the subfrom data
* @param array $getMap The map to get the subfrom data
*
* Example:
* $getMap = [
@@ -94,8 +94,8 @@ final class MultiSubform implements MultiSubformInterface
/**
* Set a subform items
*
* @param array $items The list of items from the subform to set
* @param array $setMap The the map to set the subfrom data
* @param mixed $items The list of items from the subform to set
* @param array $setMap The map to set the subfrom data
*
* Example:
* $items,
@@ -117,7 +117,7 @@ final class MultiSubform implements MultiSubformInterface
* @return bool
* @since 3.2.2
*/
public function set(array $items, array $setMap): bool
public function set(mixed $items, array $setMap): bool
{
// Validate the core map presence and structure
if (!isset($setMap['_core']) || !is_array($setMap['_core']) || !$this->validSetMap($setMap['_core']))
@@ -125,6 +125,12 @@ final class MultiSubform implements MultiSubformInterface
return false;
}
// catch an empty set
if (!is_array($items))
{
$items = []; // will delete all existing linked items :( not ideal, but real
}
// Save the core data
if (!$this->setSubformData($items, $setMap['_core']))
{
@@ -167,7 +173,7 @@ final class MultiSubform implements MultiSubformInterface
* Set data based on provided map configuration.
*
* @param array $items The list of items from the subform to set
* @param array $map The the map to set the subfrom data
* @param array $map The map to set the subfrom data
* @param array|null $coreData The core data to be appended with subform data
*
* @return bool

View File

@@ -94,7 +94,7 @@ final class Subform implements SubformInterface
/**
* Set a subform items
*
* @param array $items The list of items from the subform to set
* @param mixed $items The list of items from the subform to set
* @param string $indexKey The index key on which the items should be observed as it relates to insert/update/delete.
* @param string $linkKey The link key on which the items where linked in the child table.
* @param string $linkValue The value of the link key in child table.
@@ -102,12 +102,17 @@ final class Subform implements SubformInterface
* @return bool
* @since 3.2.2
*/
public function set(array $items, string $indexKey, string $linkKey, string $linkValue): bool
public function set(mixed $items, string $indexKey, string $linkKey, string $linkValue): bool
{
$items = $this->process($items, $indexKey, $linkKey, $linkValue);
$this->purge($items, $indexKey, $linkKey, $linkValue);
if (empty($items))
{
return true; // nothing to set (already purged)
}
return $this->items->table($this->getTable())->set(
$items, $indexKey
);
@@ -142,10 +147,19 @@ final class Subform implements SubformInterface
if ($currentIndexValues !== null)
{
// Extract the index values from the items array
$activeIndexValues = array_values(array_map(function($item) use ($indexKey) {
return $item[$indexKey] ?? null;
}, $items));
// Check if the items array is empty
if (empty($items))
{
// Set activeIndexValues to an empty array if items is empty
$activeIndexValues = [];
}
else
{
// Extract the index values from the items array
$activeIndexValues = array_values(array_map(function($item) use ($indexKey) {
return $item[$indexKey] ?? null;
}, $items));
}
// Find the index values that are no longer in the items array
$inactiveIndexValues = array_diff($currentIndexValues, $activeIndexValues);
@@ -205,7 +219,7 @@ final class Subform implements SubformInterface
/**
* Processes an array of arrays based on the specified key.
*
* @param array $items Array of arrays to be processed.
* @param mixed $items Array of arrays to be processed.
* @param string $indexKey The index key on which the items should be observed as it relates to insert/update/delete
* @param string $linkKey The link key on which the items where linked in the child table.
* @param string $linkValue The value of the link key in child table.
@@ -213,8 +227,9 @@ final class Subform implements SubformInterface
* @return array The processed array of arrays.
* @since 3.2.2
*/
private function process(array $items, string $indexKey, string $linkKey, string $linkValue): array
private function process($items, string $indexKey, string $linkKey, string $linkValue): array
{
$items = is_array($items) ? $items : [];
foreach ($items as &$item)
{
$value = $item[$indexKey] ?? '';

View File

@@ -49,7 +49,7 @@ interface MultiSubformInterface
/**
* Set a subform items
*
* @param array $items The list of items from the subform to set
* @param mixed $items The list of items from the subform to set
* @param array $setMap The the map to set the subfrom data
*
* Example:
@@ -72,6 +72,6 @@ interface MultiSubformInterface
* @return bool
* @since 3.2.2
*/
public function set(array $items, array $setMap): bool;
public function set(mixed $items, array $setMap): bool;
}

View File

@@ -35,17 +35,17 @@ interface SubformInterface
* @param string $linkValue The value of the link key in child table.
* @param string $linkKey The link key on which the items where linked in the child table.
* @param string $field The parent field name of the subform in the parent view.
* @param array $set The array SET of the keys of each row in the subform.
* @param array $get The array SET of the keys of each row in the subform.
*
* @return array|null The subform
* @since 3.2.2
*/
public function get(string $linkValue, string $linkKey, string $field, array $set): ?array;
public function get(string $linkValue, string $linkKey, string $field, array $get): ?array;
/**
* Set a subform items
*
* @param array $items The list of items from the subform to set
* @param mixed $items The list of items from the subform to set
* @param string $indexKey The index key on which the items should be observed as it relates to insert/update/delete.
* @param string $linkKey The link key on which the items where linked in the child table.
* @param string $linkValue The value of the link key in child table.
@@ -53,7 +53,7 @@ interface SubformInterface
* @return bool
* @since 3.2.2
*/
public function set(array $items, string $indexKey, string $linkKey, string $linkValue): bool;
public function set(mixed $items, string $indexKey, string $linkKey, string $linkValue): bool;
/**
* Get the current active table

View File

@@ -159,17 +159,17 @@ final class Table extends BaseTable implements Tableinterface
],
],
'currency' => [
'name' => [
'name' => 'name',
'label' => 'COM_SUBFORMPOWER_CURRENCY_NAME_LABEL',
'type' => 'text',
'ext_number' => [
'name' => 'ext_number',
'label' => 'COM_SUBFORMPOWER_CURRENCY_EXT_NUMBER_LABEL',
'type' => 'number',
'title' => true,
'list' => 'currencies',
'store' => NULL,
'tab_name' => 'Details',
'db' => [
'type' => 'VARCHAR(255)',
'default' => '',
'type' => 'INT(10)',
'default' => '0',
'null_switch' => 'NOT NULL',
'unique_key' => false,
'key' => true,

View File

@@ -2,8 +2,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage country.js

View File

@@ -2,8 +2,8 @@
Nampharm
/-------------------------------------------------------------------------------------------------------/
@version 1.0.0
@build 28th June, 2024
@version 1.0.1
@build 20th August, 2024
@created 24th May, 2024
@package Subform Power
@subpackage currency.js

View File

@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="5.0" method="upgrade">
<name>COM_SUBFORMPOWER</name>
<creationDate>28th June, 2024</creationDate>
<creationDate>20th August, 2024</creationDate>
<author>Oh Martin</author>
<authorEmail>oh@nampharm.com.na</authorEmail>
<authorUrl>https://nampharm.com.na</authorUrl>
<copyright>Copyright (C) 2015. All Rights Reserved</copyright>
<license>GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html</license>
<version>1.0.0</version>
<version>1.0.1</version>
<description><![CDATA[
<h1>Subform Power (v.1.0.0)</h1>
<h1>Subform Power (v.1.0.1)</h1>
<div style="clear: both;"></div>
<p>Demonstration of subform super power</p>
<p>Created by <a href="https://nampharm.com.na" target="_blank">Oh Martin</a><br /><small>Development started 24th May, 2024</small></p>