issue 2740 add page view api

git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12378 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ovclas 2012-12-11 05:24:04 +00:00
parent 81354ae125
commit 7cd4e520c6
2 changed files with 47 additions and 5 deletions

View file

@ -3,10 +3,12 @@
<grants /> <grants />
<permissions> <permissions>
<permission action="getWeeklyUniqueVisitor" target="manager" /> <permission action="getWeeklyUniqueVisitor" target="manager" />
<permission action="getWeeklyPageView" target="manager" />
</permissions> </permissions>
<actions> <actions>
<action name="dispCounterAdminIndex" type="view" standalone="true" admin_index="true" /> <action name="dispCounterAdminIndex" type="view" standalone="true" admin_index="true" />
<action name="procCounterExecute" type="controller" standalone="true" /> <action name="procCounterExecute" type="controller" standalone="true" />
<action name="getWeeklyUniqueVisitor" type="model" standalone="true" /> <action name="getWeeklyUniqueVisitor" type="model" standalone="true" />
<action name="getWeeklyPageView" type="model" standalone="true" />
</actions> </actions>
</module> </module>

View file

@ -104,7 +104,7 @@ class counterModel extends counter
* @param integer $site_srl Site_srl * @param integer $site_srl Site_srl
* @return Object * @return Object
*/ */
function getHourlyStatus($type='hour', $selected_date, $site_srl=0) function getHourlyStatus($type='hour', $selected_date, $site_srl=0, $isPageView=false)
{ {
$max = 0; $max = 0;
$sum = 0; $sum = 0;
@ -137,7 +137,15 @@ class counterModel extends counter
{ {
$output = executeQuery('counter.getCounterStatus', $args); $output = executeQuery('counter.getCounterStatus', $args);
} }
if(!$isPageView)
{
$count = (int)$output->data->unique_visitor; $count = (int)$output->data->unique_visitor;
}
else
{
$count = (int)$output->data->pageview;
}
$status->list[$i] = $count; $status->list[$i] = $count;
if($count>$max) $max = $count; if($count>$max) $max = $count;
$sum += $count; $sum += $count;
@ -172,7 +180,15 @@ class counterModel extends counter
{ {
$output = executeQuery('counter.getCounterStatus', $args); $output = executeQuery('counter.getCounterStatus', $args);
} }
if(!$isPageView)
{
$count = (int)$output->data->unique_visitor; $count = (int)$output->data->unique_visitor;
}
else
{
$count = (int)$output->data->pageview;
}
$status->list[$day] = (int)$count; $status->list[$day] = (int)$count;
if($count>$max) $max = $count; if($count>$max) $max = $count;
$sum += $count; $sum += $count;
@ -194,7 +210,15 @@ class counterModel extends counter
{ {
$output = executeQuery('counter.getCounterStatus', $args); $output = executeQuery('counter.getCounterStatus', $args);
} }
if(!$isPageView)
{
$count = (int)$output->data->unique_visitor; $count = (int)$output->data->unique_visitor;
}
else
{
$count = (int)$output->data->pageview;
}
$status->list[$i] = (int)$count; $status->list[$i] = (int)$count;
if($count>$max) $max = $count; if($count>$max) $max = $count;
$sum += $count; $sum += $count;
@ -240,7 +264,15 @@ class counterModel extends counter
{ {
$output = executeQuery('counter.getCounterStatus', $args); $output = executeQuery('counter.getCounterStatus', $args);
} }
if(!$isPageView)
{
$count = (int)$output->data->unique_visitor; $count = (int)$output->data->unique_visitor;
}
else
{
$count = (int)$output->data->pageview;
}
$status->list[$i] = $count; $status->list[$i] = $count;
if($count>$max) $max = $count; if($count>$max) $max = $count;
$sum += $count; $sum += $count;
@ -260,6 +292,14 @@ class counterModel extends counter
$this->add('data', $output); $this->add('data', $output);
} }
public function getWeeklyPageView()
{
$date = date('Ymd');
$output = $this->getHourlyStatus('week', $date, 0, true);
$this->add('data', $output);
}
} }
/* End of file counter.model.php */ /* End of file counter.model.php */
/* Location: ./modules/counter/counter.model.php */ /* Location: ./modules/counter/counter.model.php */