diff --git a/application/admin/controllers/DownController.php b/application/admin/controllers/DownController.php index d6c48c9b..7e600f17 100644 --- a/application/admin/controllers/DownController.php +++ b/application/admin/controllers/DownController.php @@ -920,6 +920,89 @@ class Admin_DownController extends Zend_Controller_Action }//查看单个数据下载情况 }//dataAction 数据下载情况 + + + /* + * sendmailAction() 邮件通知 + * + * Param uuid $uuid //元数据UUID + * + * return Ajax-response + * + * 传入元数据UUID,判断是否为当前用户的数据,如果是,即可向已经下载过该数据的所有用户发送电子邮件 + */ + public function sendmailAction() + { + $uuid = $this->_getParam('uuid'); + $ac = $this->_getParam('ac'); + + $auth = Zend_Auth::getInstance(); + if($auth->hasIdentity()) + { + $user = $auth->getIdentity(); + $uid = $user->id; + } + + if(empty($uuid) || empty($uid)) + { + $this->view->error = "参数错误"; + return true; + } + + $sql = "SELECT m.title,m.description,g.id as gid,mds.status as mdstatus,m.uuid FROM normalmetadata m + LEFT JOIN geonetworkmetadata g on m.uuid=g.uuid + LEFT JOIN mdstatus mds ON m.uuid=mds.uuid + WHERE m.uuid=?"; + $sth = $this->db->prepare($sql); + $sth->execute(array($uuid)); + $metadata = $sth->fetch(); + + if(empty($metadata['uuid'])) + { + $this->view->error = "数据不存在或者您可能没有该数据的管理权限"; + return true; + } + + $this->view->metadata = $metadata; + + $sql = "select u.email + from dataorder d + LEFT JOIN users u on d.userid = u.id + WHERE u.email IS NOT NULL + AND d.uuid=? + GROUP BY u.email"; + + $sth = $this->db->prepare($sql); + $sth->execute(array($uuid)); + $mails = $sth->fetchAll(); + + $this->view->mailinfo = count($mails); + + if($ac == "send") + { + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + + $title = $this->_getParam('title'); + $body = $this->_getParam('body'); + + foreach($mails as $k=>$v) + { + $mail=new WestdcMailer($this->view->config->smtp); + $mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); + $mail->setBodyText($body); + $mail->setSubject($title); + $mail->addTo($v['email']); + //$mail->addTo("Jack@sookon.com"); + if($mail->send()) + { + echo $v['email']."...发送成功!
"; + }else{ + echo $v['email']."...发送失败!
"; + } + } + } + }//sendmailAction() 为下载过某数据的用户发送邮件 function searchAction() { diff --git a/application/admin/views/scripts/data/md.phtml b/application/admin/views/scripts/data/md.phtml index a2e4a280..be780adb 100644 --- a/application/admin/views/scripts/data/md.phtml +++ b/application/admin/views/scripts/data/md.phtml @@ -46,8 +46,8 @@
  • 大小:M,创建时间: ,查看:次。 操作: - 编辑 | - 删除 | + 编辑 | + 删除 | 同步 | 文献管理 | 附件管理 | @@ -59,10 +59,11 @@ 编辑数据来源 | - 存档 + 存档 | - 添加存档 + 添加存档 | + 邮件通知

    数据贡献者:

    diff --git a/application/admin/views/scripts/down/data.phtml b/application/admin/views/scripts/down/data.phtml index 929b2986..49f952d7 100755 --- a/application/admin/views/scripts/down/data.phtml +++ b/application/admin/views/scripts/down/data.phtml @@ -1,61 +1,62 @@ -headTitle($this->config->title->site); - $this->headTitle('后台管理'); - $this->headTitle()->setSeparator(' - '); - $this->headLink()->appendStylesheet('/css/admin.css'); - $this->breadcrumb('首页'); - $this->breadcrumb('后台管理首页'); - $this->breadcrumb('申请管理'); - $this->breadcrumb('在线下载记录'); - $this->breadcrumb()->setSeparator(' > '); - $this->headScript()->appendFile('/js/prototype.js'); -?> - -
    -partial('down/left.phtml'); ?> -
    -
    -msg or $this->messages) :?> -
    -msg) : ?> -

    msg; ?>

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

    - -
    - - -
    title)) echo $this->title;?>共 count;?> 数据下载记录
    - - - - - - - - - -paginator)): ?> - -paginator as $item): ?> - - - - - - - - -
    数据下载次数操作
    -'>详细 -
    - +headTitle($this->config->title->site); + $this->headTitle('后台管理'); + $this->headTitle()->setSeparator(' - '); + $this->headLink()->appendStylesheet('/css/admin.css'); + $this->breadcrumb('首页'); + $this->breadcrumb('后台管理首页'); + $this->breadcrumb('申请管理'); + $this->breadcrumb('在线下载记录'); + $this->breadcrumb()->setSeparator(' > '); + $this->headScript()->appendFile('/js/prototype.js'); +?> + +
    +partial('down/left.phtml'); ?> +
    +
    +msg or $this->messages) :?> +
    +msg) : ?> +

    msg; ?>

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

    + +
    + + +
    title)) echo $this->title;?>共 count;?> 数据下载记录
    + + + + + + + + + +paginator)): ?> + +paginator as $item): ?> + + + + + + + + +
    数据下载次数操作
    +'>详细 +邮件通知 +
    +
    \ No newline at end of file diff --git a/application/admin/views/scripts/down/sendmail.phtml b/application/admin/views/scripts/down/sendmail.phtml new file mode 100644 index 00000000..90b04856 --- /dev/null +++ b/application/admin/views/scripts/down/sendmail.phtml @@ -0,0 +1,96 @@ +headTitle($this->config->title->site); + $this->headTitle('后台管理'); + $this->headTitle()->setSeparator(' - '); + $this->headLink()->appendStylesheet('/css/admin.css'); + $this->breadcrumb('首页'); + $this->breadcrumb('后台首页'); + $this->breadcrumb('数据管理'); + $this->breadcrumb('元数据管理'); + $this->breadcrumb()->setSeparator(' > '); + $this->headScript()->appendFile('/js/jquery-1.7.min.js'); + $this->headScript()->appendFile('/js/jquery.colorbox-min.js'); + $this->headLink()->appendStylesheet('/css/colorbox.css'); +?> +
    +partial('data/left.phtml'); ?> +
    +
    +error)) + { + echo $this->error; + } + ?> + metadata)) + { + ?> +

    metadata['title'] ?>

    + mailinfo)) + { + ?> + 共统计到可发送的电子邮件地址:mailinfo?> +
    +

    +
    + +

    +

    +
    + +

    +

    + + +

    +

    + +

    +
    + +
    + \ No newline at end of file