From b29d07988dfaae87144524aa81485897d58aab12 Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Fri, 9 Sep 2011 09:42:08 +0000 Subject: [PATCH] =?UTF-8?q?Ticket=20#150=20=E5=A2=9E=E5=8A=A0=E4=BA=86Onli?= =?UTF-8?q?neapp=E6=8E=A7=E5=88=B6=E5=99=A8=E5=92=8C=E5=AE=83=E7=9A=84?= =?UTF-8?q?=E8=A7=86=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controllers/OnlineappController.php | 170 ++++++++++++++++++ .../admin/views/scripts/user/index.phtml | 80 ++++++++- .../admin/views/scripts/user/show.phtml | 68 +++---- 3 files changed, 267 insertions(+), 51 deletions(-) create mode 100755 application/admin/controllers/OnlineappController.php diff --git a/application/admin/controllers/OnlineappController.php b/application/admin/controllers/OnlineappController.php new file mode 100755 index 00000000..e6fe8d44 --- /dev/null +++ b/application/admin/controllers/OnlineappController.php @@ -0,0 +1,170 @@ +db=Zend_Registry::get('db'); + $this->view->config = Zend_Registry::get('config'); + $this->messenger=$this->_helper->getHelper('FlashMessenger'); + $this->view->messages = $this->messenger->getMessages(); + } + function postDispatch() + { + $this->view->messages = $this->messenger->getMessages(); + } + function indexAction() + { + $select=$this->db->select(); + $select->from('onlineapp as o',array('id','username','ts_created')) + //->where('usertype = ?', 'member') + ->join('metadata as m', 'o.uuid = m.uuid', array('title','uuid')) + ->order('o.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; + + $count="select count(id) as total from onlineapp"; + $re=$this->db->query($count); + $t=$re->fetch(); + $this->view->t=$t; + }//indexAction + + function deleteAction() + { + $delete=(int)$this->_getParam('id'); + + if (isset($delete)) + { + $sql="delete from onlineapp where id=?"; + try { + $this->db->query($sql,array($delete)); + $this->messenger->addMessage('该记录已删除'); + } catch (Exception $e) { + $this->messenger->addMessage($e->getMessage()); + } + $this->_redirect("/admin/onlineapp/"); + } + }//deleteAction + + function showAction() + { + + $id = $this->_request->getParam('id'); + + if (!empty($id)) + { + $sql ="select o.*,u.username as uname,u.id as uid,m.title,m.uuid + from onlineapp as o + left join users as u on u.id = o.userid + left join metadata as m on o.uuid = m.uuid + where o.id=?"; + $result =$this->db->query($sql,$id); + $rows = $result->fetch(); + $this->view->infos=$rows; + } + }//showAction + + function datasAction() + { + $select=$this->db->select(); + $select->from('onlineapp as o','count(o.id) as num') + ->join('metadata as m', 'o.uuid = m.uuid', array('title','uuid')) + ->where('o.uuid = m.uuid') + ->group('m.title') + ->group('m.uuid') + ->order('num 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; + + /*$sql="select m.title,count(o.id) as num from onlineapp as o + left join metadata as m on m.uuid=o.uuid + where o.uuid=m.uuid + group by m.title";*/ + + }//datasAction + + function showdataAction() + { + + $uuid = $this->_request->getParam('uuid'); + + if(!empty($uuid)) + { + $select=$this->db->select(); + $select->from('onlineapp as o',array('id','username','ts_created')) + ->join('metadata as m', 'o.uuid = m.uuid', array('title','uuid')) + ->where('m.uuid = ?', $uuid) + ->order('o.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; + + $sql="select title from metadata where uuid='$uuid'"; + $re=$this->db->query($sql); + $t=$re->fetch(); + $this->view->infos=$t; + }else { + $this->_redirect("/admin/onlineapp/"); + } + + }//showdataAction + + function usersAction() + { + $select=$this->db->select(); + $select->from('onlineapp as o','count(o.id) as num') + ->join('users as u', 'u.id = o.userid', array('realname','id as uid')) + ->where('o.userid = u.id') + ->group('uid') + ->group('realname') + ->order('num 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; + + }//usersAction + + function showuserAction() + { + + $id = $this->_request->getParam('id'); + + if(!empty($id)) + { + $select=$this->db->select(); + $select->from('onlineapp as o',array('id','username','ts_created')) + ->join('metadata as m', 'o.uuid = m.uuid', array('title','uuid')) + ->where('o.userid = ?', $id) + ->order('o.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; + + $sql="select username,realname from users where id='$id'"; + $re=$this->db->query($sql); + $t=$re->fetch(); + $this->view->infos=$t; + }else { + $this->_redirect("/admin/onlineapp/"); + } + + }//showuserAction + +} + diff --git a/application/admin/views/scripts/user/index.phtml b/application/admin/views/scripts/user/index.phtml index e6c9a779..c7116e50 100755 --- a/application/admin/views/scripts/user/index.phtml +++ b/application/admin/views/scripts/user/index.phtml @@ -4,23 +4,89 @@ $this->headTitle()->setSeparator(' - '); $this->headLink()->appendStylesheet('/css/admin.css'); $this->breadcrumb('首页'); - $this->breadcrumb('后台管理首页'); + $this->breadcrumb('后台管理首页'); + $this->breadcrumb('统计'); + $this->breadcrumb('在线下载记录'); $this->breadcrumb()->setSeparator(' > '); + $this->headScript()->appendFile('/js/prototype.js'); ?>
-
+msg or $this->messages) :?> +
+msg) : ?> +

msg; ?>

+messages): foreach($this->messages as $msg): ?> +

+ +
+ - + +
+
共有 t['total'];?> 条在线下载记录
+ + + + + + + + +paginator)): ?> + +paginator as $item): ?> + +> + + + + + + + + +
id姓名资料名称下载时间操作
+'>查看详细 +/' onclick="return confirm('确定将此记录删除?')">删除 +
+
+paginator; ?> +
-
\ No newline at end of file + + \ No newline at end of file diff --git a/application/admin/views/scripts/user/show.phtml b/application/admin/views/scripts/user/show.phtml index e874b503..3bd325a8 100755 --- a/application/admin/views/scripts/user/show.phtml +++ b/application/admin/views/scripts/user/show.phtml @@ -5,17 +5,21 @@ $this->headLink()->appendStylesheet('/css/admin.css'); $this->breadcrumb('首页'); $this->breadcrumb('后台管理首页'); - $this->breadcrumb('用户列表'); + $this->breadcrumb('统计'); + $this->breadcrumb('在线下载记录'); + $this->breadcrumb('详细信息'); $this->breadcrumb()->setSeparator(' > '); + $this->headScript()->appendFile('/js/prototype.js'); ?>
msg or $this->messages) :?> @@ -28,47 +32,23 @@
+
-
- - - - - - - - - - - - - + + + + + + + + + + + +
IDinfos['id'];?>
用户名infos['username'];?>
真实姓名infos['realname'];?>
电子邮箱infos['email'];?>
注册时间infos['ts_created'];?>
最后登陆时间infos['ts_last_login'];?>
单位infos['unit'];?>
地址infos['address'];?>
电话infos['phone'];?>
项目infos['project'];?>
用户权限 - -
用户密码
确认用户密码
记录IDinfos['id'];?>
用户名infos['uname'];?> > 察看用户
姓名infos['username'];?>
单位infos['unit'];?>
电话infos['phone'];?>
地址infos['address'];?>
邮编infos['postcode'];?>
电话infos['phone'];?>
Emailinfos['email'];?>
项目
下载时间infos['ts_created']));?>
项目名称infos['title'];?> > 查看项目
- - -
-
- - - -
+
+paginator; ?> +
\ No newline at end of file