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

Last change on this file since 386 was 386, checked in by chronos, 13 years ago
  • Opraveno: Řešení zobrazování navigačního pruhu.
File size: 8.9 KB
Line 
1<?php
2
3include('Dostupnost.php');
4include('Administration.php');
5include('Hosting.php');
6include('Restart.php');
7include('Subnet.php');
8include('UserHosts.php');
9include('NetworkInformation.php');
10include('HostList.php');
11
12class NetworkPage extends Page
13{
14 function __construct()
15 {
16 parent::__construct();
17 $this->FullTitle = 'Síť';
18 $this->ShortTitle = 'Síť';
19 $this->RowPerPage = 20;
20 $this->NavigationPath[] = array('Name' => $this->ShortTitle, 'URL' => 'sit');
21 }
22
23 function Show()
24 {
25 $PageClass = '';
26 if(count($this->System->PathItems) > 1)
27 {
28 if($this->System->PathItems[1] == 'dostupnost') $PageClass = 'AvailabilityPage';
29 else if($this->System->PathItems[1] == 'hosting') $PageClass = 'HostingPage';
30 else if($this->System->PathItems[1] == 'sprava') $PageClass = 'NetworkAdministrationPage';
31 else if($this->System->PathItems[1] == 'restart-sluzeb') $PageClass = 'ServiceRestartPage';
32 else if($this->System->PathItems[1] == 'pocitace') $PageClass = 'HostListPage';
33 else if($this->System->PathItems[1] == 'podsite') $PageClass = 'SubnetPage';
34 else if($this->System->PathItems[1] == 'registrovane-pocitace') $PageClass = 'NetworkHostList';
35 else if($this->System->PathItems[1] == 'wifi-kanaly') $PageClass = 'WifiChannelsPage';
36 else return(PAGE_NOT_FOUND);
37 } else $PageClass = 'NetworkInformationPage';
38 if($PageClass != '')
39 {
40 $Page = new $PageClass();
41 $Page->Database = &$this->Database;
42 $Page->Config = &$this->Config;
43 $Page->System = &$this->System;
44 $Output = $Page->Show();
45 array_shift($Page->NavigationPath);
46 $this->NavigationPath = array_merge($this->NavigationPath, $Page->NavigationPath);
47 return($Output);
48 }
49 }
50}
51
52class NetworkPoint extends Model
53{
54 function __construct($Database, $System)
55 {
56 parent::__construct($Database, $System);
57 $this->Name = 'NetworkPoint';
58 $this->AddPropertyString('Name');
59 $this->AddPropertyFloat('Latitude');
60 $this->AddPropertyFloat('Longitude');
61 $this->AddPropertyText('Description');
62 }
63}
64
65class NetworkLink extends Model
66{
67 function __construct($Database, $System)
68 {
69 parent::__construct($Database, $System);
70 $this->Name = 'NetworkLink';
71 $this->AddPropertyOneToMany('Type', 'NetworkInterfaceType');
72 $this->AddPropertyOneToMany('Interfaces', 'NetworkInterface');
73 $this->AddPropertyManyToMany('NetworkPoint', 'NetworkLinkPoints', 'Link', 'Point');
74 }
75}
76
77class NetworkInterface extends Model
78{
79 function __construct($Database, $System)
80 {
81 parent::__construct($Database, $System);
82 $this->Name = 'NetworkInterface';
83 $this->AddPropertyString('Name');
84 $this->AddPropertyOneToMany('Type', 'NetworkInterfaceType');
85 $this->AddPropertyString('MAC');
86 $this->AddPropertyString('LocalIP');
87 $this->AddPropertyString('IPv6');
88 $this->AddPropertyString('ExternalIP');
89 $this->AddPropertyOneToMany('Device', 'NetworkDevice');
90 $this->AddPropertyBoolean('Online');
91 $this->AddPropertyDateTime('LastOnline');
92 }
93}
94
95class NetworkInterfaceType extends Model
96{
97 function __construct($Database, $System)
98 {
99 parent::__construct($Database, $System);
100 $this->Name = 'NetworkInterfaceType';
101 $this->AddPropertyString('Name');
102 $this->AddPropertyInteger('MaxSpeed');
103 $this->AddPropertyBoolean('FullDuplex');
104 $this->AddPropertyString('Color');
105 }
106}
107
108
109class NetworkDevice extends Model
110{
111 function __construct($Database, $System)
112 {
113 parent::__construct($Database, $System);
114 $this->Name = 'NetworkDevice';
115 $this->AddPropertyString('Name');
116 $this->AddPropertyOneToMany('Member', 'Member');
117 $this->AddPropertyOneToMany('Location', 'Member');
118 $this->AddPropertyOneToMany('Type', 'NetworkDeviceType');
119 $this->AddPropertyFloat('PositionLatitude');
120 $this->AddPropertyFloat('PositionLongitude');
121 $this->AddPropertyBoolean('Used');
122 $this->AddPropertyBoolean('Online');
123 $this->AddPropertyDateTime('LastOnline');
124 $this->AddPropertyBoolean('PermanentOnline');
125 $this->AddPropertyInteger('InboundNATPriority');
126 }
127}
128
129class NetworkDeviceType extends Model
130{
131 function __construct($Database, $System)
132 {
133 parent::__construct($Database, $System);
134 $this->Name = 'NetworkDeviceType';
135 $this->AddPropertyString('Name');
136 $this->AddPropertyBoolean('ShowOnline');
137 $this->AddPropertyString('IconName');
138 }
139}
140
141class NetworkSubnet extends Model
142{
143 function __construct($Database, $System)
144 {
145 parent::__construct($Database, $System);
146 $this->Name = 'NetworkSubnet';
147 $this->ModelName = 'Subnet';
148 $this->AddPropertyString('Name');
149 $this->AddPropertyString('AddressRange');
150 $this->AddPropertyInteger('Mask');
151 $this->AddPropertyString('DHCP');
152 $this->AddPropertyString('Gateway');
153 $this->AddPropertyString('WINS');
154 $this->AddPropertyString('DNS');
155 $this->AddPropertyString('Domain');
156 $this->AddPropertyString('NTP');
157 $this->AddPropertyOneToMany('Member', 'Member');
158 $this->AddPropertyString('ExtAddressRange');
159 $this->AddPropertyInteger('ExtMask');
160 $this->AddPropertyString('AddressRangeIPv6');
161 $this->AddPropertyBoolean('Configure');
162 }
163}
164
165class NetworkSegment extends Model
166{
167 function __construct($Database, $System)
168 {
169 parent::__construct($Database, $System);
170 $this->Name = 'NetworkSegment';
171 $this->AddPropertyString('Name');
172 $this->AddPropertyInteger('Price');
173 $this->AddPropertyOneToMany('Parent', 'NetworkSegment');
174 $this->AddPropertyInteger('Users');
175 $this->AddPropertyInteger('Consumption');
176 $this->AddPropertyInteger('UsersOverheads');
177 }
178}
179
180class NetworkAP extends Model
181{
182 function __construct($Database, $System)
183 {
184 parent::__construct($Database, $System);
185 $this->Name = 'NetworkAP';
186 $this->AddPropertyString('SSID');
187 $this->AddPropertyInteger('Frequency');
188 $this->AddPropertyInteger('ChannelWidth');
189 $this->AddPropertyOneToMany('NetworkDevice', 'NetworkDevice');
190 }
191}
192
193
194
195class EmailView extends ViewForm
196{
197 function __construct($Database)
198 {
199 parent::__construct($Database);
200 $this->Name = 'NewEmail';
201 $this->Title = 'Nový email';
202 $this->SubmitText = 'Odeslat';
203 $this->AddItemString('Address', 'Adresa', '');
204 $this->AddItemString('Subject', 'Předmět', '');
205 $this->AddItemText('Content', 'Obsah', '');
206 }
207}
208
209/*class NetworkDeviceView extends View
210{
211 function __construct()
212 {
213 $this->Name = 'NetworkDevice';
214 $
215 'NewNetworkDevice' => array(
216 'Title' => 'Vložit nové zařízení',
217 'Table' => 'network_devices',
218 'Items' => array(
219 'name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
220 'price' => array('Type' => 'Float', 'Caption' => 'Cena', 'Default' => 0),
221 'count' => array('Type' => 'Integer', 'Caption' => 'Počet', 'Default' => 1),
222 'date' => array('Type' => 'Time', 'Caption' => 'Datum zakoupení', 'Default' => 'Now'),
223 'segment' => array('Type' => 'TNetworkSegment', 'Caption' => 'Segment sítě', 'Default' => 0),
224 'date' => array('Type' => 'Time', 'Caption' => 'Datum zakoupení', 'Default' => 'Now'),
225 'used' => array('Type' => 'TNetworkDeviceState', 'Caption' => 'Stav', 'Default' => 0),
226 'consumption' => array('Type' => 'Integer', 'Caption' => 'Spotřeba', 'Default' => 0),
227 'user' => array('Type' => 'TFinanceSubject', 'Caption' => 'Subjekt', 'Default' => 0),
228 'info' => array('Type' => 'String', 'Caption' => 'Poznámky', 'Default' => ''),
229 'shop' => array('Type' => 'String', 'Caption' => 'Obchod', 'Default' => ''),
230 'device_id' => array('Type' => 'String', 'Caption' => 'Sériové číslo', 'Default' => ''),
231 }
232}
233
234 $FormClasses = array(
235 'NewNetworkDeviceHistory' => array(
236 'Title' => 'Vložit záznam historie zařízení',
237 'Table' => 'NetworkDeviceHistory',
238 'Items' => array(
239 'Device' => array('Type' => 'TNetworkDevice', 'Caption' => 'Zařízení', 'Default' => 0),
240 'Time' => array('Type' => 'Time', 'Caption' => 'Čas', 'Default' => 'Now'),
241 'Action' => array('Type' => 'TNetworkDeviceAction', 'Caption' => 'Akce', 'Default' => 0),
242 'Notice' => array('Type' => 'String', 'Caption' => 'Poznámka', 'Default' => ''),
243 ),
244 ),
245);
246
247
248 */
249
250
251class ModuleNetwork extends Module
252{
253 function __construct($Database, $System)
254 {
255 parent::__construct($Database, $System);
256 $this->Name = 'Network';
257 $this->Version = '1.0';
258 $this->Creator = 'Chronos';
259 $this->License = 'GNU/GPL';
260 $this->Description = 'Network device, interface and interconnection management';
261 $this->Dependencies = array('User', 'Member');
262 $this->SupportedModels = array('NetworkDevice', 'NetworkDeviceType', 'NetworkInterface',
263 'NetworkInterfaceType', 'NetworkPoint', 'NetworkLink', 'NetworkSubnet',
264 'NetworkSegment', 'NetworkAP');
265 }
266
267 function Init()
268 {
269 $this->System->Pages['sit'] = 'NetworkPage';
270 }
271
272 function Install()
273 {
274 parent::Install();
275 }
276
277 function UnInstall()
278 {
279 parent::UnInstall();
280 }
281}
282
283?>
Note: See TracBrowser for help on using the repository browser.