/** * 编辑 */ public function actionEdit() { $id = $this->helpGparam('id'); $funcInfo = Func::getById($id); $funcList = Func::getByParentId(0); $params = array('funcList' => $funcList, 'funcInfo' => $funcInfo); return $this->render('edit', $params); }
private function initFuncsData() { $funcList = Func::getByParentId(0, array(1), array('order_by' => SORT_ASC)); $iconList = $this->loadModuleIcon(); foreach ($funcList as $k => $func) { $func_id = $func['id']; $funcList[$k]['bigicon'] = isset($iconList[$func_id]['big']) ? $iconList[$func_id]['big'] : ''; $funcList[$k]['smallicon'] = isset($iconList[$func_id]['small']) ? $iconList[$func_id]['small'] : ''; $funcList[$k]['child'] = Func::getByParentId($func_id, array(1), array('order_by' => SORT_ASC)); } $this->funclist = $funcList; }
/** * 编辑用户 */ public function actionEdit() { $uid = $uid = $this->helpGparam('uid'); $userinfo = Users::getById($uid); //加载所有角色 $roleList = Roles::getByUsergroupId($this->user_group_id); $user_role_ids = User_Role_Relate::getByUid($uid); //加载所有功能 $funcList = Func::getByParentId(0); $funcData = array(); foreach ($funcList as $k => $func) { $data = array('id' => $func['id'], 'name' => $func['caption'], 'isParent' => true, 'open' => true); $childList = Func::getByParentId($func['id']); $data['children'] = array(); foreach ($childList as $cf) { $data['children'][] = array('id' => $cf['id'], 'name' => $cf['caption'], 'pId' => $func['id'], 'isParent' => false); } $funcData[] = $data; } $data = ['userinfo' => $userinfo, 'funcData' => $funcData, 'uid' => $uid, 'roleList' => $roleList, 'user_role_ids' => $user_role_ids]; return $this->render('edit', $data); }
private function getFuncsData() { $funcList = Func::getByParentId(0); $funcData = array(); foreach ($funcList as $k => $func) { $data = array('id' => $func['id'], 'name' => $func['caption'], 'fatherid' => 0, 'isparent' => true); $childList = Func::getByParentId($func['id']); $data['children'] = array(); foreach ($childList as $cf) { $data['children'][] = array('id' => $cf['id'], 'name' => $cf['caption'], 'fatherid' => $func['id'], 'isparent' => false); } $funcData[] = $data; } return $funcData; }