Subversion Repositories SmartDukaan

Rev

Rev 10582 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 10582 Rev 16269
Line 26... Line 26...
26
		
26
		
27
	}
27
	}
28
 
28
 
29
	function index($get=array(),$post=array(),$module=array())
29
	function index($get=array(),$post=array(),$module=array())
30
	{
30
	{
31
		
-
 
-
 
31
		log_message('error', "in index ".print_r($get));		
32
		//add_call( KEY, METHOD, URL, array of PARAMS, array of CURL_OPTS )
32
		//add_call( KEY, METHOD, URL, array of PARAMS, array of CURL_OPTS )
33
		$this->curlURL('products','get',$get);
33
		$this->curlURL('products','get',$get);
34
		$responses = $this->mcurl->execute();
34
		$responses = $this->mcurl->execute();
35
		$responses = $this->parser->parse_response($responses);
35
		$responses = $this->parser->parse_response($responses);
36
		return $responses;
36
		return $responses;
Line 69... Line 69...
69
						$this->curlURL($response,'get',$post);
69
						$this->curlURL($response,'get',$post);
70
 
70
 
71
					}
71
					}
72
					else
72
					else
73
					{
73
					{
-
 
74
						log_message('error',"Befor CurlUrl ".print_r($get,1));	
-
 
75
						log_message('error',"Befor CurlUrl ".print_r($itemcode,1));	
-
 
76
						log_message('error',"Befor CurlUrl ".print_r($response,1));	
74
						
77
						log_message('error',"Befor CurlUrl ".print_r($get,1));	
75
						$this->curlURL($response,'get',$get,$itemcode,$query);
78
						$this->curlURL($response,'get',$get,$itemcode,$query);
76
					}
79
					}
77
				}
80
				}
78
			}
81
			}
79
 
82
 
Line 87... Line 90...
87
		$responses = $this->parser->parse_response($responses,$module);
90
		$responses = $this->parser->parse_response($responses,$module);
88
	
91
	
89
		
92
		
90
		return $responses;
93
		return $responses;
91
	}
94
	}
92
function curlURL($configurl=null,$methodtype='get',$parameter=array(),$itemcode=null,$query=null)
95
	function curlURL($configurl=null,$methodtype='get',$parameter=array(),$itemcode=null,$query=null) {
93
{
-
 
94
		
-
 
95
		$params ='';
96
		$params ='';
96
		$display='';
97
		$display='';
97
		$url = $this->config->item('curl_base_url');
98
		$url = $this->config->item('curl_base_url');
98
		$productsurl =$this->config->item($configurl);
99
		$productsurl =$this->config->item($configurl);
99
		if(isset($productsurl['url']) and !empty($productsurl['url']))
100
		if(isset($productsurl['url']) and !empty($productsurl['url'])) {
100
			{
-
 
101
				$url .=$productsurl['url'];
101
			$url .=$productsurl['url'];
102
				if($productsurl['display'])
102
			if($productsurl['display']) {
103
				{$display=$productsurl['display'];}
103
				$display=$productsurl['display'];
-
 
104
			}
-
 
105
			if(empty($parameter)){
104
			if(empty($parameter)){$parameter=$productsurl['params'];}
106
				$parameter=$productsurl['params'];
105
			
107
			}
106
 
-
 
107
		if(isset($parameter) and !empty($parameter) and $methodtype=='get')
108
			if(isset($parameter) and !empty($parameter) and $methodtype=='get'){
108
		{
-
 
109
			$params = $this->parser->prepareParams($parameter,$display,$configurl);
109
				$params = $this->parser->prepareParams($parameter,$display);
110
 
-
 
-
 
110
				log_message('error',"Params befor add_call".print_r($params,1));
111
		}
111
			}
112
		if(isset($parameter) and !empty($parameter) and $methodtype=='post')
112
			if(isset($parameter) and !empty($parameter) and $methodtype=='post'){
113
		{
-
 
114
			$params = $this->parser->prepareParams($parameter,$display,$configurl);
113
				$params = $this->parser->prepareParams($parameter,$display);
115
			$methodtype ='post';
114
				$methodtype ='post';
116
		}
115
			}
117
		if(!isset($parameter) || empty($parameter))
116
			if(!isset($parameter) || empty($parameter)){
118
			{$params =$this->parser->prepareParams('',$display,$configurl);}
117
				$params =$this->parser->prepareParams('',$display);
-
 
118
			}
119
		if(isset($itemcode) && $itemcode != null){
119
			if(isset($itemcode) && $itemcode != null){
120
			$url .= '/'.$itemcode;
120
				$url .= '/'.$itemcode;
-
 
121
			}
-
 
122
			if(isset($query) && $query != null){
-
 
123
				$params = $query;
-
 
124
			}
-
 
125
			log_message('error',"Params befor add_call".print_r($parameter,1));
-
 
126
			log_message('error',"Params befor add_call".print_r($params,1));
-
 
127
			return $this->mcurl->add_call($configurl,$methodtype,$url,$params);
121
		}
128
		}
122
		if(isset($query) && $query != null){
129
		else {
123
 
-
 
124
			$params = $query;
130
			return '';
125
		}
131
		}
126
		return $this->mcurl->add_call($configurl,$methodtype,$url,$params);
-
 
127
	}
132
	}
128
	else
-
 
129
		{return '';}
-
 
130
 
-
 
131
}
-
 
132
 
133
 
133
 
134
 
134
	function nextProducts($get=array(),$post=array(),$module=array())
135
	function nextProducts($get=array(),$post=array(),$module=array())
135
	{
136
	{
136
		
137