Skip to content
Snippets Groups Projects
Unverified Commit ae204f90 authored by Dominik Baránek's avatar Dominik Baránek
Browse files

Removed unused functions

parent cb2a5a58
No related branches found
No related tags found
1 merge request!6Fixed drawing correct data into table by selected time range
......@@ -13,6 +13,8 @@ All notable changes to this project will be documented in this file.
[Fixed]
- Draws tables data by selected time range
[Removed]
- Removed unused functions
## [v1.3.0]
[Added]
......
......@@ -77,38 +77,6 @@ class DatabaseCommand
}
public static function getLoginCountPerDeyPerService()
{
$databaseConnector = new DatabaseConnector();
$conn = $databaseConnector->getConnection();
assert($conn != NULL);
$identityProvidersTableName = $databaseConnector->getIdentityProvidersTableName();
$identityProvidersMapTableName = $databaseConnector->getIdentityProvidersMapTableName();
$stmt = $conn->prepare("SELECT year, month, IFNULL(name,sourceIdp) AS idPName, SUM(count) AS count FROM ".$identityProvidersTableName. " LEFT OUTER JOIN " . $identityProvidersMapTableName . " ON sourceIdp = entityId GROUP BY year, month, sourceIdp HAVING sourceIdp != '' ORDER BY year DESC, month DESC, count DESC");
$stmt->execute();
$result = $stmt->get_result();
while($row = $result->fetch_assoc()) {
echo "[new Date(".$row["year"].",".($row["month"] - 1 )."),'".str_replace("'","\'",$row["idPName"])."', {v:".$row["count"]."}],";
}
$conn->close();
}
public static function getAccessToServicesPerMonth()
{
$databaseConnector = new DatabaseConnector();
$conn = $databaseConnector->getConnection();
assert($conn != NULL);
$serviceProvidersTableName = $databaseConnector->getServiceProvidersTableName();
$serviceProvidersMapTableName = $databaseConnector->getServiceProvidersMapTableName();
$stmt = $conn->prepare("SELECT year, month, IFNULL(name,service) AS spName, SUM(count) AS count FROM ".$serviceProvidersTableName." LEFT OUTER JOIN " . $serviceProvidersMapTableName . " ON service = identifier GROUP BY year DESC, month DESC, service HAVING service != '' ORDER BY year DESC, month DESC, count DESC");
$stmt->execute();
$result = $stmt->get_result();
while($row = $result->fetch_assoc()) {
echo "[new Date(".$row["year"].",".($row["month"] - 1 )."),'".str_replace("'","\'",$row["spName"])."', {v:".$row["count"]."}],";
}
$conn->close();
}
public static function getCountOfAllLogins()
{
$databaseConnector = new DatabaseConnector();
......
......@@ -14,7 +14,6 @@ $lastDays = $this->data['lastDays'];
<script type="text/javascript">
google.charts.load('current', {'packages':['corechart', 'controls', 'table']});
google.charts.setOnLoadCallback(drawLoginsChart);
google.charts.setOnLoadCallback(drawLoginsTable);
function drawLoginsChart() {
var data = google.visualization.arrayToDataTable([
......@@ -42,22 +41,7 @@ $lastDays = $this->data['lastDays'];
dashboard.draw(data);
}
function drawLoginsTable() {
var data = new google.visualization.DataTable();
data.addColumn('date', '<?php echo $this->t('{proxystatistics:Proxystatistics:templates/tables_date}'); ?>');
data.addColumn('number', '<?php echo $this->t('{proxystatistics:Proxystatistics:templates/count}'); ?>');
data.addRows([<?php DatabaseCommand::getLoginCountPerDay($lastDays)?>]);
var table = new google.visualization.Table(document.getElementById('loginsTable'));
var formatter = new google.visualization.DateFormat({pattern: "d MMMM yyyy"});
formatter.format(data, 0); // Apply formatter to second column
table.draw(data, {showRowNumber: false,});
}
google.charts.setOnLoadCallback(drawIdpsChart);
google.charts.setOnLoadCallback(drawIdpsTable);
function drawIdpsChart() {
var data = google.visualization.arrayToDataTable([
......@@ -76,23 +60,8 @@ $lastDays = $this->data['lastDays'];
chart.draw(data, options);
}
function drawIdpsTable() {
var data = new google.visualization.DataTable();
data.addColumn('date', '<?php echo $this->t('{proxystatistics:Proxystatistics:templates/tables_month}'); ?>');
data.addColumn('string', '<?php echo $this->t('{proxystatistics:Proxystatistics:templates/tables_identity_provider}'); ?>');
data.addColumn('number', '<?php echo $this->t('{proxystatistics:Proxystatistics:templates/count}'); ?>');
data.addRows([<?php DatabaseCommand::getLoginCountPerDeyPerService()?>]);
var table = new google.visualization.Table(document.getElementById('idpsTable'));
var formatter = new google.visualization.DateFormat({pattern:"MMMM yyyy"});
formatter.format(data, 0); // Apply formatter to second column
table.draw(data);
}
google.charts.setOnLoadCallback(drawSpsChart);
google.charts.setOnLoadCallback(drawSpsTable);
function drawSpsChart() {
var data = google.visualization.arrayToDataTable([
......@@ -111,20 +80,7 @@ $lastDays = $this->data['lastDays'];
chart.draw(data, options);
}
function drawSpsTable() {
var data = new google.visualization.DataTable();
data.addColumn('date', '<?php echo $this->t('{proxystatistics:Proxystatistics:templates/tables_month}'); ?>');
data.addColumn('string', '<?php echo $this->t('{proxystatistics:Proxystatistics:templates/tables_service_provider}'); ?>');
data.addColumn('number', '<?php echo $this->t('{proxystatistics:Proxystatistics:templates/count}'); ?>');
data.addRows([<?php DatabaseCommand::getAccessToServicesPerMonth()?>]);
var table = new google.visualization.Table(document.getElementById('spsTable'));
var formatter = new google.visualization.DateFormat({pattern:"MMMM yyyy"});
formatter.format(data, 0); // Apply formatter to second column
table.draw(data);
}
</script>
</head>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment