1 | <?php |
---|
2 | /* |
---|
3 | * This file is part of EC-CUBE |
---|
4 | * |
---|
5 | * Copyright(c) 2000-2010 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 |
---|
25 | require_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 | */ |
---|
34 | class 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_subnavi = 'mail/subnavi.tpl'; |
---|
49 | $this->tpl_subno = "history"; |
---|
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 | switch ($this->getMode()) { |
---|
71 | case 'delete': |
---|
72 | if (SC_Utils_Ex::sfIsInt($_GET['send_id'])) { |
---|
73 | // 削除時 |
---|
74 | $this->lfDeleteHistory($_GET['send_id']); |
---|
75 | $this->objDisplay->reload(null, true); |
---|
76 | } |
---|
77 | break; |
---|
78 | default: |
---|
79 | break; |
---|
80 | } |
---|
81 | |
---|
82 | list($this->tpl_linemax, $this->arrDataList, $this->arrPagenavi) = $this->lfDoSearch($_POST['search_pageno']); |
---|
83 | } |
---|
84 | |
---|
85 | /** |
---|
86 | * デストラクタ. |
---|
87 | * |
---|
88 | * @return void |
---|
89 | */ |
---|
90 | function destroy() { |
---|
91 | parent::destroy(); |
---|
92 | } |
---|
93 | |
---|
94 | /** |
---|
95 | * 実行履歴の取得 |
---|
96 | * |
---|
97 | * @param integer $search_pageno 表示したいページ番号 |
---|
98 | * @return array( integer 全体件数, mixed メール配信データ一覧配列, mixed SC_PageNaviオブジェクト) |
---|
99 | */ |
---|
100 | function lfDoSearch($search_pageno = 1) { |
---|
101 | |
---|
102 | // 引数の初期化 |
---|
103 | if(SC_Utils_Ex::sfIsInt($search_pageno)===false) $search_pageno = 1; |
---|
104 | // |
---|
105 | $objSelect =& SC_Query_Ex::getSingletonInstance(); // 一覧データ取得用 |
---|
106 | $objQuery =& SC_Query_Ex::getSingletonInstance(); // 件数取得用 |
---|
107 | |
---|
108 | // 該当全体件数の取得 |
---|
109 | $linemax = $objQuery->count("dtb_send_history","del_flg = 0"); |
---|
110 | |
---|
111 | // 一覧データの取得 |
---|
112 | $objSelect->setOrder("start_date DESC, send_id DESC"); |
---|
113 | |
---|
114 | $col = "*"; |
---|
115 | $col .= ",(SELECT COUNT(*) FROM dtb_send_customer WHERE dtb_send_customer.send_id = dtb_send_history.send_id) AS count_all"; |
---|
116 | $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"; |
---|
117 | $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"; |
---|
118 | $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"; |
---|
119 | |
---|
120 | // ページ送りの取得 |
---|
121 | $offset = SEARCH_PMAX * ($search_pageno - 1); |
---|
122 | $objSelect->setLimitOffset(SEARCH_PMAX, $offset); |
---|
123 | $arrResult = $objSelect->select($col, "dtb_send_history", " del_flg = 0"); |
---|
124 | |
---|
125 | $objNavi = new SC_PageNavi_Ex($search_pageno, |
---|
126 | $linemax, |
---|
127 | SEARCH_PMAX); |
---|
128 | |
---|
129 | return array($linemax, $arrResult, $objNavi->arrPagenavi); |
---|
130 | } |
---|
131 | |
---|
132 | /** |
---|
133 | * 送信履歴の削除 |
---|
134 | * @param integer $send_id 削除したい送信履歴のID |
---|
135 | * @return void |
---|
136 | */ |
---|
137 | function lfDeleteHistory($send_id){ |
---|
138 | $objQuery =& SC_Query_Ex::getSingletonInstance(); |
---|
139 | $objQuery->update("dtb_send_history", |
---|
140 | array('del_flg' =>1), |
---|
141 | "send_id = ?", |
---|
142 | array($send_id)); |
---|
143 | } |
---|
144 | } |
---|
145 | ?> |
---|