1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-22 13:41:52 +02:00

Admin-UI: $listGroup added for control of specific JOIN grouping when necessary. Example added to blank plugin.

This commit is contained in:
Cameron 2020-03-05 11:38:23 -08:00
parent bb6fe3283b
commit d6d178824c
2 changed files with 18 additions and 5 deletions
e107_handlers
e107_plugins/_blank

@ -2508,6 +2508,11 @@ class e_admin_controller_ui extends e_admin_controller
* @var string SQL order, false to disable order, null is default order
*/
protected $listOrder = null;
/**
* @var string SQL group-by field name (optional)
*/
protected $listGroup = null;
/**
* @var string field containing the order number
@ -4411,13 +4416,18 @@ class e_admin_controller_ui extends e_admin_controller
}
// group field - currently auto-added only if there are joins
// TODO - groupField property
$groupField = '';
if($joins && $this->getPrimaryName())
{
$groupField = $tablePath.$this->getPrimaryName();
}
// appended to GROUP BY when true.
if(!empty($this->listGroup))
{
$groupField = $this->listGroup;
}
if($raw)
{
$rawData = array(

@ -95,15 +95,17 @@ class plugin_blank_admin_ui extends e_admin_ui
/**
* This is only needed if you need to JOIN tables AND don't wanna use $tableJoin
* Write your list query without any Order or Limit.
* Write your list query without any Group, Order or Limit.
*
* @var string [optional]
*/
protected $listQry = "";
//
// optional - required only in case of e.g. tables JOIN. This also could be done with custom model (set it in init())
//protected $editQry = "SELECT * FROM #blank WHERE blank_id = {ID}";
protected $listOrder = 'blank_id DESC';
// protected $listGroup = 'somefield'; // (optional: when needing control over JOINs)
// protected $editQry = "SELECT * FROM #blank WHERE blank_id = {ID}";
// required - if no custom model is set in init() (primary id)
protected $pid = "blank_id";
@ -112,6 +114,7 @@ class plugin_blank_admin_ui extends e_admin_ui
protected $perPage = 20;
protected $batchDelete = true;
// protected \$sortField = 'somefield_order';