public function index(){
$user = D('User');
//整理用户查询数据
$keyword = $_POST['keyword'];
$ftype = $_POST['ftype'];
if(!empty($keyword)&&!empty($ftype)){
$where[$ftype] = array('like','%'.$keyword.'%');
$_SESSION['keyword'] = $where;
}else{
if(empty($keyword)&&!empty($ftype)){
unset($_SESSION['keyword']);
}else{
$where = $_SESSION['keyword'];
}
}
///数据分页
$count = $user->where($where)->count();
$page = new Page($count,4);
$page->rollPage = 7;// 分页栏每页显示的页数
$page->lastSuffix = false;
//$page->setConfig('header', '共 %TOTAL_ROW% 条记录');
///15页 以上 它才出现首页
$page->setConfig('first', '首页');
$page->setConfig('prev', '上一页');
$page->setConfig('next', '下一页');
$page->setConfig('last', '尾页');
$page->setConfig('theme', '%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 共%TOTAL_ROW% 条数据 共%TOTAL_PAGE%页');
$show = $page->show();
$this->assign('show',$show);
根据分页信息提取数据
$list = $user->order('id')->where($where)->limit($page->firstRow,$page->listRows)->select();
///取得所有分组
$role = M('Role');
$rlist = $role->getField('id,name');
循环遍历用户
///神奇的 引用赋值 屌屌屌
foreach($list as &$user){
$roleuser = D('RoleUser');
$data = $roleuser->where('user_id='.$user['id'])->find();
///把分组名称提取存入用户数据
$user['group'] =$rlist[ $data['role_id']];
}
$this->assign('ulist',$list);
$this->display();
}
$user = D('User');
//整理用户查询数据
$keyword = $_POST['keyword'];
$ftype = $_POST['ftype'];
if(!empty($keyword)&&!empty($ftype)){
$where[$ftype] = array('like','%'.$keyword.'%');
$_SESSION['keyword'] = $where;
}else{
if(empty($keyword)&&!empty($ftype)){
unset($_SESSION['keyword']);
}else{
$where = $_SESSION['keyword'];
}
}
///数据分页
$count = $user->where($where)->count();
$page = new Page($count,4);
$page->rollPage = 7;// 分页栏每页显示的页数
$page->lastSuffix = false;
//$page->setConfig('header', '共 %TOTAL_ROW% 条记录');
///15页 以上 它才出现首页
$page->setConfig('first', '首页');
$page->setConfig('prev', '上一页');
$page->setConfig('next', '下一页');
$page->setConfig('last', '尾页');
$page->setConfig('theme', '%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% 共%TOTAL_ROW% 条数据 共%TOTAL_PAGE%页');
$show = $page->show();
$this->assign('show',$show);
根据分页信息提取数据
$list = $user->order('id')->where($where)->limit($page->firstRow,$page->listRows)->select();
///取得所有分组
$role = M('Role');
$rlist = $role->getField('id,name');
循环遍历用户
///神奇的 引用赋值 屌屌屌
foreach($list as &$user){
$roleuser = D('RoleUser');
$data = $roleuser->where('user_id='.$user['id'])->find();
///把分组名称提取存入用户数据
$user['group'] =$rlist[ $data['role_id']];
}
$this->assign('ulist',$list);
$this->display();
}