Subversion Repositories general

Compare Revisions

Problem with comparison.

Ignore whitespace Rev HEAD → Rev 1368

/asterisk-stats/trunk/summary.php
0,0 → 1,43
<?php
####################################################
# AstWeb - Asterisk PBX Dynamic config environment #
# #
# Written by: Jamie Carl #
# jazz@funkynerd.com #
# #
# Copyright (C) 2006 Achieve Corp #
# #
# Licence: This software is licenced under the #
# GNU/GPL. Please see licence.txt for #
# more information. #
####################################################
 
if(!defined('IN_ASTWEB')) {
die('Hacking attempt!');
}
function add_summary($count_name, $dur_name, $interval)
{
global $db, $display;
 
$db->query("select count(acctid), sum(billsec) from cdr where" . BaseQuery()
. ($interval ? " and date_trunc('" . $interval . "', calldate) = date_trunc('"
. $interval . "', current_date)" : ""));
$db->fetch_row_idx();
$display->add_variables(array($count_name => $db->get_field(0),
$dur_name => Duration($db->get_field(1))));
}
 
# active calls
$db->query("select count(acctid) from activecalls where" . BaseQuery() . " and duration is null");
$db->fetch_row_idx();
$display->add_variables(array('CS_ACTIVE' => $db->get_field(0)));
 
add_summary('CS_TODAY', 'CS_TODAY_DUR', 'day');
add_summary('CS_WEEK', 'CS_WEEK_DUR', 'week');
add_summary('CS_MONTH', 'CS_MONTH_DUR', 'month');
add_summary('CS_YEAR', 'CS_YEAR_DUR', 'year');
add_summary('CS_TOTAL', 'CS_TOTAL_DUR', null);
 
$display->add_template('summary');
?>