Example #1
0
<?php

include "../lib/jpgraph/jpgraph.php";
include "../lib/jpgraph/jpgraph_bar.php";
include "../lib/jpgraph/jpgraph_date.php";
require '../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 CostsStatistics();
    $data = $stat->getCreditsStats($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

// content="text/plain; charset=utf-8"
include "../lib/jpgraph/jpgraph.php";
include "../lib/jpgraph/jpgraph_bar.php";
include "../lib/jpgraph/jpgraph_date.php";
require '../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 CostsStatistics();
    $data = $stat->getCostsStats($period);
} catch (StatisticException $e) {
    echo "Error generating statistic: {$e}";
}
$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 #3
0
<?php

include "../lib/jpgraph/jpgraph.php";
include "../lib/jpgraph/jpgraph_bar.php";
include "../lib/jpgraph/jpgraph_date.php";
include "../modules/statistics.php";
try {
    $stat = new CostsStatistics();
    $data = $stat->getCostsStats('4w');
} 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]);
}
//print_r($datax);
//print_r($datay);
//$datay=array(12,8,19,3,10,5);
// Create the graph. These two calls are always required
$graph = new Graph(700, 350, 'auto');
$graph->SetScale("texlin");
$graph->yaxis->scale->SetGrace(10);
$graph->xaxis->SetTickLabels($datax);
$graph->xaxis->SetLabelAngle(45);
$graph->xaxis->SetTextLabelInterval(5);
// Add a drop shadow
$graph->SetShadow();
Example #4
0
<?php

require_once 'include/header.php';
require_once 'include/menu.php';
require_once 'modules/statistics.php';
print_menu('statistics');
?>
			<br/><br/>
			<center>
			<br/>
			<?php 
$stat = new CostsStatistics();
try {
    $total_cost = $stat->getTotalSpent();
} catch (StatisticException $e) {
    $total_cost = "ERROR {$e}";
}
try {
    $total_credits = $stat->getTotalSpentCredits();
} catch (StatisticException $e) {
    $total_credits = "ERROR {$e}";
}
try {
    $avg_call_cost = $stat->getAverageCallCost();
} catch (StatisticException $e) {
    $avg_call_cost = "ERROR {$e}";
}
?>

			Total spent on calls: <b><?php 
echo $total_cost;