当前位置: 首页>>代码示例>>PHP>>正文


PHP Role::findAll方法代码示例

本文整理汇总了PHP中Role::findAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Role::findAll方法的具体用法?PHP Role::findAll怎么用?PHP Role::findAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Role的用法示例。


在下文中一共展示了Role::findAll方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionGetRoleList

 public function actionGetRoleList()
 {
     $role = new Role();
     $roleInfos = $role->findAll(array('select' => 'rid,rname'));
     $ret = array();
     foreach ($roleInfos as $role) {
         $ret[] = $role->getAttributes();
     }
     echo json_encode($ret);
 }
开发者ID:jinchunguang,项目名称:backadmin_yii,代码行数:10,代码来源:RoleController.php

示例2: actionList

 public function actionList()
 {
     $page = isset($_GET['id']) ? intval($_GET['id']) : 1;
     $list = array();
     $criteria = new CDbCriteria(array('order' => 'id ASC'));
     $roles = new Role();
     $count = $roles->count($criteria);
     $pager = new CPagination($count);
     $pager->pageSize = Yii::app()->params['postsPerPage'];
     $pager->setCurrentPage($page - 1);
     $pager->applyLimit($criteria);
     $list = $roles->findAll($criteria);
     $this->render('list', array('r' => Yii::app()->request->baseUrl . '/', 'pages' => $pager, 'list' => $list));
 }
开发者ID:humor-zo,项目名称:woc-yii,代码行数:14,代码来源:RoleController.php

示例3: actionEdit

 public function actionEdit()
 {
     //echo "<pre>";var_dump($_REQUEST);exit;
     $usr = new User();
     $role = new Role();
     $usrInfo = array();
     $label = '';
     foreach ($_REQUEST as $k => $v) {
         $_REQUEST[$k] = trim($v);
     }
     // 获取role列表
     $roleInfos = $role->findAll(array('select' => 'rid,rname'));
     // 过滤超极管理员
     foreach ($roleInfos as $role) {
         if ($role['rname'] != 'superman') {
             $roles[] = $role;
         }
     }
     // var_dump($_REQUEST); exit;
     //
     if (isset($_REQUEST['id']) && $_REQUEST['id'] != '') {
         // 修改
         $usrInfo = $usr->getUserWithRole('uid=:uid', array(':uid' => $_REQUEST['id']));
         $usrInfo = $usrInfo[0];
         if (isset($_REQUEST['modify'])) {
             $usr->updateByPk($_REQUEST['id'], array('uname' => $_REQUEST['name'], 'email' => $_REQUEST['email'], 'pwd' => Login::pwdEncry($_REQUEST['pwd']), 'rid' => $_REQUEST['rid']));
             $this->redirect('/main/user/list');
         }
     } elseif (!empty($_REQUEST['name'])) {
         // 新增
         $usrInfo = $usr->getUserWithRole('uname=:name', array(':name' => $_REQUEST['name']));
         //var_dump($usrInfo);exit;
         if (!empty($usrInfo)) {
             $this->render('edit', array('roles' => $roles, 'entity' => $usrInfo[0], 'label' => 'has_usr'));
             exit;
         }
         if (isset($_REQUEST['modify'])) {
             $usr->uname = $_REQUEST['name'];
             $usr->email = $_REQUEST['email'];
             $usr->pwd = Login::pwdEncry($_REQUEST['pwd']);
             $usr->rid = $_REQUEST['rid'];
             $usr->save();
             $this->redirect('/main/user/list');
         }
     }
     $this->render('edit', array('entity' => $usrInfo, 'roles' => $roles, 'label' => $label));
 }
开发者ID:jinchunguang,项目名称:backadmin_yii,代码行数:47,代码来源:UserController.php


注:本文中的Role::findAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。