/**
  * Read Label of a field from given UID
  *
  * @param string $marker Field Marker
  * @param \In2code\Powermail\Domain\Model\Form $form
  * @param string $property Field Property
  * @return string Property
  */
 public function render($marker, \In2code\Powermail\Domain\Model\Form $form, $property)
 {
     $field = $this->fieldRepository->findByMarkerAndForm($marker, $form->getUid());
     if (method_exists($field, 'get' . ucfirst($property))) {
         return $field->{'get' . ucfirst($property)}();
     }
     return '';
 }
 /**
  * Get a Property from Field by given Marker and Form
  *
  * @param string $marker Field Marker
  * @param Form $form
  * @param string $property Field Property
  * @return string Property
  */
 public function render($marker, Form $form, $property)
 {
     $field = $this->fieldRepository->findByMarkerAndForm($marker, $form->getUid());
     if ($field !== null) {
         return ObjectAccess::getProperty($field, $property);
     }
     return '';
 }
Exemplo n.º 3
0
 /**
  * Returns form with password from given UID
  *
  * @param \In2code\Powermail\Domain\Model\Form $form
  * @return \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult
  */
 public function hasPassword(\In2code\Powermail\Domain\Model\Form $form)
 {
     $query = $this->createQuery();
     $query->getQuerySettings()->setRespectStoragePage(FALSE);
     $and = array($query->equals('uid', $form->getUid()), $query->equals('pages.fields.type', 'password'));
     $query->matching($query->logicalAnd($and));
     return $query->execute();
 }
Exemplo n.º 4
0
 /**
  * Get all pages with tt_content with a Powermail Plugin
  *
  * @param \In2code\Powermail\Domain\Model\Form $form
  * @return array
  */
 public function getPagesWithContentRelatedToForm($form)
 {
     $query = $this->createQuery();
     $searchString = '%<field index=\\"settings.flexform.main.form\\">';
     $searchString .= '\\n                    <value index=\\"vDEF\\">' . $form->getUid() . '</value>%';
     $sql = 'select distinct pages.title, pages.uid';
     $sql .= ' from pages left join tt_content on tt_content.pid = pages.uid';
     $sql .= ' where tt_content.list_type = "powermail_pi1"';
     $sql .= ' and tt_content.deleted = 0 and pages.deleted = 0';
     $sql .= ' and tt_content.pi_flexform like "' . $searchString . '"';
     $result = $query->statement($sql)->execute(TRUE);
     return $result;
 }
Exemplo n.º 5
0
 /**
  * Returns Data Attribute Array to enable parsley
  *
  * @param \In2code\Powermail\Domain\Model\Form $form
  * @param \array $additionalAttributes To add further attributes
  * @return \array for data attributes
  */
 public function render(\In2code\Powermail\Domain\Model\Form $form, $additionalAttributes = array())
 {
     $dataArray = $additionalAttributes;
     // add parsley attribute
     if ($this->isClientValidationEnabled()) {
         $dataArray['data-parsley-validate'] = 'data-parsley-validate';
     }
     // add attribute for html5 validation
     if ($this->isNativeValidationEnabled()) {
         $dataArray['data-validate'] = 'html5';
     }
     // add ajax attribute
     if ($this->settings['misc']['ajaxSubmit'] === '1') {
         $dataArray['data-powermail-ajax'] = 'true';
         $dataArray['data-powermail-form'] = $form->getUid();
     }
     return $dataArray;
 }
 /**
  * Returns Data Attribute Array to enable parsley
  *
  * @param Form $form
  * @param array $additionalAttributes To add further attributes
  * @return array for data attributes
  */
 public function render(Form $form, $additionalAttributes = [])
 {
     if ($this->isClientValidationEnabled()) {
         $additionalAttributes['data-parsley-validate'] = 'data-parsley-validate';
     }
     if ($this->isNativeValidationEnabled()) {
         $additionalAttributes['data-validate'] = 'html5';
     }
     if ($this->settings['misc']['ajaxSubmit'] === '1') {
         $additionalAttributes['data-powermail-ajax'] = 'true';
         $additionalAttributes['data-powermail-form'] = $form->getUid();
         if ($this->addRedirectUri) {
             /** @var RedirectUriService $redirectService */
             $redirectService = GeneralUtility::makeInstance(ObjectManager::class)->get(RedirectUriService::class, $this->contentObject);
             $redirectUri = $redirectService->getRedirectUri();
             if ($redirectUri) {
                 $additionalAttributes['data-powermail-ajax-uri'] = $redirectUri;
             }
         }
     }
     return $additionalAttributes;
 }
 /**
  * Returns Data Attribute Array to enable parsley
  *
  * @param Form $form
  * @param array $additionalAttributes To add further attributes
  * @return array for data attributes
  */
 public function render(Form $form, $additionalAttributes = array())
 {
     if ($this->isClientValidationEnabled()) {
         $additionalAttributes['data-parsley-validate'] = 'data-parsley-validate';
     }
     if ($this->isNativeValidationEnabled()) {
         $additionalAttributes['data-validate'] = 'html5';
     }
     if ($this->settings['misc']['ajaxSubmit'] === '1') {
         $additionalAttributes['data-powermail-ajax'] = 'true';
         $additionalAttributes['data-powermail-form'] = $form->getUid();
         if ($this->addRedirectUri) {
             /** @var RedirectUriService $redirectService */
             $redirectService = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager')->get('In2code\\Powermail\\Domain\\Service\\RedirectUriService', $this->contentObject);
             $redirectUri = $redirectService->getRedirectUri();
             if ($redirectUri) {
                 $additionalAttributes['data-powermail-ajax-uri'] = $redirectUri;
             }
         }
     }
     return $additionalAttributes;
 }
Exemplo n.º 8
0
 /**
  * @param string $marker
  * @param string $value
  * @param Form $form
  * @param int $pageUid
  * @return QueryResultInterface
  */
 public function findByMarkerValueForm($marker, $value, $form, $pageUid)
 {
     $query = $this->createQuery();
     $and = array($query->equals('answers.field', $this->fieldRepository->findByMarkerAndForm($marker, $form->getUid())), $query->equals('answers.value', $value), $query->equals('pid', $pageUid));
     $query->matching($query->logicalAnd($and));
     return $query->execute();
 }
Exemplo n.º 9
0
 /**
  * Returns form with password from given UID
  *
  * @param Form $form
  * @return QueryResult
  */
 public function hasPassword(Form $form)
 {
     $query = $this->createQuery();
     $query->getQuerySettings()->setRespectStoragePage(false);
     $and = [$query->equals('uid', $form->getUid()), $query->equals('pages.fields.type', 'password')];
     $query->matching($query->logicalAnd($and));
     return $query->execute();
 }