public function get_depts() { $depts = $this->select(); $tree = new \Admin\Lib\Org\Util\Tree($depts); $depts = $tree->leaf(); return $depts; }
public function index() { $categories = D('Category')->order('sort')->get_all(); $tree = new \Admin\Lib\Org\Util\Tree($categories); $categories = $tree->leaf(); $cid = (int) $_GET['cid']; $where = array(); $params = ''; if ($cid != '') { $where['cid'] = $cid; $params = '&cid=' . $cid; } $page = (int) $_GET['page']; $page = !empty($page) ? $page : 1; $limit = 10; $offset = ($page - 1) * $limit; $total = $this->appeal->get_total($where); $page_num = ceil($total / $limit); $appeal = $this->appeal->get_appeals($limit, $offset, $where); foreach ($appeal as $key => $value) { foreach ($categories as $category) { if ($value['cid'] == $category['id']) { $appeal[$key]['c_name'] = $category['name']; } } } $this->assign('page', $page); $this->assign('total', $total); $this->assign('page_num', $page_num); $this->assign('appeal', $appeal); $this->assign('categories', $categories); $this->display(); }
public function index() { $categories = $this->category->order('sort')->get_all(); $tree = new \Admin\Lib\Org\Util\Tree($categories); $categories = $tree->leaf(); $this->assign('categories', $categories); $this->assign('method', 1); $this->display(); }