Changeset 64
- Timestamp:
- Jan 1, 2016, 2:05:17 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Global.php
r63 r64 1 1 <?php 2 2 3 session_start();4 $FileName = dirname(__FILE__).'/config.php';5 if(file_exists($FileName)) include_once($FileName);6 else {7 die('Configuration file "'.$FileName.'" not found.');8 }9 3 include_once('Version.php'); 10 4 include_once('Types.php'); … … 12 6 include_once('Packages/Common/Common.php'); 13 7 include_once('Measure.php'); 14 15 $PrefixMultiplier = new PrefixMultiplier(); 16 $ErrorHandler = new ErrorHandler(); 17 $ErrorHandler->ShowError = $Config['Web']['ShowError']; 18 $ErrorHandler->Start(); 19 $Database = new Database(); 20 $Database->Connect($Config['Database']['Host'], $Config['Database']['User'], 21 $Config['Database']['Password'], $Config['Database']['Database']); 22 $Database->Prefix = $Config['Database']['Prefix']; 23 $Database->charset($Config['Database']['Charset']); 24 $Database->ShowSQLError = $Config['Web']['ShowSQLError']; 25 $Database->ShowSQLQuery = $Config['Web']['ShowSQLQuery']; 26 27 // SQL injection hack protection 28 foreach($_POST as $Index => $Item) $_POST[$Index] = addslashes($Item); 29 foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($Item); 8 include_once('Application.php'); 30 9 31 10 function HumanDate($Time) -
trunk/Graph.php
r63 r64 3 3 include('Global.php'); 4 4 5 if(array_key_exists('Debug', $_GET)) $Debug = $_GET['Debug']; 6 else $Debug = 0; 7 8 if(!array_key_exists('From',$_GET)) die('Musíte zadat čas počátku'); 9 $StartTime = addslashes($_GET['From']); 10 if(!array_key_exists('To',$_GET)) die('Musíte zadat čas konce'); 11 $EndTime = addslashes($_GET['To']); 12 if($EndTime < $StartTime) $EndTime = $StartTime + 60; 13 $TimeDifference = $EndTime - $StartTime; 14 if(!array_key_exists('Measure', $_GET)) die('Musíte zadat měřenou veličinu'); 15 $MeasureId = addslashes($_GET['Measure']); 16 if(!array_key_exists('Width', $_GET)) $Width = $DefaultWidth; 17 else $Width = addslashes($_GET['Width']); 18 if(!array_key_exists('Height', $_GET)) $Height = $DefaultHeight; 19 else $Height = addslashes($_GET['Height']); 20 if(!array_key_exists('Differential', $_GET)) $Differential = $Config['DefaultVariables']['Differential']; 21 else $Differential = addslashes($_GET['Differential']); 22 $VerticalLinesCount = round($Height / ($FontSize + 4)); 23 24 $StopWatchStart = GetMicrotime(); 25 26 $Measure = new Measure($Database); 27 $Measure->Load($MeasureId); 28 $Measure->DivisionCount = $Config['DivisionCount']; 29 $Measure->LevelReducing = $Config['LevelReducing']; 30 $Measure->MaxLevel = $Config['MaxLevel']; 31 $Measure->ReferenceTime = $Config['ReferenceTime']; 32 $Measure->Differential = $Differential; 33 34 $Level = floor(log(($EndTime - $StartTime) / $Measure->DivisionCount / 60) / log($Measure->LevelReducing)) - 1; 35 if($Level < 0) $Level = 0; 36 if($Level > $Measure->MaxLevel) $Level = $Measure->MaxLevel; 37 38 $Points = $Measure->GetValues($StartTime, $EndTime, $Level); 39 40 if($Debug) echo('Points count: '.count($Points).'<br>'); 41 //if($Debug) foreach($Points as $Index => $Item) 42 // echo($Index.': '.$Item['min'].'<br>'); 43 44 // Calculate total max, avg, min value 45 $MaxValue = -1000000000000000000; 46 $AvgValue = 0; 47 $MinValue = 1000000000000000000; 48 foreach($Points as $Index => $Item) 5 class MeasureGraph 49 6 { 50 //$Points[$Index]['min'] = $Points[$Index]['min'] / $Measure['Divider']; 51 //$Points[$Index]['avg'] = $Points[$Index]['avg'] / $Measure['Divider']; 52 //$Points[$Index]['max'] = $Points[$Index]['max'] / $Measure['Divider']; 53 if($Points[$Index]['avg'] > $MaxValue) $MaxValue = $Points[$Index]['avg']; 54 if($Points[$Index]['avg'] < $MinValue) $MinValue = $Points[$Index]['avg']; 55 if($Points[$Index]['max'] > $MaxValue) $MaxValue = $Points[$Index]['max']; 56 if($Points[$Index]['min'] < $MinValue) $MinValue = $Points[$Index]['min']; 57 $AvgValue = $AvgValue + $Points[$Index]['avg']; 58 } 59 //$MinValue = round($MinValue * $Measure['Divider']) / $Measure['Divider']; 60 //$MaxValue = round($MaxValue * $Measure['Divider']) / $Measure['Divider']; 61 $AvgValue = $AvgValue / count($Points); //round(* $Measure['Divider']) / $Measure['Divider']; 62 63 // Generate polygon and recalculate y values to fit graph height 64 $PointsMin = array(0, $Height - 1); 65 $PointsAvg = array(0, $Height - 1); 66 $PointsMax = array(0, $Height - 1); 67 if(($MaxValue - $MinValue) == 0) $MaxValue = $MinValue + 1; 68 { 69 foreach($Points as $Index => $Item) 7 var $Database; 8 var $FontSize; 9 var $FontFileNameName; 10 var $ValueToImageHeigthCoefficient; 11 var $DefaultWidth; 12 var $DefaultHeight; 13 14 function __construct(Database $Database) 70 15 { 71 $PointsMin[] = $Index * $Width / $Measure->DivisionCount; 72 $PointsMin[] = $Height - 1 - ($Points[$Index]['min'] - $MinValue) / ($MaxValue - $MinValue) * $Height * $K; 73 $PointsAvg[] = $Index * $Width / $Measure->DivisionCount; 74 $PointsAvg[] = $Height - 1 - ($Points[$Index]['avg'] - $MinValue) / ($MaxValue - $MinValue) * $Height * $K; 75 $PointsMax[] = $Index * $Width / $Measure->DivisionCount; 76 $PointsMax[] = $Height - 1 - ($Points[$Index]['max'] - $MinValue) / ($MaxValue - $MinValue) * $Height * $K; 77 //echo($Index.' - '.$Item.' '.$Points[$Index].'<br>'); 16 $this->Database = &$Database; 17 $this->DefaultWidth = 800; 18 $this->DefaultHeight = 200; 19 $this->FontSize = 10; 20 $this->FontFileName = './arial.ttf'; 21 $this->ValueToImageHeigthCoefficient = 0.9; 22 } 23 24 function Render() 25 { 26 global $Config; 27 28 if(!array_key_exists('From',$_GET)) die('Musíte zadat čas počátku'); 29 $StartTime = addslashes($_GET['From']); 30 if(!array_key_exists('To',$_GET)) die('Musíte zadat čas konce'); 31 $EndTime = addslashes($_GET['To']); 32 if($EndTime < $StartTime) $EndTime = $StartTime + 60; 33 $TimeDifference = $EndTime - $StartTime; 34 if(!array_key_exists('Measure', $_GET)) die('Musíte zadat měřenou veličinu'); 35 $MeasureId = addslashes($_GET['Measure']); 36 if(!array_key_exists('Width', $_GET)) $Width = $this->DefaultWidth; 37 else $Width = addslashes($_GET['Width']); 38 if(!array_key_exists('Height', $_GET)) $Height = $this->DefaultHeight; 39 else $Height = addslashes($_GET['Height']); 40 if(!array_key_exists('Differential', $_GET)) $Differential = $Config['DefaultVariables']['Differential']; 41 else $Differential = addslashes($_GET['Differential']); 42 $VerticalLinesCount = round($Height / ($this->FontSize + 4)); 43 44 $PrefixMultiplier = new PrefixMultiplier(); 45 $StopWatchStart = GetMicrotime(); 46 47 $Measure = new Measure($this->Database); 48 $Measure->Load($MeasureId); 49 $Measure->DivisionCount = $Config['DivisionCount']; 50 $Measure->LevelReducing = $Config['LevelReducing']; 51 $Measure->MaxLevel = $Config['MaxLevel']; 52 $Measure->ReferenceTime = $Config['ReferenceTime']; 53 $Measure->Differential = $Differential; 54 55 $Level = floor(log(($EndTime - $StartTime) / $Measure->DivisionCount / 60) / log($Measure->LevelReducing)) - 1; 56 if($Level < 0) $Level = 0; 57 if($Level > $Measure->MaxLevel) $Level = $Measure->MaxLevel; 58 59 $Points = $Measure->GetValues($StartTime, $EndTime, $Level); 60 61 // Calculate total max, avg, min value 62 $MaxValue = -1000000000000000000; 63 $AvgValue = 0; 64 $MinValue = 1000000000000000000; 65 foreach($Points as $Index => $Item) 66 { 67 //$Points[$Index]['min'] = $Points[$Index]['min'] / $Measure['Divider']; 68 //$Points[$Index]['avg'] = $Points[$Index]['avg'] / $Measure['Divider']; 69 //$Points[$Index]['max'] = $Points[$Index]['max'] / $Measure['Divider']; 70 if($Points[$Index]['avg'] > $MaxValue) $MaxValue = $Points[$Index]['avg']; 71 if($Points[$Index]['avg'] < $MinValue) $MinValue = $Points[$Index]['avg']; 72 if($Points[$Index]['max'] > $MaxValue) $MaxValue = $Points[$Index]['max']; 73 if($Points[$Index]['min'] < $MinValue) $MinValue = $Points[$Index]['min']; 74 $AvgValue = $AvgValue + $Points[$Index]['avg']; 75 } 76 //$MinValue = round($MinValue * $Measure['Divider']) / $Measure['Divider']; 77 //$MaxValue = round($MaxValue * $Measure['Divider']) / $Measure['Divider']; 78 $AvgValue = $AvgValue / count($Points); //round(* $Measure['Divider']) / $Measure['Divider']; 79 80 // Generate polygon and recalculate y values to fit graph height 81 $PointsMin = array(0, $Height - 1); 82 $PointsAvg = array(0, $Height - 1); 83 $PointsMax = array(0, $Height - 1); 84 if(($MaxValue - $MinValue) == 0) $MaxValue = $MinValue + 1; 85 { 86 foreach($Points as $Index => $Item) 87 { 88 $PointsMin[] = $Index * $Width / $Measure->DivisionCount; 89 $PointsMin[] = $Height - 1 - ($Points[$Index]['min'] - $MinValue) / 90 ($MaxValue - $MinValue) * $Height * $this->ValueToImageHeigthCoefficient; 91 $PointsAvg[] = $Index * $Width / $Measure->DivisionCount; 92 $PointsAvg[] = $Height - 1 - ($Points[$Index]['avg'] - $MinValue) / 93 ($MaxValue - $MinValue) * $Height * $this->ValueToImageHeigthCoefficient; 94 $PointsMax[] = $Index * $Width / $Measure->DivisionCount; 95 $PointsMax[] = $Height - 1 - ($Points[$Index]['max'] - $MinValue) / 96 ($MaxValue - $MinValue) * $Height * $this->ValueToImageHeigthCoefficient; 97 } 98 } 99 $PointsMin[] = $Width - 1; 100 $PointsMin[] = $Height - 1; 101 $PointsAvg[] = $Width - 1; 102 $PointsAvg[] = $Height - 1; 103 $PointsMax[] = $Width - 1; 104 $PointsMax[] = $Height - 1; 105 $PointsMin[] = $Width - 1; 106 $PointsMin[] = $Height - 1; 107 $PointsAvg[] = $Width - 1; 108 $PointsAvg[] = $Height - 1; 109 $PointsMax[] = $Width - 1; 110 $PointsMax[] = $Height - 1; 111 112 //array_unshift($Points, $Height - 1); 113 //array_unshift($Points, 0); 114 //$Points[] = $Width - 1; 115 //$Points[] = $Height - 1; 116 117 // Generate image 118 $Image = @imagecreate($Width, $Height); 119 $BackgroundColor = imagecolorallocate($Image, 255, 255, 255); 120 $Black = imagecolorallocate($Image, 0, 0, 0); 121 $White = imagecolorallocate($Image, 255, 255, 255); 122 $Gray = imagecolorallocate($Image, 200, 200, 200); 123 $DarkGray = imagecolorallocate($Image, 100, 100, 100); 124 $LightBlue = imagecolorallocate($Image, 150, 150, 255); 125 $Blue = imagecolorallocate($Image, 0, 0, 255); 126 $LightRed = imagecolorallocate($Image, 255, 150, 150); 127 $Red = imagecolorallocate($Image, 255, 0, 0); 128 $Green = imagecolorallocate($Image, 0, 200, 0); 129 $LightGreen = imagecolorallocate($Image, 150, 255, 150); 130 131 imagefilledpolygon($Image, $PointsMax, count($PointsMax) / 2, $LightRed); 132 imagefilledpolygon($Image, $PointsAvg, count($PointsAvg) / 2, $LightGreen); 133 imagefilledpolygon($Image, $PointsMin, count($PointsMin) / 2, $LightBlue); 134 135 $TimeMarks = array(1, 60, 60*60, 60*60*24, 60*60*24*7, 60*60*24*30, 136 60*60*24*365, 60*60*24*365*10); 137 138 $TimeRange = $EndTime - $StartTime; 139 $TimeMarksIndex = 0; 140 while(($TimeRange / $TimeMarks[$TimeMarksIndex]) > 1) $TimeMarksIndex += 1; 141 if($TimeMarksIndex < 2) $TimeMarksIndex = 2; 142 $MajorTimeMarks = $TimeMarks[$TimeMarksIndex - 1]; 143 $MinorTimeMarks = $TimeMarks[$TimeMarksIndex - 2]; 144 145 $TimeShift = $Measure->AlignTime($StartTime, $MajorTimeMarks) - $StartTime; 146 //imagestring($Image, 10, 40, 50, $TimeShift, $Black); 147 148 // Zobraz měřítko Y 149 $VerticalLinesDistance = $Height / $VerticalLinesCount; 150 for($I = 1; $I <= $VerticalLinesCount; $I++) 151 { 152 $Y = $Height - 1 - ($VerticalLinesDistance * $I); 153 for($X = 1; $X < $Width; $X = $X + 3) imagesetpixel($Image, $X, $Y, $Gray); 154 //imageline($Image, 30, $Y, $Width-1, $Y, IMG_COLOR_STYLED); 155 } 156 157 $TimeShift = $Measure->AlignTime($StartTime, $MinorTimeMarks) - $StartTime; 158 159 // Zobraz měřítko X 160 $LastTextEnd = 0; 161 for($Time = $StartTime; $Time < $EndTime; $Time += $MajorTimeMarks) 162 { 163 $X = round(($Time - $StartTime + $TimeShift) / $TimeRange * $Width) % $Width; 164 //imageline($Image, 30, $Y, $Width-1, $Y, IMG_COLOR_STYLED); 165 if(($MajorTimeMarks > 60*60*24)) $Text = date('j.n.Y', $Time + $TimeShift); 166 else $Text = date('j.n.Y G:i', $Time + $TimeShift); 167 $BoundBox = imagettfbbox($this->FontSize, 0, $this->FontFileName, $Text); 168 if($LastTextEnd < ($X - ($BoundBox[2] - $BoundBox[0] + 20) / 2)) 169 { 170 for($Y = 0; $Y < $Height; $Y = $Y + 1) imagesetpixel($Image, $X, $Y, $Gray); 171 imagettftext($Image, $this->FontSize, 0, $X - ($BoundBox[2] - $BoundBox[0]) / 2, $Height - 2, $Black, $this->FontFileName, $Text); 172 $LastTextEnd = $X + ($BoundBox[2] - $BoundBox[0]) / 2; 173 } 174 else for($Y=0; $Y < $Height; $Y = $Y + 3) imagesetpixel($Image, $X, $Y, $Gray); 175 } 176 177 // Popisky osy Y 178 for($I = 1; $I <= $VerticalLinesCount; $I++) 179 { 180 $Y = $Height - 1 - ($VerticalLinesDistance * $I); 181 //$Y = $Height - 1 - ($VerticalLinesDistance * $I / ($MaxValue - $MinValue) * $this->ValueToImageHeigthCoefficient * $Height); 182 $Text = $PrefixMultiplier->Add(round(($I * $VerticalLinesDistance / $Height / 183 $this->ValueToImageHeigthCoefficient * ($MaxValue - $MinValue) + $MinValue)), 184 $Measure->Data['Unit'], 3); 185 $BoundBox = imagettfbbox($this->FontSize, 0, $this->FontFileName, $Text); 186 if(($Y - ($BoundBox[5] - $BoundBox[1]) / 2) > 10) 187 imagettftext($Image, $this->FontSize, 0, 2, $Y - ($BoundBox[5] - $BoundBox[1]) / 2, $Black, $this->FontFileName, $Text); 188 } 189 $GenerationTime = floor((GetMicrotime() - $StopWatchStart) * 1000 ) / 1000; 190 191 $Left = $Width - 10; 192 $Text = " Max. ".$PrefixMultiplier->Add($MaxValue, $Measure->Data['Unit']); 193 $BoundingBox = imagettfbbox($this->FontSize, 0, $this->FontFileName, $Text); 194 $Left -= ($BoundingBox[2] - $BoundingBox[0]); 195 imagettftext($Image, $this->FontSize, 0, $Left, 14, $Red, $this->FontFileName, $Text); 196 197 $Text = " Avg. ".$PrefixMultiplier->Add($AvgValue, $Measure->Data['Unit'], 4); 198 $BoundingBox = imagettfbbox($this->FontSize, 0, $this->FontFileName, $Text); 199 $Left -= ($BoundingBox[2] - $BoundingBox[0]); 200 imagettftext($Image, $this->FontSize, 0, $Left, 14, $Green, $this->FontFileName, $Text); 201 202 $Text = " Min. ".$PrefixMultiplier->Add($MinValue, $Measure->Data['Unit']); 203 $BoundingBox = imagettfbbox($this->FontSize, 0, $this->FontFileName, $Text); 204 $Left -= ($BoundingBox[2] - $BoundingBox[0]); 205 imagettftext($Image, $this->FontSize, 0, $Left, 14, $Blue, $this->FontFileName, $Text); 206 //imagestring($Image, 2, 70, 20, 'Vygenerováno za '.$GenerationTime.' sekund', $Black); 207 //imagestring($Image, 2, 50, 30, 'Level: '.$Level, $Black); 208 209 imagettftext($Image, $this->FontSize, 0, 70, 14, $Black, $this->FontFileName, $Measure->Data['Description']); 210 imagerectangle($Image, 0, 0, $Width - 1, $Height - 1, $Black); // Frame border 211 Header("Content-type: image/png"); 212 Header("Cache-Control: no-cache"); // Dynamic graph - no cache 213 imagepng($Image); 214 imagedestroy($Image); 78 215 } 79 216 } 80 $PointsMin[] = $Width - 1; 81 $PointsMin[] = $Height - 1; 82 $PointsAvg[] = $Width - 1; 83 $PointsAvg[] = $Height - 1; 84 $PointsMax[] = $Width - 1; 85 $PointsMax[] = $Height - 1; 86 $PointsMin[] = $Width - 1; 87 $PointsMin[] = $Height - 1; 88 $PointsAvg[] = $Width - 1; 89 $PointsAvg[] = $Height - 1; 90 $PointsMax[] = $Width - 1; 91 $PointsMax[] = $Height - 1; 92 93 94 //array_unshift($Points, $Height - 1); 95 //array_unshift($Points, 0); 96 //$Points[] = $Width - 1; 97 //$Points[] = $Height - 1; 98 99 // Generate image 100 if(!$Debug) 101 { 102 Header("Content-type: image/png"); 103 Header("Cache-Control: no-cache"); // Dynamic graph - no cache 104 $Image = @imagecreate($Width, $Height); 105 $BackgroundColor = imagecolorallocate($Image, 255, 255, 255); 106 $Black = imagecolorallocate($Image, 0, 0, 0); 107 $White = imagecolorallocate($Image, 255, 255, 255); 108 $Gray = imagecolorallocate($Image, 200, 200, 200); 109 $DarkGray = imagecolorallocate($Image, 100, 100, 100); 110 $LightBlue = imagecolorallocate($Image, 150, 150, 255); 111 $Blue = imagecolorallocate($Image, 0, 0, 255); 112 $LightRed = imagecolorallocate($Image, 255, 150, 150); 113 $Red = imagecolorallocate($Image, 255, 0, 0); 114 $Green = imagecolorallocate($Image, 0, 200, 0); 115 $LightGreen = imagecolorallocate($Image, 150, 255, 150); 116 117 imagefilledpolygon($Image, $PointsMax, count($PointsMax) / 2, $LightRed); 118 imagefilledpolygon($Image, $PointsAvg, count($PointsAvg) / 2, $LightGreen); 119 imagefilledpolygon($Image, $PointsMin, count($PointsMin) / 2, $LightBlue); 120 121 $TimeMarks = array(1, 60, 60*60, 60*60*24, 60*60*24*7, 60*60*24*30, 60*60*24*365, 60*60*24*365*10); 122 123 $TimeRange = $EndTime - $StartTime; 124 $TimeMarksIndex = 0; 125 while(($TimeRange / $TimeMarks[$TimeMarksIndex]) > 1) $TimeMarksIndex += 1; 126 if($TimeMarksIndex < 2) $TimeMarksIndex = 2; 127 $MajorTimeMarks = $TimeMarks[$TimeMarksIndex - 1]; 128 $MinorTimeMarks = $TimeMarks[$TimeMarksIndex - 2]; 129 130 $TimeShift = $Measure->AlignTime($StartTime, $MajorTimeMarks) - $StartTime; 131 //imagestring($Image, 10, 40, 50, $TimeShift, $Black); 132 133 // Zobraz měřítko Y 134 $VerticalLinesDistance = $Height / $VerticalLinesCount; 135 for($I=1; $I<=$VerticalLinesCount; $I++) 136 { 137 $Y = $Height - 1 - ($VerticalLinesDistance * $I); 138 for($X=1; $X < $Width; $X = $X + 3) imagesetpixel($Image, $X, $Y, $Gray); 139 //imageline($Image, 30, $Y, $Width-1, $Y, IMG_COLOR_STYLED); 140 } 141 142 $TimeShift = $Measure->AlignTime($StartTime, $MinorTimeMarks) - $StartTime; 143 144 // Zobraz měřítko X 145 $LastTextEnd = 0; 146 for($Time = $StartTime; $Time < $EndTime; $Time += $MajorTimeMarks) 147 { 148 $X = round(($Time - $StartTime + $TimeShift) / $TimeRange * $Width) % $Width; 149 //imageline($Image, 30, $Y, $Width-1, $Y, IMG_COLOR_STYLED); 150 if(($MajorTimeMarks > 60*60*24)) $Text = date('j.n.Y', $Time + $TimeShift); 151 else $Text = date('j.n.Y G:i', $Time + $TimeShift); 152 $BoundBox = imagettfbbox($FontSize, 0, $FontFile, $Text); 153 if($LastTextEnd < ($X - ($BoundBox[2] - $BoundBox[0] + 20) / 2)) 154 { 155 for($Y=0; $Y < $Height; $Y = $Y + 1) imagesetpixel($Image, $X, $Y, $Gray); 156 imagettftext($Image, $FontSize, 0, $X - ($BoundBox[2] - $BoundBox[0]) / 2, $Height - 2, $Black, $FontFile, $Text); 157 $LastTextEnd = $X + ($BoundBox[2] - $BoundBox[0]) / 2; 158 } 159 else for($Y=0; $Y < $Height; $Y = $Y + 3) imagesetpixel($Image, $X, $Y, $Gray); 160 } 161 162 // Popisky osy Y 163 for($I = 1; $I <= $VerticalLinesCount; $I++) 164 { 165 $Y = $Height - 1 - ($VerticalLinesDistance * $I); 166 //$Y = $Height - 1 - ($VerticalLinesDistance * $I / ($MaxValue - $MinValue) * $K * $Height); 167 $Text = $PrefixMultiplier->Add(round(($I * $VerticalLinesDistance / $Height / 168 $K * ($MaxValue - $MinValue) + $MinValue)), $Measure->Data['Unit'], 3); 169 $BoundBox = imagettfbbox($FontSize, 0, $FontFile, $Text); 170 if(($Y - ($BoundBox[5] - $BoundBox[1]) / 2) > 10) 171 imagettftext($Image, $FontSize, 0, 2, $Y - ($BoundBox[5] - $BoundBox[1]) / 2, $Black, $FontFile, $Text); 172 } 173 $GenerationTime = floor((GetMicrotime() - $StopWatchStart) * 1000 ) / 1000; 174 175 $Left = $Width - 10; 176 $Text = " Max. ".$PrefixMultiplier->Add($MaxValue, $Measure->Data['Unit']); 177 $BoundingBox = imagettfbbox($FontSize, 0, $FontFile, $Text); 178 $Left -= ($BoundingBox[2] - $BoundingBox[0]); 179 imagettftext($Image, $FontSize, 0, $Left, 14, $Red, $FontFile, $Text); 180 181 $Text = " Avg. ".$PrefixMultiplier->Add($AvgValue, $Measure->Data['Unit'], 4); 182 $BoundingBox = imagettfbbox($FontSize, 0, $FontFile, $Text); 183 $Left -= ($BoundingBox[2] - $BoundingBox[0]); 184 imagettftext($Image, $FontSize, 0, $Left, 14, $Green, $FontFile, $Text); 185 186 $Text = " Min. ".$PrefixMultiplier->Add($MinValue, $Measure->Data['Unit']); 187 $BoundingBox = imagettfbbox($FontSize, 0, $FontFile, $Text); 188 $Left -= ($BoundingBox[2] - $BoundingBox[0]); 189 imagettftext($Image, $FontSize, 0, $Left, 14, $Blue, $FontFile, $Text); 190 //imagestring($Image, 2, 70, 20, 'Vygenerováno za '.$GenerationTime.' sekund', $Black); 191 //imagestring($Image, 2, 50, 30, 'Level: '.$Level, $Black); 192 193 imagettftext($Image, $FontSize, 0, 70, 14, $Black, $FontFile, $Measure->Data['Description']); 194 imagerectangle($Image, 0, 0, $Width - 1, $Height - 1, $Black); // Frame border 195 imagepng($Image); 196 imagedestroy($Image); 197 } 217 218 $Application = new Application(); 219 $Application->Start(); 220 $Graph = new MeasureGraph($Database); 221 $Graph->Render(); -
trunk/Measure.php
r63 r64 14 14 var $DivisionCount; 15 15 16 function __construct( $Database)16 function __construct(Database $Database) 17 17 { 18 18 $this->Id = 0; -
trunk/Version.php
r63 r64 1 1 <?php 2 2 3 $Revision = 6 3;3 $Revision = 64; 4 4 $ReleaseTime = strtotime('2016-01-01'); -
trunk/add.php
r63 r64 2 2 3 3 include('Global.php'); 4 5 $Application = new Application(); 6 $Application->Start(); 4 7 5 8 if(array_key_exists('MeasureId', $_GET) and array_key_exists('Value', $_GET)) -
trunk/admin.php
r63 r64 1 1 <?php 2 2 include('Global.php'); 3 4 $Application = new Application(); 5 $Application->Start(); 3 6 4 7 if(array_key_exists('Operation', $_GET)) $Operation = $_GET['Operation']; else $Operation = ''; … … 6 9 { 7 10 case 'Add': 8 $Output = ShowAdd(); 11 $Output = ShowAdd(); 9 12 break; 10 13 case 'Delete': 11 $Output = ShowDelete(); 14 $Output = ShowDelete(); 12 15 break; 13 16 case 'Edit': 14 $Output = ShowEdit(); 17 $Output = ShowEdit(); 15 18 break; 16 19 case 'RebuildCache': 17 $Output = ShowRebuildCache(); 20 $Output = ShowRebuildCache(); 18 21 break; 19 22 default: 20 $Output = ShowNone(); 23 $Output = ShowNone(); 21 24 } 22 25 ShowPage($Output); … … 36 39 } 37 40 $Output = '<h3>Seznam měření</h3>'.Table($Table).MakeLink('?Operation=Add', 'Přidat'); 38 return($Output); 41 return($Output); 39 42 } 40 43 … … 62 65 $Measure = $DbResult->fetch_array(); 63 66 64 RebuildMeasureCache($Measure); 65 echo('Dokončeno<br>'); 67 RebuildMeasureCache($Measure); 68 echo('Dokončeno<br>'); 66 69 } -
trunk/index.php
r63 r64 2 2 include('Global.php'); 3 3 4 $Debug = 0; 5 6 function EditTime($Time) 4 class MainView 7 5 { 8 global $Months; 9 10 $Output = '<form style="display: inline;" action="?Operation=SetTime&Time='.$Time.'" method="post">'; 11 $TimeParts = getdate($_SESSION[$Time]); 12 13 // Day selection 14 $Output .= '<select name="Day">'; 15 for($I = 1; $I < 32; $I++) 16 { 17 if($I == $TimeParts['mday']) $Selected = ' selected="1"'; else $Selected = ''; 18 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 19 } 20 $Output .= '</select>. '; 21 22 // Month selection 23 $Output .= '<select name="Month">'; 24 foreach($Months as $Index => $Month) 25 { 26 if($Index == $TimeParts['mon']) $Selected = ' selected="1"'; else $Selected = ''; 27 if($Index > 0) $Output .= '<option value="'.$Index.'"'.$Selected.'>'.$Month.'</option>'; 28 } 29 $Output .= '</select>. '; 30 31 // Year selection 32 $Output .= '<select name="Year">'; 33 for($I = 2000; $I <= date("Y"); $I++) 34 { 35 if($I == $TimeParts['year']) $Selected = ' selected="1"'; else $Selected = ''; 36 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 37 } 38 $Output .= '</select> '; 39 40 // Hour selection 41 $Output .= '<select name="Hour">'; 42 for($I = 0; $I < 24; $I++) 43 { 44 if($I == $TimeParts['hours']) $Selected = ' selected="1"'; else $Selected = ''; 45 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 46 } 47 $Output .= '</select> : '; 48 49 // Minute selection 50 $Output .= '<select name="Minute">'; 51 for($I = 0; $I < 60; $I++) 52 { 53 if($I == $TimeParts['minutes']) $Selected = ' selected="1"'; else $Selected = ''; 54 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 55 } 56 $Output .= '</select> '; 57 58 $Output .= '<input type="submit" value="Nastavit">'; 59 $Output .= '</form>'; 60 $Output .= ' <form style="display: inline;" action="?Operation=SetTimeNow&Time='.$Time.'" method="post">'; 61 $Output .= '<input type="submit" value="Aktuální čas">'; 62 $Output .= '</form>'; 63 64 return($Output); 6 var $Months; 7 var $GrafTimeRanges; 8 9 function __construct($Database) 10 { 11 $this->Database = &$Database; 12 $this->Months = array('', 'Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 13 'Říjen', 'Listopad', 'Prosinec'); 14 15 $this->GrafTimeRanges = array( 16 'hour' => array( 17 'caption' => 'Hodina', 18 'period' => 3600, 19 ), 20 'day' => array( 21 'caption' => 'Den', 22 'period' => 3600 * 24, 23 ), 24 'week' => array( 25 'caption' => 'Týden', 26 'period' => 3600 * 24 * 7, 27 ), 28 'month' => array( 29 'caption' => 'Měsíc', 30 'period' => 3600 * 24 * 30, 31 ), 32 'year' => array( 33 'caption' => 'Rok', 34 'period' => 3600 * 24 * 365, 35 ), 36 'years' => array( 37 'caption' => 'Desetiletí', 38 'period' => 3600 * 24 * 365 * 10, 39 ), 40 ); 41 } 42 43 function EditTime($Time) 44 { 45 $Output = '<form style="display: inline;" action="?Operation=SetTime&Time='.$Time.'" method="post">'; 46 $TimeParts = getdate($_SESSION[$Time]); 47 48 // Day selection 49 $Output .= '<select name="Day">'; 50 for($I = 1; $I < 32; $I++) 51 { 52 if($I == $TimeParts['mday']) $Selected = ' selected="1"'; else $Selected = ''; 53 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 54 } 55 $Output .= '</select>. '; 56 57 // Month selection 58 $Output .= '<select name="Month">'; 59 foreach($this->Months as $Index => $Month) 60 { 61 if($Index == $TimeParts['mon']) $Selected = ' selected="1"'; else $Selected = ''; 62 if($Index > 0) $Output .= '<option value="'.$Index.'"'.$Selected.'>'.$Month.'</option>'; 63 } 64 $Output .= '</select>. '; 65 66 // Year selection 67 $Output .= '<select name="Year">'; 68 for($I = 2000; $I <= date("Y"); $I++) 69 { 70 if($I == $TimeParts['year']) $Selected = ' selected="1"'; else $Selected = ''; 71 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 72 } 73 $Output .= '</select> '; 74 75 // Hour selection 76 $Output .= '<select name="Hour">'; 77 for($I = 0; $I < 24; $I++) 78 { 79 if($I == $TimeParts['hours']) $Selected = ' selected="1"'; else $Selected = ''; 80 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 81 } 82 $Output .= '</select> : '; 83 84 // Minute selection 85 $Output .= '<select name="Minute">'; 86 for($I = 0; $I < 60; $I++) 87 { 88 if($I == $TimeParts['minutes']) $Selected = ' selected="1"'; else $Selected = ''; 89 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 90 } 91 $Output .= '</select> '; 92 93 $Output .= '<input type="submit" value="Nastavit">'; 94 $Output .= '</form>'; 95 $Output .= ' <form style="display: inline;" action="?Operation=SetTimeNow&Time='.$Time.'" method="post">'; 96 $Output .= '<input type="submit" value="Aktuální čas">'; 97 $Output .= '</form>'; 98 99 return($Output); 100 } 101 102 /* Produce table with available measures */ 103 function ShowMeasureTable() 104 { 105 $PrefixMultiplier = new PrefixMultiplier(); 106 $Output = '<table border="1" cellspacing="0" cellpadding="2" style="font-size: small; margin: 0px auto;">'; 107 $Output .= '<tr><th>Měřená veličina</th><th>Poslední hodnota</th><th>Čas posledního měření</th><th>Interpolace</th><th>Poznámky</th>'; 108 if(array_key_exists('Debug', $_GET)) $Output .= '<th>Počet položek</th><th>Čas vykonání</th>'; 109 $Output .= '</tr>'; 110 $Result = $this->Database->select('measure', '*', '(Enabled=1) AND ((PermissionView="all") OR (PermissionView="'.gethostbyaddr($_SERVER['REMOTE_ADDR']).'")) ORDER BY Description'); 111 while($Measure = $Result->fetch_array()) 112 { 113 $StopWatchStart = GetMicrotime(); 114 if(array_key_exists('Debug', $_GET)) 115 { 116 $DbResult = $this->Database->select($Measure['DataTable'], 'COUNT(*)', 'measure='.$Measure['Id']); 117 $RowCount = $DbResult->fetch_array(); 118 $RowCount = $RowCount[0]; 119 } 120 $Result2 = $this->Database->select($Measure['DataTable'], 'time, avg', '(measure='.$Measure['Id'].') AND (level=0) ORDER BY time DESC LIMIT 1'); 121 if($Result2->num_rows > 0) 122 { 123 $Row = $Result2->fetch_array(); 124 $LastMeasureTime = date('j.n.Y G:i:s', MysqlDateTimeToTime($Row['time'])); 125 $LastMeasureValue = $PrefixMultiplier->Add($Row['avg'], $Measure['Unit']); 126 } else { 127 $LastMeasureTime = ' '; 128 $LastMeasureValue = ' '; 129 } 130 if($Measure['Continuity'] == 1) $Interpolate = 'Ano'; else $Interpolate = 'Ne'; 131 if($Measure['Info'] == '') $Measure['Info'] = ' '; 132 $GenerationTime = floor((GetMicrotime() - $StopWatchStart) * 1000 ) / 1000; 133 $Output .= '<tr><td style="text-align: left"><a href="?Measure='.$Measure['Id'].'&Differential=0">'.$Measure['Description'].'</a></td><td align="center">'.$LastMeasureValue.'</td><td align="center">'.$LastMeasureTime.'</td><td align="center">'.$Interpolate.'</td><td>'.$Measure['Info'].'</td>'; 134 if(array_key_exists('Debug', $_GET)) $Output .= '<td>'.$RowCount.'</td><td>'.$GenerationTime.'</td>'; 135 $Output .= '</tr>'; 136 } 137 $Output .= '</table>'; 138 return($Output); 139 } 140 141 function ShowGraph() 142 { 143 $Output = '<strong>Graf:</strong><br>'; 144 $Output .= '<img alt="Graf" src="Graph.php?Measure='.$_SESSION['Measure'].'&From='. 145 $_SESSION['TimeStart'].'&To='.$_SESSION['TimeEnd']. 146 '&Width=750&Height=200&Differential='. 147 $_SESSION['Differential'].'" width="750" height="200"><br>'; 148 $Output .= '<a href="?Measure='.$_SESSION['Measure'].'&TimeStart='. 149 $_SESSION['TimeStart'].'&TimeEnd='.$_SESSION['TimeEnd']. 150 '&TimeSpecify=1&Differential='.$_SESSION['Differential']. 151 '">Odkaz na vybraný graf</a><br/>'; 152 return($Output); 153 } 154 155 function ShowTimeRange() 156 { 157 $Output = ''; 158 if($_SESSION['TimeSpecify'] == 0) 159 { 160 $_SESSION['TimeEnd'] = time() - 60; 161 $_SESSION['TimeStart'] = $_SESSION['TimeEnd'] - $this->GrafTimeRanges[$_SESSION['Period']]['period']; 162 } 163 164 if(!array_key_exists('Operation', $_GET)) $_GET['Operation'] = ''; 165 switch($_GET['Operation']) 166 { 167 case 'SetTime': 168 if(array_key_exists('Time', $_GET) and array_key_exists('Month', $_POST) and array_key_exists('Day', $_POST) and 169 array_key_exists('Year', $_POST) and array_key_exists('Hour', $_POST) and array_key_exists('Minute', $_POST)) 170 { 171 if(($_GET['Time'] == 'TimeStart') or ($_GET['Time'] == 'TimeEnd')) 172 { 173 $_SESSION[$_GET['Time']] = mktime($_POST['Hour'], $_POST['Minute'], 0, $_POST['Month'], 174 $_POST['Day'], $_POST['Year']); 175 $$_GET['Time'] = $_SESSION[$_GET['Time']]; 176 } 177 } 178 break; 179 case 'SetTimeNow': 180 if(array_key_exists('Time', $_GET)) 181 { 182 if(($_GET['Time'] == 'TimeStart') or ($_GET['Time'] == 'TimeEnd')) 183 { 184 $_SESSION[$_GET['Time']] = time(); 185 $$_GET['Time'] = $_SESSION[$_GET['Time']]; 186 } 187 } 188 break; 189 190 } 191 $Output .= '<strong>Časový úsek:</strong><br>'; 192 193 // Show graph time range menu 194 if($_SESSION['TimeSpecify'] == 0) 195 { 196 $Output .= 'Délka úseku: '; 197 foreach($this->GrafTimeRanges as $Index => $Item) 198 $Output .= '<a href="?Period='.$Index.'">'.$Item['caption'].'</a> '; 199 $Output .= '<br>'; 200 $Output .= '<a href="?TimeSpecify=1">Přesnější nastavení...</a><br>'; 201 } else { 202 $Output .= '<table cellspacing="0" cellpadding="2" border="0" style="margin: 0px auto;">'; 203 $Output .= '<tr><td>Počátek:</td><td>'.$this->EditTime('TimeStart').'</td></tr>'; 204 $Output .= '<tr><td>Konec:</td><td>'.$this->EditTime('TimeEnd').'</td></tr>'; 205 $Output .= '</table>'; 206 $Output .= '<a href="?TimeSpecify=0">Jednoduché nastavení...</a><br>'; 207 } 208 $Output .= '<br/>'; 209 return($Output); 210 211 } 212 213 function Show() 214 { 215 global $Config; 216 217 $Debug = 0; 218 foreach($Config['DefaultVariables'] as $Index => $Variable) 219 { 220 if(!array_key_exists($Index, $_SESSION)) $_SESSION[$Index] = $Variable; 221 if(array_key_exists($Index, $_GET)) $_SESSION[$Index] = $_GET[$Index]; 222 if(array_key_exists($Index, $_POST)) $_SESSION[$Index] = $_POST[$Index]; 223 //$$Index = $_SESSION[$Index]; 224 } 225 226 $Output = '<div style="text-align: center"><div class="Title">'.$Config['Web']['Title'].'</div>'; 227 228 $Result = $this->Database->select('measure', 'Id', '(`Enabled`=1) AND '. 229 '((`PermissionView`="all") OR (`PermissionView`="'.gethostbyaddr($_SERVER['REMOTE_ADDR']).'")) '. 230 'AND (`Id`='.($_SESSION['Measure'] * 1).')'); 231 if($Result->num_rows == 0) 232 $_SESSION['Measure'] = $Config['DefaultVariables']['Measure']; 233 234 $Output .= $this->ShowTimeRange(); 235 $Output .= $this->ShowGraph(); 236 $Output .= '<br/>'; 237 $Output .= $this->ShowMeasureTable(); 238 $Output .= '</div>'; 239 240 ShowPage($Output); 241 } 65 242 } 66 243 67 $Months = array('', 'Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 68 'Říjen', 'Listopad', 'Prosinec'); 69 70 $GrafTimeRanges = array( 71 'hour' => array( 72 'caption' => 'Hodina', 73 'period' => 3600, 74 ), 75 'day' => array( 76 'caption' => 'Den', 77 'period' => 3600 * 24, 78 ), 79 'week' => array( 80 'caption' => 'Týden', 81 'period' => 3600 * 24 * 7, 82 ), 83 'month' => array( 84 'caption' => 'Měsíc', 85 'period' => 3600 * 24 * 30, 86 ), 87 'year' => array( 88 'caption' => 'Rok', 89 'period' => 3600 * 24 * 365, 90 ), 91 'years' => array( 92 'caption' => 'Desetiletí', 93 'period' => 3600 * 24 * 365 * 10, 94 ), 95 ); 96 97 foreach($Config['DefaultVariables'] as $Index => $Variable) 98 { 99 if(!array_key_exists($Index, $_SESSION)) $_SESSION[$Index] = $Variable; 100 if(array_key_exists($Index, $_GET)) $_SESSION[$Index] = $_GET[$Index]; 101 if(array_key_exists($Index, $_POST)) $_SESSION[$Index] = $_POST[$Index]; 102 //$$Index = $_SESSION[$Index]; 103 } 104 105 if($_SESSION['TimeSpecify'] == 0) 106 { 107 $_SESSION['TimeEnd'] = time() - 60; 108 $_SESSION['TimeStart'] = $_SESSION['TimeEnd'] - $GrafTimeRanges[$_SESSION['Period']]['period']; 109 } 110 111 $Output = '<div style="text-align: center"><div class="Title">'.$Config['Web']['Title'].'</div>'; 112 113 if(!array_key_exists('Operation', $_GET)) $_GET['Operation'] = ''; 114 switch($_GET['Operation']) 115 { 116 case 'SetTime': 117 if(array_key_exists('Time', $_GET) and array_key_exists('Month', $_POST) and array_key_exists('Day', $_POST) and 118 array_key_exists('Year', $_POST) and array_key_exists('Hour', $_POST) and array_key_exists('Minute', $_POST)) 119 { 120 if(($_GET['Time'] == 'TimeStart') or ($_GET['Time'] == 'TimeEnd')) 121 { 122 $_SESSION[$_GET['Time']] = mktime($_POST['Hour'], $_POST['Minute'], 0, $_POST['Month'], 123 $_POST['Day'], $_POST['Year']); 124 $$_GET['Time'] = $_SESSION[$_GET['Time']]; 125 } 126 } 127 break; 128 case 'SetTimeNow': 129 if(array_key_exists('Time', $_GET)) 130 { 131 if(($_GET['Time'] == 'TimeStart') or ($_GET['Time'] == 'TimeEnd')) 132 { 133 $_SESSION[$_GET['Time']] = time(); 134 $$_GET['Time'] = $_SESSION[$_GET['Time']]; 135 } 136 } 137 break; 138 139 } 140 $Output .= '<strong>Časový úsek:</strong><br>'; 141 142 // Show graph time range menu 143 if($_SESSION['TimeSpecify'] == 0) 144 { 145 $Output .= 'Délka úseku: '; 146 foreach($GrafTimeRanges as $Index => $Item) 147 $Output .= '<a href="?Period='.$Index.'">'.$Item['caption'].'</a> '; 148 $Output .= '<br>'; 149 $Output .= '<a href="?TimeSpecify=1">Přesnější nastavení...</a><br>'; 150 } else { 151 $Output .= '<table cellspacing="0" cellpadding="2" border="0" style="margin: 0px auto;">'; 152 $Output .= '<tr><td>Počátek:</td><td>'.EditTime('TimeStart').'</td></tr>'; 153 $Output .= '<tr><td>Konec:</td><td>'.EditTime('TimeEnd').'</td></tr>'; 154 $Output .= '</table>'; 155 $Output .= '<a href="?TimeSpecify=0">Jednoduché nastavení...</a><br>'; 156 } 157 $Output .= '<br>'; 158 159 $Result = $Database->select('measure', 'Id', '(Enabled=1) AND ((PermissionView="all") OR (PermissionView="'.gethostbyaddr($_SERVER['REMOTE_ADDR']).'")) AND (Id='.($_SESSION['Measure'] * 1).')'); 160 if($Result->num_rows == 0) 161 $_SESSION['Measure'] = $Config['DefaultVariables']['Measure']; 162 163 $Output .= '<strong>Graf:</strong><br>'; 164 $Output .= '<img alt="Graf" src="Graph.php?Measure='.$_SESSION['Measure'].'&From='.$_SESSION['TimeStart'].'&To='.$_SESSION['TimeEnd'].'&Width=750&Height=200&Differential='.$_SESSION['Differential'].'" width="750" height="200"><br>'; 165 $Output .= '<a href="?Measure='.$_SESSION['Measure'].'&TimeStart='.$_SESSION['TimeStart'].'&TimeEnd='.$_SESSION['TimeEnd'].'&TimeSpecify=1&Differential='.$_SESSION['Differential'].'">Odkaz na vybraný graf</a><br>'; 166 167 $Output .= '<br>'; 168 169 // Table with available measures 170 $Output .= '<table border="1" cellspacing="0" cellpadding="2" style="font-size: small; margin: 0px auto;">'; 171 $Output .= '<tr><th>Měřená veličina</th><th>Poslední hodnota</th><th>Čas posledního měření</th><th>Interpolace</th><th>Poznámky</th>'; 172 if(array_key_exists('Debug', $_GET)) $Output .= '<th>Počet položek</th><th>Čas vykonání</th>'; 173 $Output .= '</tr>'; 174 $Result = $Database->select('measure', '*', '(Enabled=1) AND ((PermissionView="all") OR (PermissionView="'.gethostbyaddr($_SERVER['REMOTE_ADDR']).'")) ORDER BY Description'); 175 while($Measure = $Result->fetch_array()) 176 { 177 $StopWatchStart = GetMicrotime(); 178 if(array_key_exists('Debug', $_GET)) 179 { 180 $DbResult = $Database->select($Measure['DataTable'], 'COUNT(*)', 'measure='.$Measure['Id']); 181 $RowCount = $DbResult->fetch_array(); 182 $RowCount = $RowCount[0]; 183 } 184 $Result2 = $Database->select($Measure['DataTable'], 'time, avg', '(measure='.$Measure['Id'].') AND (level=0) ORDER BY time DESC LIMIT 1'); 185 if($Result2->num_rows > 0) 186 { 187 $Row = $Result2->fetch_array(); 188 $LastMeasureTime = date('j.n.Y G:i:s', MysqlDateTimeToTime($Row['time'])); 189 $LastMeasureValue = $PrefixMultiplier->Add($Row['avg'], $Measure['Unit']); 190 } else { 191 $LastMeasureTime = ' '; 192 $LastMeasureValue = ' '; 193 } 194 if($Measure['Continuity'] == 1) $Interpolate = 'Ano'; else $Interpolate = 'Ne'; 195 if($Measure['Info'] == '') $Measure['Info'] = ' '; 196 $GenerationTime = floor((GetMicrotime() - $StopWatchStart) * 1000 ) / 1000; 197 $Output .= '<tr><td style="text-align: left"><a href="?Measure='.$Measure['Id'].'&Differential=0">'.$Measure['Description'].'</a></td><td align="center">'.$LastMeasureValue.'</td><td align="center">'.$LastMeasureTime.'</td><td align="center">'.$Interpolate.'</td><td>'.$Measure['Info'].'</td>'; 198 if(array_key_exists('Debug', $_GET)) $Output .= '<td>'.$RowCount.'</td><td>'.$GenerationTime.'</td>'; 199 $Output .= '</tr>'; 200 } 201 $Output .= '</table>'; 202 $Output .= '</div>'; 203 204 ShowPage($Output); 244 $Application = new Application(); 245 $Application->Start(); 246 $MainView = new MainView($Database); 247 $MainView->Show();
Note:
See TracChangeset
for help on using the changeset viewer.