Changeset 20168


Ignore:
Timestamp:
2011/02/15 17:31:03 (13 years ago)
Author:
coelacanth
Message:

#964 アクションからデータベース操作処理を除去

Location:
branches/version-2_5-dev/data/class/pages/admin/basis
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_5-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis.php

    r20166 r20168  
    8080    function action() { 
    8181        $objSess = new SC_Session(); 
    82         $objQuery =& SC_Query::getSingletonInstance(); 
    8382 
    8483        // 認証可否の判定 
    8584        SC_Utils_Ex::sfIsSuccess($objSess); 
    8685 
    87         $cnt = $objQuery->count("dtb_baseinfo"); 
     86        $cnt = $this->lfGetBaseInfoCount(); 
    8887 
    8988        if ($cnt > 0) { 
     
    123122        } else { 
    124123            $arrCol = $this->lfGetCol(); 
    125             $col    = SC_Utils_Ex::sfGetCommaList($arrCol); 
    126             $arrRet = $objQuery->select($col, "dtb_baseinfo"); 
     124            $col    = SC_Utils_Ex::sfGetCommaList($arrCol); 
     125            $arrRet = $this->lfGetBaseInfoData($col); 
    127126            $this->arrForm = $arrRet[0]; 
    128127 
     
    140139    function destroy() { 
    141140        parent::destroy(); 
     141    } 
     142 
     143    /** 
     144     * 基本情報の登録数を取得する 
     145     * 
     146     * @return int 
     147     */ 
     148    function lfGetBaseInfoCount() { 
     149        $objQuery =& SC_Query::getSingletonInstance(); 
     150 
     151        return $objQuery->count("dtb_baseinfo"); 
     152    } 
     153 
     154    /** 
     155     * 基本情報のデータを取得する 
     156     * 
     157     * @return array 
     158     */ 
     159    function lfGetBaseInfoData($col) { 
     160        $objQuery =& SC_Query::getSingletonInstance(); 
     161 
     162        return $objQuery->select($col, "dtb_baseinfo"); 
    142163    } 
    143164 
  • branches/version-2_5-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_Delivery.php

    r20164 r20168  
    7171    function action() { 
    7272        $objSess = new SC_Session(); 
    73         $objQuery =& SC_Query::getSingletonInstance(); 
    7473        $objDb = new SC_Helper_DB_Ex(); 
    7574 
     
    9594        } 
    9695 
    97         // 配送業者一覧の取得 
     96        $this->arrDelivList = $this->lfGetDelivList(); 
     97    } 
     98 
     99    /** 
     100     * 配送業者一覧の取得 
     101     * 
     102     * @return array 
     103     */ 
     104    function lfGetDelivList() { 
     105        $objQuery =& SC_Query::getSingletonInstance(); 
     106 
    98107        $col = "deliv_id, name, service_name"; 
    99108        $where = "del_flg = 0"; 
    100109        $table = "dtb_deliv"; 
    101110        $objQuery->setOrder("rank DESC"); 
    102         $this->arrDelivList = $objQuery->select($col, $table, $where); 
     111 
     112        return $objQuery->select($col, $table, $where); 
    103113    } 
    104114 
  • branches/version-2_5-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_Holiday.php

    r20164 r20168  
    6868    function action() { 
    6969        $objSess = new SC_Session(); 
    70         $objQuery =& SC_Query::getSingletonInstance(); 
    7170        $objDb = new SC_Helper_DB_Ex(); 
    7271 
     
    110109        // 編集前処理 
    111110        case 'pre_edit': 
    112             // 編集項目をDBより取得する。 
    113             $where = "holiday_id = ?"; 
    114             $arrRet = $objQuery->select("title, month, day", "dtb_holiday", $where, array($_POST['holiday_id'])); 
     111            // 編集項目を取得する。 
     112            $arrHolidayData = $this->lfGetHolidayDataByHolidayID($_POST['holiday_id']); 
     113 
    115114            // 入力項目にカテゴリ名を入力する。 
    116             $this->arrForm['title'] = $arrRet[0]['title']; 
    117             $this->arrForm['month'] = $arrRet[0]['month']; 
    118             $this->arrForm['day'] = $arrRet[0]['day']; 
     115            $this->arrForm['title'] = $arrHolidayData[0]['title']; 
     116            $this->arrForm['month'] = $arrHolidayData[0]['month']; 
     117            $this->arrForm['day'] = $arrHolidayData[0]['day']; 
    119118            // POSTデータを引き継ぐ 
    120119            $this->tpl_holiday_id = $_POST['holiday_id']; 
     
    134133        } 
    135134 
    136         // 規格の読込 
     135        $this->arrHoliday = $this->lfGetHolidayList(); 
     136    } 
     137 
     138    /** 
     139     * デストラクタ. 
     140     * 
     141     * @return void 
     142     */ 
     143    function destroy() { 
     144        parent::destroy(); 
     145    } 
     146 
     147    function lfGetHolidayDataByHolidayID($holiday_id) { 
     148        $objQuery =& SC_Query::getSingletonInstance(); 
     149 
     150        $where = "holiday_id = ?"; 
     151        return $objQuery->select("title, month, day", "dtb_holiday", $where, array($holiday_id)); 
     152    } 
     153 
     154    function lfGetHolidayList() { 
     155        $objQuery =& SC_Query::getSingletonInstance(); 
     156 
    137157        $where = "del_flg <> 1"; 
    138158        $objQuery->setOrder("rank DESC"); 
    139         $this->arrHoliday = $objQuery->select("holiday_id, title, month, day", "dtb_holiday", $where); 
    140     } 
    141  
    142     /** 
    143      * デストラクタ. 
    144      * 
    145      * @return void 
    146      */ 
    147     function destroy() { 
    148         parent::destroy(); 
     159        return $objQuery->select("holiday_id, title, month, day", "dtb_holiday", $where); 
    149160    } 
    150161 
  • branches/version-2_5-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_Kiyaku.php

    r20164 r20168  
    6868    function action() { 
    6969        $objSess = new SC_Session(); 
    70         $objQuery =& SC_Query::getSingletonInstance(); 
    7170        $objDb = new SC_Helper_DB_Ex(); 
    7271 
     
    106105        // 編集前処理 
    107106        case 'pre_edit': 
    108             // 編集項目をDBより取得する。 
    109             $where = "kiyaku_id = ?"; 
    110             $arrRet = $objQuery->select("kiyaku_text, kiyaku_title", "dtb_kiyaku", $where, array($_POST['kiyaku_id'])); 
     107            // 編集項目を取得する。 
     108            $arrKiyakuData = $this->lfGetKiyakuDataByKiyakuID($_POST['kiyaku_id']); 
     109 
    111110            // 入力項目にカテゴリ名を入力する。 
    112             $this->arrForm['kiyaku_title'] = $arrRet[0]['kiyaku_title']; 
    113             $this->arrForm['kiyaku_text'] = $arrRet[0]['kiyaku_text']; 
     111            $this->arrForm['kiyaku_title'] = $arrKiyakuData[0]['kiyaku_title']; 
     112            $this->arrForm['kiyaku_text'] = $arrKiyakuData[0]['kiyaku_text']; 
    114113            // POSTデータを引き継ぐ 
    115114            $this->tpl_kiyaku_id = $_POST['kiyaku_id']; 
     
    129128        } 
    130129 
    131         // 規格の読込 
    132         $where = "del_flg <> 1"; 
    133         $objQuery->setOrder("rank DESC"); 
    134         $this->arrKiyaku = $objQuery->select("kiyaku_title, kiyaku_text, kiyaku_id", "dtb_kiyaku", $where); 
     130        $this->arrKiyaku = $this->lfGetKiyakuList(); 
    135131    } 
    136132 
     
    158154        $ret = $objQuery->insert("dtb_kiyaku", $sqlval); 
    159155        return $ret; 
     156    } 
     157 
     158    function lfGetKiyakuDataByKiyakuID($kiyaku_id) { 
     159        $objQuery =& SC_Query::getSingletonInstance(); 
     160 
     161        $where = "kiyaku_id = ?"; 
     162        return $objQuery->select("kiyaku_text, kiyaku_title", "dtb_kiyaku", $where, array($kiyaku_id)); 
     163    } 
     164 
     165    function lfGetKiyakuList() { 
     166        $objQuery =& SC_Query::getSingletonInstance(); 
     167 
     168        $where = "del_flg <> 1"; 
     169        $objQuery->setOrder("rank DESC"); 
     170        return $objQuery->select("kiyaku_title, kiyaku_text, kiyaku_id", "dtb_kiyaku", $where); 
    160171    } 
    161172 
  • branches/version-2_5-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_Mail.php

    r20164 r20168  
    6767     */ 
    6868    function action() { 
    69         $objQuery =& SC_Query::getSingletonInstance(); 
     69 
    7070        $objSess = new SC_Session(); 
    7171        $masterData = new SC_DB_MasterData_Ex(); 
     
    8181 
    8282            if ( SC_Utils_Ex::sfCheckNumLength( $_POST['template_id']) ){ 
    83                 $sql = "SELECT * FROM dtb_mailtemplate WHERE template_id = ?"; 
    84                 $result = $objQuery->getAll($sql, array($_POST['template_id']) ); 
     83                $result = $this->lfGetMailTemplateByTemplateID($_POST['template_id']); 
    8584                if ( $result ){ 
    8685                    $this->arrForm = $result[0]; 
     
    103102                } else { 
    104103                    // 正常 
    105                     $this->lfRegist($objQuery, $this->arrForm); 
     104                    $this->lfRegist($this->arrForm); 
    106105 
    107106                    // 完了メッセージ 
     
    125124    } 
    126125 
    127     function lfRegist(&$objQuery, $data ){ 
     126    function lfGetMailTemplateByTemplateID($template_id) { 
     127        $objQuery =& SC_Query::getSingletonInstance(); 
     128 
     129        $sql = "SELECT * FROM dtb_mailtemplate WHERE template_id = ?"; 
     130        return $objQuery->getAll($sql, array($template_id) ); 
     131    } 
     132 
     133    function lfRegist($data ){ 
     134        $objQuery =& SC_Query::getSingletonInstance(); 
    128135 
    129136        $data['creator_id'] = $_SESSION['member_id']; 
  • branches/version-2_5-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_Point.php

    r20166 r20168  
    7373    function action() { 
    7474        $objSess = new SC_Session(); 
    75         $objQuery =& SC_Query::getSingletonInstance(); 
    7675 
    7776        // 認証可否の判定 
     
    8584        $this->objFormParam->setParam($_POST); 
    8685 
    87         $cnt = $objQuery->count("dtb_baseinfo"); 
    88  
     86        $cnt = $this->lfGetBaseInfoCount(); 
    8987        if ($cnt > 0) { 
    9088            $this->tpl_mode = "update"; 
     
    116114            $arrCol = $this->objFormParam->getKeyList(); // キー名一覧を取得 
    117115            $col    = SC_Utils_Ex::sfGetCommaList($arrCol); 
    118             // DB値の取得 
    119             $arrRet = $objQuery->select($col, "dtb_baseinfo"); 
     116            $arrRet = $this->lfGetBaseInfoData($col); 
    120117            $this->objFormParam->setParam($arrRet[0]); 
    121118        } 
     
    131128    function destroy() { 
    132129        parent::destroy(); 
     130    } 
     131 
     132    /** 
     133     * 基本情報の登録数を取得する 
     134     * 
     135     * @return int 
     136     */ 
     137    function lfGetBaseInfoCount() { 
     138        $objQuery =& SC_Query::getSingletonInstance(); 
     139 
     140        return $objQuery->count("dtb_baseinfo"); 
     141    } 
     142 
     143    /** 
     144     * 基本情報のデータを取得する 
     145     * 
     146     * @return array 
     147     */ 
     148    function lfGetBaseInfoData($col) { 
     149        $objQuery =& SC_Query::getSingletonInstance(); 
     150 
     151        return $objQuery->select($col, "dtb_baseinfo"); 
    133152    } 
    134153 
  • branches/version-2_5-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_Tradelaw.php

    r20166 r20168  
    7676    function action() { 
    7777        $objSess = new SC_Session(); 
    78         $objQuery =& SC_Query::getSingletonInstance(); 
    7978 
    8079        // 認証可否の判定 
     
    8887        $this->objFormParam->setParam($_POST); 
    8988 
    90         $cnt = $objQuery->count("dtb_baseinfo"); 
     89        $cnt = $this->lfGetBaseInfoCount(); 
    9190 
    9291        if ($cnt > 0) { 
     
    119118            $arrCol = $this->objFormParam->getKeyList(); // キー名一覧を取得 
    120119            $col    = SC_Utils_Ex::sfGetCommaList($arrCol); 
    121             // DB値の取得 
    122             $arrRet = $objQuery->select($col, "dtb_baseinfo"); 
     120            $arrRet = $this->lfGetBaseInfoData($col); 
    123121            $this->objFormParam->setParam($arrRet[0]); 
    124122        } 
     
    134132    function destroy() { 
    135133        parent::destroy(); 
     134    } 
     135 
     136    /** 
     137     * 基本情報の登録数を取得する 
     138     * 
     139     * @return int 
     140     */ 
     141    function lfGetBaseInfoCount() { 
     142        $objQuery =& SC_Query::getSingletonInstance(); 
     143 
     144        return $objQuery->count("dtb_baseinfo"); 
     145    } 
     146 
     147    /** 
     148     * 基本情報のデータを取得する 
     149     * 
     150     * @return array 
     151     */ 
     152    function lfGetBaseInfoData($col) { 
     153        $objQuery =& SC_Query::getSingletonInstance(); 
     154 
     155        return $objQuery->select($col, "dtb_baseinfo"); 
    136156    } 
    137157 
  • branches/version-2_5-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_ZipInstall.php

    r20164 r20168  
    9090     */ 
    9191    function action() { 
    92         $objQuery =& SC_Query::getSingletonInstance(); 
    9392 
    9493        SC_Utils_Ex::sfIsSuccess(new SC_Session); 
     
    110109                // 自動登録 
    111110                case 'auto': 
    112                     $objQuery->begin(); 
    113                     $objQuery->delete('mtb_zip'); 
    114                     $this->insertMtbZip(); 
    115                     $objQuery->commit(); 
     111                    $this->lfAutoCommit(); 
    116112                    break; 
    117113                // 手動登録 
     
    126122            // 手動削除 
    127123            case 'delete': 
    128                 $objQuery->delete('mtb_zip'); 
     124                $this->lfDeleteZip(); 
    129125 
    130126                // 進捗・完了画面を表示しない 
     
    145141    function destroy() { 
    146142        parent::destroy(); 
     143    } 
     144 
     145    function lfAutoCommit() { 
     146        $objQuery =& SC_Query::getSingletonInstance(); 
     147 
     148        $objQuery->begin(); 
     149        $objQuery->delete('mtb_zip'); 
     150        $this->insertMtbZip(); 
     151        $objQuery->commit(); 
     152    } 
     153 
     154    function lfDeleteZip() { 
     155        $objQuery =& SC_Query::getSingletonInstance(); 
     156 
     157        $objQuery->delete('mtb_zip'); 
    147158    } 
    148159 
Note: See TracChangeset for help on using the changeset viewer.