| Line 23... |
Line 23... |
| 23 |
* admin_index method
|
23 |
* admin_index method
|
| 24 |
*
|
24 |
*
|
| 25 |
* @return void
|
25 |
* @return void
|
| 26 |
*/
|
26 |
*/
|
| 27 |
public function admin_index() {
|
27 |
public function admin_index() {
|
| - |
|
28 |
throw new NotFoundException(__('Unauthorized access'));
|
| 28 |
if ($this->request->is('post')) {
|
29 |
if ($this->request->is('post')) {
|
| 29 |
alert('Clicked');
|
30 |
alert('Clicked');
|
| 30 |
}
|
31 |
}
|
| 31 |
$this->Callhistory->recursive = 0;
|
32 |
$this->Callhistory->recursive = 0;
|
| 32 |
$this->Paginator->settings = array('order' => array('id'=>'desc'));
|
33 |
$this->Paginator->settings = array('order' => array('id'=>'desc'));
|
| Line 187... |
Line 188... |
| 187 |
|
188 |
|
| 188 |
public function admin_activations() {
|
189 |
public function admin_activations() {
|
| 189 |
$date_from = $this->request->query('date_from');
|
190 |
$date_from = $this->request->query('date_from');
|
| 190 |
$date_to = $this->request->query('date_to');
|
191 |
$date_to = $this->request->query('date_to');
|
| 191 |
if(!empty($date_to)||!empty($date_from)){
|
192 |
if(!empty($date_to)||!empty($date_from)){
|
| 192 |
$otherSql="SELECT a.name, COUNT( r.id ) AS count FROM `retailerlinks` r LEFT JOIN agents a ON r.agent_id = a.id WHERE DATE( r.activated ) BETWEEN '$date_from' AND '$date_to' GROUP BY a.id";
|
193 |
$otherSql="SELECT a.name, COUNT( r.id ) AS count FROM `retailerlinks` r LEFT JOIN agents a ON r.agent_id = a.id join users u on r.user_id=u.id WHERE DATE( r.activated ) BETWEEN '$date_from' AND '$date_to' and r.user_id is not null and date(u.activation_time)=BETWEEN '$date_from' AND '$date_to' GROUP BY a.id";
|
| - |
|
194 |
|
| 193 |
$sql = "SELECT DATE( created ) AS date, utm_campaign,referrer , COUNT( id ) AS count FROM users WHERE DATE(created) BETWEEN '$date_from' AND '$date_to' AND (utm_campaign IS NOT NULL OR referrer IS NOT NULL) GROUP BY DATE( created) ,utm_campaign,referrer";
|
195 |
$sql = "SELECT DATE( created ) AS date, utm_campaign,referrer , COUNT( id ) AS count FROM users WHERE DATE(created) BETWEEN '$date_from' AND '$date_to' AND (utm_campaign IS NOT NULL OR referrer IS NOT NULL) GROUP BY DATE( created) ,utm_campaign,referrer";
|
| 194 |
} else{
|
196 |
} else{
|
| 195 |
$otherSql="SELECT a.name, COUNT( r.id ) AS count FROM `retailerlinks` r LEFT JOIN agents a ON r.agent_id = a.id WHERE DATE( r.activated ) = CURDATE( ) GROUP BY a.id";
|
197 |
$otherSql="SELECT a.name, COUNT( r.id ) AS count FROM `retailerlinks` r LEFT JOIN agents a ON r.agent_id = a.id join users u on r.user_id=u.id WHERE DATE( r.activated ) = CURDATE( ) and r.user_id is not null and date(u.activation_time)=curdate() GROUP BY a.id";
|
| 196 |
$sql = "SELECT DATE( created ) AS date, utm_campaign,referrer , COUNT( id ) AS count FROM users WHERE DATE( created ) = CURDATE() AND (utm_campaign IS NOT NULL OR referrer IS NOT NULL) GROUP BY DATE( created) ,utm_campaign,referrer";
|
198 |
$sql = "SELECT DATE( created ) AS date, utm_campaign,referrer , COUNT( id ) AS count FROM users WHERE DATE( created ) = CURDATE() AND (utm_campaign IS NOT NULL OR referrer IS NOT NULL) GROUP BY DATE( created) ,utm_campaign,referrer";
|
| 197 |
}
|
199 |
}
|
| 198 |
$this->loadModel('User');
|
200 |
$this->loadModel('User');
|
| 199 |
$activations = $this->User->query($sql);
|
201 |
$activations = $this->User->query($sql);
|
| 200 |
foreach ($activations as $key => $value) {
|
202 |
foreach ($activations as $key => $value) {
|