Subversion Repositories SmartDukaan

Rev

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

Rev 19726 Rev 19731
Line 814... Line 814...
814
		    // echo $_SESSION["group_id"];
814
		    // echo $_SESSION["group_id"];
815
			if ($user['User']['group_id'] == 1) {
815
			if ($user['User']['group_id'] == 1) {
816
				$this->redirect(array('controller' => 'deals', 'action' => 'mine?user_id='.$user['User']['id']));
816
				$this->redirect(array('controller' => 'deals', 'action' => 'mine?user_id='.$user['User']['id']));
817
				exit();
817
				exit();
818
			}
818
			}
819
			else if ($user['User']['group_id'] >= 2) {
819
			else if ($user['User']['group_id'] >= 2 && $user['User']['group_id']<99) {
820
				$this->redirect(array('controller' => 'administration', 'action' => 'dashboard'));
820
				$this->redirect(array('controller' => 'administration', 'action' => 'dashboard'));
821
				exit();
821
				exit();
822
		    }
822
		    }
823
		} else {
823
		} else {
824
		    if (!empty($this->data)) {                
824
		    if (!empty($this->data)) {                
Line 1158... Line 1158...
1158
		$userSanctions = $response['response']['userSanctions']['userSanctions'];
1158
		$userSanctions = $response['response']['userSanctions']['userSanctions'];
1159
		$hasMore = $response['response']['userSanctions']['hasMore'];
1159
		$hasMore = $response['response']['userSanctions']['hasMore'];
1160
		$totalCount = $response['response']['userSanctions']['totalCount'];
1160
		$totalCount = $response['response']['userSanctions']['totalCount'];
1161
		$this->loadModel('UserAccount');
1161
		$this->loadModel('UserAccount');
1162
		$usersMap = array();
1162
		$usersMap = array();
-
 
1163
		$usersName = array();
1163
		foreach($userSanctions AS $userSanction){
1164
		foreach($userSanctions AS $userSanction){
1164
			if (!array_key_exists($userSanction['user_id'], $usersMap)) {
1165
			if (!array_key_exists($userSanction['user_id'], $usersMap)) {
1165
				$options = array('conditions'=>array('account_key'=>$userSanction['user_id'],'account_type'=>'saholic'),'recursive'=>-1,'fields'=>'user_id');
1166
				$options = array('conditions'=>array('account_key'=>$userSanction['user_id'],'account_type'=>'saholic'),'recursive'=>-1,'fields'=>'user_id');
1166
				$userId = $this->UserAccount->find('first',$options);
1167
				$userId = $this->UserAccount->find('first',$options);
1167
				$userId = $userId['UserAccount']['user_id'];
1168
				$userId = $userId['UserAccount']['user_id'];
-
 
1169
				$opts = array('conditions'=>array('id'=>$userId),'recursive'=>-1,'fields'=>'first_name');
-
 
1170
				$userName = $this->User->find('first',$opts);
-
 
1171
				$usersName[$userSanction['user_id']] = $userName['User']['first_name'];
1168
				$usersMap[$userSanction['user_id']]=$userId;
1172
				$usersMap[$userSanction['user_id']]=$userId;
1169
			}
1173
			}
1170
		}
1174
		}
1171
					
1175
					
1172
		$this->set(compact('userSanctions','usersMap','hasMore','totalCount'));
1176
		$this->set(compact('usersName','userSanctions','usersMap','hasMore','totalCount'));
1173
	}
1177
	}
1174
	
1178
	
1175
	public function admin_credithistory($cuid = 0){
1179
	public function admin_credithistory($cuid = 0){
1176
		$page = $this->request->query('page');
1180
		$page = $this->request->query('page');
1177
		if(!isset($page)){
1181
		if(!isset($page)){
Line 1190... Line 1194...
1190
		$url = Configure::read('saholicapihost').'counter!getCreditHistory?userId='.$cuid.'&limit='.$limit.'&offset='.$offset;
1194
		$url = Configure::read('saholicapihost').'counter!getCreditHistory?userId='.$cuid.'&limit='.$limit.'&offset='.$offset;
1191
		$response = $this->make_request ( $url, null );
1195
		$response = $this->make_request ( $url, null );
1192
		$creditHistory = $response['response']['creditHistory'];
1196
		$creditHistory = $response['response']['creditHistory'];
1193
		$hasMore = $response['response']['hasMore'];
1197
		$hasMore = $response['response']['hasMore'];
1194
		$totalCount = $response['response']['totalCount'];
1198
		$totalCount = $response['response']['totalCount'];
1195
		
1199
		$usersName = array();
1196
		$usersMap = array();
1200
		$usersMap = array();
1197
		foreach($creditHistory AS $creditH){
1201
		foreach($creditHistory AS $creditH){
1198
			if (!array_key_exists($creditH['user_id'], $usersMap)) {
1202
			if (!array_key_exists($creditH['user_id'], $usersMap)) {
1199
				$options = array('conditions'=>array('account_key'=>$creditH['user_id'],'account_type'=>'saholic'),'recursive'=>-1,'fields'=>'user_id');
1203
				$options = array('conditions'=>array('account_key'=>$creditH['user_id'],'account_type'=>'saholic'),'recursive'=>-1,'fields'=>'user_id');
1200
				$userId = $this->UserAccount->find('first',$options);
1204
				$userId = $this->UserAccount->find('first',$options);
1201
				$userId = $userId['UserAccount']['user_id'];
1205
				$userId = $userId['UserAccount']['user_id'];
-
 
1206
				$opts = array('conditions'=>array('id'=>$userId),'recursive'=>-1,'fields'=>'first_name');
-
 
1207
				$userName = $this->User->find('first',$opts);
-
 
1208
				$usersName[$creditH['user_id']] = $userName['User']['first_name'];
1202
				$usersMap[$creditH['user_id']]=$userId;
1209
				$usersMap[$creditH['user_id']]=$userId;
1203
			}
1210
			}
1204
		}
1211
		}
1205
		$this->set(compact('creditHistory','usersMap','hasMore','totalCount','page'));
1212
		$this->set(compact('creditHistory','usersName','usersMap','hasMore','totalCount','page'));
1206
	}
1213
	}
1207
	
1214
	
1208
	public function admin_loanhistory($cuid = 0){
1215
	public function admin_loanhistory($cuid = 0){
1209
		$page = $this->request->query('page');
1216
		$page = $this->request->query('page');
1210
		if(!isset($page)){
1217
		if(!isset($page)){
Line 1223... Line 1230...
1223
		
1230
		
1224
		$response = $this->make_request ( $url, null );
1231
		$response = $this->make_request ( $url, null );
1225
		$loanHistory = $response['response']['loanHistory'];
1232
		$loanHistory = $response['response']['loanHistory'];
1226
		$hasMore = $response['response']['hasMore'];
1233
		$hasMore = $response['response']['hasMore'];
1227
		$totalCount = $response['response']['totalCount'];
1234
		$totalCount = $response['response']['totalCount'];
1228
		
1235
		$usersName = array();
1229
		$usersMap = array();
1236
		$usersMap = array();
1230
		foreach($loanHistory AS $loanH){
1237
		foreach($loanHistory AS $loanH){
1231
			if (!array_key_exists($loanH['user_id'], $usersMap)) {
1238
			if (!array_key_exists($loanH['user_id'], $usersMap)) {
1232
				$options = array('conditions'=>array('account_key'=>$loanH['user_id'],'account_type'=>'saholic'),'recursive'=>-1,'fields'=>'user_id');
1239
				$options = array('conditions'=>array('account_key'=>$loanH['user_id'],'account_type'=>'saholic'),'recursive'=>-1,'fields'=>'user_id');
1233
				$userId = $this->UserAccount->find('first',$options);
1240
				$userId = $this->UserAccount->find('first',$options);
1234
				$userId = $userId['UserAccount']['user_id'];
1241
				$userId = $userId['UserAccount']['user_id'];
-
 
1242
				$opts = array('conditions'=>array('id'=>$userId),'recursive'=>-1,'fields'=>'first_name');
-
 
1243
				$userName = $this->User->find('first',$opts);
-
 
1244
				$usersName[$loanH['user_id']] = $userName['User']['first_name'];
1235
				$usersMap[$loanH['user_id']]=$userId;
1245
				$usersMap[$loanH['user_id']]=$userId;
1236
			}
1246
			}
1237
		}
1247
		}
1238
					
1248
					
1239
		$this->set(compact('loanHistory','usersMap','hasMore','totalCount','page'));
1249
		$this->set(compact('usersName','loanHistory','usersMap','hasMore','totalCount','page'));
1240
	}
1250
	}
1241
	
1251
	
1242
	public function usernotification($user = null){
1252
	public function usernotification($user = null){
1243
		$android_id = $this->request->query('android_id');
1253
		$android_id = $this->request->query('android_id');
1244
		$user_id = $this->request->query('user_id');
1254
		$user_id = $this->request->query('user_id');