public function AnalyticData::getCountEventInstance in Analytics 6
Count the total number of instances of this event.
Return value
integer
File
- includes/
analyticdata.inc, line 41 - Class definition for analytics.
Class
- AnalyticData
- @file Class definition for analytics.
Code
public function getCountEventInstance($case = 'all', $condition = NULL) {
$query = db_select('analytics_event_instance', 'aei')
->fields('aei')
->condition('event_id', $this->event_id);
switch ($case) {
case 'all':
case 'default':
break;
case 'daily':
if ($condition == NULL) {
$condition = time();
}
$query
->condition('date', array(
date('Y-m-d', $condition),
date('Y-m-d', $condition + 86400),
), 'BETWEEN');
break;
case 'weekly':
if ($condition == NULL) {
$condition = time();
}
$query
->condition('week', array(
date('W', $condition),
date('W', $condition + 604800),
), 'BETWEEN');
break;
}
$count = $query
->countQuery()
->execute()
->fetchField();
return $count;
}