Ignore:
Timestamp:
2013/03/01 10:01:07 (11 years ago)
Author:
pineray
Message:

#2166 再利用性を高めた形へ変更

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_12-dev/data/class/helper/SC_Helper_Category.php

    r22588 r22589  
    3131class SC_Helper_Category 
    3232{ 
     33    private $count_check; 
     34 
     35    /** 
     36     * コンストラクター 
     37     *  
     38     * @param boolean $count_check 登録商品数をチェックする場合はtrue 
     39     */ 
     40    function __construct($count_check = FALSE) 
     41    { 
     42        $this->count_check = $count_check; 
     43    } 
     44 
    3345    /** 
    3446     * カテゴリー一覧の取得. 
    3547     *  
    36      * @param boolean $count_check 登録商品数をチェックする場合はtrue 
    3748     * @param boolean $cid_to_key 配列のキーをカテゴリーIDにする場合はtrue 
    3849     * @return array カテゴリー一覧の配列 
    3950     */ 
    40     public function getList($count_check = FALSE, $cid_to_key = FALSE) 
     51    public function getList($cid_to_key = FALSE) 
    4152    { 
    4253        $objQuery =& SC_Query_Ex::getSingletonInstance(); 
     
    4455        $from = 'dtb_category left join dtb_category_total_count ON dtb_category.category_id = dtb_category_total_count.category_id'; 
    4556        // 登録商品数のチェック 
    46         if ($count_check) { 
     57        if ($this->count_check) { 
    4758            $where = 'del_flg = 0 AND product_count > 0'; 
    4859        } else { 
     
    5465        if ($cid_to_key) { 
    5566            // 配列のキーをカテゴリーIDに 
    56             $arrTmp = array(); 
    57             foreach ($arrCategory as $category) { 
    58                 $arrTmp[$category['category_id']] = $category; 
    59             } 
    60             $arrCategory =& $arrTmp; 
    61             unset($arrTmp); 
     67            $arrCategory = SC_Utils_Ex::makeArrayIDToKey('category_id', $arrCategory); 
    6268        } 
    6369         
     
    6874     * カテゴリーツリーの取得. 
    6975     *  
    70      * @param boolean $count_check 登録商品数をチェックする場合はtrue 
    7176     * @return type 
    7277     */ 
    73     public function getTree($count_check = FALSE) 
     78    public function getTree() 
    7479    { 
    75         $arrList = $this->getList($count_check); 
     80        $arrList = $this->getList(); 
    7681        $arrTree = SC_Utils_Ex::buildTree('category_id', 'parent_category_id', LEVEL_MAX, $arrList); 
    7782        return $arrTree; 
Note: See TracChangeset for help on using the changeset viewer.