-
Notifications
You must be signed in to change notification settings - Fork 6
/
provisioning_status.phtml
81 lines (61 loc) · 3.39 KB
/
provisioning_status.phtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
/*
* This file displays the provisioning stats
*/
require("/etc/cdrtool/global.inc");
page_open(
array("sess" => "CDRTool_Session",
"auth" => "CDRTool_Auth",
"perm" => "CDRTool_Perm"
)
);
require("provisioning_statistics.php");
$perm->check("statistics");
$title="Provisioning usage statistics";
include("header.phtml");
global $CDRTool;
if (strlen($CDRTool['filter']['domain'])) {
$allowedDomains = explode(' ', $CDRTool['filter']['domain']);
}
$layout = new pageLayoutLocal();
$layout->showTopMenu($title);
$start_date = isset($_REQUEST['start_date']) ? new DateTime($_REQUEST['start_date']) : new DateTime('-30 days');
$stop_date = isset($_REQUEST['stop_date']) ? new DateTime($_REQUEST['stop_date']) : new DateTime('now');
if ($start_date == $stop_date) {
$start_date = $start_date->setTime(00, 00, 00);
$stop_date = $stop_date->setTime(00, 00, 00);
$stop_date->add(new DateInterval('P1D'));
}
print "<script type=\"text/javascript\">var start_date_set=\"".$start_date->format('Y-m-d H:i:s')."\";var stop_date_set=\"".$stop_date->format('Y-m-d H:i:s')."\";</script>";
foreach (array_keys($DATASOURCES) as $datasource) {
if (isset($DATASOURCES[$datasource]['db_ngnpro_stats'])) {
$stats= new ProvisioningStatistics();
list($data1, $data2) = $stats->getTopRequestsProvisioning($DATASOURCES[$datasource]['db_ngnpro_stats'], $start_date, $stop_date);
// Fetch the required data
$donutData = $stats->getData($data1, $data2);
$requests_number = $stats->getNumber($DATASOURCES[$datasource]['db_ngnpro_stats'], $start_date, $stop_date);
$interval = $start_date->diff($stop_date);
$requests_time_new = $stats->getRequestsTime($DATASOURCES[$datasource]['db_ngnpro_stats'], $interval->days, $start_date, $stop_date);
$requests_new = $stats->getRequestsProvisioning($DATASOURCES[$datasource]['db_ngnpro_stats'], $interval->days, $start_date, $stop_date);
print "<div id=\"reportrange\" class=\"btn pull-right\">
<i class=\"icon-calendar\"></i>
<span>".$start_date->format('F j, Y H:i:s')." - ".$stop_date->format('F j, Y H:i:s')."</span> <b class=\"caret\"></b>
</div>";
print "<div style='clear:both'></div>";
print "<script type='text/javascript'>$('#reportrange').detach().appendTo('.page-header h1');</script>";
print "<div class='row-fluid' style='min-height:350px'><div class='span6'>";
print "<div class='alert alert-success'><center> $requests_number[0] requests between ".$start_date->format('Y-m-d H:i:s')." and ".$stop_date->format('Y-m-d H:i:s')." </center></div>";
print "<p>Top 5 percentages are calculated from the total amount of requests in the top 5. The Top 5 donut can be zoomed to reveal distribution from each source IP.
The percentages in the zoomed donut are based on the total amount of the specific SOAP port.<br/><br/>
The Line graphs can be zoomed by selecting an area in the graph. The graphs can be zoomed out with a mouse-click on the graph.</p></div>";
print "<div class='span6'>";
$stats->printChartDonut("Top 5 distribution of request types", $donutData);
print "</div></div>";
print "<div class='row-fluid' style='min-height:280px'>";
$stats->printLineCharts($datasource, $requests_new, $requests_time_new);
print "</div>";
}
}
$layout->showFooter();
page_close();
?>