* Finish task #113949.
This commit is contained in:
@@ -494,8 +494,11 @@ function initPageEntity(object $object): array
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
function initTableData(array $items, array &$fieldList, object $model = null): array
|
||||
function initTableData(array $items, array &$fieldList, object $model = null, string $moduleName = ''): array
|
||||
{
|
||||
global $config;
|
||||
if($config->edition != 'open') $fieldList = initTableFields($fieldList, $moduleName);
|
||||
|
||||
if(!empty($_GET['orderBy']) && strpos($_GET['orderBy'], '-') !== false) list($orderField, $orderValue) = explode('_', $_GET['orderBy']);
|
||||
if(!empty($orderField) && !empty($orderValue) && !empty($fieldList[$orderField]))
|
||||
{
|
||||
@@ -602,6 +605,50 @@ function initTableData(array $items, array &$fieldList, object $model = null): a
|
||||
return array_values($items);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化表格工作流内置字段。
|
||||
* Init workflow buildin fields in table.
|
||||
*
|
||||
* @param array $fieldList
|
||||
* @param string $moduleName
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
function initTableFields(array $fieldList, string $moduleName = ''): array
|
||||
{
|
||||
global $app;
|
||||
if(empty($moduleName)) $moduleName = $app->rawModule;
|
||||
$workflowFields = $app->control->loadModel('workflowfield')->getList($moduleName);
|
||||
foreach($workflowFields as $fieldKey => $field)
|
||||
{
|
||||
if($field->buildin || !isset($fieldList[$fieldKey])) continue;
|
||||
switch($field->control)
|
||||
{
|
||||
case 'select':
|
||||
case 'radio':
|
||||
$fieldList[$fieldKey]['map'] = $app->control->workflowfield->getFieldOptions($field);
|
||||
break;
|
||||
case 'multi-select':
|
||||
case 'checkbox':
|
||||
$fieldList[$fieldKey]['map'] = $app->control->workflowfield->getFieldOptions($field);
|
||||
$fieldList[$fieldKey]['type'] = 'category';
|
||||
break;
|
||||
case 'richtext':
|
||||
$fieldList[$fieldKey]['type'] = 'html';
|
||||
case 'date':
|
||||
case 'datetime':
|
||||
$fieldList[$fieldKey]['type'] = $field->control;
|
||||
case 'int':
|
||||
case 'decimal':
|
||||
$fieldList[$fieldKey]['type'] = 'number';
|
||||
default:
|
||||
$fieldList[$fieldKey]['type'] = 'text';
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $fieldList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the parent property of the data.
|
||||
*
|
||||
|
||||
@@ -64,6 +64,8 @@ class datatableModel extends model
|
||||
foreach($fields as $field)
|
||||
{
|
||||
if($field->buildin) continue;
|
||||
if($field->control == 'file') continue;
|
||||
|
||||
$fieldList[$field->field]['title'] = $field->name;
|
||||
$fieldList[$field->field]['width'] = '120';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user