Subversion Repositories SmartDukaan

Rev

Rev 18806 | Rev 18836 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 18806 Rev 18809
Line 15... Line 15...
15
 
15
 
16
    public function beforeFilter() {
16
    public function beforeFilter() {
17
    	parent::beforeFilter();
17
    	parent::beforeFilter();
18
    	// $this->Auth->loginRedirect = array('controller' => 'users', 'action' => 'dashboard');
18
    	// $this->Auth->loginRedirect = array('controller' => 'users', 'action' => 'dashboard');
19
    	$this->Auth->loginRedirect = array('controller' => 'pages', 'action' => 'display','home');
19
    	$this->Auth->loginRedirect = array('controller' => 'pages', 'action' => 'display','home');
20
        $this->Auth->allow(array('mine','login', 'forgotten_password', 'register', 'activate', 'checkemail','checkfbuser','registertwitteruser','skipmobileverification','reauthenticate','edit','mywallet','admin_push','socialauth','oneringcb','admin_usersanctions')); 
20
        $this->Auth->allow(array('mine','login', 'forgotten_password', 'register', 'activate', 'checkemail','checkfbuser','registertwitteruser','skipmobileverification','reauthenticate','edit','mywallet','admin_push','socialauth','oneringcb','admin_usersanctions','admin_loanhistory','admin_credithistory')); 
21
		$this->Cookie->name = 'profittill';
21
		$this->Cookie->name = 'profittill';
22
		$this->Cookie->time = 86400*30; 
22
		$this->Cookie->time = 86400*30; 
23
		$this->Cookie->path = '/';
23
		$this->Cookie->path = '/';
24
		$this->Cookie->key = 'qSI232qs*&sXOw!adre@34SAv!@*(XSL#$%)asGb$@11~_+!@#H23s~#^';
24
		$this->Cookie->key = 'qSI232qs*&sXOw!adre@34SAv!@*(XSL#$%)asGb$@11~_+!@#H23s~#^';
25
		$this->Cookie->httpOnly = true;
25
		$this->Cookie->httpOnly = true;
Line 1139... Line 1139...
1139
		}
1139
		}
1140
		
1140
		
1141
	}
1141
	}
1142
	
1142
	
1143
	public function admin_usersanctions(){
1143
	public function admin_usersanctions(){
1144
		$url = Configure::read('saholicapihost').'counter!getUsersSanctionDetails';
1144
		$url = Configure::read('saholicapihost').'counter!getUsersSanctionDetails?limit=0&offset=0';
1145
		$response = $this->make_request ( $url, null );
1145
		$response = $this->make_request ( $url, null );
1146
		$userSanctions = $response['response']['userSanctions']['userSanctions'];
1146
		$userSanctions = $response['response']['userSanctions']['userSanctions'];
-
 
1147
		$hasMore = $response['response']['userSanctions']['hasMore'];
-
 
1148
		$totalCount = $response['response']['userSanctions']['totalCount'];
1147
		$this->loadModel('UserAccount');
1149
		$this->loadModel('UserAccount');
1148
		$usersMap = array();
1150
		$usersMap = array();
1149
		foreach($userSanctions AS $userSanction){
1151
		foreach($userSanctions AS $userSanction){
-
 
1152
			if (!array_key_exists($userSanction['user_id'], $usersMap)) {
1150
			$options = array('conditions'=>array('account_key'=>$userSanction['user_id'],'account_type'=>'saholic'),'recursive'=>-1,'fields'=>'user_id');
1153
				$options = array('conditions'=>array('account_key'=>$userSanction['user_id'],'account_type'=>'saholic'),'recursive'=>-1,'fields'=>'user_id');
1151
			$userId = $this->UserAccount->find('first',$options);
1154
				$userId = $this->UserAccount->find('first',$options);
1152
			$userId = $userId['UserAccount']['user_id'];
1155
				$userId = $userId['UserAccount']['user_id'];
1153
			$usersMap[$userSanction['user_id']]=$userId;
1156
				$usersMap[$userSanction['user_id']]=$userId;
-
 
1157
			}
-
 
1158
		}
-
 
1159
					
-
 
1160
		$this->set(compact('userSanctions','usersMap','hasMore','totalCount'));
-
 
1161
	}
-
 
1162
	
-
 
1163
	public function admin_credithistory(){
-
 
1164
		$url = Configure::read('saholicapihost').'counter!getCreditHistory?limit=0&offset=0';
-
 
1165
		$response = $this->make_request ( $url, null );
-
 
1166
		$creditHistory = $response['response']['creditHistory'];
-
 
1167
		$hasMore = $response['response']['hasMore'];
-
 
1168
		$totalCount = $response['response']['totalCount'];
-
 
1169
		$this->loadModel('UserAccount');
-
 
1170
		$usersMap = array();
-
 
1171
		foreach($creditHistory AS $creditH){
-
 
1172
			if (!array_key_exists($creditH['user_id'], $usersMap)) {
-
 
1173
				$options = array('conditions'=>array('account_key'=>$creditH['user_id'],'account_type'=>'saholic'),'recursive'=>-1,'fields'=>'user_id');
-
 
1174
				$userId = $this->UserAccount->find('first',$options);
-
 
1175
				$userId = $userId['UserAccount']['user_id'];
-
 
1176
				$usersMap[$creditH['user_id']]=$userId;
-
 
1177
			}
-
 
1178
		}
-
 
1179
					
-
 
1180
		$this->set(compact('creditHistory','usersMap','hasMore','totalCount'));
-
 
1181
	}
-
 
1182
	
-
 
1183
	public function admin_loanhistory(){
-
 
1184
		$url = Configure::read('saholicapihost').'counter!getLoanHistory?limit=0&offset=0';
-
 
1185
		$response = $this->make_request ( $url, null );
-
 
1186
		$loanHistory = $response['response']['loanHistory'];
-
 
1187
		$hasMore = $response['response']['hasMore'];
-
 
1188
		$totalCount = $response['response']['totalCount'];
-
 
1189
		$this->loadModel('UserAccount');
-
 
1190
		$usersMap = array();
-
 
1191
		foreach($loanHistory AS $loanH){
-
 
1192
			if (!array_key_exists($loanH['user_id'], $usersMap)) {
-
 
1193
				$options = array('conditions'=>array('account_key'=>$loanH['user_id'],'account_type'=>'saholic'),'recursive'=>-1,'fields'=>'user_id');
-
 
1194
				$userId = $this->UserAccount->find('first',$options);
-
 
1195
				$userId = $userId['UserAccount']['user_id'];
-
 
1196
				$usersMap[$loanH['user_id']]=$userId;
-
 
1197
			}
1154
		}
1198
		}
1155
					
1199
					
1156
		$this->set(compact('userSanctions','usersMap'));
1200
		$this->set(compact('loanHistory','usersMap','hasMore','totalCount'));
1157
	}
1201
	}
1158
}
1202
}