Subversion Repositories SmartDukaan

Rev

Rev 13532 | Rev 15093 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
13532 anikendra 1
<?php
2
App::uses('AppController', 'Controller');
3
/**
4
 * Administration Controller
5
 *
6
 * @property Administration $Administration
7
 * @property PaginatorComponent $Paginator
8
 */
9
class AdministrationController extends AppController {
10
 
11
/**
12
 * Components
13
 *
14
 * @var array
15
 */
16
	public $components = array('Paginator');
17
 
18
	public function beforeFilter() {
19
    	parent::beforeFilter();
20
    	$this->layout = 'admin';
21
    }
22
 
23
	public function dashboard(){
15077 anikendra 24
		$this->loadModel('User');
25
		//daily userbase
26
		$sql = "SELECT count(User.id) AS count,date(User.created) AS date FROM users User WHERE datediff(now(),created) <= 30 GROUP BY date(created) ORDER BY id DESC";
27
		$userbase = $this->User->query($sql);
28
		$sql = "SELECT count(Click.id) AS count,date(created) AS date FROM clicks Click WHERE datediff(now(),created) <= 30 GROUP BY date(created) ORDER BY id DESC";
29
		$clicks = $this->User->query($sql);
30
		$this->set(compact('userbase','clicks'));
31
		$sql = "SELECT count(id) AS count,date(created) AS date FROM orders WHERE datediff(now(),created) <= 30 AND status = 'ORDER_CREATED' GROUP BY date(created) ORDER BY id DESC";
32
		$orders = $this->User->query($sql);		
33
		$sql = "select count(id) AS count,versioncode from devices group by versioncode";
34
		$devices = $this->User->query($sql);
35
		$this->set(compact('userbase','clicks','orders','devices'));
13532 anikendra 36
	}
37
}