source: trunk/Modules/Network/Network.php@ 785

Last change on this file since 785 was 785, checked in by chronos, 9 years ago
File size: 30.4 KB
Line 
1<?php
2
3include_once(dirname(__FILE__).'/HostList.php');
4include_once(dirname(__FILE__).'/Subnet.php');
5include_once(dirname(__FILE__).'/Hosting.php');
6include_once(dirname(__FILE__).'/UserHosts.php');
7
8class 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&amp;range=bc">Pásmo 5 GHz dolní (b, c)</a> '.
21 '<a href="?section=obsazeni_wifi_kanalu&amp;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.';">&nbsp;</td>';
65 }
66
67 $Output .= '</tr>';
68 }
69 }
70 $Output .= '</table>';
71 return($Output);
72 }
73}
74
75class 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 $Output = '<a href="'.$this->System->Link('/network/frequency-plan/').'">Frekvenční plán</a><br />';
93 $Output .= '<a href="'.$this->System->Link('/network/subnet/').'">Výpis registrovaných podsítí</a><br />';
94 $Output .= '<a href="'.$this->System->Link('/network/hosts/').'">Registrované zařízení</a><br />';
95 return($Output);
96 }
97}
98
99class ModuleNetwork extends AppModule
100{
101 function __construct($System)
102 {
103 parent::__construct($System);
104 $this->Name = 'Network';
105 $this->Version = '1.0';
106 $this->Creator = 'Chronos';
107 $this->License = 'GNU/GPLv3';
108 $this->Description = 'Networking related tools';
109 $this->Dependencies = array();
110 }
111
112 function DoInstall()
113 {
114 }
115
116 function DoUninstall()
117 {
118 }
119
120 function DoStart()
121 {
122 $this->System->RegisterPage('network', 'PageNetwork');
123 $this->System->RegisterPage(array('network', 'administration'), 'PageNetworkAdministration');
124 $this->System->RegisterPage(array('network', 'subnet'), 'PageSubnet');
125 $this->System->RegisterPage(array('network', 'user-hosts'), 'PageNetworkHostList');
126 $this->System->RegisterPage(array('network', 'hosting'),'PageHosting');
127 $this->System->RegisterPage(array('network', 'hosts'), 'PageHostList');
128 $this->System->RegisterPage(array('network', 'frequency-plan'), 'PageFrequencyPlan');
129
130 $this->System->FormManager->RegisterClass('NetworkDomainAlias', array(
131 'Title' => 'Alias domény',
132 'Table' => 'NetworkDomainAlias',
133 'Items' => array(
134 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
135 'Target' => array('Type' => 'String', 'Caption' => 'Cíl', 'Default' => ''),
136 'Comment' => array('Type' => 'String', 'Caption' => 'Komentář', 'Default' => ''),
137 'Domain' => array('Type' => 'TNetworkDomain', 'Caption' => 'Síťová doména', 'Default' => ''),
138 ),
139 ));
140 $this->System->FormManager->RegisterFormType('TNetworkDomainAliasListDomain', array(
141 'Type' => 'ManyToOne',
142 'Table' => 'NetworkDomainAlias',
143 'Id' => 'Id',
144 'Ref' => 'Domain',
145 'Filter' => '1',
146 ));
147 $this->System->FormManager->RegisterClass('NetworkDevice', array(
148 'Title' => 'Síťové zařízení',
149 'Table' => 'NetworkDevice',
150 'Items' => array(
151 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
152 'Type' => array('Type' => 'TNetworkDeviceType', 'Caption' => 'Typ', 'Default' => '0'),
153 'Member' => array('Type' => 'TMember', 'Caption' => 'Zákazník', 'Default' => '0'),
154 'Location' => array('Type' => 'TMember', 'Caption' => 'Umístění', 'Default' => '0'),
155 'Service' => array('Type' => 'TServiceCustomerRel', 'Caption' => 'Služba', 'Default' => '', 'Null' => true),
156 'Used' => array('Type' => 'Boolean', 'Caption' => 'Použito', 'Default' => '1'),
157 'Online' => array('Type' => 'TOnlineState', 'Caption' => 'Běží', 'Default' => '0', 'ReadOnly' => true),
158 'LastOnline' => array('Type' => 'DateTime', 'Caption' => 'Naposledy běželo', 'Default' => '', 'ReadOnly' => true),
159 'PermanentOnline' => array('Type' => 'Boolean', 'Caption' => 'Běží stále', 'Default' => '0'),
160 'Interfaces' => array('Type' => 'TInterfaceList', 'Caption' => 'Rozhraní', 'Default' => ''),
161 'MapPosition' => array('Type' => 'TMapPosition', 'Caption' => 'Pozice na mapě', 'Default' => '0', 'Null' => true),
162 'Product' => array('Type' => 'TProduct', 'Caption' => 'Produkt', 'Default' => '', 'Null' => true),
163 'LoginName' => array('Type' => 'String', 'Caption' => 'Přihlašovací jméno', 'Default' => '', 'Null' => true, 'NotInList' => true),
164 'LoginPassword' => array('Type' => 'String', 'Caption' => 'Přihlašovací heslo', 'Default' => '', 'Null' => true, 'NotInList' => true),
165 'API' => array('Type' => 'TDeviceAPIType', 'Caption' => 'API', 'Default' => '', 'Null' => true),
166 ),
167 ));
168 $this->System->FormManager->RegisterClass('NetworkDeviceType', array(
169 'Title' => 'Typ síťového zařízení',
170 'Table' => 'NetworkDeviceType',
171 'Items' => array(
172 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
173 'ShowOnline' => array('Type' => 'Boolean', 'Caption' => 'Ukázat online', 'Default' => '0'),
174 'IconName' => array('Type' => 'String', 'Caption' => 'Jméno ikony', 'Default' => '0'),
175 ),
176 ));
177 $this->System->FormManager->RegisterClass('NetworkInterface', array(
178 'Title' => 'Síťové rozhraní',
179 'Table' => 'NetworkInterface',
180 'Items' => array(
181 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
182 'Type' => array('Type' => 'TNetworkInterfaceType', 'Caption' => 'Typ', 'Default' => '0'),
183 'MAC' => array('Type' => 'MacAddress', 'Caption' => 'Fyzická adresa (MAC)', 'Default' => ''),
184 'LocalIP' => array('Type' => 'IPv4Address', 'Caption' => 'IPv4', 'Default' => '', 'Null' => true),
185 'IPv6' => array('Type' => 'IPv6Address', 'Caption' => 'IPv6', 'Default' => '', 'Null' => true),
186 'ExternalIP' => array('Type' => 'IPv4Address', 'Caption' => 'Veřejná IPv4', 'Default' => '', 'Null' => true),
187 'Device' => array('Type' => 'TNetworkDevice', 'Caption' => 'Zařízení', 'Default' => ''),
188 'Online' => array('Type' => 'TOnlineState', 'Caption' => 'Běží', 'Default' => '0', 'ReadOnly' => true),
189 'LastOnline' => array('Type' => 'DateTime', 'Caption' => 'Naposledy běželo', 'Default' => '', 'ReadOnly' => true),
190 'Links' => array('Type' => 'TNetworkLinkListInterface', 'Caption' => 'Propojení', 'Default' => ''),
191 'UpDown' => array('Type' => 'TNetworkInterfaceUpDown', 'Caption' => 'Změny stavu', 'Default' => ''),
192 'Signal' => array('Type' => 'TNetworkSignalListInterface', 'Caption' => 'Signál', 'Default' => ''),
193 'Wireless' => array('Type' => 'TNetworkInterfaceWirelessListInterface', 'Caption' => 'Bezdrátové spoje', 'Default' => ''),
194
195 ),
196 ));
197 $this->System->FormManager->RegisterClass('NetworkInterfaceType', array(
198 'Title' => 'Typ síťového rozhraní',
199 'Table' => 'NetworkInterfaceType',
200 'Items' => array(
201 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
202 'MaxSpeed' => array('Type' => 'Integer', 'Caption' => 'Max. rychlost', 'Default' => '0', 'Suffix' => 'Mbit/s'),
203 'FullDuplex' => array('Type' => 'Boolean', 'Caption' => 'Plně duplexní', 'Default' => '0'),
204 'Color' => array('Type' => 'Color', 'Caption' => 'Barva', 'Default' => '0'),
205 ),
206 ));
207 $this->System->FormManager->RegisterClass('NetworkSubnet', array(
208 'Title' => 'Podsítě',
209 'DefaultSortColumn' => 'Name',
210 'Table' => 'NetworkSubnet',
211 'Items' => array(
212 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
213 'AddressRange' => array('Type' => 'String', 'Caption' => 'Rozsah adres', 'Default' => ''),
214 'Mask' => array('Type' => 'Integer', 'Caption' => 'Prefix', 'Default' => ''),
215 'DHCP' => array('Type' => 'IPv4Address', 'Caption' => 'DHCP', 'Default' => ''),
216 'Gateway' => array('Type' => 'IPv4Address', 'Caption' => 'Brána', 'Default' => ''),
217 'WINS' => array('Type' => 'IPv4Address', 'Caption' => 'WINS', 'Default' => ''),
218 'DNS' => array('Type' => 'String', 'Caption' => 'DNS', 'Default' => ''),
219 'Domain' => array('Type' => 'String', 'Caption' => 'Doména', 'Default' => ''),
220 'NTP' => array('Type' => 'String', 'Caption' => 'NTP', 'Default' => ''),
221 'Member' => array('Type' => 'TMember', 'Caption' => 'Zákazník', 'Default' => '', 'Null' => true),
222 'ExtAddressRange' => array('Type' => 'String', 'Caption' => 'Vnější rozsah adres', 'Default' => ''),
223 'ExtMask' => array('Type' => 'String', 'Caption' => 'Vnější prefix', 'Default' => ''),
224 'AddressRangeIPv6' => array('Type' => 'String', 'Caption' => 'Rozsah adres IPv6', 'Default' => ''),
225 'Configure' => array('Type' => 'Boolean', 'Caption' => 'Nastavovat', 'Default' => ''),
226 ),
227 ));
228 $this->System->FormManager->RegisterClass('NetworkLink', array(
229 'Title' => 'Síťové propojení',
230 'Table' => 'NetworkLink',
231 'Items' => array(
232 'Type' => array('Type' => 'TNetworkLinkType', 'Caption' => 'Typ', 'Default' => '1'),
233 'Interface1' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní 1', 'Default' => ''),
234 'Interface2' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní 2', 'Default' => ''),
235 ),
236 ));
237 $this->System->FormManager->RegisterClass('NetworkLinkUnion', array(
238 'Title' => 'Síťové propojení',
239 'BaseTable' => 'NetworkLink',
240 'SQL' => '(SELECT `Id`, `Type`, `Interface1` AS `Interface`, `Interface2` AS `InterfaceOther` FROM `NetworkLink`) '.
241 'UNION (SELECT `Id`, `Type`, `Interface2` AS `Interface`, `Interface1` AS `InterfaceOther` FROM `NetworkLink`)',
242 'Items' => array(
243 'Type' => array('Type' => 'TNetworkLinkType', 'Caption' => 'Typ', 'Default' => '1', 'ReadOnly' => true),
244 'Interface' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní 1', 'Default' => '', 'ReadOnly' => true),
245 'InterfaceOther' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní 2', 'Default' => '', 'ReadOnly' => true),
246 ),
247 ));
248
249 $this->System->FormManager->RegisterClass('NetworkLinkType', array(
250 'Title' => 'Typ síťového propojení',
251 'Table' => 'NetworkLinkType',
252 'Items' => array(
253 'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
254 ),
255 ));
256 $this->System->FormManager->RegisterClass('NetworkSignal', array(
257 'Title' => 'Signál rozhraní',
258 'Table' => 'NetworkSignal',
259 'DefaultSortColumn' => 'Time',
260 'DefaultSortOrder' => 1,
261 'Items' => array(
262 'Time' => array('Type' => 'DateTime', 'Caption' => 'Čas', 'Default' => ''),
263 'MAC' => array('Type' => 'MacAddress', 'Caption' => 'Fyzická adresa (MAC)', 'Default' => ''),
264 'Interface' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní', 'Default' => '', 'Null' => true),
265 'Value' => array('Type' => 'Integer', 'Caption' => 'Signál', 'Default' => '0', 'Suffix' => 'dBm'),
266 'RateRx' => array('Type' => 'Integer', 'Caption' => 'Rychlost Rx', 'Default' => '0', 'Suffix' => 'MHz'),
267 'RateTx' => array('Type' => 'Integer', 'Caption' => 'Rychlost Tx', 'Default' => '0', 'Suffix' => 'MHz'),
268 'Device' => array('Type' => 'TNetworkDevice', 'Caption' => 'Měřeno z', 'Default' => '0'),
269 ),
270 ));
271 $this->System->FormManager->RegisterClass('NetworkAddressCategory', array(
272 'Title' => 'Kategorie síťové adresy',
273 'Table' => 'NetworkAddressCategory',
274 'DefaultSortColumn' => 'Name',
275 'DefaultSortOrder' => 1,
276 'Items' => array(
277 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
278 ),
279 ));
280 $this->System->FormManager->RegisterFormType('TNetworkAddressCategory', array(
281 'Type' => 'Reference',
282 'Table' => 'NetworkAddressCategory',
283 'Id' => 'Id',
284 'Name' => 'Name',
285 'Filter' => '1',
286 ));
287 $this->System->FormManager->RegisterClass('NetworkDeviceConfig', array(
288 'Title' => 'Nastavení zařízení',
289 'Table' => 'NetworkDeviceConfig',
290 'DefaultSortColumn' => 'Time',
291 'DefaultSortOrder' => 1,
292 'Items' => array(
293 'Device' => array('Type' => 'TNetworkDevice', 'Caption' => 'Zařízení', 'Default' => ''),
294 'Time' => array('Type' => 'Date', 'Caption' => 'Čas vytvoření', 'Default' => ''),
295 'ConfigFull' => array('Type' => 'Text', 'Caption' => 'Kompletní nastavení', 'Default' => ''),
296 'ConfigCompact' => array('Type' => 'Text', 'Caption' => 'Rozdílové nastavení', 'Default' => ''),
297 ),
298 ));
299 $this->System->FormManager->RegisterClass('NetworkDomain', array(
300 'Title' => 'Síťová doména',
301 'Table' => 'NetworkDomain',
302 'DefaultSortColumn' => 'Name',
303 'DefaultSortOrder' => 1,
304 'Items' => array(
305 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
306 'Parent' => array('Type' => 'TNetworkDomain', 'Caption' => 'Nadřazená doména', 'Default' => '', 'Null' => true),
307 'Description' => array('Type' => 'String', 'Caption' => 'Popis', 'Default' => ''),
308 'Serial' => array('Type' => 'Integer', 'Caption' => 'Sériové číslo', 'Default' => '1'),
309 'Minimum' => array('Type' => 'Integer', 'Caption' => 'Minimum', 'Default' => '10800'),
310 'Retry' => array('Type' => 'Integer', 'Caption' => 'Opakování', 'Default' => '7200'),
311 'Expire' => array('Type' => 'Integer', 'Caption' => 'Čas vypršení', 'Default' => '2419200'),
312 'Refresh' => array('Type' => 'Integer', 'Caption' => 'Obnovení', 'Default' => '28800'),
313 'TTL' => array('Type' => 'Integer', 'Caption' => 'TTL', 'Default' => '86400', 'Suffix' => 'sekund'),
314 'Servers' => array('Type' => 'TNetworkDomainServerList', 'Caption' => 'Servery', 'Default' => ''),
315 'Views' => array('Type' => 'TNetworkDomainViewListDomain', 'Caption' => 'Pohledy', 'Default' => ''),
316 'ItemFilters' => array('Type' => 'TNetworkDomainItemFilterListDomain', 'Caption' => 'Filtry položek', 'Default' => ''),
317 'Aliases' => array('Type' => 'TNetworkDomainAliasListDomain', 'Caption' => 'Aliasy', 'Default' => ''),
318 ),
319 ));
320 $this->System->FormManager->RegisterFormType('TNetworkDomain', array(
321 'Type' => 'Reference',
322 'Table' => 'NetworkDomain',
323 'Id' => 'Id',
324 'Name' => 'Name',
325 'Filter' => '1',
326 ));
327 $this->System->FormManager->RegisterClass('NetworkDomainServer', array(
328 'Title' => 'Doménový server',
329 'Table' => 'NetworkDomainServer',
330 'DefaultSortColumn' => 'Address',
331 'DefaultSortOrder' => 1,
332 'Items' => array(
333 'Address' => array('Type' => 'String', 'Caption' => 'Adresa', 'Default' => ''),
334 'Domain' => array('Type' => 'TNetworkDomain', 'Caption' => 'Doména', 'Default' => ''),
335 'Sequence' => array('Type' => 'Integer', 'Caption' => 'Pořadí', 'Default' => '1'),
336 ),
337 ));
338 $this->System->FormManager->RegisterFormType('TNetworkDomainServerList', array(
339 'Type' => 'ManyToOne',
340 'Table' => 'NetworkDomainServer',
341 'Id' => 'Id',
342 'Ref' => 'Domain',
343 'Filter' => '1',
344 ));
345 $this->System->FormManager->RegisterClass('NetworkDomainView', array(
346 'Title' => 'Pohled síťové domény',
347 'Table' => 'NetworkDomainView',
348 'DefaultSortColumn' => 'Name',
349 'DefaultSortOrder' => 1,
350 'Items' => array(
351 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
352 'SysName' => array('Type' => 'String', 'Caption' => 'Systémové jméno', 'Default' => ''),
353 'Domain' => array('Type' => 'TNetworkDomain', 'Caption' => 'Doména', 'Default' => ''),
354 'AddressRange' => array('Type' => 'String', 'Caption' => 'Rozsah adres', 'Default' => ''),
355 'ItemFilters' => array('Type' => 'TNetworkDomainItemFilterListView', 'Caption' => 'Filtry položek', 'Default' => ''),
356 ),
357 ));
358 $this->System->FormManager->RegisterFormType('TNetworkDomainView', array(
359 'Type' => 'Reference',
360 'Table' => 'NetworkDomainView',
361 'Id' => 'Id',
362 'Name' => 'Name',
363 'Filter' => '1',
364 ));
365 $this->System->FormManager->RegisterFormType('TNetworkDomainViewListDomain', array(
366 'Type' => 'ManyToOne',
367 'Table' => 'NetworkDomainView',
368 'Id' => 'Id',
369 'Ref' => 'Domain',
370 'Filter' => '1',
371 ));
372 $this->System->FormManager->RegisterClass('NetworkDomainItemFilter', array(
373 'Title' => 'Filtr doménových položek',
374 'Table' => 'NetworkDomainItemFilter',
375 'DefaultSortColumn' => 'Name',
376 'DefaultSortOrder' => 1,
377 'Items' => array(
378 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
379 'Domain' => array('Type' => 'TNetworkDomain', 'Caption' => 'Domén', 'Default' => ''),
380 'AddressCategory' => array('Type' => 'TNetworkAddressCategory', 'Caption' => 'Kategorie adresy', 'Default' => ''),
381 'Suffix' => array('Type' => 'String', 'Caption' => 'Přípona jména položek', 'Default' => ''),
382 'View' => array('Type' => 'TNetworkDomainView', 'Caption' => 'Pohled', 'Default' => ''),
383 'AddressRange' => array('Type' => 'String', 'Caption' => 'Rozsah adres', 'Default' => ''),
384 ),
385 ));
386 $this->System->FormManager->RegisterFormType('TNetworkDomainItemFilterListDomain', array(
387 'Type' => 'ManyToOne',
388 'Table' => 'NetworkDomainItemFilter',
389 'Id' => 'Id',
390 'Ref' => 'Domain',
391 'Filter' => '1',
392 ));
393 $this->System->FormManager->RegisterFormType('TNetworkDomainItemFilterListView', array(
394 'Type' => 'ManyToOne',
395 'Table' => 'NetworkDomainItemFilter',
396 'Id' => 'Id',
397 'Ref' => 'View',
398 'Filter' => '1',
399 ));
400 $this->System->FormManager->RegisterClass('DeviceAPIType', array(
401 'Title' => 'Typ API zařízení',
402 'Table' => 'DeviceAPIType',
403 'Items' => array(
404 'Name' => array('Type' => 'String', 'Caption' => 'Jméno', 'Default' => ''),
405 'Devices' => array('Type' => 'TDeviceListAPI', 'Caption' => 'Zařízení', 'Default' => ''),
406 ),
407 ));
408 $this->System->FormManager->RegisterClass('NetworkInterfaceWireless', array(
409 'Title' => 'Bezdrátová rozhraní',
410 'Table' => 'NetworkInterfaceWireless',
411 'Items' => array(
412 'SSID' => array('Type' => 'String', 'Caption' => 'SSID', 'Default' => ''),
413 'MAC' => array('Type' => 'MacAddress', 'Caption' => 'MAC', 'Default' => ''),
414 'NetworkInterface' => array('Type' => 'TNetworkInterface', 'Caption' => 'Rozhraní', 'Default' => ''),
415 'TxPower' => array('Type' => 'Integer', 'Caption' => 'Výstupní výkon', 'Default' => '18', 'Suffix' => 'dBm'),
416 'CableAttenuation' => array('Type' => 'Integer', 'Caption' => 'Útlum vedení', 'Default' => '0', 'Suffix' => 'dB'),
417 'Antenna' => array('Type' => 'TProduct', 'Caption' => 'Anténa', 'Default' => '', 'Null' => true),
418 'AntenaGain' => array('Type' => 'Integer', 'Caption' => 'Zisk antény', 'Default' => '', 'Suffix' => 'dBi'),
419 'AntennaPolarity' => array('Type' => 'TAntennaPolarity', 'Caption' => 'Polarizace antény', 'Default' => '0'),
420 'Frequency' => array('Type' => 'Float', 'Caption' => 'Frekvence', 'Default' => '5600', 'Suffix' => 'MHz'),
421 'ChannelWidthLower' => array('Type' => 'Integer', 'Caption' => 'Šírka kanálu dolního', 'Default' => '0', 'Suffix' => 'MHz'),
422 'ChannelWidth' => array('Type' => 'Integer', 'Caption' => 'Šírka kanálu', 'Default' => '20', 'Suffix' => 'MHz'),
423 'ChannelWidthUpper' => array('Type' => 'Integer', 'Caption' => 'Šírka kanálu horního', 'Default' => '0', 'Suffix' => 'MHz'),
424 'Mode' => array('Type'
425 => 'TWirelessMode', 'Caption' => 'Režim', 'Default' => '0', 'Suffix' => ''),
426 'TotalPower' => array('Type' => 'Integer', 'Caption' => 'Celkový výkon', 'Default' => '20', 'Suffix' => 'dBm',
427 'SQL' => '(`TxPower` - `CableAttenuation` + `AntenaGain`)', 'ReadOnly' => true),
428 'LimitPower' => array('Type' => 'Integer', 'Caption' => 'Max. limit', 'Default' => '', 'Suffix' => 'dBm',
429 'ReadOnly' => true, 'SQL' => '(CASE WHEN `Frequency` >= 5450 AND `Frequency` <= 5725 THEN 27 ELSE 20 END)'),
430 'UnderLimit' => array('Type' => 'Boolean', 'Caption' => 'V limitu', 'Default' => '', 'Suffix' => '',
431 'ReadOnly' => true, 'SQL' => '((`TxPower` - `CableAttenuation` + `AntenaGain`) <= (CASE WHEN `Frequency` >= 5450 AND `Frequency` <= 5725 THEN 27 ELSE 20 END))'),
432 'Description' => array('Type' => 'String', 'Caption' => 'Popis', 'Default' => ''),
433 ),
434 'Actions' => array(
435 array('Caption' => 'Frekvenční plán', 'URL' => '/network/frequency-plan/'),
436 ),
437 ));
438 $this->System->FormManager->RegisterClass('NetworkInterfaceWirelessCTU', array(
439 'Title' => 'Bezdrátová rozhraní pro ČTÚ',
440 'Table' => 'NetworkInterfaceWireless',
441 'Items' => array(
442 'SSID' => array('Type' => 'String', 'Caption' => 'SSID', 'Default' => ''),
443 'MAC' => array('Type' => 'MacAddress', 'Caption' => 'MAC', 'Default' => ''),
444 'TxPower' => array('Type' => 'Integer', 'Caption' => 'Výstupní výkon', 'Default' => '18', 'Suffix' => 'dBm'),
445 'CableAttenuation' => array('Type' => 'Integer', 'Caption' => 'Útlum vedení', 'Default' => '0', 'Suffix' => 'dB'),
446 'AntenaGain' => array('Type' => 'Integer', 'Caption' => 'Zisk antény', 'Default' => '', 'Suffix' => 'dBi'),
447 'AntennaPolarity' => array('Type' => 'TAntennaPolarity', 'Caption' => 'Polarizace antény', 'Default' => '0'),
448 'Frequency' => array('Type' => 'Float', 'Caption' => 'Frekvence', 'Default' => '5600', 'Suffix' => 'MHz'),
449 'ChannelWidthLower' => array('Type' => 'Integer', 'Caption' => 'Šírka kanálu dolního', 'Default' => '0', 'Suffix' => 'MHz'),
450 'ChannelWidth' => array('Type' => 'Integer', 'Caption' => 'Šírka kanálu', 'Default' => '20', 'Suffix' => 'MHz'),
451 'ChannelWidthUpper' => array('Type' => 'Integer', 'Caption' => 'Šírka kanálu horního', 'Default' => '0', 'Suffix' => 'MHz'),
452 'Mode' => array('Type' => 'TWirelessMode', 'Caption' => 'Režim', 'Default' => '0', 'Suffix' => ''),
453 'TotalPower' => array('Type' => 'Integer', 'Caption' => 'Celkový výkon', 'Default' => '20', 'Suffix' => 'dBm',
454 'SQL' => '(`TxPower` - `CableAttenuation` + `AntenaGain`)', 'ReadOnly' => true),
455 'LimitPower' => array('Type' => 'Integer', 'Caption' => 'Max. limit', 'Default' => '', 'Suffix' => 'dBm',
456 'ReadOnly' => true, 'SQL' => '(CASE WHEN `Frequency` >= 5450 AND `Frequency` <= 5725 THEN 27 ELSE 20 END)'),
457 'UnderLimit' => array('Type' => 'Boolean', 'Caption' => 'V limitu', 'Default' => '', 'Suffix' => '',
458 'ReadOnly' => true, 'SQL' => '((`TxPower` - `CableAttenuation` + `AntenaGain`) <= (CASE WHEN `Frequency` >= 5450 AND `Frequency` <= 5725 THEN 27 ELSE 20 END))'),
459 'Position' => array('Type' => 'String', 'Caption' => 'GPS poloha', 'Default' => '',
460 'SQL' => '(SELECT MapPosition.Pos FROM MapPosition WHERE MapPosition.Id=#Id)'),
461 'Description' => array('Type' => 'String', 'Caption' => 'Popis', 'Default' => ''),
462 ),
463 'Actions' => array(
464 array('Caption' => 'Frekvenční plán', 'URL' => '/network/frequency-plan/'),
465 ),
466 ));
467 $this->System->FormManager->RegisterFormType('TNetworkDevice', array(
468 'Type' => 'Reference',
469 'Table' => 'NetworkDevice',
470 'Id' => 'Id',
471 'Name' => 'Name',
472 'Filter' => '1',
473 ));
474 $this->System->FormManager->RegisterFormType('TNetworkDeviceType', array(
475 'Type' => 'Reference',
476 'Table' => 'NetworkDeviceType',
477 'Id' => 'Id',
478 'Name' => 'Name',
479 'Filter' => '1',
480 ));
481 $this->System->FormManager->RegisterFormType('TNetworkInterface', array(
482 'Type' => 'Reference',
483 'Table' => 'NetworkInterface',
484 'View' => '(SELECT NetworkInterface.*, CONCAT_WS("-", NetworkDevice.Name, NULLIF(NetworkInterface.Name, "")) AS DeviceName FROM NetworkInterface '.
485 'LEFT JOIN NetworkDevice ON NetworkDevice.Id = NetworkInterface.Device) AS T',
486 'Id' => 'Id',
487 'Name' => 'DeviceName',
488 'Filter' => '1',
489 ));
490 $this->System->FormManager->RegisterFormType('TNetworkInterfaceType', array(
491 'Type' => 'Reference',
492 'Table' => 'NetworkInterfaceType',
493 'Id' => 'Id',
494 'Name' => 'Name',
495 'Filter' => '1',
496 ));
497 $this->System->FormManager->RegisterFormType('TDeviceList', array(
498 'Type' => 'ManyToOne',
499 'Table' => 'NetworkDevice',
500 'Id' => 'Id',
501 'Ref' => 'Member',
502 'Filter' => '1',
503 ));
504 $this->System->FormManager->RegisterFormType('TDeviceListAPI', array(
505 'Type' => 'ManyToOne',
506 'Table' => 'NetworkDevice',
507 'Id' => 'Id',
508 'Ref' => 'API',
509 'Filter' => '1',
510 ));
511 $this->System->FormManager->RegisterFormType('TNetworkLinkType', array(
512 'Type' => 'Reference',
513 'Table' => 'NetworkLinkType',
514 'Id' => 'Id',
515 'Name' => 'Name',
516 'Filter' => '1',
517 ));
518 $this->System->FormManager->RegisterFormType('TDeviceAPIType', array(
519 'Type' => 'Reference',
520 'Table' => 'DeviceAPIType',
521 'Id' => 'Id',
522 'Name' => 'Name',
523 'Filter' => '1',
524 ));
525 $this->System->FormManager->RegisterFormType('TNetworkInterfaceWirelessListInterface', array(
526 'Type' => 'ManyToOne',
527 'Table' => 'NetworkInterfaceWireless',
528 'Id' => 'Id',
529 'Ref' => 'NetworkInterface',
530 'Filter' => '1',
531 ));
532 $this->System->FormManager->RegisterFormType('TInterfaceList', array(
533 'Type' => 'ManyToOne',
534 'Table' => 'NetworkInterface',
535 'Id' => 'Id',
536 'Ref' => 'Device',
537 'Filter' => '1',
538 ));
539 $this->System->FormManager->RegisterFormType('TNetworkLinkListInterface', array(
540 'Type' => 'ManyToOne',
541 'Table' => 'NetworkLinkUnion',
542 'Id' => 'Id',
543 'Ref' => 'Interface',
544 'Filter' => '1',
545 ));
546 $this->System->FormManager->RegisterFormType('TNetworkLinkListInterface1', array(
547 'Type' => 'ManyToOne',
548 'Table' => 'NetworkLink',
549 'Id' => 'Id',
550 'Ref' => 'Interface1',
551 'Filter' => '1',
552 ));
553 $this->System->FormManager->RegisterFormType('TNetworkLinkListInterface2', array(
554 'Type' => 'ManyToOne',
555 'Table' => 'NetworkLink',
556 'Id' => 'Id',
557 'Ref' => 'Interface2',
558 'Filter' => '1',
559 ));
560 $this->System->FormManager->RegisterFormType('TNetworkInterfaceUpDown', array(
561 'Type' => 'ManyToOne',
562 'Table' => 'NetworkInterfaceUpDown',
563 'Id' => 'Id',
564 'Ref' => 'Interface',
565 'Filter' => '1',
566 ));
567
568 $this->System->ModuleManager->Modules['IS']->RegisterDashboardItem('Network',
569 array('ModuleNetwork', 'ShowDashboardItem'));
570 }
571
572 function ShowDashboardItem()
573 {
574 $Output = '';
575 $DbResult = $this->Database->select('NetworkDevice', 'COUNT(*)', '1');
576 $DbRow = $DbResult->fetch_row();
577 $Output .= 'Síťových zařízení: registrovaných:'.$DbRow['0'];
578
579 $DbResult = $this->Database->select('NetworkDevice', 'COUNT(*)', '`Used`=1');
580 $DbRow = $DbResult->fetch_row();
581 $Output .= ' použitých:'.$DbRow['0'].'<br>';
582
583 $DbResult = $this->Database->select('NetworkInterface', 'COUNT(*)', '1');
584 $DbRow = $DbResult->fetch_row();
585 $Output .= 'Síťových rozhraní: '.$DbRow['0'].'<br>';
586
587 $DbResult = $this->Database->select('NetworkSubnet', 'COUNT(*)', '1');
588 $DbRow = $DbResult->fetch_row();
589 $Output .= 'Síťových podsítí: '.$DbRow['0'].'<br/>';
590 return $Output;
591 }
592
593 function DoStop()
594 {
595 }
596}
Note: See TracBrowser for help on using the repository browser.