Ejemplo n.º 1
0
 /**
  * @param array $formData
  *
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  */
 protected function executePost(array $formData)
 {
     return $this->actionHelper->handlePostAction(function () use($formData) {
         $this->unsubscribeFormValidation->validate($formData);
         $bool = $this->accountStatusHelper->changeAccountStatus(Newsletter\Helper\AccountStatus::ACCOUNT_STATUS_DISABLED, ['mail' => $formData['mail']]);
         $this->setTemplate($this->get('core.helpers.alerts')->confirmBox($this->translator->t('newsletter', $bool !== false ? 'unsubscribe_success' : 'unsubscribe_error'), $this->appPath->getWebRoot()));
     });
 }
Ejemplo n.º 2
0
 /**
  * @param string $hash
  */
 public function execute($hash)
 {
     try {
         $this->activateAccountFormValidation->validate(['hash' => $hash]);
         $bool = $this->accountStatusHelper->changeAccountStatus(Newsletter\Helper\AccountStatus::ACCOUNT_STATUS_CONFIRMED, ['hash' => $hash]);
         $this->setTemplate($this->get('core.helpers.alerts')->confirmBox($this->translator->t('newsletter', $bool !== false ? 'activate_success' : 'activate_error'), $this->appPath->getWebRoot()));
     } catch (Core\Validation\Exceptions\ValidationFailedException $e) {
         $this->setContent($this->get('core.helpers.alerts')->errorBox($e->getMessage()));
     }
 }
Ejemplo n.º 3
0
 /**
  * @param string $action
  *
  * @return mixed
  * @throws \ACP3\Core\Controller\Exception\ResultNotExistsException
  */
 public function execute($action = '')
 {
     return $this->actionHelper->handleDeleteAction($action, function (array $items) {
         $bool = false;
         foreach ($items as $item) {
             $bool = $this->accountStatusHelper->changeAccountStatus(Newsletter\Helper\AccountStatus::ACCOUNT_STATUS_DISABLED, $item);
         }
         return $bool;
     });
 }
Ejemplo n.º 4
0
 /**
  * @param int $id
  *
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  */
 public function execute($id)
 {
     $bool = $this->accountStatusHelper->changeAccountStatus(Newsletter\Helper\AccountStatus::ACCOUNT_STATUS_CONFIRMED, $id);
     return $this->redirectMessages()->setMessage($bool, $this->translator->t('newsletter', $bool !== false ? 'activate_success' : 'activate_error'));
 }