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/config/services/export.yaml b/src/Bundle/ChillActivityBundle/config/services/export.yaml index 16addd2a3..09817d80e 100644 --- a/src/Bundle/ChillActivityBundle/config/services/export.yaml +++ b/src/Bundle/ChillActivityBundle/config/services/export.yaml @@ -79,6 +79,11 @@ services: tags: - { name: chill.export_filter, alias: 'accompanyingcourse_activitytype_filter' } + chill.activity.export.location_filter: + class: Chill\ActivityBundle\Export\Filter\ACPFilters\LocationFilter + tags: + - { name: chill.export_filter, alias: 'activity_location_filter' } + chill.activity.export.locationtype_filter: class: Chill\ActivityBundle\Export\Filter\ACPFilters\LocationTypeFilter tags: diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index 20d72e7b3..461137454 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -252,6 +252,8 @@ Activity reasons for those activities: Sujets de ces activités Filter by activity type: Filtrer les activités par type +Filter activity by location: Filtrer les activités par localisation +'Filtered activity by location: only %locations%': "Filtré par localisation: uniquement %locations%" Filter activity by locationtype: Filtrer les activités par type de localisation 'Filtered activity by locationtype: only %types%': "Filtré par type de localisation: uniquement %types%" Accepted locationtype: Types de localisation diff --git a/src/Bundle/ChillMainBundle/translations/messages.fr.yml b/src/Bundle/ChillMainBundle/translations/messages.fr.yml index b092805c6..63e93891f 100644 --- a/src/Bundle/ChillMainBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillMainBundle/translations/messages.fr.yml @@ -229,6 +229,7 @@ Create a new circle: Créer un nouveau cercle #admin section for location Location: Localisation +pick location: Localisation Location type list: Liste des types de localisation Create a new location type: Créer un nouveau type de localisation Available for users: Disponible aux utilisateurs diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilter.php index 7aadde734..615ace4c6 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/HasTemporaryLocationFilter.php @@ -72,6 +72,7 @@ class HasTemporaryLocationFilter implements FilterInterface { $builder ->add('having_temporarily', ChoiceType::class, [ + 'label' => 'export.filter.course.having_temporarily.label', 'choices' => [ 'export.filter.course.having_temporarily.Having a temporarily location' => true, 'export.filter.course.having_temporarily.Having a person\'s location' => false, diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 55f1282cb..808ce5257 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -1068,6 +1068,7 @@ export: by_referrer: Computation date for referrer: Date à laquelle le référent était actif having_temporarily: + label: Qualité de la localisation Having a temporarily location: Ayant une localisation temporaire Having a person's location: Ayant une localisation auprès d'un usager Calculation date: Date de la localisation