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

Revision 23124, 4.5 KB checked in by kimoto, 11 years ago (diff)

#2043 typo修正・ソース整形・ソースコメントの改善 for 2.13.0
PHP4的な書き方の修正

  • 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    public 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    public function process()
57    {
58        $this->action();
59        $this->sendResponse();
60    }
61
62    /**
63     * Page のアクション.
64     *
65     * @return void
66     */
67    public 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     * @param  integer $search_pageno 表示したいページ番号
89     * @return array(  integer 全体件数, mixed メール配信データ一覧配列, mixed SC_PageNaviオブジェクト)
90     */
91    public function lfDoSearch($search_pageno = 1)
92    {
93        // 引数の初期化
94        if (SC_Utils_Ex::sfIsInt($search_pageno)===false) {
95            $search_pageno = 1;
96        }
97        //
98        $objSelect =& SC_Query_Ex::getSingletonInstance();    // 一覧データ取得用
99        $objQuery =& SC_Query_Ex::getSingletonInstance();    // 件数取得用
100
101        // 該当全体件数の取得
102        $linemax = $objQuery->count('dtb_send_history','del_flg = 0');
103
104        // 一覧データの取得
105        $objSelect->setOrder('start_date DESC, send_id DESC');
106
107        $col = '*';
108        $col .= ',(SELECT COUNT(*) FROM dtb_send_customer WHERE dtb_send_customer.send_id = dtb_send_history.send_id) AS count_all';
109        $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';
110        $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';
111        $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';
112
113        // ページ送りの取得
114        $offset = SEARCH_PMAX * ($search_pageno - 1);
115        $objSelect->setLimitOffset(SEARCH_PMAX, $offset);
116        $arrResult = $objSelect->select($col, 'dtb_send_history', ' del_flg = 0');
117
118        $objNavi = new SC_PageNavi_Ex($search_pageno,
119                                    $linemax,
120                                    SEARCH_PMAX);
121
122        return array($linemax, $arrResult, $objNavi->arrPagenavi);
123    }
124
125    /**
126     * 送信履歴の削除
127     * @param  integer $send_id 削除したい送信履歴のID
128     * @return void
129     */
130    public function lfDeleteHistory($send_id)
131    {
132            $objQuery =& SC_Query_Ex::getSingletonInstance();
133            $objQuery->update('dtb_send_history',
134                              array('del_flg' =>1),
135                              'send_id = ?',
136                              array($send_id));
137    }
138}
Note: See TracBrowser for help on using the repository browser.