$duration = $interval_types[$url_params['interval']]['duration'];
if ($url_params['service'] == 'sms') {
    $stats_url = SMS_STATS_URL . "?days=" . $interval_types[$url_params['interval']]['numdays'];
    $stats_data = json_decode(file_get_contents($stats_url), TRUE);
    $days = aggregate_days($stats_data['days'], $url_params['interval'], $duration);
    $sent = aggregate_days($stats_data['sent'], $url_params['interval'], $duration);
    $modules = $stats_data['modules'];
    $carriers = $stats_data['carriers'];
    $graphs = array(summary_total($days, "count", "total incoming messages"), trend($days, "count", "Incoming Messages by " . ucfirst($url_params['interval']), $url_params['interval']), summary_total($sent, "count", "total outgoing messages"), trend($sent, "count", "Outgoing Messages by " . ucfirst($url_params['interval']), $url_params['interval']), bar_percentage(carriers_data($carriers), "Queries by Carrier"), list_items(generate_sms_content($modules), "Popular SMS Queries", "queries"));
} else {
    $all_data = PageViews::view_past($url_params['service'], $url_params['interval'], $duration);
    if ($url_params['service'] == 'web') {
        $graphs = array(summary_total($all_data, "total", "total page views"), trend($all_data, "total", 'Page Views by ' . ucfirst($url_params['interval']), $url_params['interval']), bar_percentage(platform_data($all_data), "Traffic by Platform"), list_items(generate_popular_content('web', $all_data), "Most Popular Content", "page views"));
    } else {
        // api
        $graphs = array(summary_total(PageViews::count_iphone_tokens(), "total", "active users"), summary_total($all_data, "total", "total API requests"), trend($all_data, "total", 'API Requests by ' . ucfirst($url_params['interval']), $url_params['interval']), list_items(generate_popular_content('api', $all_data), "Most Popular Modules", "requests"));
    }
}
$name = $service_types[$url_params['service']];
// set states of fake segmented control
$statclasses = array();
foreach ($interval_types as $type => $attrs) {
    $stclass = array();
    $stclass['interval'] = $type;
    if ($url_params['interval'] == $type) {
        $stclass['active'] = ' class="active"';
    } else {
        $stclass['active'] = '';
    }
    $stclass['title'] = $attrs['title'];
    $statclasses[$type] = $stclass;
Пример #2
0
    summary_total($all_data, "total", "total page views"),
    trend($all_data, "total", 
	  'Page Views by ' . ucfirst($url_params['interval']), 
	  $url_params['interval']),
    bar_percentage( platform_data($all_data), "Traffic by Platform"),
    list_items(generate_popular_content('web', $all_data), "Most Popular Content", "page views"),
    );
} else { // api
  $graphs = array(
    summary_total(PageViews::count_iphone_tokens(), "total", "active iPhone users"),
    summary_total($all_data, "total", "total API requests"),
    trend($all_data, "total", 
	  'API Requests by ' . ucfirst($url_params['interval']), 
	  $url_params['interval']),
    bar_percentage( native_platform_data($all_data), "Requests by Platform"),
    list_items(generate_popular_content('api', $all_data), "Most Popular Modules", "requests"),
    );
} 

$name = $service_types[$url_params['service']];

// set states of fake segmented control
$statclasses = Array();
foreach ($interval_types as $type => $attrs) {
  $stclass = Array();
  $stclass['interval'] = $type;
  if ($url_params['interval'] == $type) {
    $stclass['active'] = ' class="active"';
  } else {
    $stclass['active'] = '';
  }