public function AnalyticData::getDailyHistoryEventInstance in Analytics 6
Return the daily data for an event.
File
- includes/
analyticdata.inc, line 104 - Class definition for analytics.
Class
- AnalyticData
- @file Class definition for analytics.
Code
public function getDailyHistoryEventInstance($start_date = NULL) {
if ($start_date == NULL) {
$start_date = strtotime(date('Y-m-d'));
}
$data = array();
for ($i = 6; $i >= 0; $i--) {
$date = $start_date - 86400 * $i;
$query = db_select('analytics_event_instance', 'aei')
->fields('aei')
->condition('event_id', $this->event_id)
->condition('date', array(
date('Y-m-d', $date),
date('Y-m-d', $date + 86400),
), 'BETWEEN');
$data[$date] = $query
->countQuery()
->execute()
->fetchField();
}
return $data;
}