diff --git a/.gitignore b/.gitignore index ebdc16e56..26802dca0 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ composer.lock docs/build/ node_modules/* .php_cs.cache +.cache/* ###> symfony/framework-bundle ### /.env.local diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationFilter.php new file mode 100644 index 000000000..ed591e957 --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationFilter.php @@ -0,0 +1,74 @@ +translatableStringHelper = $translatableStringHelper; + } + + public function addRole(): ?string + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->andWhere( + $qb->expr()->in('activity.location', ':location') + ); + + $qb->setParameter('location', $data['accepted_location']); + } + + public function applyOn(): string + { + return Declarations::ACTIVITY_ACP; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_location', PickUserLocationType::class, [ + 'multiple' => true, + 'label' => 'pick location' + ]); + } + + public function describeAction($data, $format = 'string'): array + { + $locations = []; + + foreach ($data['accepted_location'] as $location) { + $locations[] = $location->getName(); + } + + return ['Filtered activity by location: only %locations%', [ + '%locations%' => implode(', ', $locations), + ]]; + } + + public function getTitle(): string + { + return 'Filter activity by location'; + } +} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig index 53bd3e8a7..1ec0ab274 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig @@ -168,7 +168,7 @@ {% if entity.documents|length > 0 %}
{{ entity.kind }}
+