function &_fetch(&$counter, $params)
 {
     $tree_array =& parent::_fetch($counter, $params);
     if (!count($tree_array)) {
         return array();
     }
     $result = array();
     $current_date = date('Y-m-d', time());
     $prev_item_key = null;
     foreach ($tree_array as $id => $tree_item) {
         $tree_item['is_expanded'] = true;
         if (!$tree_item['is_last_child']) {
             $prev_item_parent_id = $tree_item['parent_node_id'];
             $prev_item_key = $tree_item['id'];
         }
         if (!isset($tree_item['start_date'])) {
             $result[$id] = $tree_item;
             continue;
         }
         if ($tree_item['start_date'] <= $current_date && $tree_item['finish_date'] >= $current_date) {
             $result[$id] = $data;
             continue;
         }
         if ($tree_item['is_last_child'] && $tree_item['parent_node_id'] == $prev_item_parent_id) {
             $result[$prev_item_key]['is_last_child'] = true;
         }
     }
     return $result;
 }
 function &_fetch(&$counter, $params)
 {
     $tree_array = parent::_fetch($counter, $params);
     $user_groups =& fetch_sub_branch('/root/user_groups', 'user_group', $counter);
     foreach ($tree_array as $id => $node) {
         $object_id = $node['id'];
         foreach ($user_groups as $group_id => $group_data) {
             $tree_array[$id]['groups'][$group_id]['read_selector_name'] = 'policy[' . $object_id . '][' . $group_id . '][r]';
             $tree_array[$id]['groups'][$group_id]['write_selector_name'] = 'policy[' . $object_id . '][' . $group_id . '][w]';
         }
     }
     return $tree_array;
 }