Example #1
0
<?php

include "../lib/jpgraph/jpgraph.php";
include "../lib/jpgraph/jpgraph_bar.php";
include "../lib/jpgraph/jpgraph_date.php";
require_once '../modules/statistics.php';
require_once '../modules/access_manager.php';
$access = new AccessManager();
$filename = basename($_SERVER['PHP_SELF']);
if ($filename != "login.php") {
    $access->checkAuth();
}
$period = $_GET['p'];
try {
    $stat = new CallsStatistics();
    $data = $stat->getCallsMinutes($period);
} catch (StatisticException $e) {
    echo "Error generating statistic: {$e}";
    exit;
}
$datax = array();
$datay = array();
foreach ($data as $entry) {
    array_push($datax, $entry[0]);
    array_push($datay, $entry[1]);
}
$tickint = count($datax) > 1 && count($datax) < 5 ? 5 : 2;
// Create the graph. These two calls are always required
$graph = new Graph(700, 350, 'auto');
$graph->SetScale("texlin");
$graph->yaxis->scale->SetGrace(10);
Example #2
0
<?php

include "../lib/jpgraph/jpgraph.php";
include "../lib/jpgraph/jpgraph_bar.php";
include "../lib/jpgraph/jpgraph_date.php";
require_once '../modules/statistics.php';
require_once '../modules/access_manager.php';
$access = new AccessManager();
$filename = basename($_SERVER['PHP_SELF']);
if ($filename != "login.php") {
    $access->checkAuth();
}
$period = $_GET['p'];
try {
    $stat = new CallsStatistics();
    $data = $stat->getCalls($period);
} catch (StatisticException $e) {
    echo "Error generating statistic: {$e}";
    exit;
}
$datax = array();
$datay = array();
foreach ($data as $entry) {
    array_push($datax, $entry[0]);
    array_push($datay, $entry[1]);
}
# 1 = 2
# 2 = 5
# 3 = 5
# 4 = 5
# 5 = 2
Example #3
0
<?php

require_once 'include/header.php';
require_once 'include/menu.php';
require_once 'modules/statistics.php';
print_menu('statistics');
?>
			<br/><br/>
			<center>
			<?php 
$stat = new CallsStatistics();
try {
    $total_calls = $stat->getTotalCalls();
} catch (StatisticException $e) {
    $total_calls = "ERROR {$e}";
}
try {
    $total_minutes = $stat->getTotalMinutes();
} catch (StatisticException $e) {
    $total_minutes = "ERROR {$e}";
}
try {
    $avg_call_duration = $stat->getAverageCallDuration();
} catch (StatisticException $e) {
    $avg_call_duration = "ERROR {$e}";
}
?>

			Total calls: <b><?php 
echo $total_calls;
?>