Ignore:
Timestamp:
2007/08/10 18:33:39 (17 years ago)
Author:
nanasess
Message:

リファクタリング

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/feature-module-update/data/class/helper/SC_Helper_DB.php

    r15237 r15279  
    1414 */ 
    1515class SC_Helper_DB { 
     16 
     17    // {{{ properties 
     18 
     19    /** ルートカテゴリ取得フラグ */ 
     20    var $g_root_on; 
     21 
     22    /** ルートカテゴリID */ 
     23    var $g_root_id; 
    1624 
    1725    // }}} 
     
    166174        } 
    167175        return $ret; 
     176    } 
     177 
     178    /** 
     179     * 店舗基本情報を取得する. 
     180     * 
     181     * @return array 店舗基本情報の配列 
     182     */ 
     183    function sf_getBasisData() { 
     184        //DBから設定情報を取得 
     185        $objConn = new SC_DbConn(); 
     186        $result = $objConn->getAll("SELECT * FROM dtb_baseinfo"); 
     187        if(is_array($result[0])) { 
     188            foreach ( $result[0] as $key=>$value ){ 
     189                $CONF["$key"] = $value; 
     190            } 
     191        } 
     192        return $CONF; 
     193    } 
     194 
     195    /* 選択中のアイテムのルートカテゴリIDを取得する */ 
     196    function sfGetRootId() { 
     197 
     198        if(!$this->g_root_on)   { 
     199            $this->g_root_on = true; 
     200            $objQuery = new SC_Query(); 
     201 
     202            if (!isset($_GET['product_id'])) $_GET['product_id'] = ""; 
     203            if (!isset($_GET['category_id'])) $_GET['category_id'] = ""; 
     204 
     205            if(!empty($_GET['product_id']) || !empty($_GET['category_id'])) { 
     206                // 選択中のカテゴリIDを判定する 
     207                $category_id = SC_Utils_Ex::sfGetCategoryId($_GET['product_id'], $_GET['category_id']); 
     208                // ROOTカテゴリIDの取得 
     209                $arrRet = SC_Utils_Ex::sfGetParents($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $category_id); 
     210                $root_id = $arrRet[0]; 
     211            } else { 
     212                // ROOTカテゴリIDをなしに設定する 
     213                $root_id = ""; 
     214            } 
     215            $this->g_root_id = $root_id; 
     216        } 
     217        return $this->g_root_id; 
    168218    } 
    169219 
Note: See TracChangeset for help on using the changeset viewer.