Changeset 14
- Timestamp:
- Oct 17, 2007, 7:53:48 PM (17 years ago)
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
admin.php
r13 r14 13 13 case 'Edit': 14 14 $Output = ShowEdit(); 15 break; 16 case 'RebuildCache': 17 $Output = ShowRebuildCache(); 15 18 break; 16 19 default: … … 30 33 while($Measure = $Result->fetch_array()) 31 34 { 32 array_push($Table['Rows'], array($Measure['Description'], MakeLink('?Operation=Edit&MeasureId='.$Measure['Id'], 'Editovat').' '.MakeLink('?Operation=Delete&MeasureId='.$Measure['Id'], 'Odstranit') ));35 array_push($Table['Rows'], array($Measure['Description'], MakeLink('?Operation=Edit&MeasureId='.$Measure['Id'], 'Editovat').' '.MakeLink('?Operation=Delete&MeasureId='.$Measure['Id'], 'Odstranit').' '.MakeLink('?Operation=RebuildCache&MeasureId='.$Measure['Id'], 'Pøestavìt cache'))); 33 36 } 34 37 $Output = '<h3>Seznam mìøení</h3>'.Table($Table).MakeLink('?Operation=Add', 'Pøidat'); … … 39 42 { 40 43 global $Database; 41 $DbResult = $Database->select('measure', '*', 'Id='. $_GET['MeasureId']);44 $DbResult = $Database->select('measure', '*', 'Id='.addslashes($_GET['MeasureId'])); 42 45 $Values = array(); 43 46 $Values = $DbResult->fetch_array(); … … 52 55 } 53 56 57 function ShowRebuildCache() 58 { 59 global $Database; 60 echo("Vytvaøím novou cache...<br>"); 61 $DbResult = $Database->select('measure', '*', 'Id='.addslashes($_GET['MeasureId'])); 62 $Measure = $DbResult->fetch_array(); 63 64 RebuildMeasureCache($Measure); 65 echo('Dokonèeno<br>'); 66 } 67 54 68 ?> -
graph.php
r13 r14 181 181 imagettftext($Image, $FontSize, 0, $Width-194, 14, $Green, $FontFile, "Avg. ".AddPrefixMultipliers($AvgValue, $Measure['Unit'])); 182 182 imagettftext($Image, $FontSize, 0, $Width-294, 14, $Blue, $FontFile, "Min. ".AddPrefixMultipliers($MinValue, $Measure['Unit'])); 183 imagestring($Image, 2, 50, 20, 'Vygenerováno za '.$GenerationTime.' sekund', $Black);183 imagestring($Image, 2, 70, 20, 'Vygenerováno za '.$GenerationTime.' sekund', $Black); 184 184 //imagestring($Image, 2, 50, 30, 'Level: '.$Level, $Black); 185 185 186 imagettftext($Image, $FontSize, 0, 50, 14, $Black, $FontFile, to_utf8($Measure['Description']));186 imagettftext($Image, $FontSize, 0, 70, 14, $Black, $FontFile, to_utf8($Measure['Description'])); 187 187 imagerectangle($Image, 0, 0, $Width - 1, $Height - 1, $Black); // Frame border 188 188 imagepng($Image); -
index.php
r13 r14 190 190 $RowCount = $RowCount[0]; 191 191 } 192 $Result2 = $Database->select($Measure['DataTable'], 'time, avg', 'measure='.$Measure['Id'].' ORDER BY time DESC LIMIT 1');192 $Result2 = $Database->select($Measure['DataTable'], 'time, avg', 'measure='.$Measure['Id'].' AND level=0 ORDER BY time DESC LIMIT 1'); 193 193 if($Result2->num_rows > 0) 194 194 { -
rebuild.php
r1 r14 1 <? 1 <?php 2 2 3 include('error.php'); 4 include('stat_functions.php'); 5 include('db.php'); 6 DB_Init('localhost', 'stat', '', 'statistic'); 3 include('global.php'); 7 4 8 5 //$Measure = GetMeasureById(12); -
stat_functions.php
r13 r14 249 249 function GetTimeRange($Measure, $Level) 250 250 { 251 global $Debug ;251 global $Debug, $Database; 252 252 253 253 // Get first and last time 254 echo($Measure['Id'].','.$Level.','.StatTableName($Level)."\n");254 //echo($Measure['Id'].','.$Level.','.StatTableName($Level)."\n"); 255 255 $Result = $Database->select($Measure['DataTable'], '*', 'measure='.$Measure['Id'].' AND level='.$Level.' ORDER BY time LIMIT 1'); 256 256 if($Result->num_rows > 0) … … 395 395 function RebuildMeasureCache($Measure) 396 396 { 397 global $MaxLevel, $LevelReducing ;398 399 echo('Velicina '.$Measure['Name']." \n");397 global $MaxLevel, $LevelReducing, $Database; 398 399 echo('Velicina '.$Measure['Name']."<br>\n"); 400 400 if($Measure['Continuity'] == 0) $Measure['ContinuityEnabled'] = 0; // non continuous 401 401 else $Measure['ContinuityEnabled'] = 2; // continuous graph 402 402 403 403 // Clear previous items 404 $ Result = $Database->select($Measure['DataTable'], 'COUNT(*)', 'level>0 AND measure='.$Measure['Id']);405 $Row = $ Result->fetch_array();404 $DbResult = $Database->select($Measure['DataTable'], 'COUNT(*)', 'level>0 AND measure='.$Measure['Id']); 405 $Row = $DbResult->fetch_array(); 406 406 echo("Mazu starou cache (".$Row[0]." polozek)..."); 407 407 $Database->delete($Measure['DataTable'], 'level>0 AND measure='.$Measure['Id']); 408 echo(" \n");408 echo("<br>\n"); 409 409 410 410 for($Level=1; $Level <= $MaxLevel; $Level++) 411 411 { 412 echo('Uroven '.$Level." \n");412 echo('Uroven '.$Level."<br>\n"); 413 413 $TimeRange = GetTimeRange($Measure, $Level-1); 414 414 //echo($Measure['Id'].','.($Level-1)."\n"); … … 418 418 $EndTime = AlignTime($TimeRange['right'], $TimeSegment); 419 419 $BurstCount = 500; 420 echo('For 0 to '.round(($EndTime - $StartTime) / $TimeSegment / $BurstCount)." \n");420 echo('For 0 to '.round(($EndTime - $StartTime) / $TimeSegment / $BurstCount)."<br>\n"); 421 421 for($I = 0; $I <= round(($EndTime - $StartTime) / $TimeSegment / $BurstCount); $I++) 422 422 { … … 425 425 $EndTime2 = $StartTime + ($I+1) * $BurstCount * $TimeSegment; 426 426 $Values = array(); 427 DB_Select($Measure['DataTable'], '*', 'time > "'.TimeToMysqlDateTime($StartTime2).'" AND time < "'.427 $DbResult = $Database->select($Measure['DataTable'], '*', 'time > "'.TimeToMysqlDateTime($StartTime2).'" AND time < "'. 428 428 TimeToMysqlDateTime($EndTime2).'" AND measure='.$Measure['Id'].' AND level='.($Level-1).' ORDER BY time'); 429 while($Row = DB_Row())429 while($Row = $DbResult->fetch_array()) 430 430 { 431 431 $Row['time'] = MysqlDateTimeToTime($Row['time']); … … 453 453 $Point = ComputeOneValue($StartTime3, $EndTime3, $SubValues, $Measure, $Level); 454 454 $Continuity = $SubValues[1]['continuity']; 455 DB_Insert($Measure['DataTable'], array('level' => $Level, 'measure' => $Measure['Id'], 'min' => $Point['min'],455 $Database->insert($Measure['DataTable'], array('level' => $Level, 'measure' => $Measure['Id'], 'min' => $Point['min'], 456 456 'avg' => $Point['avg'], 'max' => $Point['max'], 'continuity' => $Continuity, 'time' => TimeToMysqlDateTime($StartTime3+($EndTime3-$StartTime3)/2))); 457 457 } … … 462 462 //array_pop($NextValues); 463 463 } 464 echo("Uroven dokoncena \n");465 DB_Select($Measure['DataTable'], 'COUNT(*)', 'level='.$Level.' AND measure='.$Measure['Id']);466 $Row = DB_Row();467 echo("Vlozeno ".$Row[0]." polozek. \n");464 echo("Uroven dokoncena<br>\n"); 465 $DbResult = $Database->select($Measure['DataTable'], 'COUNT(*)', 'level='.$Level.' AND measure='.$Measure['Id']); 466 $Row = $DbResult->fetch_array(); 467 echo("Vlozeno ".$Row[0]." polozek.<br>\n"); 468 468 } 469 469 } … … 479 479 $Result = $Database->select('measure', '*'); 480 480 while($Measures[] = $Result->fetch_array()); 481 array_pop($Measures);481 array_pop($Measures); 482 482 483 483 foreach($Measures as $Measure) -
style/style.css
r7 r14 1 body { 2 font-family: Arial, Helvetica, sans-serif; 1 body 2 { 3 font-family : Arial, sans-serif; 4 } 5 .BasicTable 6 { 7 border-width: thin; 8 border-style: solid; 9 border-color: red; 10 padding: 0px 0px 0px 0px; 11 border-collapse: collapse; 12 } 13 .BasicTable td 14 { 15 border-width: 2px; 16 border-style: solid; 17 border-color: Silver; 18 padding: 2px; 19 } 20 .BasicTable th 21 { 22 border-width: 2px; 23 border-style: solid; 24 border-color: Silver; 25 padding: 2px; 26 } 27 h3 28 { 29 margin-bottom: 3px; 3 30 } 4 31
Note:
See TracChangeset
for help on using the changeset viewer.