Beispiel #1
0
 public function getrolelistAction()
 {
     $data = array();
     $role = new Admin_Model_Role();
     $data = $role->getList();
     echo Zend_Json::encode($data);
     exit;
 }
Beispiel #2
0
 public function getroleAction()
 {
     $data = array();
     // 请求参数
     $request = $this->getRequest()->getParams();
     $option = isset($request['option']) ? $request['option'] : 'list';
     $role = new Admin_Model_Role();
     if ($option == 'list') {
         $data = $role->getList(false);
     } else {
         // 请求部门的层级ID
         $parentId = isset($request['parentId']) ? $request['parentId'] : 0;
         $active = isset($request['active']) ? $request['active'] : null;
         // 获取部门数据
         $data = $role->getData($parentId, $active);
     }
     // 将部门数据转为json格式并输出
     echo Zend_Json::encode($data);
     exit;
 }