示例#1
0
 /**
  * @param array $formData
  * @param array $settings
  * @param int $guestbookId
  *
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  */
 protected function executePost(array $formData, array $settings, $guestbookId)
 {
     return $this->actionHelper->handleEditPostAction(function () use($formData, $settings, $guestbookId) {
         $this->adminFormValidation->setSettings($settings)->validate($formData);
         $formData['active'] = $settings['notify'] == 2 ? $formData['active'] : 1;
         $bool = $this->guestbookModel->save($formData, $guestbookId);
         return $bool;
     });
 }
示例#2
0
 /**
  * @param array $formData
  *
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  */
 protected function executePost(array $formData)
 {
     return $this->actionHelper->handlePostAction(function () use($formData) {
         $ipAddress = $this->request->getSymfonyRequest()->getClientIp();
         $this->formValidation->setIpAddress($ipAddress)->setNewsletterAccess($this->newsletterActive)->validate($formData);
         $formData['date'] = 'now';
         $formData['ip'] = $ipAddress;
         $formData['user_id'] = $this->user->isAuthenticated() ? $this->user->getUserId() : null;
         $formData['active'] = $this->guestbookSettings['notify'] == 2 ? 0 : 1;
         $lastId = $this->guestbookModel->save($formData);
         if ($this->guestbookSettings['notify'] == 1 || $this->guestbookSettings['notify'] == 2) {
             $this->sendNotificationEmail($lastId);
         }
         // Falls es der Benutzer ausgewählt hat, diesen in den Newsletter eintragen
         if ($this->newsletterActive === true && $this->newsletterSubscribeHelper && isset($formData['subscribe_newsletter']) && $formData['subscribe_newsletter'] == 1) {
             $this->newsletterSubscribeHelper->subscribeToNewsletter($formData['mail']);
         }
         return $this->redirectMessages()->setMessage($lastId, $this->translator->t('system', $lastId !== false ? 'create_success' : 'create_error'));
     });
 }
示例#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) {
         return $this->guestbookModel->delete($items);
     });
 }