<?php
class admin_statisticsControl extends skymvc{
		
	public function __construct(){
		parent::__construct();
		$this->loadModel(array("statistics"));
		if(empty($_SESSION['ssadmin'])){
			$this->gourl("".APPADMIN."?m=admin&a=login");	
		}
	}
	
	public function onDefault(){
		$rscount=true;
		$url="".APPADMIN."?m=admin_statistics&a=default";
		if($userid=get('userid','i')){
			$where['userid']=$userid;
			$url.="&userid=$userid";
		}
		if(get('start_time')){
			$where['dateline>=']=strtotime(get('start_time'));
			$url.="&start_time=".get('start_time');
		}
		if(get('end_time')){
			$where['dateline<=']=strtotime(get('end_time'));
			$url.="&end_time=".get('end_time');
		}
		if($from_url=get('from_url','h')){
			$where['from_url']=$from_url;
			$url.="&from_url".$from_url;
		}
		$option=array(
			"start"=>get('per_page','i'),
			"limit"=>50,
			"order"=>" id desc",
			"where"=>$where
			
		);
		$data=$this->statistics->select($option,$rscount);
		$pagelist=$this->pagelist($rscount,50,$url);
		$this->smarty->assign(array(
			"data"=>$data,
			"rscount"=>$rscount,
			"pagelist"=>$pagelist
		));
		$this->smarty->display("statistics/index.html");
	}
}

?>