dept.php 686 B

1234567891011121314151617181920212223242526
  1. <?php
  2. global $app;
  3. helper::import($app->getModulePath('', 'dept') . 'model.php');
  4. class extdeptModel extends deptModel
  5. {
  6. /**
  7. * Get list of one type.
  8. *
  9. * @param string $type
  10. * @param string $orderBy
  11. * @access public
  12. * @return array
  13. */
  14. public function getListByType($type = 'article', $orderBy = 'id_asc')
  15. {
  16. $depts = $this->dao->select('*')->from(TABLE_DEPT)->orderBy('grade,`order`')->fetchAll('id');
  17. $manager = array();
  18. foreach($depts as $dept)
  19. {
  20. $dept->manager = $dept->manager ? ",{$dept->manager}," : zget($manager, $dept->parent, '');
  21. $manager[$dept->id] = $dept->manager;
  22. }
  23. return $depts;
  24. }
  25. //**//
  26. }