Changeset 92 for trunk/Modules/Measure/Page.php
- Timestamp:
- Apr 7, 2020, 11:53:58 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.