* Get program list with hierarchy in screen's metric.

This commit is contained in:
zhouxin
2024-01-08 14:27:28 +08:00
parent 58d0105738
commit c53d900da4
+7 -3
View File
@@ -974,14 +974,15 @@ class metricModel extends model
* Get object pairs by scope.
*
* @param string $scope
* @param bool $deptWithHierarchy
* @param bool $withHierarchy
* @access public
* @return array
*/
public function getPairsByScope($scope, $deptWithHierarchy = false)
public function getPairsByScope($scope, $withHierarchy = false)
{
if(empty($scope) || $scope == 'system') return array();
if($scope == 'dept' && $deptWithHierarchy) $scope = 'deptWithHierarchy';
if($scope == 'dept' && $withHierarchy) $scope = 'deptWithHierarchy';
if($scope == 'program' && $withHierarchy) $scope = 'programWithHierarchy';
$objectPairs = array();
switch($scope)
@@ -1001,6 +1002,9 @@ class metricModel extends model
->andWhere('type')->eq('program')
->fetchPairs();
break;
case 'programWithHierarchy':
$objectPairs = $this->loadModel('program')->getParentPairs();
break;
case 'product':
$objectPairs = $this->dao->select('id, name')->from(TABLE_PRODUCT)
->where('deleted')->eq(0)->fetchPairs();