yii框架分类树扩展示例

2020-02-10 14:12:41丽君

                            array_push($this->arrIdRoot, $strTemp);
                    }
            }

            $this->arrIdRelation = $this->helpForGetRelation($this->arrIdRelation);
            $this->arrIdLeaf = array_unique($this->arrIdLeaf);
            foreach ($this->arrIdRelation as $strTemp => $arrTemp) {
                    $this->arrIdChildren[$strTemp] = $this->helpForGetChildren($arrTemp);
                    in_array($strTemp, $this->arrIdRoot) && $this->arrIdRelationSimple[$strTemp] = $arrTemp;
            }
            $arrTemp = array_keys($this->arrIdAll);
            foreach ($arrTemp as $strTemp) {
                    $this->arrIdBackPath[$strTemp] = $this->helpForGetBackPath($strTemp);
            }
    }

    /**
     * 数据处理
     * @param type $intLen
     * @return string
     */
    private function genSeparator($intLen) {
            $strRe = '';
            $i = 0;
            while ($i < $intLen) {
                    $strRe .= ' ' . (($i + 1 == $intLen) ? '├' : '│');
                    $i++;
            }

            !empty($strRe) && $strRe .= '─';
            return $strRe;
    }

    /**
     * 数据处理
     * @param type $arrRelation
     * @param type $intSep