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

Revision 21689, 5.3 KB checked in by h_yoshimoto, 12 years ago (diff)

#1692 インスタンスを呼び出す処理を統一

  • 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        $objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance($this->plugin_activate_flg);
72        $objPlugin->doAction('lc_page_admin_mail_history_action_start', array($this));
73
74        switch ($this->getMode()) {
75            case 'delete':
76                if (SC_Utils_Ex::sfIsInt($_GET['send_id'])) {
77                    // 削除時
78                    $this->lfDeleteHistory($_GET['send_id']);
79
80                    // フックポイント.
81                    $objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance($this->plugin_activate_flg);
82                    $objPlugin->doAction('lc_page_admin_mail_history_action_delete', array($this));
83
84                    $this->objDisplay->reload(null, true);
85                }
86                break;
87            default:
88                break;
89        }
90
91        list($this->tpl_linemax, $this->arrDataList, $this->arrPagenavi) = $this->lfDoSearch($_POST['search_pageno']);
92
93        // フックポイント.
94        $objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance($this->plugin_activate_flg);
95        $objPlugin->doAction('lc_page_admin_mail_history_action_end', array($this));
96    }
97
98    /**
99     * デストラクタ.
100     *
101     * @return void
102     */
103    function destroy() {
104        parent::destroy();
105    }
106
107    /**
108     * 実行履歴の取得
109     *
110     * @param integer $search_pageno 表示したいページ番号
111     * @return array( integer 全体件数, mixed メール配信データ一覧配列, mixed SC_PageNaviオブジェクト)
112     */
113    function lfDoSearch($search_pageno = 1) {
114
115        // 引数の初期化
116        if (SC_Utils_Ex::sfIsInt($search_pageno)===false) {
117            $search_pageno = 1;
118        }
119        //
120        $objSelect =& SC_Query_Ex::getSingletonInstance();    // 一覧データ取得用
121        $objQuery =& SC_Query_Ex::getSingletonInstance();    // 件数取得用
122
123        // 該当全体件数の取得
124        $linemax = $objQuery->count('dtb_send_history','del_flg = 0');
125
126        // 一覧データの取得
127        $objSelect->setOrder('start_date DESC, send_id DESC');
128
129        $col = '*';
130        $col .= ',(SELECT COUNT(*) FROM dtb_send_customer WHERE dtb_send_customer.send_id = dtb_send_history.send_id) AS count_all';
131        $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';
132        $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';
133        $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';
134
135        // ページ送りの取得
136        $offset = SEARCH_PMAX * ($search_pageno - 1);
137        $objSelect->setLimitOffset(SEARCH_PMAX, $offset);
138        $arrResult = $objSelect->select($col, 'dtb_send_history', ' del_flg = 0');
139
140        $objNavi = new SC_PageNavi_Ex($search_pageno,
141                                    $linemax,
142                                    SEARCH_PMAX);
143
144        return array($linemax, $arrResult, $objNavi->arrPagenavi);
145    }
146
147    /**
148     * 送信履歴の削除
149     * @param integer $send_id 削除したい送信履歴のID
150     * @return void
151     */
152    function lfDeleteHistory($send_id) {
153            $objQuery =& SC_Query_Ex::getSingletonInstance();
154            $objQuery->update('dtb_send_history',
155                              array('del_flg' =>1),
156                              'send_id = ?',
157                              array($send_id));
158    }
159}
Note: See TracBrowser for help on using the repository browser.