Changeset 634 for trunk/Modules/Portal
- Timestamp:
- Jan 19, 2014, 2:28:30 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Portal/Portal.php
r630 r634 42 42 ), 43 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 44 $this->System->ModuleManager->Modules['User']->UserPanel[] = array('PagePortal', 'UserPanel'); 92 45 } 93 46 … … 161 114 function UserPanel() 162 115 { 163 $Output = '<a href="'.$this->System->Link('/ ?Action=UserOptions').'">Profil</a><br />';116 $Output = '<a href="'.$this->System->Link('/user/?Action=UserOptions').'">Profil</a><br />'; 164 117 if($this->System->User->CheckPermission('Finance', 'MemberOptions')) 165 118 $Output .= '<a href="'.$this->System->Link('/?Action=MemberOptions').'">Domácnost</a><br />'; … … 226 179 { 227 180 $Output .= $this->System->ModuleManager->Modules['News']->CustomizeSave(); 228 } else229 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 } else238 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 } else263 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 } else270 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 } else281 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 } else293 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 } else301 if($Action == 'UserRegisterConfirm')302 {303 $Output .= $this->SystemMessage('Potvrzení registrace',304 $this->System->User->RegisterConfirm($_GET['User'], $_GET['H']));305 } else306 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 } else313 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 } else325 if($Action == 'PasswordRecoveryConfirm')326 {327 $Output .= $this->SystemMessage('Obnova hesla', $this->System->User->PasswordRecoveryConfirm($_GET['User'], $_GET['H'], $_GET['P']));328 } else329 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 181 } else 343 182 if($Action == 'MemberOptions') … … 396 235 $Form->OnSubmit = '?Action=MemberOptionsSave'; 397 236 $Output .= $Form->ShowEditForm(); 398 } else 399 if($Action == 'UserMenu') 400 { 401 $Output = $this->ShowUserPanel(); 402 } else $Output = $this->ShowMain(); 237 } 403 238 } else $Output = $this->ShowMain(); 404 239 return($Output); … … 439 274 $Output .= '</tr></table>'; 440 275 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 } 276 } 456 277 }
Note:
See TracChangeset
for help on using the changeset viewer.