tree.php 623 B

123456789101112131415161718192021
  1. <?php
  2. global $app;
  3. helper::import($app->getModulePath('', 'tree') . 'model.php');
  4. class exttreeModel extends treeModel
  5. {
  6. public function getFamily($categoryID, $type = '', $root = 0)
  7. {
  8. if($categoryID == 0 and empty($type)) return array();
  9. $category = $this->loadModel('dept')->getById($categoryID);
  10. if($category)
  11. {
  12. return $this->dao->select('id')->from(TABLE_DEPT)->where('path')->like($category->path . '%')->fetchPairs();
  13. }
  14. if(!$category)
  15. {
  16. return $this->dao->select('id')->from(TABLE_DEPT)->beginIF($root)->where('root')->eq((int)$root)->fi()->fetchPairs();
  17. }
  18. }
  19. //**//
  20. }