source: branches/version-2_12-dev/data/class/pages/admin/mail/LC_Page_Admin_Mail_History.php @ 21866

Revision 21866, 4.7 KB checked in by h_yoshimoto, 12 years ago (diff)

#1831 Copyrightを更新を誤っているので戻します

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
Line 
1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2011 LOCKON CO.,LTD. All Rights Reserved.
6 *
7 * http://www.lockon.co.jp/
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22 */
23
24// {{{ requires
25require_once CLASS_EX_REALDIR . 'page_extends/admin/LC_Page_Admin_Ex.php';
26
27/**
28 * メール配信履歴 のページクラス.
29 *
30 * @package Page
31 * @author LOCKON CO.,LTD.
32 * @version $Id$
33 */
34class LC_Page_Admin_Mail_History extends LC_Page_Admin_Ex {
35
36    // }}}
37    // {{{ functions
38
39    /**
40     * Page を初期化する.
41     *
42     * @return void
43     */
44    function init() {
45        parent::init();
46        $this->tpl_mainpage = 'mail/history.tpl';
47        $this->tpl_mainno = 'mail';
48        $this->tpl_subno = 'history';
49        $this->tpl_maintitle = 'メルマガ管理';
50        $this->tpl_subtitle = '配信履歴';
51        $this->tpl_pager = 'pager.tpl';
52    }
53
54    /**
55     * Page のプロセス.
56     *
57     * @return void
58     */
59    function process() {
60        $this->action();
61        $this->sendResponse();
62    }
63
64    /**
65     * Page のアクション.
66     *
67     * @return void
68     */
69    function action() {
70
71        switch ($this->getMode()) {
72            case 'delete':
73                if (SC_Utils_Ex::sfIsInt($_GET['send_id'])) {
74                    // 削除時
75                    $this->lfDeleteHistory($_GET['send_id']);
76
77                    $this->objDisplay->reload(null, true);
78                }
79                break;
80            default:
81                break;
82        }
83
84        list($this->tpl_linemax, $this->arrDataList, $this->arrPagenavi) = $this->lfDoSearch($_POST['search_pageno']);
85
86    }
87
88    /**
89     * デストラクタ.
90     *
91     * @return void
92     */
93    function destroy() {
94        parent::destroy();
95    }
96
97    /**
98     * 実行履歴の取得
99     *
100     * @param integer $search_pageno 表示したいページ番号
101     * @return array( integer 全体件数, mixed メール配信データ一覧配列, mixed SC_PageNaviオブジェクト)
102     */
103    function lfDoSearch($search_pageno = 1) {
104
105        // 引数の初期化
106        if (SC_Utils_Ex::sfIsInt($search_pageno)===false) {
107            $search_pageno = 1;
108        }
109        //
110        $objSelect =& SC_Query_Ex::getSingletonInstance();    // 一覧データ取得用
111        $objQuery =& SC_Query_Ex::getSingletonInstance();    // 件数取得用
112
113        // 該当全体件数の取得
114        $linemax = $objQuery->count('dtb_send_history','del_flg = 0');
115
116        // 一覧データの取得
117        $objSelect->setOrder('start_date DESC, send_id DESC');
118
119        $col = '*';
120        $col .= ',(SELECT COUNT(*) FROM dtb_send_customer WHERE dtb_send_customer.send_id = dtb_send_history.send_id) AS count_all';
121        $col .= ',(SELECT COUNT(*) FROM dtb_send_customer WHERE dtb_send_customer.send_id = dtb_send_history.send_id AND send_flag = 1) AS count_sent';
122        $col .= ',(SELECT COUNT(*) FROM dtb_send_customer WHERE dtb_send_customer.send_id = dtb_send_history.send_id AND send_flag = 2) AS count_error';
123        $col .= ',(SELECT COUNT(*) FROM dtb_send_customer WHERE dtb_send_customer.send_id = dtb_send_history.send_id AND send_flag IS NULL) AS count_unsent';
124
125        // ページ送りの取得
126        $offset = SEARCH_PMAX * ($search_pageno - 1);
127        $objSelect->setLimitOffset(SEARCH_PMAX, $offset);
128        $arrResult = $objSelect->select($col, 'dtb_send_history', ' del_flg = 0');
129
130        $objNavi = new SC_PageNavi_Ex($search_pageno,
131                                    $linemax,
132                                    SEARCH_PMAX);
133
134        return array($linemax, $arrResult, $objNavi->arrPagenavi);
135    }
136
137    /**
138     * 送信履歴の削除
139     * @param integer $send_id 削除したい送信履歴のID
140     * @return void
141     */
142    function lfDeleteHistory($send_id) {
143            $objQuery =& SC_Query_Ex::getSingletonInstance();
144            $objQuery->update('dtb_send_history',
145                              array('del_flg' =>1),
146                              'send_id = ?',
147                              array($send_id));
148    }
149}
Note: See TracBrowser for help on using the repository browser.