1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 12:48:26 +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

View File

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

View File

@@ -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 * 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] * @var string [optional]
*/ */
protected $listQry = ""; 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 $listOrder = 'blank_id DESC';
//protected $editQry = "SELECT * FROM #blank WHERE blank_id = {ID}";
// 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) // required - if no custom model is set in init() (primary id)
protected $pid = "blank_id"; protected $pid = "blank_id";
@@ -113,6 +115,7 @@ class plugin_blank_admin_ui extends e_admin_ui
protected $batchDelete = true; protected $batchDelete = true;
// protected \$sortField = 'somefield_order'; // protected \$sortField = 'somefield_order';