Changeset 501 for trunk/Modules/Portal/Portal.php
- Timestamp:
- Mar 10, 2013, 8:15:46 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Portal/Portal.php
r494 r501 1 1 <?php 2 2 3 include_once( 'Common/Global.php');3 include_once(dirname(__FILE__).'/../../Common/Global.php'); 4 4 5 5 class PagePortal extends Page … … 45 45 $TotalUser = $DbRow[0]; 46 46 47 $DbResult = $this->Database->query('SELECT COUNT(DISTINCT(Member)) FROM NetworkDevice LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type WHERE NetworkDeviceType.ShowOnline = 1 AND NetworkDevice.Online = 1'); 47 $DbResult = $this->Database->query('SELECT COUNT(DISTINCT(Member)) FROM NetworkDevice '. 48 'LEFT JOIN NetworkDeviceType ON NetworkDeviceType.Id = NetworkDevice.Type '. 49 'WHERE NetworkDeviceType.ShowOnline = 1 AND NetworkDevice.Online = 1'); 48 50 $DbRow = $DbResult->fetch_array(); 49 51 $OnlineUser = $DbRow[0]; … … 132 134 function Show() 133 135 { 134 global $ Database, $Config, $User;136 global $Config, $User; 135 137 136 138 $Output = ''; … … 143 145 if($_GET['Action'] == 'LoginForm') 144 146 { 145 $Form = new Form('UserLogin'); 147 $Form = new Form($this->System->FormManager); 148 $Form->SetClass('UserLogin'); 146 149 $Form->OnSubmit = '?Action=Login'; 147 150 $Output .= $Form->ShowEditForm(); … … 153 156 if(array_key_exists('Username', $_POST) and array_key_exists('Password', $_POST)) 154 157 { 155 $Form = new Form('UserLogin'); 158 $Form = new Form($this->System->FormManager); 159 $Form->SetClass('UserLogin'); 156 160 $Form->OnSubmit = '?Action=Login'; 157 161 $Result = $this->System->Modules['User']->Login($_POST['Username'], $_POST['Password']); … … 178 182 if($this->System->Modules['User']->User['Id'] != null) 179 183 { 180 $UserOptions = new Form('UserOptions'); 184 $UserOptions = new Form($this->System->FormManager); 185 $UserOptions->SetClass('UserOptions'); 181 186 $UserOptions->LoadValuesFromDatabase($this->System->Modules['User']->User['Id']); 182 187 $UserOptions->OnSubmit = '?Action=UserOptionsSave'; … … 186 191 if($_GET['Action'] == 'UserOptionsSave') 187 192 { 188 $UserOptions = new Form('UserOptions', array()); 193 $UserOptions = new Form($this->System->FormManager); 194 $UserOptions->SetClass('UserOptions'); 189 195 $UserOptions->LoadValuesFromForm(); 190 196 $UserOptions->SaveValuesToDatabase($this->System->Modules['User']->User['Id']); … … 197 203 if($_GET['Action'] == 'UserRegister') 198 204 { 199 $Form = new Form('UserRegister'); 205 $Form = new Form($this->System->FormManager); 206 $Form->SetClass('UserRegister'); 200 207 //$Form->LoadValuesFromForm(); 201 208 $Form->OnSubmit = '?Action=UserRegisterSave'; … … 209 216 if($_GET['Action'] == 'PasswordRecovery') 210 217 { 211 $Form = new Form('PasswordRecovery'); 218 $Form = new Form($this->System->FormManager); 219 $Form->SetClass('PasswordRecovery'); 212 220 $Form->OnSubmit = '?Action=PasswordRecovery2'; 213 221 $Output .= $Form->ShowEditForm(); … … 215 223 if($_GET['Action'] == 'PasswordRecovery2') 216 224 { 217 $Form = new Form('PasswordRecovery'); 225 $Form = new Form($this->System->FormManager); 226 $Form->SetClass('PasswordRecovery'); 218 227 $Form->LoadValuesFromForm(); 219 228 $Result = $this->System->Modules['User']->PasswordRecoveryRequest($Form->Values['Name'], $Form->Values['Email']); … … 230 239 if($_GET['Action'] == 'UserRegisterSave') 231 240 { 232 $Form = new Form('UserRegister', array()); 241 $Form = new Form($this->System->FormManager); 242 $Form->SetClass('UserRegister'); 233 243 $Form->LoadValuesFromForm(); 234 244 $Result = $this->System->Modules['User']->Register($Form->Values['Login'], $Form->Values['Password'], $Form->Values['Password2'], $Form->Values['Email'], $Form->Values['Name'], $Form->Values['PhoneNumber'], $Form->Values['ICQ']); … … 242 252 if($_GET['Action'] == 'MemberOptions') 243 253 { 244 $UserOptions = new Form('MemberOptions'); 254 $Form = new Form($this->System->FormManager); 255 $Form->SetClass('MemberOptions'); 245 256 $DbResult = $this->Database->query('SELECT Customer FROM UserCustomerRel WHERE User='.$this->System->Modules['User']->User['Id']); 246 257 if($DbResult->num_rows > 0) … … 252 263 'ON Subject.Id = Member.Subject WHERE Member.Id='.$CustomerUserRel['Customer']); 253 264 $DbRow = $DbResult->fetch_array(); 254 foreach($ UserOptions->Definition['Items'] as $Index => $Item)265 foreach($Form->Definition['Items'] as $Index => $Item) 255 266 { 256 $ UserOptions->Values[$Index] = $DbRow[$Index];267 $Form->Values[$Index] = $DbRow[$Index]; 257 268 } 258 $ UserOptions->OnSubmit = '?Action=MemberOptionsSave';259 $Output .= $ UserOptions->ShowEditForm();269 $Form->OnSubmit = '?Action=MemberOptionsSave'; 270 $Output .= $Form->ShowEditForm(); 260 271 } else $Output .= $this->SystemMessage('Chyba', 'Nejste zákazníkem'); 261 272 } else 262 273 if($_GET['Action'] == 'MemberOptionsSave') 263 274 { 264 $UserOptions = new Form('MemberOptions'); 265 $UserOptions->LoadValuesFromForm(); 266 if($UserOptions->Values['FamilyMemberCount'] < 0) 267 $UserOptions->Values['FamilyMemberCount'] = 0; 268 if($UserOptions->Values['BillingPeriodNext'] < 2) 269 $UserOptions->Values['BillingPeriodNext'] = 2; 275 $Form = new Form($this->System->FormManager); 276 $Form->SetClass('MemberOptions'); 277 $Form->LoadValuesFromForm(); 278 if($Form->Values['FamilyMemberCount'] < 0) 279 $Form->Values['FamilyMemberCount'] = 0; 280 if($Form->Values['BillingPeriodNext'] < 2) 281 $Form->Values['BillingPeriodNext'] = 2; 270 282 271 283 $DbResult = $this->Database->update('Member', 'Id='.$this->System->Modules['User']->User['Member'], 272 array('FamilyMemberCount' => $ UserOptions->Values['FamilyMemberCount'],273 'BillingPeriodNext' => $ UserOptions->Values['BillingPeriodNext']));284 array('FamilyMemberCount' => $Form->Values['FamilyMemberCount'], 285 'BillingPeriodNext' => $Form->Values['BillingPeriodNext'])); 274 286 $DbResult = $this->Database->query('SELECT Subject FROM Member WHERE Id='.$this->System->Modules['User']->User['Member']); 275 287 $Member = $DbResult->fetch_assoc(); 276 288 $DbResult = $this->Database->update('Subject', 'Id='.$Member['Subject'], 277 array('Name' => $ UserOptions->Values['Name'], 'AddressStreet' => $UserOptions->Values['AddressStreet'],278 'AddressTown' => $ UserOptions->Values['AddressTown'], 'AddressCountry' => $UserOptions->Values['AddressCountry'],279 'AddressPSC' => $ UserOptions->Values['AddressPSC'], 'IC' => $UserOptions->Values['IC'],289 array('Name' => $Form->Values['Name'], 'AddressStreet' => $Form->Values['AddressStreet'], 290 'AddressTown' => $Form->Values['AddressTown'], 'AddressCountry' => $Form->Values['AddressCountry'], 291 'AddressPSC' => $Form->Values['AddressPSC'], 'IC' => $Form->Values['IC'], 280 292 'DIC' => $UserOptions->Values['DIC'])); 281 293 $Output .= $this->SystemMessage('Nastavení', 'Nastavení domácnosti uloženo.'); 282 $this->System->Modules['Log']->NewRecord('Member+Subject', 'Nastavení člena/subjektu změněno', $UserOptions->Values['Name']); 283 $DbResult = $this->Database->query('SELECT Member.Id, Member.FamilyMemberCount, Member.BillingPeriodNext, Subject.Name, Subject.AddressStreet, Subject.AddressTown, Subject.AddressPSC, Subject.AddressCountry, Subject.IC, Subject.DIC FROM Member JOIN Subject ON Subject.Id = Member.Subject WHERE Member.Id='.$this->System->Modules['User']->User['Member']); 294 $this->System->Modules['Log']->NewRecord('Member+Subject', 'Nastavení člena/subjektu změněno', 295 $Form->Values['Name']); 296 $DbResult = $this->Database->query('SELECT Member.Id, Member.FamilyMemberCount, Member.BillingPeriodNext, '. 297 'Subject.Name, Subject.AddressStreet, Subject.AddressTown, Subject.AddressPSC, '. 298 'Subject.AddressCountry, Subject.IC, Subject.DIC FROM Member JOIN Subject '. 299 'ON Subject.Id = Member.Subject WHERE Member.Id='.$this->System->Modules['User']->User['Member']); 284 300 $DbRow = $DbResult->fetch_array(); 285 foreach($ UserOptions->Definition['Items'] as $Index => $Item)286 { 287 $ UserOptions->Values[$Index] = $DbRow[$Index];301 foreach($Form->Definition['Items'] as $Index => $Item) 302 { 303 $Form->Values[$Index] = $DbRow[$Index]; 288 304 } 289 $ UserOptions->OnSubmit = '?Action=MemberOptionsSave';290 $Output .= $ UserOptions->ShowEditForm();305 $Form->OnSubmit = '?Action=MemberOptionsSave'; 306 $Output .= $Form->ShowEditForm(); 291 307 } 292 308 } 293 309 294 $ Database->select_db($Config['Database']['Database']);295 296 $DbResult = $ Database->query('SELECT * FROM `HyperlinkGroup`');310 $this->Database->select_db($Config['Database']['Database']); 311 312 $DbResult = $this->Database->query('SELECT * FROM `HyperlinkGroup`'); 297 313 while($DbRow = $DbResult->fetch_assoc()) 298 314 $HyperlinkGroups[$DbRow['Id']] = $DbRow; … … 302 318 //$Output .= $this->InfoBar(); 303 319 $Output .= '<table id="MainTable"><tr>'; 304 $DbResult = $ Database->select('PanelColumn', '*');320 $DbResult = $this->Database->select('PanelColumn', '*'); 305 321 while($PanelColumn = $DbResult->fetch_assoc()) 306 322 { … … 308 324 else $Width = ''; 309 325 $Output .= '<td valign="top"'.$Width.'>'; 310 $DbResult2 = $ Database->query('SELECT * FROM `Panel` WHERE `PanelColumn`='.$PanelColumn['Id'].' ORDER BY `Order`');326 $DbResult2 = $this->Database->query('SELECT * FROM `Panel` WHERE `PanelColumn`='.$PanelColumn['Id'].' ORDER BY `Order`'); 311 327 while($Panel = $DbResult2->fetch_assoc()) 312 328 {
Note:
See TracChangeset
for help on using the changeset viewer.