From f60b21375e4f09b655a3914e0f2d191e1941ea35 Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Tue, 11 Dec 2012 04:57:07 +0000 Subject: [PATCH] =?UTF-8?q?#438=20=E6=B7=BB=E5=8A=A0=E4=BA=86=E4=B8=BA?= =?UTF-8?q?=E9=BB=91=E6=B2=B3=E7=94=A8=E6=88=B7=E5=8F=91=E9=80=81=E9=82=AE?= =?UTF-8?q?=E4=BB=B6=E9=80=9A=E7=9F=A5=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controllers/UserController.php | 125 +++++++++++++++++- .../admin/views/scripts/user/left.phtml | 1 + .../scripts/user/sendmail-heihe-send.phtml | 70 ++++++++++ .../views/scripts/user/sendmail-heihe.phtml | 54 ++++++++ 4 files changed, 248 insertions(+), 2 deletions(-) create mode 100644 application/admin/views/scripts/user/sendmail-heihe-send.phtml create mode 100644 application/admin/views/scripts/user/sendmail-heihe.phtml diff --git a/application/admin/controllers/UserController.php b/application/admin/controllers/UserController.php index 2ed352ac..6226d855 100755 --- a/application/admin/controllers/UserController.php +++ b/application/admin/controllers/UserController.php @@ -523,6 +523,8 @@ class Admin_UserController extends Zend_Controller_Action $this->view->paginator=$paginator; $this->view->count_users = count($rows); + return true; + } if($ac == "send") @@ -604,9 +606,125 @@ class Admin_UserController extends Zend_Controller_Action @$mail->addTo($v['email']); $result[$v['id']] = array( 'username'=>$v['username'], - 'email'=>$v['email'], + 'email'=>$v['email'], 'lastlogin'=>date("Y-m-d",strtotime($v['ts_last_login'])) ); + //@$mail->send(); + } + + + $this->view->result = $result; + $this->view->now = $start; + $this->view->total = $total; + + $percent = round( ( $start / $total ) * 100 ,1); + $this->view->percent = $percent; + + $page ++; + + $this->view->page = $page; + + return true; + + } + + if($ac == "heihe") + { + + $this->_helper->viewRenderer('sendmail-heihe'); + + $sql = "SELECT * FROM heiheuser ORDER BY id DESC"; + + $sth = $this->db->query($sql); + + $rows = $sth->fetchAll(); + + $paginator = Zend_Paginator::factory($rows); + $paginator->setCurrentPageNumber($this->_getParam('page')); + $paginator->setItemCountPerPage(20); + $paginator->setView($this->view); + Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); + $this->view->paginator=$paginator; + + $this->view->count_users = count($rows); + + return true; + + } + + if($ac == "heihemail") + { + $this->_helper->viewRenderer('sendmail-heihe-send'); + + //当前进行到的数量 + $now = $this->_getParam('now'); + + //当前处理的页数 + $page = $this->_getParam('page'); + if(empty($page)) + { + $page = 0; + } + + $step = 20; + + $sql = "SELECT count(id) as c FROM heiheuser"; + + $sth = $this->db->query($sql); + $row = $sth->fetch(); + + $total = $row['c']; + + if(empty($now)) + { + $now = 0; + } + + //此次读取的起点 + $start = $now + $step; + + if($start>$total) + { + $this->view->stop = "YES"; + $msg = array( + "title"=>"为数字黑河用户发送了邮件通知", + "body"=>"在 ".time()." 时间给数字黑河用户发送了邮件通知 " + ); + include_once("message.php"); + message::post($this->db,0,-1,$msg['title'],$msg['body']); + return true; + } + + $sql = "SELECT * FROM heiheuser + ORDER BY id DESC + LIMIT $step + OFFSET $start"; + + $sth = $this->db->query($sql); + $rows = $sth->fetchAll(); + + $result = array(); + + foreach($rows as $k=>$v) + { + + include_once("EmailText.php"); + $mail=new WestdcMailer($this->view->config->smtp); + $mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); + $mailtp=new EmailText($this->db,"user-heihe-invite",array( + 'user' => $v['username'], + 'uid' => $v['id'], + 'lastlogin'=> date("Y-m-d",strtotime($v['lastlogin'])), + )); + $mail->setBodyText($mailtp->getBody()); + $mail->setSubject($mailtp->getSubject()); + @$mail->addTo($v['email']); + + $result[$v['id']] = array( + 'username'=>$v['username'], + 'email'=>$v['email'], + 'lastlogin'=>date("Y-m-d",strtotime($v['lastlogin'])) + ); @$mail->send(); } @@ -620,8 +738,11 @@ class Admin_UserController extends Zend_Controller_Action $page ++; - $this->view->page = $page; + $this->view->page = $page; + $this->view->url = "/admin/user/sendmail/ac/heihemail?now=".$start."&page=".$page; + + return true; } }//sendemailAction() diff --git a/application/admin/views/scripts/user/left.phtml b/application/admin/views/scripts/user/left.phtml index ff5d3990..0fedf68a 100755 --- a/application/admin/views/scripts/user/left.phtml +++ b/application/admin/views/scripts/user/left.phtml @@ -6,4 +6,5 @@
  • 用户组管理
  • 元数据评审专家库
  • 长时间未登录用户
  • +
  • 数字黑河用户
  • \ No newline at end of file diff --git a/application/admin/views/scripts/user/sendmail-heihe-send.phtml b/application/admin/views/scripts/user/sendmail-heihe-send.phtml new file mode 100644 index 00000000..e75a64c7 --- /dev/null +++ b/application/admin/views/scripts/user/sendmail-heihe-send.phtml @@ -0,0 +1,70 @@ +headTitle($this->config->title->site); + $this->headTitle('后台管理'); + $this->headTitle()->setSeparator(' - '); + $this->headLink()->appendStylesheet('/css/admin.css'); + $this->headLink()->appendStylesheet('/css/author.css'); + $this->breadcrumb('首页'); + $this->breadcrumb('后台首页'); + $this->breadcrumb('用户管理'); + $this->breadcrumb()->setSeparator(' > '); +?> + +
    +partial('user/left.phtml'); ?> +
    + +msg or $this->messages) :?> +
    +msg) : ?> +

    msg; ?>

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

    + +
    + + + +
    +stop)){ ?> +'; +echo '
    '.$this->percent.'%
    '; +echo '
    '; +echo '
    '; +?> +
    +如果页面没有跳转点击这里 +
    +
    + +
    + +jump()'; +?> + + \ No newline at end of file diff --git a/application/admin/views/scripts/user/sendmail-heihe.phtml b/application/admin/views/scripts/user/sendmail-heihe.phtml new file mode 100644 index 00000000..5f9373d2 --- /dev/null +++ b/application/admin/views/scripts/user/sendmail-heihe.phtml @@ -0,0 +1,54 @@ +headTitle($this->config->title->site); + $this->headTitle('后台管理'); + $this->headTitle()->setSeparator(' - '); + $this->headLink()->appendStylesheet('/css/admin.css'); + $this->breadcrumb('首页'); + $this->breadcrumb('后台首页'); + $this->breadcrumb('用户管理'); + $this->breadcrumb()->setSeparator(' > '); +?> +
    +partial('user/left.phtml'); ?> +
    + +msg or $this->messages) :?> +
    +msg) : ?> +

    msg; ?>

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

    + +
    + + + +
    +
    数字黑河用户(共 count_users;?> 个)
    + +
    + +
    + + + + + + + + + +paginator)): ?> + +paginator as $item): ?> + + + + + + + + +
    用户名电子邮箱最后登录
    + +
    \ No newline at end of file