function & _fetch(&$counter, $params = array()) { $limit = DEFAULT_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 search_datasource() { parent::fetch_datasource(); $this->query_object = new search_query(); $this->_init_search_query_object(); set_search_query_object($this->query_object); }
function &_fetch(&$counter, $params) { $result =& parent::_fetch($counter, $params); if (!count($result)) { return $result; } $this->_process_loaded_items($result); return $result; }
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) { $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; }