/**
  * 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 '';
 }
 /**
  * Read Label of a field from given UID
  *
  * @param int $uid
  * @return string Label
  */
 public function render($uid)
 {
     $result = '';
     $field = $this->fieldRepository->findByUid($uid);
     if (method_exists($field, 'getMarker')) {
         $result = $field->getMarker();
     }
     return $result;
 }
 /**
  * Check if there are localized records with
  *        tx_powermail_domain_model_fields.markers != ""
  *
  * @return bool
  */
 public function render()
 {
     $forms = $this->fieldRepository->findAllFieldsWithFilledMarkerrsInLocalizedFields();
     if (count($forms) > 0) {
         return false;
     }
     $forms = $this->fieldRepository->findAllWrongLocalizedFields();
     if (count($forms) > 0) {
         return false;
     }
     return true;
 }
 /**
  * @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();
 }
Example #6
0
File: Div.php Project: advOpk/pwm
 /**
  * Return type from given field marker and form
  *
  * @param string $marker Field marker
  * @param integer $formUid Form UID
  * @return string Field Type
  */
 public function getFieldTypeFromMarker($marker, $formUid = 0)
 {
     $field = $this->fieldRepository->findByMarkerAndForm($marker, $formUid);
     if (method_exists($field, 'getType')) {
         return $field->getType();
     }
     return '';
 }
 /**
  * Reformat array for createAction
  *
  * @return void
  */
 protected function reformatParamsForAction()
 {
     BasicFileUtility::rewriteFilesArrayToPreventDuplicatFilenames();
     $arguments = $this->request->getArguments();
     if (!isset($arguments['field'])) {
         return;
     }
     $newArguments = ['mail' => $arguments['mail']];
     // allow subvalues in new property mapper
     $mailMvcArgument = $this->arguments->getArgument('mail');
     $propertyMappingConfiguration = $mailMvcArgument->getPropertyMappingConfiguration();
     $propertyMappingConfiguration->allowProperties('answers');
     $propertyMappingConfiguration->allowCreationForSubProperty('answers');
     $propertyMappingConfiguration->allowModificationForSubProperty('answers');
     $propertyMappingConfiguration->allowProperties('form');
     $propertyMappingConfiguration->allowCreationForSubProperty('form');
     $propertyMappingConfiguration->allowModificationForSubProperty('form');
     // allow creation of new objects (for validation)
     $propertyMappingConfiguration->setTypeConverterOptions('TYPO3\\CMS\\Extbase\\Property\\TypeConverter\\PersistentObjectConverter', [PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED => true, PersistentObjectConverter::CONFIGURATION_MODIFICATION_ALLOWED => true]);
     $i = 0;
     foreach ((array) $arguments['field'] as $marker => $value) {
         // ignore internal fields (honeypod)
         if (substr($marker, 0, 2) === '__') {
             continue;
         }
         $fieldUid = $this->fieldRepository->getFieldUidFromMarker($marker, $arguments['mail']['form']);
         // Skip fields without Uid (secondary password, upload)
         if ($fieldUid === 0) {
             continue;
         }
         // allow subvalues in new property mapper
         $propertyMappingConfiguration->forProperty('answers')->allowProperties($i);
         $propertyMappingConfiguration->forProperty('answers.' . $i)->allowAllProperties();
         $propertyMappingConfiguration->allowCreationForSubProperty('answers.' . $i);
         $propertyMappingConfiguration->allowModificationForSubProperty('answers.' . $i);
         /** @var Field $field */
         $field = $this->fieldRepository->findByUid($fieldUid);
         $valueType = $field->dataTypeFromFieldType($this->fieldRepository->getFieldTypeFromMarker($marker, $arguments['mail']['form']));
         if ($valueType === 3 && is_array($value)) {
             $value = BasicFileUtility::getUniqueNamesForFileUploads($value, $this->settings, false);
         }
         if (is_array($value)) {
             if (empty($value)) {
                 $value = '';
             } else {
                 $value = json_encode($value);
             }
         }
         $newArguments['mail']['answers'][$i] = ['field' => strval($fieldUid), 'value' => $value, 'valueType' => $valueType];
         // edit form: add answer id
         if (!empty($arguments['field']['__identity'])) {
             $answer = $this->answerRepository->findByFieldAndMail($fieldUid, $arguments['field']['__identity']);
             if ($answer !== null) {
                 $newArguments['mail']['answers'][$i]['__identity'] = $answer->getUid();
             }
         }
         $i++;
     }
     // edit form: add mail id
     if (!empty($arguments['field']['__identity'])) {
         $newArguments['mail']['__identity'] = $arguments['field']['__identity'];
     }
     $this->request->setArguments($newArguments);
     $this->request->setArgument('field', null);
 }