本文整理汇总了PHP中Admin\Builder\AdminListBuilder::modalPopupButton方法的典型用法代码示例。如果您正苦于以下问题:PHP AdminListBuilder::modalPopupButton方法的具体用法?PHP AdminListBuilder::modalPopupButton怎么用?PHP AdminListBuilder::modalPopupButton使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Admin\Builder\AdminListBuilder
的用法示例。
在下文中一共展示了AdminListBuilder::modalPopupButton方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: userList
public function userList($page = 1, $r = 20)
{
$aRoleId = I('role_id', 0, 'intval');
$aUserStatus = I('user_status', 0, 'intval');
$aSingleRole = I('single_role', 0, 'intval');
$role_list = $this->roleModel->field('id,title as value')->order('sort asc')->select();
$role_id_list = array_column($role_list, 'id');
if ($aRoleId && in_array($aRoleId, $role_id_list)) {
//筛选角色
$map_user_list['role_id'] = $aRoleId;
} else {
$map_user_list['role_id'] = $role_list[0]['id'];
}
if ($aUserStatus) {
//筛选状态
$map_user_list['status'] = $aUserStatus == 3 ? 0 : $aUserStatus;
}
if ($aSingleRole) {
//单角色筛选
$uids = $this->userRoleModel->group('uid')->field('uid')->having('count(uid)=1')->select();
$uids = array_column($uids, 'uid');
//单角色用户id列表
if ($aSingleRole == 1) {
$map_user_list['uid'] = array('in', $uids);
} else {
$map_user_list['uid'] = array('not in', $uids);
}
}
$user_list = $this->userRoleModel->where($map_user_list)->page($page, $r)->order('id desc')->select();
$totalCount = $this->userRoleModel->where($map_user_list)->count();
foreach ($user_list as &$val) {
$user = query_user(array('nickname', 'avatar64'), $val['uid']);
$val['nickname'] = $user['nickname'];
$val['avatar'] = $user['avatar64'];
}
unset($user, $val);
$statusOptions = array(0 => array('id' => 0, 'value' => '全部'), 1 => array('id' => 1, 'value' => '启用'), 2 => array('id' => 2, 'value' => '未审核'), 3 => array('id' => 3, 'value' => '禁用'));
$singleRoleOptions = array(0 => array('id' => 0, 'value' => '全部'), 1 => array('id' => 1, 'value' => '单角色用户'), 2 => array('id' => 2, 'value' => '非单角色用户'));
$builder = new AdminListBuilder();
$builder->title('角色用户列表')->setSelectPostUrl('Role/userList');
if ($map_user_list['status'] == 2) {
$builder->setStatusUrl(U('Role/setUserAudit', array('role_id' => $map_user_list['role_id'])))->buttonEnable('', '审核通过')->buttonDelete('', '审核失败');
} else {
$builder->setStatusUrl(U('Role/setUserStatus', array('role_id' => $map_user_list['role_id'])))->buttonEnable()->buttonDisable();
}
$builder->modalPopupButton(U('Role/changeRole', array('role_id' => $map_user_list['role_id'])), array(), '迁移用户', array('data-title' => '迁移用户到其他角色'))->select('角色:', 'role_id', 'select', '', '', '', $role_list)->select('状态:', 'user_status', 'select', '', '', '', $statusOptions)->select('', 'single_role', 'select', '', '', '', $singleRoleOptions)->keyId()->keyImage('avatar', '头像')->keyLink('nickname', '昵称', 'ucenter/index/information?uid=###')->keyStatus()->pagination($totalCount, $r)->data($user_list)->display();
}