Пример #1
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $id_users = null;
     if ($builder->getData()->getUser() instanceof User) {
         $id_users = $builder->getData()->getUser()->getId();
     }
     //
     if (in_array('ROLE_ADMIN', $this->_roles_user) || in_array('ROLE_SUPER_ADMIN', $this->_roles_user) || in_array('ROLE_CONTENT_MANAGER', $this->_roles_user)) {
         $read_only = false;
     } else {
         $read_only = true;
     }
     $builder->add('enabled', 'checkbox', array('data' => true, 'label' => 'pi.form.label.field.enabled'))->add('user', 'entity', array('class' => 'SfynxAuthBundle:User', 'query_builder' => function (EntityRepository $er) use($id_users) {
         $translatableListener = $this->_container->get('gedmo.listener.translatable');
         $translatableListener->setTranslationFallback(true);
         return $er->createQueryBuilder('a')->select('a')->where("a.id IN (:id)")->andWhere('a.enabled = 1')->setParameter('id', $id_users);
     }, 'empty_value' => 'pi.form.label.select.choose.user', 'label' => "pi.form.label.field.user", 'multiple' => false, 'required' => false, "attr" => array("class" => "pi_simpleselect ajaxselect", "data-url" => $this->_container->get('sfynx.tool.route.factory')->getRoute("users_selectentity_ajax"), "data-selectid" => $id_users, "data-max" => 50)))->add('rubrique', 'entity', array('class' => 'SfynxCmfBundle:Rubrique', 'query_builder' => function (EntityRepository $er) {
         return $er->getAllPageRubrique();
     }, 'empty_value' => 'Choose an option', 'multiple' => false, 'required' => false, "attr" => array("class" => "pi_simpleselect")))->add('layout', 'entity', array('class' => 'SfynxAuthBundle:Layout', "attr" => array("class" => "pi_simpleselect")))->add('page_css', 'entity', array('class' => 'SfynxCmfBundle:Page', 'query_builder' => function (EntityRepository $er) {
         return $er->getAllPageCss();
     }, 'property' => 'url', 'multiple' => true, 'required' => false, "attr" => array("class" => "pi_multiselect")))->add('page_js', 'entity', array('class' => 'SfynxCmfBundle:Page', 'query_builder' => function (EntityRepository $er) {
         return $er->getAllPageJs();
     }, 'property' => 'url', 'multiple' => true, 'required' => false, "attr" => array("class" => "pi_multiselect")))->add('keywords', 'entity', array('class' => 'SfynxCmfBundle:KeyWord', 'query_builder' => function (EntityRepository $er) {
         return $er->getAllPageKeyWords();
     }, 'multiple' => true, 'required' => false, "attr" => array("class" => "pi_multiselect")))->add('meta_content_type', 'choice', array('choices' => PageRepository::getAvailableContentTypes(), 'required' => true, 'multiple' => false, 'expanded' => true, 'read_only' => true))->add('cacheable', 'checkbox', array('label' => 'pi.page.form.cacheable', 'required' => false, 'help_block' => $this->_container->get('translator')->trans('pi.page.form.field.cacheable')))->add('public', 'checkbox', array('label' => 'pi.page.form.public', 'required' => false, 'help_block' => $this->_container->get('translator')->trans('pi.page.form.field.public')))->add('lifetime', 'number', array('label' => 'pi.page.form.lifetime', 'required' => false, 'help_block' => $this->_container->get('translator')->trans('pi.page.form.field.lifetime')))->add('route_name', 'text', array('label' => 'pi.page.form.route_name'))->add('url', 'text', array('label' => 'pi.page.form.url'))->add('blocks', 'collection', array('allow_add' => true, 'allow_delete' => true, 'prototype' => true, 'by_reference' => true, 'type' => new BlockType(), 'options' => array('attr' => array('class' => 'block_widget')), 'label' => ' '));
 }
Пример #2
0
 /**
  * {@inheritDoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $admin = clone $this->getAdmin($options);
     if ($admin->hasParentFieldDescription()) {
         $admin->getParentFieldDescription()->setAssociationAdmin($admin);
     }
     if ($options['delete'] && $admin->isGranted('DELETE')) {
         if (!array_key_exists('translation_domain', $options['delete_options']['type_options'])) {
             $options['delete_options']['type_options']['translation_domain'] = $admin->getTranslationDomain();
         }
         $builder->add('_delete', $options['delete_options']['type'], $options['delete_options']['type_options']);
     }
     // hack to make sure the subject is correctly set
     // https://github.com/sonata-project/SonataAdminBundle/pull/2076
     if ($builder->getData() === null) {
         $p = new PropertyAccessor(false, true);
         try {
             $subject = $p->getValue($admin->getParentFieldDescription()->getAdmin()->getSubject(), $this->getFieldDescription($options)->getFieldName() . $options['property_path']);
             $builder->setData($subject);
         } catch (NoSuchIndexException $e) {
             // no object here
         }
     }
     $admin->setSubject($builder->getData());
     $admin->defineFormBuilder($builder);
     $builder->addModelTransformer(new ArrayToModelTransformer($admin->getModelManager(), $admin->getClass()));
 }
Пример #3
0
 /**
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('ip', null, array('attr' => array('placeholder' => 'e.g 192.168.1.1/16'), 'label' => 'Ip/Mask', 'description' => "The network ip and mask"))->add('networkAdmin', null, array('required' => true, 'empty_value' => 'Choose an admin', 'attr' => array('help_text' => 'This will be the network admin'), 'description' => "The administrator responsible for the network", 'query_builder' => function (EntityRepository $er) {
         return $er->createQueryBuilder('na')->where('na.isActive = TRUE')->orderBy('na.name', 'ASC');
     }))->add('academicUnit', null, array('required' => true, 'empty_value' => 'Choose a unit', 'attr' => array('help_text' => 'The unit to which the network belongs'), 'description' => "The unit responsible, that owns the network", 'query_builder' => function (EntityRepository $er) {
         return $er->createQueryBuilder('au')->orderBy('au.name', 'ASC');
     }));
     if ($builder->getData()) {
         if (!$builder->getData()->getIsActive()) {
             $builder->add('reactivate', 'checkbox', array('data' => false, 'mapped' => false, 'label_attr' => array('class' => 'alert alert-warning'), 'attr' => array('align_with_widget' => true, 'help_text' => 'If it set to true the network will be reactivated.'), 'required' => false, 'label' => 'Reactivate?'));
         }
         $builder->add('force_edit', 'checkbox', array('data' => false, 'mapped' => false, 'label_attr' => array('class' => 'alert alert-warning'), 'attr' => array('align_with_widget' => true, 'help_text' => 'If it set to true the network will be edited and not replaced.(this can harm the network history)'), 'required' => false, 'label' => 'Force edit'));
     }
     $builder->add('save', 'submit', array('attr' => array('class' => 'save ladda-button btn-lg btn-block', 'data-style' => "slide-down")));
     $builder->addEventListener(FormEvents::POST_SET_DATA, function (FormEvent $event) {
         $network = $event->getData();
         $form = $event->getForm();
         // check if the Product object is "new"
         // If no data is passed to the form, the data is "null".
         // This should be considered a new "Product"
         if ($network) {
             $form->get('ip')->setData($network->getIpAndMask());
         }
     });
 }
Пример #4
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     /** @var \Doctrine\Orm\EntityManager $manager */
     $manager = $options['manager'];
     $query = $manager->createQuery('SELECT c FROM AppBundle:Category c ORDER BY c.name');
     $query->setHint(\Doctrine\ORM\Query::HINT_CUSTOM_OUTPUT_WALKER, 'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker');
     $query->setHint(\Gedmo\Translatable\TranslatableListener::HINT_TRANSLATABLE_LOCALE, $options['locale']);
     $categories = [];
     $musicCategories = [];
     foreach ($query->getResult() as $category) {
         if (get_class($category) == 'AppBundle\\Entity\\GeneralCategory') {
             $categories[] = $category;
         } elseif (get_class($category) == 'AppBundle\\Entity\\MusicCategory') {
             $musicCategories[] = $category;
         }
     }
     $user = $builder->getData();
     $builder->add('firstName', 'text', ['label' => 'user.form.first_name'])->add('lastName', 'text', ['label' => 'user.form.last_name'])->add('wantToLearn', 'boolean_choice', ['expanded' => true, 'label' => 'user.form.want_to_learn', 'choices' => ['user.form.want_to_learn.choice.learn' => '1', 'user.form.want_to_learn.choice.teach' => '0'], 'choices_as_values' => true, 'data' => !$user->hasRole('ROLE_COMPLETE_USER') ? null : $user->getWantToLearn()])->add('categories', 'entity', ['class' => 'AppBundle:GeneralCategory', 'multiple' => true, 'expanded' => true, 'choice_list' => new ArrayChoiceList($categories), 'property' => 'name', 'label' => 'user.form.categories'])->add('musicCategories', 'entity', ['class' => 'AppBundle:MusicCategory', 'multiple' => true, 'expanded' => true, 'choice_list' => new ArrayChoiceList($musicCategories), 'property' => 'name'])->add('age', 'choice', ['label' => 'user.form.age', 'empty_data' => null, 'required' => false, 'choices' => array_combine(range(18, 100), range(18, 100))])->add('gender', 'choice', ['expanded' => true, 'label' => 'user.form.gender', 'choices' => ['M' => 'user.form.gender.m', 'F' => 'user.form.gender.f', 'X' => 'user.form.gender.x']])->add('about', 'textarea', ['label' => 'user.form.about'])->add('from', 'choice', ['label' => 'user.form.from', 'choices' => Countries::getList(), 'empty_data' => null, 'empty_value' => ''])->add('hasChildren', 'choice', ['expanded' => true, 'label' => 'user.form.has_children', 'choices' => [true => 'yes', false => 'no'], 'choice_value' => function ($currentChoiceKey) {
         return $currentChoiceKey ? 'true' : 'false';
     }])->add('profilePicture', 'hidden')->add('musicFriend', 'boolean_choice', ['expanded' => true, 'label' => 'user.form.fikatype', 'choices' => ['user.form.fikatype.fikafriend' => '0', 'user.form.fikatype.musicfriend' => '1'], 'choices_as_values' => true, 'data' => !$user->hasRole('ROLE_COMPLETE_USER') ? null : $user->isMusicFriend()])->add('municipality', 'entity', ['class' => 'AppBundle:Municipality', 'property' => 'name', 'empty_data' => null, 'required' => false, 'label' => 'user.form.municipality']);
     $user = $builder->getData();
     if (!$user->hasRole('ROLE_COMPLETE_USER')) {
         $builder->add('city', 'entity', ['label' => 'user.form.city', 'class' => 'AppBundle:City', 'query_builder' => function (EntityRepository $er) {
             return $er->createQueryBuilder('c')->orderBy('c.name', 'ASC');
         }, 'property' => 'name', 'mapped' => false, 'empty_value' => '']);
     }
 }
Пример #5
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $isExisting = $builder->getData() && $builder->getData()->getId();
     $builder->add('namePrefix', 'text', ['required' => false, 'label' => 'orocrm.magento.customer.name_prefix.label'])->add('firstName', 'text', ['label' => 'orocrm.magento.customer.first_name.label'])->add('middleName', 'text', ['required' => false, 'label' => 'orocrm.magento.customer.middle_name.label'])->add('lastName', 'text', ['label' => 'orocrm.magento.customer.last_name.label'])->add('nameSuffix', 'text', ['required' => false, 'label' => 'orocrm.magento.customer.name_suffix.label'])->add('gender', 'oro_gender', ['required' => false, 'label' => 'orocrm.magento.customer.gender.label'])->add('birthday', 'oro_date', ['required' => false, 'label' => 'orocrm.magento.customer.birthday.label'])->add('email', 'email', ['label' => 'orocrm.magento.customer.email.label'])->add('vat', 'text', ['required' => false, 'label' => 'orocrm.magento.customer.vat.label'])->add('dataChannel', 'orocrm_magento_customer_channel_select', ['label' => 'orocrm.magento.customer.data_channel.label', 'entities' => [$this->customerClassName], 'required' => true, 'disabled' => $isExisting])->add('store', 'orocrm_magento_store_select', ['label' => 'orocrm.magento.customer.store.label', 'channel_field' => 'dataChannel', 'required' => true, 'disabled' => $isExisting])->add('group', 'orocrm_magento_customer_group_select', ['label' => 'orocrm.magento.customer.group.label', 'channel_field' => 'dataChannel', 'required' => true])->add('addresses', 'oro_address_collection', ['label' => 'orocrm.magento.customer.addresses.label', 'type' => 'orocrm_magento_customer_addresses', 'required' => true, 'options' => ['data_class' => $this->customerAddressClassName]])->add('contact', 'orocrm_contact_select', ['label' => 'orocrm.magento.customer.contact.label'])->add('account', 'orocrm_account_select', ['label' => 'orocrm.magento.customer.account.label']);
     if ($this->isPasswordSetAllowed($builder->getData())) {
         $builder->add('generatedPassword', 'text', ['label' => 'orocrm.magento.customer.password.label', 'tooltip' => 'orocrm.magento.customer.password.tooltip', 'required' => false, 'constraints' => [new Length(['min' => 6])]]);
     }
     $builder->addEventListener(FormEvents::SUBMIT, function (FormEvent $event) {
         /** @var Customer $entity */
         $entity = $event->getData();
         $dataChannel = $entity->getDataChannel();
         if ($dataChannel) {
             $entity->setChannel($dataChannel->getDataSource());
         }
         $store = $entity->getStore();
         if ($store) {
             $entity->setWebsite($store->getWebsite());
         }
         if (!$entity->getAddresses()->isEmpty()) {
             /** @var Address $address */
             foreach ($entity->getAddresses() as $address) {
                 if (!$address->getChannel()) {
                     $address->setChannel($entity->getChannel());
                 }
             }
         }
     });
 }
Пример #6
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $id_category = null;
     if ($builder->getData()->getCategory() instanceof Category) {
         $id_category = $builder->getData()->getCategory()->getId();
     }
     if (isset($_POST['piapp_gedmobundle_contenttype']['category'])) {
         $id_category = $_POST['piapp_gedmobundle_contenttype']['category'];
     }
     $builder->add('enabled', 'checkbox', array('data' => true, 'label' => 'pi.form.label.field.enabled', "label_attr" => array("class" => "content_collection")))->add('category', 'entity', array('class' => 'PiAppGedmoBundle:Category', 'query_builder' => function (EntityRepository $er) use($id_category) {
         $translatableListener = $this->_container->get('gedmo.listener.translatable');
         $translatableListener->setTranslationFallback(true);
         return $er->createQueryBuilder('k')->select('k')->where('k.type = :type')->andWhere("k.id IN (:id)")->orderBy('k.name', 'ASC')->setParameter('id', $id_category)->setParameter('type', 3);
     }, 'empty_value' => 'pi.form.label.select.choose.category', 'label' => "pi.form.label.field.category", 'multiple' => false, 'required' => false, "attr" => array("class" => "pi_simpleselect ajaxselect", "data-url" => $this->_container->get('sfynx.tool.route.factory')->getRoute("admin_gedmo_category_selectentity_ajax", array('type' => 3)), "data-selectid" => $id_category, "data-max" => 50), 'widget_suffix' => '<a class="button-ui-mediatheque button-ui-dialog"
                                 title="Ajouter une catégorie"
                                 data-title="Catégorie"
                                 data-href="' . $this->_container->get('sfynx.tool.route.factory')->getRoute("admin_gedmo_category_new", array("NoLayout" => "false", 'type' => 3)) . '"
                                 data-selectid="#piapp_gedmobundle_categorytype_id"
                                 data-selecttitle="#piapp_gedmobundle_categorytype_name"
                                 data-insertid="#piapp_gedmobundle_contenttype_category"
                                 data-inserttype="multiselect"
                                 ></a>'))->add('descriptif', 'text', array('label' => 'pi.form.label.field.description', "label_attr" => array("class" => "content_collection")))->add('pageurl', 'entity', array('class' => 'SfynxCmfBundle:Page', 'query_builder' => function (EntityRepository $er) {
         return $er->getAllPageHtml();
     }, 'property' => 'route_name', 'empty_value' => 'pi.form.label.select.choose.option', 'multiple' => false, 'required' => false, "label" => "pi.form.label.field.url", "attr" => array("class" => "pi_simpleselect"), "label_attr" => array("class" => "content_collection")))->add('url', 'text', array('required' => false, "label" => "pi.form.label.field.or", "label_attr" => array("class" => "content_collection")))->add('content', 'textarea', array("attr" => array("class" => "pi_editor_simple_easy"), 'required' => false, 'label' => "pi.form.label.field.content", "label_attr" => array("class" => "content_collection")))->add('pagecssclass');
 }
Пример #7
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $id_media = null;
     // get the id of media
     if ($builder->getData()->getMedia() instanceof \Sfynx\MediaBundle\Entity\Mediatheque) {
         $id_media = $builder->getData()->getMedia()->getId();
     }
     if (isset($_POST['piapp_gedmobundle_organigramtype']['media'])) {
         $id_media = $_POST['piapp_gedmobundle_organigramtype']['media'];
     }
     $choiceList = $this->_em->getRepository("PiAppGedmoBundle:Organigram")->getArrayAllByField('category');
     if (!isset($choiceList) || !count($choiceList)) {
         $choiceList = array();
     }
     $builder->add('enabled', 'checkbox', array('data' => true))->add('page', 'entity', array('class' => 'SfynxCmfBundle:Page', 'query_builder' => function (EntityRepository $er) {
         return $er->getAllPageHtml();
     }, 'property' => 'route_name', 'empty_value' => 'pi.form.label.select.choose.option', "label" => "pi.form.label.field.url", 'multiple' => false, 'required' => false, "attr" => array("class" => "pi_simpleselect")))->add('category', 'choice', array('choices' => $choiceList, 'multiple' => false, 'required' => false, 'empty_value' => 'pi.form.label.select.choose.category', 'label' => "pi.form.label.field.category", "attr" => array("class" => "pi_simpleselect")))->add('categoryother', 'text', array("label" => "pi.form.label.field.or", 'required' => false))->add('parent', 'entity', array('class' => 'PiAppGedmoBundle:Organigram', 'query_builder' => function (EntityRepository $er) {
         $translatableListener = $this->_container->get('gedmo.listener.translatable');
         $translatableListener->setTranslationFallback(true);
         return $er->createQueryBuilder('k')->select('k')->orderBy('k.lft', 'ASC');
     }, 'empty_value' => 'pi.form.label.select.choose.option', 'multiple' => false, 'required' => false, "attr" => array("class" => "pi_simpleselect")))->add('title', 'text', array('label' => "pi.form.label.field.title"))->add('descriptif', 'textarea', array('label' => 'pi.form.label.field.description'))->add('question')->add('content', 'textarea', array('label' => "pi.form.label.field.content", "attr" => array("class" => "pi_editor_simple_easy")))->add('media', 'entity', array('class' => 'SfynxMediaBundle:Mediatheque', 'query_builder' => function (EntityRepository $er) use($id_media) {
         $translatableListener = $this->_container->get('gedmo.listener.translatable');
         $translatableListener->setTranslationFallback(true);
         return $er->createQueryBuilder('a')->select('a')->where("a.id IN (:id)")->setParameter('id', $id_media);
     }, 'empty_value' => 'pi.form.label.select.choose.media', 'label' => "Media", 'multiple' => false, 'required' => false, 'constraints' => array(), "label_attr" => array("class" => 'bg_image_collection'), "attr" => array("class" => "pi_simpleselect ajaxselect", "data-url" => $this->_container->get('sfynx.tool.route.factory')->getRoute("admin_gedmo_media_selectentity_ajax", array('type' => 'image')), "data-selectid" => $id_media, "data-max" => 50), 'widget_suffix' => '<a class="button-ui-mediatheque button-ui-dialog"
          				title="Ajouter une image à la médiatheque"
          				data-title="Mediatheque"
          				data-href="' . $this->_container->get('sfynx.tool.route.factory')->getRoute("admin_gedmo_media_new", array("NoLayout" => "false", "category" => '', 'status' => 'image')) . '"
          				data-selectid="#sfynx_mediabundle_mediatype_id"
          				data-selecttitle="#sfynx_mediabundle_mediatype_title"
          				data-insertid="#piapp_gedmobundle_blocktype_media"
          				data-inserttype="multiselect"
          				></a>'));
 }
Пример #8
0
 /**
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('type', ChoiceType::class, ['label' => 'Type', 'attr' => ['class' => 'form-control'], 'choices' => array_flip(Comment::types)])->add('content', TextareaType::class, ['label' => 'Content', 'attr' => ['class' => 'form-control', 'maxlength' => 200]]);
     if ($builder->getData()) {
         $exist = $builder->getData()->getId();
         $builder->add('secret', SpamType::class)->add('save', SubmitType::class, ['label' => $exist ? 'Update' : 'Add', 'attr' => ['class' => 'btn btn-' . ($exist ? 'warning' : 'success') . ' pull-right', 'icon' => 'fa fa-' . ($exist ? 'check' : 'comment')]]);
     }
 }
Пример #9
0
 /**
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $id = $builder->getData()->getBranch()->getMeta()->getId();
     $exclude = $builder->getData()->getBranch()->getId();
     $builder->remove('folder')->remove('packages')->remove('actions')->add('branch', 'entity', array('class' => 'HLPNebulaBundle:Branch', 'expanded' => false, 'multiple' => false, 'query_builder' => function (\HLP\NebulaBundle\Entity\BranchRepository $repo) use($id, $exclude) {
         return $repo->getBranchQueryBuilder($id, $exclude);
     }));
 }
Пример #10
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $content = '';
     if ($builder->getData() instanceof Content) {
         $content = $builder->getData()->getContent();
     }
     $builder->add('scroll', 'scroll', array('label' => 'term_of_service', 'data' => $content))->add('terms_of_service', 'checkbox', array('mapped' => false, 'label' => 'terms_of_service_acceptance'));
 }
Пример #11
0
 /**
  * Build form
  *
  * @param \Symfony\Component\Form\FormBuilderInterface $builder
  * @param array                                        $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     /** @var $domain \Jeboehm\Lampcp\CoreBundle\Entity\Domain */
     $domain = $builder->getData()->getDomain();
     $zoneCollectionTransformer = new ZoneCollectionTransformer($builder->getData()->getZoneCollection());
     $dnsResourceRecordType = new DnsResourceRecordType();
     $builder->add('subdomain', null, array('required' => false, 'attr' => array('append_input' => '.' . $domain->getDomain())))->add($builder->create('zone_collection', 'collection', array('type' => $dnsResourceRecordType, 'allow_add' => true, 'allow_delete' => true, 'options' => array('required' => false)))->addModelTransformer($zoneCollectionTransformer));
 }
Пример #12
0
 private function getAvailableRoles(FormBuilderInterface $builder)
 {
     $roles = ['ROLE_ADMIN' => 'Admin', 'ROLE_USER' => 'User'];
     if ($builder->getData() && $builder->getData()->getId() === 1) {
         $roles['ROLE_SUPER_ADMIN'] = sprintf('%s (super)', $roles['ROLE_ADMIN']);
         unset($roles['ROLE_ADMIN']);
     }
     return $roles;
 }
 /**
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $choices = [];
     foreach ($builder->getData()->getChoices() as $choice) {
         $choices[$choice->getId()] = $choice->getAnswer();
     }
     $supportsMultiple = $builder->getData()->getMaxNumberOfAnswers() === 1 ? false : true;
     $builder->add('poll', ChoiceType::class, ['choices' => $choices, 'mapped' => false, 'multiple' => $supportsMultiple, 'expanded' => true]);
 }
Пример #14
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $isExisting = $builder->getData() && $builder->getData()->getId();
     $builder->add('namePrefix', 'text', ['required' => false, 'label' => 'orocrm.magento.customer.name_prefix.label'])->add('firstName', 'text', ['label' => 'orocrm.magento.customer.first_name.label'])->add('middleName', 'text', ['required' => false, 'label' => 'orocrm.magento.customer.middle_name.label'])->add('lastName', 'text', ['label' => 'orocrm.magento.customer.last_name.label'])->add('nameSuffix', 'text', ['required' => false, 'label' => 'orocrm.magento.customer.name_suffix.label'])->add('gender', 'oro_gender', ['required' => false, 'label' => 'orocrm.magento.customer.gender.label'])->add('birthday', 'oro_date', ['required' => false, 'label' => 'orocrm.magento.customer.birthday.label'])->add('email', 'email', ['label' => 'orocrm.magento.customer.email.label'])->add('vat', 'text', ['required' => false, 'label' => 'orocrm.magento.customer.vat.label'])->add('dataChannel', 'orocrm_magento_customer_channel_select', ['label' => 'orocrm.magento.customer.data_channel.label', 'entities' => [$this->customerClassName], 'required' => true, 'disabled' => $isExisting])->add('store', 'orocrm_magento_store_select', ['label' => 'orocrm.magento.customer.store.label', 'channel_field' => 'dataChannel', 'required' => true, 'disabled' => $isExisting])->add('group', 'orocrm_magento_customer_group_select', ['label' => 'orocrm.magento.customer.group.label', 'channel_field' => 'dataChannel', 'required' => true])->add('addresses', 'oro_address_collection', ['label' => 'orocrm.magento.customer.addresses.label', 'type' => 'orocrm_magento_customer_addresses', 'required' => true, 'options' => ['data_class' => $this->customerAddressClassName]])->add('contact', 'orocrm_contact_select', ['label' => 'orocrm.magento.customer.contact.label'])->add('account', 'orocrm_account_select', ['label' => 'orocrm.magento.customer.account.label']);
     if ($this->isPasswordSetAllowed($builder->getData())) {
         $builder->add('generatedPassword', 'text', ['label' => 'orocrm.magento.customer.password.label', 'tooltip' => 'orocrm.magento.customer.password.tooltip', 'required' => false, 'constraints' => [new Length(['min' => 6])]]);
     }
     $this->initFormEvents($builder);
 }
Пример #15
0
 /**
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('country', 'entity', array('class' => 'SiploMediaBundle:Country', 'placeholder' => '', 'read_only' => 'true,'));
     $builder->add('title');
     $builder->add('photo', 'vich_file');
     $builder->add('category', 'entity', array('class' => 'SiploMediaBundle:Category', 'choices' => $builder->getData()->getCountry()->getCategories(), 'required' => 'true'));
     $builder->add('subCategory', 'entity', array('class' => 'SiploMediaBundle:SubCategory', 'choices' => $builder->getData()->getCountry()->getSubCategories(), 'required' => 'true'));
     $builder->add('upload', 'submit');
 }
Пример #16
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $isSystem = $builder->getData() ? $builder->getData()->isSystem() : false;
     $builder->add('name', 'text', array('label' => 'form.banner_zone.name', 'required' => false, 'constraints' => array(new Assert\NotBlank(), new Assert\Length(array('min' => 3, 'max' => 255)))));
     $builder->add('code', 'text', array('label' => 'form.banner_zone.code', 'required' => false, 'constraints' => array(new Assert\NotBlank(), new Assert\Length(array('max' => 255)))));
     $builder->add('slug', 'text', array('label' => 'form.banner_zone.slug', 'required' => false, 'constraints' => array(new Assert\NotBlank()), 'disabled' => $isSystem));
     $builder->add('width', 'integer', array('label' => 'form.banner_zone.width', 'required' => false, 'constraints' => array(new Assert\NotBlank()), 'disabled' => $isSystem));
     $builder->add('height', 'integer', array('label' => 'form.banner_zone.height', 'required' => false, 'constraints' => array(new Assert\NotBlank()), 'disabled' => $isSystem));
     $builder->add('submit', 'submit', array('label' => 'form.button.save'));
 }
Пример #17
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     if ($this->type === 'menu' && !$this->father) {
         $builder->add($this->name, 'content', array('data' => $builder->getData(), 'theme_options' => array('titlePlaceHolder' => 'menu_title', 'contentText' => false, 'tinymce' => false)));
     } elseif ($this->type === 'menu') {
         $builder->add($this->name, 'content', array('data' => $builder->getData(), 'theme_options' => array('titlePlaceHolder' => 'link_title', 'textPlaceHolder' => 'link_address', 'tinymce' => false)));
     } else {
         $builder->add($this->name, 'content', array('data' => $builder->getData()));
     }
 }
Пример #18
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('country', 'entity', array('class' => 'SiploMediaBundle:Country', 'choice_label' => 'name', 'read_only' => 'true,'));
     $builder->add('VideoTitle', 'text');
     $builder->add('videoFile', 'vich_file', array('required' => false));
     $builder->add('youtubeLink', 'text', array('required' => false));
     $builder->add('thumbnail', 'vich_file');
     $builder->add('category', 'entity', array('class' => 'SiploMediaBundle:Category', 'choices' => $builder->getData()->getCountry()->getCategories(), 'required' => 'true'));
     $builder->add('subCategory', 'entity', array('class' => 'SiploMediaBundle:SubCategory', 'choices' => $builder->getData()->getCountry()->getSubCategories(), 'required' => 'true'));
     $builder->add('upload', 'submit');
 }
Пример #19
0
 /**
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('regimeSansPorc', 'checkbox', array('required' => false))->add('allergie', 'text', array('label' => 'allergie', 'required' => false))->add('habits', 'choice', array('choices' => Eleve::getHabitDaysLabels(), 'expanded' => true, 'multiple' => true, 'required' => false))->add('lunches', 'hidden', array('required' => false));
     $builder->get('lunches')->addModelTransformer(new LunchToStringTransformer($this->manager, $builder->getData()));
     /**
      * @var \WCS\CantineBundle\Entity\Eleve $entity
      */
     $entity = $builder->getData();
     if (!$entity->isCanteenSigned()) {
         $builder->add('canteen_atteste', 'checkbox', array('required' => true, 'mapped' => false))->add('canteen_autorise', 'checkbox', array('required' => true, 'mapped' => false))->add('canteen_certifie', 'checkbox', array('required' => true, 'mapped' => false));
     }
 }
Пример #20
0
 /**
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('typePassage', ChoiceType::class, array('label' => 'Type de passage :', 'choices' => array_merge(array("" => ""), PassageManager::$typesPassageLibelles), "attr" => array("class" => "select2 select2-simple", "data-placeholder" => "Sélectionner un type")));
     if (!$builder->getData()->getRendezVous()) {
         $builder->add('techniciens', DocumentType::class, array('choices' => $this->getTechniciens(), 'class' => 'AppBundle\\Document\\Compte', 'required' => false, 'expanded' => false, 'multiple' => true, 'attr' => array("class" => "select2 select2-simple", "multiple" => "multiple", "style" => "width:100%;")));
     }
     $builder->add('prestations', ChoiceType::class, array('choices' => $this->getPrestations(), 'expanded' => false, 'multiple' => true, 'attr' => array("class" => "select2 select2-simple", "multiple" => "multiple", "style" => "width:100%;")));
     if (!$builder->getData()->getRendezVous()) {
         $builder->add('datePrevision', DateType::class, array("attr" => array('class' => 'input-inline datepicker', 'data-provide' => 'datepicker', 'data-date-format' => 'dd/mm/yyyy'), 'widget' => 'single_text', 'format' => 'dd/MM/yyyy'), array("label" => "Date de prévision"));
     }
     $builder->add('mouvement_declenchable', null, array('label' => "Ce mouvement déclenche une facture", "required" => false));
     $builder->get('prestations')->addModelTransformer(new PrestationTransformer($this->dm));
 }
 /**
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('taps', 'hidden', array('required' => false))->add('garderies', 'hidden', array('required' => false));
     $builder->get('taps')->addModelTransformer(new TapToStringTransformer($options['manager'], $builder->getData(), $options['days_of_week']));
     $builder->get('garderies')->addModelTransformer(new GarderieToStringTransformer($options['manager'], $builder->getData(), $options['days_of_week']));
     /**
      * @var \WCS\CantineBundle\Entity\Eleve $entity
      */
     $entity = $builder->getData();
     if (!$entity->isTapgarderieSigned()) {
         $builder->add('tapgarderie_atteste', 'checkbox', array('required' => true, 'mapped' => false))->add('tapgarderie_autorise', 'checkbox', array('required' => true, 'mapped' => false))->add('tapgarderie_certifie', 'checkbox', array('required' => true, 'mapped' => false));
     }
 }
Пример #22
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     /**
      * Utilisateur form builder
      * Fields :
      * - Nom
      * - Prénom
      * - Identifiant
      * - Email
      * - Role
      * - Mot de passe
      */
     $builder->add('lastname', 'text', array('label' => 'Nom', 'attr' => array('placeholder' => 'Nom', 'class' => 'span12', 'data-handler' => 'change')))->add('firstname', 'text', array('label' => 'Prénom', 'attr' => array('placeholder' => 'Prénom', 'class' => 'span12', 'data-handler' => 'change')))->add('username', 'text', array('label' => 'Identifiant/Code administratif', 'attr' => array('placeholder' => 'Identifiant', 'class' => 'span12', 'data-change' => 'autocomplete')))->add('code', 'text', array('label' => 'Code Agent', 'attr' => array('placeholder' => 'Ex: RAK', 'class' => 'span12')))->add('isActive', 'checkbox', array('label' => 'Activé le compte', 'required' => false))->add('email', 'text', array('label' => 'Adresse email', 'attr' => array('placeholder' => 'Adresse email', 'class' => 'span12')))->add('phone', 'text', array('label' => 'Téléphone', 'required' => false, 'attr' => array('placeholder' => 'Téléphone', 'class' => 'span12')))->add('position', 'text', array('label' => 'Poste', 'required' => false, 'attr' => array('placeholder' => 'Poste', 'class' => 'span12')))->add('role', 'entity', array('label' => 'Groupe', 'class' => 'App\\CoreBundle\\Entity\\Role', 'empty_value' => 'Choisissez une groupe', 'empty_data' => null))->add('password', 'repeated', array('type' => 'password', 'invalid_message' => 'Les mots de passe ne correspondent pas.', 'required' => !$builder->getData()->getId() ? true : false, 'first_options' => array('label' => (!$builder->getData()->getId() ? 'Mot' : 'Nouveau mot') . ' de passe', 'attr' => array('placeholder' => (!$builder->getData()->getId() ? 'Mot' : 'Nouveau mot') . ' de passe', 'class' => 'span12')), 'second_options' => array('label' => 'Confirmation', 'attr' => array('placeholder' => 'Confirmation', 'class' => 'span12'))));
 }
Пример #23
0
 /**
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $members = function (EntityRepository $er) {
         return $er->createQueryBuilder('p')->innerJoin('LoginCidadaoOAuthBundle:Organization', 'o', 'WITH', 'p MEMBER OF o.members');
     };
     $builder->add('name', 'Symfony\\Component\\Form\\Extension\\Core\\Type\\TextType', array('label' => 'organizations.form.name.label'))->add('domain', 'Symfony\\Component\\Form\\Extension\\Core\\Type\\TextType', array('label' => 'organizations.form.domain.label'))->add('sectorIdentifierUri', 'Symfony\\Component\\Form\\Extension\\Core\\Type\\UrlType', array('label' => 'organizations.form.sectorIdentifierUri.label'));
     if ($this->authorizationChecker->isGranted('ROLE_ORGANIZATIONS_CAN_TRUST')) {
         $builder->add('trusted', 'LoginCidadao\\CoreBundle\\Form\\Type\\SwitchType', array('label' => 'organizations.form.trusted.label', 'required' => false));
     }
     if ($this->authorizationChecker->isGranted('ROLE_ORGANIZATIONS_VALIDATE') && $builder->getData()->getId()) {
         $builder->add('validationUrl', 'Symfony\\Component\\Form\\Extension\\Core\\Type\\UrlType', array('required' => false, 'label' => 'organizations.form.validationUrl.label'));
     }
     $organization = $builder->getData();
     $this->prepareMembersField($builder, $organization);
 }
Пример #24
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $id_users = null;
     if ($builder->getData()->getUser() instanceof User) {
         $id_users = $builder->getData()->getUser()->getId();
     }
     //
     $builder->add('enabled', 'checkbox', array('data' => true, 'label' => 'pi.form.label.field.enabled'))->add('user', 'entity', array('class' => 'SfynxAuthBundle:User', 'query_builder' => function (EntityRepository $er) use($id_users) {
         $translatableListener = $this->_container->get('gedmo.listener.translatable');
         $translatableListener->setTranslationFallback(true);
         return $er->createQueryBuilder('a')->select('a')->where("a.id IN (:id)")->andWhere('a.enabled = 1')->setParameter('id', $id_users);
     }, 'empty_value' => 'pi.form.label.select.choose.user', 'label' => "pi.form.label.field.user", 'multiple' => false, 'required' => false, "attr" => array("class" => "pi_simpleselect ajaxselect", "data-url" => $this->_container->get('sfynx.tool.route.factory')->getRoute("users_selectentity_ajax"), "data-selectid" => $id_users, "data-max" => 50)))->add('keywords', 'entity', array('class' => 'SfynxCmfBundle:KeyWord', 'query_builder' => function (EntityRepository $er) {
         return $er->getAllPageKeyWords();
     }, 'multiple' => true, 'required' => false, "attr" => array("class" => "pi_multiselect")))->add('meta_content_type', 'choice', array('choices' => PageRepository::getAvailableCssJsContentTypes(), 'required' => true, 'multiple' => false, 'expanded' => true))->add('cacheable', 'checkbox', array('label' => 'pi.page.form.cacheable', 'required' => false, 'help_block' => $this->_container->get('translator')->trans('pi.page.form.field.cacheable')))->add('public', 'checkbox', array('label' => 'pi.page.form.public', 'required' => false, 'help_block' => $this->_container->get('translator')->trans('pi.page.form.field.public')))->add('lifetime', 'number', array('label' => 'pi.page.form.lifetime', 'required' => false, 'help_block' => $this->_container->get('translator')->trans('pi.page.form.field.lifetime')))->add('url', 'text', array('help_block' => 'css/js file path (ex: bundles/sfynxtemplate/css/screen.css)'))->add('translations', 'collection', array('allow_add' => true, 'allow_delete' => true, 'prototype' => true, 'by_reference' => true, 'type' => new TranslationCssJsPageType(), 'options' => array('attr' => array('class' => 'translation_widget')), 'label' => ' '));
 }
Пример #25
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $object = $builder->getData();
     $tagTransformer = new TagsToTextTransformer($this->entityManager->getManager(), $this->taxonomyClass);
     $photoTransformer = new PhotoToIdTransformer($this->entityManager->getManager());
     $builder->add('title', 'text', array('required' => true, 'label' => 'Title:', 'attr' => array('class' => 'form-control form-control--lg margin--b', 'placeholder' => 'Enter title of the article')))->add('excerpt', 'textarea', array('required' => false, 'label' => 'Excerpt text:', 'attr' => array('class' => 'form-control form-control--lg margin--halfb', 'rows' => 2, 'placeholder' => 'Enter excerpt text')))->add($builder->create('excerptPhoto', 'hidden', array('attr' => array('class' => 'sr-only js-excerpt-photo'), 'required' => false))->addModelTransformer($photoTransformer))->add('content', 'textarea', array('required' => false, 'label' => ' ', 'attr' => array('class' => 'tinymce hide')))->add('categories', 'entity', array('class' => $this->taxonomyClass, 'required' => false, 'expanded' => true, 'multiple' => true, 'attr' => array('class' => 'js-get-pretty-categories', 'placeholder' => 'Select category')))->add($builder->create('tags', 'text', array('required' => false, 'attr' => array("class" => "form-control form-control--lg margin--halfb", "placeholder" => "Enter tags", "data-role" => "tagsinput")))->addModelTransformer($tagTransformer))->add('metaData', 'collection', array('type' => 'article_meta', 'allow_add' => true, 'allow_delete' => true, 'by_reference' => false))->add('metaExtras', 'hidden', array('mapped' => false));
     if ($this->authorizationChecker->isGranted('SWITCH_ARTICLE_AUTHOR')) {
         $builder->add('author', 'entity', array('label' => 'Author:', 'required' => true, 'class' => $this->userClass, 'placeholder' => 'Select author', 'query_builder' => function (EntityRepository $er) {
             return $er->createQueryBuilder('a')->where('a.roles like :type')->orderBy('a.username', 'ASC')->setParameter('type', '%ROLE_BLOG_USER%');
         }, 'attr' => array('class' => 'form-control form-control--lg color-placeholder')));
     }
     if ($this->authorizationChecker->isGranted('EDIT_PUBLISH_STATUS', $object)) {
         $builder->add('status', 'choice', array('label' => 'Status:', 'choices' => array(Article::STATUS_PUBLISHED => "Published", Article::STATUS_DRAFTED => "Draft"), 'required' => true, 'attr' => array("class" => "form-control form-control--lg margin--halfb"), 'data' => $object->getParent() ? $object->getParent()->getStatus() : Article::STATUS_DRAFTED));
     }
     if (!$object->getParent()) {
         //When creating new articles
         if ($this->authorizationChecker->isGranted('PUBLISH_ARTICLE', $object)) {
             $builder->add('publish', 'submit', array('attr' => array('class' => 'btn btn-md btn-primary btn-wide--xl flright--responsive-mob margin--b first-in-line js-publish-article')));
         }
         $builder->add('save_draft', 'submit', array('attr' => array('class' => 'btn btn-md btn-b-blue btn-wide--xl flright--responsive-mob margin--r')));
     } else {
         if ($object && $object->getParent() && $object->getParent()->getStatus() == Article::STATUS_DRAFTED) {
             $builder->add('save', 'submit', array('attr' => array('class' => 'btn btn-md btn-b-blue btn-wide--xl flright--responsive-mob margin--r')));
             if ($this->authorizationChecker->isGranted('PUBLISH_ARTICLE', $object)) {
                 $builder->add('publish', 'submit', array('attr' => array('class' => 'btn btn-md btn-primary btn-wide--xl flright--responsive-mob margin--b first-in-line js-publish-article')));
             }
         } else {
             $builder->add('update', 'submit', array('attr' => array('class' => 'btn btn-md btn-primary btn-wide--xl flright--responsive-mob margin--r')));
         }
     }
 }
Пример #26
0
 /**
  * Determine, if form is in editing mode
  *
  * @param \Symfony\Component\Form\FormBuilderInterface $builder
  *
  * @return bool
  */
 protected function _getIsEditMode(FormBuilderInterface $builder)
 {
     if (!$builder->getData()->getId()) {
         return false;
     }
     return true;
 }
Пример #27
0
 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $type = $builder->getData()->getNode()->getType();
     if (isset($this->nodeExtensions[$type])) {
         $this->nodeExtensions[$type]->buildForm($builder, $options);
     }
 }
Пример #28
0
 /**
  * @param FormBuilderInterface $builder
  * @param array $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('name', TextType::class, array('label' => 'Название (используется в хлебных крошках)', 'attr' => array('class' => 'form-control')))->add('title', TextType::class, array('label' => 'Заголовок окна браузера', 'attr' => array('class' => 'form-control')))->add('description', TextType::class, array('label' => 'Описание страницы', 'attr' => array('class' => 'form-control')))->add('keywords', TextType::class, array('label' => 'Ключевые слова страницы', 'attr' => array('class' => 'form-control')))->add('header', TextType::class, array('label' => 'Заголовок страницы (h1)', 'attr' => array('class' => 'form-control')));
     $builder->add('content', TextareaType::class, array('required' => false, 'attr' => array('class' => 'tinymce', 'data-theme' => 'bbcode')));
     $entity = $builder->getData();
     if ($options['SHOW_URL']) {
         $builder->add('url', null, array('attr' => array('class' => 'form-control'), 'label' => 'Адрес (без слеша)'));
     }
     if ($options['SHOW_PARENT']) {
         $builder->add('parent', 'choice', array('choices' => $options['CHOICES']));
     }
     if ($options['SHOW_PARENT']) {
         $builder->add('parent', EntityType::class, array('class' => 'NovuscomCMFBundle:Page', 'choice_label' => 'indentedTitle', 'query_builder' => function ($er) use($options, $entity) {
             if ($entity->getId()) {
                 $nots = $er->createQueryBuilder('s')->select('s.id')->where("s.lft > " . $entity->getLft() . " AND s.rgt < " . $entity->getRgt() . '')->getQuery()->getResult();
                 $notsId = array($entity->getId());
                 foreach ($nots as $val) {
                     $notsId[] = $val['id'];
                 }
                 $q = $er->createQueryBuilder('s');
                 $linked = $q->where($q->expr()->notIn('s.id', $notsId))->andwhere("s.site = :siteId")->setParameters(array('siteId' => $options['SITE_ID']))->orderBy('s.lft', 'ASC');
                 return $linked;
             } else {
                 return $er->createQueryBuilder('s')->where("s.site = :siteId")->orderBy('s.lft', 'ASC')->setParameters(array('siteId' => $options['SITE_ID']));
             }
         }, 'attr' => array('class' => 'form-control'), 'label' => 'Родитель'));
     }
     $builder->add('template', TextType::class, array('label' => 'Шаблон', 'attr' => array('class' => 'form-control'), 'required' => false));
     $builder->add('preview_picture', FileType::class, array('label' => 'Картинка для анонса', 'mapped' => false, 'required' => false));
     $builder->add('detail_picture', FileType::class, array('label' => 'Картинка для анонса', 'required' => false, 'mapped' => false));
 }
Пример #29
0
 /**
  * Builds a form with given fields.
  *
  * @param object $builder A Formbuilder interface object
  * @param array  $options An array of options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $dataArr = $builder->getData();
     $config = $this->container->getParameter('opit_opit_hrm_user');
     $builder->add('username', 'text', array('attr' => array('placeholder' => 'Username')));
     $builder->add('email', 'text', array('attr' => array('placeholder' => 'Email')));
     $builder->add('groups', 'entity', array('class' => 'OpitOpitHrmUserBundle:Groups', 'query_builder' => function (EntityRepository $er) {
         $securityContext = $this->container->get('security.context');
         $dq = $er->createQueryBuilder('g');
         if (!$securityContext->isGranted('ROLE_ADMIN')) {
             $roleHierarchy = new RoleHierarchy($this->container->getParameter('security.role_hierarchy.roles'));
             $roles = $roleHierarchy->getReachableRoles($securityContext->getToken()->getRoles());
             $allowedRoles = array();
             foreach ($roles as $role) {
                 // Exclude ROLE_SYSTEM_ADMIN role
                 // As per definition, a system admin can only set roles lower than his highest role in the hierachy
                 if ('ROLE_SYSTEM_ADMIN' != $role->getRole()) {
                     $allowedRoles[] = $role->getRole();
                 }
             }
             $dq->where('g.role IN (:allowedRoles)');
             $dq->setParameter(':allowedRoles', $allowedRoles);
         }
         return $dq->orderBy('g.name', 'ASC');
     }, 'property' => 'name', 'multiple' => true, 'expanded' => true, 'label_attr' => array('id' => 'idGroups')));
     $builder->add('isActive', 'choice', array('choices' => $this->container->getParameter('opithrm_user_status')));
     // Display ldap feature related form inputs
     if (isset($config['ldap']['enabled']) && true === $config['ldap']['enabled']) {
         $builder->add('ldapEnabled', 'choice', array('choices' => array('No', 'Yes'), 'multiple' => false, 'expanded' => true, 'data' => $dataArr->isLdapEnabled() || 0));
     }
     $builder->add('employee', new EmployeeType($this->container, $dataArr->getEmployee()));
 }
Пример #30
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('enabled', BooleanType::class)->add('confirmed', BooleanType::class);
     if ($this->isOtherUser($builder->getData())) {
         $builder->remove('password');
     }
 }