Changeset 59 for branches/mvc/Application
- Timestamp:
- Mar 1, 2015, 12:43:56 PM (10 years ago)
- Location:
- branches/mvc
- Files:
-
- 5 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/mvc/Application/CustomOutput.php
r47 r59 35 35 $Tag->SubElements[] = $ExecutionTimeTag; 36 36 $UsedMemoryTag = new XMLTag('li'); 37 $UsedMemoryTag->SubElements = 'Použitá paměť: '.$this->System->AddPrefixMultipliers(memory_get_peak_usage(FALSE), 'B').' / '.ini_get('memory_limit').'B'; 37 $PrefixMultiplier = new PrefixMultiplier(); 38 $UsedMemoryTag->SubElements = 'Použitá paměť: '.$PrefixMultiplier->Add(memory_get_peak_usage(FALSE), 'B').' / '.ini_get('memory_limit').'B'; 38 39 $Tag->SubElements[] = $UsedMemoryTag; 39 40 } -
branches/mvc/Application/Model/Measure.php
r47 r59 41 41 } 42 42 43 44 43 function AddValue($Value = array('Min' => 0, 'Avg' => 0, 'Max' => 0), $Level = 0, $Time = 0) 45 44 { … … 48 47 //echo(TimeToMysqlDateTime($Time).'|'.$Level."\n"); 49 48 50 $Result = $this->Database->select($this->Data['DataTable'], '*', 'Measure='.$this->Data['Id'].' AND Level='.$Level.' ORDER BY Time DESC LIMIT 2'); 49 $Result = $this->Database->select($this->Data['DataTable'], '*', '(Measure='.$this->Data['Id'].') AND '. 50 '(Level='.$Level.') ORDER BY Time DESC LIMIT 2'); 51 51 //echo($Database->LastQuery."\n"); 52 52 if($Result->num_rows == 0) 53 53 { 54 $this->Database->insert($this->Data['DataTable'], array('Min' => $Value['Min'], 'Avg' => $Value['Avg'], 'Max' => $Value['Max'], 'Level' => $Level, 'Measure' => $this->Data['Id'], 'Time' => $this->Database->TimeToMysqlDateTime($Time), 'Continuity' => 0)); 54 $this->Database->insert($this->Data['DataTable'], array('Min' => $Value['Min'], 55 'Avg' => $Value['Avg'], 'Max' => $Value['Max'], 'Level' => $Level, 56 'Measure' => $this->Data['Id'], 'Time' => $this->Database->TimeToMysqlDateTime($Time), 'Continuity' => 0)); 55 57 //echo($Database->LastQuery."\n"); 56 58 } else if($Result->num_rows == 1) 57 59 { 58 $this->Database->insert($this->Data['DataTable'], array('Min' => $Value['Min'], 'Avg' => $Value['Avg'], 'Max' => $Value['Max'], 'Level' => $Level, 'Measure' => $this->Data['Id'], 'Time' => $this->Database->TimeToMysqlDateTime($Time), 'Continuity' => 1)); 60 $this->Database->insert($this->Data['DataTable'], array('Min' => $Value['Min'], 61 'Avg' => $Value['Avg'], 'Max' => $Value['Max'], 'Level' => $Level, 62 'Measure' => $this->Data['Id'], 'Time' => $this->Database->TimeToMysqlDateTime($Time), 'Continuity' => 1)); 59 63 //echo($Database->LastQuery."\n"); 60 64 } else … … 71 75 else $Continuity = 0; 72 76 echo('('.$LastValue['Avg'].'=='.$NextToLastValue['Avg'].') and ('.$LastValue['Avg'].' == '.$Value.') and ('.$LastValue['Continuity'].' == 1) and ('.$Continuity.' == 1))'."\n"); 73 if(($LastValue['Min'] == $NextToLastValue['Min']) and ($LastValue['Min'] == $Value['Min']) and ($LastValue['Avg'] == $NextToLastValue['Avg']) and ($LastValue['Avg'] == $Value['Avg']) and ($LastValue['Max'] == $NextToLastValue['Max']) and ($LastValue['Max'] == $Value['Max']) and ($LastValue['Continuity'] == 1) and ($Continuity == 1)) 74 { 75 $this->Database->update($this->Data['DataTable'], '(Time="'.$LastValue['Time'].'") AND (Level='.$Level.') AND (Measure='.$this->Data['Id'].')', array('Time' => $this->Database->TimeToMysqlDateTime($Time))); 77 if(($LastValue['Min'] == $NextToLastValue['Min']) and ($LastValue['Min'] == $Value['Min']) and 78 ($LastValue['Avg'] == $NextToLastValue['Avg']) and ($LastValue['Avg'] == $Value['Avg']) and 79 ($LastValue['Max'] == $NextToLastValue['Max']) and ($LastValue['Max'] == $Value['Max']) and 80 ($LastValue['Continuity'] == 1) and ($Continuity == 1)) 81 { 82 $this->Database->update($this->Data['DataTable'], '(Time="'.$LastValue['Time'].'") '. 83 'AND (Level='.$Level.') AND (Measure='.$this->Data['Id'].')', array( 84 'Time' => $this->Database->TimeToMysqlDateTime($Time))); 76 85 //echo($this->Database->LastQuery."\n"); 77 86 } else 78 87 { 79 $this->Database->insert($this->Data['DataTable'], array('Min' => $Value['Min'], 'Avg' => $Value['Avg'], 'Max' => $Value['Max'], 'Level' => $Level, 'Measure' => $this->Data['Id'], 'Time' => $this->Database->TimeToMysqlDateTime($Time), 'Continuity' => $Continuity)); 88 $this->Database->insert($this->Data['DataTable'], array('Min' => $Value['Min'], 89 'Avg' => $Value['Avg'], 'Max' => $Value['Max'], 'Level' => $Level, 90 'Measure' => $this->Data['Id'], 'Time' => $this->Database->TimeToMysqlDateTime($Time), 91 'Continuity' => $Continuity)); 80 92 } 81 93 } -
branches/mvc/Application/Style/Basic/Style.css
r43 r59 3 3 font-family : Arial, sans-serif; 4 4 } 5 6 .Main 7 { 8 text-align: center; 9 } 10 5 11 .BasicTable 6 12 { … … 25 31 padding: 2px; 26 32 } 33 34 .WideTable 35 { 36 border-color: #A0A0A0; 37 border-style: solid; 38 border-width: 1px 1px 0px 0px; 39 border-spacing: 0px; 40 text-align: center; 41 margin-left: auto; 42 margin-right: auto; 43 } 44 45 .WideTable th 46 { 47 border-color: #A0A0A0; 48 border-style: solid; 49 border-width: 0px 0px 1px 1px; 50 padding: 1px 5px 1px 5px; 51 background-color: #F0F0FF 52 } 53 54 .WideTable td 55 { 56 border-color: #A0A0A0; 57 border-style: solid; 58 border-width: 0px 0px 1px 1px; 59 padding: 1px 5px 1px 5px; 60 text-align: center; 61 } 62 27 63 h3 28 64 { -
branches/mvc/Application/View/Graph.php
r47 r59 6 6 class GraphView extends View 7 7 { 8 var $FontSize; 9 var $FontFileName; 10 var $ValueToImageHeigthCoefficient; 8 11 var $DefaultWidth; 9 12 var $DefaultHeight; … … 14 17 $this->DefaultWidth = 800; 15 18 $this->DefaultHeight = 200; 19 $this->FontSize = 10; 20 $this->FontFileName = 'Arial.ttf'; 21 $this->ValueToImageHeigthCoefficient = 0.9; 16 22 } 17 23 … … 35 41 if(!array_key_exists('Differential', $_GET)) $Differential = $this->Config['Application']['DefaultVariables']['Differential']; 36 42 else $Differential = addslashes($_GET['Differential']); 37 $VerticalLinesCount = round($Height / ($this->Config['Application']['FontSize'] + 4)); 38 43 $VerticalLinesCount = round($Height / ($this->FontSize + 4)); 44 45 $PrefixMultiplier = new PrefixMultiplier(); 39 46 $StopWatchStart = $this->System->GetMicrotime(); 40 47 … … 50 57 $MeasureMethod = $DbResult2->fetch_assoc(); 51 58 52 $FontSize = $this-> Config['Application']['FontSize'];53 $FontFile = dirname(__FILE__).'/../Style/'.$this->Config['System']['Style'].'/'.$this-> Config['Application']['FontFileName'];59 $FontSize = $this->FontSize; 60 $FontFile = dirname(__FILE__).'/../Style/'.$this->Config['System']['Style'].'/'.$this->FontFileName; 54 61 55 62 $Level = floor(log(($EndTime - $StartTime) / $Measure->DivisionCount / 60) / log($Measure->LevelReducing)) - 1; … … 92 99 { 93 100 $PointsMin[] = $Index * $Width / $Measure->DivisionCount; 94 $PointsMin[] = $Height - 1 - ($Points[$Index]['Min'] - $MinValue) / ($MaxValue - $MinValue) * $Height * $this->Config['Application']['ValueToImageHeigthCoefficient']; 101 $PointsMin[] = $Height - 1 - ($Points[$Index]['Min'] - $MinValue) / 102 ($MaxValue - $MinValue) * $Height * $this->ValueToImageHeigthCoefficient; 95 103 $PointsAvg[] = $Index * $Width / $Measure->DivisionCount; 96 $PointsAvg[] = $Height - 1 - ($Points[$Index]['Avg'] - $MinValue) / ($MaxValue - $MinValue) * $Height * $this->Config['Application']['ValueToImageHeigthCoefficient']; 104 $PointsAvg[] = $Height - 1 - ($Points[$Index]['Avg'] - $MinValue) / 105 ($MaxValue - $MinValue) * $Height * $this->ValueToImageHeigthCoefficient; 97 106 $PointsMax[] = $Index * $Width / $Measure->DivisionCount; 98 $PointsMax[] = $Height - 1 - ($Points[$Index]['Max'] - $MinValue) / ($MaxValue - $MinValue) * $Height * $this->Config['Application']['ValueToImageHeigthCoefficient']; 107 $PointsMax[] = $Height - 1 - ($Points[$Index]['Max'] - $MinValue) / 108 ($MaxValue - $MinValue) * $Height * $this->ValueToImageHeigthCoefficient; 99 109 //echo($Index.' - '.$Item.' '.$Points[$Index].'<br/>'); 100 110 } … … 113 123 $PointsMax[] = $Height - 1; 114 124 115 116 125 //array_unshift($Points, $Height - 1); 117 126 //array_unshift($Points, 0); 118 127 //$Points[] = $Width - 1; 119 128 //$Points[] = $Height - 1; echo('sds'); 120 121 122 129 //print_r($PointsMax); 123 130 … … 179 186 { 180 187 for($Y = 0; $Y < $Height; $Y = $Y + 1) imagesetpixel($Image, $X, $Y, $Gray); 181 imagettftext($Image, $FontSize, 0, $X - ($BoundBox[2] - $BoundBox[0]) / 2, $Height - 2, $Black, $FontFile, $Text); 188 imagettftext($Image, $FontSize, 0, $X - ($BoundBox[2] - $BoundBox[0]) / 2, 189 $Height - 2, $Black, $FontFile, $Text); 182 190 $LastTextEnd = $X + ($BoundBox[2] - $BoundBox[0]) / 2; 183 191 } … … 190 198 $Y = $Height - 1 - ($VerticalLinesDistance * $I); 191 199 //$Y = $Height - 1 - ($VerticalLinesDistance * $I / ($MaxValue - $MinValue) * $this->Config['Application']['ValueToImageHeigthCoefficient'] * $Height); 192 $Text = $this->System->AddPrefixMultipliers(round(($I * $VerticalLinesDistance / $Height / $this->Config['Application']['ValueToImageHeigthCoefficient'] * ($MaxValue - $MinValue) + $MinValue)), $MeasureMethod['Unit'], 3); 200 $Text = $PrefixMultiplier->Add(round(($I * $VerticalLinesDistance / 201 $Height / $this->ValueToImageHeigthCoefficient * ($MaxValue - $MinValue) + $MinValue)), $MeasureMethod['Unit'], 3); 193 202 $BoundBox = imagettfbbox($FontSize, 0, $FontFile, $Text); 194 203 if(($Y - ($BoundBox[5] - $BoundBox[1]) / 2) > 10) … … 198 207 199 208 $Left = $Width - 10; 200 $Text = ' Max. '.$ this->System->AddPrefixMultipliers($MaxValue, $MeasureMethod['Unit']);209 $Text = ' Max. '.$PrefixMultiplier->Add($MaxValue, $MeasureMethod['Unit']); 201 210 $BoundingBox = imagettfbbox($FontSize, 0, $FontFile, $Text); 202 211 $Left -= ($BoundingBox[2] - $BoundingBox[0]); 203 212 imagettftext($Image, $FontSize, 0, $Left, 14, $Red, $FontFile, $Text); 204 213 205 $Text = ' Avg. '.$ this->System->AddPrefixMultipliers($AvgValue, $MeasureMethod['Unit']);214 $Text = ' Avg. '.$PrefixMultiplier->Add($AvgValue, $MeasureMethod['Unit']); 206 215 $BoundingBox = imagettfbbox($FontSize, 0, $FontFile, $Text); 207 216 $Left -= ($BoundingBox[2] - $BoundingBox[0]); 208 217 imagettftext($Image, $FontSize, 0, $Left, 14, $Green, $FontFile, $Text); 209 218 210 $Text = ' Min. '.$ this->System->AddPrefixMultipliers($MinValue, $MeasureMethod['Unit']);219 $Text = ' Min. '.$PrefixMultiplier->Add($MinValue, $MeasureMethod['Unit']); 211 220 $BoundingBox = imagettfbbox($FontSize, 0, $FontFile, $Text); 212 221 $Left -= ($BoundingBox[2] - $BoundingBox[0]); -
branches/mvc/Application/View/Main.php
r47 r59 113 113 } 114 114 115 $Output = '<div class="Title">Statistiky</div>'; 115 $Output = '<div class="Main">'; 116 $Output .= '<div class="Title">Statistiky</div>'; 116 117 117 118 if(!array_key_exists('Operation', $_GET)) $_GET['Operation'] = ''; … … 160 161 161 162 $Output .= '<br/>'.$this->MeasureTable(); 163 $Output .= '</div>'; 162 164 return($Output); 163 165 } … … 178 180 function MeasureTable() 179 181 { 180 $Output = '<table border="1" cellspacing="0" cellpadding="2" style="font-size: small;">';182 $Output = '<table class="WideTable">'; 181 183 $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>'; 182 184 if(array_key_exists('Debug', $_GET)) $Output .= '<th>Počet položek</th><th>Čas vykonání</th>'; 183 185 $Output .= '</tr>'; 186 $PrefixMultiplier = new PrefixMultiplier(); 184 187 $Result = $this->Database->select('Measure', '*', 'Enabled=1 ORDER BY Description'); 185 188 while($Measure = $Result->fetch_array()) … … 199 202 $Row = $Result2->fetch_array(); 200 203 $LastMeasureTime = date('j.n.Y G:i:s', $this->Database->MysqlDateTimeToTime($Row['Time'])); 201 $LastMeasureValue = $ this->System->AddPrefixMultipliers($Row['Avg'], $MeasureMethod['Unit']);204 $LastMeasureValue = $PrefixMultiplier->Add($Row['Avg'], $MeasureMethod['Unit']); 202 205 } else 203 206 { … … 219 222 220 223 //ShowPage($Output); 221 //echo(AddPrefixMultipliers('-0.000000071112345', 'B'));222 224 return($Output); 223 225 }
Note:
See TracChangeset
for help on using the changeset viewer.