source: branches/version-2_12-dev/data/class/helper/SC_Helper_Delivery.php @ 22543

Revision 22543, 2.8 KB checked in by pineray, 11 years ago (diff)

#2136 SC_Helper_Deliveryクラスを作成

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
24/**
25 * 配送方法を管理するヘルパークラス.
26 *
27 * @package Helper
28 * @author pineray
29 * @version $Id:$
30 */
31class SC_Helper_Delivery
32{
33
34    /**
35     * 配送方法一覧の取得.
36     *
37     * @param boolean $has_deleted 削除された支払方法も含む場合 true; 初期値 false
38     * @return array
39     */
40    public function getList($has_deleted = false) {
41        $objQuery =& SC_Query_Ex::getSingletonInstance();
42        $col = '*';
43        $where = '';
44        if (!$has_deleted) {
45            $where .= 'del_flg = 0';
46        }
47        $table = 'dtb_deliv';
48        $objQuery->setOrder('rank DESC');
49        $arrRet = $objQuery->select($col, $table, $where);
50        return $arrRet;
51    }
52
53    /**
54     * 配送方法の削除.
55     *
56     * @param integer $deliv_id 配送方法ID
57     * @return void
58     */
59    public function delete($deliv_id) {
60        $objDb = new SC_Helper_DB_Ex();
61        // ランク付きレコードの削除
62        $objDb->sfDeleteRankRecord('dtb_deliv', 'deliv_id', $deliv_id);
63    }
64
65    /**
66     * 配送方法の表示順をひとつ上げる.
67     *
68     * @param integer $deliv_id 配送方法ID
69     * @return void
70     */
71    public function rankUp($deliv_id) {
72        $objDb = new SC_Helper_DB_Ex();
73        $objDb->sfRankUp('dtb_deliv', 'deliv_id', $deliv_id);
74    }
75
76    /**
77     * 配送方法の表示順をひとつ下げる.
78     *
79     * @param integer $deliv_id 配送方法ID
80     * @return void
81     */
82    public function rankDown($deliv_id) {
83        $objDb = new SC_Helper_DB_Ex();
84        $objDb->sfRankDown('dtb_deliv', 'deliv_id', $deliv_id);
85    }
86
87    /**
88     * 配送方法IDをキー, 名前を値とする配列を取得.
89     *
90     * @param string $type 値のタイプ
91     * @return array
92     */
93    public static function getIDValueList($type = 'name') {
94        return SC_Helper_DB_Ex::sfGetIDValueList('dtb_deliv', 'deliv_id', $type);
95    }
96}
Note: See TracBrowser for help on using the repository browser.