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

Last change on this file since 377 was 377, checked in by chronos, 13 years ago
  • Upraveno: Testována instalace čisté databáze na základě definic modulů a jejich modelů.
  • Opraveno: Doplněny definice modelů pro FinanceMonthlyOverall a FinanceCharge.
  • Přidáno: Podpora pro nastavitelnost NULL hodnoty u vlastností modelů.
  • Opraveno: Řešení správného kaskádového načítání závislostí modulů.
File size: 7.7 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->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 EmailView extends ViewForm
157{
158 function __construct($Database)
159 {
160 parent::__construct($Database);
161 $this->Name = 'NewEmail';
162 $this->Title = 'Nový email';
163 $this->SubmitText = 'Odeslat';
164 $this->AddItemString('Address', 'Adresa', '');
165 $this->AddItemString('Subject', 'Předmět', '');
166 $this->AddItemText('Content', 'Obsah', '');
167 }
168}
169
170/*class NetworkDeviceView extends View
171{
172 function __construct()
173 {
174 $this->Name = 'NetworkDevice';
175 $
176 'NewNetworkDevice' => array(
177 'Title' => 'Vložit nové zařízení',
178 'Table' => 'network_devices',
179 'Items' => array(
180 'name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
181 'price' => array('Type' => 'Float', 'Caption' => 'Cena', 'Default' => 0),
182 'count' => array('Type' => 'Integer', 'Caption' => 'Počet', 'Default' => 1),
183 'date' => array('Type' => 'Time', 'Caption' => 'Datum zakoupení', 'Default' => 'Now'),
184 'segment' => array('Type' => 'TNetworkSegment', 'Caption' => 'Segment sítě', 'Default' => 0),
185 'date' => array('Type' => 'Time', 'Caption' => 'Datum zakoupení', 'Default' => 'Now'),
186 'used' => array('Type' => 'TNetworkDeviceState', 'Caption' => 'Stav', 'Default' => 0),
187 'consumption' => array('Type' => 'Integer', 'Caption' => 'Spotřeba', 'Default' => 0),
188 'user' => array('Type' => 'TFinanceSubject', 'Caption' => 'Subjekt', 'Default' => 0),
189 'info' => array('Type' => 'String', 'Caption' => 'Poznámky', 'Default' => ''),
190 'shop' => array('Type' => 'String', 'Caption' => 'Obchod', 'Default' => ''),
191 'device_id' => array('Type' => 'String', 'Caption' => 'Sériové číslo', 'Default' => ''),
192 }
193}
194
195 $FormClasses = array(
196 'NewNetworkDeviceHistory' => array(
197 'Title' => 'Vložit záznam historie zařízení',
198 'Table' => 'NetworkDeviceHistory',
199 'Items' => array(
200 'Device' => array('Type' => 'TNetworkDevice', 'Caption' => 'Zařízení', 'Default' => 0),
201 'Time' => array('Type' => 'Time', 'Caption' => 'Čas', 'Default' => 'Now'),
202 'Action' => array('Type' => 'TNetworkDeviceAction', 'Caption' => 'Akce', 'Default' => 0),
203 'Notice' => array('Type' => 'String', 'Caption' => 'Poznámka', 'Default' => ''),
204 ),
205 ),
206);
207
208
209 */
210
211
212class ModuleNetwork extends Module
213{
214 function __construct($Database, $System)
215 {
216 parent::__construct($Database, $System);
217 $this->Name = 'Network';
218 $this->Version = '1.0';
219 $this->Creator = 'Chronos';
220 $this->License = 'GNU/GPL';
221 $this->Description = 'Network device, interface and interconnection management';
222 $this->Dependencies = array('User', 'Member');
223 $this->Models = array('NetworkDevice', 'NetworkDeviceType', 'NetworkInterface',
224 'NetworkInterfaceType', 'NetworkPoint', 'NetworkLink', 'NetworkSubnet');
225 }
226
227 function Init()
228 {
229 $this->System->Pages['sit'] = 'NetworkPage';
230 }
231
232 function Install()
233 {
234 parent::Install();
235 }
236
237 function UnInstall()
238 {
239 parent::UnInstall();
240 }
241}
242
243?>
Note: See TracBrowser for help on using the repository browser.