| Line 62... |
Line 62... |
| 62 |
if ($this->UserUrl->saveAll($pushdata['pushdata'])) {
|
62 |
if ($this->UserUrl->saveAll($pushdata['pushdata'])) {
|
| 63 |
$result = array('success' => true,'message'=>__('The url has been saved.'));
|
63 |
$result = array('success' => true,'message'=>__('The url has been saved.'));
|
| 64 |
} else {
|
64 |
} else {
|
| 65 |
$result = array('success' => false,'message'=>__('The url could not be saved. Please, try again.'));
|
65 |
$result = array('success' => false,'message'=>__('The url could not be saved. Please, try again.'));
|
| 66 |
}
|
66 |
}
|
| - |
|
67 |
*/
|
| 67 |
if(isset($pushdata['pushdata'][0]['httpstatus']) && !empty($pushdata['pushdata'][0]['httpstatus'])) {
|
68 |
if(isset($pushdata['pushdata'][0]['httpstatus']) && !empty($pushdata['pushdata'][0]['httpstatus'])) {
|
| 68 |
$this->loadModel('SaholicLog');
|
69 |
$this->loadModel('SaholicLog');
|
| 69 |
$this->SaholicLog->create();
|
70 |
$this->SaholicLog->create();
|
| 70 |
$this->SaholicLog->saveAll($pushdata['pushdata']);
|
71 |
$this->SaholicLog->saveAll($pushdata['pushdata']);
|
| 71 |
}
|
72 |
}
|
| 72 |
*/
|
- |
|
| 73 |
//Nodejs api call
|
73 |
//Nodejs api call
|
| 74 |
$url = "45.33.50.227:3001/addBrowsingHistory";
|
74 |
$url = Configure::read('nodeurl') . '/addBrowsingHistory/?pushed_by=php';
|
| 75 |
$this->make_request($url,$pushdata['pushdata'][0]);
|
75 |
$this->make_request($url,json_encode($pushdata));
|
| 76 |
$result = array('success' => true,'message'=>__('The url has been saved.'));
|
76 |
$result = array('success' => true,'message'=>__('The url has been saved.'));
|
| 77 |
$this->response->type('json');
|
77 |
$this->response->type('json');
|
| 78 |
$this->layout = 'ajax';
|
78 |
$this->layout = 'ajax';
|
| 79 |
$this->set(array(
|
79 |
$this->set(array(
|
| 80 |
'result' => $result,
|
80 |
'result' => $result,
|
| Line 139... |
Line 139... |
| 139 |
* admin_index method
|
139 |
* admin_index method
|
| 140 |
*
|
140 |
*
|
| 141 |
* @return void
|
141 |
* @return void
|
| 142 |
*/
|
142 |
*/
|
| 143 |
public function admin_index() {
|
143 |
public function admin_index() {
|
| - |
|
144 |
/*
|
| 144 |
$this->UserUrl->recursive = 0;
|
145 |
$this->UserUrl->recursive = 0;
|
| 145 |
$q = $this->request->query('q');
|
146 |
$q = $this->request->query('q');
|
| 146 |
if(isset($q) && !empty($q)){
|
147 |
if(isset($q) && !empty($q)){
|
| 147 |
$this->Paginator->settings = array('conditions' => array('UserUrl.url LIKE'=>'%'.$q.'%'),'order' => array('id'=>'desc'));
|
148 |
$this->Paginator->settings = array('conditions' => array('UserUrl.url LIKE'=>'%'.$q.'%'),'order' => array('id'=>'desc'));
|
| 148 |
$this->set(compact('q'));
|
149 |
$this->set(compact('q'));
|
| 149 |
} else {
|
150 |
} else {
|
| 150 |
$this->Paginator->settings = array('order' => array('id'=>'desc'));
|
151 |
$this->Paginator->settings = array('order' => array('id'=>'desc'));
|
| 151 |
}
|
152 |
}
|
| 152 |
$this->set('userUrls', $this->Paginator->paginate());
|
153 |
$this->set('userUrls', $this->Paginator->paginate());
|
| - |
|
154 |
*/
|
| - |
|
155 |
$page = $this->request->query('page');
|
| - |
|
156 |
if(!isset($page)){
|
| - |
|
157 |
$page = 1;
|
| - |
|
158 |
}
|
| - |
|
159 |
$url = Configure::read('nodeurl') . '/getBrowsingHistory/?posted_by=php';
|
| - |
|
160 |
$url = $this->UserUrl->getNodeUrl($url,$page);
|
| - |
|
161 |
$userUrls = $this->make_request($url,null);
|
| - |
|
162 |
$this->set(compact('userUrls', 'page'));
|
| 153 |
}
|
163 |
}
|
| 154 |
|
164 |
|
| 155 |
/**
|
165 |
/**
|
| 156 |
* admin_view method
|
166 |
* admin_view method
|
| 157 |
*
|
167 |
*
|
| Line 166... |
Line 176... |
| 166 |
$options = array('conditions' => array('UserUrl.' . $this->UserUrl->primaryKey => $id));
|
176 |
$options = array('conditions' => array('UserUrl.' . $this->UserUrl->primaryKey => $id));
|
| 167 |
$this->set('userUrl', $this->UserUrl->find('first', $options));
|
177 |
$this->set('userUrl', $this->UserUrl->find('first', $options));
|
| 168 |
}
|
178 |
}
|
| 169 |
|
179 |
|
| 170 |
public function admin_by($userId = null) {
|
180 |
public function admin_by($userId = null) {
|
| 171 |
$options = array('conditions' => array('UserUrl.user_id' => $userId),'order'=>array('id'=>'desc'),'limit' => 100);
|
181 |
/*$options = array('conditions' => array('UserUrl.user_id' => $userId),'order'=>array('id'=>'desc'),'limit' => 100);
|
| 172 |
$this->Paginator->settings = $options;
|
182 |
$this->Paginator->settings = $options;
|
| 173 |
$userUrls = $this->Paginator->paginate();
|
183 |
$userUrls = $this->Paginator->paginate();
|
| 174 |
$this->set(compact('userUrls'));
|
184 |
$this->set(compact('userUrls'));*/
|
| - |
|
185 |
$page = $this->request->query('page');
|
| - |
|
186 |
if(!isset($page)){
|
| - |
|
187 |
$page = 1;
|
| - |
|
188 |
}
|
| - |
|
189 |
$url = Configure::read('nodeurl') . '/getBrowsingHistoryByUserId/?posted_by=php&user_id='.$userId;
|
| - |
|
190 |
$url = $this->UserUrl->getNodeUrl($url,$page);
|
| - |
|
191 |
$userUrls = $this->make_request($url,null);
|
| - |
|
192 |
$userInfoApiUrl = Configure::read('nodeurl') . '/getUserById/?user_id='.$userId;
|
| - |
|
193 |
$user = $this->make_request($userInfoApiUrl,null);
|
| - |
|
194 |
$this->set(compact('userUrls', 'page','user','userId'));
|
| 175 |
}
|
195 |
}
|
| 176 |
/**
|
196 |
/**
|
| 177 |
* admin_add method
|
197 |
* admin_add method
|
| 178 |
*
|
198 |
*
|
| 179 |
* @return void
|
199 |
* @return void
|