* Modify basicInfo and createInfo.

This commit is contained in:
songchenxuan
2023-09-13 13:45:19 +08:00
parent 9ee57254a0
commit 2c3bb2d7dd
2 changed files with 14 additions and 10 deletions
+3 -3
View File
@@ -235,9 +235,9 @@ class metric extends control
{
$metric = $this->metric->getByID($metricID);
$this->view->metric = $metric;
$this->view->legendBasic = $this->metricZen->getBasicInfo($this->view);
$this->view->createEditInfo = $this->metricZen->getCreateEditInfo($this->view);
$this->view->metric = $metric;
$this->view->legendBasic = $this->metricZen->getBasicInfo($this->view,'scope,object,purpose,name,code,unit,desc,definition');
$this->view->createEditInfo = $this->metricZen->getCreateEditInfo($this->view, 'createdBy,implementedBy,lastEdited');
$this->display();
}
+11 -7
View File
@@ -233,22 +233,26 @@ class metricZen extends metric
* Get the basic information of the metric.
*
* @param object $view
* @param string $fields
* @access protected
* @return array
*/
protected function getBasicInfo(object $view)
protected function getBasicInfo(object $view, string $fields = 'scope,object,purpose,code,unit,stage')
{
extract((array)$view);
$unit = $this->metric->isOldMetric($metric) ? $metric->oldUnit : zget($this->lang->metric->unitList, $metric->unit);
$legendBasic = array();
$legendBasic['scope'] = array('name' => $this->lang->metric->scope, 'text' => zget($this->lang->metric->scopeList, $metric->scope));
$legendBasic['object'] = array('name' => $this->lang->metric->object, 'text' => zget($this->lang->metric->objectList, $metric->object));
$legendBasic['purpose'] = array('name' => $this->lang->metric->purpose, 'text' => zget($this->lang->metric->purposeList, $metric->purpose));
$legendBasic['code'] = array('name' => $this->lang->metric->code, 'text' => $metric->code);
$legendBasic['unit'] = array('name' => $this->lang->metric->unit, 'text' => $unit);
$legendBasic['stage'] = array('name' => $this->lang->metric->stage, 'text' => zget($this->lang->metric->stageList, $metric->stage));
if(strpos($fields, 'scope') !== false) $legendBasic['scope'] = array('name' => $this->lang->metric->scope, 'text' => zget($this->lang->metric->scopeList, $metric->scope));
if(strpos($fields, 'object') !== false) $legendBasic['object'] = array('name' => $this->lang->metric->object, 'text' => zget($this->lang->metric->objectList, $metric->object));
if(strpos($fields, 'purpose') !== false) $legendBasic['purpose'] = array('name' => $this->lang->metric->purpose, 'text' => zget($this->lang->metric->purposeList, $metric->purpose));
if(strpos($fields, 'name') !== false) $legendBasic['name'] = array('name' => $this->lang->metric->name, 'text' => $metric->name);
if(strpos($fields, 'code') !== false) $legendBasic['code'] = array('name' => $this->lang->metric->code, 'text' => $metric->code);
if(strpos($fields, 'unit') !== false) $legendBasic['unit'] = array('name' => $this->lang->metric->unit, 'text' => $unit);
if(strpos($fields, 'desc') !== false) $legendBasic['desc'] = array('name' => $this->lang->metric->desc, 'text' => $metric->desc);
if(strpos($fields, 'definition') !== false) $legendBasic['definition'] = array('name' => $this->lang->metric->definition, 'text' => $metric->definition);
if(strpos($fields, 'stage') !== false) $legendBasic['stage'] = array('name' => $this->lang->metric->stage, 'text' => zget($this->lang->metric->stageList, $metric->stage));
return $legendBasic;
}