Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function buildActiveFilter(TableView $view, array $data, array $options)
 {
     /** @var \DateTime $date */
     $date = $data['value'];
     $activeFilter = new ActiveFilter();
     $activeFilter->setVars(['full_name' => $data['full_name'], 'id' => $data['id'], 'field' => $data['label'], 'operator' => FilterOperator::getLabel($data['operator']), 'value' => $date->format('d/m/Y H:i')]);
     $view->active_filters[] = $activeFilter;
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function buildActiveFilter(TableView $view, array $data, array $options)
 {
     $value = $data['value'];
     $choices = $options['choices'];
     $transform = function ($v) use($choices) {
         if (array_key_exists($v, $choices)) {
             return $choices[$v];
         }
         return $v;
     };
     if (is_array($value)) {
         $value = array_map($transform, $value);
     } else {
         $value = $transform($value);
     }
     $activeFilter = new ActiveFilter();
     $activeFilter->setVars(['full_name' => $data['full_name'], 'id' => $data['id'], 'field' => $data['label'], 'operator' => FilterOperator::getLabel($data['operator']), 'value' => $value]);
     $view->active_filters[] = $activeFilter;
 }
Exemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function buildActiveFilter(TableView $view, array $data, array $options)
 {
     $repo = $this->em->getRepository($options['class']);
     $entities = $repo->findBy(['id' => $data['value']]);
     $values = [];
     if (0 < strlen($property = $options['property'])) {
         $accessor = PropertyAccess::createPropertyAccessor();
         $transform = function ($entity) use($accessor, $property) {
             return $accessor->getValue($entity, $property);
         };
     } else {
         $transform = function ($entity) {
             return (string) $entity;
         };
     }
     foreach ($entities as $entity) {
         $values[] = $transform($entity);
     }
     $activeFilter = new ActiveFilter();
     $activeFilter->setVars(['full_name' => $data['full_name'], 'id' => $data['id'], 'field' => $data['label'], 'operator' => FilterOperator::getLabel($data['operator']), 'value' => $values]);
     $view->active_filters[] = $activeFilter;
 }
Exemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 public function buildActiveFilter(TableView $view, array $data, array $options)
 {
     $activeFilter = new ActiveFilter();
     $activeFilter->setVars(['full_name' => $data['full_name'], 'id' => $data['id'], 'field' => $data['label'], 'operator' => FilterOperator::getLabel($data['operator']), 'value' => $data['value'] ? 'ekyna_core.value.yes' : 'ekyna_core.value.no']);
     $view->active_filters[] = $activeFilter;
 }