* Ajax get component of global filters.
This commit is contained in:
@@ -124,8 +124,15 @@ class screen extends control
|
||||
{
|
||||
$chartID = $this->post->sourceID;
|
||||
$type = $this->post->type;
|
||||
$queryType = isset($_POST['queryType']) ? $this->post->queryType : 'filter';
|
||||
$component = isset($_POST['component']) ? json_decode($this->post->component) : null;
|
||||
|
||||
if($type == 'Filters')
|
||||
{
|
||||
$filterComponent = $this->screen->genFilterComponent($chartID);
|
||||
return print(json_encode($filterComponent));
|
||||
}
|
||||
|
||||
$queryType = isset($_POST['queryType']) ? $this->post->queryType : 'filter';
|
||||
$component = isset($_POST['component']) ? json_decode($this->post->component) : null;
|
||||
|
||||
$type = $this->screen->getChartType($type);
|
||||
|
||||
|
||||
@@ -9,3 +9,4 @@ $lang->screen->allUsers = 'All users';
|
||||
$lang->screen->noData = 'No Data';
|
||||
$lang->screen->noDesc = 'No Desc';
|
||||
$lang->screen->bizGuide = 'For more Organization-wide Overview Reports please contact us';
|
||||
$lang->screen->globalFilter = 'Global Filter';
|
||||
|
||||
@@ -9,3 +9,4 @@ $lang->screen->allUsers = 'All users';
|
||||
$lang->screen->noData = 'No Data';
|
||||
$lang->screen->noDesc = 'No Desc';
|
||||
$lang->screen->bizGuide = 'For more Organization-wide Overview Reports please contact us';
|
||||
$lang->screen->globalFilter = 'Global Filter';
|
||||
|
||||
@@ -9,3 +9,4 @@ $lang->screen->allUsers = 'All users';
|
||||
$lang->screen->noData = 'No Data';
|
||||
$lang->screen->noDesc = 'No Desc';
|
||||
$lang->screen->bizGuide = 'For more Organization-wide Overview Reports please contact us';
|
||||
$lang->screen->globalFilter = 'Global Filter';
|
||||
|
||||
@@ -9,3 +9,4 @@ $lang->screen->allUsers = '所有用户';
|
||||
$lang->screen->noData = '暂时没有数据';
|
||||
$lang->screen->noDesc = '暂无描述';
|
||||
$lang->screen->bizGuide = '更多大屏请联系我们';
|
||||
$lang->screen->globalFilter = '全局筛选器';
|
||||
|
||||
@@ -286,6 +286,40 @@ class screenModel extends model
|
||||
return $component;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成全局筛选器的组件。
|
||||
* Generate component of global filters.
|
||||
*
|
||||
* @param string $filterType
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function genFilterComponent($filterType)
|
||||
{
|
||||
$type = ucfirst($filterType);
|
||||
|
||||
$component = new stdclass();
|
||||
$component->chartConfig = new stdclass();
|
||||
$component->chartConfig->id = $type;
|
||||
$component->chartConfig->key = "{$type}Filter";
|
||||
$component->chartConfig->chartKey = "V{$type}Filter";
|
||||
$component->chartConfig->conKey = "VC{$type}Filter";
|
||||
$component->chartConfig->category = 'Filters';
|
||||
$component->chartConfig->categoryName = $this->lang->screen->globalFilter;
|
||||
$component->chartConfig->package = 'Decorates';
|
||||
|
||||
$objectPairs = $this->loadModel('metric')->getPairsByScope($filterType);
|
||||
$component->chartConfig->objectList = array_map(function($objectID, $objectTitle)
|
||||
{
|
||||
$object = new stdclass();
|
||||
$object->label = $objectTitle;
|
||||
$object->value = $objectID;
|
||||
return $object;
|
||||
}, array_keys($objectPairs), array_values($objectPairs));
|
||||
|
||||
return $component;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate metric component.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user