/** * Handle user input */ public function listen() { if ($this->regCtrlr->registerLinkPressed()) { $this->regCtrlr->listen(); $this->renderRegView = true; } else { $this->logCtrlr->listen(); $this->renderRegView = false; } }
/** * Handle user input */ public function listen() { if ($this->regCtrlr->registerLinkPressed()) { $this->regCtrlr->listen(); $this->renderRegView = true; $this->renderSearchView = false; $this->renderMyProfile = false; $this->renderSettingsView = false; } else { if ($this->layoutView->searchButtonPost()) { try { $usernameSearch = $this->layoutView->getUserSearchTerm(); $this->searchController->searchUser($usernameSearch); $this->searchController->listen(); $this->renderSearchView = true; $this->renderRegView = false; $this->renderMyProfile = false; $this->renderSettingsView = false; } catch (SUsernameMissingException $e) { $this->layoutView->setSearchMsgUsernameMissing(); } catch (SInvalidCharactersException $e) { $this->layoutView->setSearchMsgInvalidCharacters(); } } else { if ($this->layoutView->logoutButtonPost()) { $this->logCtrlr->logout(); } else { if ($this->layoutView->myProfileButtonPost()) { $this->userProfileController->setUserProfile(null); $this->userProfileController->listen(); $this->renderMyProfile = true; $this->renderRegView = false; $this->renderSearchView = false; $this->renderSettingsView = false; } else { if ($this->layoutView->settingsButtonPost()) { $this->settingsController->listen(); $this->renderSettingsView = true; $this->renderMyProfile = false; $this->renderRegView = false; $this->renderSearchView = false; /* if($this->settingsController->renderProfileView()) { var_dump("Profile from settings (nested)"); $this->userProfileController->setUserProfile(null); $this->userProfileController->listen(); $this->renderMyProfile = true; $this->renderRegView = false; $this->renderSearchView = false; $this->renderSettingsView = false; } */ } else { if ($this->settingsView->saveButtonPost()) { $this->settingsController->saveChanges(); $this->renderRegView = false; $this->renderSearchView = false; $this->renderMyProfile = false; $this->renderSettingsView = false; } else { $this->logCtrlr->listen(); $this->renderRegView = false; $this->renderSearchView = false; $this->renderMyProfile = false; $this->renderSettingsView = false; } } } } } } }