Changeset 887 for trunk/Modules/User/UserPage.php
- Timestamp:
- Nov 20, 2020, 12:08:12 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/User/UserPage.php
r874 r887 3 3 class PageUser extends Page 4 4 { 5 var $FullTitle = 'Uživatel'; 6 var $ShortTitle = 'Uživatel'; 7 var $ParentClass = 'PagePortal'; 8 9 function Panel($Title, $Content, $Menu = array()) 5 function __construct(System $System) 6 { 7 parent::__construct($System); 8 $this->FullTitle = 'Uživatel'; 9 $this->ShortTitle = 'Uživatel'; 10 $this->ParentClass = 'PagePortal'; 11 } 12 13 function Panel(string $Title, string $Content, array $Menu = array()): string 10 14 { 11 15 if (count($Menu) > 0) … … 15 19 } 16 20 17 function ShowContacts() 21 function ShowContacts(): string 18 22 { 19 23 $Query = 'SELECT `Contact`.`Value`, `Contact`.`Description`, (SELECT `Name` FROM `ContactCategory` WHERE `ContactCategory`.`Id` = `Contact`.`Category`) AS `Category` '. 20 24 'FROM `Contact` WHERE `User` = '. 21 $this->System->User->User['Id'];25 ModuleUser::Cast($this->System->GetModule('User'))->User->User['Id']; 22 26 $DbResult = $this->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS T'); 23 27 $DbRow = $DbResult->fetch_row(); … … 53 57 } 54 58 55 function ShowUserPanel() 56 { 59 function ShowUserPanel(): string 60 { 61 $User = &ModuleUser::Cast($this->System->GetModule('User'))->User; 57 62 $Output = ''; 58 if ($ this->System->User->User['Id'] != null)63 if ($User->User['Id'] != null) 59 64 { 60 65 $Actions = ''; 61 foreach ( $this->System->ModuleManager->Modules['User']->UserPanel as $Action)66 foreach (ModuleUser::Cast($this->System->GetModule('User'))->UserPanel as $Action) 62 67 { 63 68 if (is_string($Action[0])) … … 71 76 $Output .= $this->Panel('Nabídka uživatele', $Actions); 72 77 $Output .= '</td><td style="vertical-align:top;">'; 73 if ($ this->System->User->User['Id'] != null)78 if ($User->User['Id'] != null) 74 79 { 75 80 $Form = new Form($this->System->FormManager); 76 81 $Form->SetClass('UserOptions'); 77 $Form->LoadValuesFromDatabase($ this->System->User->User['Id']);82 $Form->LoadValuesFromDatabase($User->User['Id']); 78 83 $Form->OnSubmit = '?Action=UserOptionsSave'; 79 84 $Output .= $Form->ShowViewForm(); … … 88 93 } 89 94 90 function Show() 91 { 95 function Show(): string 96 { 97 $User = &ModuleUser::Cast($this->System->GetModule('User'))->User; 92 98 $Output = ''; 93 99 if (array_key_exists('Action', $_GET)) … … 112 118 if (array_key_exists('StayLogged', $_POST) and ($_POST['StayLogged'] == 'on')) $StayLogged = true; 113 119 else $StayLogged = false; 114 $Result = $ this->System->User->Login($_POST['Username'], $_POST['Password'], $StayLogged);120 $Result = $User->Login($_POST['Username'], $_POST['Password'], $StayLogged); 115 121 $Output .= $this->SystemMessage('Přihlášení', $Result); 116 122 if ($Result <> USER_LOGGED_IN) … … 130 136 if ($Action == 'Logout') 131 137 { 132 if ($ this->System->User->User['Id'] != null)133 { 134 $Output .= $this->SystemMessage('Odhlášení', $ this->System->User->Logout());138 if ($User->User['Id'] != null) 139 { 140 $Output .= $this->SystemMessage('Odhlášení', $User->Logout()); 135 141 } else $Output .= $this->SystemMessage('Nastavení uživatele', 'Nejste přihlášen'); 136 142 } else 137 143 if ($Action == 'UserOptions') 138 144 { 139 if ($ this->System->User->User['Id'] != null)145 if ($User->User['Id'] != null) 140 146 { 141 147 $Form = new Form($this->System->FormManager); 142 148 $Form->SetClass('UserOptions'); 143 $Form->LoadValuesFromDatabase($ this->System->User->User['Id']);149 $Form->LoadValuesFromDatabase($User->User['Id']); 144 150 $Form->OnSubmit = '?Action=UserOptionsSave'; 145 151 $Output .= $Form->ShowEditForm(); … … 151 157 $Form->SetClass('UserOptions'); 152 158 $Form->LoadValuesFromForm(); 153 $Form->SaveValuesToDatabase($ this->System->User->User['Id']);159 $Form->SaveValuesToDatabase($User->User['Id']); 154 160 $Output .= $this->SystemMessage('Nastavení', 'Nastavení uloženo.'); 155 $this->System->ModuleManager->Modules['Log']->NewRecord('User', 'Nastavení uživatele změněno', $Form->Values['Name']);156 $Form->LoadValuesFromDatabase($ this->System->User->User['Id']);161 ModuleLog::Cast($this->System->GetModule('Log'))->NewRecord('User', 'Nastavení uživatele změněno', $Form->Values['Name']); 162 $Form->LoadValuesFromDatabase($User->User['Id']); 157 163 $Form->OnSubmit = '?Action=UserOptionsSave'; 158 164 $Output .= $Form->ShowEditForm(); … … 169 175 { 170 176 $Output .= $this->SystemMessage('Potvrzení registrace', 171 $ this->System->User->RegisterConfirm($_GET['User'], $_GET['H']));177 $User->RegisterConfirm($_GET['User'], $_GET['H'])); 172 178 } else 173 179 if ($Action == 'PasswordRecovery') … … 183 189 $Form->SetClass('PasswordRecovery'); 184 190 $Form->LoadValuesFromForm(); 185 $Result = $ this->System->User->PasswordRecoveryRequest($Form->Values['Name'], $Form->Values['Email']);191 $Result = $User->PasswordRecoveryRequest($Form->Values['Name'], $Form->Values['Email']); 186 192 $Output .= $this->SystemMessage('Obnova hesla', $Result); 187 193 if ($Result <> USER_PASSWORD_RECOVERY_SUCCESS) … … 192 198 if ($Action == 'PasswordRecoveryConfirm') 193 199 { 194 $Output .= $this->SystemMessage('Obnova hesla', $ this->System->User->PasswordRecoveryConfirm($_GET['User'], $_GET['H'], $_GET['P']));200 $Output .= $this->SystemMessage('Obnova hesla', $User->PasswordRecoveryConfirm($_GET['User'], $_GET['H'], $_GET['P'])); 195 201 } else 196 202 if ($Action == 'UserRegisterSave') … … 199 205 $Form->SetClass('UserRegister'); 200 206 $Form->LoadValuesFromForm(); 201 $Result = $ this->System->User->Register($Form->Values['Login'], $Form->Values['Password'],207 $Result = $User->Register($Form->Values['Login'], $Form->Values['Password'], 202 208 $Form->Values['Password2'], $Form->Values['Email'], $Form->Values['Name']); 203 209 $Output .= $this->SystemMessage('Registrace nového účtu', $Result); … … 216 222 } 217 223 218 function ShowMain() 224 function ShowMain(): string 219 225 { 220 226 $Output = 'Nebyla vybrána akce';
Note:
See TracChangeset
for help on using the changeset viewer.