129 lines
3.2 KiB
PHP
129 lines
3.2 KiB
PHP
<?php
|
|
/*
|
|
# Fuer debugging
|
|
error_reporting(E_ALL);
|
|
ini_set('display_errors', 1);
|
|
#echo __LINE__."<br>";
|
|
*/
|
|
|
|
require_once("config/datenbankanbindung.php"); // fügt die Datenbankanbindung ein: Sys:\php\includes\kurs\datenbankanbindung.php
|
|
|
|
#require ("./jpgraph/jpgraph.php");
|
|
#require ("./jpgraph/jpgraph_bar.php");
|
|
#require ("./jpgraph/jpgraph_line.php");
|
|
require ("./jpgraph/src/jpgraph.php");
|
|
require ("./jpgraph/src/jpgraph_bar.php");
|
|
require ("./jpgraph/src/jpgraph_line.php");
|
|
|
|
|
|
$db = dbconnect();
|
|
|
|
$query2 = $db->query( "SELECT count(*) multiplikator
|
|
FROM userlog,admin
|
|
WHERE admin.user= userlog.uid
|
|
GROUP BY userlog.uid" );
|
|
$row2 = $query2->fetch_object();
|
|
$height= 16*5;
|
|
|
|
|
|
$query = "SELECT vorname, nachname, count(ip) anz,datum
|
|
FROM userlog,admin
|
|
WHERE admin.user= userlog.uid
|
|
AND admin.inaktiv !='X'
|
|
GROUP BY userlog.uid
|
|
ORDER BY anz desc, datum desc, nachname asc
|
|
LIMIT 5
|
|
";
|
|
$result = $db->query( $query)
|
|
or die ("Cannot execute query");
|
|
|
|
|
|
while ($row = $result->fetch_array()){
|
|
|
|
$ydata[] = $row['anz'];
|
|
$ydata2[] = $row['anz'];
|
|
$namen[] = "$row[vorname] $row[nachname] ($row[anz])";
|
|
|
|
|
|
}
|
|
|
|
|
|
// Some "random" data ## Balken und Linien
|
|
#$ydata = $data;
|
|
#$ydata2 = $data;
|
|
#exit;
|
|
// Get a list of month using the current locale
|
|
#$namen = $gDateLocale->GetShortMonth();
|
|
#$namen = array('1','3');
|
|
|
|
// Create the graph.
|
|
$graph = new Graph(400,220);
|
|
$graph->SetScale("textlin"); # automatische Bemaßung
|
|
$graph->SetMarginColor('white');
|
|
|
|
// Adjust the margin slightly so that we use the
|
|
// entire area (since we don't use a frame)
|
|
$graph->Set90AndMargin(120,10,35,20); # es empfiehlt sich immer was anzugeben, da bei 0 eine ungeschickte autoskalierung zur Anwendung kommt
|
|
#$graph->xaxis->SetLabelAngle(90);
|
|
#$graph->SetMargin(40,10,40,45);
|
|
|
|
// Box around plotarea
|
|
$graph->SetBox();
|
|
|
|
// No frame around the image
|
|
$graph->SetFrame(false);
|
|
|
|
// Setup the tab title
|
|
$graph->title->Set('Top 5 User');
|
|
$graph->tabtitle->Set('Besuchsstatistik');
|
|
// Setup the tab title
|
|
#$graph->tabtitle->Set('Top 5 User');
|
|
|
|
$graph->title->SetFont(FF_ARIAL,FS_BOLD,10);
|
|
|
|
|
|
|
|
// Setup month as labels on the X-axis
|
|
$graph->xaxis->SetTickLabels($namen);
|
|
$graph->xaxis->SetFont(FF_ARIAL,FS_NORMAL,7);
|
|
#$graph->xaxis->SetLabelAlign('right','center','center');
|
|
#$graph->xaxis->SetLabelAngle(45);
|
|
$graph->yaxis->SetPos(5.8);
|
|
|
|
$graph->yaxis->SetFont(FF_ARIAL,FS_NORMAL,7);
|
|
// Create a bar pot
|
|
$bplot = new BarPlot($ydata);
|
|
$bplot->SetWidth(0.6);
|
|
$fcol='#440000';
|
|
$tcol='#FF9090';
|
|
|
|
$bplot->SetFillGradient($fcol,$tcol,GRAD_LEFT_REFLECTION);
|
|
|
|
// Set line weigth to 0 so that there are no border
|
|
// around each bar
|
|
$bplot->SetWeight(1);
|
|
|
|
$graph->Add($bplot);
|
|
|
|
// Create filled line plot # Füllung
|
|
$lplot = new LinePlot($ydata2);
|
|
$lplot->SetFillColor('skyblue@0.7');
|
|
$lplot->SetColor('navy@0.5');
|
|
$lplot->SetBarCenter();
|
|
$lplot->mark->SetType(MARK_SQUARE);
|
|
$lplot->mark->SetColor('blue@0.7');
|
|
$lplot->mark->SetFillColor('lightblue');
|
|
$lplot->mark->SetSize(3);
|
|
|
|
$graph->Add($lplot);
|
|
|
|
// Setup the X and Y grid
|
|
$graph->ygrid->SetFill(true,'#EFEFEF@0.5','#BBCCFF@0.5');
|
|
$graph->ygrid->Show();
|
|
$graph->xgrid->Show();
|
|
|
|
|
|
// .. and finally send it back to the browser
|
|
$graph->Stroke();
|
|
?>
|