function & _fetch(&$counter, $params)
  {
    $tree_array = parent :: _fetch($counter, $params);
    $group_params['order'] = array('priority' => 'ASC');
    $user_groups =& fetch_sub_branch('/root/admin/user_groups', 'user_group', $counter, $group_params);

    $dataspace =& dataspace_registry :: get('set_group_access');

    $groups = $dataspace->get('filter_groups');

    if (!is_array($groups) || !count($groups))
      return $tree_array;

    foreach(array_keys($user_groups) as $key)
    {
      if (!in_array($key, $groups))
        unset($user_groups[$key]);
    }

    foreach($tree_array as $id => $node)
    {
      $object_id = $node['id'];
      foreach($user_groups as $group_id => $group_data)
      {
        $tree_array[$id]['groups'][$group_id]['selector_name'] = 'policy[' . $object_id . '][' .  $group_id . ']';
      }
    }

    return $tree_array;
  }
 function setUp()
 {
     debug_mock::init($this);
     $this->dataspace =& dataspace_registry::get('test1');
     $this->form_action = new form_action_test_version($this);
     $this->request = new Mockrequest($this);
     $this->response = new Mockresponse($this);
 }
 function &get_dataset(&$counter, $params = array())
 {
     $params['order'] = array('priority' => 'ASC');
     $user_groups =& fetch_sub_branch('/root/user_groups', 'user_group', $counter, $params);
     $group_params['order'] = array('priority' => 'ASC');
     $groups =& fetch('user_group', $counter, $group_params, 'fetch');
     $dataspace =& dataspace_registry::get('set_group_access');
     $filter_groups = $dataspace->get('filter_groups');
     if (!is_array($filter_groups) || !count($filter_groups)) {
         return false;
     }
     foreach (array_keys($groups) as $key) {
         if (!in_array($key, $filter_groups)) {
             unset($groups[$key]);
         }
     }
     return new array_dataset($groups);
 }
	function set_value($value)
	{
		$form_component =& $this->find_parent_by_class('form_component');
    
    $dataspace =& dataspace_registry :: get($form_component->attributes['name']);

		if(!isset($this->attributes['name']))
			debug :: write_warning("form element 'name' attribute not set:" . $this->get_server_id());
		
		$dataspace->set_by_index_string($this->_make_index_name($this->attributes['name']), $value);
	}
	function is_first_time()
	{
		if(isset($this->attributes['name']))
		{
			$dataspace =& dataspace_registry :: get($this->attributes['name']);
			
			return $dataspace->get('submitted') ? false : true;
		}	
		else
		{
		  $request = request :: instance();
		  return $request->has_attribute('submitted');
		}
	} 
 function action()
 {
     $this->name = $this->_define_dataspace_name();
     $this->dataspace =& dataspace_registry::get($this->name);
 }