Changeset 92 for trunk/Modules/Measure
- Timestamp:
- Apr 7, 2020, 11:53:58 AM (5 years ago)
- Location:
- trunk/Modules/Measure
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Measure/Measure.php
r91 r92 83 83 function TimeSegment($Level) 84 84 { 85 return (pow($this->LevelReducing, $Level) * 60);85 return pow($this->LevelReducing, $Level) * 60; 86 86 } 87 87 88 88 function GetDataTable() 89 89 { 90 return ('data_'.$this->Data['Name']);90 return 'data_'.$this->Data['Name']; 91 91 } 92 92 93 93 function AlignTime($Time, $TimeSegment) 94 94 { 95 return (round(($Time - $this->ReferenceTime) / $TimeSegment) * $TimeSegment +96 $this->ReferenceTime );95 return round(($Time - $this->ReferenceTime) / $TimeSegment) * $TimeSegment + 96 $this->ReferenceTime; 97 97 } 98 98 … … 100 100 { 101 101 $Result = $this->Database->select('Measure', '*', '`Id`='.$Id); 102 if ($Result->num_rows > 0)102 if ($Result->num_rows > 0) 103 103 { 104 104 $this->Data = $Result->fetch_array(); 105 if ($this->Data['Continuity'] == 0) $this->Data['ContinuityEnabled'] = 0; // non continuous105 if ($this->Data['Continuity'] == 0) $this->Data['ContinuityEnabled'] = 0; // non continuous 106 106 else $this->Data['ContinuityEnabled'] = 2; // continuous graph 107 107 } else die('Měřená veličina '.$Id.' nenalezena.'); … … 112 112 $Result = $this->Database->select($this->Data['DataTable'], '*', '(`Measure`='.$this->Data['Id'].') AND '. 113 113 '(`Level`=0) ORDER BY `Time` DESC LIMIT 2'); 114 if ($Result->num_rows == 0) {114 if ($Result->num_rows == 0) { 115 115 // No measure value found. Simply insert new first value. 116 116 $this->Database->insert($this->Data['DataTable'], … … 118 118 'Measure' => $this->Data['Id'], 'Time' => TimeToMysqlDateTime($Time), 119 119 'Continuity' => 0)); 120 } else if ($Result->num_rows == 1) {120 } else if ($Result->num_rows == 1) { 121 121 // One value exists. Add second value. 122 122 $this->Database->insert($this->Data['DataTable'], … … 128 128 $LastValue = $Result->fetch_array(); 129 129 $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']) 131 131 { 132 132 // New value added too quickly. Need to wait for next measure period. … … 135 135 { 136 136 // 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']) { 138 138 // New value added near defined measure period inside tolerance. Keep continuity. 139 139 $Continuity = 1; … … 143 143 $Continuity = 0; 144 144 } 145 if (($LastValue['Avg'] == $NextToLastValue['Avg']) and ($LastValue['Avg'] == $Value) and145 if (($LastValue['Avg'] == $NextToLastValue['Avg']) and ($LastValue['Avg'] == $Value) and 146 146 ($LastValue['Continuity'] == 1) and ($Continuity == 1)) 147 147 { … … 165 165 function UpdateHigherLevels($Time) 166 166 { 167 for ($Level = 1; $Level <= $this->MaxLevel; $Level++)167 for ($Level = 1; $Level <= $this->MaxLevel; $Level++) 168 168 { 169 169 $TimeSegment = $this->TimeSegment($Level); 170 170 $EndTime = $this->AlignTime($Time, $TimeSegment); 171 //if ($EndTime < $Time) $EndTime = $EndTime + $TimeSegment;171 //if ($EndTime < $Time) $EndTime = $EndTime + $TimeSegment; 172 172 $StartTime = $EndTime - $TimeSegment; 173 173 … … 178 178 '(`Time` < "'.TimeToMysqlDateTime($EndTime).'") AND '. 179 179 '(`Measure`='.$this->Data['Id'].') AND (`Level`='.($Level - 1).') ORDER BY `Time`'); 180 while ($Row = $Result->fetch_array())180 while ($Row = $Result->fetch_array()) 181 181 { 182 182 $Row['Time'] = MysqlDateTimeToTime($Row['Time']); … … 211 211 212 212 // Trim outside parts 213 foreach ($this->ValueTypes as $ValueType)213 foreach ($this->ValueTypes as $ValueType) 214 214 { 215 215 $Values[0][$ValueType] = Interpolation( … … 218 218 } 219 219 $Values[0]['Time'] = $LeftTime; 220 foreach ($this->ValueTypes as $ValueType)220 foreach ($this->ValueTypes as $ValueType) 221 221 { 222 222 $Values[count($Values) - 1][$ValueType] = Interpolation( … … 228 228 229 229 // Perform computation 230 foreach ($this->ValueTypes as $ValueType)230 foreach ($this->ValueTypes as $ValueType) 231 231 { 232 232 // 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') 236 236 { 237 237 if ($this->Data['Cumulative']) … … 240 240 } else 241 241 { 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) 244 244 { 245 245 $NewValue[$ValueType] = $NewValue[$ValueType] + ($Values[$I + 1]['Time'] - $Values[$I]['Time']) * … … 251 251 } 252 252 } 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']) 256 256 { 257 if (0 > $NewValue[$ValueType]) $NewValue[$ValueType] = 0;257 if (0 > $NewValue[$ValueType]) $NewValue[$ValueType] = 0; 258 258 } 259 259 else 260 260 { 261 if ($this->Differential == 0)261 if ($this->Differential == 0) 262 262 { 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]; 264 264 } else { 265 265 $Difference = $Values[$I + 1][$ValueType] - $Values[$I][$ValueType]; 266 if ($Difference > $NewValue[$ValueType]) $NewValue[$ValueType] = $Difference;266 if ($Difference > $NewValue[$ValueType]) $NewValue[$ValueType] = $Difference; 267 267 } 268 268 } 269 269 } 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']) 273 273 { 274 if (0 < $NewValue[$ValueType]) $NewValue[$ValueType] = 0;274 if (0 < $NewValue[$ValueType]) $NewValue[$ValueType] = 0; 275 275 } else { 276 if ($this->Differential == 0)276 if ($this->Differential == 0) 277 277 { 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]; 279 279 } else { 280 280 $Difference = $Values[$I + 1][$ValueType] - $Values[$I][$ValueType]; 281 if ($Difference < $NewValue[$ValueType]) $NewValue[$ValueType] = $Difference;281 if ($Difference < $NewValue[$ValueType]) $NewValue[$ValueType] = $Difference; 282 282 } 283 283 } … … 286 286 $NewValue[$ValueType] = $NewValue[$ValueType]; 287 287 } 288 //if (($RightTime - $LeftTime) > 0)289 if ($this->Data['Cumulative'] == 0)288 //if (($RightTime - $LeftTime) > 0) 289 if ($this->Data['Cumulative'] == 0) 290 290 { 291 291 $NewValue['Avg'] = $NewValue['Avg'] / ($RightTime - $LeftTime); 292 292 } 293 return ($NewValue);293 return $NewValue; 294 294 } 295 295 … … 299 299 $Result = $this->Database->select($this->Data['DataTable'], '*', '(`Measure`='.$this->Data['Id'].') AND '. 300 300 '(`Level`='.$Level.') ORDER BY `Time` LIMIT 1'); 301 if ($Result->num_rows > 0)301 if ($Result->num_rows > 0) 302 302 { 303 303 $Row = $Result->fetch_array(); … … 307 307 $Result = $this->Database->select($this->Data['DataTable'], '*', '(`Measure`='.$this->Data['Id'].') AND '. 308 308 '(`Level`='.$Level.') ORDER BY `Time` DESC LIMIT 1'); 309 if ($Result->num_rows > 0)309 if ($Result->num_rows > 0) 310 310 { 311 311 $Row = $Result->fetch_array(); … … 313 313 } else $AbsoluteRightTime = 0; 314 314 315 return (array('Left' => $AbsoluteLeftTime, 'Right' => $AbsoluteRightTime));315 return array('Left' => $AbsoluteLeftTime, 'Right' => $AbsoluteRightTime); 316 316 } 317 317 … … 323 323 '(`Time` > "'.TimeToMysqlDateTime($Time).'") AND (`Measure`='. 324 324 $this->Data['Id'].') AND (`Level`='.$Level.') ORDER BY `Time` ASC LIMIT 1'); 325 if ($DbResult->num_rows > 0)325 if ($DbResult->num_rows > 0) 326 326 { 327 327 // Found one value, simply return it 328 328 $Row = $DbResult->fetch_array(); 329 329 $Row['Time'] = MysqlDateTimeToTime($Row['Time']); 330 return (array($Row));330 return array($Row); 331 331 } else 332 332 { … … 339 339 '(`Time` < "'.TimeToMysqlDateTime($Time).'") AND (`Measure`='.$this->Data['Id'].') '. 340 340 'AND (`Level`='.$Level.') ORDER BY `Time` DESC LIMIT 1'); 341 if ($DbResult->num_rows > 0)341 if ($DbResult->num_rows > 0) 342 342 { 343 343 $Row = $DbResult->fetch_array(); … … 345 345 'Min' => 0, 'Avg' => 0, 'Max' => 0, 'Continuity' => 0)); 346 346 } 347 return ($Result);347 return $Result; 348 348 } 349 349 } … … 356 356 '(`Time` < "'.TimeToMysqlDateTime($Time).'") AND (`Measure`='.$this->Data['Id'].') '. 357 357 'AND (`Level`='.$Level.') ORDER BY `Time` DESC LIMIT 1'); 358 if ($DbResult->num_rows > 0)358 if ($DbResult->num_rows > 0) 359 359 { 360 360 // Found one value, simply return it 361 361 $Row = $DbResult->fetch_array(); 362 362 $Row['Time'] = MysqlDateTimeToTime($Row['Time']); 363 return (array($Row));363 return array($Row); 364 364 } else { 365 365 // Not found any value. Calculate it … … 372 372 '(`Time` > "'.TimeToMysqlDateTime($Time).'") AND (`Measure`='.$this->Data['Id'].') '. 373 373 'AND (`Level`='.$Level.') ORDER BY `Time` ASC LIMIT 1'); 374 if ($DbResult->num_rows > 0)374 if ($DbResult->num_rows > 0) 375 375 { 376 376 $Row = $DbResult->fetch_array(); … … 378 378 'Min' => 0, 'Avg' => 0, 'Max' => 0, 'Continuity' => 0)); 379 379 } 380 return ($Result);380 return $Result; 381 381 } 382 382 } … … 386 386 //$AbsoluteTime = GetTimeRange($this->DataId); 387 387 388 // if (($TimeFrom > $AbsoluteLeftTime) and ($TimeStart < $AbsoluteRightTime) and388 // if (($TimeFrom > $AbsoluteLeftTime) and ($TimeStart < $AbsoluteRightTime) and 389 389 // ($TimeTo > $AbsoluteLeftTime) and ($TimeTo < $AbsoluteRightTime)) 390 390 // { … … 397 397 '(`Measure`='.$this->Data['Id'].') AND (`Level`='.$Level.') ORDER BY `Time`'); 398 398 $Values = array(); 399 while ($Row = $Result->fetch_array())399 while ($Row = $Result->fetch_array()) 400 400 { 401 401 $Values[] = array('Time' => MysqlDateTimeToTime($Row['Time']), … … 406 406 407 407 $Points = array(); 408 if (count($Values) > 0)408 if (count($Values) > 0) 409 409 { 410 410 $Values = array_merge( … … 415 415 $StartIndex = 0; 416 416 $Points = array(); 417 for ($I = 0; $I < $this->DivisionCount; $I++)417 for ($I = 0; $I < $this->DivisionCount; $I++) 418 418 { 419 419 $TimeStart = $TimeFrom + (($TimeTo - $TimeFrom) / $this->DivisionCount) * $I; … … 421 421 422 422 $EndIndex = $StartIndex; 423 while ($Values[$EndIndex]['Time'] < $TimeEnd) $EndIndex = $EndIndex + 1;423 while ($Values[$EndIndex]['Time'] < $TimeEnd) $EndIndex = $EndIndex + 1; 424 424 $SubValues = array_slice($Values, $StartIndex, $EndIndex - $StartIndex + 1); 425 425 $Points[] = $this->ComputeOneValue($TimeStart, $TimeEnd, $SubValues, $Level); … … 427 427 } 428 428 } else $Points[] = array('Min' => 0, 'Avg' => 0, 'Max' => 0); 429 return ($Points);429 return $Points; 430 430 } 431 431 … … 433 433 { 434 434 echo('Velicina '.$this->Data['Name']."<br>\n"); 435 if ($this->Data['Continuity'] == 0) $this->Data['ContinuityEnabled'] = 0; // non continuous435 if ($this->Data['Continuity'] == 0) $this->Data['ContinuityEnabled'] = 0; // non continuous 436 436 else $this->Data['ContinuityEnabled'] = 2; // continuous graph 437 437 … … 443 443 echo("<br>\n"); 444 444 445 for ($Level = 1; $Level <= $this->MaxLevel; $Level++)445 for ($Level = 1; $Level <= $this->MaxLevel; $Level++) 446 446 { 447 447 echo('Uroven '.$Level."<br>\n"); … … 453 453 $Count = round(($EndTime - $StartTime) / $TimeSegment / $BurstCount); 454 454 echo('For 0 to '.$Count."<br>\n"); 455 for ($I = 0; $I <= $Count; $I++)455 for ($I = 0; $I <= $Count; $I++) 456 456 { 457 457 echo($I.' '); … … 463 463 TimeToMysqlDateTime($EndTime2).'") AND (`Measure`='.$this->Data['Id']. 464 464 ') AND (`Level`='.($Level - 1).') ORDER BY `Time`'); 465 while ($Row = $DbResult->fetch_array())465 while ($Row = $DbResult->fetch_array()) 466 466 { 467 467 $Row['Time'] = MysqlDateTimeToTime($Row['Time']); … … 469 469 } 470 470 471 if (count($Values) > 0)471 if (count($Values) > 0) 472 472 { 473 473 $Values = array_merge( … … 477 477 478 478 $StartIndex = 0; 479 for ($B = 0; $B < $BurstCount; $B++)479 for ($B = 0; $B < $BurstCount; $B++) 480 480 { 481 481 echo('.'); … … 484 484 485 485 $EndIndex = $StartIndex; 486 while ($Values[$EndIndex]['Time'] < $EndTime3) $EndIndex = $EndIndex + 1;486 while ($Values[$EndIndex]['Time'] < $EndTime3) $EndIndex = $EndIndex + 1; 487 487 $SubValues = array_slice($Values, $StartIndex, $EndIndex - $StartIndex + 1); 488 if (count($SubValues) > 2)488 if (count($SubValues) > 2) 489 489 { 490 490 $Point = $this->ComputeOneValue($StartTime3, $EndTime3, $SubValues, $Level); … … 511 511 { 512 512 $Result = $this->Database->select('Measure', 'Id'); 513 while ($Row = $Result->fetch_array())513 while ($Row = $Result->fetch_array()) 514 514 { 515 515 $Measure = new Measure(); -
trunk/Modules/Measure/Page.php
r86 r92 68 68 // Day selection 69 69 $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 = ''; 73 73 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 74 74 } … … 77 77 // Month selection 78 78 $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>'; 83 83 } 84 84 $Output .= '</select>. '; … … 86 86 // Year selection 87 87 $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 = ''; 91 91 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 92 92 } … … 95 95 // Hour selection 96 96 $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 = ''; 100 100 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 101 101 } … … 104 104 // Minute selection 105 105 $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 = ''; 109 109 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 110 110 } … … 117 117 $Output .= '</form>'; 118 118 119 return ($Output);119 return $Output; 120 120 } 121 121 … … 123 123 { 124 124 $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) 126 126 { 127 127 $Row = $Result2->fetch_array(); … … 132 132 $LastMeasureValue = 0; 133 133 } 134 return (array('Time' => $LastMeasureTime, 'Value' => $LastMeasureValue));134 return array('Time' => $LastMeasureTime, 'Value' => $LastMeasureValue); 135 135 } 136 136 … … 138 138 { 139 139 $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) 141 141 { 142 142 $Row = $Result2->fetch_array(); … … 147 147 $LastMeasureValue = 0; 148 148 } 149 return (array('Time' => $LastMeasureTime, 'Value' => $LastMeasureValue));149 return array('Time' => $LastMeasureTime, 'Value' => $LastMeasureValue); 150 150 } 151 151 … … 164 164 $Output = '<table border="1" cellspacing="0" cellpadding="2" style="font-size: small; margin: 0px auto;">'; 165 165 $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>'; 167 167 $Output .= '</tr>'; 168 168 $Result = $this->Database->select('Measure', '*', '( `Enabled`=1) AND ((`PermissionView`="all") OR (`PermissionView`="'. 169 169 gethostbyaddr($_SERVER['REMOTE_ADDR']).'")) ORDER BY `Description`'); 170 while ($Measure = $Result->fetch_array())170 while ($Measure = $Result->fetch_array()) 171 171 { 172 172 $StopWatchStart = GetMicrotime(); 173 if (array_key_exists('Debug', $_GET))173 if (array_key_exists('Debug', $_GET)) 174 174 { 175 175 $DbResult = $this->Database->select($Measure['DataTable'], 'COUNT(*)', '`Measure`='.$Measure['Id']); … … 179 179 $Result2 = $this->Database->select($Measure['DataTable'], '`Time`, `Avg`', '(`Measure`='. 180 180 $Measure['Id'].') AND (`Level`=0) ORDER BY `Time` DESC LIMIT 1'); 181 if ($Result2->num_rows > 0)181 if ($Result2->num_rows > 0) 182 182 { 183 183 $Row = $Result2->fetch_array(); … … 188 188 $LastMeasureValue = ' '; 189 189 } 190 if ($Measure['Continuity'] == 1) $Interpolate = 'Ano'; else $Interpolate = 'Ne';191 if ($Measure['Info'] == '') $Measure['Info'] = ' ';190 if ($Measure['Continuity'] == 1) $Interpolate = 'Ano'; else $Interpolate = 'Ne'; 191 if ($Measure['Info'] == '') $Measure['Info'] = ' '; 192 192 $GenerationTime = floor((GetMicrotime() - $StopWatchStart) * 1000 ) / 1000; 193 193 $Output .= '<tr><td style="text-align: left"><a href="?Measure='.$Measure['Id']. … … 195 195 $LastMeasureValue.'</td><td align="center">'.$LastMeasureTime.'</td><td align="center">'. 196 196 $Interpolate.'</td><td>'.$Measure['Info'].'</td>'; 197 if (array_key_exists('Debug', $_GET))197 if (array_key_exists('Debug', $_GET)) 198 198 $Output .= '<td>'.$RowCount.'</td><td>'.$GenerationTime.'</td>'; 199 199 $Output .= '</tr>'; 200 200 } 201 201 $Output .= '</table>'; 202 return ($Output);202 return $Output; 203 203 } 204 204 … … 214 214 '&TimeSpecify=1&Differential='.$_SESSION['Differential']. 215 215 '">Odkaz na vybraný graf</a><br/>'; 216 return ($Output);216 return $Output; 217 217 } 218 218 … … 221 221 $Output = ''; 222 222 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']) 225 225 { 226 226 case 'SetTime': 227 if (array_key_exists('Time', $_GET) and array_key_exists('Month', $_POST) and array_key_exists('Day', $_POST) and227 if (array_key_exists('Time', $_GET) and array_key_exists('Month', $_POST) and array_key_exists('Day', $_POST) and 228 228 array_key_exists('Year', $_POST) and array_key_exists('Hour', $_POST) and array_key_exists('Minute', $_POST)) 229 229 { 230 if (($_GET['Time'] == 'TimeStart') or ($_GET['Time'] == 'TimeEnd'))230 if (($_GET['Time'] == 'TimeStart') or ($_GET['Time'] == 'TimeEnd')) 231 231 { 232 232 $_SESSION[$_GET['Time']] = mktime($_POST['Hour'], $_POST['Minute'], 0, $_POST['Month'], … … 236 236 break; 237 237 case 'SetTimeNow': 238 if (array_key_exists('Time', $_GET))238 if (array_key_exists('Time', $_GET)) 239 239 { 240 if (($_GET['Time'] == 'TimeStart') or ($_GET['Time'] == 'TimeEnd'))240 if (($_GET['Time'] == 'TimeStart') or ($_GET['Time'] == 'TimeEnd')) 241 241 { 242 242 $_SESSION[$_GET['Time']] = $this->Time; … … 249 249 250 250 // Show graph time range menu 251 if ($_SESSION['TimeSpecify'] == 0)251 if ($_SESSION['TimeSpecify'] == 0) 252 252 { 253 253 $Output .= 'Délka úseku: '; 254 foreach ($this->GraphTimeRanges as $Index => $Item)254 foreach ($this->GraphTimeRanges as $Index => $Item) 255 255 $Output .= '<a href="?Period='.$Index.'">'.$Item['caption'].'</a> '; 256 256 $Output .= '<br>'; … … 266 266 '<a href="?Move=Right">></a> <a href="?Move=RightEnd">>|</a> <a href="?Move=Now">Nyní</a><br>'; 267 267 $Output .= '<br/>'; 268 return ($Output);268 return $Output; 269 269 270 270 } … … 277 277 { 278 278 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]; 281 281 //$$Index = $_SESSION[$Index]; 282 282 } … … 370 370 '((`PermissionView`="all") OR (`PermissionView`="'.gethostbyaddr($_SERVER['REMOTE_ADDR']).'")) '. 371 371 'AND (`Id`='.($_SESSION['Measure'] * 1).')'); 372 if ($Result->num_rows == 0)372 if ($Result->num_rows == 0) 373 373 $_SESSION['Measure'] = $Config['DefaultVariables']['Measure']; 374 374 … … 378 378 $Output .= $this->ShowMeasureTable(); 379 379 $Output .= '</div>'; 380 return ($Output);380 return $Output; 381 381 } 382 382 }
Note:
See TracChangeset
for help on using the changeset viewer.