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

Last change on this file since 371 was 371, checked in by chronos, 13 years ago
  • Přidáno: Definice modulu a modelu Subject.
File size: 7.6 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', 'Device');
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->AddPropertyString('Name');
139 $this->AddPropertyString('AddressRange');
140 $this->AddPropertyInteger('Mask');
141 $this->AddPropertyString('DHCP');
142 $this->AddPropertyString('Gateway');
143 $this->AddPropertyString('WINS');
144 $this->AddPropertyString('DNS');
145 $this->AddPropertyString('Domain');
146 $this->AddPropertyString('NTP');
147 $this->AddPropertyOneToMany('Member', 'Member');
148 $this->AddPropertyString('ExtAddressRange');
149 $this->AddPropertyInteger('ExtMask');
150 $this->AddPropertyString('AddressRangeIPv6');
151 $this->AddPropertyBoolean('Configure');
152 }
153}
154
155class EmailView extends View
156{
157 function __construct()
158 {
159 $this->Name = 'NewEmail';
160 $this->Title = 'Nový email';
161 $this->SubmitText = 'Odeslat';
162 AddItemString('Address', 'Adresa', '');
163 AddItemString('Subject', 'Předmět', '');
164 AddItemText('Content', 'Obsah', '');
165 }
166}
167
168/*class NetworkDeviceView extends View
169{
170 function __construct()
171 {
172 $this->Name = 'NetworkDevice';
173 $
174 'NewNetworkDevice' => array(
175 'Title' => 'Vložit nové zařízení',
176 'Table' => 'network_devices',
177 'Items' => array(
178 'name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
179 'price' => array('Type' => 'Float', 'Caption' => 'Cena', 'Default' => 0),
180 'count' => array('Type' => 'Integer', 'Caption' => 'Počet', 'Default' => 1),
181 'date' => array('Type' => 'Time', 'Caption' => 'Datum zakoupení', 'Default' => 'Now'),
182 'segment' => array('Type' => 'TNetworkSegment', 'Caption' => 'Segment sítě', 'Default' => 0),
183 'date' => array('Type' => 'Time', 'Caption' => 'Datum zakoupení', 'Default' => 'Now'),
184 'used' => array('Type' => 'TNetworkDeviceState', 'Caption' => 'Stav', 'Default' => 0),
185 'consumption' => array('Type' => 'Integer', 'Caption' => 'Spotřeba', 'Default' => 0),
186 'user' => array('Type' => 'TFinanceSubject', 'Caption' => 'Subjekt', 'Default' => 0),
187 'info' => array('Type' => 'String', 'Caption' => 'Poznámky', 'Default' => ''),
188 'shop' => array('Type' => 'String', 'Caption' => 'Obchod', 'Default' => ''),
189 'device_id' => array('Type' => 'String', 'Caption' => 'Sériové číslo', 'Default' => ''),
190 }
191}
192
193 $FormClasses = array(
194 'NewNetworkDeviceHistory' => array(
195 'Title' => 'Vložit záznam historie zařízení',
196 'Table' => 'NetworkDeviceHistory',
197 'Items' => array(
198 'Device' => array('Type' => 'TNetworkDevice', 'Caption' => 'Zařízení', 'Default' => 0),
199 'Time' => array('Type' => 'Time', 'Caption' => 'Čas', 'Default' => 'Now'),
200 'Action' => array('Type' => 'TNetworkDeviceAction', 'Caption' => 'Akce', 'Default' => 0),
201 'Notice' => array('Type' => 'String', 'Caption' => 'Poznámka', 'Default' => ''),
202 ),
203 ),
204);
205
206
207 */
208
209
210class ModuleNetwork extends Module
211{
212 function __construct($Database, $System)
213 {
214 parent::__construct($Database, $System);
215 $this->Name = 'Network';
216 $this->Version = '1.0';
217 $this->Creator = 'Chronos';
218 $this->License = 'GNU/GPL';
219 $this->Description = 'Network device, interface and interconnection management';
220 $this->Dependencies = array('User', 'Member');
221 $this->Models = array('NetworkDevice', 'NetworkDeviceType', 'NetworkInterface',
222 'NetworkInterfaceType', 'NetworkPoint', 'NetworkLink', 'NetworkSubnet');
223 }
224
225 function Init()
226 {
227 $this->System->Pages['sit'] = 'NetworkPage';
228 }
229
230 function Install()
231 {
232 parent::Install();
233 }
234
235 function UnInstall()
236 {
237 parent::UnInstall();
238 }
239}
240
241?>
Note: See TracBrowser for help on using the repository browser.