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 _process_loaded_items(& $items) { if (!count($items)) return $items; $parent_node_ids = array(); foreach($items as $key => $data) if (!isset($parent_node_ids[$data['parent_node_id']])) { $parent_node_ids[$data['parent_node_id']] = $data['parent_node_id']; } $fetcher =& fetcher :: instance(); $access_policy =& access_policy :: instance(); $params = array( 'restrict_by_class' => false ); $parents =& $fetcher->fetch_by_node_ids($parent_node_ids, 'site_object', $parents_counter, $params, 'fetch_by_ids'); foreach($items as $key => $data) { $parent_data = $parents[$data['parent_node_id']]; $items[$key]['parent_title'] = $parent_data['title']; $items[$key]['parent_path'] = $parent_data['path']; } }
function setUp() { parent::setUp(); $this->fetcher =& fetcher::instance(); $user_id = 10; $this->_login_user($user_id, array(103 => 'visitors', 104 => 'admin')); $obj1 = site_object_factory::create('fetching_test_object1'); $obj2 = site_object_factory::create('fetching_test_object2'); $obj1->set_identifier('root'); $obj1->set_title('Root'); $obj1->create(true); $access[$obj1->get_id()] = array($user_id => array('r' => 1, 'w' => 1)); $this->root_node_id = $obj1->get_node_id(); $this->_add_object($obj1); $obj1->set_parent_id($this->root_node_id); $obj1->set_identifier('articles'); $obj1->set_title('Articles'); $obj1->create(); $access[$obj1->get_id()] = array($user_id => array('r' => 1, 'w' => 1)); $this->_add_object($obj1); $this->articles_object = $obj1; $obj2->set_parent_id($obj1->get_node_id()); $obj2->set_identifier('article1'); $obj2->set_title('Article1'); $obj2->create(); $access[$obj2->get_id()] = array($user_id => array('r' => 1, 'w' => 1)); $this->child_node_ids[] = $obj2->get_node_id(); $this->_add_object($obj2); $this->article_object = $obj2; $obj2->set_parent_id($obj1->get_node_id()); $obj2->set_identifier('article2'); $obj2->set_title('Article2'); $obj2->create(); $access[$obj2->get_id()] = array($user_id => array('r' => 1, 'w' => 1)); $this->child_node_ids[] = $obj2->get_node_id(); $this->_add_object($obj2); $obj2->set_parent_id($obj1->get_node_id()); $obj2->set_identifier('article3'); $obj2->set_title('Article3'); $obj2->create(); $access[$obj2->get_id()] = array($user_id => array('r' => 0, 'w' => 0)); $this->child_node_ids[] = $obj2->get_node_id(); $this->_add_object($obj2); $this->access_policy =& access_policy::instance(); $this->access_policy->save_user_object_access($access); $actions = array($user_id => array('display' => 1)); $this->access_policy->save_user_action_access($obj1->get_class_id(), $actions); $this->access_policy->save_user_action_access($obj2->get_class_id(), $actions); }
function run(&$filter_chain, &$request, &$response) { debug::add_timing_point('jip filter started'); $fetcher =& fetcher::instance(); $fetcher->set_jip_status(false); $user =& user::instance(); if ($user->is_logged_in()) { $ini =& get_ini('jip_groups.ini'); if ($user->is_in_groups(array_keys($ini->get_group('groups')))) { $fetcher->set_jip_status(true); } } debug::add_timing_point('jip filter done'); $filter_chain->next(); }
function &_fetch(&$counter, $params) { $result =& parent::_fetch($counter, $params); if (!count($result)) { return $result; } $parent_node_ids = array(); foreach ($result as $key => $data) { if (!isset($parent_node_ids[$data['parent_node_id']])) { $parent_node_ids[$data['parent_node_id']] = $data['parent_node_id']; } } $fetcher =& fetcher::instance(); $access_policy =& access_policy::instance(); $params = array('restrict_by_class' => false); $parents =& $fetcher->fetch_by_node_ids($parent_node_ids, 'site_object', $parents_counter, $params, 'fetch_by_ids'); foreach ($result as $key => $data) { $parent_data = $parents[$data['parent_node_id']]; $result[$key]['parent_title'] = $parent_data['title']; $result[$key]['parent_path'] = $parent_data['path']; } return $result; }
function & _get_fetcher() { if($this->fetcher) return $this->fetcher; $this->fetcher =& fetcher :: instance(); return $this->fetcher; }
function & fetch_by_node_ids($node_ids, $loader_class_name, &$counter, $params = array(), $fetch_method = 'fetch_by_ids') { $fetcher =& fetcher :: instance(); $result =& $fetcher->fetch_by_node_ids($node_ids, $loader_class_name, $counter, $params, $fetch_method); return $result; }