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:
@ -278,7 +278,7 @@ class ComponentbuilderModelHelp_documents 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;
|
||||
@ -296,7 +296,24 @@ class ComponentbuilderModelHelp_documents extends JModelList
|
||||
|
||||
// From the componentbuilder_help_document table
|
||||
$query->from($db->quoteName('#__componentbuilder_help_document', '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) . ')');
|
||||
}
|
||||
|
||||
// Order the results by ordering
|
||||
$query->order('a.ordering ASC');
|
||||
|
Reference in New Issue
Block a user