1 | <?php
|
---|
2 |
|
---|
3 | include_once(dirname(__FILE__).'/../../Common/Global.php');
|
---|
4 |
|
---|
5 | class ModulePortal extends AppModule
|
---|
6 | {
|
---|
7 | function __construct($System)
|
---|
8 | {
|
---|
9 | parent::__construct($System);
|
---|
10 | $this->Name = 'Portal';
|
---|
11 | $this->Version = '1.0';
|
---|
12 | $this->Creator = 'Chronos';
|
---|
13 | $this->License = 'GNU/GPLv3';
|
---|
14 | $this->Description = 'Community portal.';
|
---|
15 | $this->Dependencies = array('News');
|
---|
16 | }
|
---|
17 |
|
---|
18 | function DoInstall()
|
---|
19 | {
|
---|
20 | }
|
---|
21 |
|
---|
22 | function DoUninstall()
|
---|
23 | {
|
---|
24 | }
|
---|
25 |
|
---|
26 | function DoStart()
|
---|
27 | {
|
---|
28 | $this->System->RegisterPage('', 'PagePortal');
|
---|
29 | $this->System->FormManager->RegisterClass('MemberOptions', array(
|
---|
30 | 'Title' => 'Nastavení domácnosti',
|
---|
31 | 'Table' => '(SELECT Member.Id, Member.FamilyMemberCount, Subject.Name, Subject.AddressStreet, Subject.AddressTown, Subject.AddressPSC, Subject.IC, Subject.DIC FROM Member JOIN Subject ON Subject.Id = Member.Subject)',
|
---|
32 | 'Items' => array(
|
---|
33 | 'Name' => array('Type' => 'String', 'Caption' => 'Fakturační jméno', 'Default' => ''),
|
---|
34 | 'AddressStreet' => array('Type' => 'String', 'Caption' => 'Ulice', 'Default' => 'Zděchov'),
|
---|
35 | 'AddressTown' => array('Type' => 'String', 'Caption' => 'Město', 'Default' => 'Zděchov'),
|
---|
36 | 'AddressPSC' => array('Type' => 'String', 'Caption' => 'PSČ', 'Default' => '75607'),
|
---|
37 | 'AddressCountry' => array('Type' => 'TCountry', 'Caption' => 'Země', 'Default' => '1'),
|
---|
38 | 'IC' => array('Type' => 'String', 'Caption' => 'IČ', 'Default' => ''),
|
---|
39 | 'DIC' => array('Type' => 'String', 'Caption' => 'DIČ', 'Default' => ''),
|
---|
40 | 'FamilyMemberCount' => array('Type' => 'Integer', 'Caption' => 'Počet osob v domácnosti', 'Default' => '', 'Suffix' => 'osob'),
|
---|
41 | 'BillingPeriodNext' => array('Type' => 'TFinanceBillingPeriod', 'Caption' => 'Požadované fakturované období', 'Default' => ''),
|
---|
42 | ),
|
---|
43 | ));
|
---|
44 | $this->System->FormManager->RegisterClass('UserOptions', array(
|
---|
45 | 'Title' => 'Základní nastavení',
|
---|
46 | 'Table' => 'User',
|
---|
47 | 'SubmitText' => 'Uložit',
|
---|
48 | 'Items' => array(
|
---|
49 | 'Login' => array('Type' => 'String', 'Caption' => 'Přihlašovací jméno', 'Default' => ''),
|
---|
50 | 'Salt' => array('Type' => 'RandomHash', 'Caption' => 'Sůl', 'Default' => ''),
|
---|
51 | 'Password' => array('Type' => 'Password', 'Caption' => 'Heslo', 'Default' => ''),
|
---|
52 | 'Name' => array('Type' => 'String', 'Caption' => 'Zobrazované jméno', 'Default' => ''),
|
---|
53 | 'Email' => array('Type' => 'String', 'Caption' => 'E-mail', 'Default' => ''),
|
---|
54 | 'PhoneNumber' => array('Type' => 'String', 'Caption' => 'Telefón', 'Default' => ''),
|
---|
55 | 'ICQ' => array('Type' => 'String', 'Caption' => 'ICQ', 'Default' => ''),
|
---|
56 | ),
|
---|
57 | ));
|
---|
58 | $this->System->FormManager->RegisterClass('UserRegister', array(
|
---|
59 | 'Title' => 'Registrace uživatele',
|
---|
60 | 'SubmitText' => 'Registrovat',
|
---|
61 | 'Table' => 'User',
|
---|
62 | 'Items' => array(
|
---|
63 | 'Login' => array('Type' => 'String', 'Caption' => 'Přihlašovací jméno', 'Default' => ''),
|
---|
64 | 'Password' => array('Type' => 'Password', 'Caption' => 'Heslo', 'Default' => ''),
|
---|
65 | 'Password2' => array('Type' => 'Password', 'Caption' => 'Potvrzení hesla', 'Default' => ''),
|
---|
66 | 'Name' => array('Type' => 'String', 'Caption' => 'Zobrazované jméno', 'Default' => ''),
|
---|
67 | 'Email' => array('Type' => 'String', 'Caption' => 'E-mail', 'Default' => ''),
|
---|
68 | 'PhoneNumber' => array('Type' => 'String', 'Caption' => 'Telefón', 'Default' => ''),
|
---|
69 | 'ICQ' => array('Type' => 'String', 'Caption' => 'ICQ', 'Default' => ''),
|
---|
70 | ),
|
---|
71 | ));
|
---|
72 | $this->System->FormManager->RegisterClass('PasswordRecovery', array(
|
---|
73 | 'Title' => 'Obnova hesla',
|
---|
74 | 'SubmitText' => 'Obnovit',
|
---|
75 | 'Table' => '',
|
---|
76 | 'Items' => array(
|
---|
77 | 'Name' => array('Type' => 'String', 'Caption' => 'Přihlašovací jméno', 'Default' => ''),
|
---|
78 | 'Email' => array('Type' => 'String', 'Caption' => 'E-mail', 'Default' => ''),
|
---|
79 | ),
|
---|
80 | ));
|
---|
81 | $this->System->FormManager->RegisterClass('UserLogin', array(
|
---|
82 | 'Title' => 'Přihlášení uživatele',
|
---|
83 | 'SubmitText' => 'Přihlásit',
|
---|
84 | 'Table' => '',
|
---|
85 | 'Items' => array(
|
---|
86 | 'Username' => array('Type' => 'String', 'Caption' => 'Přihlašovací jméno', 'Default' => ''),
|
---|
87 | 'Password' => array('Type' => 'Password', 'Caption' => 'Heslo', 'Default' => ''),
|
---|
88 | 'StayLogged' => array('Type' => 'Boolean', 'Caption' => 'Zůstat přihlášen', 'Default' => '0'),
|
---|
89 | ),
|
---|
90 | ));
|
---|
91 |
|
---|
92 | }
|
---|
93 |
|
---|
94 | function DoStop()
|
---|
95 | {
|
---|
96 | }
|
---|
97 | }
|
---|
98 |
|
---|
99 | class PagePortal extends Page
|
---|
100 | {
|
---|
101 | var $FullTitle = 'Zděchovský rozcestník';
|
---|
102 | var $ShortTitle = 'Rozcestník';
|
---|
103 |
|
---|
104 | function ShowActions($ActionGroup)
|
---|
105 | {
|
---|
106 | $Output = '';
|
---|
107 | $DbResult = $this->Database->query('SELECT `Id` FROM `Action` '.
|
---|
108 | 'WHERE (`Action`.`Group`='.$ActionGroup['Id'].') AND (`Action`.`Enable` = 1)');
|
---|
109 | while($Action = $DbResult->fetch_assoc())
|
---|
110 | {
|
---|
111 | $Output .= $this->System->ShowAction($Action['Id']).'<br/>';
|
---|
112 | }
|
---|
113 | return($this->Panel($ActionGroup['Name'], $Output));
|
---|
114 | }
|
---|
115 |
|
---|
116 | function InfoBar()
|
---|
117 | {
|
---|
118 | $Output2 = '';
|
---|
119 |
|
---|
120 | $DbResult = $this->Database->query('SELECT COUNT(*) FROM NetworkDevice LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type WHERE NetworkDeviceType.ShowOnline = 1');
|
---|
121 | $DbRow = $DbResult->fetch_array();
|
---|
122 | $TotalComputers = $DbRow[0];
|
---|
123 |
|
---|
124 | $DbResult = $this->Database->query('SELECT COUNT(*) FROM NetworkDevice LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type WHERE (NetworkDeviceType.ShowOnline = 1) AND (NetworkDevice.Online = 1)');
|
---|
125 | $DbRow = $DbResult->fetch_array();
|
---|
126 | $OnlineComputers = $DbRow[0];
|
---|
127 |
|
---|
128 | $Output = '<img alt="" src="images/favicons/comp.png" width="16" height="16" /> '.$OnlineComputers.' / '.$TotalComputers.' ';
|
---|
129 |
|
---|
130 | $DbResult = $this->Database->select('Member', 'COUNT(*)', '1');
|
---|
131 | $DbRow = $DbResult->fetch_array();
|
---|
132 | $TotalUser = $DbRow[0];
|
---|
133 |
|
---|
134 | $DbResult = $this->Database->query('SELECT COUNT(DISTINCT(Member)) FROM NetworkDevice '.
|
---|
135 | 'LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type '.
|
---|
136 | 'WHERE NetworkDeviceType.ShowOnline = 1 AND NetworkDevice.Online = 1');
|
---|
137 | $DbRow = $DbResult->fetch_array();
|
---|
138 | $OnlineUser = $DbRow[0];
|
---|
139 |
|
---|
140 | $Output .= '<img alt="" src="images/favicons/house.png" width="16" height="16" /> '.$OnlineUser.' / '.$TotalUser.' ';
|
---|
141 |
|
---|
142 | $NetworkUsage = 0;
|
---|
143 | $Output .= '<img alt="" src="images/favicons/usage.png" width="16" height="16" /> '.$NetworkUsage.' % ';
|
---|
144 |
|
---|
145 | //$Output .= 'Server běží: '.$this->GetServerUptime().' ';
|
---|
146 |
|
---|
147 | if($this->System->User->CheckPermission('Finance', 'DisplaySubjectState'))
|
---|
148 | {
|
---|
149 | $DbResult = $this->Database->select('MemberPayment', 'Cash', 'Member=(SELECT Customer FROM UserCustomerRel WHERE Id='.$this->System->User->User['Id'].')');
|
---|
150 | if($DbResult->num_rows > 0)
|
---|
151 | {
|
---|
152 | $DbRow = $DbResult->fetch_assoc();
|
---|
153 | $Output2 .= ' <img alt="" src="images/favicons/money.png" width="16" height="16" /> '.$DbRow['Cash'].' Kč';
|
---|
154 | }
|
---|
155 | }
|
---|
156 |
|
---|
157 | $Output = '<div class="Navigation"><span class="MenuItem">'.$Output.'</span><div class="MenuItem2"> '.$Output2.'</div></div>';
|
---|
158 | return($Output);
|
---|
159 | }
|
---|
160 |
|
---|
161 | function UserPanel()
|
---|
162 | {
|
---|
163 | $Output = '<a href="'.$this->System->Link('/?Action=UserOptions').'">Profil</a><br />';
|
---|
164 | if($this->System->User->CheckPermission('Finance', 'MemberOptions'))
|
---|
165 | $Output .= '<a href="'.$this->System->Link('/?Action=MemberOptions').'">Domácnost</a><br />';
|
---|
166 | if($this->System->User->CheckPermission('Finance', 'DisplaySubjectState'))
|
---|
167 | $Output .= '<a href="'.$this->System->Link('/finance/platby/').'">Finance</a><br />';
|
---|
168 | if($this->System->User->CheckPermission('Network', 'RegistredHostList'))
|
---|
169 | $Output .= '<a href="'.$this->System->Link('/network/user-hosts/').'">Počítače</a><br />';
|
---|
170 | if($this->System->User->CheckPermission('News', 'Insert'))
|
---|
171 | $Output .= '<a href="'.$this->System->Link('/aktuality/?action=add').'">Vložení aktuality</a><br />';
|
---|
172 | if($this->System->User->CheckPermission('EatingPlace', 'Edit'))
|
---|
173 | $Output .= '<a href="'.$this->System->Link('/jidelna/menuedit.php').'">Úprava jídelníčků</a><br />';
|
---|
174 | if($this->System->User->CheckPermission('Finance', 'Manage'))
|
---|
175 | $Output .= '<a href="'.$this->System->Link('/finance/sprava/').'">Správa financí</a><br />';
|
---|
176 | if($this->System->User->CheckPermission('IS', 'Manage'))
|
---|
177 | $Output .= '<a href="'.$this->System->Link('/is/').'">Správa dat</a><br />';
|
---|
178 | return($Output);
|
---|
179 | }
|
---|
180 |
|
---|
181 | function WebcamPanel()
|
---|
182 | {
|
---|
183 | $Output = $this->System->ModuleManager->Modules['WebCam']->ShowImage();
|
---|
184 | return($Output);
|
---|
185 | }
|
---|
186 |
|
---|
187 | function OnlineHostList()
|
---|
188 | {
|
---|
189 | $Output = '<span style="font-size: smaller;">';
|
---|
190 | $DbResult = $this->Database->query('SELECT NetworkDevice.Name FROM NetworkDevice LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type WHERE (NetworkDeviceType.ShowOnline = 1) AND (NetworkDevice.Online = 1) ORDER BY NetworkDevice.Name');
|
---|
191 | while($Device = $DbResult->fetch_array())
|
---|
192 | {
|
---|
193 | $Output .= $Device['Name'].'<br />';
|
---|
194 | }
|
---|
195 | $Output .= '</span>';
|
---|
196 | return($Output);
|
---|
197 | }
|
---|
198 |
|
---|
199 | function ShowBadPayerList()
|
---|
200 | {
|
---|
201 | $Output .= '<div class="PanelTitle">Dlužníci:</div><span style="font-size: smaller;">';
|
---|
202 | $DbResult = $Database->select('Subject', 'Name', 'Money < 0 ORDER BY Money');
|
---|
203 | while($Row = $DbResult->fetch_array())
|
---|
204 | {
|
---|
205 | $Output .= $Row['Name'].'<br />';
|
---|
206 | }
|
---|
207 | $Output .= '</span>';
|
---|
208 | return($Output);
|
---|
209 | }
|
---|
210 |
|
---|
211 | function Panel($Title, $Content, $Menu = array())
|
---|
212 | {
|
---|
213 | if(count($Menu) > 0)
|
---|
214 | foreach($Menu as $Item)
|
---|
215 | $Title .= '<div class="Action">'.$Item.'</div>';
|
---|
216 | return('<div class="Panel"><div class="Title">'.$Title.'</div><div class="Content">'.$Content.'</div></div>');
|
---|
217 | }
|
---|
218 |
|
---|
219 | function Show()
|
---|
220 | {
|
---|
221 | $Output = '';
|
---|
222 | if(array_key_exists('Action', $_GET))
|
---|
223 | {
|
---|
224 | $Action = $_GET['Action'];
|
---|
225 | if($Action == 'CustomizeNewsSave')
|
---|
226 | {
|
---|
227 | $Output .= $this->System->ModuleManager->Modules['News']->CustomizeSave();
|
---|
228 | } else
|
---|
229 | if($Action == 'LoginForm')
|
---|
230 | {
|
---|
231 | $Form = new Form($this->System->FormManager);
|
---|
232 | $Form->SetClass('UserLogin');
|
---|
233 | $Form->OnSubmit = '?Action=Login';
|
---|
234 | $Output .= $Form->ShowEditForm();
|
---|
235 | $Output .= '<div class="Centred"><a href="?Action=UserRegister">Registrovat se</a> '.
|
---|
236 | '<a href="?Action=PasswordRecovery">Obnova zapomenutého hesla</a></div>';
|
---|
237 | } else
|
---|
238 | if($Action == 'Login')
|
---|
239 | {
|
---|
240 | if(array_key_exists('Username', $_POST) and array_key_exists('Password', $_POST))
|
---|
241 | {
|
---|
242 | $Form = new Form($this->System->FormManager);
|
---|
243 | $Form->SetClass('UserLogin');
|
---|
244 | $Form->OnSubmit = '?Action=Login';
|
---|
245 | if(array_key_exists('StayLogged', $_POST) and ($_POST['StayLogged'] == 'on')) $StayLogged = true;
|
---|
246 | else $StayLogged = false;
|
---|
247 | $Result = $this->System->User->Login($_POST['Username'], $_POST['Password'], $StayLogged);
|
---|
248 | $Output .= $this->SystemMessage('Přihlášení', $Result);
|
---|
249 | if($Result <> USER_LOGGED_IN)
|
---|
250 | {
|
---|
251 | $Form->LoadValuesFromForm();
|
---|
252 | $Form->Values['Password'] = '';
|
---|
253 | $Output .= $Form->ShowEditForm();
|
---|
254 | $Output .= '<div class="Centred"><a href="?Action=UserRegister">Registrovat se</a> '.
|
---|
255 | '<a href="?Action=PasswordRecovery">Obnova zapomenutého hesla</a></div>';
|
---|
256 | } else {
|
---|
257 | //$Output .= '<div class="Centred">Za 5 sekund budete přesměrováni na <a href="?Action=UserMenu">nabídku uživatele</a></div>';
|
---|
258 | //Header('refresh:5;url=?Action=UserMenu');
|
---|
259 | Header('Location: ?Action=UserMenu');
|
---|
260 | }
|
---|
261 | } else $Output .= $this->SystemMessage('Přihlášení', 'Nezadány přihlašovací údaje');
|
---|
262 | } else
|
---|
263 | if($Action == 'Logout')
|
---|
264 | {
|
---|
265 | if($this->System->User->User['Id'] != null)
|
---|
266 | {
|
---|
267 | $Output .= $this->SystemMessage('Odhlášení', $this->System->User->Logout());
|
---|
268 | } else $Output .= $this->SystemMessage('Nastavení uživatele', 'Nejste přihlášen');
|
---|
269 | } else
|
---|
270 | if($Action == 'UserOptions')
|
---|
271 | {
|
---|
272 | if($this->System->User->User['Id'] != null)
|
---|
273 | {
|
---|
274 | $Form = new Form($this->System->FormManager);
|
---|
275 | $Form->SetClass('UserOptions');
|
---|
276 | $Form->LoadValuesFromDatabase($this->System->User->User['Id']);
|
---|
277 | $Form->OnSubmit = '?Action=UserOptionsSave';
|
---|
278 | $Output .= $Form->ShowEditForm();
|
---|
279 | } else $Output .= $this->SystemMessage('Nastavení uživatele', 'Nejste přihlášen');
|
---|
280 | } else
|
---|
281 | if($Action == 'UserOptionsSave')
|
---|
282 | {
|
---|
283 | $Form = new Form($this->System->FormManager);
|
---|
284 | $Form->SetClass('UserOptions');
|
---|
285 | $Form->LoadValuesFromForm();
|
---|
286 | $Form->SaveValuesToDatabase($this->System->User->User['Id']);
|
---|
287 | $Output .= $this->SystemMessage('Nastavení', 'Nastavení uloženo.');
|
---|
288 | $this->System->ModuleManager->Modules['Log']->NewRecord('User', 'Nastavení uživatele změněno', $Form->Values['Name']);
|
---|
289 | $Form->LoadValuesFromDatabase($this->System->User->User['Id']);
|
---|
290 | $Form->OnSubmit = '?Action=UserOptionsSave';
|
---|
291 | $Output .= $Form->ShowEditForm();
|
---|
292 | } else
|
---|
293 | if($Action == 'UserRegister')
|
---|
294 | {
|
---|
295 | $Form = new Form($this->System->FormManager);
|
---|
296 | $Form->SetClass('UserRegister');
|
---|
297 | //$Form->LoadValuesFromForm();
|
---|
298 | $Form->OnSubmit = '?Action=UserRegisterSave';
|
---|
299 | $Output .= $Form->ShowEditForm();
|
---|
300 | } else
|
---|
301 | if($Action == 'UserRegisterConfirm')
|
---|
302 | {
|
---|
303 | $Output .= $this->SystemMessage('Potvrzení registrace',
|
---|
304 | $this->System->User->RegisterConfirm($_GET['User'], $_GET['H']));
|
---|
305 | } else
|
---|
306 | if($Action == 'PasswordRecovery')
|
---|
307 | {
|
---|
308 | $Form = new Form($this->System->FormManager);
|
---|
309 | $Form->SetClass('PasswordRecovery');
|
---|
310 | $Form->OnSubmit = '?Action=PasswordRecovery2';
|
---|
311 | $Output .= $Form->ShowEditForm();
|
---|
312 | } else
|
---|
313 | if($Action == 'PasswordRecovery2')
|
---|
314 | {
|
---|
315 | $Form = new Form($this->System->FormManager);
|
---|
316 | $Form->SetClass('PasswordRecovery');
|
---|
317 | $Form->LoadValuesFromForm();
|
---|
318 | $Result = $this->System->User->PasswordRecoveryRequest($Form->Values['Name'], $Form->Values['Email']);
|
---|
319 | $Output .= $this->SystemMessage('Obnova hesla', $Result);
|
---|
320 | if($Result <> USER_PASSWORD_RECOVERY_SUCCESS)
|
---|
321 | {
|
---|
322 | $Output .= $Form->ShowEditForm();
|
---|
323 | }
|
---|
324 | } else
|
---|
325 | if($Action == 'PasswordRecoveryConfirm')
|
---|
326 | {
|
---|
327 | $Output .= $this->SystemMessage('Obnova hesla', $this->System->User->PasswordRecoveryConfirm($_GET['User'], $_GET['H'], $_GET['P']));
|
---|
328 | } else
|
---|
329 | if($Action == 'UserRegisterSave')
|
---|
330 | {
|
---|
331 | $Form = new Form($this->System->FormManager);
|
---|
332 | $Form->SetClass('UserRegister');
|
---|
333 | $Form->LoadValuesFromForm();
|
---|
334 | $Result = $this->System->User->Register($Form->Values['Login'], $Form->Values['Password'],
|
---|
335 | $Form->Values['Password2'], $Form->Values['Email'], $Form->Values['Name'], $Form->Values['PhoneNumber'], $Form->Values['ICQ']);
|
---|
336 | $Output .= $this->SystemMessage('Registrace nového účtu', $Result);
|
---|
337 | if($Result <> USER_REGISTRATED)
|
---|
338 | {
|
---|
339 | $Form->OnSubmit = '?Action=UserRegisterSave';
|
---|
340 | $Output .= $Form->ShowEditForm();
|
---|
341 | }
|
---|
342 | } else
|
---|
343 | if($Action == 'MemberOptions')
|
---|
344 | {
|
---|
345 | $Form = new Form($this->System->FormManager);
|
---|
346 | $Form->SetClass('MemberOptions');
|
---|
347 | $DbResult = $this->Database->query('SELECT Customer FROM UserCustomerRel WHERE User='.$this->System->User->User['Id']);
|
---|
348 | if($DbResult->num_rows > 0)
|
---|
349 | {
|
---|
350 | $CustomerUserRel = $DbResult->fetch_assoc();
|
---|
351 | $DbResult = $this->Database->query('SELECT Member.Id, '.
|
---|
352 | 'Member.FamilyMemberCount, Member.BillingPeriodNext, Subject.Name, Subject.AddressStreet, '.
|
---|
353 | 'Subject.AddressTown, Subject.AddressPSC, Subject.AddressCountry, Subject.IC, Subject.DIC FROM Member JOIN Subject '.
|
---|
354 | 'ON Subject.Id = Member.Subject WHERE Member.Id='.$CustomerUserRel['Customer']);
|
---|
355 | $DbRow = $DbResult->fetch_array();
|
---|
356 | foreach($Form->Definition['Items'] as $Index => $Item)
|
---|
357 | {
|
---|
358 | $Form->Values[$Index] = $DbRow[$Index];
|
---|
359 | }
|
---|
360 | $Form->OnSubmit = '?Action=MemberOptionsSave';
|
---|
361 | $Output .= $Form->ShowEditForm();
|
---|
362 | } else $Output .= $this->SystemMessage('Chyba', 'Nejste zákazníkem');
|
---|
363 | } else
|
---|
364 | if($Action == 'MemberOptionsSave')
|
---|
365 | {
|
---|
366 | $Form = new Form($this->System->FormManager);
|
---|
367 | $Form->SetClass('MemberOptions');
|
---|
368 | $Form->LoadValuesFromForm();
|
---|
369 | if($Form->Values['FamilyMemberCount'] < 0)
|
---|
370 | $Form->Values['FamilyMemberCount'] = 0;
|
---|
371 | if($Form->Values['BillingPeriodNext'] < 2)
|
---|
372 | $Form->Values['BillingPeriodNext'] = 2;
|
---|
373 |
|
---|
374 | $DbResult = $this->Database->update('Member', 'Id='.$this->System->User->User['Member'],
|
---|
375 | array('FamilyMemberCount' => $Form->Values['FamilyMemberCount'],
|
---|
376 | 'BillingPeriodNext' => $Form->Values['BillingPeriodNext']));
|
---|
377 | $DbResult = $this->Database->query('SELECT Subject FROM Member WHERE Id='.$this->System->User->User['Member']);
|
---|
378 | $Member = $DbResult->fetch_assoc();
|
---|
379 | $DbResult = $this->Database->update('Subject', 'Id='.$Member['Subject'],
|
---|
380 | array('Name' => $Form->Values['Name'], 'AddressStreet' => $Form->Values['AddressStreet'],
|
---|
381 | 'AddressTown' => $Form->Values['AddressTown'], 'AddressCountry' => $Form->Values['AddressCountry'],
|
---|
382 | 'AddressPSC' => $Form->Values['AddressPSC'], 'IC' => $Form->Values['IC'],
|
---|
383 | 'DIC' => $Form->Values['DIC']));
|
---|
384 | $Output .= $this->SystemMessage('Nastavení', 'Nastavení domácnosti uloženo.');
|
---|
385 | $this->System->ModuleManager->Modules['Log']->NewRecord('Member+Subject', 'Nastavení člena/subjektu změněno',
|
---|
386 | $Form->Values['Name']);
|
---|
387 | $DbResult = $this->Database->query('SELECT Member.Id, Member.FamilyMemberCount, Member.BillingPeriodNext, '.
|
---|
388 | 'Subject.Name, Subject.AddressStreet, Subject.AddressTown, Subject.AddressPSC, '.
|
---|
389 | 'Subject.AddressCountry, Subject.IC, Subject.DIC FROM Member JOIN Subject '.
|
---|
390 | 'ON Subject.Id = Member.Subject WHERE Member.Id='.$this->System->User->User['Member']);
|
---|
391 | $DbRow = $DbResult->fetch_array();
|
---|
392 | foreach($Form->Definition['Items'] as $Index => $Item)
|
---|
393 | {
|
---|
394 | $Form->Values[$Index] = $DbRow[$Index];
|
---|
395 | }
|
---|
396 | $Form->OnSubmit = '?Action=MemberOptionsSave';
|
---|
397 | $Output .= $Form->ShowEditForm();
|
---|
398 | } else
|
---|
399 | if($Action == 'UserMenu')
|
---|
400 | {
|
---|
401 | $Output = $this->ShowUserPanel();
|
---|
402 | } else $Output = $this->ShowMain();
|
---|
403 | } else $Output = $this->ShowMain();
|
---|
404 | return($Output);
|
---|
405 | }
|
---|
406 |
|
---|
407 | function ShowMain()
|
---|
408 | {
|
---|
409 | $Output = '';
|
---|
410 | $DbResult = $this->Database->query('SELECT * FROM `ActionGroup`');
|
---|
411 | while($DbRow = $DbResult->fetch_assoc())
|
---|
412 | $ActionGroups[$DbRow['Id']] = $DbRow;
|
---|
413 |
|
---|
414 | // Show pannels
|
---|
415 | //if(IsInternetAddr()) echo('Internet'); else echo('LAN');
|
---|
416 | //$Output .= $this->InfoBar();
|
---|
417 | $Output .= '<table id="MainTable"><tr>';
|
---|
418 | $DbResult = $this->Database->select('PanelColumn', '*');
|
---|
419 | while($PanelColumn = $DbResult->fetch_assoc())
|
---|
420 | {
|
---|
421 | if($PanelColumn != '') $Width = ' width="'.$PanelColumn['Width'].'"';
|
---|
422 | else $Width = '';
|
---|
423 | $Output .= '<td valign="top"'.$Width.'>';
|
---|
424 | $DbResult2 = $this->Database->query('SELECT * FROM `Panel` WHERE `PanelColumn`='.$PanelColumn['Id'].' ORDER BY `Order`');
|
---|
425 | while($Panel = $DbResult2->fetch_assoc())
|
---|
426 | {
|
---|
427 | if($Panel['Module'] == 'ActionGroup') $Output .= $this->ShowActions($ActionGroups[$Panel['Parameters']]);
|
---|
428 | else if($Panel['Module'] == 'OnlineHostList') $Output .= $this->Panel('Online počítače', $this->OnlineHostList());
|
---|
429 | else if($Panel['Module'] == 'UserOptions')
|
---|
430 | {
|
---|
431 | //if($this->System->User->User['Id'] != null) $Output .= $this->Panel('Přihlášený uživatel', $this->UserPanel());
|
---|
432 | } else
|
---|
433 | if($Panel['Module'] == 'Webcam') $Output .= $this->Panel('Kamery', $this->WebcamPanel());
|
---|
434 | else if($Panel['Module'] == 'NewsGroupList')
|
---|
435 | $Output .= $this->Panel('Aktuality', $this->System->ModuleManager->Modules['News']->Show(), array('<a href="?Action=CustomizeNews">Upravit</a>'));
|
---|
436 | }
|
---|
437 | $Output .= '</td>';
|
---|
438 | }
|
---|
439 | $Output .= '</tr></table>';
|
---|
440 | return($Output);
|
---|
441 | }
|
---|
442 |
|
---|
443 | function ShowUserPanel()
|
---|
444 | {
|
---|
445 | $Output = '';
|
---|
446 | if($this->System->User->User['Id'] != null)
|
---|
447 | {
|
---|
448 | $Output .= '<div class="Centred"><table id="MainTable"><tr><td>';
|
---|
449 | $Output .= $this->Panel('Nabídka uživatele', $this->UserPanel());
|
---|
450 | $Output .= '</td><td>';
|
---|
451 | //$Output .= $this->Panel('Přehled', $this->UserPanel());
|
---|
452 | $Output .= '</td></tr></table></div>';
|
---|
453 | } else $Output .= $this->SystemMessage('Oprávnění', 'Nejste přihlášen');
|
---|
454 | return($Output);
|
---|
455 | }
|
---|
456 | }
|
---|