issue 2740 add last week statistics

git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12470 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ovclas 2012-12-26 08:39:15 +00:00
parent 9e46f8687e
commit d19ad9c2d0

View file

@ -287,32 +287,58 @@ class counterModel extends counter
public function getWeeklyUniqueVisitor()
{
$date = date('Ymd');
$output = $this->getHourlyStatus('week', $date);
//for last week
$date1 = date('Ymd', strtotime('-1 week'));
$output1 = $this->getHourlyStatus('week', $date1);
$tmp = array();
foreach($output->list AS $key=>$value)
foreach($output1->list AS $key=>$value)
{
$tmp["'".$key."'"] = $value;
}
$output->list = $tmp;
$output1->list = $tmp;
$this->add('data', $output);
//for this week
$date2 = date('Ymd');
$output2 = $this->getHourlyStatus('week', $date2);
$tmp = array();
foreach($output2->list AS $key=>$value)
{
$tmp["'".$key."'"] = $value;
}
$output2->list = $tmp;
$this->add('last_week', $output1);
$this->add('this_week', $output2);
}
public function getWeeklyPageView()
{
$date = date('Ymd');
$output = $this->getHourlyStatus('week', $date, 0, true);
//for last week
$date1 = date('Ymd', strtotime('-1 week'));
$output1 = $this->getHourlyStatus('week', $date1, 0, true);
$tmp = array();
foreach($output->list AS $key=>$value)
foreach($output1->list AS $key=>$value)
{
$tmp["'".$key."'"] = $value;
}
$output->list = $tmp;
$output1->list = $tmp;
$this->add('data', $output);
//for this week
$date2 = date('Ymd');
$output2 = $this->getHourlyStatus('week', $date2, 0, true);
$tmp = array();
foreach($output2->list AS $key=>$value)
{
$tmp["'".$key."'"] = $value;
}
$output2->list = $tmp;
$this->add('last_week', $output1);
$this->add('this_week', $output2);
}
}
/* End of file counter.model.php */