You are here

function mandrill_reports_data in Mandrill 7.2

Same name and namespace in other branches
  1. 8 modules/mandrill_reports/mandrill_reports.module \mandrill_reports_data()
  2. 7 modules/mandrill_reports/mandrill_reports.module \mandrill_reports_data()

Return an associative array containing raw stats.

Return value

array Associative array containing report data.

3 calls to mandrill_reports_data()
MandrillReportsTestCase::testGetReportsData in modules/mandrill_reports/tests/mandrill_reports.test
Tests getting Mandrill reports data.
mandrill_reports_dashboard_page in modules/mandrill_reports/mandrill_reports.module
Page callback for rendering stats.
mandrill_reports_summary_page in modules/mandrill_reports/mandrill_reports.module
Displays summary information for the active API user.

File

modules/mandrill_reports/mandrill_reports.module, line 52
Main module functions for mandrill_reports.

Code

function mandrill_reports_data() {
  if ($cache = cache_get('mandrill_report_data')) {
    return $cache->data;
  }
  $data = array();
  $api = mandrill_get_api_object();
  if ($api) {

    // Basic user info.
    $data['user'] = $api->users
      ->info();

    // All time.
    $data['all_time_series'] = $api->tags
      ->allTimeSeries();
  }
  else {
    drupal_set_message(t('Please enter a Mandrill API key to use reports.'));
    drupal_goto('admin/config/services/mandrill');
  }
  return $data;
}