function _do_get_shipping_options($shipping_configuration)
 {        
   $this->_clean_cookie();
   
   $this->_browse_to_home_page();
   
   $express_html = $this->_get_express_shipping_options_html($shipping_configuration);
     
   $ground_html = $this->_get_ground_shipping_options_html($shipping_configuration);
   
   if($express_html === false)
     $express_options = array();
   else
     $express_options = $this->_parse_html_options($express_html);
         
   if($ground_html === false)
     $ground_options = array();
   else
   {
     $ground_options = $this->_parse_html_options($ground_html);
     
     foreach($ground_options as $key => $value)
     {
       $ground_options[$key]['ground'] = true;
     }
   }
       
   $options = complex_array :: array_merge($express_options, $ground_options);
   
   if(empty($options))
     return false;
   
   return $options;
 }
  function _define_datamap()
	{
	  return complex_array :: array_merge(
	      parent :: _define_datamap(),
	      array(
  				'url' => 'url',
  				'new_window' => 'new_window',
	      )
	  );     
	}  
	function perform()
	{
		$object_data = fetch_mapped_by_url();
		
		$parent_data = fetch_one_by_node_id($object_data['parent_node_id']);
		$path = $parent_data['path'];
		
		$params = complex_array :: array_merge($_GET, $_POST);

		$sep = '';
		$query = '';
		
		$flat_params = array();
		complex_array :: to_flat_array($params, $flat_params);
		
		foreach ($flat_params as $key => $value)
		{
			$query .= $sep . $key . '=' . urlencode($value);
			$sep = '&';
		} 
		if (!empty($query))
			$path .= '?' . $query;
		
		return new redirect_response(RESPONSE_STATUS_SUCCESS, $path);
	}
	function _define_class_properties()
	{
		return complex_array :: array_merge(
					parent :: _define_attributes_definition(),
					array('abstract_class' => true)
				);
	}
	function _define_attributes_definition()
	{
		return complex_array :: array_merge(
				parent :: _define_attributes_definition(),
				array(
				'question' => array('search' => true),
				'answer' => array('search' => true)
				));
	}
 function _define_attributes_definition()
 {
   return complex_array :: array_merge(
       parent :: _define_attributes_definition(),
       array(
       'content' => array('search' => true),
       'annotation' => array('search' => true),
       'identifier' => array('search' => false)
       ));
 }
  function _define_datamap()
	{
	  return complex_array :: array_merge(
	      parent :: _define_datamap(),
	      array(
  				'content' => 'content',
	      )
	  );     
	}   
  function _define_datamap()
	{
	  return complex_array :: array_merge(
	      parent :: _define_datamap(),
	      array(
  				'document_content' => 'content',
  				'annotation' => 'annotation',
	      )
	  );     
	}  
	function _define_attributes_definition()
	{
		return complex_array :: array_merge(
				parent :: _define_attributes_definition(),
				array(
				'title' => '',
				'name' => array('type' => 'numeric'),
				'search' => array('search' => true),
				));		
	}
 function _define_datamap()
 {
   return complex_array :: array_merge(
       parent :: _define_datamap(),
       array(
         'object_content' => 'content',
         'file_id' => 'file_id'
       )
   );
 }
	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;
	}
示例#12
0
 function &fetch_sub_branch($path, $loader_class_name, &$counter, $params = array(), $fetch_method = 'fetch_by_ids')
 {
     $tree =& limb_tree::instance();
     $site_object =& site_object_factory::instance($loader_class_name);
     if (!isset($params['restrict_by_class']) || isset($params['restrict_by_class']) && (bool) $params['restrict_by_class']) {
         $class_id = $site_object->get_class_id();
     } else {
         $class_id = null;
     }
     if (isset($params['check_expanded_parents'])) {
         $check_expanded_parents = (bool) $params['check_expanded_parents'];
     } else {
         $check_expanded_parents = false;
     }
     if (isset($params['include_parent'])) {
         $include_parent = (bool) $params['include_parent'];
     } else {
         $include_parent = false;
     }
     $depth = isset($params['depth']) ? $params['depth'] : 1;
     if (!($nodes = $tree->get_accessible_sub_branch_by_path($path, $depth, $include_parent, $check_expanded_parents, $class_id))) {
         return array();
     }
     $object_ids = complex_array::get_column_values('object_id', $nodes);
     if (!count($object_ids)) {
         return array();
     }
     $result =& $this->fetch_by_ids($object_ids, $loader_class_name, $counter, $params, $fetch_method);
     return $result;
 }
  function _process_result_array($arr)
  {
    if(complex_array :: get_max_column_value('hosts', $arr, $index) !== false)
      $arr[$index]['max_hosts'] = 1;

    if(complex_array :: get_max_column_value('hits', $arr, $index) !== false)
      $arr[$index]['max_hits'] = 1;

    if(complex_array :: get_max_column_value('home_hits', $arr, $index) !== false)
      $arr[$index]['max_home_hits'] = 1;

    if(complex_array :: get_max_column_value('audience', $arr, $index) !== false)
      $arr[$index]['max_audience'] = 1;

    $result = array();
    foreach($arr as $index => $data)
    {
      if(date('w', $data['time']+60*60*24) == 1)
        $data['new_week'] = 1;

      $result[$index] = $data;
    }

    return $result;
  }
	function _valid_perform(&$request, &$response)
	{
		$object_data =& $this->_load_object_data();

		$data_to_import['id'] = $object_data['id'];
		$data_to_import['node_id'] = $object_data['node_id'];
		$data_to_import['parent_node_id'] = $object_data['parent_node_id'];
		$data_to_import['identifier'] = $object_data['identifier'];
		$data_to_import['title'] = $object_data['title'];
		
		complex_array :: map($this->datamap, $this->dataspace->export(), $data_to_import);
		
		if (!isset($data_to_import['status']))
			$data_to_import['status'] = $object_data['status'];
			
		$this->object->import_attributes($data_to_import);
		
		if(!$this->_update_object_operation())
		{
		  $request->set_status(REQUEST_STATUS_FAILURE);
			return;
		}	

		$this->indexer->add($this->object);
		
		if(isset($data_to_import['identifier']) && $object_data['identifier'] != $data_to_import['identifier'])
		{
			$this->_handle_changed_identifier($data_to_import['identifier']);
		}	

	  $request->set_status(REQUEST_STATUS_FORM_SUBMITTED);
	  
	  fetcher :: flush_cache();
	}
	function & get_dataset(&$counter, $params=array())
	{
		$counter = 0;
		
		$mapped_node = map_request_to_node();
		
		$links_manager = new links_manager();
		
		$groups = array();
		
		if(isset($params['group_identifier']))
		{
		  if($group = $links_manager->fetch_group_by_identifier($params['group_identifier']))
		    $groups[$group['id']] = $group;
		}
		else
		  $groups = $links_manager->fetch_groups();

		if (!is_array($groups) || !count($groups))
		  return new empty_dataset();

		if(isset($params['back_links']) && $params['back_links'])
		  $links = $links_manager->fetch_back_links($mapped_node['id'], array_keys($groups));
		else
		  $links = $links_manager->fetch_target_links($mapped_node['id'], array_keys($groups));

		if (!is_array($links) || !count($links))
		  return new array_dataset($groups);
		
		$target_node_ids = complex_array :: get_column_values('target_node_id', $links);
				
		if (!is_array($target_node_ids) || !count($target_node_ids))
		  return new array_dataset($groups);

		$site_object_class_name = isset($params['loader_class_name']) ? $params['loader_class_name'] : 'site_object';
		$objects =& fetch_by_node_ids($target_node_ids, $site_object_class_name, $counter, array(
		  'restrict_by_class' => false
		));
		
		$result = array();
		
		foreach($groups as $group_id => $group)
		{
      $groups[$group_id]['links'] = array();
      
		  foreach($links as $link_id => $link)
		  {
		    if ($link['group_id']!= $group_id)
		      continue;
		    
		    //if (!isset($objects[$link['target_node_id']]))
		    //  continue;
        
        $link_data = array_merge($objects[$link['target_node_id']], $link);
        $groups[$group_id]['links'][$link_id] = $link_data;
		  }
		}
		
		return new array_dataset($groups);
	}		
 function _define_attributes_definition()
 {
   return complex_array :: array_merge(
       parent :: _define_attributes_definition(),
       array(
       'second_password' => '',
       ));
 }
	function set_phpbb_rank_action($name = 'set_phpbb_rank', $merge_definition=array())
	{		
		$definition = array(
			'site_object' => 'user_object'
		);
		
		parent :: form_action($name, complex_array :: array_merge($definition, $merge_definition));
	}
	function _define_attributes_definition()
	{
		return complex_array :: array_merge(
				parent :: _define_attributes_definition(),
				array(
				'identifier' => array('search' => true)
				));
	}
 function _define_attributes_definition()
 {
   return complex_array :: array_merge(
       parent :: _define_attributes_definition(),
       array(
       'content' => array('search' => true, 'search_weight' => 1),
       ));
 }
 function _define_class_properties()
 {
   return complex_array :: array_merge(
         parent :: _define_class_properties(),
         array(
           'abstract_class' => true,
           'db_table_name' => 'empty',
         )
   );
 }
 function get_classes_list()
 {
     $project_db = str_replace('_tests', '', DB_NAME);
     $db =& db_factory::instance();
     $db->select_db($project_db);
     $db->sql_select('sys_class', '*', 'class_name != "site_object"');
     $list = $db->get_array();
     $db->select_db(DB_NAME);
     return complex_array::get_column_values('class_name', $list);
 }
  function _define_datamap()
	{
	  return complex_array :: array_merge(
	      parent :: _define_datamap(),
	      array(
  				'subscribe_mail_content' => 'content',
  				'author' => 'author',
	      )
	  );     
	}   
  function _define_datamap()
	{
	  return complex_array :: array_merge(
	      parent :: _define_datamap(),
	      array(
  				'name' => 'name',
  				'lastname' => 'lastname',
  				'email' => 'email',
	      )
	  );     
	}  
	function perform(&$request, &$response)
	{
		$object_data = fetch_requested_object();
		
		$parent_data = fetch_one_by_node_id($object_data['parent_node_id']);
		$path = $parent_data['path'];
		
		$params = complex_array :: array_merge($_GET, $_POST);

		$sep = '';
		$query = '';
		
		$flat_params = array();
		complex_array :: to_flat_array($params, $flat_params);
		
		foreach ($flat_params as $key => $value)
		{
			$query .= $sep . $key . '=' . urlencode($value);
			$sep = '&';
		} 
		if (!empty($query))
			$path .= '?' . $query;
		
		$response->redirect($path);
	}
  function _define_datamap()
	{
	  return complex_array :: array_merge(
	      parent :: _define_datamap(),
	      array(
				  'image_id' => 'image_id',
	      )
	  );     
	}  
  function _define_datamap()
	{
	  return complex_array :: array_merge(
	      parent :: _define_datamap(),
	      array(
  				'mail_template' => 'mail_template',
	      )
	  );     
	}  
  function _define_datamap()
	{
	  return complex_array :: array_merge(
	      parent :: _define_datamap(),
	      array(
  				'description' => 'description',
	      )
	  );     
	}
	function & _load_all_questions($new_params = array())
	{
		$params = array(
			'depth' => -1
		);
		
		$params = complex_array :: array_merge($params, $new_params);
		
		return fetch_sub_branch('/root/polls', 'poll', $params);
	}
  function _define_datamap()
	{
	  return complex_array :: array_merge(
	      parent :: _define_datamap(),
	      array(
  				'message' => 'message',
  				'sender' => 'sender',
  				'sender_email' => 'sender_email',
	      )
	  );     
	}  
示例#30
-2
	function _define_attributes_definition()
	{
		return complex_array :: array_merge(
				parent :: _define_attributes_definition(),
				array(
					'content' => array('search' => true, 'search_weight' => 1),
					'annotation' => array('search' => true, 'search_weight' => 5),
					'author' => array('search' => true, 'search_weight' => 10),
					'source' => array('search' => true, 'search_weight' => 10),
				));
	}