public function prepareData() { parent::prepareData(); $this->form = new CoreForm('post'); $this->createFormFields(); $this->errorMessageContainer = new CoreFormValidationMessageContainer(); if (CoreServices::get('request')->isSetGet('logout')) { $this->logAction('logout'); CoreServices::get('access')->logout(); $this->currentUser = null; } elseif ($this->form->isSubmitted()) { $this->addFormValidators(); CoreServices::get('access')->logout(); $this->currentUser = null; $this->form->setFieldValuesFromRequest(); $this->errorMessageContainer = $this->form->getValidationResults(); if (!$this->errorMessageContainer->isAnyErrorMessage()) { CoreServices::get('access')->login($this->form->getField('adminName')->getValue(), $this->form->getField('password')->getValue(), $this->errorMessageContainer); $this->logAction('login'); } } if (!$this->form->isSubmitted() || !$this->errorMessageContainer->isAnyErrorMessage()) { $adminId = CoreServices::get('access')->getCurrentUserId(); if ($adminId) { $this->currentUser = CoreServices::get('access')->getCurrentUserData(); $redirectAddress = $this->getFirstAccessiblePage(); if ($redirectAddress == CoreServices::get('url')->getCurrentPageUrl()) { $this->errorMessageContainer->addMessage('youHaveNoPermissions'); } else { CoreUtils::redirect($redirectAddress); } } } }
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(); $this->initFilter(); $this->initPagination(); $this->initRecordList(); $this->prepareAdditionalData(); }
public function prepareData() { parent::prepareData(); $this->initDAO(); $this->initSearchForm(); if ($this->searchForm->isSubmitted()) { $this->searchForm->setFieldValuesFromRequest(); } $this->initRecordList(); $this->initDeletionForm(); if ($this->deletionForm->isSubmitted()) { $this->deletionForm->setFieldValuesFromRequest(); $this->handleDeleteRequest(); CoreUtils::redirect(CoreServices::get('url')->getCurrentPageUrl('_sm', 'MassDelete')); } }