Changeset 22603
- Timestamp:
- 2013/03/05 09:21:53 (10 years ago)
- Location:
- branches/version-2_12-dev/data/class
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/helper/SC_Helper_Category.php
r22597 r22603 71 71 public function getList($cid_to_key = FALSE) 72 72 { 73 static $arrCategory = array() ;73 static $arrCategory = array(), $cidIsKey = array(); 74 74 75 75 if (!isset($arrCategory[$this->count_check])) { … … 90 90 91 91 if ($cid_to_key) { 92 // 配列のキーをカテゴリーIDに 93 return SC_Utils_Ex::makeArrayIDToKey('category_id', $arrCategory[$this->count_check]); 92 if (!isset($cidIsKey[$this->count_check])) { 93 // 配列のキーをカテゴリーIDに 94 $cidIsKey[$this->count_check] = SC_Utils_Ex::makeArrayIDToKey('category_id', $arrCategory[$this->count_check]); 95 } 96 return $cidIsKey[$this->count_check]; 94 97 } 95 98 … … 104 107 public function getTree() 105 108 { 106 $arrList = $this->getList(); 107 $arrTree = SC_Utils_Ex::buildTree('category_id', 'parent_category_id', LEVEL_MAX, $arrList); 108 return $arrTree; 109 static $arrTree = array(); 110 if (!isset($arrTree[$this->count_check])) { 111 $arrList = $this->getList(); 112 $arrTree[$this->count_check] = SC_Utils_Ex::buildTree('category_id', 'parent_category_id', LEVEL_MAX, $arrList); 113 } 114 return $arrTree[$this->count_check]; 109 115 } 110 116 … … 118 124 public function getTreeTrail($category_id, $id_only = TRUE) 119 125 { 120 $arrCategory = $this->getList( );121 $arrTrailID = SC_Utils_Ex::getTreeTrail($category_id, 'category_id', 'parent_category_id', $arrCategory, 0, $id_only);126 $arrCategory = $this->getList(TRUE); 127 $arrTrailID = SC_Utils_Ex::getTreeTrail($category_id, 'category_id', 'parent_category_id', $arrCategory, TRUE, 0, $id_only); 122 128 return $arrTrailID; 123 129 } -
branches/version-2_12-dev/data/class/util/SC_Utils.php
r22602 r22603 1969 1969 * @param string $glue_key 親IDキー名 1970 1970 * @param array $correction 階層構造が含まれている配列 1971 * @param boolean $cid_is_key キーがIDの配列の場合はtrue 1971 1972 * @param integer $root_id ルートID 1972 1973 * @param boolean $id_only IDだけの配列を返す場合はtrue 1973 1974 * @return array 親ID配列 1974 1975 */ 1975 public static function getTreeTrail($start_id, $primary_key, $glue_key, $correction = array(), $root_id = 0, $id_only = TRUE) 1976 { 1977 $arrIDToKay = SC_Utils_Ex::makeArrayIDToKey($primary_key, $correction); 1976 public static function getTreeTrail($start_id, $primary_key, $glue_key, $correction = array(), $cid_is_key = FALSE, $root_id = 0, $id_only = TRUE) 1977 { 1978 if ($cid_is_key) { 1979 $arrIDToKay = $correction; 1980 } else { 1981 $arrIDToKay = SC_Utils_Ex::makeArrayIDToKey($primary_key, $correction); 1982 } 1978 1983 $id = $start_id; 1979 1984 $arrTrail = array();
Note: See TracChangeset
for help on using the changeset viewer.