Changeset 20171


Ignore:
Timestamp:
2011/02/16 14:12:30 (13 years ago)
Author:
coelacanth
Message:

#964 リファクタリング 共通処理をヘルパークラスへ移動

Location:
branches/version-2_5-dev/data/class
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_5-dev/data/class/helper/SC_Helper_DB.php

    r20167 r20171  
    138138     * 
    139139     * @param boolean $force 強制的にDB取得するか 
     140     * @param string $col 取得カラムを指定する 
    140141     * @return array 店舗基本情報の配列 
    141142     */ 
    142     function sfGetBasisData($force = false) { 
     143    function sfGetBasisData($force = false, $col = "") { 
    143144        static $data; 
    144145 
    145146        if ($force || !isset($data)) { 
    146147            $objQuery =& SC_Query::getSingletonInstance(); 
    147             $arrRet = $objQuery->select('*', 'dtb_baseinfo'); 
     148 
     149            if ($col === "") { 
     150                $arrRet = $objQuery->select('*', 'dtb_baseinfo'); 
     151            } else { 
     152                $arrRet = $objQuery->select($col, "dtb_baseinfo"); 
     153            } 
    148154 
    149155            if (isset($arrRet[0])) { 
     
    153159            } 
    154160        } 
    155  
    156161        return $data; 
    157162    } 
     163 
     164    /** 
     165     * 基本情報の登録数を取得する 
     166     * 
     167     * @return int 
     168     */ 
     169    function sfGetBasisCount() { 
     170        $objQuery =& SC_Query::getSingletonInstance(); 
     171 
     172        return $objQuery->count("dtb_baseinfo"); 
     173    } 
     174 
    158175 
    159176    /* 選択中のアイテムのルートカテゴリIDを取得する */ 
  • branches/version-2_5-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis.php

    r20168 r20171  
    8484        SC_Utils_Ex::sfIsSuccess($objSess); 
    8585 
    86         $cnt = $this->lfGetBaseInfoCount(); 
    87  
     86        $objDb = new SC_Helper_DB_Ex(); 
     87 
     88        $cnt = $objDb->sfGetBasisCount(); 
    8889        if ($cnt > 0) { 
    8990            $this->tpl_mode = "update"; 
     
    123124            $arrCol = $this->lfGetCol(); 
    124125            $col    = SC_Utils_Ex::sfGetCommaList($arrCol); 
    125             $arrRet = $this->lfGetBaseInfoData($col); 
    126             $this->arrForm = $arrRet[0]; 
     126            $arrRet = $objDb->sfGetBasisData(true, $col); 
     127            $this->arrForm = $arrRet; 
    127128 
    128129            $regular_holiday_ids = explode('|', $this->arrForm['regular_holiday_ids']); 
     
    139140    function destroy() { 
    140141        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"); 
    163142    } 
    164143 
  • branches/version-2_5-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_Point.php

    r20168 r20171  
    7777        SC_Utils_Ex::sfIsSuccess($objSess); 
    7878 
     79        $objDb = new SC_Helper_DB_Ex(); 
     80 
    7981        // パラメータ管理クラス 
    8082        $this->objFormParam = new SC_FormParam(); 
     
    8486        $this->objFormParam->setParam($_POST); 
    8587 
    86         $cnt = $this->lfGetBaseInfoCount(); 
     88        $cnt = $objDb->sfGetBasisCount(); 
    8789        if ($cnt > 0) { 
    8890            $this->tpl_mode = "update"; 
     
    114116            $arrCol = $this->objFormParam->getKeyList(); // キー名一覧を取得 
    115117            $col    = SC_Utils_Ex::sfGetCommaList($arrCol); 
    116             $arrRet = $this->lfGetBaseInfoData($col); 
    117             $this->objFormParam->setParam($arrRet[0]); 
     118            $arrRet = $objDb->sfGetBasisData(true, $col); 
     119            $this->objFormParam->setParam($arrRet); 
    118120        } 
    119121 
     
    128130    function destroy() { 
    129131        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"); 
    152132    } 
    153133 
  • branches/version-2_5-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_Tradelaw.php

    r20168 r20171  
    8080        SC_Utils_Ex::sfIsSuccess($objSess); 
    8181 
     82        $objDb = new SC_Helper_DB_Ex(); 
     83 
    8284        // パラメータ管理クラス 
    8385        $this->objFormParam = new SC_FormParam(); 
     
    8789        $this->objFormParam->setParam($_POST); 
    8890 
    89         $cnt = $this->lfGetBaseInfoCount(); 
    90  
     91        $cnt = $objDb->sfGetBasisCount(); 
    9192        if ($cnt > 0) { 
    9293            $this->tpl_mode = "update"; 
     
    118119            $arrCol = $this->objFormParam->getKeyList(); // キー名一覧を取得 
    119120            $col    = SC_Utils_Ex::sfGetCommaList($arrCol); 
    120             $arrRet = $this->lfGetBaseInfoData($col); 
    121             $this->objFormParam->setParam($arrRet[0]); 
     121            $arrRet = $objDb->sfGetBasisData(true, $col); 
     122            $this->objFormParam->setParam($arrRet); 
    122123        } 
    123124 
     
    132133    function destroy() { 
    133134        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"); 
    156135    } 
    157136 
Note: See TracChangeset for help on using the changeset viewer.