function & _fetch(&$counter, $params)
	{
		if(!$result =& parent :: _fetch($counter, $params))
			return $result;
		
		$user_ids = complex_array :: get_column_values('user_id', $result);

		$fetcher =& fetcher :: instance();
		
		$params = array(
			'restrict_by_class' => false
		);
		
		$user_counter = 0;
		$users =& $fetcher->fetch_by_ids($user_ids, 'user_object', $user_counter, $params, 'fetch_by_ids');

		foreach($result as $key => $data)
		{
			if (!isset($users[$data['user_id']]))
				continue;
				
			$customer_data = $users[$data['user_id']];
			$result[$key]['user_name'] = $customer_data['name'];
			$result[$key]['user_lastname'] = $customer_data['lastname'];
			$result[$key]['user_secondname'] = $customer_data['secondname'];
			$result[$key]['user_email'] = $customer_data['email'];
			$result[$key]['user_phone'] = $customer_data['phone'];
		}	

		return $result;
	}
	function & _fetch(&$counter, $params)
	{
		$items =& parent :: _fetch($counter, $params);
		
		if (!count($items))
			return array();

		reset($items);

		if (isset($_REQUEST['id']) && $_REQUEST['id'])
			$current_id = $_REQUEST['id'];
		else
			$current_id = $items[key($items)]['id'];

		foreach($items as $id => $item)
			if ($current_id == $item['id'])
			{
				$current_item = $item;
				break;
			}	
			else
				next($items);

		$result = array();
		$result['prev'] = array($this->_get_prev_item($items, $current_id));
		$result['next'] = array($this->_get_next_item($items, $current_id));
		$result['current'] = array($current_item);
		
		$result['prev']['presentation_path'] = $params['path'];
		$result['next']['presentation_path'] = $params['path'];
		$result['current']['presentation_path'] = $params['path'];

		return array($result);
	}
 function &_fetch(&$counter, $params)
 {
     $items =& parent::_fetch($counter, $params);
     if (!count($items)) {
         return array();
     }
     reset($items);
     $request = request::instance();
     if (!($current_id = $request->get_attribute('id'))) {
         $current_id = $items[key($items)]['id'];
     }
     foreach ($items as $id => $item) {
         if ($current_id == $item['id']) {
             $current_item = $item;
             break;
         } else {
             next($items);
         }
     }
     $result = array();
     $result['prev'] = array($this->_get_prev_item($items, $current_id));
     $result['next'] = array($this->_get_next_item($items, $current_id));
     $result['current'] = array($current_item);
     $result['prev']['presentation_path'] = $params['path'];
     $result['next']['presentation_path'] = $params['path'];
     $result['current']['presentation_path'] = $params['path'];
     return array($result);
 }
  function & _fetch(&$counter, $params = array())
  {
    $limit = DEFAULT_BRANCH_RANDOM_LIMIT;

    if (isset($params['limit']))
    {
      $limit = $params['limit'];
      unset($params['limit']);
    }

    if(!$all_objects =& parent :: _fetch($counter, $params))
      return array();

    $result = array();

    if ($limit >= count($all_objects))
      $limit = count($all_objects);

    $max_index = count($all_objects) - 1;
    $indexes = array_keys($all_objects);

    while(count($result) < $limit)
    {
      $index = mt_rand(0, $max_index);
      if (!isset($result[$index]))
        $result[$index] = $all_objects[$indexes[$index]];
    }

    return $result;
  }
  function & _fetch(&$counter, $params)
  {
    $result =& parent :: _fetch($counter, $params);
    $uri = new uri($_SERVER['PHP_SELF']);   

    foreach($result as $key => $data)
    {
      $nav_uri = new uri($data['url']);

      if ($uri->get_host() != $nav_uri->get_host())
        continue;
      
      if(is_integer($res = $uri->compare_path($nav_uri)))
      {
        if($res >= 0)
        {
          $result[$key]['in_path'] = true;
          $params['path'] = $data['path'];
          $result[$key]['items'] = $this->_fetch(&$counter, $params); 
        }  
        if($res == 0)
          $result[$key]['selected'] = true;
      }
    }
    return $result;
  }
  function & _fetch(&$counter, $params)
  {
    $result =& parent :: _fetch($counter, $params);

    $uri = new uri($_SERVER['PHP_SELF']);

    //we're trimming trailing slashes: thus /root/about == /root/about/

    $uri->set_path(rtrim($uri->get_path(), '/'));

    foreach($result as $key => $data)
    {
      $nav_uri = new uri($data['url']);
      $nav_uri->set_path(rtrim($nav_uri->get_path(), '/'));

      if ($uri->get_host() != $nav_uri->get_host())
        continue;

      if(is_integer($res = $uri->compare_path($nav_uri)))
      {
        if($res >= 0)
          $result[$key]['in_path'] = true;

        if($res == 0)
          $result[$key]['selected'] = true;
      }
    }
    return $result;
  }
 function &_fetch(&$counter, $params)
 {
     $tree =& tree::instance();
     if (isset($params['order'])) {
         $order = $params['order'];
         unset($params['order']);
     } else {
         $order = array('priority' => 'ASC');
     }
     $tree_array =& parent::_fetch($counter, $params);
     $tree_array =& tree_sorter::sort($tree_array, $order, 'node_id', 'parent_node_id');
     $path_node = $tree->get_node_by_path($params['path']);
     if (isset($params['include_parent']) && (bool) $params['include_parent']) {
         $path_node_level = $path_node['level'] - 1;
     } else {
         $path_node_level = $path_node['level'];
     }
     $levels_status_array = array();
     $size = count($tree_array);
     $current_pos = 0;
     $parent_data = array();
     foreach ($tree_array as $id => $tree_item) {
         $parent_node_id = $tree_item['parent_node_id'];
         if (!isset($parent_data[$parent_node_id])) {
             if ($parent_node_id == 0) {
                 $parent_data[$parent_node_id]['children_amount'] = 1;
             } else {
                 $parent_data[$parent_node_id]['children_amount'] = $tree->count_accessible_children($parent_node_id);
             }
             $parent_data[$parent_node_id]['counter'] = 0;
         }
         $parent_data[$parent_node_id]['counter']++;
         if ($parent_data[$parent_node_id]['counter'] == 1) {
             $is_first_child = true;
         } else {
             $is_first_child = false;
         }
         if ($parent_data[$parent_node_id]['counter'] == $parent_data[$parent_node_id]['children_amount']) {
             $is_last_child = true;
         } else {
             $is_last_child = false;
         }
         $tree_array[$id]['level'] = $tree_array[$id]['level'] - $path_node_level;
         $levels_status_array[$tree_item['level'] - $path_node_level] = $is_last_child;
         $tree_array[$id]['level_' . $tree_array[$id]['level']] = 1;
         $tree_array[$id]['is_expanded'] = $tree->is_node_expanded($tree_item['node_id']);
         $tree_array[$id]['is_last_child'] = $is_last_child;
         $tree_array[$id]['is_first_child'] = $is_first_child;
         $tree_array[$id]['levels_status'] = $levels_status_array;
         if ($tree_array[$id]['class_name'] == 'image_object' || $tree_array[$id]['class_name'] == 'file_object') {
             $tree_array[$id]['icon'] = '/root?node_id=' . $tree_item['node_id'] . '&icon';
         } elseif (isset($tree_item['icon']) && $tree_item['icon']) {
             $tree_array[$id]['icon'] = $tree_item['icon'];
         } else {
             $tree_array[$id]['icon'] = '/shared/images/generic.gif';
         }
     }
     return $tree_array;
 }
 function &get_dataset(&$counter, $params = array())
 {
     $params['depth'] = 1;
     if (isset($_REQUEST['only_parents']) && $_REQUEST['only_parents'] == 'false') {
         $params['only_parents'] = false;
     } else {
         $params['only_parents'] = true;
     }
     $params['restrict_by_class'] = false;
     $params['path'] = $this->_process_path();
     return parent::get_dataset($counter, $params);
 }
 function &get_dataset(&$counter, $params = array())
 {
     $params['depth'] = 1;
     $request = request::instance();
     if ($request->get_attribute('only_parents') == 'false') {
         $params['only_parents'] = false;
     } else {
         $params['only_parents'] = true;
     }
     $params['restrict_by_class'] = false;
     $params['path'] = $this->_process_path();
     return parent::get_dataset($counter, $params);
 }
 function &_fetch(&$counter, $params)
 {
     $result =& parent::_fetch($counter, $params);
     $uri = new uri($_SERVER['PHP_SELF']);
     foreach ($result as $key => $data) {
         if ($uri->compare($data['url'], $url_rest, $query_match)) {
             if ($url_rest >= 0) {
                 $result[$key]['in_path'] = true;
             }
             if ($url_rest == 0) {
                 $result[$key]['selected'] = true;
             }
         }
     }
     return $result;
 }
	function & _fetch(&$counter, $params)
	{
		$result =& parent :: _fetch($counter, $params);
		$uri = new uri($_SERVER['PHP_SELF']);		

		foreach($result as $key => $data)
		{
			if(is_integer($res = $uri->compare_path(new uri($data['url']))))
			{
				if($res >= 0)
					$result[$key]['in_path'] = true;
				if($res == 0)
					$result[$key]['selected'] = true;
			}
		}
		return $result;
	}
 function &_fetch(&$counter, $params)
 {
     $result =& parent::_fetch($counter, $params);
     $this->set_navigation_attributes($result);
     return $result;
 }
 function pricelist_datasource()
 {
     parent::fetch_sub_branch_datasource();
 }