Example #1
0
 /** ************************************************************************
  * @param FormBuilderInterface $builder
  * @param array $options
  **************************************************************************/
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('accountId', 'hidden', array('mapped' => false))->add('htmlString', 'hidden', array('mapped' => false))->add('operationList', 'collection', array('type' => new OperationType(), 'mapped' => false, 'label' => NULL, 'allow_add' => true, 'allow_delete' => true))->add('transferBetweenAccountList', 'collection', array('type' => new TransferBetweenAccountType(), 'mapped' => false, 'label' => NULL, 'allow_add' => true, 'allow_delete' => true));
     if ($this->account !== NULL) {
         $builder->setAction($this->router->generate('finance_operation_operation_persistimportform', array('account_id' => $this->account->getId())));
     }
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new CleanFormSubscriber(array('description' => 'html')));
     $builder->addEventSubscriber(new FormExitSubscriber('form.form', $options));
     //details
     $builder->add('name', 'text', array('label' => 'mautic.core.name', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control')));
     $builder->add('description', 'textarea', array('label' => 'mautic.core.description', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control editor'), 'required' => false));
     //add category
     $builder->add('category', 'category', array('bundle' => 'form'));
     $builder->add('template', 'theme_list', array('feature' => 'form', 'empty_value' => ' ', 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.form.form.template.help')));
     if (!empty($options['data']) && $options['data']->getId()) {
         $readonly = !$this->security->hasEntityAccess('form:forms:publishown', 'form:forms:publishother', $options['data']->getCreatedBy());
         $data = $options['data']->isPublished(false);
     } elseif (!$this->security->isGranted('form:forms:publishown')) {
         $readonly = true;
         $data = false;
     } else {
         $readonly = false;
         $data = true;
     }
     $builder->add('isPublished', 'yesno_button_group', array('read_only' => $readonly, 'data' => $data));
     $builder->add('inKioskMode', 'yesno_button_group', array('label' => 'mautic.form.form.kioskmode', 'attr' => array('tooltip' => 'mautic.form.form.kioskmode.tooltip')));
     $builder->add('publishUp', 'datetime', array('widget' => 'single_text', 'label' => 'mautic.core.form.publishup', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-toggle' => 'datetime'), 'format' => 'yyyy-MM-dd HH:mm', 'required' => false));
     $builder->add('publishDown', 'datetime', array('widget' => 'single_text', 'label' => 'mautic.core.form.publishdown', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-toggle' => 'datetime'), 'format' => 'yyyy-MM-dd HH:mm', 'required' => false));
     $builder->add('postAction', 'choice', array('choices' => array('return' => 'mautic.form.form.postaction.return', 'redirect' => 'mautic.form.form.postaction.redirect', 'message' => 'mautic.form.form.postaction.message'), 'label' => 'mautic.form.form.postaction', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'onchange' => 'Mautic.onPostSubmitActionChange(this.value);'), 'required' => false, 'empty_value' => false));
     $postAction = isset($options['data']) ? $options['data']->getPostAction() : '';
     $required = in_array($postAction, array('redirect', 'message')) ? true : false;
     $builder->add('postActionProperty', 'text', array('label' => 'mautic.form.form.postactionproperty', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control'), 'required' => $required));
     $builder->add('sessionId', 'hidden', array('mapped' => false));
     $builder->add('buttons', 'form_buttons');
     $builder->add('formType', 'hidden');
     if (!empty($options["action"])) {
         $builder->setAction($options["action"]);
     }
 }
Example #3
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('name', 'textarea', array('label' => 'ddi.lead_actions.tasks.thead.name', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'nomousetrap form-control', 'rows' => 10), 'constraints' => array(new NotBlank(array('message' => 'ddi.lead_actions.task.name.notblank')))));
     // Campaign builder form
     if (!empty($options['type'])) {
         $data = empty($options['data']['dateInterval']) ? 1 : $options['data']['dateInterval'];
         $builder->add('dateInterval', 'number', array('label' => 'ddi.lead_actions.tasks.form.due_date_after', 'attr' => array('class' => 'form-control', 'preaddon' => 'symbol-hashtag'), 'data' => $data));
         $data = !empty($options['data']['dateIntervalUnit']) ? $options['data']['dateIntervalUnit'] : 'd';
         $builder->add('dateIntervalUnit', 'choice', array('choices' => array('i' => 'mautic.campaign.event.intervalunit.choice.i', 'h' => 'mautic.campaign.event.intervalunit.choice.h', 'd' => 'mautic.campaign.event.intervalunit.choice.d', 'm' => 'mautic.campaign.event.intervalunit.choice.m', 'y' => 'mautic.campaign.event.intervalunit.choice.y'), 'multiple' => false, 'label_attr' => array('class' => 'control-label'), 'label' => false, 'attr' => array('class' => 'form-control'), 'empty_value' => false, 'required' => false, 'data' => $data));
         // Default form
     } else {
         $dueDate = $builder->create('dueDate', 'datetime', array('widget' => 'single_text', 'label' => 'ddi.lead_actions.tasks.thead.due_date', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'nomousetrap form-control', 'data-toggle' => 'datetime', 'preaddon' => 'fa fa-calendar'), 'format' => 'yyyy-MM-dd HH:mm', 'required' => true, 'constraints' => array(new NotBlank(array('message' => 'ddi.lead_actions.task.due_date.notblank')))));
         $builder->add($dueDate);
         $builder->add('buttons', 'form_buttons', array('apply_text' => false, 'save_text' => 'mautic.core.form.save'));
     }
     $assignUser = $builder->create('assignUser', 'user_list', array('label' => 'ddi.lead_actions.tasks.thead.assigned_user', 'label_attr' => array('class' => 'control-label, required'), 'attr' => array('class' => 'nomousetrap form-control'), 'required' => false, 'multiple' => false, 'constraints' => array(new NotBlank(array('message' => 'ddi.lead_actions.task.assigned_user.notblank')))));
     if (empty($options['type'])) {
         $transformer = new IdToEntityModelTransformer($this->factory->getEntityManager(), 'MauticUserBundle:User');
         $assignUser->addModelTransformer($transformer);
     }
     $builder->add($assignUser);
     if (!empty($options['action'])) {
         $builder->setAction($options['action']);
     }
 }
Example #4
0
 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new CleanFormSubscriber(['content' => 'html']));
     $builder->addEventSubscriber(new FormExitSubscriber('dynamicContent.dynamicContent', $options));
     $builder->add('name', 'text', ['label' => 'mautic.dynamicContent.form.internal.name', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control']]);
     $emojiTransformer = new EmojiToShortTransformer();
     $builder->add($builder->create('description', 'textarea', ['label' => 'mautic.dynamicContent.description', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control'], 'required' => false])->addModelTransformer($emojiTransformer));
     $builder->add('isPublished', 'yesno_button_group');
     $builder->add('language', 'locale', ['label' => 'mautic.core.language', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control'], 'required' => false]);
     $builder->add('publishUp', 'datetime', ['widget' => 'single_text', 'label' => 'mautic.core.form.publishup', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'data-toggle' => 'datetime'], 'format' => 'yyyy-MM-dd HH:mm', 'required' => false]);
     $builder->add('publishDown', 'datetime', ['widget' => 'single_text', 'label' => 'mautic.core.form.publishdown', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'data-toggle' => 'datetime'], 'format' => 'yyyy-MM-dd HH:mm', 'required' => false]);
     $builder->add('content', 'textarea', ['label' => 'mautic.dynamicContent.form.content', 'label_attr' => ['class' => 'control-label'], 'attr' => ['tooltip' => 'mautic.dynamicContent.form.content.help', 'class' => 'form-control editor editor-advanced editor-builder-tokens', 'rows' => '15'], 'required' => false]);
     $transformer = new IdToEntityModelTransformer($this->em, 'MauticDynamicContentBundle:DynamicContent');
     $builder->add($builder->create('translationParent', 'dwc_list', ['label' => 'mautic.core.form.translation_parent', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'tooltip' => 'mautic.core.form.translation_parent.help'], 'required' => false, 'multiple' => false, 'empty_value' => 'mautic.core.form.translation_parent.empty', 'top_level' => 'translation', 'ignore_ids' => [(int) $options['data']->getId()]])->addModelTransformer($transformer));
     $builder->add('category', 'category', ['bundle' => 'dynamicContent']);
     if (!empty($options['update_select'])) {
         $builder->add('buttons', 'form_buttons', ['apply_text' => false]);
         $builder->add('updateSelect', 'hidden', ['data' => $options['update_select'], 'mapped' => false]);
     } else {
         $builder->add('buttons', 'form_buttons');
     }
     if (!empty($options['action'])) {
         $builder->setAction($options['action']);
     }
 }
Example #5
0
 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new CleanFormSubscriber(['website' => 'url']));
     $builder->addEventSubscriber(new FormExitSubscriber('focus', $options));
     $builder->add('name', 'text', ['label' => 'mautic.core.name', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control']]);
     $builder->add('description', 'textarea', ['label' => 'mautic.core.description', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control editor'], 'required' => false]);
     $builder->add('website', 'url', ['label' => 'mautic.focus.form.website', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'tooltip' => 'mautic.focus.form.website.tooltip'], 'required' => false]);
     //add category
     $builder->add('category', 'category', ['bundle' => 'plugin:focus']);
     if (!empty($options['data']) && $options['data']->getId()) {
         $readonly = !$this->security->isGranted('plugin:focus:items:publish');
         $data = $options['data']->isPublished(false);
     } elseif (!$this->security->isGranted('plugin:focus:items:publish')) {
         $readonly = true;
         $data = false;
     } else {
         $readonly = false;
         $data = false;
     }
     $builder->add('isPublished', 'yesno_button_group', ['read_only' => $readonly, 'data' => $data]);
     $builder->add('publishUp', 'datetime', ['widget' => 'single_text', 'label' => 'mautic.core.form.publishup', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'data-toggle' => 'datetime'], 'format' => 'yyyy-MM-dd HH:mm', 'required' => false]);
     $builder->add('publishDown', 'datetime', ['widget' => 'single_text', 'label' => 'mautic.core.form.publishdown', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'data-toggle' => 'datetime'], 'format' => 'yyyy-MM-dd HH:mm', 'required' => false]);
     $builder->add('properties', 'focus_entity_properties', ['data' => $options['data']->getProperties()]);
     // Will be managed by JS
     $builder->add('type', 'hidden');
     $builder->add('style', 'hidden');
     $builder->add('form', 'form_list', ['label' => 'mautic.focus.form.choose_form', 'multiple' => false, 'empty_value' => '', 'attr' => ['onchange' => 'Mautic.focusUpdatePreview()']]);
     if (!empty($options['action'])) {
         $builder->setAction($options['action']);
     }
     $builder->add('buttons', 'form_buttons', ['pre_extra_buttons' => [['name' => 'builder', 'label' => 'mautic.core.builder', 'attr' => ['class' => 'btn btn-default btn-dnd btn-nospin', 'icon' => 'fa fa-cube', 'onclick' => 'Mautic.launchFocusBuilder();']]]]);
 }
Example #6
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('isPublished', 'yesno_button_group');
     $keys = $options['integration_object']->getRequiredKeyFields();
     $decryptedKeys = $options['integration_object']->decryptApiKeys($options['data']->getApiKeys());
     $builder->add('apiKeys', 'integration_keys', array('label' => false, 'integration_keys' => $keys, 'data' => $decryptedKeys, 'integration_object' => $options['integration_object']));
     $formSettings = $options['integration_object']->getFormSettings();
     if (!empty($formSettings['requires_authorization'])) {
         $disabled = false;
         $label = $options['integration_object']->isAuthorized() ? 'reauthorize' : 'authorize';
         $builder->add('authButton', 'standalone_button', array('attr' => array('class' => 'btn btn-primary', 'onclick' => 'Mautic.initiateIntegrationAuthorization()', 'icon' => 'fa fa-key'), 'label' => 'mautic.integration.form.' . $label, 'disabled' => $disabled));
     }
     $features = $options['integration_object']->getSupportedFeatures();
     if (!empty($features)) {
         // Check to see if the integration is a new entry and thus not configured
         $configured = $options['data']->getId() !== null;
         $enabledFeatures = $options['data']->getSupportedFeatures();
         $data = $configured ? $enabledFeatures : $features;
         $labels = array();
         foreach ($features as $f) {
             $labels[] = 'mautic.integration.form.feature.' . $f;
         }
         $builder->add('supportedFeatures', 'choice', array('choice_list' => new ChoiceList($features, $labels), 'expanded' => true, 'label_attr' => array('class' => 'control-label'), 'multiple' => true, 'label' => 'mautic.integration.form.features', 'required' => false, 'data' => $data));
         $builder->add('featureSettings', 'integration_featuresettings', array('label' => 'mautic.integration.form.feature.settings', 'required' => true, 'data' => $options['data']->getFeatureSettings(), 'label_attr' => array('class' => 'control-label'), 'integration' => $options['integration'], 'integration_object' => $options['integration_object'], 'lead_fields' => $options['lead_fields']));
     }
     $builder->add('name', 'hidden', array('data' => $options['integration']));
     $builder->add('in_auth', 'hidden', array('mapped' => false));
     $builder->add('buttons', 'form_buttons', array('apply_text' => false, 'save_text' => 'mautic.core.form.save'));
     if (!empty($options['action'])) {
         $builder->setAction($options['action']);
     }
 }
Example #7
0
 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new CleanFormSubscriber(array('content' => 'html', 'customHtml' => 'html')));
     $builder->addEventSubscriber(new FormExitSubscriber('sms.sms', $options));
     $builder->add('name', 'text', array('label' => 'mautic.sms.form.internal.name', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control')));
     $builder->add('description', 'textarea', array('label' => 'mautic.sms.form.internal.description', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control'), 'required' => false));
     $builder->add('message', 'textarea', array('label' => 'mautic.sms.form.message', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'rows' => 6)));
     $builder->add('isPublished', 'yesno_button_group');
     $builder->add('publishUp', 'datetime', array('widget' => 'single_text', 'label' => 'mautic.core.form.publishup', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-toggle' => 'datetime'), 'format' => 'yyyy-MM-dd HH:mm', 'required' => false));
     $builder->add('publishDown', 'datetime', array('widget' => 'single_text', 'label' => 'mautic.core.form.publishdown', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-toggle' => 'datetime'), 'format' => 'yyyy-MM-dd HH:mm', 'required' => false));
     //add category
     // $builder->add(
     //     'category',
     //     'category',
     //     array(
     //         'bundle' => 'email'
     //     )
     // );
     //add lead lists
     $transformer = new IdToEntityModelTransformer($this->em, 'MauticLeadBundle:LeadList', 'id', true);
     $builder->add($builder->create('lists', 'leadlist_choices', array('label' => 'mautic.sms.form.list', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control'), 'multiple' => true, 'expanded' => false, 'required' => true))->addModelTransformer($transformer));
     $builder->add('language', 'locale', array('label' => 'mautic.core.language', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control'), 'required' => false));
     $builder->add('buttons', 'form_buttons');
     $builder->add('smsType', 'hidden');
     if (!empty($options['update_select'])) {
         $builder->add('buttons', 'form_buttons', array('apply_text' => false));
         $builder->add('updateSelect', 'hidden', array('data' => $options['update_select'], 'mapped' => false));
     } else {
         $builder->add('buttons', 'form_buttons');
     }
     if (!empty($options["action"])) {
         $builder->setAction($options["action"]);
     }
 }
Example #8
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('quote', TextareaType::class)->add('author', TextType::class, array('attr' => array('class' => 'typeahead')));
     if (!empty($options['action'])) {
         $builder->setAction($options['action']);
     }
 }
Example #9
0
 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new CleanFormSubscriber(array('content' => 'html', 'customHtml' => 'html')));
     $builder->addEventSubscriber(new FormExitSubscriber('notification.notification', $options));
     $builder->add('name', 'text', array('label' => 'mautic.notification.form.internal.name', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control')));
     $builder->add('description', 'textarea', array('label' => 'mautic.notification.form.internal.description', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control'), 'required' => false));
     $builder->add('heading', 'text', array('label' => 'mautic.notification.form.heading', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control')));
     $builder->add('message', 'textarea', array('label' => 'mautic.notification.form.message', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'rows' => 6)));
     $builder->add('url', 'url', array('label' => 'mautic.notification.form.url', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.notification.form.url.tooltip'), 'required' => false));
     $builder->add('isPublished', 'yesno_button_group');
     $builder->add('publishUp', 'datetime', array('widget' => 'single_text', 'label' => 'mautic.core.form.publishup', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-toggle' => 'datetime'), 'format' => 'yyyy-MM-dd HH:mm', 'required' => false));
     $builder->add('publishDown', 'datetime', array('widget' => 'single_text', 'label' => 'mautic.core.form.publishdown', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-toggle' => 'datetime'), 'format' => 'yyyy-MM-dd HH:mm', 'required' => false));
     //add category
     $builder->add('category', 'category', array('bundle' => 'email'));
     //add lead lists
     $transformer = new IdToEntityModelTransformer($this->em, 'MauticLeadBundle:LeadList', 'id', true);
     $builder->add($builder->create('lists', 'leadlist_choices', array('label' => 'mautic.notification.form.list', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control'), 'multiple' => true, 'expanded' => false, 'required' => true))->addModelTransformer($transformer));
     $builder->add('language', 'locale', array('label' => 'mautic.core.language', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control'), 'required' => false));
     $builder->add('buttons', 'form_buttons');
     $builder->add('notificationType', 'hidden');
     $customButtons = array(array('name' => 'builder', 'label' => 'mautic.core.builder', 'attr' => array('class' => 'btn btn-default btn-dnd btn-nospin text-primary btn-builder', 'icon' => 'fa fa-cube', 'onclick' => "Mautic.launchBuilder('notificationform', 'notification');")));
     if (!empty($options['update_select'])) {
         $builder->add('buttons', 'form_buttons', array('apply_text' => false, 'pre_extra_buttons' => $customButtons));
         $builder->add('updateSelect', 'hidden', array('data' => $options['update_select'], 'mapped' => false));
     } else {
         $builder->add('buttons', 'form_buttons', array('pre_extra_buttons' => $customButtons));
     }
     if (!empty($options["action"])) {
         $builder->setAction($options["action"]);
     }
 }
Example #10
0
 /**
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     // ajout de action si défini
     if (isset($this->parametres['form_action'])) {
         $builder->setAction($this->parametres['form_action']);
     }
     // Builder…
     $factory = $builder->getFormFactory();
     $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use($factory) {
         $data = $event->getData();
         // important : GARDER CETTE CONDITION CI-DESSOUS (toujours !!!)
         if (null === $data) {
             return;
         }
         if (null === $data->getId()) {
             // création
             $event->getForm()->add('nom', 'textarea', array('label' => 'form.nom', 'required' => true, 'attr' => array('rows' => 6, 'style' => 'resize: vertical;')));
         } else {
             // L'entité existe : édition
             $event->getForm()->add('nom', 'text', array('label' => 'form.nom', 'required' => true));
         }
     });
     // ajoute les valeurs hidden, passés en paramètre
     $builder = $this->addHiddenValues($builder);
     // AJOUT SUBMIT
     $builder->add('submit', 'submit', array('label' => 'form.enregistrer', 'attr' => array('class' => "btn btn-md btn-block btn-info")));
 }
Example #11
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $masks = ['description' => 'html'];
     $builder->add('name', 'text', ['label' => 'mautic.core.name', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control'], 'required' => false]);
     $builder->add('description', 'textarea', ['label' => 'mautic.core.description', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control editor'], 'required' => false]);
     if (!empty($options['settings']['formType'])) {
         $properties = !empty($options['data']['properties']) ? $options['data']['properties'] : null;
         $formTypeOptions = ['label' => false, 'data' => $properties];
         if (!empty($options['settings']['formTypeOptions'])) {
             $formTypeOptions = array_merge($formTypeOptions, $options['settings']['formTypeOptions']);
         }
         if (isset($options['settings']['formTypeCleanMasks'])) {
             $masks['properties'] = $options['settings']['formTypeCleanMasks'];
         }
         $builder->add('properties', $options['settings']['formType'], $formTypeOptions);
     }
     $builder->add('type', 'hidden');
     $update = !empty($properties);
     if (!empty($update)) {
         $btnValue = 'mautic.core.form.update';
         $btnIcon = 'fa fa-pencil';
     } else {
         $btnValue = 'mautic.core.form.add';
         $btnIcon = 'fa fa-plus';
     }
     $builder->add('buttons', 'form_buttons', ['save_text' => $btnValue, 'save_icon' => $btnIcon, 'apply_text' => false, 'container_class' => 'bottom-form-buttons']);
     $builder->add('triggerId', 'hidden', ['mapped' => false]);
     $builder->addEventSubscriber(new CleanFormSubscriber($masks));
     if (!empty($options['action'])) {
         $builder->setAction($options['action']);
     }
 }
Example #12
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('cancel', 'button', array('label' => 'Cancel', 'attr' => array('class' => 'overlay-close cancel')))->add('save', 'submit', array('label' => ' ', 'attr' => array('class' => 'save pe-7s-check')));
     if ($options['action'] != '') {
         $builder->setAction($options['action']);
     }
 }
Example #13
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new CleanFormSubscriber(['description' => 'html']));
     $builder->addEventSubscriber(new FormExitSubscriber('point', $options));
     $builder->add('name', 'text', ['label' => 'mautic.core.name', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control']]);
     $builder->add('description', 'textarea', ['label' => 'mautic.core.description', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control editor'], 'required' => false]);
     $builder->add('type', 'choice', ['choices' => $options['pointActions']['choices'], 'empty_value' => '', 'label' => 'mautic.point.form.type', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'onchange' => 'Mautic.getPointActionPropertiesForm(this.value);']]);
     $builder->add('delta', 'number', ['label' => 'mautic.point.action.delta', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'tooltip' => 'mautic.point.action.delta.help'], 'precision' => 0]);
     $type = !empty($options['actionType']) ? $options['actionType'] : $options['data']->getType();
     if ($type) {
         $formType = !empty($options['pointActions']['actions'][$type]['formType']) ? $options['pointActions']['actions'][$type]['formType'] : 'genericpoint_settings';
         $properties = $options['data'] ? $options['data']->getProperties() : [];
         $builder->add('properties', $formType, ['label' => false, 'data' => $properties]);
     }
     if (!empty($options['data']) && $options['data'] instanceof Point) {
         $readonly = !$this->security->hasEntityAccess('point:points:publishown', 'point:points:publishother', $options['data']->getCreatedBy());
         $data = $options['data']->isPublished(false);
     } elseif (!$this->security->isGranted('point:points:publishown')) {
         $readonly = true;
         $data = false;
     } else {
         $readonly = false;
         $data = true;
     }
     $builder->add('isPublished', 'yesno_button_group', ['read_only' => $readonly, 'data' => $data]);
     $builder->add('publishUp', 'datetime', ['widget' => 'single_text', 'label' => 'mautic.core.form.publishup', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'data-toggle' => 'datetime'], 'format' => 'yyyy-MM-dd HH:mm', 'required' => false]);
     $builder->add('publishDown', 'datetime', ['widget' => 'single_text', 'label' => 'mautic.core.form.publishdown', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'data-toggle' => 'datetime'], 'format' => 'yyyy-MM-dd HH:mm', 'required' => false]);
     //add category
     $builder->add('category', 'category', ['bundle' => 'point']);
     $builder->add('buttons', 'form_buttons');
     if (!empty($options['action'])) {
         $builder->setAction($options['action']);
     }
 }
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->setAction($this->urlGenerator->generate($options['route'], $options['route_parameters']));
     $builder->setMethod('POST');
     $builder->add('locale', 'choice', ['label' => false, 'required' => true, 'widget_addon_prepend' => ['icon' => 'language'], 'choices' => $this->localeChoiceList->create(), 'choices_as_values' => true]);
     $builder->add('switch', 'submit', ['label' => 'stepup_middleware_client.form.switch_locale.switch', 'attr' => ['class' => 'btn btn-default']]);
 }
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->setAction($options['data']['url'])->setMethod('GET')->add('roles', 'choice', array('choices' => array('user.role.corporation_travel_manager' => 'ROLE_CORPORATION_TRAVEL_MANAGER', 'user.role.agency_tc_only' => 'ROLE_TC_ONLY', 'user.role.agency_waiver_request_only' => 'ROLE_WAIVER_REQUEST_ONLY', 'user.role.agency_core_user' => 'ROLE_AGENCY_CORE_USER', 'user.role.agency_management_user' => 'ROLE_AGENCY_MANAGEMENT_USER', 'user.role.agency_signee' => 'ROLE_AGENCY_SIGNEE', 'user.role.sales_support_user' => 'ROLE_SALES_SUPPORT_USER', 'user.role.sales_support_supervisor' => 'ROLE_SALES_SUPPORT_SUPERVISOR', 'user.role.audit_dispute_user' => 'ROLE_AUDIT_DISPUTE_USER', 'user.role.audit_dispute_supervisor' => '​​ROLE_AUDIT_DISPUTE_SUPERVISOR', 'user.role.audit_user' => 'ROLE_AUDIT_USER', 'user.role.sales_am' => '​ROLE_SALES_AM', 'user.role.sales_gg' => '​ROLE_SALES_GG', 'user.role.sales_oal_user' => 'ROLE_SALES_OAL_USER', 'user.role.sales_oal_supervisor' => 'ROLE_SALES_OAL_USER_SUPERVISOR', 'user.role.pricing_oal_user' => 'ROLE_PRICING_OAL_USER', 'user.role.pricing_oal_supervisor' => '​ROLE_PRICING_OAL_USER_SUPERVISOR', 'user.role.pricing_lhg_user' => 'ROLE_PRICING_LHG_USER', 'user.role.accounting' => 'ROLE_ACCOUNTING', 'user.role.contract_admin' => 'ROLE_CONTRACT_ADMIN', 'user.role.spc' => 'ROLE_SPC', 'user.role.app_admin' => 'ROLE_APP_ADMIN'), 'choices_as_values' => true, 'label' => 'Roles', 'expanded' => true, 'multiple' => true, 'translation_domain' => 'UserBundle'))->add('enabled', 'choice', array('choices' => array('user.status.enabled' => 1, 'user.status.disabled' => 0), 'choices_as_values' => true, 'label' => 'Enabled', 'expanded' => true, 'multiple' => true, 'translation_domain' => 'UserBundle'));
     $user = $this->tokenStorage->getToken()->getUser();
     $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use($user) {
         $form = $event->getForm();
         // only show specific filters based on user's context
         // $form->add('airlines', 'entity', array(
         //   'class' => 'AppBundle:Airline', 'property' => 'id',
         //   'query_builder' => function (EntityRepository $er) use ($user) {
         //     $airlines = $user->getAirlines();
         //
         //     return $er->createQueryBuilder('a')
         //       ->addOrderBy('a.id', 'ASC')
         //       ->andWhere('a.id IN (?1)')
         //       ->setParameter(1,$airlines);
         //     },
         //   'choice_value' => 'id',
         //   'choice_label' => 'id', 'label' => 'Airlines',
         //   'expanded' => true, 'multiple' => true,));
         $form->add('markets', 'entity', array('class' => 'AppBundle:Market', 'property' => 'id', 'query_builder' => function (EntityRepository $er) use($user) {
             $markets = $user->getMarkets();
             return $er->createQueryBuilder('m')->addOrderBy('m.id', 'ASC')->andWhere('m.id IN (?1)')->setParameter(1, $markets);
         }, 'choice_value' => 'id', 'choice_label' => 'id', 'label' => 'Markets', 'expanded' => true, 'multiple' => true));
     });
 }
Example #16
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new CleanFormSubscriber(array('content' => 'html', 'customHtml' => 'html')));
     $builder->addEventSubscriber(new FormExitSubscriber('page.page', $options));
     $variantParent = $options['data']->getVariantParent();
     $isVariant = !empty($variantParent);
     $builder->add('title', 'text', array('label' => 'mautic.core.title', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control')));
     $builder->add('customHtml', 'textarea', array('label' => 'mautic.page.form.customhtml', 'required' => false, 'attr' => array('class' => 'form-control editor-fullpage editor-builder-tokens', 'data-token-callback' => 'page:getBuilderTokens', 'data-token-activator' => '{')));
     $template = $options['data']->getTemplate();
     if (empty($template)) {
         $template = $this->defaultTheme;
     }
     $builder->add('template', 'theme_list', array('feature' => 'page', 'data' => $template, 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.page.form.template.help', 'onchange' => 'Mautic.onBuilderModeSwitch(this);'), 'empty_value' => 'mautic.core.none'));
     $builder->add('isPublished', 'yesno_button_group');
     $builder->add('publishUp', 'datetime', array('widget' => 'single_text', 'label' => 'mautic.core.form.publishup', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-toggle' => 'datetime'), 'format' => 'yyyy-MM-dd HH:mm', 'required' => false));
     $builder->add('publishDown', 'datetime', array('widget' => 'single_text', 'label' => 'mautic.core.form.publishdown', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-toggle' => 'datetime'), 'format' => 'yyyy-MM-dd HH:mm', 'required' => false));
     $builder->add('sessionId', 'hidden');
     if ($isVariant) {
         $builder->add('variantSettings', 'pagevariant', array('label' => false, 'page_entity' => $options['data'], 'data' => $options['data']->getVariantSettings()));
     } else {
         $builder->add('metaDescription', 'textarea', array('label' => 'mautic.page.form.metadescription', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'maxlength' => 160), 'required' => false));
         $builder->add('alias', 'text', array('label' => 'mautic.core.alias', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.page.help.alias'), 'required' => false, 'disabled' => $isVariant));
         //add category
         $builder->add('category', 'category', array('bundle' => 'page', 'disabled' => $isVariant));
         $builder->add('language', 'locale', array('label' => 'mautic.core.language', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.page.form.language.help'), 'required' => false, 'disabled' => $isVariant));
         $transformer = new \Mautic\CoreBundle\Form\DataTransformer\IdToEntityModelTransformer($this->em, 'MauticPageBundle:Page', 'id');
         $builder->add($builder->create('translationParent', 'page_list', array('label' => 'mautic.page.form.translationparent', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.page.form.translationparent.help'), 'required' => false, 'multiple' => false, 'empty_value' => 'mautic.page.form.translationparent.empty', 'disabled' => $isVariant, 'top_level' => 'translation', 'ignore_ids' => array((int) $options['data']->getId())))->addModelTransformer($transformer));
     }
     $builder->add('buttons', 'form_buttons', array('pre_extra_buttons' => array(array('name' => 'builder', 'label' => 'mautic.core.builder', 'attr' => array('class' => 'btn btn-default btn-dnd btn-nospin btn-builder text-primary', 'icon' => 'fa fa-cube', 'onclick' => "Mautic.launchBuilder('page');")))));
     if (!empty($options['action'])) {
         $builder->setAction($options['action']);
     }
 }
Example #17
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('msg_subject', 'text', array('label' => 'mautic.email.subject', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control'), 'constraints' => array(new NotBlank(array('message' => 'Subject should not be blank.')), new Length(array('min' => 3)))))->add('msg_body', 'textarea', array('label' => 'mautic.user.user.contact.message', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'rows' => 10), 'constraints' => array(new NotBlank(array('message' => 'Message should not be blank.')), new Length(array('min' => 5)))))->add('entity', 'hidden', array('attr' => array('autocomplete' => 'off')))->add('id', 'hidden', array('attr' => array('autocomplete' => 'off')))->add('returnUrl', 'hidden', array('attr' => array('autocomplete' => 'off')))->add('buttons', 'form_buttons', array('save_text' => 'mautic.user.user.contact.send', 'save_icon' => 'fa fa-send', 'apply_text' => false));
     if (!empty($options["action"])) {
         $builder->setAction($options["action"]);
     }
 }
Example #18
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new CleanFormSubscriber(array('description' => 'html')));
     $builder->addEventSubscriber(new FormExitSubscriber('point', $options));
     $builder->add('name', 'text', array('label' => 'mautic.core.name', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control')));
     $builder->add('description', 'textarea', array('label' => 'mautic.core.description', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control editor'), 'required' => false));
     //add category
     $builder->add('category', 'category', array('bundle' => 'point'));
     $builder->add('points', 'number', array('label' => 'mautic.point.trigger.form.points', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.point.trigger.form.points_descr'), 'required' => false));
     $color = $options['data']->getColor();
     $builder->add('color', 'text', array('label' => 'mautic.point.trigger.form.color', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-toggle' => 'color', 'tooltip' => 'mautic.point.trigger.form.color_descr'), 'required' => false, 'data' => !empty($color) ? $color : 'a0acb8', 'empty_data' => 'a0acb8'));
     $builder->add('triggerExistingLeads', 'yesno_button_group', array('label' => 'mautic.point.trigger.form.existingleads'));
     if (!empty($options['data']) && $options['data']->getId()) {
         $readonly = !$this->security->isGranted('point:triggers:publish');
         $data = $options['data']->isPublished(false);
     } elseif (!$this->security->isGranted('point:triggers:publish')) {
         $readonly = true;
         $data = false;
     } else {
         $readonly = false;
         $data = false;
     }
     $builder->add('isPublished', 'yesno_button_group', array('read_only' => $readonly, 'data' => $data));
     $builder->add('publishUp', 'datetime', array('widget' => 'single_text', 'label' => 'mautic.core.form.publishup', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-toggle' => 'datetime'), 'format' => 'yyyy-MM-dd HH:mm', 'required' => false));
     $builder->add('publishDown', 'datetime', array('widget' => 'single_text', 'label' => 'mautic.core.form.publishdown', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-toggle' => 'datetime'), 'format' => 'yyyy-MM-dd HH:mm', 'required' => false));
     $builder->add('sessionId', 'hidden', array('mapped' => false));
     $builder->add('buttons', 'form_buttons');
     if (!empty($options["action"])) {
         $builder->setAction($options["action"]);
     }
 }
Example #19
0
 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new CleanFormSubscriber(array('content' => 'html')));
     $builder->addEventSubscriber(new FormExitSubscriber('category.category', $options));
     if ($options['data']->getId()) {
         // Edit existing category from category manager - do not allow to edit bundle
         $builder->add('bundle', 'hidden', array('data' => $options['data']->getBundle()));
     } elseif ($options['show_bundle_select'] == true) {
         // Create new category from category bundle - let user select the bundle
         $selected = $this->session->get('mautic.category.type', 'category');
         $builder->add('bundle', 'category_bundles_form', array('label' => 'mautic.core.type', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control'), 'required' => true, 'data' => $selected));
     } else {
         // Create new category directly from another bundle - preset bundle
         $builder->add('bundle', 'hidden', array('data' => $options['bundle']));
     }
     $builder->add('title', 'text', array('label' => 'mautic.core.title', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control')));
     $builder->add('description', 'text', array('label' => 'mautic.core.description', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control'), 'required' => false));
     $builder->add('alias', 'text', array('label' => 'mautic.core.alias', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.category.form.alias.help'), 'required' => false));
     $builder->add('color', 'text', array('label' => 'mautic.core.color', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-toggle' => 'color'), 'required' => false));
     $builder->add('isPublished', 'yesno_button_group');
     $builder->add('inForm', 'hidden', array('mapped' => false));
     $builder->add('buttons', 'form_buttons');
     if (!empty($options["action"])) {
         $builder->setAction($options["action"]);
     }
 }
Example #20
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new CleanFormSubscriber(['description' => 'html']));
     $builder->addEventSubscriber(new FormExitSubscriber('stage', $options));
     $builder->add('description', 'textarea', ['label' => 'mautic.core.description', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control editor'], 'required' => false]);
     $builder->add('name', 'text', ['label' => 'mautic.core.name', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control']]);
     $builder->add('weight', 'number', ['label' => 'mautic.stage.action.weight', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'tooltip' => 'mautic.stage.action.weight.help'], 'precision' => 0, 'required' => false]);
     if (!empty($options['data']) && $options['data'] instanceof Stage) {
         $readonly = !$this->security->hasEntityAccess('stage:stages:publishown', 'stage:stages:publishother', $options['data']->getCreatedBy());
         $data = $options['data']->isPublished(false);
     } elseif (!$this->security->isGranted('stage:stages:publishown')) {
         $readonly = true;
         $data = false;
     } else {
         $readonly = false;
         $data = true;
     }
     $builder->add('isPublished', 'yesno_button_group', ['read_only' => $readonly, 'data' => $data]);
     $builder->add('publishUp', 'datetime', ['widget' => 'single_text', 'label' => 'mautic.core.form.publishup', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'data-toggle' => 'datetime'], 'format' => 'yyyy-MM-dd HH:mm', 'required' => false]);
     $builder->add('publishDown', 'datetime', ['widget' => 'single_text', 'label' => 'mautic.core.form.publishdown', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'data-toggle' => 'datetime'], 'format' => 'yyyy-MM-dd HH:mm', 'required' => false]);
     //add category
     $builder->add('category', 'category', ['bundle' => 'stage']);
     $builder->add('buttons', 'form_buttons');
     if (!empty($options['action'])) {
         $builder->setAction($options['action']);
     }
 }
Example #21
0
 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new CleanFormSubscriber(array('description' => 'html')));
     $builder->addEventSubscriber(new FormExitSubscriber('campaign', $options));
     $builder->add('name', 'text', array('label' => 'mautic.core.name', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control')));
     $builder->add('description', 'textarea', array('label' => 'mautic.core.description', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control editor'), 'required' => false));
     //add category
     $builder->add('category', 'category', array('bundle' => 'campaign'));
     if (!empty($options['data']) && $options['data']->getId()) {
         $readonly = !$this->security->isGranted('campaign:campaigns:publish');
         $data = $options['data']->isPublished(false);
     } elseif (!$this->security->isGranted('campaign:campaigns:publish')) {
         $readonly = true;
         $data = false;
     } else {
         $readonly = false;
         $data = false;
     }
     $builder->add('isPublished', 'yesno_button_group', array('read_only' => $readonly, 'data' => $data));
     $builder->add('publishUp', 'datetime', array('widget' => 'single_text', 'label' => 'mautic.core.form.publishup', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-toggle' => 'datetime'), 'format' => 'yyyy-MM-dd HH:mm', 'required' => false));
     $builder->add('publishDown', 'datetime', array('widget' => 'single_text', 'label' => 'mautic.core.form.publishdown', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'data-toggle' => 'datetime'), 'format' => 'yyyy-MM-dd HH:mm', 'required' => false));
     $builder->add('sessionId', 'hidden', array('mapped' => false));
     if (!empty($options["action"])) {
         $builder->setAction($options["action"]);
     }
     $builder->add('buttons', 'form_buttons', array('pre_extra_buttons' => array(array('name' => 'builder', 'label' => 'mautic.campaign.campaign.launch.builder', 'attr' => array('class' => 'btn btn-default btn-dnd', 'icon' => 'fa fa-cube', 'onclick' => "Mautic.launchCampaignEditor();")))));
 }
Example #22
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     foreach ($options['data'] as $config) {
         if (isset($config['formAlias']) && isset($config['parameters'])) {
             $builder->add($config['formAlias'], $config['formAlias'], array('data' => $config['parameters']));
         }
     }
     $translator = $this->translator;
     $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use($options, $translator) {
         $form = $event->getForm();
         foreach ($form as $config => $configForm) {
             foreach ($configForm as $key => $child) {
                 if (in_array($key, $options['doNotChange'])) {
                     if ($options['doNotChangeDisplayMode'] == 'mask') {
                         $fieldOptions = $child->getConfig()->getOptions();
                         $configForm->add($key, 'text', array('label' => $fieldOptions['label'], 'required' => false, 'mapped' => false, 'disabled' => true, 'attr' => array('placeholder' => $translator->trans('mautic.config.restricted'), 'class' => 'form-control'), 'label_attr' => array('class' => 'control-label')));
                     } elseif ($options['doNotChangeDisplayMode'] == 'remove') {
                         $configForm->remove($key);
                     }
                 }
             }
         }
     });
     $builder->add('buttons', 'form_buttons', array('apply_onclick' => 'Mautic.activateBackdrop()', 'save_onclick' => 'Mautic.activateBackdrop()'));
     if (!empty($options['action'])) {
         $builder->setAction($options['action']);
     }
 }
Example #23
0
 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new CleanFormSubscriber(['content' => 'html', 'customHtml' => 'html']));
     $builder->addEventSubscriber(new FormExitSubscriber('notification.notification', $options));
     $builder->add('name', 'text', ['label' => 'mautic.notification.form.internal.name', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control']]);
     $builder->add('description', 'textarea', ['label' => 'mautic.notification.form.internal.description', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control'], 'required' => false]);
     $builder->add('heading', 'text', ['label' => 'mautic.notification.form.heading', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control']]);
     $builder->add('message', 'textarea', ['label' => 'mautic.notification.form.message', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'rows' => 6]]);
     $builder->add('url', 'url', ['label' => 'mautic.notification.form.url', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'tooltip' => 'mautic.notification.form.url.tooltip'], 'required' => false]);
     $builder->add('isPublished', 'yesno_button_group');
     $builder->add('publishUp', 'datetime', ['widget' => 'single_text', 'label' => 'mautic.core.form.publishup', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'data-toggle' => 'datetime'], 'format' => 'yyyy-MM-dd HH:mm', 'required' => false]);
     $builder->add('publishDown', 'datetime', ['widget' => 'single_text', 'label' => 'mautic.core.form.publishdown', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control', 'data-toggle' => 'datetime'], 'format' => 'yyyy-MM-dd HH:mm', 'required' => false]);
     //add category
     $builder->add('category', 'category', ['bundle' => 'notification']);
     $builder->add('language', 'locale', ['label' => 'mautic.core.language', 'label_attr' => ['class' => 'control-label'], 'attr' => ['class' => 'form-control'], 'required' => false]);
     $builder->add('buttons', 'form_buttons');
     if (!empty($options['update_select'])) {
         $builder->add('buttons', 'form_buttons', ['apply_text' => false]);
         $builder->add('updateSelect', 'hidden', ['data' => $options['update_select'], 'mapped' => false]);
     } else {
         $builder->add('buttons', 'form_buttons');
     }
     if (!empty($options['action'])) {
         $builder->setAction($options['action']);
     }
 }
Example #24
0
 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new CleanFormSubscriber());
     $builder->addEventSubscriber(new FormExitSubscriber('lead.field', $options));
     $builder->add('label', 'text', array('label' => 'mautic.lead.field.label', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'length' => 50)));
     $disabled = !empty($options['data']) ? $options['data']->isFixed() : false;
     $builder->add('group', 'choice', array('choices' => array('core' => 'mautic.lead.field.group.core', 'social' => 'mautic.lead.field.group.social', 'personal' => 'mautic.lead.field.group.personal', 'professional' => 'mautic.lead.field.group.professional'), 'attr' => array('class' => 'form-control', 'tooltip' => 'mautic.lead.field.form.group.help'), 'expanded' => false, 'multiple' => false, 'label' => 'mautic.lead.field.group', 'empty_value' => false, 'required' => false, 'disabled' => $disabled));
     $new = !empty($options['data']) && $options['data']->getAlias() ? false : true;
     $default = $new ? 'text' : $options['data']->getType();
     $fieldHelper = new FormFieldHelper();
     $fieldHelper->setTranslator($this->translator);
     $builder->add('type', 'choice', array('choices' => $fieldHelper->getChoiceList(), 'expanded' => false, 'multiple' => false, 'label' => 'mautic.lead.field.type', 'empty_value' => false, 'disabled' => $disabled || !$new, 'attr' => array('class' => 'form-control', 'onchange' => 'Mautic.updateLeadFieldProperties(this.value);'), 'data' => $default, 'required' => false));
     $builder->add('properties', 'collection', array('required' => false, 'allow_add' => true, 'error_bubbling' => false));
     $builder->add('defaultValue', 'text', array('label' => 'mautic.core.defaultvalue', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control'), 'required' => false));
     //get order list
     $transformer = new FieldToOrderTransformer($this->em);
     $builder->add($builder->create('order', 'entity', array('label' => 'mautic.core.order', 'class' => 'MauticLeadBundle:LeadField', 'property' => 'label', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control'), 'query_builder' => function (EntityRepository $er) {
         return $er->createQueryBuilder('f')->orderBy('f.order', 'ASC');
     }, 'required' => false))->addModelTransformer($transformer));
     $builder->add('alias', 'text', array('label' => 'mautic.core.alias', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'length' => 25, 'tooltip' => 'mautic.lead.field.help.alias'), 'required' => false, 'disabled' => $disabled || !$new));
     $data = $disabled ? true : $options['data']->getIsPublished();
     $builder->add('isPublished', 'yesno_button_group', array('disabled' => $disabled, 'data' => $data));
     $builder->add('isRequired', 'yesno_button_group', array('label' => 'mautic.core.required'));
     $builder->add('isVisible', 'yesno_button_group', array('label' => 'mautic.lead.field.form.isvisible'));
     $builder->add('isShortVisible', 'yesno_button_group', array('label' => 'mautic.lead.field.form.isshortvisible'));
     $builder->add('isListable', 'yesno_button_group', array('label' => 'mautic.lead.field.form.islistable'));
     $builder->add('isUniqueIdentifer', 'yesno_button_group', array('label' => 'mautic.lead.field.form.isuniqueidentifer', 'attr' => array('tooltip' => 'mautic.lead.field.form.isuniqueidentifer.tooltip')));
     $builder->add('isPubliclyUpdatable', 'yesno_button_group', array('label' => 'mautic.lead.field.form.ispubliclyupdatable', 'attr' => array('tooltip' => 'mautic.lead.field.form.ispubliclyupdatable.tooltip')));
     $builder->add('buttons', 'form_buttons');
     if (!empty($options["action"])) {
         $builder->setAction($options["action"]);
     }
 }
Example #25
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     //第一步:设置表单的基本属性,从控制器中中设置变成在这里设置
     $builder->setMethod('post');
     $builder->setAction($this->router->generate('web_user_register_check'));
     //$builder->setAttribute('class', 'form-horizontal');
     //第二步:添加表单的相关元素
     //1.添加电子邮箱
     $builder->add('email', 'text', array('attr' => array('class' => 'form-control', 'placeholder' => '请输入您的电子邮箱', 'wx-validator-rule' => 'required|email'), 'label' => '电子邮箱', 'label_attr' => array('class' => 'col-md-3 control-label')));
     //add end
     //2.添加密码
     $builder->add('password', 'text', array('attr' => array('class' => 'form-control', 'placeholder' => '请输入密码', 'wx-validator-rule' => 'required'), 'label' => '密码', 'label_attr' => array('class' => 'col-md-3 control-label')));
     //add end
     //3.添加确认密码
     $builder->add('confirm_password', 'text', array('attr' => array('class' => 'form-control', 'placeholder' => '请输入确认密码', 'wx-validator-rule' => 'required'), 'label' => '确认密码', 'label_attr' => array('class' => 'col-md-3 control-label')));
     //add end
     //4.添加用户昵称
     $builder->add('nickname', 'text', array('attr' => array('class' => 'form-control', 'placeholder' => '请输入昵称', 'wx-validator-rule' => 'required'), 'label' => '昵称', 'label_attr' => array('class' => 'col-md-3 control-label')));
     //add end
     //5.添加手机号码
     $builder->add('cellphone', 'text', array('attr' => array('class' => 'form-control', 'placeholder' => '请输入手机号', 'wx-validator-rule' => 'required|mobile'), 'label' => '手机号', 'label_attr' => array('class' => 'col-md-3 control-label')));
     //add end
     //6.添加手机验证码
     $builder->add('capcha', 'text', array('attr' => array('class' => 'form-control', 'placeholder' => '请输入验证码', 'wx-validator-rule' => 'required|email'), 'label' => '验证码', 'label_attr' => array('class' => 'col-md-3 control-label')));
     //add end
 }
Example #26
0
 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new CleanFormSubscriber());
     $builder->add('name', 'text', array('label' => 'mautic.chat.channel.form.name', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'maxlength' => 25, 'preaddon' => 'symbol-hashtag')));
     $builder->add('description', 'text', array('label' => 'mautic.chat.channel.form.description', 'label_attr' => array('class' => 'control-label'), 'attr' => array('class' => 'form-control', 'maxlength' => 150), 'required' => false));
     /*
     $builder->add('isPrivate', 'button_group', array(
         'choice_list' => new ChoiceList(
             array(false, true),
             array('mautic.core.form.no', 'mautic.core.form.yes')
         ),
         'expanded'      => true,
         'multiple'      => false,
                 'empty_value'   => false,
         'required'      => false
         'label_attr'    => array('class' => 'control-label'),
         'label'         => 'mautic.chat.channel.form.isprivate',
         'empty_value'   => false,
         'required'      => false
     ));
     
     $builder->add('privateUsers', 'collection', array(
         'allow_add'    => true,
         'by_reference' => false,
         'prototype'    => true
     ));
     */
     $builder->add('buttons', 'form_buttons', array('apply_text' => false, 'save_text' => 'mautic.core.form.save', 'container_class' => 'chat-channel-buttons'));
     if (!empty($options["action"])) {
         $builder->setAction($options["action"]);
     }
 }
Example #27
0
 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('lead_to_merge', 'choice', ['choices' => $options['leads'], 'label' => 'mautic.lead.merge.select', 'label_attr' => ['class' => 'control-label'], 'multiple' => false, 'empty_value' => '', 'attr' => ['class' => 'form-control', 'tooltip' => 'mautic.lead.merge.select.modal.tooltip'], 'constraints' => [new NotBlank(['message' => 'mautic.core.value.required'])]]);
     $builder->add('buttons', 'form_buttons', ['apply_text' => false, 'save_text' => 'mautic.lead.merge', 'save_icon' => 'fa fa-user']);
     if (!empty($options['action'])) {
         $builder->setAction($options['action']);
     }
 }
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->setAction($this->action)->add('condition', 'hidden');
     if (!$this->behavior->isFirstCondition($builder->getData())) {
         $builder->add('operator', 'choice', array('label' => 'fc.label.admin.condition_operator', 'required' => true, 'choices' => array(1 => 'fc.label.admin.condition_operator.and', 0 => 'fc.label.admin.condition_operator.or'), 'constraints' => array(new NotBlank(array('message' => 'fc.constraint.admin.blank')))));
     }
     $builder->add('is_active', null, array('label' => 'fc.label.admin.is_active', 'required' => false))->add('params', $this->params_builder, array('label' => false));
 }
Example #29
0
 public function buildForm(FormBuilderInterface $builder, array $options, $path = NULL)
 {
     if (!empty($path)) {
         $builder->setAction($path);
     }
     $builder->add('name', 'text', array('label' => 'Nom', 'required' => true));
     $builder->add('public', 'choice', array('choices' => array('1' => 'Publique', '0' => 'Privée'), 'label' => false, 'required' => true));
 }
Example #30
0
 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $default = empty($options['data']['batchlimit']) ? 100 : (int) $options['data']['batchlimit'];
     $builder->add('batchlimit', 'text', ['label' => false, 'attr' => ['class' => 'form-control'], 'data' => $default, 'constraints' => [new \Symfony\Component\Validator\Constraints\NotBlank(['message' => 'mautic.core.value.required'])]]);
     if (!empty($options['action'])) {
         $builder->setAction($options['action']);
     }
 }