Ignore:
Timestamp:
2014/05/20 17:56:50 (10 years ago)
Author:
pineray
Message:

#2554 カテゴリーの削除処理を SC_Helper_Category へ移動

File:
1 edited

Legend:

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

    r23124 r23435  
    132132        return $arrTrailID; 
    133133    } 
     134 
     135    /** 
     136     * 指定カテゴリーの子孫カテゴリーを取得 
     137     * 
     138     * @param int $category_id カテゴリーID 
     139     * @return array 
     140     */ 
     141    public function getTreeBranch($category_id) { 
     142        $arrTree = $this->getTree(); 
     143        $arrTrail = $this->getTreeTrail($category_id, true); 
     144 
     145        // ルートから指定カテゴリーまでたどる. 
     146        foreach ($arrTrail as $parent_id) { 
     147            $nextTree = array(); 
     148            foreach ($arrTree as $branch) { 
     149                if ($branch['category_id'] == $parent_id && isset($branch['children'])) { 
     150                    $nextTree = $branch['children']; 
     151                } 
     152            } 
     153            $arrTree = $nextTree; 
     154        } 
     155 
     156        return $arrTree; 
     157    } 
     158 
     159    /** 
     160     * カテゴリーの削除 
     161     * 
     162     * @param int $category_id カテゴリーID 
     163     * @return void 
     164     */ 
     165    public function delete($category_id) { 
     166        $objDb = new SC_Helper_DB_Ex(); 
     167        // ランク付きレコードの削除(※処理負荷を考慮してレコードごと削除する。) 
     168        $objDb->sfDeleteRankRecord('dtb_category', 'category_id', $category_id, '', true); 
     169    } 
    134170} 
Note: See TracChangeset for help on using the changeset viewer.