* fix bug #755.
This commit is contained in:
@@ -1090,7 +1090,7 @@ class bugModel extends model
|
||||
{
|
||||
$datas = $this->dao->select('module as name, count(module) as value')->from(TABLE_BUG)->where($this->reportCondition())->groupBy('module')->orderBy('value DESC')->fetchAll('name');
|
||||
if(!$datas) return array();
|
||||
$modules = $this->dao->select('id, name')->from(TABLE_MODULE)->where('id')->in(array_keys($datas))->fetchPairs();
|
||||
$modules = $this->loadModel('tree')->getModulesName(array_keys($datas));
|
||||
foreach($datas as $moduleID => $data) $data->name = isset($modules[$moduleID]) ? $modules[$moduleID] : '/';
|
||||
return $datas;
|
||||
}
|
||||
|
||||
@@ -1662,7 +1662,7 @@ class storyModel extends model
|
||||
->beginIF($this->session->storyQueryCondition != false)->where($this->session->storyQueryCondition)->fi()
|
||||
->groupBy('module')->orderBy('value DESC')->fetchAll('name');
|
||||
if(!$datas) return array();
|
||||
$modules = $this->dao->select('id, name')->from(TABLE_MODULE)->where('id')->in(array_keys($datas))->fetchPairs();
|
||||
$modules = $this->loadModel('tree')->getModulesName(array_keys($datas));
|
||||
foreach($datas as $moduleID => $data) $data->name = isset($modules[$moduleID]) ? $modules[$moduleID] : '/';
|
||||
return $datas;
|
||||
}
|
||||
|
||||
@@ -1161,7 +1161,7 @@ class taskModel extends model
|
||||
->orderBy('value DESC')
|
||||
->fetchAll('name');
|
||||
if(!$datas) return array();
|
||||
$modules = $this->dao->select('id, name')->from(TABLE_MODULE)->where('id')->in(array_keys($datas))->fetchPairs();
|
||||
$modules = $this->loadModel('tree')->getModulesName(array_keys($datas));
|
||||
foreach($datas as $moduleID => $data) $data->name = isset($modules[$moduleID]) ? $modules[$moduleID] : '/';
|
||||
return $datas;
|
||||
}
|
||||
|
||||
@@ -1030,6 +1030,31 @@ class treeModel extends model
|
||||
return empty($module) ? 0 : $module->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get modules name.
|
||||
*
|
||||
* @param array $moduleIdList
|
||||
* @param bool $allPath
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getModulesName($moduleIdList, $allPath = true)
|
||||
{
|
||||
if(!$allPath) return $this->dao->select('id, name')->from(TABLE_MODULE)->where('id')->in($moduleIdList)->fetchPairs('id', 'name');
|
||||
|
||||
$modules = $this->dao->select('id, name, path')->from(TABLE_MODULE)->where('id')->in($moduleIdList)->fetchAll('path');
|
||||
$allModules = $this->dao->select('id, name')->from(TABLE_MODULE)->where('id')->in(join(array_keys($modules)))->fetchPairs('id', 'name');
|
||||
$modulePairs = array();
|
||||
foreach($modules as $module)
|
||||
{
|
||||
$paths = explode(',', trim($module->path, ','));
|
||||
$moduleName = '';
|
||||
foreach($paths as $path) $moduleName .= '/' . $allModules[$path];
|
||||
$modulePairs[$module->id] = $moduleName;
|
||||
}
|
||||
return $modulePairs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update modules' order.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user