* Add option for global filter.

This commit is contained in:
songchenxuan
2024-02-20 12:26:20 +08:00
parent 8255feb259
commit 4d2cc0dfa9
+9 -2
View File
@@ -459,6 +459,7 @@ class screenModel extends model
$type = ucfirst($filterType);
$component = new stdclass();
$component->option = new stdclass();
$component->chartConfig = new stdclass();
$component->chartConfig->id = $type;
$component->chartConfig->key = "{$type}Filter";
@@ -471,18 +472,21 @@ class screenModel extends model
if(in_array($filterType, $this->config->metric->scopeList))
{
$objectPairs = $this->metric->getPairsByScope($filterType, true);
$component->chartConfig->objectList = array_map(function($objectID, $objectTitle)
$objectList = array_map(function($objectID, $objectTitle)
{
$object = new stdclass();
$object->label = $objectTitle;
$object->value = $objectID;
return $object;
}, array_keys($objectPairs), array_values($objectPairs));
$component->chartConfig->objectList = $objectList;
$component->option->objectList = $objectList;
}
$firstAction = $this->dao->select('YEAR(date) as year')->from(TABLE_ACTION)->orderBy('id_asc')->limit(1)->fetch();
$yearRange = range((int)date('Y'), $firstAction->year);
$component->chartConfig->yearList = array_map(function($year)
$yearList = array_map(function($year)
{
$yearObject = new stdclass();
$yearObject->label = $year;
@@ -490,6 +494,9 @@ class screenModel extends model
return $yearObject;
}, $yearRange);
$component->chartConfig->yearList = $yearList;
$component->option->yearList = $yearList;
return $component;
}