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 |
|
---|
136 | $this->System->RegisterPage('network', 'PageNetwork');
|
---|
137 | $this->System->RegisterPage(array('network', 'administration'), 'PageNetworkAdministration');
|
---|
138 | $this->System->RegisterPage(array('network', 'subnet'), 'PageSubnet');
|
---|
139 | $this->System->RegisterPage(array('network', 'user-hosts'), 'PageNetworkHostList');
|
---|
140 | $this->System->RegisterPage(array('network', 'hosting'),'PageHosting');
|
---|
141 | $this->System->RegisterPage(array('network', 'hosts'), 'PageHostList');
|
---|
142 | $this->System->RegisterPage(array('network', 'frequency-plan'), 'PageFrequencyPlan');
|
---|
143 |
|
---|
144 | $this->System->FormManager->RegisterClass('NetworkDomainAlias', array(
|
---|
145 | 'Title' => 'Alias domény',
|
---|
146 | 'Table' => 'NetworkDomainAlias',
|
---|
147 | 'Items' => array(
|
---|
148 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
---|
149 | 'Target' => array('Type' => 'String', 'Caption' => 'Cíl', 'Default' => ''),
|
---|
150 | 'Comment' => array('Type' => 'String', 'Caption' => 'Komentář', 'Default' => ''),
|
---|
151 | 'Domain' => array('Type' => 'TNetworkDomain', 'Caption' => 'Síťová doména', 'Default' => ''),
|
---|
152 | ),
|
---|
153 | ));
|
---|
154 | $this->System->FormManager->RegisterFormType('TNetworkDomainAliasListDomain', array(
|
---|
155 | 'Type' => 'ManyToOne',
|
---|
156 | 'Table' => 'NetworkDomainAlias',
|
---|
157 | 'Id' => 'Id',
|
---|
158 | 'Ref' => 'Domain',
|
---|
159 | 'Filter' => '1',
|
---|
160 | ));
|
---|
161 | $this->System->FormManager->RegisterClass('NetworkDevice', array(
|
---|
162 | 'Title' => 'Síťové zařízení',
|
---|
163 | 'Table' => 'NetworkDevice',
|
---|
164 | 'Items' => array(
|
---|
165 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
---|
166 | 'Type' => array('Type' => 'TNetworkDeviceType', 'Caption' => 'Typ', 'Default' => '0'),
|
---|
167 | 'Member' => array('Type' => 'TMember', 'Caption' => 'Zákazník', 'Default' => '0'),
|
---|
168 | 'Location' => array('Type' => 'TMember', 'Caption' => 'Umístění', 'Default' => '0'),
|
---|
169 | 'Service' => array('Type' => 'TServiceCustomerRel', 'Caption' => 'Služba', 'Default' => '', 'Null' => true),
|
---|
170 | 'Used' => array('Type' => 'Boolean', 'Caption' => 'Použito', 'Default' => '1'),
|
---|
171 | 'Online' => array('Type' => 'TOnlineState', 'Caption' => 'Běží', 'Default' => '0', 'ReadOnly' => true),
|
---|
172 | 'LastOnline' => array('Type' => 'DateTime', 'Caption' => 'Naposledy běželo', 'Default' => '', 'ReadOnly' => true),
|
---|
173 | 'PermanentOnline' => array('Type' => 'Boolean', 'Caption' => 'Běží stále', 'Default' => '0'),
|
---|
174 | 'Interfaces' => array('Type' => 'TInterfaceList', 'Caption' => 'Rozhraní', 'Default' => ''),
|
---|
175 | 'MapPosition' => array('Type' => 'TMapPosition', 'Caption' => 'Pozice na mapě', 'Default' => '0', 'Null' => true),
|
---|
176 | 'Product' => array('Type' => 'TProduct', 'Caption' => 'Produkt', 'Default' => '', 'Null' => true),
|
---|
177 | 'LoginName' => array('Type' => 'String', 'Caption' => 'Přihlašovací jméno', 'Default' => '', 'Null' => true, 'NotInList' => true),
|
---|
178 | 'LoginPassword' => array('Type' => 'String', 'Caption' => 'Přihlašovací heslo', 'Default' => '', 'Null' => true, 'NotInList' => true),
|
---|
179 | 'API' => array('Type' => 'TDeviceAPIType', 'Caption' => 'API', 'Default' => '', 'Null' => true),
|
---|
180 | ),
|
---|
181 | 'AfterInsert' => array($this, 'AfterInsertNetworkDevice'),
|
---|
182 | 'AfterModify' => array($this, 'AfterModifyNetworkDevice'),
|
---|
183 | 'AfterDelete' => array($this, 'AfterModifyNetworkDevice'),
|
---|
184 | ));
|
---|
185 | $this->System->FormManager->RegisterClass('NetworkDeviceType', array(
|
---|
186 | 'Title' => 'Typ síťového zařízení',
|
---|
187 | 'Table' => 'NetworkDeviceType',
|
---|
188 | 'Items' => array(
|
---|
189 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
---|
190 | 'ShowOnline' => array('Type' => 'Boolean', 'Caption' => 'Ukázat online', 'Default' => '0'),
|
---|
191 | 'IconName' => array('Type' => 'String', 'Caption' => 'Jméno ikony', 'Default' => '0'),
|
---|
192 | ),
|
---|
193 | ));
|
---|
194 | $this->System->FormManager->RegisterClass('NetworkInterface', array(
|
---|
195 | 'Title' => 'Síťové rozhraní',
|
---|
196 | 'Table' => 'NetworkInterface',
|
---|
197 | 'Items' => array(
|
---|
198 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
---|
199 | 'Type' => array('Type' => 'TNetworkInterfaceType', 'Caption' => 'Typ', 'Default' => '0'),
|
---|
200 | 'MAC' => array('Type' => 'MacAddress', 'Caption' => 'Fyzická adresa (MAC)', 'Default' => ''),
|
---|
201 | 'LocalIP' => array('Type' => 'IPv4Address', 'Caption' => 'IPv4', 'Default' => '', 'Null' => true),
|
---|
202 | 'IPv6' => array('Type' => 'IPv6Address', 'Caption' => 'IPv6', 'Default' => '', 'Null' => true),
|
---|
203 | 'ExternalIP' => array('Type' => 'IPv4Address', 'Caption' => 'Veřejná IPv4', 'Default' => '', 'Null' => true),
|
---|
204 | 'Device' => array('Type' => 'TNetworkDevice', 'Caption' => 'Zařízení', 'Default' => ''),
|
---|
205 | 'Enabled' => array('Type' => 'Boolean', 'Caption' => 'Povoleno', 'Default' => '1'),
|
---|
206 | 'Online' => array('Type' => 'TOnlineState', 'Caption' => 'Běží', 'Default' => '0', 'ReadOnly' => true),
|
---|
207 | 'LastOnline' => array('Type' => 'DateTime', 'Caption' => 'Naposledy běželo', 'Default' => '', 'ReadOnly' => true),
|
---|
208 | 'Links' => array('Type' => 'TNetworkLinkListInterface', 'Caption' => 'Propojení', 'Default' => ''),
|
---|
209 | 'UpDown' => array('Type' => 'TNetworkInterfaceUpDown', 'Caption' => 'Změny stavu', 'Default' => ''),
|
---|
210 | 'Signal' => array('Type' => 'TNetworkSignalListInterface', 'Caption' => 'Signál', 'Default' => ''),
|
---|
211 | 'Wireless' => array('Type' => 'TNetworkInterfaceWirelessListInterface', 'Caption' => 'Bezdrátové spoje', 'Default' => ''),
|
---|
212 | 'Ports' => array('Type' => 'TDevicePortListInterface', 'Caption' => 'Síťové porty', 'Default' => ''),
|
---|
213 | 'Latency' => array('Type' => 'TDeviceInterfaceLatencyListInterface', 'Caption' => 'Síťová odezva', 'Default' => ''),
|
---|
214 | ),
|
---|
215 | 'AfterInsert' => array($this, 'AfterInsertNetworkInterface'),
|
---|
216 | 'AfterModify' => array($this, 'AfterModifyNetworkInterface'),
|
---|
217 | 'BeforeDelete' => array($this, 'BeforeDeleteNetworkInterface'),
|
---|
218 | 'AfterDelete' => array($this, 'AfterModifyNetworkInterface'),
|
---|
219 | ));
|
---|
220 | $this->System->FormManager->RegisterClass('NetworkInterfaceType', array(
|
---|
221 | 'Title' => 'Typ síťového rozhraní',
|
---|
222 | 'Table' => 'NetworkInterfaceType',
|
---|
223 | 'Items' => array(
|
---|
224 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
---|
225 | 'MaxSpeed' => array('Type' => 'Integer', 'Caption' => 'Max. rychlost', 'Default' => '0', 'Suffix' => 'Mbit/s'),
|
---|
226 | 'FullDuplex' => array('Type' => 'Boolean', 'Caption' => 'Plně duplexní', 'Default' => '0'),
|
---|
227 | 'Color' => array('Type' => 'Color', 'Caption' => 'Barva', 'Default' => '0'),
|
---|
228 | ),
|
---|
229 | ));
|
---|
230 | $this->System->FormManager->RegisterClass('NetworkSubnet', array(
|
---|
231 | 'Title' => 'Podsítě',
|
---|
232 | 'DefaultSortColumn' => 'Name',
|
---|
233 | 'Table' => 'NetworkSubnet',
|
---|
234 | 'Items' => array(
|
---|
235 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
---|
236 | 'AddressRange' => array('Type' => 'String', 'Caption' => 'Rozsah adres', 'Default' => ''),
|
---|
237 | 'Mask' => array('Type' => 'Integer', 'Caption' => 'Prefix', 'Default' => ''),
|
---|
238 | 'DHCP' => array('Type' => 'IPv4Address', 'Caption' => 'DHCP', 'Default' => ''),
|
---|
239 | 'Gateway' => array('Type' => 'IPv4Address', 'Caption' => 'Brána', 'Default' => ''),
|
---|
240 | 'WINS' => array('Type' => 'IPv4Address', 'Caption' => 'WINS', 'Default' => ''),
|
---|
241 | 'DNS' => array('Type' => 'String', 'Caption' => 'DNS', 'Default' => ''),
|
---|
242 | 'Domain' => array('Type' => 'String', 'Caption' => 'Doména', 'Default' => ''),
|
---|
243 | 'NTP' => array('Type' => 'String', 'Caption' => 'NTP', 'Default' => ''),
|
---|
244 | 'Member' => array('Type' => 'TMember', 'Caption' => 'Zákazník', 'Default' => '', 'Null' => true),
|
---|
245 | 'ExtAddressRange' => array('Type' => 'String', 'Caption' => 'Vnější rozsah adres', 'Default' => ''),
|
---|
246 | 'ExtMask' => array('Type' => 'String', 'Caption' => 'Vnější prefix', 'Default' => ''),
|
---|
247 | 'AddressRangeIPv6' => array('Type' => 'String', 'Caption' => 'Rozsah adres IPv6', 'Default' => ''),
|
---|
248 | 'Configure' => array('Type' => 'Boolean', 'Caption' => 'Nastavovat', 'Default' => ''),
|
---|
249 | 'Interfaces' => array('Type' => 'TNetworkSubnetInterfaceList', 'Caption' => 'Rozhraní', 'Default' => ''),
|
---|
250 | ),
|
---|
251 | ));
|
---|
252 | $this->System->FormManager->RegisterFormType('TNetworkSubnetInterfaceList', array(
|
---|
253 | 'Type' => 'ManyToOne',
|
---|
254 | 'Table' => 'NetworkInterface',
|
---|
255 | 'Id' => 'Id',
|
---|
256 | 'Ref' => null,
|
---|
257 | 'Filter' => '(`TX`.`LocalIP` != "") AND CompareNetworkPrefix(INET_ATON(`TX`.`LocalIP`), INET_ATON((SELECT `NetworkSubnet`.`AddressRange` FROM `NetworkSubnet` WHERE `NetworkSubnet`.`Id`=#Id)), '.
|
---|
258 | '(SELECT `NetworkSubnet`.`Mask` FROM `NetworkSubnet` WHERE `NetworkSubnet`.`Id`=#Id))',
|
---|
259 | ));
|
---|
260 | $this->System->FormManager->RegisterClass('NetworkPort', array(
|
---|
261 | 'Title' => 'Síťový port',
|
---|
262 | 'Table' => 'NetworkPort',
|
---|
263 | 'Items' => array(
|
---|
264 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
---|
265 | 'Protocol' => array('Type' => 'TNetworkProtocol', 'Caption' => 'Protokol', 'Default' => '0'),
|
---|
266 | 'Number' => array('Type' => 'Integer', 'Caption' => 'Číslo', 'Default' => ''),
|
---|
267 | 'Interface' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní', 'Default' => ''),
|
---|
268 | 'Enabled' => array('Type' => 'Boolean', 'Caption' => 'Povoleno', 'Default' => '1'),
|
---|
269 | 'Online' => array('Type' => 'TOnlineState', 'Caption' => 'Běží', 'Default' => '0', 'ReadOnly' => true),
|
---|
270 | 'LastOnline' => array('Type' => 'DateTime', 'Caption' => 'Naposledy běželo', 'Default' => '', 'ReadOnly' => true),
|
---|
271 | 'UpDown' => array('Type' => 'TNetworkPortUpDown', 'Caption' => 'Změny stavu', 'Default' => ''),
|
---|
272 | ),
|
---|
273 | ));
|
---|
274 | $this->System->FormManager->RegisterClass('NetworkInterfaceLatency', array(
|
---|
275 | 'Title' => 'Síťová odezva',
|
---|
276 | 'Table' => 'NetworkInterfaceLatency',
|
---|
277 | 'DefaultSortColumn' => 'Time',
|
---|
278 | 'DefaultSortOrder' => 1,
|
---|
279 | 'Items' => array(
|
---|
280 | 'Time' => array('Type' => 'DateTime', 'Caption' => 'Čas', 'Default' => ''),
|
---|
281 | 'Interface' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní', 'Default' => ''),
|
---|
282 | 'Value' => array('Type' => 'Float', 'Caption' => 'Hodnota', 'Default' => '0', 'Suffix' => 'ms'),
|
---|
283 | ),
|
---|
284 | ));
|
---|
285 | $this->System->FormManager->RegisterClass('NetworkLink', array(
|
---|
286 | 'Title' => 'Síťové propojení',
|
---|
287 | 'Table' => 'NetworkLink',
|
---|
288 | 'Items' => array(
|
---|
289 | 'Type' => array('Type' => 'TNetworkLinkType', 'Caption' => 'Typ', 'Default' => '1'),
|
---|
290 | 'Interface1' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní 1', 'Default' => ''),
|
---|
291 | 'Interface2' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní 2', 'Default' => ''),
|
---|
292 | ),
|
---|
293 | ));
|
---|
294 | $this->System->FormManager->RegisterClass('NetworkLinkUnion', array(
|
---|
295 | 'Title' => 'Síťové propojení',
|
---|
296 | 'BaseTable' => 'NetworkLink',
|
---|
297 | 'SQL' => '(SELECT `Id`, `Type`, `Interface1` AS `Interface`, `Interface2` AS `InterfaceOther` FROM `NetworkLink`) '.
|
---|
298 | 'UNION (SELECT `Id`, `Type`, `Interface2` AS `Interface`, `Interface1` AS `InterfaceOther` FROM `NetworkLink`)',
|
---|
299 | 'Items' => array(
|
---|
300 | 'Type' => array('Type' => 'TNetworkLinkType', 'Caption' => 'Typ', 'Default' => '1', 'ReadOnly' => true),
|
---|
301 | 'Interface' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní 1', 'Default' => '', 'ReadOnly' => true),
|
---|
302 | 'InterfaceOther' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní 2', 'Default' => '', 'ReadOnly' => true),
|
---|
303 | ),
|
---|
304 | ));
|
---|
305 |
|
---|
306 | $this->System->FormManager->RegisterClass('NetworkLinkType', array(
|
---|
307 | 'Title' => 'Typ síťového propojení',
|
---|
308 | 'Table' => 'NetworkLinkType',
|
---|
309 | 'Items' => array(
|
---|
310 | 'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
|
---|
311 | 'MaxLinkSpeed' => array('Type' => 'Integer', 'Caption' => 'Maximální spojová rychlost', 'Default' => '0', 'Suffix' => 'bits/s'),
|
---|
312 | 'MaxRealSpeed' => array('Type' => 'Integer', 'Caption' => 'Maximální reálná rychlost', 'Default' => '0', 'Suffix' => 'bits/s'),
|
---|
313 | 'FullDuplex' => array('Type' => 'Boolean', 'Caption' => 'Plně duplexní', 'Default' => '0'),
|
---|
314 | 'Color' => array('Type' => 'Color', 'Caption' => 'Barva', 'Default' => '0'),
|
---|
315 | ),
|
---|
316 | ));
|
---|
317 | $this->System->FormManager->RegisterClass('NetworkSignal', array(
|
---|
318 | 'Title' => 'Signál rozhraní',
|
---|
319 | 'Table' => 'NetworkSignal',
|
---|
320 | 'DefaultSortColumn' => 'Time',
|
---|
321 | 'DefaultSortOrder' => 1,
|
---|
322 | 'Items' => array(
|
---|
323 | 'Time' => array('Type' => 'DateTime', 'Caption' => 'Čas', 'Default' => ''),
|
---|
324 | 'MAC' => array('Type' => 'MacAddress', 'Caption' => 'Fyzická adresa (MAC)', 'Default' => ''),
|
---|
325 | 'Interface' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní', 'Default' => '', 'Null' => true),
|
---|
326 | 'Value' => array('Type' => 'Integer', 'Caption' => 'Signál', 'Default' => '0', 'Suffix' => 'dBm'),
|
---|
327 | 'RateRx' => array('Type' => 'Integer', 'Caption' => 'Rychlost Rx', 'Default' => '0', 'Suffix' => 'MHz'),
|
---|
328 | 'RateTx' => array('Type' => 'Integer', 'Caption' => 'Rychlost Tx', 'Default' => '0', 'Suffix' => 'MHz'),
|
---|
329 | 'Device' => array('Type' => 'TNetworkDevice', 'Caption' => 'Měřeno z', 'Default' => '0'),
|
---|
330 | ),
|
---|
331 | ));
|
---|
332 | $this->System->FormManager->RegisterClass('NetworkAddressCategory', array(
|
---|
333 | 'Title' => 'Kategorie síťové adresy',
|
---|
334 | 'Table' => 'NetworkAddressCategory',
|
---|
335 | 'DefaultSortColumn' => 'Name',
|
---|
336 | 'DefaultSortOrder' => 1,
|
---|
337 | 'Items' => array(
|
---|
338 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
---|
339 | ),
|
---|
340 | ));
|
---|
341 | $this->System->FormManager->RegisterFormType('TNetworkAddressCategory', array(
|
---|
342 | 'Type' => 'Reference',
|
---|
343 | 'Table' => 'NetworkAddressCategory',
|
---|
344 | 'Id' => 'Id',
|
---|
345 | 'Name' => 'Name',
|
---|
346 | 'Filter' => '1',
|
---|
347 | ));
|
---|
348 | $this->System->FormManager->RegisterClass('NetworkDeviceConfig', array(
|
---|
349 | 'Title' => 'Nastavení zařízení',
|
---|
350 | 'Table' => 'NetworkDeviceConfig',
|
---|
351 | 'DefaultSortColumn' => 'Time',
|
---|
352 | 'DefaultSortOrder' => 1,
|
---|
353 | 'Items' => array(
|
---|
354 | 'Device' => array('Type' => 'TNetworkDevice', 'Caption' => 'Zařízení', 'Default' => ''),
|
---|
355 | 'Time' => array('Type' => 'Date', 'Caption' => 'Čas vytvoření', 'Default' => ''),
|
---|
356 | 'ConfigFull' => array('Type' => 'Text', 'Caption' => 'Kompletní nastavení', 'Default' => ''),
|
---|
357 | 'ConfigCompact' => array('Type' => 'Text', 'Caption' => 'Rozdílové nastavení', 'Default' => ''),
|
---|
358 | ),
|
---|
359 | ));
|
---|
360 | $this->System->FormManager->RegisterClass('NetworkDomain', array(
|
---|
361 | 'Title' => 'Síťová doména',
|
---|
362 | 'Table' => 'NetworkDomain',
|
---|
363 | 'DefaultSortColumn' => 'Name',
|
---|
364 | 'DefaultSortOrder' => 1,
|
---|
365 | 'Items' => array(
|
---|
366 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
---|
367 | 'Parent' => array('Type' => 'TNetworkDomain', 'Caption' => 'Nadřazená doména', 'Default' => '', 'Null' => true),
|
---|
368 | 'Description' => array('Type' => 'String', 'Caption' => 'Popis', 'Default' => ''),
|
---|
369 | 'Serial' => array('Type' => 'Integer', 'Caption' => 'Sériové číslo', 'Default' => '1'),
|
---|
370 | 'Minimum' => array('Type' => 'Integer', 'Caption' => 'Minimum', 'Default' => '10800'),
|
---|
371 | 'Retry' => array('Type' => 'Integer', 'Caption' => 'Opakování', 'Default' => '7200'),
|
---|
372 | 'Expire' => array('Type' => 'Integer', 'Caption' => 'Čas vypršení', 'Default' => '2419200'),
|
---|
373 | 'Refresh' => array('Type' => 'Integer', 'Caption' => 'Obnovení', 'Default' => '28800'),
|
---|
374 | 'TTL' => array('Type' => 'Integer', 'Caption' => 'TTL', 'Default' => '86400', 'Suffix' => 'sekund'),
|
---|
375 | 'Servers' => array('Type' => 'TNetworkDomainServerList', 'Caption' => 'Servery', 'Default' => ''),
|
---|
376 | 'Views' => array('Type' => 'TNetworkDomainViewListDomain', 'Caption' => 'Pohledy', 'Default' => ''),
|
---|
377 | 'ItemFilters' => array('Type' => 'TNetworkDomainItemFilterListDomain', 'Caption' => 'Filtry položek', 'Default' => ''),
|
---|
378 | 'Aliases' => array('Type' => 'TNetworkDomainAliasListDomain', 'Caption' => 'Aliasy', 'Default' => ''),
|
---|
379 | ),
|
---|
380 | ));
|
---|
381 | $this->System->FormManager->RegisterFormType('TNetworkDomain', array(
|
---|
382 | 'Type' => 'Reference',
|
---|
383 | 'Table' => 'NetworkDomain',
|
---|
384 | 'Id' => 'Id',
|
---|
385 | 'Name' => 'Name',
|
---|
386 | 'Filter' => '1',
|
---|
387 | ));
|
---|
388 | $this->System->FormManager->RegisterClass('NetworkDomainServer', array(
|
---|
389 | 'Title' => 'Doménový server',
|
---|
390 | 'Table' => 'NetworkDomainServer',
|
---|
391 | 'DefaultSortColumn' => 'Address',
|
---|
392 | 'DefaultSortOrder' => 1,
|
---|
393 | 'Items' => array(
|
---|
394 | 'Address' => array('Type' => 'String', 'Caption' => 'Adresa', 'Default' => ''),
|
---|
395 | 'Domain' => array('Type' => 'TNetworkDomain', 'Caption' => 'Doména', 'Default' => ''),
|
---|
396 | 'Sequence' => array('Type' => 'Integer', 'Caption' => 'Pořadí', 'Default' => '1'),
|
---|
397 | ),
|
---|
398 | ));
|
---|
399 | $this->System->FormManager->RegisterFormType('TNetworkDomainServerList', array(
|
---|
400 | 'Type' => 'ManyToOne',
|
---|
401 | 'Table' => 'NetworkDomainServer',
|
---|
402 | 'Id' => 'Id',
|
---|
403 | 'Ref' => 'Domain',
|
---|
404 | 'Filter' => '1',
|
---|
405 | ));
|
---|
406 | $this->System->FormManager->RegisterClass('NetworkDomainView', array(
|
---|
407 | 'Title' => 'Pohled síťové domény',
|
---|
408 | 'Table' => 'NetworkDomainView',
|
---|
409 | 'DefaultSortColumn' => 'Name',
|
---|
410 | 'DefaultSortOrder' => 1,
|
---|
411 | 'Items' => array(
|
---|
412 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
---|
413 | 'SysName' => array('Type' => 'String', 'Caption' => 'Systémové jméno', 'Default' => ''),
|
---|
414 | 'Domain' => array('Type' => 'TNetworkDomain', 'Caption' => 'Doména', 'Default' => ''),
|
---|
415 | 'AddressRange' => array('Type' => 'String', 'Caption' => 'Rozsah adres', 'Default' => ''),
|
---|
416 | 'ItemFilters' => array('Type' => 'TNetworkDomainItemFilterListView', 'Caption' => 'Filtry položek', 'Default' => ''),
|
---|
417 | ),
|
---|
418 | ));
|
---|
419 | $this->System->FormManager->RegisterFormType('TNetworkDomainView', array(
|
---|
420 | 'Type' => 'Reference',
|
---|
421 | 'Table' => 'NetworkDomainView',
|
---|
422 | 'Id' => 'Id',
|
---|
423 | 'Name' => 'Name',
|
---|
424 | 'Filter' => '1',
|
---|
425 | ));
|
---|
426 | $this->System->FormManager->RegisterFormType('TNetworkDomainViewListDomain', array(
|
---|
427 | 'Type' => 'ManyToOne',
|
---|
428 | 'Table' => 'NetworkDomainView',
|
---|
429 | 'Id' => 'Id',
|
---|
430 | 'Ref' => 'Domain',
|
---|
431 | 'Filter' => '1',
|
---|
432 | ));
|
---|
433 | $this->System->FormManager->RegisterClass('NetworkDomainItemFilter', array(
|
---|
434 | 'Title' => 'Filtr doménových položek',
|
---|
435 | 'Table' => 'NetworkDomainItemFilter',
|
---|
436 | 'DefaultSortColumn' => 'Name',
|
---|
437 | 'DefaultSortOrder' => 1,
|
---|
438 | 'Items' => array(
|
---|
439 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
---|
440 | 'Domain' => array('Type' => 'TNetworkDomain', 'Caption' => 'Domén', 'Default' => ''),
|
---|
441 | 'AddressCategory' => array('Type' => 'TNetworkAddressCategory', 'Caption' => 'Kategorie adresy', 'Default' => ''),
|
---|
442 | 'Suffix' => array('Type' => 'String', 'Caption' => 'Přípona jména položek', 'Default' => ''),
|
---|
443 | 'View' => array('Type' => 'TNetworkDomainView', 'Caption' => 'Pohled', 'Default' => ''),
|
---|
444 | 'AddressRange' => array('Type' => 'String', 'Caption' => 'Rozsah adres', 'Default' => ''),
|
---|
445 | ),
|
---|
446 | ));
|
---|
447 | $this->System->FormManager->RegisterFormType('TNetworkDomainItemFilterListDomain', array(
|
---|
448 | 'Type' => 'ManyToOne',
|
---|
449 | 'Table' => 'NetworkDomainItemFilter',
|
---|
450 | 'Id' => 'Id',
|
---|
451 | 'Ref' => 'Domain',
|
---|
452 | 'Filter' => '1',
|
---|
453 | ));
|
---|
454 | $this->System->FormManager->RegisterFormType('TNetworkDomainItemFilterListView', array(
|
---|
455 | 'Type' => 'ManyToOne',
|
---|
456 | 'Table' => 'NetworkDomainItemFilter',
|
---|
457 | 'Id' => 'Id',
|
---|
458 | 'Ref' => 'View',
|
---|
459 | 'Filter' => '1',
|
---|
460 | ));
|
---|
461 | $this->System->FormManager->RegisterClass('DeviceAPIType', array(
|
---|
462 | 'Title' => 'Typ API zařízení',
|
---|
463 | 'Table' => 'DeviceAPIType',
|
---|
464 | 'Items' => array(
|
---|
465 | 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
|
---|
466 | 'Devices' => array('Type' => 'TDeviceListAPI', 'Caption' => 'Zařízení', 'Default' => ''),
|
---|
467 | ),
|
---|
468 | ));
|
---|
469 | $this->System->FormManager->RegisterClass('NetworkInterfaceWireless', array(
|
---|
470 | 'Title' => 'Bezdrátová rozhraní',
|
---|
471 | 'Table' => 'NetworkInterfaceWireless',
|
---|
472 | 'Items' => array(
|
---|
473 | 'SSID' => array('Type' => 'String', 'Caption' => 'SSID', 'Default' => ''),
|
---|
474 | 'MAC' => array('Type' => 'MacAddress', 'Caption' => 'MAC', 'Default' => ''),
|
---|
475 | 'NetworkInterface' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní', 'Default' => ''),
|
---|
476 | 'TxPower' => array('Type' => 'Integer', 'Caption' => 'Výstupní výkon', 'Default' => '18', 'Suffix' => 'dBm'),
|
---|
477 | 'CableAttenuation' => array('Type' => 'Integer', 'Caption' => 'Útlum vedení', 'Default' => '0', 'Suffix' => 'dB'),
|
---|
478 | 'Antenna' => array('Type' => 'TProduct', 'Caption' => 'Anténa', 'Default' => '', 'Null' => true),
|
---|
479 | 'AntenaGain' => array('Type' => 'Integer', 'Caption' => 'Zisk antény', 'Default' => '', 'Suffix' => 'dBi'),
|
---|
480 | 'AntennaPolarity' => array('Type' => 'TAntennaPolarity', 'Caption' => 'Polarizace antény', 'Default' => '0'),
|
---|
481 | 'Frequency' => array('Type' => 'Float', 'Caption' => 'Frekvence', 'Default' => '5600', 'Suffix' => 'MHz'),
|
---|
482 | 'ChannelWidthLower' => array('Type' => 'Integer', 'Caption' => 'Šírka kanálu dolního', 'Default' => '0', 'Suffix' => 'MHz'),
|
---|
483 | 'ChannelWidth' => array('Type' => 'Integer', 'Caption' => 'Šírka kanálu', 'Default' => '20', 'Suffix' => 'MHz'),
|
---|
484 | 'ChannelWidthUpper' => array('Type' => 'Integer', 'Caption' => 'Šírka kanálu horního', 'Default' => '0', 'Suffix' => 'MHz'),
|
---|
485 | 'Mode' => array('Type'
|
---|
486 | => 'TWirelessMode', 'Caption' => 'Režim', 'Default' => '0', 'Suffix' => ''),
|
---|
487 | 'TotalPower' => array('Type' => 'Integer', 'Caption' => 'Celkový výkon', 'Default' => '20', 'Suffix' => 'dBm',
|
---|
488 | 'SQL' => '(`TxPower` - `CableAttenuation` + `AntenaGain`)', 'ReadOnly' => true),
|
---|
489 | 'LimitPower' => array('Type' => 'Integer', 'Caption' => 'Max. limit', 'Default' => '', 'Suffix' => 'dBm',
|
---|
490 | 'ReadOnly' => true, 'SQL' => '(CASE WHEN `Frequency` >= 5450 AND `Frequency` <= 5725 THEN 27 ELSE 20 END)'),
|
---|
491 | 'UnderLimit' => array('Type' => 'Boolean', 'Caption' => 'V limitu', 'Default' => '', 'Suffix' => '',
|
---|
492 | 'ReadOnly' => true, 'SQL' => '((`TxPower` - `CableAttenuation` + `AntenaGain`) <= (CASE WHEN `Frequency` >= 5450 AND `Frequency` <= 5725 THEN 27 ELSE 20 END))'),
|
---|
493 | 'Description' => array('Type' => 'String', 'Caption' => 'Popis', 'Default' => ''),
|
---|
494 | ),
|
---|
495 | 'Actions' => array(
|
---|
496 | array('Caption' => 'Frekvenční plán', 'URL' => '/network/frequency-plan/'),
|
---|
497 | ),
|
---|
498 | ));
|
---|
499 | $this->System->FormManager->RegisterClass('NetworkInterfaceWirelessCTU', array(
|
---|
500 | 'Title' => 'Bezdrátová rozhraní pro ČTÚ',
|
---|
501 | 'Table' => 'NetworkInterfaceWireless',
|
---|
502 | 'Items' => array(
|
---|
503 | 'SSID' => array('Type' => 'String', 'Caption' => 'SSID', 'Default' => ''),
|
---|
504 | 'MAC' => array('Type' => 'MacAddress', 'Caption' => 'MAC', 'Default' => ''),
|
---|
505 | 'TxPower' => array('Type' => 'Integer', 'Caption' => 'Výstupní výkon', 'Default' => '18', 'Suffix' => 'dBm'),
|
---|
506 | 'CableAttenuation' => array('Type' => 'Integer', 'Caption' => 'Útlum vedení', 'Default' => '0', 'Suffix' => 'dB'),
|
---|
507 | 'AntenaGain' => array('Type' => 'Integer', 'Caption' => 'Zisk antény', 'Default' => '', 'Suffix' => 'dBi'),
|
---|
508 | 'AntennaPolarity' => array('Type' => 'TAntennaPolarity', 'Caption' => 'Polarizace antény', 'Default' => '0'),
|
---|
509 | 'Frequency' => array('Type' => 'Float', 'Caption' => 'Frekvence', 'Default' => '5600', 'Suffix' => 'MHz'),
|
---|
510 | 'ChannelWidthLower' => array('Type' => 'Integer', 'Caption' => 'Šírka kanálu dolního', 'Default' => '0', 'Suffix' => 'MHz'),
|
---|
511 | 'ChannelWidth' => array('Type' => 'Integer', 'Caption' => 'Šírka kanálu', 'Default' => '20', 'Suffix' => 'MHz'),
|
---|
512 | 'ChannelWidthUpper' => array('Type' => 'Integer', 'Caption' => 'Šírka kanálu horního', 'Default' => '0', 'Suffix' => 'MHz'),
|
---|
513 | 'Mode' => array('Type' => 'TWirelessMode', 'Caption' => 'Režim', 'Default' => '0', 'Suffix' => ''),
|
---|
514 | 'TotalPower' => array('Type' => 'Integer', 'Caption' => 'Celkový výkon', 'Default' => '20', 'Suffix' => 'dBm',
|
---|
515 | 'SQL' => '(`TxPower` - `CableAttenuation` + `AntenaGain`)', 'ReadOnly' => true),
|
---|
516 | 'LimitPower' => array('Type' => 'Integer', 'Caption' => 'Max. limit', 'Default' => '', 'Suffix' => 'dBm',
|
---|
517 | 'ReadOnly' => true, 'SQL' => '(CASE WHEN `Frequency` >= 5450 AND `Frequency` <= 5725 THEN 27 ELSE 20 END)'),
|
---|
518 | 'UnderLimit' => array('Type' => 'Boolean', 'Caption' => 'V limitu', 'Default' => '', 'Suffix' => '',
|
---|
519 | 'ReadOnly' => true, 'SQL' => '((`TxPower` - `CableAttenuation` + `AntenaGain`) <= (CASE WHEN `Frequency` >= 5450 AND `Frequency` <= 5725 THEN 27 ELSE 20 END))'),
|
---|
520 | 'Position' => array('Type' => 'String', 'Caption' => 'GPS poloha', 'Default' => '',
|
---|
521 | 'SQL' => '(SELECT MapPosition.Pos FROM MapPosition WHERE MapPosition.Id=#Id)'),
|
---|
522 | 'Description' => array('Type' => 'String', 'Caption' => 'Popis', 'Default' => ''),
|
---|
523 | ),
|
---|
524 | 'Actions' => array(
|
---|
525 | array('Caption' => 'Frekvenční plán', 'URL' => '/network/frequency-plan/'),
|
---|
526 | ),
|
---|
527 | ));
|
---|
528 | $this->System->FormManager->RegisterClass('NetworkInterfaceUpDown', array(
|
---|
529 | 'Title' => 'Změny stavu rozhraní',
|
---|
530 | 'Table' => 'NetworkInterfaceUpDown',
|
---|
531 | 'DefaultSortColumn' => 'Time',
|
---|
532 | 'DefaultSortOrder' => 1,
|
---|
533 | 'Items' => array(
|
---|
534 | 'Time' => array('Type' => 'DateTime', 'Caption' => 'Čas', 'Default' => '', 'ReadOnly' => true),
|
---|
535 | 'Interface' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní', 'Default' => '', 'ReadOnly' => true),
|
---|
536 | 'State' => array('Type' => 'TOnlineState', 'Caption' => 'Stav', 'Default' => '', 'ReadOnly' => true),
|
---|
537 | 'Duration' => array('Type' => 'TimeDiff', 'Caption' => 'Trvání', 'Default' => '', 'ReadOnly' => true),
|
---|
538 | ),
|
---|
539 | ));
|
---|
540 | $this->System->FormManager->RegisterClass('NetworkPortUpDown', array(
|
---|
541 | 'Title' => 'Změny stavu portů',
|
---|
542 | 'Table' => 'NetworkPortUpDown',
|
---|
543 | 'DefaultSortColumn' => 'Time',
|
---|
544 | 'DefaultSortOrder' => 1,
|
---|
545 | 'Items' => array(
|
---|
546 | 'Time' => array('Type' => 'DateTime', 'Caption' => 'Čas', 'Default' => '', 'ReadOnly' => true),
|
---|
547 | 'Port' => array('Type' => 'TNetworkPort', 'Caption' => 'Port', 'Default' => '', 'ReadOnly' => true),
|
---|
548 | 'State' => array('Type' => 'TOnlineState', 'Caption' => 'Stav', 'Default' => '', 'ReadOnly' => true),
|
---|
549 | 'Duration' => array('Type' => 'TimeDiff', 'Caption' => 'Trvání', 'Default' => '', 'ReadOnly' => true),
|
---|
550 | ),
|
---|
551 | ));
|
---|
552 | $this->System->FormManager->RegisterFormType('TNetworkProtocol', array(
|
---|
553 | 'Type' => 'Enumeration',
|
---|
554 | 'States' => array('TCP', 'UDP'),
|
---|
555 | ));
|
---|
556 | $this->System->FormManager->RegisterFormType('TNetworkDevice', array(
|
---|
557 | 'Type' => 'Reference',
|
---|
558 | 'Table' => 'NetworkDevice',
|
---|
559 | 'Id' => 'Id',
|
---|
560 | 'Name' => 'Name',
|
---|
561 | 'Filter' => '1',
|
---|
562 | ));
|
---|
563 | $this->System->FormManager->RegisterFormType('TNetworkDeviceType', array(
|
---|
564 | 'Type' => 'Reference',
|
---|
565 | 'Table' => 'NetworkDeviceType',
|
---|
566 | 'Id' => 'Id',
|
---|
567 | 'Name' => 'Name',
|
---|
568 | 'Filter' => '1',
|
---|
569 | ));
|
---|
570 | $this->System->FormManager->RegisterFormType('TNetworkInterface', array(
|
---|
571 | 'Type' => 'Reference',
|
---|
572 | 'Table' => 'NetworkInterface',
|
---|
573 | 'View' => '(SELECT NetworkInterface.*, CONCAT_WS("-", NetworkDevice.Name, NULLIF(NetworkInterface.Name, "")) AS DeviceName FROM NetworkInterface '.
|
---|
574 | 'LEFT JOIN NetworkDevice ON NetworkDevice.Id = NetworkInterface.Device) AS T',
|
---|
575 | 'Id' => 'Id',
|
---|
576 | 'Name' => 'DeviceName',
|
---|
577 | 'Filter' => '1',
|
---|
578 | ));
|
---|
579 | $this->System->FormManager->RegisterFormType('TNetworkPort', array(
|
---|
580 | 'Type' => 'Reference',
|
---|
581 | 'Table' => 'NetworkPort',
|
---|
582 | 'View' => '(SELECT `NetworkPort`.*, CONCAT(CONCAT_WS("-", `NetworkDevice`.`Name`, NULLIF(`NetworkInterface`.`Name`, "")), ":", `NetworkPort`.`Number`) AS `PortName` FROM `NetworkPort` '.
|
---|
583 | 'LEFT JOIN `NetworkInterface` ON `NetworkInterface`.`Id` = `NetworkPort`.`Interface` '.
|
---|
584 | 'LEFT JOIN `NetworkDevice` ON `NetworkDevice`.`Id` = `NetworkInterface`.`Device`) AS `T`',
|
---|
585 | 'Id' => 'Id',
|
---|
586 | 'Name' => 'PortName',
|
---|
587 | 'Filter' => '1',
|
---|
588 | ));
|
---|
589 | $this->System->FormManager->RegisterFormType('TNetworkInterfaceType', array(
|
---|
590 | 'Type' => 'Reference',
|
---|
591 | 'Table' => 'NetworkInterfaceType',
|
---|
592 | 'Id' => 'Id',
|
---|
593 | 'Name' => 'Name',
|
---|
594 | 'Filter' => '1',
|
---|
595 | ));
|
---|
596 | $this->System->FormManager->RegisterFormType('TDeviceList', array(
|
---|
597 | 'Type' => 'ManyToOne',
|
---|
598 | 'Table' => 'NetworkDevice',
|
---|
599 | 'Id' => 'Id',
|
---|
600 | 'Ref' => 'Member',
|
---|
601 | 'Filter' => '1',
|
---|
602 | ));
|
---|
603 | $this->System->FormManager->RegisterFormType('TDeviceListAPI', array(
|
---|
604 | 'Type' => 'ManyToOne',
|
---|
605 | 'Table' => 'NetworkDevice',
|
---|
606 | 'Id' => 'Id',
|
---|
607 | 'Ref' => 'API',
|
---|
608 | 'Filter' => '1',
|
---|
609 | ));
|
---|
610 | $this->System->FormManager->RegisterFormType('TDevicePortListInterface', array(
|
---|
611 | 'Type' => 'ManyToOne',
|
---|
612 | 'Table' => 'NetworkPort',
|
---|
613 | 'Id' => 'Id',
|
---|
614 | 'Ref' => 'Interface',
|
---|
615 | 'Filter' => '1',
|
---|
616 | ));
|
---|
617 | $this->System->FormManager->RegisterFormType('TDeviceInterfaceLatencyListInterface', array(
|
---|
618 | 'Type' => 'ManyToOne',
|
---|
619 | 'Table' => 'NetworkInterfaceLatency',
|
---|
620 | 'Id' => 'Id',
|
---|
621 | 'Ref' => 'Interface',
|
---|
622 | 'Filter' => '1',
|
---|
623 | ));
|
---|
624 | $this->System->FormManager->RegisterFormType('TNetworkLinkType', array(
|
---|
625 | 'Type' => 'Reference',
|
---|
626 | 'Table' => 'NetworkLinkType',
|
---|
627 | 'Id' => 'Id',
|
---|
628 | 'Name' => 'Name',
|
---|
629 | 'Filter' => '1',
|
---|
630 | ));
|
---|
631 | $this->System->FormManager->RegisterFormType('TDeviceAPIType', array(
|
---|
632 | 'Type' => 'Reference',
|
---|
633 | 'Table' => 'DeviceAPIType',
|
---|
634 | 'Id' => 'Id',
|
---|
635 | 'Name' => 'Name',
|
---|
636 | 'Filter' => '1',
|
---|
637 | ));
|
---|
638 | $this->System->FormManager->RegisterFormType('TNetworkInterfaceWirelessListInterface', array(
|
---|
639 | 'Type' => 'ManyToOne',
|
---|
640 | 'Table' => 'NetworkInterfaceWireless',
|
---|
641 | 'Id' => 'Id',
|
---|
642 | 'Ref' => 'NetworkInterface',
|
---|
643 | 'Filter' => '1',
|
---|
644 | ));
|
---|
645 | $this->System->FormManager->RegisterFormType('TInterfaceList', array(
|
---|
646 | 'Type' => 'ManyToOne',
|
---|
647 | 'Table' => 'NetworkInterface',
|
---|
648 | 'Id' => 'Id',
|
---|
649 | 'Ref' => 'Device',
|
---|
650 | 'Filter' => '1',
|
---|
651 | ));
|
---|
652 | $this->System->FormManager->RegisterFormType('TNetworkLinkListInterface', array(
|
---|
653 | 'Type' => 'ManyToOne',
|
---|
654 | 'Table' => 'NetworkLinkUnion',
|
---|
655 | 'Id' => 'Id',
|
---|
656 | 'Ref' => 'Interface',
|
---|
657 | 'Filter' => '1',
|
---|
658 | ));
|
---|
659 | $this->System->FormManager->RegisterFormType('TNetworkLinkListInterface1', array(
|
---|
660 | 'Type' => 'ManyToOne',
|
---|
661 | 'Table' => 'NetworkLink',
|
---|
662 | 'Id' => 'Id',
|
---|
663 | 'Ref' => 'Interface1',
|
---|
664 | 'Filter' => '1',
|
---|
665 | ));
|
---|
666 | $this->System->FormManager->RegisterFormType('TNetworkLinkListInterface2', array(
|
---|
667 | 'Type' => 'ManyToOne',
|
---|
668 | 'Table' => 'NetworkLink',
|
---|
669 | 'Id' => 'Id',
|
---|
670 | 'Ref' => 'Interface2',
|
---|
671 | 'Filter' => '1',
|
---|
672 | ));
|
---|
673 | $this->System->FormManager->RegisterFormType('TNetworkInterfaceUpDown', array(
|
---|
674 | 'Type' => 'ManyToOne',
|
---|
675 | 'Table' => 'NetworkInterfaceUpDown',
|
---|
676 | 'Id' => 'Id',
|
---|
677 | 'Ref' => 'Interface',
|
---|
678 | 'Filter' => '1',
|
---|
679 | ));
|
---|
680 | $this->System->FormManager->RegisterFormType('TNetworkPortUpDown', array(
|
---|
681 | 'Type' => 'ManyToOne',
|
---|
682 | 'Table' => 'NetworkPortUpDown',
|
---|
683 | 'Id' => 'Id',
|
---|
684 | 'Ref' => 'Port',
|
---|
685 | 'Filter' => '1',
|
---|
686 | ));
|
---|
687 |
|
---|
688 | $this->System->ModuleManager->Modules['IS']->RegisterDashboardItem('Network',
|
---|
689 | array('ModuleNetwork', 'ShowDashboardItem'));
|
---|
690 |
|
---|
691 | $this->System->RegisterModel('NetworkDevice', array(
|
---|
692 | 'Title' => 'Síťové zařízení',
|
---|
693 | ));
|
---|
694 | $this->System->RegisterModel('NetworkInterface', array(
|
---|
695 | 'Title' => 'Síťové rozhraní',
|
---|
696 | ));
|
---|
697 | }
|
---|
698 |
|
---|
699 | function AfterInsertNetworkDevice($Form)
|
---|
700 | {
|
---|
701 | $this->System->Models['NetworkDevice']->DoOnChange();
|
---|
702 | }
|
---|
703 |
|
---|
704 | function AfterModifyNetworkDevice($Form, $Id)
|
---|
705 | {
|
---|
706 | $this->System->Models['NetworkDevice']->DoOnChange();
|
---|
707 | }
|
---|
708 |
|
---|
709 | function AfterInsertNetworkInterface($Form)
|
---|
710 | {
|
---|
711 | $this->System->Models['NetworkInterface']->DoOnChange();
|
---|
712 | }
|
---|
713 |
|
---|
714 | function AfterModifyNetworkInterface($Form, $Id)
|
---|
715 | {
|
---|
716 | $this->System->Models['NetworkInterface']->DoOnChange();
|
---|
717 | }
|
---|
718 |
|
---|
719 | function BeforeDeleteNetworkInterface($Form, $Id)
|
---|
720 | {
|
---|
721 | $this->Database->query('DELETE FROM `NetworkInterfaceUpDown` WHERE `Interface`='.$Id);
|
---|
722 | $this->Database->query('DELETE FROM `NetworkLink` WHERE `Interface1`='.$Id.' OR `Interface2`='.$Id);
|
---|
723 | $this->Database->query('DELETE FROM `NetworkPort` WHERE `Interface`='.$Id);
|
---|
724 | $this->Database->query('DELETE FROM `NetworkSignal` WHERE `Interface`='.$Id);
|
---|
725 | $this->Database->query('DELETE FROM `NetworkInterfaceWireless` WHERE `NetworkInterface`='.$Id);
|
---|
726 | $this->Database->query('DELETE FROM `NetworkInterfaceLatency` WHERE `Interface`='.$Id);
|
---|
727 | }
|
---|
728 |
|
---|
729 | function ShowDashboardItem()
|
---|
730 | {
|
---|
731 | $Output = '';
|
---|
732 | $DbResult = $this->Database->select('NetworkDevice', 'COUNT(*)', '1');
|
---|
733 | $DbRow = $DbResult->fetch_row();
|
---|
734 | $Output .= 'Síťových zařízení: registrovaných:'.$DbRow['0'];
|
---|
735 |
|
---|
736 | $DbResult = $this->Database->select('NetworkDevice', 'COUNT(*)', '`Used`=1');
|
---|
737 | $DbRow = $DbResult->fetch_row();
|
---|
738 | $Output .= ' použitých:'.$DbRow['0'].'<br>';
|
---|
739 |
|
---|
740 | $DbResult = $this->Database->select('NetworkInterface', 'COUNT(*)', '1');
|
---|
741 | $DbRow = $DbResult->fetch_row();
|
---|
742 | $Output .= 'Síťových rozhraní: '.$DbRow['0'].'<br>';
|
---|
743 |
|
---|
744 | $DbResult = $this->Database->select('NetworkSubnet', 'COUNT(*)', '1');
|
---|
745 | $DbRow = $DbResult->fetch_row();
|
---|
746 | $Output .= 'Síťových podsítí: '.$DbRow['0'].'<br/>';
|
---|
747 | return $Output;
|
---|
748 | }
|
---|
749 |
|
---|
750 | function DoStop()
|
---|
751 | {
|
---|
752 | }
|
---|
753 |
|
---|
754 | function OnlineList($Title, $OnlineNow, $OnlinePrevious, $MinDuration)
|
---|
755 | {
|
---|
756 | $Time = time();
|
---|
757 | $OnlineText = array('<span style="color:red;">Nedostupný</span>', '<span style="color:green;">Dostupný</span>');
|
---|
758 | $Output = '';
|
---|
759 | $Condition = 'WHERE (`NetworkInterface`.`Online` = '.$OnlineNow.') AND (`NetworkInterface`.`OnlineNotify` = '.$OnlinePrevious.') '.
|
---|
760 | 'AND (`NetworkInterface`.`LastOnline` <= "'.TimeToMysqlDateTime($Time - $MinDuration).'")';
|
---|
761 | $DbResult3 = $this->Database->query('SELECT CONCAT_WS("-", `NetworkDevice`.`Name`, NULLIF(`NetworkInterface`.`Name`, "")) AS `Name`, '.
|
---|
762 | '`NetworkInterface`.`Online`, `NetworkInterface`.`LastOnline` FROM `NetworkInterface` '.
|
---|
763 | 'LEFT JOIN `NetworkDevice` ON `NetworkDevice`.`Id` = `NetworkInterface`.`Device` '.
|
---|
764 | $Condition.' AND (`NetworkDevice`.`PermanentOnline`=1) AND (`NetworkDevice`.`Used`=1) AND '.
|
---|
765 | '(`NetworkInterface`.`LocalIP` != "") AND (`NetworkInterface`.`Enabled`=1)'.
|
---|
766 | 'ORDER BY `Name` ASC');
|
---|
767 | if($DbResult3->num_rows > 0)
|
---|
768 | {
|
---|
769 | $Output .= $Title.'<br/>';
|
---|
770 | $Output .= '<table>'.
|
---|
771 | '<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";
|
---|
772 | while($Item = $DbResult3->fetch_assoc())
|
---|
773 | {
|
---|
774 | $Duration = $Time - MysqlDateTimeToTime($Item['LastOnline']);
|
---|
775 | $DurationText = sprintf('%02d', floor($Duration / 3600 % 24)).':'.
|
---|
776 | sprintf('%02d', floor($Duration / 60 % 60)).':'.
|
---|
777 | sprintf('%02d', floor($Duration % 60));
|
---|
778 | $Days = floor($Duration / (60 * 60 * 24));
|
---|
779 | if($Days > 0) $DurationText = $Days.' dnů '.$DurationText;
|
---|
780 |
|
---|
781 | $Output .= '<tr><td>'.$Item['Name'].'</td><td>'.$OnlineText[$Item['Online']].
|
---|
782 | '</td><td>'.$Item['LastOnline'].'</td><td>'.$DurationText.'</td></tr>'."\n";
|
---|
783 | }
|
---|
784 | $Output .= '</table><br/>'."\n";
|
---|
785 | }
|
---|
786 | $this->Database->query('UPDATE `NetworkInterface` SET `OnlineNotify` = `Online` '.
|
---|
787 | $Condition);
|
---|
788 | return $Output;
|
---|
789 | }
|
---|
790 |
|
---|
791 | function ReachabilityCheck()
|
---|
792 | {
|
---|
793 | $Output = '';
|
---|
794 | $Output = $this->OnlineList('Nově online', 1, 0, 0);
|
---|
795 | $Output .= $this->OnlineList('Nově offline', 0, 1, $this->MinNotifyTime);
|
---|
796 | if($Output != '') $Output .= $this->OnlineList('Stále offline', 0, 0, 0);
|
---|
797 | return($Output);
|
---|
798 | }
|
---|
799 |
|
---|
800 | function PortCheckList($Title, $OnlineNow, $OnlinePrevious, $MinDuration)
|
---|
801 | {
|
---|
802 | $Time = time();
|
---|
803 | $OnlineText = array('<span style="color:red;">Nedostupný</span>', '<span style="color:green;">Dostupný</span>');
|
---|
804 | $Output = '';
|
---|
805 | $Condition = 'WHERE (`NetworkPort`.`Online` = '.$OnlineNow.') AND (`NetworkPort`.`OnlineNotify` = '.$OnlinePrevious.') '.
|
---|
806 | 'AND (`NetworkPort`.`LastOnline` <= "'.TimeToMysqlDateTime($Time - $MinDuration).'")';
|
---|
807 | $DbResult3 = $this->Database->query('SELECT CONCAT(CONCAT_WS("-", `NetworkDevice`.`Name`, NULLIF(`NetworkInterface`.`Name`, "")), ":", `NetworkPort`.`Number`, "(", `NetworkPort`.`Name`, ")") AS `Name`, '.
|
---|
808 | '`NetworkPort`.`Online`, `NetworkPort`.`LastOnline` FROM `NetworkPort` '.
|
---|
809 | 'LEFT JOIN `NetworkInterface` ON `NetworkInterface`.`Id` = `NetworkPort`.`Interface` '.
|
---|
810 | 'LEFT JOIN `NetworkDevice` ON `NetworkDevice`.`Id` = `NetworkInterface`.`Device` '.
|
---|
811 | $Condition.' AND (`NetworkDevice`.`PermanentOnline`=1) AND (`NetworkDevice`.`Used`=1) AND '.
|
---|
812 | '(`NetworkInterface`.`LocalIP` != "") AND (`NetworkPort`.`Enabled` = 1)'.
|
---|
813 | 'ORDER BY `Name` ASC');
|
---|
814 | if($DbResult3->num_rows > 0)
|
---|
815 | {
|
---|
816 | $Output .= $Title.'<br/>';
|
---|
817 | $Output .= '<table>'.
|
---|
818 | '<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";
|
---|
819 | while($Item = $DbResult3->fetch_assoc())
|
---|
820 | {
|
---|
821 | $Duration = $Time - MysqlDateTimeToTime($Item['LastOnline']);
|
---|
822 | $DurationText = sprintf('%02d', floor($Duration / 3600 % 24)).':'.
|
---|
823 | sprintf('%02d', floor($Duration / 60 % 60)).':'.
|
---|
824 | sprintf('%02d', floor($Duration % 60));
|
---|
825 | $Days = floor($Duration / (60 * 60 * 24));
|
---|
826 | if($Days > 0) $DurationText = $Days.' dnů '.$DurationText;
|
---|
827 |
|
---|
828 | $Output .= '<tr><td>'.$Item['Name'].'</td><td>'.$OnlineText[$Item['Online']].
|
---|
829 | '</td><td>'.$Item['LastOnline'].'</td><td>'.$DurationText.'</td></tr>'."\n";
|
---|
830 | }
|
---|
831 | $Output .= '</table><br/>'."\n";
|
---|
832 | }
|
---|
833 | $this->Database->query('UPDATE `NetworkPort` SET `OnlineNotify` = `Online` '.
|
---|
834 | $Condition);
|
---|
835 | return $Output;
|
---|
836 | }
|
---|
837 |
|
---|
838 | function PortCheck()
|
---|
839 | {
|
---|
840 | $Output = '';
|
---|
841 | $Output = $this->PortCheckList('Nově online', 1, 0, 0);
|
---|
842 | $Output .= $this->PortCheckList('Nově offline', 0, 1, $this->MinNotifyTime);
|
---|
843 | if($Output != '') $Output .= $this->PortCheckList('Stále offline', 0, 0, 0);
|
---|
844 | return($Output);
|
---|
845 | }
|
---|
846 | }
|
---|