Пример #1
0
 /**
  * Determines which sections are currently expanded
  *
  * @return  array  The list of expanded pages
  */
 function get_expanded_sections()
 {
     $current_page = treerepresentation::get_current_section();
     //base case
     if ($this->name == $current_page) {
         return array($this->name);
     }
     foreach ($this->children as $child) {
         $child_result = $child->get_expanded_sections();
         if (!empty($child_result)) {
             //should have only one tree "branch", so merge upward
             return array_merge(array($this->name), $child_result);
         }
     }
     //not found
     return array();
 }