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

Revision 22857, 4.6 KB checked in by Seasoft, 11 years ago (diff)

#2043 (typo修正・ソース整形・ソースコメントの改善 for 2.13.0)

  • 主に空白・空白行の調整。
  • 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-2013 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
24require_once CLASS_EX_REALDIR . 'page_extends/admin/LC_Page_Admin_Ex.php';
25
26/**
27 * メール配信履歴 のページクラス.
28 *
29 * @package Page
30 * @author LOCKON CO.,LTD.
31 * @version $Id$
32 */
33class LC_Page_Admin_Mail_History extends LC_Page_Admin_Ex
34{
35    /**
36     * Page を初期化する.
37     *
38     * @return void
39     */
40    function init()
41    {
42        parent::init();
43        $this->tpl_mainpage = 'mail/history.tpl';
44        $this->tpl_mainno = 'mail';
45        $this->tpl_subno = 'history';
46        $this->tpl_maintitle = 'メルマガ管理';
47        $this->tpl_subtitle = '配信履歴';
48        $this->tpl_pager = 'pager.tpl';
49    }
50
51    /**
52     * Page のプロセス.
53     *
54     * @return void
55     */
56    function process()
57    {
58        $this->action();
59        $this->sendResponse();
60    }
61
62    /**
63     * Page のアクション.
64     *
65     * @return void
66     */
67    function action()
68    {
69        switch ($this->getMode()) {
70            case 'delete':
71                if (SC_Utils_Ex::sfIsInt($_GET['send_id'])) {
72                    // 削除時
73                    $this->lfDeleteHistory($_GET['send_id']);
74
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    {
92        parent::destroy();
93    }
94
95    /**
96     * 実行履歴の取得
97     *
98     * @param integer $search_pageno 表示したいページ番号
99     * @return array( integer 全体件数, mixed メール配信データ一覧配列, mixed SC_PageNaviオブジェクト)
100     */
101    function lfDoSearch($search_pageno = 1)
102    {
103        // 引数の初期化
104        if (SC_Utils_Ex::sfIsInt($search_pageno)===false) {
105            $search_pageno = 1;
106        }
107        //
108        $objSelect =& SC_Query_Ex::getSingletonInstance();    // 一覧データ取得用
109        $objQuery =& SC_Query_Ex::getSingletonInstance();    // 件数取得用
110
111        // 該当全体件数の取得
112        $linemax = $objQuery->count('dtb_send_history','del_flg = 0');
113
114        // 一覧データの取得
115        $objSelect->setOrder('start_date DESC, send_id DESC');
116
117        $col = '*';
118        $col .= ',(SELECT COUNT(*) FROM dtb_send_customer WHERE dtb_send_customer.send_id = dtb_send_history.send_id) AS count_all';
119        $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';
120        $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';
121        $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';
122
123        // ページ送りの取得
124        $offset = SEARCH_PMAX * ($search_pageno - 1);
125        $objSelect->setLimitOffset(SEARCH_PMAX, $offset);
126        $arrResult = $objSelect->select($col, 'dtb_send_history', ' del_flg = 0');
127
128        $objNavi = new SC_PageNavi_Ex($search_pageno,
129                                    $linemax,
130                                    SEARCH_PMAX);
131
132        return array($linemax, $arrResult, $objNavi->arrPagenavi);
133    }
134
135    /**
136     * 送信履歴の削除
137     * @param integer $send_id 削除したい送信履歴のID
138     * @return void
139     */
140    function lfDeleteHistory($send_id)
141    {
142            $objQuery =& SC_Query_Ex::getSingletonInstance();
143            $objQuery->update('dtb_send_history',
144                              array('del_flg' =>1),
145                              'send_id = ?',
146                              array($send_id));
147    }
148}
Note: See TracBrowser for help on using the repository browser.