1 | <?php
|
---|
2 |
|
---|
3 | include_once(dirname(__FILE__).'/HostList.php');
|
---|
4 | include_once(dirname(__FILE__).'/Subnet.php');
|
---|
5 | include_once(dirname(__FILE__).'/Hosting.php');
|
---|
6 | include_once(dirname(__FILE__).'/UserHosts.php');
|
---|
7 |
|
---|
8 | class PageFrequencyPlan extends Page
|
---|
9 | {
|
---|
10 | var $FullTitle = 'Výpis obsazení frekvenčních kanálů';
|
---|
11 | var $ShortTitle = 'Frekvenční plán';
|
---|
12 | var $ParentClass = 'PageNetwork';
|
---|
13 |
|
---|
14 | function Show()
|
---|
15 | {
|
---|
16 | // http://en.wikipedia.org/wiki/List_of_WLAN_channels
|
---|
17 | //$ChannelList = array(2412 => 1, 2417 => 2, 2422 => 3, 2427 => 4, 2432 => 5, 2437 => 6, 2442 => 7, 2447 => 8, 2452 => 9, 2457 => 10, 2462 => 11, 2467 => 12, 2472 => 13, 5200 => 40, 5205 => 41, 5210 => 42, 5215 => 43, 5220 => 44, 5225 => 45, 5230 => 46, 5235 => 47, 5240 => 48, 5245 => 49, 5250 => 50, 5255 => 51, 5260 => 52, 5265 => 53, 5270 => 54, 5275 => 55, 5280 => 56, 5285 => 57, 5290 => 58, 5295 => 59, 5300 => 60, 5500 => 100, 5520 => 104, 5540 => 108, 5560 => 112, 5580 => 116, 5600 => 120, 5620 => 124, 5640 => 128, 5660 => 132, 5700 => 140, 5720 => 144);
|
---|
18 | $Output = '<div align="center">'.
|
---|
19 | '<a href="?section=obsazeni_wifi_kanalu&range=a">Pásmo 2,4 GHz (a)</a> '.
|
---|
20 | '<a href="?section=obsazeni_wifi_kanalu&range=bc">Pásmo 5 GHz dolní (b, c)</a> '.
|
---|
21 | '<a href="?section=obsazeni_wifi_kanalu&range=d">Pásmo 5 GHz horní (d)</a> '.
|
---|
22 | '<a href="http://www.ctu.cz/1/download/Opatreni%20obecne%20povahy/VO_R_12_08_2005_34.pdf">VO_R_12_08_2005_34</a><br/>'.
|
---|
23 | '<strong>Seznam známých AP a obsazení kmitočtových pásem:</strong></div>'.
|
---|
24 | '<table class="WideTable">'.
|
---|
25 | '<tr><th/><br/>SSID<br/><br/></th>';
|
---|
26 | $ChannelList = array();
|
---|
27 | if(!array_key_exists('range', $_GET)) $_GET['range'] = 'a';
|
---|
28 | if($_GET['range'] == 'a')
|
---|
29 | {
|
---|
30 | $Where = '(Frequency < 5000)';
|
---|
31 | for($Freq = 2402; $Freq <= 2482; $Freq = $Freq + 5) $ChannelList[] = $Freq;
|
---|
32 | }
|
---|
33 | if($_GET['range'] == 'bc')
|
---|
34 | {
|
---|
35 | $Where = '(Frequency >= 5000) AND (Frequency <= 5350)';
|
---|
36 | for($Freq = 5150; $Freq <= 5350; $Freq = $Freq + 5) $ChannelList[] = $Freq;
|
---|
37 | }
|
---|
38 | if($_GET['range'] == 'd')
|
---|
39 | {
|
---|
40 | $Where = '(Frequency >= 5470)';
|
---|
41 | for($Freq = 5470; $Freq <= 5725; $Freq = $Freq + 5) $ChannelList[] = $Freq;
|
---|
42 | }
|
---|
43 |
|
---|
44 | foreach($ChannelList as $Frequency)
|
---|
45 | {
|
---|
46 | $Output .= '<th><div class="RotatedHeader">'.$Frequency.'<div></th>';
|
---|
47 | }
|
---|
48 | $Output .= '</tr>';
|
---|
49 | $DbResult = $this->Database->query('SELECT `Frequency` FROM `NetworkInterfaceWireless` WHERE '.$Where.' AND (`Mode`=0) GROUP BY `Frequency`');
|
---|
50 | while($DbRow = $DbResult->fetch_assoc())
|
---|
51 | {
|
---|
52 | $DbResult2 = $this->Database->query('SELECT * FROM `NetworkInterfaceWireless` WHERE (`Frequency`='.$DbRow['Frequency'].') AND '.$Where);
|
---|
53 | while($DbRow2 = $DbResult2->fetch_assoc())
|
---|
54 | {
|
---|
55 | $LowFrequency = $DbRow['Frequency'] - $DbRow2['ChannelWidth'] / 2 - $DbRow2['ChannelWidthLower'];
|
---|
56 | $HighFrequency = $DbRow['Frequency'] + $DbRow2['ChannelWidth'] / 2 + $DbRow2['ChannelWidthUpper'];
|
---|
57 | $Output .= '<tr><td>'.$DbRow2['SSID'].'</td>';
|
---|
58 | foreach($ChannelList as $Frequency)
|
---|
59 | {
|
---|
60 | if(($DbRow2['Frequency'] == $Frequency)) $Color = '#000000';
|
---|
61 | else if(($LowFrequency <= ($Frequency - 2.5)) and ($HighFrequency >= ($Frequency + 2.5))) $Color = '#808080';
|
---|
62 | else if(($LowFrequency == $Frequency) or ($HighFrequency == $Frequency)) $Color = '#c0c0c0';
|
---|
63 | else $Color = '#ffffff';
|
---|
64 | $Output .= '<td style="background-color: '.$Color.';"> </td>';
|
---|
65 | }
|
---|
66 |
|
---|
67 | $Output .= '</tr>';
|
---|
68 | }
|
---|
69 | }
|
---|
70 | $Output .= '</table>';
|
---|
71 | return($Output);
|
---|
72 | }
|
---|
73 | }
|
---|
74 |
|
---|
75 | class PageNetwork extends Page
|
---|
76 | {
|
---|
77 | var $FullTitle = 'Technické informace o síti';
|
---|
78 | var $ShortTitle = 'Síť';
|
---|
79 | var $ParentClass = 'PagePortal';
|
---|
80 |
|
---|
81 | function Show()
|
---|
82 | {
|
---|
83 | if(count($this->System->PathItems) > 1)
|
---|
84 | {
|
---|
85 | $Output = $this->PageNotFound();
|
---|
86 | } else $Output = $this->ShowInformation();
|
---|
87 | return($Output);
|
---|
88 | }
|
---|
89 |
|
---|
90 | function ShowInformation()
|
---|
91 | {
|
---|
92 | if(!$this->System->User->CheckPermission('Network', 'ShowInfo'))
|
---|
93 | return('Nemáte oprávnění');
|
---|
94 |
|
---|
95 | $Output = '<a href="'.$this->System->Link('/network/frequency-plan/').'">Frekvenční plán</a><br />';
|
---|
96 | $Output .= '<a href="'.$this->System->Link('/network/subnet/').'">Výpis registrovaných podsítí</a><br />';
|
---|
97 | $Output .= '<a href="'.$this->System->Link('/network/hosts/').'">Registrované zařízení</a><br />';
|
---|
98 | return($Output);
|
---|
99 | }
|
---|
100 | }
|
---|
101 |
|
---|
102 | class ModuleNetwork extends AppModule
|
---|
103 | {
|
---|
104 | var $MinNotifyTime;
|
---|
105 |
|
---|
106 | function __construct($System)
|
---|
107 | {
|
---|
108 | parent::__construct($System);
|
---|
109 | $this->Name = 'Network';
|
---|
110 | $this->Version = '1.0';
|
---|
111 | $this->Creator = 'Chronos';
|
---|
112 | $this->License = 'GNU/GPLv3';
|
---|
113 | $this->Description = 'Networking related tools';
|
---|
114 | $this->Dependencies = array('Notify');
|
---|
115 |
|
---|
116 | // TODO: Make notify time configurable
|
---|
117 | $this->MinNotifyTime = 30; // seconds
|
---|
118 | }
|
---|
119 |
|
---|
120 | function DoInstall()
|
---|
121 | {
|
---|
122 | }
|
---|
123 |
|
---|
124 | function DoUninstall()
|
---|
125 | {
|
---|
126 | }
|
---|
127 |
|
---|
128 | function DoStart()
|
---|
129 | {
|
---|
130 | $this->System->ModuleManager->Modules['Notify']->RegisterCheck('NetworkReachability',
|
---|
131 | array($this, 'ReachabilityCheck'));
|
---|
132 | $this->System->ModuleManager->Modules['Notify']->RegisterCheck('NetworkPort',
|
---|
133 | array($this, 'PortCheck'));
|
---|
134 |
|
---|
135 | $this->System->RegisterPage('network', 'PageNetwork');
|
---|
136 | $this->System->RegisterPage(array('network', 'administration'), 'PageNetworkAdministration');
|
---|
137 | $this->System->RegisterPage(array('network', 'subnet'), 'PageSubnet');
|
---|
138 | $this->System->RegisterPage(array('network', 'user-hosts'), 'PageNetworkHostList');
|
---|
139 | $this->System->RegisterPage(array('network', 'hosting'),'PageHosting');
|
---|
140 | $this->System->RegisterPage(array('network', 'hosts'), 'PageHostList');
|
---|
141 | $this->System->RegisterPage(array('network', 'frequency-plan'), 'PageFrequencyPlan');
|
---|
142 |
|
---|
143 | $this->System->RegisterCommandLine('networklog_import', array($this, 'ImportNetworkLog'));
|
---|
144 |
|
---|
145 | $this->System->FormManager->RegisterClass('NetworkDomainAlias', array(
|
---|
146 | 'Title' => 'Alias domény',
|
---|
147 | 'Table' => 'NetworkDomainAlias',
|
---|
148 | 'Items' => array(
|
---|
149 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
---|
150 | 'Target' => array('Type' => 'String', 'Caption' => 'Cíl', 'Default' => ''),
|
---|
151 | 'Comment' => array('Type' => 'String', 'Caption' => 'Komentář', 'Default' => ''),
|
---|
152 | 'Domain' => array('Type' => 'TNetworkDomain', 'Caption' => 'Síťová doména', 'Default' => ''),
|
---|
153 | ),
|
---|
154 | ));
|
---|
155 | $this->System->FormManager->RegisterFormType('TNetworkDomainAliasListDomain', array(
|
---|
156 | 'Type' => 'ManyToOne',
|
---|
157 | 'Table' => 'NetworkDomainAlias',
|
---|
158 | 'Id' => 'Id',
|
---|
159 | 'Ref' => 'Domain',
|
---|
160 | 'Filter' => '1',
|
---|
161 | ));
|
---|
162 | $this->System->FormManager->RegisterClass('NetworkDevice', array(
|
---|
163 | 'Title' => 'Síťové zařízení',
|
---|
164 | 'Table' => 'NetworkDevice',
|
---|
165 | 'Items' => array(
|
---|
166 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
---|
167 | 'Type' => array('Type' => 'TNetworkDeviceType', 'Caption' => 'Typ', 'Default' => '0'),
|
---|
168 | 'Member' => array('Type' => 'TMember', 'Caption' => 'Zákazník', 'Default' => '0'),
|
---|
169 | 'Location' => array('Type' => 'TMember', 'Caption' => 'Umístění', 'Default' => '0'),
|
---|
170 | 'Service' => array('Type' => 'TServiceCustomerRel', 'Caption' => 'Služba', 'Default' => '', 'Null' => true),
|
---|
171 | 'Used' => array('Type' => 'Boolean', 'Caption' => 'Použito', 'Default' => '1'),
|
---|
172 | 'Online' => array('Type' => 'TOnlineState', 'Caption' => 'Běží', 'Default' => '0', 'ReadOnly' => true),
|
---|
173 | 'LastOnline' => array('Type' => 'DateTime', 'Caption' => 'Naposledy běželo', 'Default' => '', 'ReadOnly' => true),
|
---|
174 | 'PermanentOnline' => array('Type' => 'Boolean', 'Caption' => 'Běží stále', 'Default' => '0'),
|
---|
175 | 'Interfaces' => array('Type' => 'TInterfaceList', 'Caption' => 'Rozhraní', 'Default' => ''),
|
---|
176 | 'MapPosition' => array('Type' => 'TMapPosition', 'Caption' => 'Pozice na mapě', 'Default' => '0', 'Null' => true),
|
---|
177 | 'Product' => array('Type' => 'TProduct', 'Caption' => 'Produkt', 'Default' => '', 'Null' => true),
|
---|
178 | 'LoginName' => array('Type' => 'String', 'Caption' => 'Přihlašovací jméno', 'Default' => '', 'Null' => true, 'NotInList' => true),
|
---|
179 | 'LoginPassword' => array('Type' => 'String', 'Caption' => 'Přihlašovací heslo', 'Default' => '', 'Null' => true, 'NotInList' => true),
|
---|
180 | 'API' => array('Type' => 'TDeviceAPIType', 'Caption' => 'API', 'Default' => '', 'Null' => true),
|
---|
181 | 'Logs' => array('Type' => 'TDeviceLogList', 'Caption' => 'Záznamy', 'Default' => ''),
|
---|
182 | ),
|
---|
183 | 'AfterInsert' => array($this, 'AfterInsertNetworkDevice'),
|
---|
184 | 'AfterModify' => array($this, 'AfterModifyNetworkDevice'),
|
---|
185 | 'AfterDelete' => array($this, 'AfterModifyNetworkDevice'),
|
---|
186 | ));
|
---|
187 | $this->System->FormManager->RegisterClass('NetworkDeviceType', array(
|
---|
188 | 'Title' => 'Typ síťového zařízení',
|
---|
189 | 'Table' => 'NetworkDeviceType',
|
---|
190 | 'Items' => array(
|
---|
191 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
---|
192 | 'ShowOnline' => array('Type' => 'Boolean', 'Caption' => 'Ukázat online', 'Default' => '0'),
|
---|
193 | 'IconName' => array('Type' => 'String', 'Caption' => 'Jméno ikony', 'Default' => '0'),
|
---|
194 | 'Devices' => array('Type' => 'TNetworkDeviceListType', 'Caption' => 'Síťová zařízení', 'Default' => ''),
|
---|
195 | ),
|
---|
196 | ));
|
---|
197 | $this->System->FormManager->RegisterFormType('TNetworkDeviceListType', array(
|
---|
198 | 'Type' => 'ManyToOne',
|
---|
199 | 'Table' => 'NetworkDevice',
|
---|
200 | 'Id' => 'Id',
|
---|
201 | 'Ref' => 'Type',
|
---|
202 | 'Filter' => '1',
|
---|
203 | ));
|
---|
204 | $this->System->FormManager->RegisterClass('NetworkDeviceLog', array(
|
---|
205 | 'Title' => 'Zprávy zařízení',
|
---|
206 | 'Table' => 'NetworkDeviceLog',
|
---|
207 | 'DefaultSortColumn' => 'Time',
|
---|
208 | 'DefaultSortOrder' => 1,
|
---|
209 | 'Items' => array(
|
---|
210 | 'Time' => array('Type' => 'DateTime', 'Caption' => 'Čas', 'Default' => ''),
|
---|
211 | 'Device' => array('Type' => 'TNetworkDevice', 'Caption' => 'Zařízení', 'Default' => ''),
|
---|
212 | 'Message' => array('Type' => 'String', 'Caption' => 'Zpáva', 'Default' => ''),
|
---|
213 | 'Tags' => array('Type' => 'String', 'Caption' => 'Značky', 'Default' => ''),
|
---|
214 | ),
|
---|
215 | ));
|
---|
216 | $this->System->FormManager->RegisterClass('NetworkInterface', array(
|
---|
217 | 'Title' => 'Síťové rozhraní',
|
---|
218 | 'Table' => 'NetworkInterface',
|
---|
219 | 'Items' => array(
|
---|
220 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
---|
221 | 'Type' => array('Type' => 'TNetworkInterfaceType', 'Caption' => 'Typ', 'Default' => '0'),
|
---|
222 | 'MAC' => array('Type' => 'MacAddress', 'Caption' => 'Fyzická adresa (MAC)', 'Default' => ''),
|
---|
223 | 'LocalIP' => array('Type' => 'IPv4Address', 'Caption' => 'IPv4', 'Default' => '', 'Null' => true),
|
---|
224 | 'IPv6' => array('Type' => 'IPv6Address', 'Caption' => 'IPv6', 'Default' => '', 'Null' => true),
|
---|
225 | 'ExternalIP' => array('Type' => 'IPv4Address', 'Caption' => 'Veřejná IPv4', 'Default' => '', 'Null' => true),
|
---|
226 | 'Device' => array('Type' => 'TNetworkDevice', 'Caption' => 'Zařízení', 'Default' => ''),
|
---|
227 | 'Enabled' => array('Type' => 'Boolean', 'Caption' => 'Povoleno', 'Default' => '1'),
|
---|
228 | 'Online' => array('Type' => 'TOnlineState', 'Caption' => 'Běží', 'Default' => '0', 'ReadOnly' => true),
|
---|
229 | 'LastOnline' => array('Type' => 'DateTime', 'Caption' => 'Naposledy běželo', 'Default' => '', 'ReadOnly' => true),
|
---|
230 | 'Links' => array('Type' => 'TNetworkLinkListInterface', 'Caption' => 'Propojení', 'Default' => ''),
|
---|
231 | 'UpDown' => array('Type' => 'TNetworkInterfaceUpDown', 'Caption' => 'Změny stavu', 'Default' => ''),
|
---|
232 | 'Signal' => array('Type' => 'TNetworkSignalListInterface', 'Caption' => 'Signál', 'Default' => ''),
|
---|
233 | 'Wireless' => array('Type' => 'TNetworkInterfaceWirelessListInterface', 'Caption' => 'Bezdrátové spoje', 'Default' => ''),
|
---|
234 | 'Ports' => array('Type' => 'TDevicePortListInterface', 'Caption' => 'Síťové porty', 'Default' => ''),
|
---|
235 | 'Latency' => array('Type' => 'TDeviceInterfaceLatencyListInterface', 'Caption' => 'Síťová odezva', 'Default' => ''),
|
---|
236 | ),
|
---|
237 | 'AfterInsert' => array($this, 'AfterInsertNetworkInterface'),
|
---|
238 | 'AfterModify' => array($this, 'AfterModifyNetworkInterface'),
|
---|
239 | 'BeforeDelete' => array($this, 'BeforeDeleteNetworkInterface'),
|
---|
240 | 'AfterDelete' => array($this, 'AfterModifyNetworkInterface'),
|
---|
241 | ));
|
---|
242 | $this->System->FormManager->RegisterClass('NetworkInterfaceType', array(
|
---|
243 | 'Title' => 'Typ síťového rozhraní',
|
---|
244 | 'Table' => 'NetworkInterfaceType',
|
---|
245 | 'Items' => array(
|
---|
246 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
---|
247 | 'MaxSpeed' => array('Type' => 'Integer', 'Caption' => 'Max. rychlost', 'Default' => '0', 'Suffix' => 'Mbit/s'),
|
---|
248 | 'FullDuplex' => array('Type' => 'Boolean', 'Caption' => 'Plně duplexní', 'Default' => '0'),
|
---|
249 | 'Color' => array('Type' => 'Color', 'Caption' => 'Barva', 'Default' => '0'),
|
---|
250 | ),
|
---|
251 | ));
|
---|
252 | $this->System->FormManager->RegisterClass('NetworkSubnet', array(
|
---|
253 | 'Title' => 'Podsítě',
|
---|
254 | 'DefaultSortColumn' => 'Name',
|
---|
255 | 'Table' => 'NetworkSubnet',
|
---|
256 | 'Items' => array(
|
---|
257 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
---|
258 | 'AddressRange' => array('Type' => 'String', 'Caption' => 'Rozsah adres', 'Default' => ''),
|
---|
259 | 'Mask' => array('Type' => 'Integer', 'Caption' => 'Prefix', 'Default' => ''),
|
---|
260 | 'DHCP' => array('Type' => 'IPv4Address', 'Caption' => 'DHCP', 'Default' => ''),
|
---|
261 | 'Gateway' => array('Type' => 'IPv4Address', 'Caption' => 'Brána', 'Default' => ''),
|
---|
262 | 'WINS' => array('Type' => 'IPv4Address', 'Caption' => 'WINS', 'Default' => ''),
|
---|
263 | 'DNS' => array('Type' => 'String', 'Caption' => 'DNS', 'Default' => ''),
|
---|
264 | 'Domain' => array('Type' => 'String', 'Caption' => 'Doména', 'Default' => ''),
|
---|
265 | 'NTP' => array('Type' => 'String', 'Caption' => 'NTP', 'Default' => ''),
|
---|
266 | 'Member' => array('Type' => 'TMember', 'Caption' => 'Zákazník', 'Default' => '', 'Null' => true),
|
---|
267 | 'ExtAddressRange' => array('Type' => 'String', 'Caption' => 'Vnější rozsah adres', 'Default' => ''),
|
---|
268 | 'ExtMask' => array('Type' => 'String', 'Caption' => 'Vnější prefix', 'Default' => ''),
|
---|
269 | 'AddressRangeIPv6' => array('Type' => 'String', 'Caption' => 'Rozsah adres IPv6', 'Default' => ''),
|
---|
270 | 'Configure' => array('Type' => 'Boolean', 'Caption' => 'Nastavovat', 'Default' => ''),
|
---|
271 | 'Interfaces' => array('Type' => 'TNetworkSubnetInterfaceList', 'Caption' => 'Rozhraní', 'Default' => ''),
|
---|
272 | ),
|
---|
273 | ));
|
---|
274 | $this->System->FormManager->RegisterFormType('TNetworkSubnetInterfaceList', array(
|
---|
275 | 'Type' => 'ManyToOne',
|
---|
276 | 'Table' => 'NetworkInterface',
|
---|
277 | 'Id' => 'Id',
|
---|
278 | 'Ref' => null,
|
---|
279 | 'Filter' => '(`TX`.`LocalIP` != "") AND CompareNetworkPrefix(INET_ATON(`TX`.`LocalIP`), INET_ATON((SELECT `NetworkSubnet`.`AddressRange` FROM `NetworkSubnet` WHERE `NetworkSubnet`.`Id`=#Id)), '.
|
---|
280 | '(SELECT `NetworkSubnet`.`Mask` FROM `NetworkSubnet` WHERE `NetworkSubnet`.`Id`=#Id))',
|
---|
281 | ));
|
---|
282 | $this->System->FormManager->RegisterClass('NetworkPort', array(
|
---|
283 | 'Title' => 'Síťový port',
|
---|
284 | 'Table' => 'NetworkPort',
|
---|
285 | 'Items' => array(
|
---|
286 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
---|
287 | 'Protocol' => array('Type' => 'TNetworkProtocol', 'Caption' => 'Protokol', 'Default' => '0'),
|
---|
288 | 'Number' => array('Type' => 'Integer', 'Caption' => 'Číslo', 'Default' => ''),
|
---|
289 | 'Interface' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní', 'Default' => ''),
|
---|
290 | 'Enabled' => array('Type' => 'Boolean', 'Caption' => 'Povoleno', 'Default' => '1'),
|
---|
291 | 'Online' => array('Type' => 'TOnlineState', 'Caption' => 'Běží', 'Default' => '0', 'ReadOnly' => true),
|
---|
292 | 'LastOnline' => array('Type' => 'DateTime', 'Caption' => 'Naposledy běželo', 'Default' => '', 'ReadOnly' => true),
|
---|
293 | 'UpDown' => array('Type' => 'TNetworkPortUpDown', 'Caption' => 'Změny stavu', 'Default' => ''),
|
---|
294 | ),
|
---|
295 | ));
|
---|
296 | $this->System->FormManager->RegisterClass('NetworkInterfaceLatency', array(
|
---|
297 | 'Title' => 'Síťová odezva',
|
---|
298 | 'Table' => 'NetworkInterfaceLatency',
|
---|
299 | 'DefaultSortColumn' => 'Time',
|
---|
300 | 'DefaultSortOrder' => 1,
|
---|
301 | 'Items' => array(
|
---|
302 | 'Time' => array('Type' => 'DateTime', 'Caption' => 'Čas', 'Default' => ''),
|
---|
303 | 'Interface' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní', 'Default' => ''),
|
---|
304 | 'Value' => array('Type' => 'Float', 'Caption' => 'Hodnota', 'Default' => '0', 'Suffix' => 'ms'),
|
---|
305 | ),
|
---|
306 | ));
|
---|
307 | $this->System->FormManager->RegisterClass('NetworkLink', array(
|
---|
308 | 'Title' => 'Síťové propojení',
|
---|
309 | 'Table' => 'NetworkLink',
|
---|
310 | 'Items' => array(
|
---|
311 | 'Type' => array('Type' => 'TNetworkLinkType', 'Caption' => 'Typ', 'Default' => '1'),
|
---|
312 | 'Interface1' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní 1', 'Default' => ''),
|
---|
313 | 'Interface2' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní 2', 'Default' => ''),
|
---|
314 | ),
|
---|
315 | ));
|
---|
316 | $this->System->FormManager->RegisterClass('NetworkLinkUnion', array(
|
---|
317 | 'Title' => 'Síťové propojení',
|
---|
318 | 'BaseTable' => 'NetworkLink',
|
---|
319 | 'SQL' => '(SELECT `Id`, `Type`, `Interface1` AS `Interface`, `Interface2` AS `InterfaceOther` FROM `NetworkLink`) '.
|
---|
320 | 'UNION (SELECT `Id`, `Type`, `Interface2` AS `Interface`, `Interface1` AS `InterfaceOther` FROM `NetworkLink`)',
|
---|
321 | 'Items' => array(
|
---|
322 | 'Type' => array('Type' => 'TNetworkLinkType', 'Caption' => 'Typ', 'Default' => '1', 'ReadOnly' => true),
|
---|
323 | 'Interface' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní 1', 'Default' => '', 'ReadOnly' => true),
|
---|
324 | 'InterfaceOther' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní 2', 'Default' => '', 'ReadOnly' => true),
|
---|
325 | ),
|
---|
326 | ));
|
---|
327 |
|
---|
328 | $this->System->FormManager->RegisterClass('NetworkLinkType', array(
|
---|
329 | 'Title' => 'Typ síťového propojení',
|
---|
330 | 'Table' => 'NetworkLinkType',
|
---|
331 | 'Items' => array(
|
---|
332 | 'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
|
---|
333 | 'MaxLinkSpeed' => array('Type' => 'Integer', 'Caption' => 'Maximální spojová rychlost', 'Default' => '0', 'Suffix' => 'bits/s'),
|
---|
334 | 'MaxRealSpeed' => array('Type' => 'Integer', 'Caption' => 'Maximální reálná rychlost', 'Default' => '0', 'Suffix' => 'bits/s'),
|
---|
335 | 'FullDuplex' => array('Type' => 'Boolean', 'Caption' => 'Plně duplexní', 'Default' => '0'),
|
---|
336 | 'Color' => array('Type' => 'Color', 'Caption' => 'Barva', 'Default' => '0'),
|
---|
337 | ),
|
---|
338 | ));
|
---|
339 | $this->System->FormManager->RegisterClass('NetworkSignal', array(
|
---|
340 | 'Title' => 'Signál rozhraní',
|
---|
341 | 'Table' => 'NetworkSignal',
|
---|
342 | 'DefaultSortColumn' => 'Time',
|
---|
343 | 'DefaultSortOrder' => 1,
|
---|
344 | 'Items' => array(
|
---|
345 | 'Time' => array('Type' => 'DateTime', 'Caption' => 'Čas', 'Default' => ''),
|
---|
346 | 'MAC' => array('Type' => 'MacAddress', 'Caption' => 'Fyzická adresa (MAC)', 'Default' => ''),
|
---|
347 | 'Interface' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní', 'Default' => '', 'Null' => true),
|
---|
348 | 'Value' => array('Type' => 'Integer', 'Caption' => 'Signál', 'Default' => '0', 'Suffix' => 'dBm'),
|
---|
349 | 'RateRx' => array('Type' => 'Integer', 'Caption' => 'Rychlost Rx', 'Default' => '0', 'Suffix' => 'MHz'),
|
---|
350 | 'RateTx' => array('Type' => 'Integer', 'Caption' => 'Rychlost Tx', 'Default' => '0', 'Suffix' => 'MHz'),
|
---|
351 | 'Device' => array('Type' => 'TNetworkDevice', 'Caption' => 'Měřeno z', 'Default' => '0'),
|
---|
352 | ),
|
---|
353 | ));
|
---|
354 | $this->System->FormManager->RegisterClass('NetworkAddressCategory', array(
|
---|
355 | 'Title' => 'Kategorie síťové adresy',
|
---|
356 | 'Table' => 'NetworkAddressCategory',
|
---|
357 | 'DefaultSortColumn' => 'Name',
|
---|
358 | 'DefaultSortOrder' => 1,
|
---|
359 | 'Items' => array(
|
---|
360 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
---|
361 | ),
|
---|
362 | ));
|
---|
363 | $this->System->FormManager->RegisterFormType('TNetworkAddressCategory', array(
|
---|
364 | 'Type' => 'Reference',
|
---|
365 | 'Table' => 'NetworkAddressCategory',
|
---|
366 | 'Id' => 'Id',
|
---|
367 | 'Name' => 'Name',
|
---|
368 | 'Filter' => '1',
|
---|
369 | ));
|
---|
370 | $this->System->FormManager->RegisterClass('NetworkDeviceConfig', array(
|
---|
371 | 'Title' => 'Nastavení zařízení',
|
---|
372 | 'Table' => 'NetworkDeviceConfig',
|
---|
373 | 'DefaultSortColumn' => 'Time',
|
---|
374 | 'DefaultSortOrder' => 1,
|
---|
375 | 'Items' => array(
|
---|
376 | 'Device' => array('Type' => 'TNetworkDevice', 'Caption' => 'Zařízení', 'Default' => ''),
|
---|
377 | 'Time' => array('Type' => 'Date', 'Caption' => 'Čas vytvoření', 'Default' => ''),
|
---|
378 | 'ConfigFull' => array('Type' => 'Text', 'Caption' => 'Kompletní nastavení', 'Default' => ''),
|
---|
379 | 'ConfigCompact' => array('Type' => 'Text', 'Caption' => 'Rozdílové nastavení', 'Default' => ''),
|
---|
380 | ),
|
---|
381 | ));
|
---|
382 | $this->System->FormManager->RegisterClass('NetworkDomain', array(
|
---|
383 | 'Title' => 'Síťová doména',
|
---|
384 | 'Table' => 'NetworkDomain',
|
---|
385 | 'DefaultSortColumn' => 'Name',
|
---|
386 | 'DefaultSortOrder' => 1,
|
---|
387 | 'Items' => array(
|
---|
388 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
---|
389 | 'Parent' => array('Type' => 'TNetworkDomain', 'Caption' => 'Nadřazená doména', 'Default' => '', 'Null' => true),
|
---|
390 | 'Description' => array('Type' => 'String', 'Caption' => 'Popis', 'Default' => ''),
|
---|
391 | 'Serial' => array('Type' => 'Integer', 'Caption' => 'Sériové číslo', 'Default' => '1'),
|
---|
392 | 'Minimum' => array('Type' => 'Integer', 'Caption' => 'Minimum', 'Default' => '10800'),
|
---|
393 | 'Retry' => array('Type' => 'Integer', 'Caption' => 'Opakování', 'Default' => '7200'),
|
---|
394 | 'Expire' => array('Type' => 'Integer', 'Caption' => 'Čas vypršení', 'Default' => '2419200'),
|
---|
395 | 'Refresh' => array('Type' => 'Integer', 'Caption' => 'Obnovení', 'Default' => '28800'),
|
---|
396 | 'TTL' => array('Type' => 'Integer', 'Caption' => 'TTL', 'Default' => '86400', 'Suffix' => 'sekund'),
|
---|
397 | 'Servers' => array('Type' => 'TNetworkDomainServerList', 'Caption' => 'Servery', 'Default' => ''),
|
---|
398 | 'Views' => array('Type' => 'TNetworkDomainViewListDomain', 'Caption' => 'Pohledy', 'Default' => ''),
|
---|
399 | 'ItemFilters' => array('Type' => 'TNetworkDomainItemFilterListDomain', 'Caption' => 'Filtry položek', 'Default' => ''),
|
---|
400 | 'Aliases' => array('Type' => 'TNetworkDomainAliasListDomain', 'Caption' => 'Aliasy', 'Default' => ''),
|
---|
401 | ),
|
---|
402 | ));
|
---|
403 | $this->System->FormManager->RegisterFormType('TNetworkDomain', array(
|
---|
404 | 'Type' => 'Reference',
|
---|
405 | 'Table' => 'NetworkDomain',
|
---|
406 | 'Id' => 'Id',
|
---|
407 | 'Name' => 'Name',
|
---|
408 | 'Filter' => '1',
|
---|
409 | ));
|
---|
410 | $this->System->FormManager->RegisterClass('NetworkDomainServer', array(
|
---|
411 | 'Title' => 'Doménový server',
|
---|
412 | 'Table' => 'NetworkDomainServer',
|
---|
413 | 'DefaultSortColumn' => 'Address',
|
---|
414 | 'DefaultSortOrder' => 1,
|
---|
415 | 'Items' => array(
|
---|
416 | 'Address' => array('Type' => 'String', 'Caption' => 'Adresa', 'Default' => ''),
|
---|
417 | 'Domain' => array('Type' => 'TNetworkDomain', 'Caption' => 'Doména', 'Default' => ''),
|
---|
418 | 'Sequence' => array('Type' => 'Integer', 'Caption' => 'Pořadí', 'Default' => '1'),
|
---|
419 | ),
|
---|
420 | ));
|
---|
421 | $this->System->FormManager->RegisterFormType('TNetworkDomainServerList', array(
|
---|
422 | 'Type' => 'ManyToOne',
|
---|
423 | 'Table' => 'NetworkDomainServer',
|
---|
424 | 'Id' => 'Id',
|
---|
425 | 'Ref' => 'Domain',
|
---|
426 | 'Filter' => '1',
|
---|
427 | ));
|
---|
428 | $this->System->FormManager->RegisterClass('NetworkDomainView', array(
|
---|
429 | 'Title' => 'Pohled síťové domény',
|
---|
430 | 'Table' => 'NetworkDomainView',
|
---|
431 | 'DefaultSortColumn' => 'Name',
|
---|
432 | 'DefaultSortOrder' => 1,
|
---|
433 | 'Items' => array(
|
---|
434 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
---|
435 | 'SysName' => array('Type' => 'String', 'Caption' => 'Systémové jméno', 'Default' => ''),
|
---|
436 | 'Domain' => array('Type' => 'TNetworkDomain', 'Caption' => 'Doména', 'Default' => ''),
|
---|
437 | 'AddressRange' => array('Type' => 'String', 'Caption' => 'Rozsah adres', 'Default' => ''),
|
---|
438 | 'ItemFilters' => array('Type' => 'TNetworkDomainItemFilterListView', 'Caption' => 'Filtry položek', 'Default' => ''),
|
---|
439 | ),
|
---|
440 | ));
|
---|
441 | $this->System->FormManager->RegisterFormType('TNetworkDomainView', array(
|
---|
442 | 'Type' => 'Reference',
|
---|
443 | 'Table' => 'NetworkDomainView',
|
---|
444 | 'Id' => 'Id',
|
---|
445 | 'Name' => 'Name',
|
---|
446 | 'Filter' => '1',
|
---|
447 | ));
|
---|
448 | $this->System->FormManager->RegisterFormType('TNetworkDomainViewListDomain', array(
|
---|
449 | 'Type' => 'ManyToOne',
|
---|
450 | 'Table' => 'NetworkDomainView',
|
---|
451 | 'Id' => 'Id',
|
---|
452 | 'Ref' => 'Domain',
|
---|
453 | 'Filter' => '1',
|
---|
454 | ));
|
---|
455 | $this->System->FormManager->RegisterClass('NetworkDomainItemFilter', array(
|
---|
456 | 'Title' => 'Filtr doménových položek',
|
---|
457 | 'Table' => 'NetworkDomainItemFilter',
|
---|
458 | 'DefaultSortColumn' => 'Name',
|
---|
459 | 'DefaultSortOrder' => 1,
|
---|
460 | 'Items' => array(
|
---|
461 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
---|
462 | 'Domain' => array('Type' => 'TNetworkDomain', 'Caption' => 'Domén', 'Default' => ''),
|
---|
463 | 'AddressCategory' => array('Type' => 'TNetworkAddressCategory', 'Caption' => 'Kategorie adresy', 'Default' => ''),
|
---|
464 | 'Suffix' => array('Type' => 'String', 'Caption' => 'Přípona jména položek', 'Default' => ''),
|
---|
465 | 'View' => array('Type' => 'TNetworkDomainView', 'Caption' => 'Pohled', 'Default' => ''),
|
---|
466 | 'AddressRange' => array('Type' => 'String', 'Caption' => 'Rozsah adres', 'Default' => ''),
|
---|
467 | ),
|
---|
468 | ));
|
---|
469 | $this->System->FormManager->RegisterFormType('TNetworkDomainItemFilterListDomain', array(
|
---|
470 | 'Type' => 'ManyToOne',
|
---|
471 | 'Table' => 'NetworkDomainItemFilter',
|
---|
472 | 'Id' => 'Id',
|
---|
473 | 'Ref' => 'Domain',
|
---|
474 | 'Filter' => '1',
|
---|
475 | ));
|
---|
476 | $this->System->FormManager->RegisterFormType('TNetworkDomainItemFilterListView', array(
|
---|
477 | 'Type' => 'ManyToOne',
|
---|
478 | 'Table' => 'NetworkDomainItemFilter',
|
---|
479 | 'Id' => 'Id',
|
---|
480 | 'Ref' => 'View',
|
---|
481 | 'Filter' => '1',
|
---|
482 | ));
|
---|
483 | $this->System->FormManager->RegisterClass('DeviceAPIType', array(
|
---|
484 | 'Title' => 'Typ API zařízení',
|
---|
485 | 'Table' => 'DeviceAPIType',
|
---|
486 | 'Items' => array(
|
---|
487 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
---|
488 | 'Devices' => array('Type' => 'TDeviceListAPI', 'Caption' => 'Zařízení', 'Default' => ''),
|
---|
489 | ),
|
---|
490 | ));
|
---|
491 | $this->System->FormManager->RegisterClass('NetworkInterfaceWireless', array(
|
---|
492 | 'Title' => 'Bezdrátová rozhraní',
|
---|
493 | 'Table' => 'NetworkInterfaceWireless',
|
---|
494 | 'Items' => array(
|
---|
495 | 'SSID' => array('Type' => 'String', 'Caption' => 'SSID', 'Default' => ''),
|
---|
496 | 'MAC' => array('Type' => 'MacAddress', 'Caption' => 'MAC', 'Default' => ''),
|
---|
497 | 'NetworkInterface' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní', 'Default' => ''),
|
---|
498 | 'TxPower' => array('Type' => 'Integer', 'Caption' => 'Výstupní výkon', 'Default' => '18', 'Suffix' => 'dBm'),
|
---|
499 | 'CableAttenuation' => array('Type' => 'Integer', 'Caption' => 'Útlum vedení', 'Default' => '0', 'Suffix' => 'dB'),
|
---|
500 | 'Antenna' => array('Type' => 'TProduct', 'Caption' => 'Anténa', 'Default' => '', 'Null' => true),
|
---|
501 | 'AntenaGain' => array('Type' => 'Integer', 'Caption' => 'Zisk antény', 'Default' => '', 'Suffix' => 'dBi'),
|
---|
502 | 'AntennaPolarity' => array('Type' => 'TAntennaPolarity', 'Caption' => 'Polarizace antény', 'Default' => '0'),
|
---|
503 | 'Frequency' => array('Type' => 'Float', 'Caption' => 'Frekvence', 'Default' => '5600', 'Suffix' => 'MHz'),
|
---|
504 | 'ChannelWidthLower' => array('Type' => 'Integer', 'Caption' => 'Šírka kanálu dolního', 'Default' => '0', 'Suffix' => 'MHz'),
|
---|
505 | 'ChannelWidth' => array('Type' => 'Integer', 'Caption' => 'Šírka kanálu', 'Default' => '20', 'Suffix' => 'MHz'),
|
---|
506 | 'ChannelWidthUpper' => array('Type' => 'Integer', 'Caption' => 'Šírka kanálu horního', 'Default' => '0', 'Suffix' => 'MHz'),
|
---|
507 | 'Mode' => array('Type'
|
---|
508 | => 'TWirelessMode', 'Caption' => 'Režim', 'Default' => '0', 'Suffix' => ''),
|
---|
509 | 'TotalPower' => array('Type' => 'Integer', 'Caption' => 'Celkový výkon', 'Default' => '20', 'Suffix' => 'dBm',
|
---|
510 | 'SQL' => '(`TxPower` - `CableAttenuation` + `AntenaGain`)', 'ReadOnly' => true),
|
---|
511 | 'LimitPower' => array('Type' => 'Integer', 'Caption' => 'Max. limit', 'Default' => '', 'Suffix' => 'dBm',
|
---|
512 | 'ReadOnly' => true, 'SQL' => '(CASE WHEN `Frequency` >= 5450 AND `Frequency` <= 5725 THEN 27 ELSE 20 END)'),
|
---|
513 | 'UnderLimit' => array('Type' => 'Boolean', 'Caption' => 'V limitu', 'Default' => '', 'Suffix' => '',
|
---|
514 | 'ReadOnly' => true, 'SQL' => '((`TxPower` - `CableAttenuation` + `AntenaGain`) <= (CASE WHEN `Frequency` >= 5450 AND `Frequency` <= 5725 THEN 27 ELSE 20 END))'),
|
---|
515 | 'Description' => array('Type' => 'String', 'Caption' => 'Popis', 'Default' => ''),
|
---|
516 | ),
|
---|
517 | 'Actions' => array(
|
---|
518 | array('Caption' => 'Frekvenční plán', 'URL' => '/network/frequency-plan/'),
|
---|
519 | ),
|
---|
520 | ));
|
---|
521 | $this->System->FormManager->RegisterClass('NetworkInterfaceWirelessCTU', array(
|
---|
522 | 'Title' => 'Bezdrátová rozhraní pro ČTÚ',
|
---|
523 | 'Table' => 'NetworkInterfaceWireless',
|
---|
524 | 'Items' => array(
|
---|
525 | 'SSID' => array('Type' => 'String', 'Caption' => 'SSID', 'Default' => ''),
|
---|
526 | 'MAC' => array('Type' => 'MacAddress', 'Caption' => 'MAC', 'Default' => ''),
|
---|
527 | 'TxPower' => array('Type' => 'Integer', 'Caption' => 'Výstupní výkon', 'Default' => '18', 'Suffix' => 'dBm'),
|
---|
528 | 'CableAttenuation' => array('Type' => 'Integer', 'Caption' => 'Útlum vedení', 'Default' => '0', 'Suffix' => 'dB'),
|
---|
529 | 'AntenaGain' => array('Type' => 'Integer', 'Caption' => 'Zisk antény', 'Default' => '', 'Suffix' => 'dBi'),
|
---|
530 | 'AntennaPolarity' => array('Type' => 'TAntennaPolarity', 'Caption' => 'Polarizace antény', 'Default' => '0'),
|
---|
531 | 'Frequency' => array('Type' => 'Float', 'Caption' => 'Frekvence', 'Default' => '5600', 'Suffix' => 'MHz'),
|
---|
532 | 'ChannelWidthLower' => array('Type' => 'Integer', 'Caption' => 'Šírka kanálu dolního', 'Default' => '0', 'Suffix' => 'MHz'),
|
---|
533 | 'ChannelWidth' => array('Type' => 'Integer', 'Caption' => 'Šírka kanálu', 'Default' => '20', 'Suffix' => 'MHz'),
|
---|
534 | 'ChannelWidthUpper' => array('Type' => 'Integer', 'Caption' => 'Šírka kanálu horního', 'Default' => '0', 'Suffix' => 'MHz'),
|
---|
535 | 'Mode' => array('Type' => 'TWirelessMode', 'Caption' => 'Režim', 'Default' => '0', 'Suffix' => ''),
|
---|
536 | 'TotalPower' => array('Type' => 'Integer', 'Caption' => 'Celkový výkon', 'Default' => '20', 'Suffix' => 'dBm',
|
---|
537 | 'SQL' => '(`TxPower` - `CableAttenuation` + `AntenaGain`)', 'ReadOnly' => true),
|
---|
538 | 'LimitPower' => array('Type' => 'Integer', 'Caption' => 'Max. limit', 'Default' => '', 'Suffix' => 'dBm',
|
---|
539 | 'ReadOnly' => true, 'SQL' => '(CASE WHEN `Frequency` >= 5450 AND `Frequency` <= 5725 THEN 27 ELSE 20 END)'),
|
---|
540 | 'UnderLimit' => array('Type' => 'Boolean', 'Caption' => 'V limitu', 'Default' => '', 'Suffix' => '',
|
---|
541 | 'ReadOnly' => true, 'SQL' => '((`TxPower` - `CableAttenuation` + `AntenaGain`) <= (CASE WHEN `Frequency` >= 5450 AND `Frequency` <= 5725 THEN 27 ELSE 20 END))'),
|
---|
542 | 'Position' => array('Type' => 'String', 'Caption' => 'GPS poloha', 'Default' => '',
|
---|
543 | 'SQL' => '(SELECT MapPosition.Pos FROM MapPosition WHERE MapPosition.Id=#Id)'),
|
---|
544 | 'Description' => array('Type' => 'String', 'Caption' => 'Popis', 'Default' => ''),
|
---|
545 | ),
|
---|
546 | 'Actions' => array(
|
---|
547 | array('Caption' => 'Frekvenční plán', 'URL' => '/network/frequency-plan/'),
|
---|
548 | ),
|
---|
549 | ));
|
---|
550 | $this->System->FormManager->RegisterClass('NetworkInterfaceUpDown', array(
|
---|
551 | 'Title' => 'Změny stavu rozhraní',
|
---|
552 | 'Table' => 'NetworkInterfaceUpDown',
|
---|
553 | 'DefaultSortColumn' => 'Time',
|
---|
554 | 'DefaultSortOrder' => 1,
|
---|
555 | 'Items' => array(
|
---|
556 | 'Time' => array('Type' => 'DateTime', 'Caption' => 'Čas', 'Default' => '', 'ReadOnly' => true),
|
---|
557 | 'Interface' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní', 'Default' => '', 'ReadOnly' => true),
|
---|
558 | 'State' => array('Type' => 'TOnlineState', 'Caption' => 'Stav', 'Default' => '', 'ReadOnly' => true),
|
---|
559 | 'Duration' => array('Type' => 'TimeDiff', 'Caption' => 'Trvání', 'Default' => '', 'ReadOnly' => true),
|
---|
560 | ),
|
---|
561 | ));
|
---|
562 | $this->System->FormManager->RegisterClass('NetworkPortUpDown', array(
|
---|
563 | 'Title' => 'Změny stavu portů',
|
---|
564 | 'Table' => 'NetworkPortUpDown',
|
---|
565 | 'DefaultSortColumn' => 'Time',
|
---|
566 | 'DefaultSortOrder' => 1,
|
---|
567 | 'Items' => array(
|
---|
568 | 'Time' => array('Type' => 'DateTime', 'Caption' => 'Čas', 'Default' => '', 'ReadOnly' => true),
|
---|
569 | 'Port' => array('Type' => 'TNetworkPort', 'Caption' => 'Port', 'Default' => '', 'ReadOnly' => true),
|
---|
570 | 'State' => array('Type' => 'TOnlineState', 'Caption' => 'Stav', 'Default' => '', 'ReadOnly' => true),
|
---|
571 | 'Duration' => array('Type' => 'TimeDiff', 'Caption' => 'Trvání', 'Default' => '', 'ReadOnly' => true),
|
---|
572 | ),
|
---|
573 | ));
|
---|
574 | $this->System->FormManager->RegisterFormType('TNetworkProtocol', array(
|
---|
575 | 'Type' => 'Enumeration',
|
---|
576 | 'States' => array('TCP', 'UDP'),
|
---|
577 | ));
|
---|
578 | $this->System->FormManager->RegisterFormType('TNetworkDevice', array(
|
---|
579 | 'Type' => 'Reference',
|
---|
580 | 'Table' => 'NetworkDevice',
|
---|
581 | 'Id' => 'Id',
|
---|
582 | 'Name' => 'Name',
|
---|
583 | 'Filter' => '1',
|
---|
584 | ));
|
---|
585 | $this->System->FormManager->RegisterFormType('TNetworkDeviceType', array(
|
---|
586 | 'Type' => 'Reference',
|
---|
587 | 'Table' => 'NetworkDeviceType',
|
---|
588 | 'Id' => 'Id',
|
---|
589 | 'Name' => 'Name',
|
---|
590 | 'Filter' => '1',
|
---|
591 | ));
|
---|
592 | $this->System->FormManager->RegisterFormType('TNetworkInterface', array(
|
---|
593 | 'Type' => 'Reference',
|
---|
594 | 'Table' => 'NetworkInterface',
|
---|
595 | 'View' => '(SELECT NetworkInterface.*, CONCAT_WS("-", NetworkDevice.Name, NULLIF(NetworkInterface.Name, "")) AS DeviceName FROM NetworkInterface '.
|
---|
596 | 'LEFT JOIN NetworkDevice ON NetworkDevice.Id = NetworkInterface.Device) AS T',
|
---|
597 | 'Id' => 'Id',
|
---|
598 | 'Name' => 'DeviceName',
|
---|
599 | 'Filter' => '1',
|
---|
600 | ));
|
---|
601 | $this->System->FormManager->RegisterFormType('TNetworkPort', array(
|
---|
602 | 'Type' => 'Reference',
|
---|
603 | 'Table' => 'NetworkPort',
|
---|
604 | 'View' => '(SELECT `NetworkPort`.*, CONCAT(CONCAT_WS("-", `NetworkDevice`.`Name`, NULLIF(`NetworkInterface`.`Name`, "")), ":", `NetworkPort`.`Number`) AS `PortName` FROM `NetworkPort` '.
|
---|
605 | 'LEFT JOIN `NetworkInterface` ON `NetworkInterface`.`Id` = `NetworkPort`.`Interface` '.
|
---|
606 | 'LEFT JOIN `NetworkDevice` ON `NetworkDevice`.`Id` = `NetworkInterface`.`Device`) AS `T`',
|
---|
607 | 'Id' => 'Id',
|
---|
608 | 'Name' => 'PortName',
|
---|
609 | 'Filter' => '1',
|
---|
610 | ));
|
---|
611 | $this->System->FormManager->RegisterFormType('TNetworkInterfaceType', array(
|
---|
612 | 'Type' => 'Reference',
|
---|
613 | 'Table' => 'NetworkInterfaceType',
|
---|
614 | 'Id' => 'Id',
|
---|
615 | 'Name' => 'Name',
|
---|
616 | 'Filter' => '1',
|
---|
617 | ));
|
---|
618 | $this->System->FormManager->RegisterFormType('TDeviceList', array(
|
---|
619 | 'Type' => 'ManyToOne',
|
---|
620 | 'Table' => 'NetworkDevice',
|
---|
621 | 'Id' => 'Id',
|
---|
622 | 'Ref' => 'Member',
|
---|
623 | 'Filter' => '1',
|
---|
624 | ));
|
---|
625 | $this->System->FormManager->RegisterFormType('TDeviceListAPI', array(
|
---|
626 | 'Type' => 'ManyToOne',
|
---|
627 | 'Table' => 'NetworkDevice',
|
---|
628 | 'Id' => 'Id',
|
---|
629 | 'Ref' => 'API',
|
---|
630 | 'Filter' => '1',
|
---|
631 | ));
|
---|
632 | $this->System->FormManager->RegisterFormType('TDevicePortListInterface', array(
|
---|
633 | 'Type' => 'ManyToOne',
|
---|
634 | 'Table' => 'NetworkPort',
|
---|
635 | 'Id' => 'Id',
|
---|
636 | 'Ref' => 'Interface',
|
---|
637 | 'Filter' => '1',
|
---|
638 | ));
|
---|
639 | $this->System->FormManager->RegisterFormType('TDeviceInterfaceLatencyListInterface', array(
|
---|
640 | 'Type' => 'ManyToOne',
|
---|
641 | 'Table' => 'NetworkInterfaceLatency',
|
---|
642 | 'Id' => 'Id',
|
---|
643 | 'Ref' => 'Interface',
|
---|
644 | 'Filter' => '1',
|
---|
645 | ));
|
---|
646 | $this->System->FormManager->RegisterFormType('TNetworkLinkType', array(
|
---|
647 | 'Type' => 'Reference',
|
---|
648 | 'Table' => 'NetworkLinkType',
|
---|
649 | 'Id' => 'Id',
|
---|
650 | 'Name' => 'Name',
|
---|
651 | 'Filter' => '1',
|
---|
652 | ));
|
---|
653 | $this->System->FormManager->RegisterFormType('TDeviceAPIType', array(
|
---|
654 | 'Type' => 'Reference',
|
---|
655 | 'Table' => 'DeviceAPIType',
|
---|
656 | 'Id' => 'Id',
|
---|
657 | 'Name' => 'Name',
|
---|
658 | 'Filter' => '1',
|
---|
659 | ));
|
---|
660 | $this->System->FormManager->RegisterFormType('TNetworkInterfaceWirelessListInterface', array(
|
---|
661 | 'Type' => 'ManyToOne',
|
---|
662 | 'Table' => 'NetworkInterfaceWireless',
|
---|
663 | 'Id' => 'Id',
|
---|
664 | 'Ref' => 'NetworkInterface',
|
---|
665 | 'Filter' => '1',
|
---|
666 | ));
|
---|
667 | $this->System->FormManager->RegisterFormType('TInterfaceList', array(
|
---|
668 | 'Type' => 'ManyToOne',
|
---|
669 | 'Table' => 'NetworkInterface',
|
---|
670 | 'Id' => 'Id',
|
---|
671 | 'Ref' => 'Device',
|
---|
672 | 'Filter' => '1',
|
---|
673 | ));
|
---|
674 | $this->System->FormManager->RegisterFormType('TDeviceLogList', array(
|
---|
675 | 'Type' => 'ManyToOne',
|
---|
676 | 'Table' => 'NetworkDeviceLog',
|
---|
677 | 'Id' => 'Id',
|
---|
678 | 'Ref' => 'Device',
|
---|
679 | 'Filter' => '1',
|
---|
680 | ));
|
---|
681 | $this->System->FormManager->RegisterFormType('TNetworkLinkListInterface', array(
|
---|
682 | 'Type' => 'ManyToOne',
|
---|
683 | 'Table' => 'NetworkLinkUnion',
|
---|
684 | 'Id' => 'Id',
|
---|
685 | 'Ref' => 'Interface',
|
---|
686 | 'Filter' => '1',
|
---|
687 | ));
|
---|
688 | $this->System->FormManager->RegisterFormType('TNetworkLinkListInterface1', array(
|
---|
689 | 'Type' => 'ManyToOne',
|
---|
690 | 'Table' => 'NetworkLink',
|
---|
691 | 'Id' => 'Id',
|
---|
692 | 'Ref' => 'Interface1',
|
---|
693 | 'Filter' => '1',
|
---|
694 | ));
|
---|
695 | $this->System->FormManager->RegisterFormType('TNetworkLinkListInterface2', array(
|
---|
696 | 'Type' => 'ManyToOne',
|
---|
697 | 'Table' => 'NetworkLink',
|
---|
698 | 'Id' => 'Id',
|
---|
699 | 'Ref' => 'Interface2',
|
---|
700 | 'Filter' => '1',
|
---|
701 | ));
|
---|
702 | $this->System->FormManager->RegisterFormType('TNetworkInterfaceUpDown', array(
|
---|
703 | 'Type' => 'ManyToOne',
|
---|
704 | 'Table' => 'NetworkInterfaceUpDown',
|
---|
705 | 'Id' => 'Id',
|
---|
706 | 'Ref' => 'Interface',
|
---|
707 | 'Filter' => '1',
|
---|
708 | ));
|
---|
709 | $this->System->FormManager->RegisterFormType('TNetworkPortUpDown', array(
|
---|
710 | 'Type' => 'ManyToOne',
|
---|
711 | 'Table' => 'NetworkPortUpDown',
|
---|
712 | 'Id' => 'Id',
|
---|
713 | 'Ref' => 'Port',
|
---|
714 | 'Filter' => '1',
|
---|
715 | ));
|
---|
716 |
|
---|
717 | $this->System->ModuleManager->Modules['IS']->RegisterDashboardItem('Network',
|
---|
718 | array('ModuleNetwork', 'ShowDashboardItem'));
|
---|
719 |
|
---|
720 | $this->System->RegisterModel('NetworkDevice', array(
|
---|
721 | 'Title' => 'Síťové zařízení',
|
---|
722 | ));
|
---|
723 | $this->System->RegisterModel('NetworkInterface', array(
|
---|
724 | 'Title' => 'Síťové rozhraní',
|
---|
725 | ));
|
---|
726 | }
|
---|
727 |
|
---|
728 | function AfterInsertNetworkDevice($Form)
|
---|
729 | {
|
---|
730 | $this->System->Models['NetworkDevice']->DoOnChange();
|
---|
731 | }
|
---|
732 |
|
---|
733 | function AfterModifyNetworkDevice($Form, $Id)
|
---|
734 | {
|
---|
735 | $this->System->Models['NetworkDevice']->DoOnChange();
|
---|
736 | }
|
---|
737 |
|
---|
738 | function AfterInsertNetworkInterface($Form)
|
---|
739 | {
|
---|
740 | $this->System->Models['NetworkInterface']->DoOnChange();
|
---|
741 | }
|
---|
742 |
|
---|
743 | function AfterModifyNetworkInterface($Form, $Id)
|
---|
744 | {
|
---|
745 | $this->System->Models['NetworkInterface']->DoOnChange();
|
---|
746 | }
|
---|
747 |
|
---|
748 | function BeforeDeleteNetworkInterface($Form, $Id)
|
---|
749 | {
|
---|
750 | $this->Database->query('DELETE FROM `NetworkInterfaceUpDown` WHERE `Interface`='.$Id);
|
---|
751 | $this->Database->query('DELETE FROM `NetworkLink` WHERE `Interface1`='.$Id.' OR `Interface2`='.$Id);
|
---|
752 | $this->Database->query('DELETE FROM `NetworkPort` WHERE `Interface`='.$Id);
|
---|
753 | $this->Database->query('DELETE FROM `NetworkSignal` WHERE `Interface`='.$Id);
|
---|
754 | $this->Database->query('DELETE FROM `NetworkInterfaceWireless` WHERE `NetworkInterface`='.$Id);
|
---|
755 | $this->Database->query('DELETE FROM `NetworkInterfaceLatency` WHERE `Interface`='.$Id);
|
---|
756 | }
|
---|
757 |
|
---|
758 | function ImportNetworkLog($Parameters)
|
---|
759 | {
|
---|
760 | global $Config;
|
---|
761 |
|
---|
762 | $DbResult = $this->System->Database->select('NetworkDeviceLog', 'Time',
|
---|
763 | '1 ORDER BY Time DESC LIMIT 1');
|
---|
764 | if ($DbResult->num_rows > 0)
|
---|
765 | {
|
---|
766 | $DbRow = $DbResult->fetch_assoc();
|
---|
767 | $WhereTime = ' AND (`Time` > "'.$DbRow['Time'].'")';
|
---|
768 | } else $WhereTime = '';
|
---|
769 |
|
---|
770 | $RemoteDb = new Database();
|
---|
771 | $RemoteDb->Connect($Config['NetworkLog']['Host'], $Config['NetworkLog']['User'],
|
---|
772 | $Config['NetworkLog']['Password'], $Config['NetworkLog']['Database']);
|
---|
773 | $DbResult = $RemoteDb->select('SystemEvents', '*', '`ReceivedAt`>"'. TimeToMysqlDate($StartTime).'"'.$WhereTime.' ORDER BY `Time` DESC');
|
---|
774 | while ($DbRow = $DbResult->fetch_array())
|
---|
775 | {
|
---|
776 | $DbResult2 = $this->System->Database->select('NetworkInterface', 'Device, CONCAT(CONCAT_WS("-", `NetworkDevice`.`Name`, NULLIF(`NetworkInterface`.`Name`, "")), ".") AS `Name` ', '`Name` LIKE "'.$DbRow['FromHost'].'"');
|
---|
777 | if ($DbResult2->num_rows > 0)
|
---|
778 | {
|
---|
779 | $DbRow2 = $DbResult2->fetch_assoc();
|
---|
780 | $DeviceID = $DbRow2['Device'];
|
---|
781 | $this->System->Database->insert('NetworkDeviceLog', array('Time' => $DbRow['ReceivedAt'],
|
---|
782 | 'Device' => $DeviceId, 'Message' => $DbRow['Message'], 'Tags' => $DbRow['SysLogTag']));
|
---|
783 | } else echo('Host '.$DbRow['Host'].' not paired with network device.'."\n");
|
---|
784 | }
|
---|
785 | }
|
---|
786 |
|
---|
787 | function ShowDashboardItem()
|
---|
788 | {
|
---|
789 | $Output = '';
|
---|
790 | $DbResult = $this->Database->select('NetworkDevice', 'COUNT(*)', '1');
|
---|
791 | $DbRow = $DbResult->fetch_row();
|
---|
792 | $Output .= 'Síťových zařízení: registrovaných:'.$DbRow['0'];
|
---|
793 |
|
---|
794 | $DbResult = $this->Database->select('NetworkDevice', 'COUNT(*)', '`Used`=1');
|
---|
795 | $DbRow = $DbResult->fetch_row();
|
---|
796 | $Output .= ' použitých:'.$DbRow['0'].'<br>';
|
---|
797 |
|
---|
798 | $DbResult = $this->Database->select('NetworkInterface', 'COUNT(*)', '1');
|
---|
799 | $DbRow = $DbResult->fetch_row();
|
---|
800 | $Output .= 'Síťových rozhraní: '.$DbRow['0'].'<br>';
|
---|
801 |
|
---|
802 | $DbResult = $this->Database->select('NetworkSubnet', 'COUNT(*)', '1');
|
---|
803 | $DbRow = $DbResult->fetch_row();
|
---|
804 | $Output .= 'Síťových podsítí: '.$DbRow['0'].'<br/>';
|
---|
805 | return $Output;
|
---|
806 | }
|
---|
807 |
|
---|
808 | function DoStop()
|
---|
809 | {
|
---|
810 | }
|
---|
811 |
|
---|
812 | function OnlineList($Title, $OnlineNow, $OnlinePrevious, $MinDuration)
|
---|
813 | {
|
---|
814 | $Time = time();
|
---|
815 | $OnlineText = array('<span style="color:red;">Nedostupný</span>', '<span style="color:green;">Dostupný</span>');
|
---|
816 | $Output = '';
|
---|
817 | $Condition = 'WHERE (`NetworkInterface`.`LastOnline` <= "'.TimeToMysqlDateTime($Time - $MinDuration).'")';
|
---|
818 | echo($OnlineNow);
|
---|
819 | if ($OnlineNow >= 0) $Condition .= ' AND (`NetworkInterface`.`Online` = '.$OnlineNow.')';
|
---|
820 | echo($OnlinePrevious);
|
---|
821 | if ($OnlinePrevious >= 0) $Condition .= ' AND (`NetworkInterface`.`OnlineNotify` = '.$OnlinePrevious.')';
|
---|
822 | echo($Condition."\n");
|
---|
823 | $DbResult3 = $this->Database->query('SELECT CONCAT_WS("-", `NetworkDevice`.`Name`, NULLIF(`NetworkInterface`.`Name`, "")) AS `Name`, '.
|
---|
824 | '`NetworkInterface`.`Online`, `NetworkInterface`.`LastOnline` FROM `NetworkInterface` '.
|
---|
825 | 'LEFT JOIN `NetworkDevice` ON `NetworkDevice`.`Id` = `NetworkInterface`.`Device` '.
|
---|
826 | $Condition.' AND (`NetworkDevice`.`PermanentOnline`=1) AND (`NetworkDevice`.`Used`=1) AND '.
|
---|
827 | '(`NetworkInterface`.`LocalIP` != "") AND (`NetworkInterface`.`Enabled`=1)'.
|
---|
828 | 'ORDER BY `Name` ASC');
|
---|
829 | if($DbResult3->num_rows > 0)
|
---|
830 | {
|
---|
831 | $Output .= $Title.'<br/>';
|
---|
832 | $Output .= '<table>'.
|
---|
833 | '<tr><th align="center">Jméno</th><th align="center">Stav</th><th align="center">Čas</th><th align="center">Trvání</th></tr>'."\n";
|
---|
834 | while($Item = $DbResult3->fetch_assoc())
|
---|
835 | {
|
---|
836 | $Duration = $Time - MysqlDateTimeToTime($Item['LastOnline']);
|
---|
837 | $DurationText = sprintf('%02d', floor($Duration / 3600 % 24)).':'.
|
---|
838 | sprintf('%02d', floor($Duration / 60 % 60)).':'.
|
---|
839 | sprintf('%02d', floor($Duration % 60));
|
---|
840 | $Days = floor($Duration / (60 * 60 * 24));
|
---|
841 | if($Days > 0) $DurationText = $Days.' dnů '.$DurationText;
|
---|
842 |
|
---|
843 | $Output .= '<tr><td>'.$Item['Name'].'</td><td>'.$OnlineText[$Item['Online']].
|
---|
844 | '</td><td>'.$Item['LastOnline'].'</td><td>'.$DurationText.'</td></tr>'."\n";
|
---|
845 | }
|
---|
846 | $Output .= '</table><br/>'."\n";
|
---|
847 | }
|
---|
848 | $this->Database->query('UPDATE `NetworkInterface` SET `OnlineNotify` = `Online` '.
|
---|
849 | $Condition);
|
---|
850 | return array('Report' => $Output, 'Count' => $DbResult3->num_rows);
|
---|
851 | }
|
---|
852 |
|
---|
853 | function ReachabilityCheck()
|
---|
854 | {
|
---|
855 | $NewOnline = $this->OnlineList('Nově online', 1, 0, 0);
|
---|
856 | $Output = $NewOnline['Report'];
|
---|
857 | $NewOffline = $this->OnlineList('Nově offline', 0, 1, $this->MinNotifyTime);
|
---|
858 | $Output .= $NewOffline['Report'];
|
---|
859 | $StillOffline = $this->OnlineList('Stále offline', 0, 0, 0);
|
---|
860 | $Output .= $StillOffline['Report'];
|
---|
861 | $Offline = $this->OnlineList('Offline', 0, -1, 0);
|
---|
862 | return(array('Report' => $Output, 'Count' => $Offline['Count'], 'ShortTitle' => 'Odezva'));
|
---|
863 | }
|
---|
864 |
|
---|
865 | function PortCheckList($Title, $OnlineNow, $OnlinePrevious, $MinDuration)
|
---|
866 | {
|
---|
867 | $Time = time();
|
---|
868 | $OnlineText = array('<span style="color:red;">Nedostupný</span>', '<span style="color:green;">Dostupný</span>');
|
---|
869 | $Output = '';
|
---|
870 | $Condition = 'WHERE (`NetworkPort`.`LastOnline` <= "'.TimeToMysqlDateTime($Time - $MinDuration).'")';
|
---|
871 | if ($OnlineNow >= null) $Condition .= ' AND (`NetworkPort`.`Online` = '.$OnlineNow.')';
|
---|
872 | if ($OnlinePrevious >= null) $Condition .= ' AND (`NetworkPort`.`OnlineNotify` = '.$OnlinePrevious.')';
|
---|
873 | $DbResult3 = $this->Database->query('SELECT CONCAT(CONCAT_WS("-", `NetworkDevice`.`Name`, NULLIF(`NetworkInterface`.`Name`, "")), ":", `NetworkPort`.`Number`, "(", `NetworkPort`.`Name`, ")") AS `Name`, '.
|
---|
874 | '`NetworkPort`.`Online`, `NetworkPort`.`LastOnline` FROM `NetworkPort` '.
|
---|
875 | 'LEFT JOIN `NetworkInterface` ON `NetworkInterface`.`Id` = `NetworkPort`.`Interface` '.
|
---|
876 | 'LEFT JOIN `NetworkDevice` ON `NetworkDevice`.`Id` = `NetworkInterface`.`Device` '.
|
---|
877 | $Condition.' AND (`NetworkDevice`.`PermanentOnline`=1) AND (`NetworkDevice`.`Used`=1) AND '.
|
---|
878 | '(`NetworkInterface`.`LocalIP` != "") AND (`NetworkPort`.`Enabled` = 1)'.
|
---|
879 | 'ORDER BY `Name` ASC');
|
---|
880 | if ($DbResult3->num_rows > 0)
|
---|
881 | {
|
---|
882 | $Output .= $Title.'<br/>';
|
---|
883 | $Output .= '<table>'.
|
---|
884 | '<tr><th align="center">Jméno</th><th align="center">Stav</th><th align="center">Čas</th><th align="center">Trvání</th></tr>'."\n";
|
---|
885 | while($Item = $DbResult3->fetch_assoc())
|
---|
886 | {
|
---|
887 | $Duration = $Time - MysqlDateTimeToTime($Item['LastOnline']);
|
---|
888 | $DurationText = sprintf('%02d', floor($Duration / 3600 % 24)).':'.
|
---|
889 | sprintf('%02d', floor($Duration / 60 % 60)).':'.
|
---|
890 | sprintf('%02d', floor($Duration % 60));
|
---|
891 | $Days = floor($Duration / (60 * 60 * 24));
|
---|
892 | if($Days > 0) $DurationText = $Days.' dnů '.$DurationText;
|
---|
893 |
|
---|
894 | $Output .= '<tr><td>'.$Item['Name'].'</td><td>'.$OnlineText[$Item['Online']].
|
---|
895 | '</td><td>'.$Item['LastOnline'].'</td><td>'.$DurationText.'</td></tr>'."\n";
|
---|
896 | }
|
---|
897 | $Output .= '</table><br/>'."\n";
|
---|
898 | }
|
---|
899 | $this->Database->query('UPDATE `NetworkPort` SET `OnlineNotify` = `Online` '.
|
---|
900 | $Condition);
|
---|
901 | return array('Report' => $Output, 'Count' => $DbResult3->num_rows);
|
---|
902 | }
|
---|
903 |
|
---|
904 | function PortCheck()
|
---|
905 | {
|
---|
906 | $Output = '';
|
---|
907 | $NewOnline = $this->PortCheckList('Nově online', 1, 0, 0);
|
---|
908 | $Output .= $NewOnline['Report'];
|
---|
909 | $NewOffline = $this->PortCheckList('Nově offline', 0, 1, $this->MinNotifyTime);
|
---|
910 | $Output .= $NewOffline['Report'];
|
---|
911 | $StillOffline = $this->PortCheckList('Stále offline', 0, 0, 0);
|
---|
912 | $Output .= $StillOffline['Report'];
|
---|
913 | $Offline = $this->PortCheckList('Offline', 0, -1, 0);
|
---|
914 | return(array('Report' => $Output, 'Count' => $Offline['Count'], 'ShortTitle' => 'Port'));
|
---|
915 | }
|
---|
916 | }
|
---|