summaryrefslogblamecommitdiffstats
path: root/Website/networkResult.php
blob: 962d60720162d8222b9af6c85a4833e7fa7b4edb (plain) (tree)




















































































































































































































































































































                                                                                                                                                                                                                  
<?php   
 /* CAT:Drawing */

 /* pChart library inclusions */
 include("class/pData.class.php");

 include("class/pDraw.class.php");
 include("class/pImage.class.php");

 include("class/pSurface.class.php"); 
 //test case php defined for defining the colors and what's OK and what's wrong!
 include 'testCase.php';

 //Triangle function used for defining a triangle, used later to draw a triangle polygon!
 function Triangle($x,$y)
 {
    $Bx = $x - 7;
    $By = $y + 18;
    $Cx = $x + 7;
    $Cy = $y + 18;
    return array($x,$y,$Bx,$By,$Cx,$Cy);
 }

 /* Create and populate the pData object */
 $MyData = new pData();
 $MyData->addPoints(array($GSMINTPercent,$GSMEXTPercent,$SIPPercent,$UNISIPPercent,$LANDLINEPercent),"Hits");
 $MyData->setAxisName(0,"Network operability");
 $MyData->addPoints(array("GSM University","GSM External","SIP","Uni.Tel.network","Landline"),"Networks");
 $MyData->setSerieDescription("Networks","Networks");
 $MyData->setAbscissa("Networks");


 /* Create the pChart object */
 $myPicture = new pImage(700,430,$MyData);

 /* Draw the background */
 $Settings = array("R"=>170, "G"=>183, "B"=>87, "Dash"=>1, "DashR"=>190, "DashG"=>203, "DashB"=>107);
// $myPicture->drawFilledRectangle(0,0,700,230,$Settings);

 /* Overlay with a gradient */
 $Settings = array("StartR"=>219, "StartG"=>231, "StartB"=>139, "EndR"=>1, "EndG"=>138, "EndB"=>68, "Alpha"=>50);
 $myPicture->drawGradientArea(0,0,700,430,DIRECTION_VERTICAL,$Settings);
 $myPicture->drawGradientArea(0,0,700,20,DIRECTION_VERTICAL,array("StartR"=>0,"StartG"=>0,"StartB"=>0,"EndR"=>50,"EndG"=>50,"EndB"=>50,"Alpha"=>80));

 /* Add a border to the picture */
 $myPicture->drawRectangle(0,0,699,429,array("R"=>0,"G"=>0,"B"=>0));
 
 /* Write the picture title */ 
 $myPicture->setFontProperties(array("FontName"=>"fonts/Silkscreen.ttf","FontSize"=>6));
 $myPicture->drawText(10,13,"Network Test Results - UNI FREIBURG",array("R"=>255,"G"=>255,"B"=>255));



 //CONNECTIONS
 /* BTS PICTURE INTERNAL CONNECTIONS */ 
 $myPicture->drawLine(80,170,185,230,$BTS1PING); //BTS1 PING
 $myPicture->drawLine(75,225,185,225,$BTS2PING); //BTS2 PING
 $myPicture->drawLine(75,288,185,220,$BTS2PING); //BTS3 PING 
 /*GSMBOX LINES */
 $myPicture->drawLine(181,65,299,150); //BTS3 PING 
 $myPicture->drawLine(250,65,308,150); //BTS3 PING 
 $myPicture->drawLine(347,65,309,150); //BTS3 PING 
 $myPicture->drawLine(410,70,316,150); //BTS3 PING 

 //Arrow for GSM-Box
 $arrowSettings = array("FillR"=>2.5,"FillG"=>2.5,"FillB"=>2.5,"Ticks"=>1); 
 $myPicture->drawArrow(303,209,303,161,$arrowSettings); 

 //Arrow for Landline 
 $arrowSettings = array("FillR"=>2.5,"FillG"=>2.5,"FillB"=>2.5,"Ticks"=>1); 
 $myPicture->drawArrow(313,210,393,171,$arrowSettings); 
 
 //Arrow for University telephone network 
 $arrowSettings = array("FillR"=>2.5,"FillG"=>2.5,"FillB"=>2.5,"Ticks"=>1, "TwoHeads"=>TRUE); 
 $myPicture->drawArrow(303,298,303,239,$arrowSettings); 

 //SIP
 $arrowSettings = array("FillR"=>2.5,"FillG"=>2.5,"FillB"=>2.5,"Ticks"=>1, "TwoHeads"=>TRUE); 
 $myPicture->drawArrow(316,220,393,220,$arrowSettings); 
 /* Write some text */  
 $myPicture->setFontProperties(array("FontName"=>"fonts/verdana.ttf","FontSize"=>7)); 
 $TextSettings = array("BoxRounded"=>TRUE,"R"=>0,"G"=>0,"B"=>0,"Angle"=>0,"FontSize"=>7); 
 $myPicture->drawText(346,218,"SIP",$TextSettings);

 //IAX
 $arrowSettings = array("FillR"=>2.5,"FillG"=>2.5,"FillB"=>2.5,"Ticks"=>1, "TwoHeads"=>TRUE); 
 $myPicture->drawArrow(192,220,297,220,$arrowSettings); 
 /* Write some text */  
 $myPicture->setFontProperties(array("FontName"=>"fonts/verdana.ttf","FontSize"=>7)); 
 $TextSettings = array("BoxRounded"=>TRUE,"R"=>0,"G"=>0,"B"=>0,"Angle"=>0,"FontSize"=>7); 
 $myPicture->drawText(235,218,"IAX",$TextSettings);
 //######################################

 //BTS1
 $Points = Triangle(74,155);
 $myPicture->drawPolygon($Points, $BTS1COL);
 /* Write some text */  
 $myPicture->setFontProperties(array("FontName"=>"fonts/verdana.ttf","FontSize"=>7)); 
 $TextSettings = array("DrawBox"=>TRUE,"BoxRounded"=>TRUE,"R"=>0,"G"=>0,"B"=>0,"Angle"=>0,"FontSize"=>7); 
 $myPicture->drawText(10,169,"nanoBTS0",$TextSettings);
 //##################################

 //BTS2
 $Points = Triangle(74,215);
 $myPicture->drawPolygon($Points, $BTS2COL);
 /* Write some text */  
 $myPicture->setFontProperties(array("FontName"=>"fonts/verdana.ttf","FontSize"=>7)); 
 $TextSettings = array("DrawBox"=>TRUE,"BoxRounded"=>TRUE,"R"=>0,"G"=>0,"B"=>0,"Angle"=>0,"FontSize"=>7); 
 $myPicture->drawText(10,229,"nanoBTS1",$TextSettings);
 //###################################

 //BTS3
 $Points = Triangle(74,275);
 $myPicture->drawPolygon($Points, $BTS3COL);
 /* Write some text */  
 $myPicture->setFontProperties(array("FontName"=>"fonts/verdana.ttf","FontSize"=>7)); 
 $TextSettings = array("DrawBox"=>TRUE,"BoxRounded"=>TRUE,"R"=>0,"G"=>0,"B"=>0,"Angle"=>0,"FontSize"=>7); 
 $myPicture->drawText(10,289,"nanoBTS3",$TextSettings);
 //###################################



 //LsfKs-Asterisk 
 /* Turn on shadow computing */  
 $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>20)); 
 /* Draw a PNG object */ 
 $myPicture->drawFromPNG(295,210,$LSFKSCOL); 
 /* Write some text */  
 $myPicture->setFontProperties(array("FontName"=>"fonts/verdana.ttf","FontSize"=>7)); 
 $TextSettings = array("DrawBox"=>TRUE,"BoxRounded"=>TRUE,"R"=>0,"G"=>0,"B"=>0,"Angle"=>0,"FontSize"=>7); 
 $myPicture->drawText(270,257," LsfKs-Asterisk",$TextSettings);
 //###############################

 
 //Open BSC 
 /* Turn on shadow computing */  
 $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>20)); 
 /* Draw a PNG object */ 
 $myPicture->drawFromPNG(171,210,$GSMINTCOL); 
 /* Write some text */  
 $myPicture->setFontProperties(array("FontName"=>"fonts/verdana.ttf","FontSize"=>7)); 
 $TextSettings = array("DrawBox"=>TRUE,"BoxRounded"=>TRUE,"R"=>0,"G"=>0,"B"=>0,"Angle"=>0,"FontSize"=>7); 
 $myPicture->drawText(155,275," OpenBSC \r\n     LCR   \r\n  Asterisk",$TextSettings);
 //###############################


 //E-plus 
 /* Turn on shadow computing */  
 $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>20)); 
 /* Draw a PNG object */ 
 $myPicture->drawFromPNG(171,50,$GSMEECOL); 
 /* Write some text */  
 $myPicture->setFontProperties(array("FontName"=>"fonts/verdana.ttf","FontSize"=>7)); 
 $TextSettings = array("DrawBox"=>TRUE,"BoxRounded"=>TRUE,"R"=>0,"G"=>0,"B"=>0,"Angle"=>0,"FontSize"=>7); 
 $myPicture->drawText(171,40,"E-Plus",$TextSettings);
 //###############################


 //Vodaphone 
 /* Turn on shadow computing */  
 $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>20)); 
 /* Draw a PNG object */ 
 $myPicture->drawFromPNG(231,50,$GSMEVCOL); 
 /* Write some text */  
 $myPicture->setFontProperties(array("FontName"=>"fonts/verdana.ttf","FontSize"=>7)); 
 $TextSettings = array("DrawBox"=>TRUE,"BoxRounded"=>TRUE,"R"=>0,"G"=>0,"B"=>0,"Angle"=>0,"FontSize"=>7); 
 $myPicture->drawText(218,40,"Vodafone",$TextSettings);
 //###############################


 //T-mobile
 /* Turn on shadow computing */  
 $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>20)); 
 /* Draw a PNG object */ 
 $myPicture->drawFromPNG(336,50,$GSMETCOL); 
 /* Write some text */  
 $myPicture->setFontProperties(array("FontName"=>"fonts/verdana.ttf","FontSize"=>7)); 
 $TextSettings = array("DrawBox"=>TRUE,"BoxRounded"=>TRUE,"R"=>0,"G"=>0,"B"=>0,"Angle"=>0,"FontSize"=>7); 
 $myPicture->drawText(330,40,"T-Mobile",$TextSettings);
 //###############################


 //O2
 /* Turn on shadow computing */  
 $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>20)); 
 /* Draw a PNG object */ 
 $myPicture->drawFromPNG(396,50,$GSMEOCOL); 
 /* Write some text */  
 $myPicture->setFontProperties(array("FontName"=>"fonts/verdana.ttf","FontSize"=>7)); 
 $TextSettings = array("DrawBox"=>TRUE,"BoxRounded"=>TRUE,"R"=>0,"G"=>0,"B"=>0,"Angle"=>0,"FontSize"=>7); 
 $myPicture->drawText(404,40,"02",$TextSettings);
 //###############################


 //GSMBOX
 /* Turn on shadow computing */  
 $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>20)); 
 /* Draw a PNG object */ 
 $myPicture->drawFromPNG(293,140,$GSMEXTCOL); 
 /* Write some text */  
 $myPicture->setFontProperties(array("FontName"=>"fonts/verdana.ttf","FontSize"=>7)); 
 $TextSettings = array("DrawBox"=>TRUE,"BoxRounded"=>TRUE,"R"=>0,"G"=>0,"B"=>0,"Angle"=>0,"FontSize"=>7); 
 $myPicture->drawText(238,157,"GSM-Box",$TextSettings);
 //###############################
 

 //LANDLINE
 /* Turn on shadow computing */  
 $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>20)); 
 /* Draw a PNG object */ 
 $myPicture->drawFromPNG(393,147,$LANDLINECOL); 
 /* Write some text */  
 $myPicture->setFontProperties(array("FontName"=>"fonts/verdana.ttf","FontSize"=>7)); 
 $TextSettings = array("DrawBox"=>TRUE,"BoxRounded"=>TRUE,"R"=>0,"G"=>0,"B"=>0,"Angle"=>0,"FontSize"=>7); 
 $myPicture->drawText(388,137,"Landline",$TextSettings);
 //###############################

 
 //University SIP
 /* Turn on shadow computing */  
 $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>20)); 
 /* Draw a PNG object */ 
 $myPicture->drawFromPNG(283,297,$UNISIPCOL); 
 /* Write some text */  
 $myPicture->setFontProperties(array("FontName"=>"fonts/verdana.ttf","FontSize"=>7)); 
 $TextSettings = array("DrawBox"=>TRUE,"BoxRounded"=>TRUE,"R"=>0,"G"=>0,"B"=>0,"Angle"=>0,"FontSize"=>7); 
 $myPicture->drawText(238,365,"University telephone network",$TextSettings);
 //###############################


 //SIP
 /* Turn on shadow computing */  
 $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>20)); 
 /* Draw a PNG object */ 
 $myPicture->drawFromPNG(393,208,$SIPCOL); 
 /* Write some text */  
 $myPicture->setFontProperties(array("FontName"=>"fonts/verdana.ttf","FontSize"=>7)); 
 $TextSettings = array("DrawBox"=>TRUE,"BoxRounded"=>TRUE,"R"=>0,"G"=>0,"B"=>0,"Angle"=>0,"FontSize"=>7); 
 $myPicture->drawText(399,256,"SIP",$TextSettings);
 //###############################

 //PING RESULTS
 //START ############################################
 $myPicture->setGraphArea(530,280,660,290);

 // Create the surface object 
 $mySurface = new pSurface($myPicture);

 // Set the grid size 
 $mySurface->setGrid(4,0);

 $mySurface->writeXLabels(array("Angle"=>45,"Labels"=>array("SIP","Landline","Uni. Telephone","BTS Cont.1","BTS Cont.2")));
 $mySurface->writeYLabels(array("Labels"=>array("Ping")));

 $Palette = array(1=>array("R"=>0,"G"=>255,"B"=>0, "Alpha"=>40),
                  0=>array("R"=>255,"G"=>0,"B"=>1, "Alpha"=>40),
		  2=>array("R"=>255,"G"=>227,"B"=>85));

 $mySurface->addPoint(0,0,$SIPP); 
 $mySurface->addPoint(1,0,$LANDLINEP); 
 $mySurface->addPoint(2,0,$UNISIPP); 
 $mySurface->addPoint(3,0,$NANOBTS1P); 
 $mySurface->addPoint(4,0,$NANOBTS2P); 

 // Draw the surface chart
 $mySurface->drawSurface(array("Border"=>TRUE,"Surrounding"=>40,"Palette"=>$Palette));


 //A BIT OF STATISTICS
 /* Draw the chart scale */
 $myPicture->setGraphArea(520,50,685,220);
 $AxisBoundaries = array(0=>array("Min"=>0,"Max"=>100));

 $myPicture->drawScale(array("CycleBackground"=>TRUE,"DrawSubTicks"=>TRUE,"GridR"=>0,"GridG"=>0,"GridB"=>0,"GridAlpha"=>10,"Pos"=>SCALE_POS_TOPBOTTOM,"Mode"=>SCALE_MODE_MANUAL,"ManualScale"=>$AxisBoundaries));

 /* Turn on shadow computing */
 $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));

 /* Create the per bar palette */
 $Palette = array("0"=>array("R"=>188,"G"=>224,"B"=>46,"Alpha"=>100),
                  "1"=>array("R"=>224,"G"=>100,"B"=>46,"Alpha"=>100),
                  "2"=>array("R"=>224,"G"=>214,"B"=>46,"Alpha"=>100),
                  "3"=>array("R"=>46,"G"=>151,"B"=>224,"Alpha"=>100),
                  "4"=>array("R"=>224,"G"=>176,"B"=>46,"Alpha"=>100));


/* $Palette = array("1"=>array("R"=>91,"G"=>184,"B"=>202,"Alpha"=>100),
                  "2"=>array("R"=>166,"G"=>218,"B"=>215,"Alpha"=>100),
                  "3"=>array("R"=>223,"G"=>227,"B"=>203,"Alpha"=>100),
                  "0"=>array("R"=>114,"G"=>176,"B"=>180,"Alpha"=>100),
                  "4"=>array("R"=>241,"G"=>233,"B"=>214,"Alpha"=>100));
*/
 /* Draw the chart */
 $myPicture->drawBarChart(array("DisplayPos"=>LABEL_POS_INSIDE,"DisplayValues"=>TRUE,"Rounded"=>TRUE,"Surrounding"=>30,"OverrideColors"=>$Palette));
 //############################################STATISTICS

 //DATE AND TEST NUMBER
 /* Write some text */  
 $myPicture->setFontProperties(array("FontName"=>"fonts/verdana.ttf","FontSize"=>7)); 
 $TextSettings = array("BoxRounded"=>TRUE,"R"=>255,"G"=>255,"B"=>255,"Angle"=>0,"FontSize"=>9); 
 $taskInfo ='Task #: ' . $TASKID . ' ' . date("d.m.Y H:m:s");
 $myPicture->drawText(460,425,$taskInfo,$TextSettings);
 //###########################################################



 /* Render the picture (choose the best way) */
 $myPicture->autoOutput("example.drawFilledCircle.png");
?>