Improved the export feature to allow bulk custom overide, and dynamic behaviour towards larger sets. Added function name to custom buttons as a class for CSS styling.

This commit is contained in:
2020-07-24 06:11:38 +02:00
parent 27de9a83a5
commit 6bb23fc6ee
41 changed files with 527 additions and 115 deletions

View File

@ -266,7 +266,7 @@ class ComponentbuilderModelDynamic_gets extends JModelList
public function getExportData($pks, $user = null)
{
// setup the query
if (ComponentbuilderHelper::checkArray($pks))
if (($pks_size = ComponentbuilderHelper::checkArray($pks)) !== false || 'bulk' === $pks)
{
// Set a value to know this is export method. (USE IN CUSTOM CODE TO ALTER OUTCOME)
$_export = true;
@ -284,7 +284,24 @@ class ComponentbuilderModelDynamic_gets extends JModelList
// From the componentbuilder_dynamic_get table
$query->from($db->quoteName('#__componentbuilder_dynamic_get', 'a'));
$query->where('a.id IN (' . implode(',',$pks) . ')');
// The bulk export path
if ('bulk' === $pks)
{
$query->where('a.id > 0');
}
// A large array of ID's will not work out well
elseif ($pks_size > 500)
{
// Use lowest ID
$query->where('a.id >= ' . (int) min($pks));
// Use highest ID
$query->where('a.id <= ' . (int) max($pks));
}
// The normal default path
else
{
$query->where('a.id IN (' . implode(',',$pks) . ')');
}
// Implement View Level Access
if (!$user->authorise('core.options', 'com_componentbuilder'))
{