Changeset 92 for trunk/Modules


Ignore:
Timestamp:
Apr 7, 2020, 11:53:58 AM (5 years ago)
Author:
chronos
Message:
  • Modified: Improved code formatting.
Location:
trunk/Modules
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Admin/Admin.php

    r78 r92  
    4141  function Show()
    4242  {
    43     if(array_key_exists('Operation', $_GET)) $Operation = $_GET['Operation']; else $Operation = '';
    44     switch($Operation)
     43    if (array_key_exists('Operation', $_GET)) $Operation = $_GET['Operation']; else $Operation = '';
     44    switch ($Operation)
    4545    {
    4646      case 'Add':
     
    5959        $Output = $this->ShowNone();
    6060    }
    61     return($Output);
     61    return $Output;
    6262  }
    6363
     
    7070
    7171    $Result = $this->Database->select('Measure', '*', '1 ORDER BY Description');
    72     while($Measure = $Result->fetch_array())
     72    while ($Measure = $Result->fetch_array())
    7373    {
    7474      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')));
    7575    }
    7676    $Output = '<h3>Seznam měření</h3>'.Table($Table).MakeLink('?Operation=Add', 'Přidat');
    77     return($Output);
     77    return $Output;
    7878  }
    7979
     
    8383    $Values = array();
    8484    $Values = $DbResult->fetch_array();
    85     return(ShowEditTable('Measure', $Values));
     85    return ShowEditTable('Measure', $Values);
    8686  }
    8787
     
    8989  {
    9090    $Values = array();
    91     return(ShowEditTable('Measure', $Values));
     91    return ShowEditTable('Measure', $Values);
    9292  }
    9393
  • trunk/Modules/Measure/Measure.php

    r91 r92  
    8383  function TimeSegment($Level)
    8484  {
    85     return(pow($this->LevelReducing, $Level) * 60);
     85    return pow($this->LevelReducing, $Level) * 60;
    8686  }
    8787
    8888  function GetDataTable()
    8989  {
    90     return('data_'.$this->Data['Name']);
     90    return 'data_'.$this->Data['Name'];
    9191  }
    9292
    9393  function AlignTime($Time, $TimeSegment)
    9494  {
    95     return(round(($Time - $this->ReferenceTime) / $TimeSegment) * $TimeSegment +
    96       $this->ReferenceTime);
     95    return round(($Time - $this->ReferenceTime) / $TimeSegment) * $TimeSegment +
     96      $this->ReferenceTime;
    9797  }
    9898
     
    100100  {
    101101    $Result = $this->Database->select('Measure', '*', '`Id`='.$Id);
    102     if($Result->num_rows > 0)
     102    if ($Result->num_rows > 0)
    103103    {
    104104      $this->Data = $Result->fetch_array();
    105       if($this->Data['Continuity'] == 0) $this->Data['ContinuityEnabled'] = 0;  // non continuous
     105      if ($this->Data['Continuity'] == 0) $this->Data['ContinuityEnabled'] = 0;  // non continuous
    106106        else $this->Data['ContinuityEnabled'] = 2;    // continuous graph
    107107    } else die('Měřená veličina '.$Id.' nenalezena.');
     
    112112    $Result = $this->Database->select($this->Data['DataTable'], '*', '(`Measure`='.$this->Data['Id'].') AND '.
    113113      '(`Level`=0) ORDER BY `Time` DESC LIMIT 2');
    114     if($Result->num_rows == 0) {
     114    if ($Result->num_rows == 0) {
    115115      // No measure value found. Simply insert new first value.
    116116      $this->Database->insert($this->Data['DataTable'],
     
    118118        'Measure' => $this->Data['Id'], 'Time' => TimeToMysqlDateTime($Time),
    119119        'Continuity' => 0));
    120     } else if($Result->num_rows == 1) {
     120    } else if ($Result->num_rows == 1) {
    121121      // One value exists. Add second value.
    122122      $this->Database->insert($this->Data['DataTable'],
     
    128128      $LastValue = $Result->fetch_array();
    129129      $NextToLastValue = $Result->fetch_array();
    130       if(($Time - MysqlDateTimeToTime($LastValue['Time'])) < (1 - $this->PeriodTolerance) * $this->Data['Period'])
     130      if (($Time - MysqlDateTimeToTime($LastValue['Time'])) < (1 - $this->PeriodTolerance) * $this->Data['Period'])
    131131      {
    132132        // New value added too quickly. Need to wait for next measure period.
     
    135135      {
    136136        // We are near defined period and can add new value.
    137         if(($Time - MysqlDateTimeToTime($LastValue['Time'])) < (1 + $this->PeriodTolerance) * $this->Data['Period']) {
     137        if (($Time - MysqlDateTimeToTime($LastValue['Time'])) < (1 + $this->PeriodTolerance) * $this->Data['Period']) {
    138138          // New value added near defined measure period inside tolerance. Keep continuity.
    139139          $Continuity = 1;
     
    143143          $Continuity = 0;
    144144        }
    145         if(($LastValue['Avg'] == $NextToLastValue['Avg']) and ($LastValue['Avg'] == $Value) and
     145        if (($LastValue['Avg'] == $NextToLastValue['Avg']) and ($LastValue['Avg'] == $Value) and
    146146          ($LastValue['Continuity'] == 1) and ($Continuity == 1))
    147147        {
     
    165165  function UpdateHigherLevels($Time)
    166166  {
    167     for($Level = 1; $Level <= $this->MaxLevel; $Level++)
     167    for ($Level = 1; $Level <= $this->MaxLevel; $Level++)
    168168    {
    169169      $TimeSegment = $this->TimeSegment($Level);
    170170      $EndTime = $this->AlignTime($Time, $TimeSegment);
    171       //if($EndTime < $Time) $EndTime = $EndTime + $TimeSegment;
     171      //if ($EndTime < $Time) $EndTime = $EndTime + $TimeSegment;
    172172      $StartTime = $EndTime - $TimeSegment;
    173173
     
    178178        '(`Time` < "'.TimeToMysqlDateTime($EndTime).'") AND '.
    179179        '(`Measure`='.$this->Data['Id'].') AND (`Level`='.($Level - 1).') ORDER BY `Time`');
    180       while($Row = $Result->fetch_array())
     180      while ($Row = $Result->fetch_array())
    181181      {
    182182        $Row['Time'] = MysqlDateTimeToTime($Row['Time']);
     
    211211
    212212    // Trim outside parts
    213     foreach($this->ValueTypes as $ValueType)
     213    foreach ($this->ValueTypes as $ValueType)
    214214    {
    215215      $Values[0][$ValueType] = Interpolation(
     
    218218    }
    219219    $Values[0]['Time'] = $LeftTime;
    220     foreach($this->ValueTypes as $ValueType)
     220    foreach ($this->ValueTypes as $ValueType)
    221221    {
    222222      $Values[count($Values) - 1][$ValueType] = Interpolation(
     
    228228
    229229    // Perform computation
    230     foreach($this->ValueTypes as $ValueType)
     230    foreach ($this->ValueTypes as $ValueType)
    231231    {
    232232      // Compute new value
    233       for($I = 0; $I < (count($Values) - 1); $I++)
    234       {
    235         if($ValueType == 'Avg')
     233      for ($I = 0; $I < (count($Values) - 1); $I++)
     234      {
     235        if ($ValueType == 'Avg')
    236236        {
    237237          if ($this->Data['Cumulative'])
     
    240240          } else
    241241          {
    242             if($Values[$I + 1]['Continuity'] == $this->Data['ContinuityEnabled']);
    243             else if($this->Differential == 0)
     242            if ($Values[$I + 1]['Continuity'] == $this->Data['ContinuityEnabled']);
     243            else if ($this->Differential == 0)
    244244            {
    245245              $NewValue[$ValueType] = $NewValue[$ValueType] + ($Values[$I + 1]['Time'] - $Values[$I]['Time']) *
     
    251251          }
    252252        }
    253         else if($ValueType == 'Max')
    254         {
    255           if($Values[$I + 1]['Continuity'] == $this->Data['ContinuityEnabled'])
     253        else if ($ValueType == 'Max')
     254        {
     255          if ($Values[$I + 1]['Continuity'] == $this->Data['ContinuityEnabled'])
    256256          {
    257             if(0 > $NewValue[$ValueType]) $NewValue[$ValueType] = 0;
     257            if (0 > $NewValue[$ValueType]) $NewValue[$ValueType] = 0;
    258258          }
    259259          else
    260260          {
    261             if($this->Differential == 0)
     261            if ($this->Differential == 0)
    262262            {
    263               if($Values[$I + 1][$ValueType] > $NewValue[$ValueType]) $NewValue[$ValueType] = $Values[$I + 1][$ValueType];
     263              if ($Values[$I + 1][$ValueType] > $NewValue[$ValueType]) $NewValue[$ValueType] = $Values[$I + 1][$ValueType];
    264264            } else {
    265265              $Difference = $Values[$I + 1][$ValueType] - $Values[$I][$ValueType];
    266               if($Difference > $NewValue[$ValueType]) $NewValue[$ValueType] = $Difference;
     266              if ($Difference > $NewValue[$ValueType]) $NewValue[$ValueType] = $Difference;
    267267            }
    268268          }
    269269        }
    270         else if($ValueType == 'Min')
    271         {
    272           if($Values[$I + 1]['Continuity'] == $this->Data['ContinuityEnabled'])
     270        else if ($ValueType == 'Min')
     271        {
     272          if ($Values[$I + 1]['Continuity'] == $this->Data['ContinuityEnabled'])
    273273          {
    274             if(0 < $NewValue[$ValueType]) $NewValue[$ValueType] = 0;
     274            if (0 < $NewValue[$ValueType]) $NewValue[$ValueType] = 0;
    275275          } else {
    276             if($this->Differential == 0)
     276            if ($this->Differential == 0)
    277277            {
    278               if($Values[$I + 1][$ValueType] < $NewValue[$ValueType]) $NewValue[$ValueType] = $Values[$I + 1][$ValueType];
     278              if ($Values[$I + 1][$ValueType] < $NewValue[$ValueType]) $NewValue[$ValueType] = $Values[$I + 1][$ValueType];
    279279            } else {
    280280              $Difference = $Values[$I + 1][$ValueType] - $Values[$I][$ValueType];
    281               if($Difference < $NewValue[$ValueType]) $NewValue[$ValueType] = $Difference;
     281              if ($Difference < $NewValue[$ValueType]) $NewValue[$ValueType] = $Difference;
    282282            }
    283283          }
     
    286286      $NewValue[$ValueType] = $NewValue[$ValueType];
    287287    }
    288     //if(($RightTime - $LeftTime) > 0)
    289     if($this->Data['Cumulative'] == 0)
     288    //if (($RightTime - $LeftTime) > 0)
     289    if ($this->Data['Cumulative'] == 0)
    290290    {
    291291      $NewValue['Avg'] = $NewValue['Avg'] / ($RightTime - $LeftTime);
    292292    }
    293     return($NewValue);
     293    return $NewValue;
    294294  }
    295295
     
    299299    $Result = $this->Database->select($this->Data['DataTable'], '*', '(`Measure`='.$this->Data['Id'].') AND '.
    300300      '(`Level`='.$Level.') ORDER BY `Time` LIMIT 1');
    301     if($Result->num_rows > 0)
     301    if ($Result->num_rows > 0)
    302302    {
    303303      $Row = $Result->fetch_array();
     
    307307    $Result = $this->Database->select($this->Data['DataTable'], '*', '(`Measure`='.$this->Data['Id'].') AND '.
    308308      '(`Level`='.$Level.') ORDER BY `Time` DESC LIMIT 1');
    309     if($Result->num_rows > 0)
     309    if ($Result->num_rows > 0)
    310310    {
    311311      $Row = $Result->fetch_array();
     
    313313    } else $AbsoluteRightTime = 0;
    314314
    315     return(array('Left' => $AbsoluteLeftTime, 'Right' => $AbsoluteRightTime));
     315    return array('Left' => $AbsoluteLeftTime, 'Right' => $AbsoluteRightTime);
    316316  }
    317317
     
    323323      '(`Time` > "'.TimeToMysqlDateTime($Time).'") AND (`Measure`='.
    324324      $this->Data['Id'].') AND (`Level`='.$Level.') ORDER BY `Time` ASC LIMIT 1');
    325     if($DbResult->num_rows > 0)
     325    if ($DbResult->num_rows > 0)
    326326    {
    327327      // Found one value, simply return it
    328328      $Row = $DbResult->fetch_array();
    329329      $Row['Time'] = MysqlDateTimeToTime($Row['Time']);
    330       return(array($Row));
     330      return array($Row);
    331331    } else
    332332    {
     
    339339        '(`Time` < "'.TimeToMysqlDateTime($Time).'") AND (`Measure`='.$this->Data['Id'].') '.
    340340        'AND (`Level`='.$Level.') ORDER BY `Time` DESC LIMIT 1');
    341       if($DbResult->num_rows > 0)
     341      if ($DbResult->num_rows > 0)
    342342      {
    343343        $Row = $DbResult->fetch_array();
     
    345345          'Min' => 0, 'Avg' => 0, 'Max' => 0, 'Continuity' => 0));
    346346      }
    347       return($Result);
     347      return $Result;
    348348    }
    349349  }
     
    356356      '(`Time` < "'.TimeToMysqlDateTime($Time).'") AND (`Measure`='.$this->Data['Id'].') '.
    357357      'AND (`Level`='.$Level.') ORDER BY `Time` DESC LIMIT 1');
    358     if($DbResult->num_rows > 0)
     358    if ($DbResult->num_rows > 0)
    359359    {
    360360      // Found one value, simply return it
    361361      $Row = $DbResult->fetch_array();
    362362      $Row['Time'] = MysqlDateTimeToTime($Row['Time']);
    363       return(array($Row));
     363      return array($Row);
    364364    } else {
    365365      // Not found any value. Calculate it
     
    372372        '(`Time` > "'.TimeToMysqlDateTime($Time).'") AND (`Measure`='.$this->Data['Id'].') '.
    373373        'AND (`Level`='.$Level.') ORDER BY `Time` ASC LIMIT 1');
    374       if($DbResult->num_rows > 0)
     374      if ($DbResult->num_rows > 0)
    375375      {
    376376        $Row = $DbResult->fetch_array();
     
    378378          'Min' => 0, 'Avg' => 0, 'Max' => 0, 'Continuity' => 0));
    379379      }
    380       return($Result);
     380      return $Result;
    381381    }
    382382  }
     
    386386  //$AbsoluteTime = GetTimeRange($this->DataId);
    387387
    388 //  if(($TimeFrom > $AbsoluteLeftTime) and ($TimeStart < $AbsoluteRightTime) and
     388//  if (($TimeFrom > $AbsoluteLeftTime) and ($TimeStart < $AbsoluteRightTime) and
    389389//    ($TimeTo > $AbsoluteLeftTime) and ($TimeTo < $AbsoluteRightTime))
    390390//  {
     
    397397      '(`Measure`='.$this->Data['Id'].') AND (`Level`='.$Level.') ORDER BY `Time`');
    398398    $Values = array();
    399     while($Row = $Result->fetch_array())
     399    while ($Row = $Result->fetch_array())
    400400    {
    401401      $Values[] = array('Time' => MysqlDateTimeToTime($Row['Time']),
     
    406406
    407407    $Points = array();
    408     if(count($Values) > 0)
     408    if (count($Values) > 0)
    409409    {
    410410      $Values = array_merge(
     
    415415      $StartIndex = 0;
    416416      $Points = array();
    417       for($I = 0; $I < $this->DivisionCount; $I++)
     417      for ($I = 0; $I < $this->DivisionCount; $I++)
    418418      {
    419419        $TimeStart = $TimeFrom + (($TimeTo - $TimeFrom) / $this->DivisionCount) * $I;
     
    421421
    422422        $EndIndex = $StartIndex;
    423         while($Values[$EndIndex]['Time'] < $TimeEnd) $EndIndex = $EndIndex + 1;
     423        while ($Values[$EndIndex]['Time'] < $TimeEnd) $EndIndex = $EndIndex + 1;
    424424        $SubValues = array_slice($Values, $StartIndex, $EndIndex - $StartIndex + 1);
    425425        $Points[] = $this->ComputeOneValue($TimeStart, $TimeEnd, $SubValues, $Level);
     
    427427      }
    428428    } else $Points[] = array('Min' => 0, 'Avg' => 0, 'Max' => 0);
    429     return($Points);
     429    return $Points;
    430430  }
    431431
     
    433433  {
    434434    echo('Velicina '.$this->Data['Name']."<br>\n");
    435     if($this->Data['Continuity'] == 0) $this->Data['ContinuityEnabled'] = 0;  // non continuous
     435    if ($this->Data['Continuity'] == 0) $this->Data['ContinuityEnabled'] = 0;  // non continuous
    436436      else $this->Data['ContinuityEnabled'] = 2;    // continuous graph
    437437
     
    443443    echo("<br>\n");
    444444
    445     for($Level = 1; $Level <= $this->MaxLevel; $Level++)
     445    for ($Level = 1; $Level <= $this->MaxLevel; $Level++)
    446446    {
    447447      echo('Uroven '.$Level."<br>\n");
     
    453453      $Count = round(($EndTime - $StartTime) / $TimeSegment / $BurstCount);
    454454      echo('For 0 to '.$Count."<br>\n");
    455       for($I = 0; $I <= $Count; $I++)
     455      for ($I = 0; $I <= $Count; $I++)
    456456      {
    457457        echo($I.' ');
     
    463463          TimeToMysqlDateTime($EndTime2).'") AND (`Measure`='.$this->Data['Id'].
    464464          ') AND (`Level`='.($Level - 1).') ORDER BY `Time`');
    465         while($Row = $DbResult->fetch_array())
     465        while ($Row = $DbResult->fetch_array())
    466466        {
    467467          $Row['Time'] = MysqlDateTimeToTime($Row['Time']);
     
    469469        }
    470470
    471         if(count($Values) > 0)
     471        if (count($Values) > 0)
    472472        {
    473473          $Values = array_merge(
     
    477477
    478478          $StartIndex = 0;
    479           for($B = 0; $B < $BurstCount; $B++)
     479          for ($B = 0; $B < $BurstCount; $B++)
    480480          {
    481481            echo('.');
     
    484484
    485485            $EndIndex = $StartIndex;
    486             while($Values[$EndIndex]['Time'] < $EndTime3) $EndIndex = $EndIndex + 1;
     486            while ($Values[$EndIndex]['Time'] < $EndTime3) $EndIndex = $EndIndex + 1;
    487487            $SubValues = array_slice($Values, $StartIndex, $EndIndex - $StartIndex + 1);
    488             if(count($SubValues) > 2)
     488            if (count($SubValues) > 2)
    489489            {
    490490              $Point = $this->ComputeOneValue($StartTime3, $EndTime3, $SubValues, $Level);
     
    511511  {
    512512    $Result = $this->Database->select('Measure', 'Id');
    513     while($Row = $Result->fetch_array())
     513    while ($Row = $Result->fetch_array())
    514514    {
    515515      $Measure = new Measure();
  • trunk/Modules/Measure/Page.php

    r86 r92  
    6868    // Day selection
    6969    $Output .= '<select name="Day">';
    70     for($I = 1; $I < 32; $I++)
    71     {
    72       if($I == $TimeParts['mday']) $Selected = ' selected="1"'; else $Selected = '';
     70    for ($I = 1; $I < 32; $I++)
     71    {
     72      if ($I == $TimeParts['mday']) $Selected = ' selected="1"'; else $Selected = '';
    7373      $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>';
    7474    }
     
    7777    // Month selection
    7878    $Output .= '<select name="Month">';
    79     foreach($this->Months as $Index => $Month)
    80     {
    81       if($Index == $TimeParts['mon']) $Selected = ' selected="1"'; else $Selected = '';
    82       if($Index > 0) $Output .= '<option value="'.$Index.'"'.$Selected.'>'.$Month.'</option>';
     79    foreach ($this->Months as $Index => $Month)
     80    {
     81      if ($Index == $TimeParts['mon']) $Selected = ' selected="1"'; else $Selected = '';
     82      if ($Index > 0) $Output .= '<option value="'.$Index.'"'.$Selected.'>'.$Month.'</option>';
    8383    }
    8484    $Output .= '</select>. ';
     
    8686    // Year selection
    8787    $Output .= '<select name="Year">';
    88     for($I = 2000; $I <= date("Y"); $I++)
    89     {
    90       if($I == $TimeParts['year']) $Selected = ' selected="1"'; else $Selected = '';
     88    for ($I = 2000; $I <= date("Y"); $I++)
     89    {
     90      if ($I == $TimeParts['year']) $Selected = ' selected="1"'; else $Selected = '';
    9191      $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>';
    9292    }
     
    9595    // Hour selection
    9696    $Output .= '<select name="Hour">';
    97     for($I = 0; $I < 24; $I++)
    98     {
    99       if($I == $TimeParts['hours']) $Selected = ' selected="1"'; else $Selected = '';
     97    for ($I = 0; $I < 24; $I++)
     98    {
     99      if ($I == $TimeParts['hours']) $Selected = ' selected="1"'; else $Selected = '';
    100100      $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>';
    101101    }
     
    104104    // Minute selection
    105105    $Output .= '<select name="Minute">';
    106     for($I = 0; $I < 60; $I++)
    107     {
    108       if($I == $TimeParts['minutes']) $Selected = ' selected="1"'; else $Selected = '';
     106    for ($I = 0; $I < 60; $I++)
     107    {
     108      if ($I == $TimeParts['minutes']) $Selected = ' selected="1"'; else $Selected = '';
    109109      $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>';
    110110    }
     
    117117    $Output .= '</form>';
    118118
    119     return($Output);
     119    return $Output;
    120120  }
    121121 
     
    123123  {
    124124    $Result2 = $this->Database->select($Measure['DataTable'], '`Time`, `Avg`', '(`Measure`='.$Measure['Id'].') AND (`Level`=0) ORDER BY `Time` ASC LIMIT 1');
    125     if($Result2->num_rows > 0)
     125    if ($Result2->num_rows > 0)
    126126    {
    127127      $Row = $Result2->fetch_array();
     
    132132      $LastMeasureValue = 0;
    133133    }
    134     return(array('Time' => $LastMeasureTime, 'Value' => $LastMeasureValue));
     134    return array('Time' => $LastMeasureTime, 'Value' => $LastMeasureValue);
    135135  }
    136136
     
    138138  {
    139139    $Result2 = $this->Database->select($Measure['DataTable'], '`Time`, `Avg`', '(`Measure`='.$Measure['Id'].') AND (`Level`=0) ORDER BY `Time` DESC LIMIT 1');
    140     if($Result2->num_rows > 0)
     140    if ($Result2->num_rows > 0)
    141141    {
    142142      $Row = $Result2->fetch_array();
     
    147147      $LastMeasureValue = 0;
    148148    }
    149     return(array('Time' => $LastMeasureTime, 'Value' => $LastMeasureValue));
     149    return array('Time' => $LastMeasureTime, 'Value' => $LastMeasureValue);
    150150  }
    151151 
     
    164164    $Output = '<table border="1" cellspacing="0" cellpadding="2" style="font-size: small; margin: 0px auto;">';
    165165    $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>';
    166     if(array_key_exists('Debug', $_GET)) $Output .= '<th>Počet položek</th><th>Čas vykonání</th>';
     166    if (array_key_exists('Debug', $_GET)) $Output .= '<th>Počet položek</th><th>Čas vykonání</th>';
    167167    $Output .= '</tr>';
    168168    $Result = $this->Database->select('Measure', '*', '( `Enabled`=1) AND ((`PermissionView`="all") OR (`PermissionView`="'.
    169169      gethostbyaddr($_SERVER['REMOTE_ADDR']).'")) ORDER BY `Description`');
    170     while($Measure = $Result->fetch_array())
     170    while ($Measure = $Result->fetch_array())
    171171    {
    172172      $StopWatchStart = GetMicrotime();
    173       if(array_key_exists('Debug', $_GET))
     173      if (array_key_exists('Debug', $_GET))
    174174      {
    175175        $DbResult = $this->Database->select($Measure['DataTable'], 'COUNT(*)', '`Measure`='.$Measure['Id']);
     
    179179      $Result2 = $this->Database->select($Measure['DataTable'], '`Time`, `Avg`', '(`Measure`='.
    180180        $Measure['Id'].') AND (`Level`=0) ORDER BY `Time` DESC LIMIT 1');
    181       if($Result2->num_rows > 0)
     181      if ($Result2->num_rows > 0)
    182182      {
    183183        $Row = $Result2->fetch_array();
     
    188188        $LastMeasureValue = '&nbsp;';
    189189      }
    190       if($Measure['Continuity'] == 1) $Interpolate = 'Ano'; else $Interpolate = 'Ne';
    191       if($Measure['Info'] == '') $Measure['Info'] = '&nbsp;';
     190      if ($Measure['Continuity'] == 1) $Interpolate = 'Ano'; else $Interpolate = 'Ne';
     191      if ($Measure['Info'] == '') $Measure['Info'] = '&nbsp;';
    192192      $GenerationTime = floor((GetMicrotime() - $StopWatchStart) * 1000  ) / 1000;
    193193      $Output .= '<tr><td style="text-align: left"><a href="?Measure='.$Measure['Id'].
     
    195195        $LastMeasureValue.'</td><td align="center">'.$LastMeasureTime.'</td><td align="center">'.
    196196        $Interpolate.'</td><td>'.$Measure['Info'].'</td>';
    197       if(array_key_exists('Debug', $_GET))
     197      if (array_key_exists('Debug', $_GET))
    198198        $Output .= '<td>'.$RowCount.'</td><td>'.$GenerationTime.'</td>';
    199199      $Output .= '</tr>';
    200200    }
    201201    $Output .= '</table>';
    202     return($Output);
     202    return $Output;
    203203  }
    204204
     
    214214      '&amp;TimeSpecify=1&amp;Differential='.$_SESSION['Differential'].
    215215      '">Odkaz na vybraný graf</a><br/>';
    216     return($Output);
     216    return $Output;
    217217  }
    218218
     
    221221    $Output = '';
    222222
    223     if(!array_key_exists('Operation', $_GET)) $_GET['Operation'] = '';
    224     switch($_GET['Operation'])
     223    if (!array_key_exists('Operation', $_GET)) $_GET['Operation'] = '';
     224    switch ($_GET['Operation'])
    225225    {
    226226      case 'SetTime':
    227         if(array_key_exists('Time', $_GET) and array_key_exists('Month', $_POST) and array_key_exists('Day', $_POST) and
     227        if (array_key_exists('Time', $_GET) and array_key_exists('Month', $_POST) and array_key_exists('Day', $_POST) and
    228228        array_key_exists('Year', $_POST) and array_key_exists('Hour', $_POST) and array_key_exists('Minute', $_POST))
    229229        {
    230           if(($_GET['Time'] == 'TimeStart') or ($_GET['Time'] == 'TimeEnd'))
     230          if (($_GET['Time'] == 'TimeStart') or ($_GET['Time'] == 'TimeEnd'))
    231231          {
    232232            $_SESSION[$_GET['Time']] = mktime($_POST['Hour'], $_POST['Minute'], 0, $_POST['Month'],
     
    236236        break;
    237237      case 'SetTimeNow':
    238         if(array_key_exists('Time', $_GET))
     238        if (array_key_exists('Time', $_GET))
    239239        {
    240           if(($_GET['Time'] == 'TimeStart') or ($_GET['Time'] == 'TimeEnd'))
     240          if (($_GET['Time'] == 'TimeStart') or ($_GET['Time'] == 'TimeEnd'))
    241241          {
    242242            $_SESSION[$_GET['Time']] = $this->Time;
     
    249249
    250250    // Show graph time range menu
    251     if($_SESSION['TimeSpecify'] == 0)
     251    if ($_SESSION['TimeSpecify'] == 0)
    252252    {
    253253      $Output .= 'Délka úseku: ';
    254       foreach($this->GraphTimeRanges as $Index => $Item)
     254      foreach ($this->GraphTimeRanges as $Index => $Item)
    255255        $Output .= '<a href="?Period='.$Index.'">'.$Item['caption'].'</a>&nbsp;';
    256256      $Output .= '<br>';
     
    266266      '<a href="?Move=Right">&gt;</a> <a href="?Move=RightEnd">&gt;|</a> <a href="?Move=Now">Nyní</a><br>';
    267267    $Output .= '<br/>';
    268     return($Output);
     268    return $Output;
    269269
    270270  }
     
    277277    {
    278278      if (!array_key_exists($Index, $_SESSION)) $_SESSION[$Index] = $Variable;
    279       //if(array_key_exists($Index, $_GET)) $_SESSION[$Index] = $_GET[$Index];
    280       //if(array_key_exists($Index, $_POST)) $_SESSION[$Index] = $_POST[$Index];
     279      //if (array_key_exists($Index, $_GET)) $_SESSION[$Index] = $_GET[$Index];
     280      //if (array_key_exists($Index, $_POST)) $_SESSION[$Index] = $_POST[$Index];
    281281      //$$Index = $_SESSION[$Index];
    282282    }
     
    370370      '((`PermissionView`="all") OR (`PermissionView`="'.gethostbyaddr($_SERVER['REMOTE_ADDR']).'")) '.
    371371      'AND (`Id`='.($_SESSION['Measure'] * 1).')');
    372     if($Result->num_rows == 0)
     372    if ($Result->num_rows == 0)
    373373      $_SESSION['Measure'] = $Config['DefaultVariables']['Measure'];
    374374
     
    378378    $Output .= $this->ShowMeasureTable();
    379379    $Output .= '</div>';
    380     return($Output);
     380    return $Output;
    381381  }
    382382}
Note: See TracChangeset for help on using the changeset viewer.