0) foreach($Menu as $Item) $Title .= '
'.$Item.'
'; return('
'.$Title.'
'.$Content.'
'); } function ShowUserPanel() { $Output = ''; if($this->System->User->User['Id'] != null) { $Actions = ''; foreach($this->System->ModuleManager->Modules['User']->UserPanel as $Action) { if(is_string($Action[0])) { $Class = new $Action[0]($this->System); $Actions .= $Class->$Action[1](); } else $Actions .= call_user_func($Action).'
'; } $Actions .= 'Úprava jídelníčku'; $Output .= '
'; $Output .= $this->Panel('Nabídka uživatele', $Actions); $Output .= ''; //$Output .= $this->Panel('Přehled', $this->UserPanel()); $Output .= '
'; } else $Output .= $this->SystemMessage('Oprávnění', 'Nejste přihlášen'); return($Output); } function Show() { $Output = ''; if(array_key_exists('Action', $_GET)) { $Action = $_GET['Action']; if($Action == 'LoginForm') { $Form = new Form($this->System->FormManager); $Form->SetClass('UserLogin'); $Form->OnSubmit = '?Action=Login'; $Output .= $Form->ShowEditForm(); $Outptu .= '
'; if($this->System->Modules['User']->RegistrationEnabled) $Output .= 'Registrovat se '; if($this->System->Modules['User']->PasswordRecoveryEnabled) $Output .= 'Obnova zapomenutého hesla'; $Output .= '
'; } else if($Action == 'Login') { if(array_key_exists('Username', $_POST) and array_key_exists('Password', $_POST)) { $Form = new Form($this->System->FormManager); $Form->SetClass('UserLogin'); $Form->OnSubmit = '?Action=Login'; if(array_key_exists('StayLogged', $_POST) and ($_POST['StayLogged'] == 'on')) $StayLogged = true; else $StayLogged = false; $Result = $this->System->User->Login($_POST['Username'], $_POST['Password'], $StayLogged); $Output .= $this->SystemMessage('Přihlášení', $Result); if($Result <> USER_LOGGED_IN) { $Form->LoadValuesFromForm(); $Form->Values['Password'] = ''; $Output .= $Form->ShowEditForm(); $Output .= '
'; if($this->System->Modules['User']->RegistrationEnabled) $Output .= 'Registrovat se '; if($this->System->Modules['User']->PasswordRecoveryEnabled) $Output .= 'Obnova zapomenutého hesla'; $Output .= '
'; } else { //$Output .= '
Za 5 sekund budete přesměrováni na nabídku uživatele
'; //Header('refresh:5;url=?Action=UserMenu'); Header('Location: ?Action=UserMenu'); } } else $Output .= $this->SystemMessage('Přihlášení', 'Nezadány přihlašovací údaje'); } else if($Action == 'Logout') { if($this->System->User->User['Id'] != null) { $Output .= $this->SystemMessage('Odhlášení', $this->System->User->Logout()); } else $Output .= $this->SystemMessage('Nastavení uživatele', 'Nejste přihlášen'); } else if($Action == 'UserOptions') { if($this->System->User->User['Id'] != null) { $Form = new Form($this->System->FormManager); $Form->SetClass('UserOptions'); $Form->LoadValuesFromDatabase($this->System->User->User['Id']); $Form->OnSubmit = '?Action=UserOptionsSave'; $Output .= $Form->ShowEditForm(); } else $Output .= $this->SystemMessage('Nastavení uživatele', 'Nejste přihlášen'); } else if($Action == 'UserOptionsSave') { $Form = new Form($this->System->FormManager); $Form->SetClass('UserOptions'); $Form->LoadValuesFromForm(); $Form->SaveValuesToDatabase($this->System->User->User['Id']); $Output .= $this->SystemMessage('Nastavení', 'Nastavení uloženo.'); $this->System->ModuleManager->Modules['Log']->NewRecord('User', 'Nastavení uživatele změněno', $Form->Values['Name']); $Form->LoadValuesFromDatabase($this->System->User->User['Id']); $Form->OnSubmit = '?Action=UserOptionsSave'; $Output .= $Form->ShowEditForm(); } else if($Action == 'UserRegister') { $Form = new Form($this->System->FormManager); $Form->SetClass('UserRegister'); //$Form->LoadValuesFromForm(); $Form->OnSubmit = '?Action=UserRegisterSave'; $Output .= $Form->ShowEditForm(); } else if($Action == 'UserRegisterConfirm') { $Output .= $this->SystemMessage('Potvrzení registrace', $this->System->User->RegisterConfirm($_GET['User'], $_GET['H'])); } else if($Action == 'PasswordRecovery') { $Form = new Form($this->System->FormManager); $Form->SetClass('PasswordRecovery'); $Form->OnSubmit = '?Action=PasswordRecovery2'; $Output .= $Form->ShowEditForm(); } else if($Action == 'PasswordRecovery2') { $Form = new Form($this->System->FormManager); $Form->SetClass('PasswordRecovery'); $Form->LoadValuesFromForm(); $Result = $this->System->User->PasswordRecoveryRequest($Form->Values['Name'], $Form->Values['Email']); $Output .= $this->SystemMessage('Obnova hesla', $Result); if($Result <> USER_PASSWORD_RECOVERY_SUCCESS) { $Output .= $Form->ShowEditForm(); } } else if($Action == 'PasswordRecoveryConfirm') { $Output .= $this->SystemMessage('Obnova hesla', $this->System->User->PasswordRecoveryConfirm($_GET['User'], $_GET['H'], $_GET['P'])); } else if($Action == 'UserRegisterSave') { $Form = new Form($this->System->FormManager); $Form->SetClass('UserRegister'); $Form->LoadValuesFromForm(); $Result = $this->System->User->Register($Form->Values['Login'], $Form->Values['Password'], $Form->Values['Password2'], $Form->Values['Email'], $Form->Values['Name'], $Form->Values['PhoneNumber'], $Form->Values['ICQ']); $Output .= $this->SystemMessage('Registrace nového účtu', $Result); if($Result <> USER_REGISTRATED) { $Form->OnSubmit = '?Action=UserRegisterSave'; $Output .= $Form->ShowEditForm(); } } else if($Action == 'UserMenu') { $Output = $this->ShowUserPanel(); } else $Output = $this->ShowMain(); } else $Output = $this->ShowMain(); return($Output); } function ShowMain() { $Output = 'Nebyla vybrána akce'; return($Output); } }