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

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