Revert "Revert "* Add ajaxGetMetricData function.""
This reverts commit c45fa44b2c.
This commit is contained in:
@@ -199,4 +199,50 @@ class screen extends control
|
||||
print(json_encode($chartData));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax get tree data.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxGetTreeData($screenID)
|
||||
{
|
||||
$dimensions = $this->screen->getDimensionPairs();
|
||||
$screen = $this->screen->getByID($screenID);
|
||||
$dimensionID = $this->loadModel('dimension')->setSwitcherMenu($screen->dimension);
|
||||
|
||||
foreach($dimensions as $dimension) $dimension->value = (int)$dimension->value;
|
||||
|
||||
$data = new stdclass();
|
||||
$data->chartData = $screen->chartData;
|
||||
$data->treeData = $this->screen->getTreeData($dimensions);
|
||||
$data->dimensions = $dimensions;
|
||||
$data->dimension = $screen->dimension;
|
||||
$data->scopeList = $this->loadModel('metric')->getScopePairs(false);
|
||||
$data->scope = 'system';
|
||||
$data->fieldConfig = $this->screen->getTreeSelectOptions();
|
||||
|
||||
echo(json_encode($data));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取度量数据。
|
||||
* Ajax get metric data.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxGetMetricData()
|
||||
{
|
||||
$metricID = $this->post->metricID;
|
||||
$metric = $this->loadModel('metric')->getByID($metricID);
|
||||
$result = $this->metric->getResultByCode($metric->code, $_POST, 'cron');
|
||||
|
||||
$metricData = new stdclass();
|
||||
$metricData->header = $this->metric->getViewTableHeader($metric);
|
||||
$metricData->data = $this->metric->getViewTableData($metric, $result);
|
||||
|
||||
echo(json_encode($metricData));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user