Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     if ($options['level']) {
         $builder->add('condition_pattern', 'choice', array('choices' => array('AND' => 'AND', 'OR' => 'OR'), 'attr' => array('class' => 'sf_filter_condition_pattern')));
     }
     if ($options['condition_operator']) {
         $builder->add('condition_operator', 'choice', array('choices' => $options['condition_operator'] ? ConditionOperator::get($options['condition_operator']) : ConditionOperator::get('date_from'), 'attr' => array('class' => 'sf_filter_condition_operator')));
     }
     $builder->add('name', 'zk2_date_bootstrap', array('required' => false, 'Zk2DateSetting' => array('filter' => true), 'attr' => array('class' => 'sf_filter_value sf_filter_text', 'style' => 'width:70%;', 'data-index' => $options['data_index'])));
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     if ($options['level']) {
         $builder->add('condition_pattern', 'choice', array('choices' => array('OR' => 'OR', 'AND' => 'AND'), 'attr' => array('class' => 'sf_filter_condition_pattern')));
     }
     if ($options['condition_operator']) {
         $builder->add('condition_operator', 'choice', array('choices' => ConditionOperator::get($options['condition_operator']), 'attr' => array('class' => 'sf_filter_condition_operator')));
     }
     $builder->add('name', null, array('required' => false, 'attr' => array('class' => 'sf_filter_text', 'style' => 'background: #FFFFFF;', 'data-index' => $options['data_index'])));
 }
Пример #3
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     if ($options['level']) {
         $builder->add('condition_pattern', 'choice', array('choices' => array('OR' => 'OR', 'AND' => 'AND'), 'attr' => array('class' => 'sf_filter_condition_pattern')));
     }
     if ($options['condition_operator']) {
         $builder->add('condition_operator', 'choice', array('choices' => ConditionOperator::get($options['condition_operator']), 'attr' => array('class' => 'sf_filter_condition_operator')));
     }
     $opt = array('required' => false, 'empty_value' => '', 'choices' => $options['sf_choice'], 'attr' => array('class' => 'sf_filter_select', 'data-index' => $options['data_index']));
     $builder->add('name', 'choice', $opt);
 }
Пример #4
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     if ($options['level']) {
         $builder->add('condition_pattern', 'choice', array('choices' => array('OR' => 'OR', 'AND' => 'AND'), 'attr' => array('class' => 'sf_filter_condition_pattern')));
     }
     if ($options['condition_operator']) {
         $builder->add('condition_operator', 'choice', array('choices' => ConditionOperator::get($options['condition_operator']), 'attr' => array('class' => 'sf_filter_condition_operator')));
     }
     $entity_type = $options['entity_type'] ? $options['entity_type'] : 'entity';
     $opt = array('required' => false, 'empty_value' => '', 'em' => $options['em'], 'class' => $options['entity_class'], 'property' => $options['property'], 'attr' => array('class' => 'sf_filter_select', 'data-index' => $options['data_index']));
     if ($options['sf_query_builder']) {
         $query = function (EntityRepository $er) use($options) {
             return $er->createQueryBuilder($options['sf_query_builder']['alias'])->where($options['sf_query_builder']['where'])->orderBy($options['sf_query_builder']['order_field'], $options['sf_query_builder']['order_type']);
         };
         $opt['query_builder'] = $query;
     }
     $builder->add('name', $entity_type, $opt);
 }