Changeset 17284 for branches/comu-ver2/data/class/helper/SC_Helper_DB.php
- Timestamp:
- 2008/04/24 16:42:17 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/comu-ver2/data/class/helper/SC_Helper_DB.php
r17283 r17284 708 708 function sfGetLevelCatList($parent_zero = true) { 709 709 $objQuery = new SC_Query(); 710 711 // カテゴリ名リストを取得 712 $col = "category_id, parent_category_id, category_name"; 713 $where = "del_flg = 0"; 714 $objQuery->setoption("ORDER BY level"); 715 $arrRet = $objQuery->select($col, "dtb_category", $where); 716 $arrCatName = array(); 717 foreach ($arrRet as $arrTmp) { 718 $arrCatName[$arrTmp['category_id']] = 719 (($arrTmp['parent_category_id'] > 0)? 720 $arrCatName[$arrTmp['parent_category_id']] : "") 721 . CATEGORY_HEAD . $arrTmp['category_name']; 722 } 723 710 724 $col = "category_id, parent_category_id, category_name, level"; 711 725 $where = "del_flg = 0"; … … 725 739 } 726 740 727 $arrOutput[$cnt] = ""; 728 729 // 子カテゴリから親カテゴリを検索 730 $parent_category_id = $arrRet[$cnt]['parent_category_id']; 731 for($cat_cnt = $arrRet[$cnt]['level']; $cat_cnt > 1; $cat_cnt--) { 732 733 foreach ($arrRet as $arrCat) { 734 // 親が見つかったら順番に代入 735 if ($arrCat['category_id'] == $parent_category_id) { 736 737 $arrOutput[$cnt] = CATEGORY_HEAD 738 . $arrCat['category_name'] . $arrOutput[$cnt]; 739 $parent_category_id = $arrCat['parent_category_id']; 740 } 741 } 742 } 743 $arrOutput[$cnt].= CATEGORY_HEAD . $arrRet[$cnt]['category_name']; 741 $arrOutput[$cnt] = $arrCatName[$arrRet[$cnt]['category_id']]; 744 742 } 745 743
Note: See TracChangeset
for help on using the changeset viewer.