* Finish task #6484.

This commit is contained in:
Yagami
2019-11-14 14:25:26 +08:00
parent 55e0dc16c3
commit 51e84b63ee
2 changed files with 26 additions and 2 deletions
+24
View File
@@ -25,6 +25,30 @@ class treeModel extends model
return $this->dao->findById((int)$moduleID)->from(TABLE_MODULE)->fetch();
}
/**
* Get module path by ID.
*
* @param int $moduleID
* @access public
* @return object
*/
public function getModulePathByID($moduleID)
{
$module = $this->dao->findById((int)$moduleID)->from(TABLE_MODULE)->fetch();
if($module->parent == '0') return '/' . $module->name;
$path = substr($module->path, 1, -1);
$modules = $this->dao->select('id,name')->from(TABLE_MODULE)->where('id')->in($path)->orderBy('grade')->fetchPairs();
$modulePath = '';
foreach($modules as $moduleName)
{
$modulePath .= '/' . $moduleName;
}
return $modulePath;
}
/**
* Build the sql query.
*