src/cultusrego.php
private function build_section_sub_tree($main_tree, $tree_level, $section_level) {
    $sub_sections = array();
    if (isset($main_tree[$tree_level]) && isset($main_tree[$tree_level][$section_level])) {
      $sub_sections = $main_tree[$tree_level][$section_level];
      $sub_tree_level = $tree_level + 1;
      foreach ($sub_sections as $sub_section_level => $sub_section) {
        $sub_sections[$sub_section_level]['sub'] = $this->build_section_sub_tree($main_tree, $sub_tree_level, $sub_section_level);
      }
    }
    return $sub_sections;
  }
private function build_section_sub_tree($main_tree, $tree_level, $section_level) {
    $sub_sections = array();
    if (isset($main_tree[$tree_level]) && isset($main_tree[$tree_level][$section_level])) {
      $sub_sections = $main_tree[$tree_level][$section_level];
      $sub_tree_level = $tree_level + 1;
      foreach ($sub_sections as $sub_section_level => $sub_section) {
        $sub_sections[$sub_section_level]['sub'] = $this->build_section_sub_tree($main_tree, $sub_tree_level, $sub_section_level);
      }
    }
    return $sub_sections;
  }
private function build_section_sub_tree ( $ main_tree , $ tree_level , $ section_level ) { $ sub_sections = array ( ) ; if ( isset ( $ main_tree [ $ tree_level ] ) && isset ( $ main_tree [ $ tree_level ] [ $ section_level ] ) ) { $ sub_sections = $ main_tree [ $ tree_level ] [ $ section_level ] ; $ sub_tree_level = $ tree_level + 1 ; foreach ( $ sub_sections as $ sub_section_level => $ sub_section ) { $ sub_sections [ $ sub_section_level ] [ 'sub' ] = $ this -> build_section_sub_tree ( $ main_tree , $ sub_tree_level , $ sub_section_level ) ; } } return $ sub_sections ; }
Build an array of sub sections for the given section
@param  array   $main_tree
@param  integer $tree_level
@param  string  $section_level
@return array                  Sub sections for the given section
Build an array of sub sections for the given section