public function prepareData() { parent::prepareData(); $this->initForm(); if ($this->form->isSubmitted()) { CoreServices::get('db')->transactionStart(); $this->initRecord(); $this->prepareAdditionalData(); $this->initActions(); $this->getMenuData(); $this->createFormFields(); $this->setFormFieldValuesFromRequest(); $this->addFormValidators(); $this->handleRequest(); CoreServices::get('db')->transactionCommit(); } else { $this->initRecord(); $this->prepareAdditionalData(); $this->initActions(); $this->getMenuData(); $this->createFormFields(); $this->setFormValuesFromRecord(); } if (!is_null($this->redirectAddress)) { CoreUtils::redirect($this->redirectAddress); } }
public function prepareData() { parent::prepareData(); if (CoreServices2::getRequest()->getFromGet('_sm')) { $this->successMessage = 1; return; } $this->dao = new UserDAO(); $this->initRecord(); $this->initForm(); $this->createFormFields(); if (empty($this->record['id'])) { // @TODO: własciwie w tym wypadku powinno sie przejść z powrotem do pierwszego // formularza i rozpocząć całą procedurę od nowa $this->errorMessageContainer = new CoreFormValidationMessageContainer(); $this->errorMessageContainer->addMessage('errorInvalidCode'); return; } if ($this->form->isSubmitted()) { $this->addFormValidators(); $this->form->setFieldValuesFromRequest(); $this->handleRequest(); } else { $this->setFormFieldValuesFromRecord(); } if (!empty($this->redirectAddress)) { CoreUtils::redirect($this->redirectAddress); } }
protected function handleLoginForm() { if (!empty($this->currentUser['id'])) { if (CoreServices2::getRequest()->getFromGet('logout') == 1) { CoreServices2::getAccess()->logout(); $this->redirectToHomePage(); } } else { $currentPage = CoreServices2::getUrl()->getCurrentExactAddress(); $this->loginForm = new CoreForm('post', CoreServices2::getUrl()->getCurrentExactAddress(), 'loginForm'); $this->createLoginFormFields(); if ($this->loginForm->isSubmitted()) { //$this->addLoginFormValidators(); CoreServices2::getAccess()->logout(); $this->loginForm->setFieldValuesFromRequest(); $this->loginErrorMessageContainer = $this->loginForm->getValidationResults(); if (!$this->loginErrorMessageContainer->isAnyErrorMessage()) { $this->loginAndReload(); } } } }