From ddda3987793dfc141ec79c4fc35b5c67677b9a81 Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Wed, 14 Sep 2011 02:34:15 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E4=BC=9A=E5=91=98?= =?UTF-8?q?=E7=AE=A1=E7=90=86=EF=BC=8C=E5=A2=9E=E5=8A=A0=E4=BA=86=E5=B8=A6?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E5=88=86=E9=A1=B5=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controllers/UserController.php | 67 +++++++++++++- .../admin/views/scripts/down/left.phtml | 1 + .../admin/views/scripts/pagination.phtml | 8 +- .../views/scripts/pagination_param.phtml | 26 ++++++ .../admin/views/scripts/user/adminlist.phtml | 10 +- .../admin/views/scripts/user/index.phtml | 92 ++++--------------- .../admin/views/scripts/user/list.phtml | 13 ++- .../admin/views/scripts/user/show.phtml | 68 +++++++++----- 8 files changed, 173 insertions(+), 112 deletions(-) create mode 100755 application/admin/views/scripts/pagination_param.phtml diff --git a/application/admin/controllers/UserController.php b/application/admin/controllers/UserController.php index 00e23b70..65d9036c 100755 --- a/application/admin/controllers/UserController.php +++ b/application/admin/controllers/UserController.php @@ -14,22 +14,79 @@ class Admin_UserController extends Zend_Controller_Action } function indexAction() { - //其他连接 - } + $sql="select count(id) as total from users"; + $uq=$this->db->query($sql); + $row=$uq->fetch(); + + $sqlt="select count(id) as total from users where usertype='administrator'"; + $uqt=$this->db->query($sqlt); + $adminrow=$uqt->fetch(); + + $this->view->su=$row; + $this->view->suadmin=$adminrow; + + }//indexAction function listAction() { - $select=$this->db->select(); - $select->from('users') + + $select=$this->db->select(); + + + $select->from('users') ->where('usertype = ?', 'member') ->order('users.id desc'); + + $paginator = Zend_Paginator::factory($select); $paginator->setCurrentPageNumber($this->_getParam('page')); $paginator->setItemCountPerPage(30); $paginator->setView($this->view); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml'); $this->view->paginator=$paginator; - } + }//listAction + + function searchAction() + { + $search = $this->_getParam('search'); + $realname = $this->_getParam('realname'); + $unit = $this->_getParam('unit'); + $project = $this->_getParam('project'); + + $select=$this->db->select(); + + if(!empty($search) && ( !empty($realname) || !empty($unit) || !empty($project) )) + { + $this->messenger->addMessage('搜索结果'); + $select->from('users'); + if(!empty($realname)) + $select->where('realname like ? ', '%'.$realname.'%'); + if(!empty($unit)) + $select->where('unit like ? ', '%'.$unit.'%'); + if(!empty($project)) + $select->where('project like ? ', '%'.$project.'%'); + + $select->order('users.id desc'); + + + + $paginator = Zend_Paginator::factory($select); + $paginator->setCurrentPageNumber($this->_getParam('page')); + $paginator->setItemCountPerPage(30); + $paginator->setView($this->view); + Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); + $this->view->paginator=$paginator; + $this->_helper->viewRenderer('list'); + + } + else { + $this->_redirect("/admin/user/list"); + } + + + + + }//searchAction function deleteAction() { diff --git a/application/admin/views/scripts/down/left.phtml b/application/admin/views/scripts/down/left.phtml index 23c6bd4a..5943d77f 100644 --- a/application/admin/views/scripts/down/left.phtml +++ b/application/admin/views/scripts/down/left.phtml @@ -1,4 +1,5 @@