Changeset 51 for branches/old


Ignore:
Timestamp:
Feb 20, 2015, 9:21:01 AM (10 years ago)
Author:
chronos
Message:
  • Modify: If measure not found then use default one.
Location:
branches/old
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • branches/old/add.php

    r49 r51  
    1 <?
     1<?php
     2
    23include('global.php');
    34
     
    1011  {
    1112    AddValue($Measure, $Value);
    12     echo('Hodnota '.$Value.' uložena');
    13   } else echo('Nemáte oprávnění k aktualizaci zadané veličiny!<br>Vaše adresa: '.gethostbyaddr($_SERVER['REMOTE_ADDR']).'('.$_SERVER['REMOTE_ADDR'].')');
     13    echo('Hodnota '.$Value.' uložena');
     14  } else echo('Nemáte oprávnění k aktualizaci zadané veličiny!<br>Vaše adresa: '.gethostbyaddr($_SERVER['REMOTE_ADDR']).'('.$_SERVER['REMOTE_ADDR'].')');
    1415} else echo('Nebyly zadány potřebné parametry');
  • branches/old/admin.php

    r28 r51  
    6565  echo('Dokončeno<br>');         
    6666}
    67 
    68 ?>
  • branches/old/classes.php

    r28 r51  
    1616  ),
    1717);
    18 
    19 ?>
  • branches/old/code.php

    r3 r51  
    559559    return $string;
    560560}
    561 ?>
  • branches/old/config.sample.php

    r50 r51  
    2828  'ImageHeight' => 200,
    2929  'ValueToImageHeigthCoefficient' => 0.9,
    30   'FontFileName' => 'arial.ttf',
     30  'FontFileName' => './arial.ttf',
    3131  'FontSize' => 10,
    3232  'DefaultVariables' => array(
  • branches/old/create_groups.php

    r1 r51  
    1 <?
     1<?php
    22
    33include('error.php');
     
    1616  for($Level=)         
    1717}
    18 ?>
  • branches/old/database.php

    r50 r51  
    6969    $this->query('SET CHARACTER SET '.$Charset);
    7070  }
    71 
    7271}
  • branches/old/error.php

    r28 r51  
    6464
    6565set_error_handler('obsluha_chyb');                              // Aktivuj novou obsluhu chyb
    66 
    67 ?>
  • branches/old/graph.php

    r28 r51  
    11<?php
     2
    23include('global.php');
    3  
     4
    45if(array_key_exists('Debug', $_GET)) $Debug = $_GET['Debug'];
    56  else $Debug = 0;
    6  
     7
    78if(!array_key_exists('From',$_GET)) die('Musíte zadat čas počátku');
    89$StartTime = addslashes($_GET['From']);
     
    2829if($Level < 0) $Level = 0;
    2930if($Level > $MaxLevel) $Level = $MaxLevel;
    30 //$Level = 0;
    31 
    3231
    3332$Points = GetValues($Measure, $StartTime, $EndTime, $Level);
     
    5453//$MinValue = round($MinValue * $Measure['Divider']) / $Measure['Divider'];
    5554//$MaxValue = round($MaxValue * $Measure['Divider']) / $Measure['Divider'];
    56 $AvgValue = $AvgValue / count($Points); //round( * $Measure['Divider']) / $Measure['Divider'];
     55$AvgValue = $AvgValue / count($Points); //round(* $Measure['Divider']) / $Measure['Divider'];
    5756
    5857// Generate polygon and recalculate y values to fit graph height
     
    6160$PointsMax = array(0, $Height-1);
    6261if(($MaxValue - $MinValue) == 0) $MaxValue = $MinValue + 1;
    63 { 
     62{
    6463  foreach($Points as $Index => $Item)
    6564  {
     
    7372  }
    7473}
    75 $PointsMin[] = $Width-1;
    76 $PointsMin[] = $Height-1;
    77 $PointsAvg[] = $Width-1;
    78 $PointsAvg[] = $Height-1;
    79 $PointsMax[] = $Width-1;
    80 $PointsMax[] = $Height-1;
    81 $PointsMin[] = $Width-1;
    82 $PointsMin[] = $Height-1;
    83 $PointsAvg[] = $Width-1;
    84 $PointsAvg[] = $Height-1;
    85 $PointsMax[] = $Width-1;
    86 $PointsMax[] = $Height-1;
     74$PointsMin[] = $Width - 1;
     75$PointsMin[] = $Height - 1;
     76$PointsAvg[] = $Width - 1;
     77$PointsAvg[] = $Height - 1;
     78$PointsMax[] = $Width - 1;
     79$PointsMax[] = $Height - 1;
     80$PointsMin[] = $Width - 1;
     81$PointsMin[] = $Height - 1;
     82$PointsAvg[] = $Width - 1;
     83$PointsAvg[] = $Height - 1;
     84$PointsMax[] = $Width - 1;
     85$PointsMax[] = $Height - 1;
    8786
    8887
     
    9594
    9695// Generate image
    97 if(!$Debug) 
     96if(!$Debug)
    9897{
    9998  header("Content-type: image/png");
     
    115114  imagefilledpolygon($Image, $PointsAvg, count($PointsAvg) / 2, $LightGreen);
    116115  imagefilledpolygon($Image, $PointsMin, count($PointsMin) / 2, $LightBlue);
    117  
     116
    118117  $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);
    119  
     118
    120119  $TimeRange = $EndTime - $StartTime;
    121120  $TimeMarksIndex = 0;
     
    124123  $MajorTimeMarks = $TimeMarks[$TimeMarksIndex - 1];
    125124  $MinorTimeMarks = $TimeMarks[$TimeMarksIndex - 2]; 
    126    
     125
    127126  $TimeShift = AlignTime($StartTime, $MajorTimeMarks) - $StartTime;
    128127  //imagestring($Image, 10, 40, 50, $TimeShift, $Black);
    129  
     128
    130129  // Zobraz měřítko Y
    131130  $VerticalLinesDistance = $Height / $VerticalLinesCount;
     
    138137
    139138  $TimeShift = AlignTime($StartTime, $MinorTimeMarks) - $StartTime;
    140  
     139
    141140  // Zobraz měřítko X
    142141  $LastTextEnd = 0;
     
    155154    }
    156155    else for($Y=0; $Y < $Height; $Y = $Y + 3) imagesetpixel($Image, $X, $Y, $Gray);
    157   } 
    158  
     156  }
     157
    159158  // Popisky osy Y
    160   for($I=1; $I<=$VerticalLinesCount; $I++)
     159  for($I = 1; $I <= $VerticalLinesCount; $I++)
    161160  {
    162161    $Y = $Height - 1 - ($VerticalLinesDistance * $I);
     
    166165    if(($Y - ($BoundBox[5] - $BoundBox[1]) / 2) > 10)
    167166      imagettftext($Image, $FontSize, 0, 2,  $Y - ($BoundBox[5] - $BoundBox[1]) / 2, $Black, $FontFile, $Text);
    168   } 
     167  }
    169168  $GenerationTime = floor((GetMicrotime() - $StopWatchStart) * 1000  ) / 1000;
    170169
     
    175174  imagettftext($Image, $FontSize, 0, $Left, 14, $Red, $FontFile, $Text);
    176175
    177   $Text = "    Avg.  ".AddPrefixMultipliers($AvgValue, $Measure['Unit']);
     176  $Text = "    Avg.  ".AddPrefixMultipliers($AvgValue, $Measure['Unit'], 4);
    178177  $BoundingBox = imagettfbbox($FontSize, 0, $FontFile, $Text);
    179178  $Left -= ($BoundingBox[2] - $BoundingBox[0]);
     
    192191  imagedestroy($Image);
    193192}
    194 
    195 ?>
  • branches/old/index.php

    r50 r51  
    156156    }
    157157$Output .= '<br>';
     158
     159$Result = $Database->select('measure', 'id', '(Enabled=1) AND ((PermissionView="all") OR (PermissionView="'.gethostbyaddr($_SERVER['REMOTE_ADDR']).'")) WHERE Id='.$_SESSION['Measure']);
     160if($Result->num_rows == 0) $_SESSION['Measure'] = $Config['DefaultVariables']['Measure'];
    158161
    159162$Output .= '<strong>Graf:</strong><br>';
  • branches/old/rebuild.php

    r17 r51  
    77
    88//RebuildAllMeasuresCache();
    9 
    10 ?>
  • branches/old/sql/23_data.sql

    r24 r51  
    88  `level` tinyint(4) NOT NULL default '0',
    99  KEY `time` (`time`)
    10 ) ENGINE=MyISAM DEFAULT CHARSET=latin2;
     10) ENGINE=MyISAM DEFAULT CHARSET=utf8;
  • branches/old/stat_functions.php

    r49 r51  
    2424function TruncateDigits($Value, $Digits = 4)
    2525{
    26   for($II = 2; $II > -1; $II--)
     26  for($II = 2; $II > -6; $II--)
    2727  {
    2828    if($Value >= pow(10, $II))
    2929    {
    30       if($Digits < ($II + 1)) $RealDigits = $II + 1; else $RealDigits = $Digits;
     30      if($Digits < ($II + 1)) $RealDigits = $II + 1;
     31        else $RealDigits = $Digits;
    3132      $Value = round($Value / pow(10, $II - $RealDigits + 1)) * pow(10, $II - $RealDigits + 1);
    3233      break;
  • branches/old/types.php

    r4 r51  
    1212  ),
    1313);
    14 
    15 ?>
Note: See TracChangeset for help on using the changeset viewer.