From 4ebe06453888892e9c16fa10a1714645c210f580 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 17 Aug 2022 09:49:33 +0200 Subject: [PATCH 01/10] exports: improve translations --- src/Bundle/ChillPersonBundle/translations/messages.fr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index d9dad5f85..10e0e2539 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -346,7 +346,7 @@ Accompanying courses duration: Durée moyenne des parcours Create an average of accompanying courses duration according to various filters: Moyenne de la durée des parcours en jours, selon différents filtres. Closingdate to apply: Date de fin à prendre en compte lorsque le parcours n'est pas clotûré -Exports of social work actions: Exports des actions d'accompangement +Exports of social work actions: Exports des actions d'accompagnement Count social work actions: Nombre d'actions d'accompagnement Count social work actions by various parameters: Compte le nombre d'actions d'accompagnement en fonction de différents filtres. @@ -356,7 +356,7 @@ Count evaluation by various parameters.: Compte le nombre d'évaluations selon d Exports of households: Exports des ménages Count households: Nombre de ménages -Count household by various parameters.: Compte le nombre de ménages selon différents filtres. +Count household by various parameters.: Compte le nombre de ménages impliqués dans un parcours selon différents filtres. ## filters Filter by person gender: Filtrer par genre de la personne From 94cee14a112328de2c6d5476edcc0dc57cc347bb Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 17 Aug 2022 09:50:35 +0200 Subject: [PATCH 02/10] exports: complete modifiers --- src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php | 2 ++ src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php | 1 + 2 files changed, 3 insertions(+) diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php index 3c7a0e319..1e703754e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php @@ -128,6 +128,8 @@ class CountEvaluation implements ExportInterface, GroupedExportInterface { return [ Declarations::EVAL_TYPE, + //Declarations::ACP_TYPE, + //Declarations::SOCIAL_WORK_ACTION_TYPE, ]; } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php b/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php index 9767c17ed..a43345ff3 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php @@ -130,6 +130,7 @@ class CountHousehold implements ExportInterface, GroupedExportInterface { return [ Declarations::HOUSEHOLD_TYPE, + //Declarations::ACP_TYPE ]; } From 57d00df46046f189d884f10e43d144190439beff Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 17 Aug 2022 10:12:29 +0200 Subject: [PATCH 03/10] exports: split namespace between activity linked to person <> acp --- .../CountActivity.php} | 4 +-- .../{ => LinkedToPerson}/CountActivity.php | 2 +- .../{ => LinkedToPerson}/ListActivity.php | 2 +- .../StatActivityDuration.php | 2 +- .../config/services/export.yaml | 30 +++++++++---------- 5 files changed, 20 insertions(+), 20 deletions(-) rename src/Bundle/ChillActivityBundle/Export/Export/{CountActivityLinkedToACP.php => LinkedToACP/CountActivity.php} (95%) rename src/Bundle/ChillActivityBundle/Export/Export/{ => LinkedToPerson}/CountActivity.php (97%) rename src/Bundle/ChillActivityBundle/Export/Export/{ => LinkedToPerson}/ListActivity.php (99%) rename src/Bundle/ChillActivityBundle/Export/Export/{ => LinkedToPerson}/StatActivityDuration.php (98%) diff --git a/src/Bundle/ChillActivityBundle/Export/Export/CountActivityLinkedToACP.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php similarity index 95% rename from src/Bundle/ChillActivityBundle/Export/Export/CountActivityLinkedToACP.php rename to src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php index 91a2dd285..35e52dbd5 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/CountActivityLinkedToACP.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\ActivityBundle\Export\Export; +namespace Chill\ActivityBundle\Export\Export\LinkedToACP; use Chill\ActivityBundle\Export\Declarations; use Chill\ActivityBundle\Repository\ActivityRepository; @@ -23,7 +23,7 @@ use LogicException; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Role\Role; -class CountActivityLinkedToACP implements ExportInterface, GroupedExportInterface +class CountActivity implements ExportInterface, GroupedExportInterface { protected ActivityRepository $activityRepository; diff --git a/src/Bundle/ChillActivityBundle/Export/Export/CountActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php similarity index 97% rename from src/Bundle/ChillActivityBundle/Export/Export/CountActivity.php rename to src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php index 3834bc819..425e15dea 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/CountActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\ActivityBundle\Export\Export; +namespace Chill\ActivityBundle\Export\Export\LinkedToPerson; use Chill\ActivityBundle\Repository\ActivityRepository; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; diff --git a/src/Bundle/ChillActivityBundle/Export/Export/ListActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php similarity index 99% rename from src/Bundle/ChillActivityBundle/Export/Export/ListActivity.php rename to src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php index 773c4bee1..b0112b24c 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/ListActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\ActivityBundle\Export\Export; +namespace Chill\ActivityBundle\Export\Export\LinkedToPerson; use Chill\ActivityBundle\Entity\ActivityReason; use Chill\ActivityBundle\Repository\ActivityRepository; diff --git a/src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php similarity index 98% rename from src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php rename to src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php index 5f02928c6..be1e9d318 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\ActivityBundle\Export\Export; +namespace Chill\ActivityBundle\Export\Export\LinkedToPerson; use Chill\ActivityBundle\Repository\ActivityRepository; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; diff --git a/src/Bundle/ChillActivityBundle/config/services/export.yaml b/src/Bundle/ChillActivityBundle/config/services/export.yaml index 366c9c1b1..7d6570e07 100644 --- a/src/Bundle/ChillActivityBundle/config/services/export.yaml +++ b/src/Bundle/ChillActivityBundle/config/services/export.yaml @@ -4,26 +4,26 @@ services: autoconfigure: true ## Indicators - chill.activity.export.count_activity: - class: Chill\ActivityBundle\Export\Export\CountActivity + chill.activity.export.count_activity_linked_to_person: + class: Chill\ActivityBundle\Export\Export\LinkedToPerson\CountActivity tags: - - { name: chill.export, alias: 'count_activity' } - + - { name: chill.export, alias: 'count_activity_linked_to_person' } + + chill.activity.export.sum_activity_duration_linked_to_person: + class: Chill\ActivityBundle\Export\Export\LinkedToPerson\StatActivityDuration + tags: + - { name: chill.export, alias: 'sum_activity_duration_linked_to_person' } + + chill.activity.export.list_activity_linked_to_person: + class: Chill\ActivityBundle\Export\Export\LinkedToPerson\ListActivity + tags: + - { name: chill.export, alias: 'list_activity_linked_to_person' } + chill.activity.export.count_activity_linked_to_acp: - class: Chill\ActivityBundle\Export\Export\CountActivityLinkedToACP + class: Chill\ActivityBundle\Export\Export\LinkedToACP\CountActivity tags: - { name: chill.export, alias: 'count_activity_linked_to_acp' } - chill.activity.export.sum_activity_duration: - class: Chill\ActivityBundle\Export\Export\StatActivityDuration - tags: - - { name: chill.export, alias: 'sum_activity_duration' } - - chill.activity.export.list_activity: - class: Chill\ActivityBundle\Export\Export\ListActivity - tags: - - { name: chill.export, alias: 'list_activity' } - ## Filters chill.activity.export.reason_filter: class: Chill\ActivityBundle\Export\Filter\ActivityReasonFilter From d9b668e61461959486de9997d5c082de035a6302 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 17 Aug 2022 11:44:15 +0200 Subject: [PATCH 04/10] exports: create new activity linked to acp exports indicators + title/descr/groups translations --- .../LinkedToACP/AvgActivityDuration.php | 79 +++++++++++++++++++ .../LinkedToACP/AvgActivityVisitDuration.php | 79 +++++++++++++++++++ .../Export/LinkedToACP/CountActivity.php | 22 +++--- .../LinkedToACP/SumActivityDuration.php | 79 +++++++++++++++++++ .../LinkedToACP/SumActivityVisitDuration.php | 78 ++++++++++++++++++ .../Export/LinkedToPerson/CountActivity.php | 2 +- .../Export/LinkedToPerson/ListActivity.php | 6 +- .../LinkedToPerson/StatActivityDuration.php | 6 +- .../config/services/export.yaml | 20 +++++ .../translations/messages.fr.yml | 26 ++++-- 10 files changed, 372 insertions(+), 25 deletions(-) create mode 100644 src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php create mode 100644 src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php create mode 100644 src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php create mode 100644 src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php new file mode 100644 index 000000000..ec9c1aecb --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php @@ -0,0 +1,79 @@ +getQuery()->getResult(Query::HYDRATE_SCALAR); + } + + public function getType(): string + { + return Declarations::ACTIVITY; + } + + public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) + { + // TODO: Implement initiateQuery() method. + } + + public function requiredRole(): Role + { + return new Role(ActivityStatsVoter::STATS); + } + + public function supportsModifiers(): array + { + return [ + Declarations::ACTIVITY, + //PersonDeclarations::ACP_TYPE, + ]; + } + + public function getGroup(): string + { + return 'Exports of activities linked to an accompanying period'; + } + +} \ No newline at end of file diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php new file mode 100644 index 000000000..f74dbda6d --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php @@ -0,0 +1,79 @@ +getQuery()->getResult(Query::HYDRATE_SCALAR); + } + + public function getType(): string + { + return Declarations::ACTIVITY; + } + + public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) + { + // TODO: Implement initiateQuery() method. + } + + public function requiredRole(): Role + { + return new Role(ActivityStatsVoter::STATS); + } + + public function supportsModifiers(): array + { + return [ + Declarations::ACTIVITY, + //PersonDeclarations::ACP_TYPE, + ]; + } + + public function getGroup(): string + { + return 'Exports of activities linked to an accompanying period'; + } + +} \ No newline at end of file diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php index 35e52dbd5..faefaedfc 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php @@ -37,28 +37,28 @@ class CountActivity implements ExportInterface, GroupedExportInterface { } - public function getAllowedFormattersTypes() + public function getAllowedFormattersTypes(): array { return [FormatterInterface::TYPE_TABULAR]; } - public function getDescription() + public function getDescription(): string { return 'Count activities linked to an accompanying period by various parameters.'; } public function getLabels($key, array $values, $data) { - if ('export_count_activity_acp' !== $key) { + if ('export_count_activity' !== $key) { throw new LogicException("the key {$key} is not used by this export"); } return static fn ($value) => '_header' === $value ? 'Number of activities linked to an accompanying period' : $value; } - public function getQueryKeys($data) + public function getQueryKeys($data): array { - return ['export_count_activity_acp']; + return ['export_count_activity']; } public function getResult($qb, $data) @@ -66,12 +66,12 @@ class CountActivity implements ExportInterface, GroupedExportInterface return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR); } - public function getTitle() + public function getTitle(): string { return 'Count activities linked to an accompanying period'; } - public function getType() + public function getType(): string { return Declarations::ACTIVITY; } @@ -83,7 +83,7 @@ class CountActivity implements ExportInterface, GroupedExportInterface $qb = $this ->activityRepository ->createQueryBuilder('activity') - ->select('COUNT(activity.id) as export_count_activity_acp'); + ->select('COUNT(activity.id) as export_count_activity'); $qb->andWhere( $qb->expr()->isNotNull('activity.accompanyingPeriod') @@ -92,12 +92,12 @@ class CountActivity implements ExportInterface, GroupedExportInterface return $qb; } - public function requiredRole() + public function requiredRole(): Role { return new Role(ActivityStatsVoter::STATS); } - public function supportsModifiers() + public function supportsModifiers(): array { return [ Declarations::ACTIVITY, @@ -108,6 +108,6 @@ class CountActivity implements ExportInterface, GroupedExportInterface public function getGroup(): string { - return 'Exports of activities'; + return 'Exports of activities linked to an accompanying period'; } } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php new file mode 100644 index 000000000..d32840d04 --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php @@ -0,0 +1,79 @@ +getQuery()->getResult(Query::HYDRATE_SCALAR); + } + + public function getType(): string + { + return Declarations::ACTIVITY; + } + + public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) + { + // TODO: Implement initiateQuery() method. + } + + public function requiredRole(): Role + { + return new Role(ActivityStatsVoter::STATS); + } + + public function supportsModifiers(): array + { + return [ + Declarations::ACTIVITY, + //PersonDeclarations::ACP_TYPE, + ]; + } + + public function getGroup(): string + { + return 'Exports of activities linked to an accompanying period'; + } + +} \ No newline at end of file diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php new file mode 100644 index 000000000..94be1a546 --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php @@ -0,0 +1,78 @@ +getQuery()->getResult(Query::HYDRATE_SCALAR); + } + + public function getType(): string + { + return Declarations::ACTIVITY; + } + + public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) + { + // TODO: Implement initiateQuery() method. + } + + public function requiredRole(): Role + { + return new Role(ActivityStatsVoter::STATS); + } + + public function supportsModifiers(): array + { + return [ + Declarations::ACTIVITY, + //PersonDeclarations::ACP_TYPE, + ]; + } + + public function getGroup(): string + { + return 'Exports of activities linked to an accompanying period'; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php index 425e15dea..18ef1671d 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php @@ -108,6 +108,6 @@ class CountActivity implements ExportInterface, GroupedExportInterface public function getGroup(): string { - return 'Exports of activities'; + return 'Exports of activities linked to a person'; } } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php index b0112b24c..3e8442a7e 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php @@ -97,7 +97,7 @@ class ListActivity implements ListInterface, GroupedExportInterface public function getDescription() { - return 'List activities description'; + return 'List activities linked to a person description'; } public function getLabels($key, array $values, $data) @@ -183,7 +183,7 @@ class ListActivity implements ListInterface, GroupedExportInterface public function getTitle() { - return 'List activities'; + return 'List activities linked to a person'; } public function getType() @@ -285,6 +285,6 @@ class ListActivity implements ListInterface, GroupedExportInterface public function getGroup(): string { - return 'Exports of activities'; + return 'Exports of activities linked to a person'; } } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php index be1e9d318..80f1803c5 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php @@ -63,7 +63,7 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface public function getDescription() { if (self::SUM === $this->action) { - return 'Sum activities duration by various parameters.'; + return 'Sum activities linked to a person duration by various parameters.'; } } @@ -91,7 +91,7 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface public function getTitle() { if (self::SUM === $this->action) { - return 'Sum activity duration'; + return 'Sum activity linked to a person duration'; } } @@ -137,6 +137,6 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface public function getGroup(): string { - return 'Exports of activities'; + return 'Exports of activities linked to a person'; } } diff --git a/src/Bundle/ChillActivityBundle/config/services/export.yaml b/src/Bundle/ChillActivityBundle/config/services/export.yaml index 7d6570e07..c6b0e9718 100644 --- a/src/Bundle/ChillActivityBundle/config/services/export.yaml +++ b/src/Bundle/ChillActivityBundle/config/services/export.yaml @@ -24,6 +24,26 @@ services: tags: - { name: chill.export, alias: 'count_activity_linked_to_acp' } + chill.activity.export.sum_activity_duration_linked_to_acp: + class: Chill\ActivityBundle\Export\Export\LinkedToACP\SumActivityDuration + tags: + - { name: chill.export, alias: 'sum_activity_duration_linked_to_acp' } + + chill.activity.export.sum_activity_visit_duration_linked_to_acp: + class: Chill\ActivityBundle\Export\Export\LinkedToACP\SumActivityVisitDuration + tags: + - { name: chill.export, alias: 'sum_activity_visit_duration_linked_to_acp' } + + chill.activity.export.avg_activity_duration_linked_to_acp: + class: Chill\ActivityBundle\Export\Export\LinkedToACP\AvgActivityDuration + tags: + - { name: chill.export, alias: 'avg_activity_duration_linked_to_acp' } + + chill.activity.export.avg_activity_visit_duration_linked_to_acp: + class: Chill\ActivityBundle\Export\Export\LinkedToACP\AvgActivityVisitDuration + tags: + - { name: chill.export, alias: 'avg_activity_visit_duration_linked_to_acp' } + ## Filters chill.activity.export.reason_filter: class: Chill\ActivityBundle\Export\Filter\ActivityReasonFilter diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index 9cc8d47af..82c821f51 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -203,17 +203,29 @@ Are you sure you want to remove the activity about "%name%" ?: Êtes-vous sûr d The activity has been successfully removed.: L'activité a été supprimée. # exports -Exports of activities: Exports des activités +Exports of activities linked to a person: Exports des activités liées à une personne + Number of activities linked to a person: Nombre d'activités liées à une personne -Count activities linked to a person: Nombre d'activités liées à une personne +Count activities linked to a person: Nombre d'activités Count activities linked to a person by various parameters.: Compte le nombre d'activités enregistrées et liées à une personne en fonction de différents paramètres. -Sum activity duration: Total de la durée des activités -Sum activities duration by various parameters.: Additionne la durée des activités en fonction de différents paramètres. -List activities: Liste les activités -List activities description: Créer la liste des activités +Sum activity linked to a person duration: Total de la durée des activités +Sum activities linked to a person duration by various parameters.: Additionne la durée des activités en fonction de différents paramètres. +List activities linked to a person: Liste les activités +List activities linked to a person description: Crée la liste des activités en fonction de différents paramètres. + +Exports of activities linked to an accompanying period: Exports des activités liées à un parcours + Number of activities linked to an accompanying period: Nombre d'activités liées à un parcours -Count activities linked to an accompanying period: Nombre d'activités liées à un parcours +Count activities linked to an accompanying period: Nombre d'activités Count activities linked to an accompanying period by various parameters.: Compte le nombre d'activités enregistrées et liées à un parcours en fonction de différents paramètres. +Sum activity linked to an accompanying period duration: Somme de la durée des activités +Sum activities linked to an accompanying period duration by various parameters.: Additionne la durée des activités en fonction de différents paramètres. +Sum activity linked to an accompanying period visit duration: Somme de la durée de déplacement des activités +Sum activities linked to an accompanying period visit duration by various parameters.: Additionne la durée de déplacement des activités en fonction de différents paramètres. +Average activity linked to an accompanying period duration: Moyenne de la durée des activités +Average activities linked to an accompanying period duration by various parameters.: Moyenne de la durée des activités en fonction de différents paramètres. +Average activity linked to an accompanying period visit duration: Moyenne de la durée de déplacement des activités +Average activities linked to an accompanying period visit duration by various parameters.: Moyenne de la durée de déplacement des activités en fonction de différents paramètres. #filters Filter by reason: Filtrer par sujet d'activité From df9a5071c714b653dc4d7525c7f8f9268b465341 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 17 Aug 2022 13:02:54 +0200 Subject: [PATCH 05/10] exports: display group as a breadcrumb in template add a private method in controller which could be moved maybe in ExportManager --- .../Controller/ExportController.php | 24 ++++++++++++++++++- .../Resources/views/Export/download.html.twig | 5 ++++ .../Resources/views/Export/new.html.twig | 5 ++++ .../views/Export/new_centers_step.html.twig | 5 ++++ .../views/Export/new_formatter_step.html.twig | 5 ++++ 5 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillMainBundle/Controller/ExportController.php b/src/Bundle/ChillMainBundle/Controller/ExportController.php index 5dcd158f6..a7404b879 100644 --- a/src/Bundle/ChillMainBundle/Controller/ExportController.php +++ b/src/Bundle/ChillMainBundle/Controller/ExportController.php @@ -86,6 +86,9 @@ class ExportController extends AbstractController { /** @var \Chill\MainBundle\Export\ExportManager $exportManager */ $exportManager = $this->exportManager; + + $export = $exportManager->getExport($alias); + $key = $request->query->get('key', null); [$dataCenters, $dataExport, $dataFormatter] = $this->rebuildData($key); @@ -100,7 +103,8 @@ class ExportController extends AbstractController $viewVariables = [ 'alias' => $alias, - 'export' => $exportManager->getExport($alias), + 'export' => $export, + 'export_group' => $this->getExportGroup($export), ]; if ($formater instanceof \Chill\MainBundle\Export\Formatter\CSVListFormatter) { @@ -316,6 +320,7 @@ class ExportController extends AbstractController 'form' => $form->createView(), 'export_alias' => $alias, 'export' => $export, + 'export_group' => $this->getExportGroup($export), ]); } @@ -371,6 +376,7 @@ class ExportController extends AbstractController [ 'form' => $form->createView(), 'export' => $export, + 'export_group' => $this->getExportGroup($export), ] ); } @@ -514,6 +520,7 @@ class ExportController extends AbstractController [ 'form' => $form->createView(), 'export' => $export, + 'export_group' => $this->getExportGroup($export), ] ); } @@ -565,4 +572,19 @@ class ExportController extends AbstractController throw new LogicException("the step {$step} is not defined."); } } + + private function getExportGroup($target): string + { + $exportManager = $this->exportManager; + + $groups = $exportManager->getExportsGrouped(true); + + foreach ($groups as $group => $array) { + foreach ($array as $alias => $export) { + if ($export === $target) { + return $group; + } + } + } + } } diff --git a/src/Bundle/ChillMainBundle/Resources/views/Export/download.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Export/download.html.twig index 505c22ab4..fa568d857 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Export/download.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Export/download.html.twig @@ -36,6 +36,11 @@ window.addEventListener("DOMContentLoaded", function(e) { {% block content %}
+
+ + {{ export_group|trans }} +
+

{{ export.title|trans }}

{{ "Download export"|trans }}

diff --git a/src/Bundle/ChillMainBundle/Resources/views/Export/new.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Export/new.html.twig index 4ee857f00..8aac6c253 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Export/new.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Export/new.html.twig @@ -27,6 +27,11 @@ {% block content %}
+
+ + {{ export_group|trans }} +
+

{{ export.title|trans }}

{{ export.description|trans }}

diff --git a/src/Bundle/ChillMainBundle/Resources/views/Export/new_centers_step.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Export/new_centers_step.html.twig index 9adad67df..4a2d9ab9e 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Export/new_centers_step.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Export/new_centers_step.html.twig @@ -23,6 +23,11 @@ {% block content %}
+
+ + {{ export_group|trans }} +
+

{{ export.title|trans }}

{{ export.description|trans }}

diff --git a/src/Bundle/ChillMainBundle/Resources/views/Export/new_formatter_step.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Export/new_formatter_step.html.twig index 4854b1c9d..443816611 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Export/new_formatter_step.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Export/new_formatter_step.html.twig @@ -22,6 +22,11 @@ {% block content %}
+ +
+ + {{ export_group|trans }} +

{{ export.title|trans }}

From c09c7a9615adf3a875900442eb2e34c325819fc7 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 17 Aug 2022 14:18:39 +0200 Subject: [PATCH 06/10] exports: add new modifiers declarations to split filter/aggregators between activities linked to person <> acp --- .../Export/Aggregator/ActivityReasonAggregator.php | 2 +- .../Export/Aggregator/ActivityTypeAggregator.php | 2 +- .../Export/Aggregator/ActivityUserAggregator.php | 2 +- src/Bundle/ChillActivityBundle/Export/Declarations.php | 4 ++++ .../Export/Export/LinkedToACP/AvgActivityDuration.php | 1 + .../Export/Export/LinkedToACP/AvgActivityVisitDuration.php | 1 + .../Export/Export/LinkedToACP/CountActivity.php | 2 +- .../Export/Export/LinkedToACP/SumActivityDuration.php | 1 + .../Export/Export/LinkedToACP/SumActivityVisitDuration.php | 1 + .../Export/Export/LinkedToPerson/CountActivity.php | 5 +++-- .../Export/Export/LinkedToPerson/ListActivity.php | 5 +++-- .../Export/Export/LinkedToPerson/StatActivityDuration.php | 5 +++-- .../ChillActivityBundle/Export/Filter/ActivityDateFilter.php | 2 +- .../Export/Filter/ActivityReasonFilter.php | 2 +- .../ChillActivityBundle/Export/Filter/ActivityTypeFilter.php | 2 +- 15 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php index b4d2f8e52..5c77159e3 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php @@ -107,7 +107,7 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali public function applyOn(): string { - return Declarations::ACTIVITY; + return Declarations::ACTIVITY_PERSON; } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php index 8a5ce4d01..3d73e0648 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php @@ -54,7 +54,7 @@ class ActivityTypeAggregator implements AggregatorInterface public function applyOn(): string { - return Declarations::ACTIVITY; + return Declarations::ACTIVITY_PERSON; } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php index 3cdeee0f9..be4149bf9 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php @@ -48,7 +48,7 @@ class ActivityUserAggregator implements AggregatorInterface public function applyOn(): string { - return Declarations::ACTIVITY; + return Declarations::ACTIVITY_PERSON; } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillActivityBundle/Export/Declarations.php b/src/Bundle/ChillActivityBundle/Export/Declarations.php index 76335415f..7a5b47028 100644 --- a/src/Bundle/ChillActivityBundle/Export/Declarations.php +++ b/src/Bundle/ChillActivityBundle/Export/Declarations.php @@ -17,4 +17,8 @@ namespace Chill\ActivityBundle\Export; abstract class Declarations { public const ACTIVITY = 'activity'; + + public const ACTIVITY_ACP = "activity_linked_to_acp"; + + public const ACTIVITY_PERSON = "activity_linked_to_person"; } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php index ec9c1aecb..327dc9e30 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php @@ -67,6 +67,7 @@ class AvgActivityDuration implements ExportInterface, GroupedExportInterface { return [ Declarations::ACTIVITY, + Declarations::ACTIVITY_ACP, //PersonDeclarations::ACP_TYPE, ]; } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php index f74dbda6d..96c7941e9 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php @@ -67,6 +67,7 @@ class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterfac { return [ Declarations::ACTIVITY, + Declarations::ACTIVITY_ACP, //PersonDeclarations::ACP_TYPE, ]; } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php index faefaedfc..2cbd7ddd8 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php @@ -101,7 +101,7 @@ class CountActivity implements ExportInterface, GroupedExportInterface { return [ Declarations::ACTIVITY, - //PersonDeclarations::PERSON_TYPE, + Declarations::ACTIVITY_ACP, //PersonDeclarations::ACP_TYPE, ]; } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php index d32840d04..40f8977a3 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php @@ -67,6 +67,7 @@ class SumActivityDuration implements ExportInterface, GroupedExportInterface { return [ Declarations::ACTIVITY, + Declarations::ACTIVITY_ACP, //PersonDeclarations::ACP_TYPE, ]; } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php index 94be1a546..1bbc83a86 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php @@ -67,6 +67,7 @@ class SumActivityVisitDuration implements ExportInterface, GroupedExportInterfac { return [ Declarations::ACTIVITY, + Declarations::ACTIVITY_ACP, //PersonDeclarations::ACP_TYPE, ]; } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php index 18ef1671d..96c79297e 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php @@ -71,9 +71,9 @@ class CountActivity implements ExportInterface, GroupedExportInterface return 'Count activities linked to a person'; } - public function getType() + public function getType(): string { - return 'activity'; + return Declarations::ACTIVITY; } public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) @@ -102,6 +102,7 @@ class CountActivity implements ExportInterface, GroupedExportInterface { return [ Declarations::ACTIVITY, + Declarations::ACTIVITY_PERSON, //PersonDeclarations::PERSON_TYPE, ]; } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php index 3e8442a7e..3ded55b56 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php @@ -186,9 +186,9 @@ class ListActivity implements ListInterface, GroupedExportInterface return 'List activities linked to a person'; } - public function getType() + public function getType(): string { - return 'activity'; + return Declarations::ACTIVITY; } public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) @@ -279,6 +279,7 @@ class ListActivity implements ListInterface, GroupedExportInterface { return [ Declarations::ACTIVITY, + Declarations::ACTIVITY_PERSON, //PersonDeclarations::PERSON_TYPE, ]; } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php index 80f1803c5..94903b282 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php @@ -95,9 +95,9 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface } } - public function getType() + public function getType(): string { - return 'activity'; + return Declarations::ACTIVITY; } public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) @@ -131,6 +131,7 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface { return [ Declarations::ACTIVITY, + Declarations::ACTIVITY_PERSON, //PersonDeclarations::PERSON_TYPE, ]; } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php index 7a7fed3ee..977fa2f9e 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php @@ -60,7 +60,7 @@ class ActivityDateFilter implements FilterInterface public function applyOn(): string { - return Declarations::ACTIVITY; + return Declarations::ACTIVITY_PERSON; } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityReasonFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityReasonFilter.php index de6baac03..eef032818 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityReasonFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityReasonFilter.php @@ -82,7 +82,7 @@ class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInt public function applyOn(): string { - return Declarations::ACTIVITY; + return Declarations::ACTIVITY_PERSON; } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php index 9019bf3cd..bfd80ecc7 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php @@ -64,7 +64,7 @@ class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInter public function applyOn(): string { - return Declarations::ACTIVITY; + return Declarations::ACTIVITY_PERSON; } public function buildForm(FormBuilderInterface $builder) From c17036fcdaf2259bfc80435a513614c5559c4c27 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 17 Aug 2022 15:27:37 +0200 Subject: [PATCH 07/10] exports: fix activitytype filter/aggregator appliedTo activity_person and too activity_acl --- .../Aggregator/ActivityTypeAggregator.php | 18 +++++++---- .../Export/LinkedToACP/CountActivity.php | 25 +++++++--------- .../Export/LinkedToPerson/CountActivity.php | 13 ++++---- .../Export/Filter/ActivityTypeFilter.php | 30 ++++++++----------- .../translations/messages.fr.yml | 2 +- .../translations/messages.nl.yaml | 2 +- 6 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php index 3d73e0648..cedd2df8c 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php @@ -45,16 +45,24 @@ class ActivityTypeAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - // add select element - $qb->addSelect(sprintf('IDENTITY(activity.type) AS %s', self::KEY)); + if (!in_array('type', $qb->getAllAliases())) { + $qb->join('activity.activityType', 'type'); + } - // add the "group by" part - $qb->addGroupBy(self::KEY); + $qb->addSelect(sprintf('IDENTITY(activity.activityType) AS %s', self::KEY)); + + $groupby = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy(self::KEY); + } else { + $qb->groupBy(self::KEY); + } } public function applyOn(): string { - return Declarations::ACTIVITY_PERSON; + return Declarations::ACTIVITY; } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php index 2cbd7ddd8..55c0a1974 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php @@ -11,13 +11,15 @@ declare(strict_types=1); namespace Chill\ActivityBundle\Export\Export\LinkedToACP; +use Chill\ActivityBundle\Entity\Activity; use Chill\ActivityBundle\Export\Declarations; -use Chill\ActivityBundle\Repository\ActivityRepository; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; use Chill\PersonBundle\Export\Declarations as PersonDeclarations; +use Doctrine\ORM\EntityManagerInterface; +use Doctrine\ORM\EntityRepository; use Doctrine\ORM\Query; use LogicException; use Symfony\Component\Form\FormBuilderInterface; @@ -25,12 +27,12 @@ use Symfony\Component\Security\Core\Role\Role; class CountActivity implements ExportInterface, GroupedExportInterface { - protected ActivityRepository $activityRepository; + protected EntityRepository $repository; public function __construct( - ActivityRepository $activityRepository + EntityManagerInterface $em ) { - $this->activityRepository = $activityRepository; + $this->repository = $em->getRepository(Activity::class); } public function buildForm(FormBuilderInterface $builder) @@ -78,17 +80,12 @@ class CountActivity implements ExportInterface, GroupedExportInterface public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { - $centers = array_map(static fn ($el) => $el['center'], $acl); - - $qb = $this - ->activityRepository - ->createQueryBuilder('activity') - ->select('COUNT(activity.id) as export_count_activity'); - - $qb->andWhere( - $qb->expr()->isNotNull('activity.accompanyingPeriod') - ); + $qb = $this->repository->createQueryBuilder('activity') + ->join('activity.accompanyingPeriod', 'acp') + ; + $qb->select('COUNT(activity.id) as export_count_activity'); + return $qb; } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php index 96c79297e..75d3122c3 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php @@ -80,15 +80,16 @@ class CountActivity implements ExportInterface, GroupedExportInterface { $centers = array_map(static fn ($el) => $el['center'], $acl); - $qb = $this - ->activityRepository - ->createQueryBuilder('activity') - ->select('COUNT(activity.id) as export_count_activity') - ->join('activity.person', 'person'); + $qb = $this->activityRepository->createQueryBuilder('activity') + ->join('activity.person', 'person') + ; + + $qb->select('COUNT(activity.id) as export_count_activity'); $qb ->where($qb->expr()->in('person.center', ':centers')) - ->setParameter('centers', $centers); + ->setParameter('centers', $centers) + ; return $qb; } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php index bfd80ecc7..665515cb1 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php @@ -64,37 +64,31 @@ class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInter public function applyOn(): string { - return Declarations::ACTIVITY_PERSON; + return Declarations::ACTIVITY; } public function buildForm(FormBuilderInterface $builder) { - $builder->add( - 'types', - EntityType::class, - [ - 'class' => ActivityType::class, - 'choice_label' => fn (ActivityType $type) => $this->translatableStringHelper->localize($type->getName()), - 'multiple' => true, - 'expanded' => false, - ] - ); + $builder->add('types', EntityType::class, [ + 'class' => ActivityType::class, + 'choice_label' => fn (ActivityType $type) => $this->translatableStringHelper->localize($type->getName()), + 'group_by' => fn (ActivityType $type) => $this->translatableStringHelper->localize($type->getCategory()->getName()), + 'multiple' => true, + 'expanded' => false, + ]); } public function describeAction($data, $format = 'string') { // collect all the reasons'name used in this filter in one array $reasonsNames = array_map( - fn (ActivityType $t): string => '"' . $this->translatableStringHelper->localize($t->getName()) . '"', + fn (ActivityType $t): string => $this->translatableStringHelper->localize($t->getName()), $this->activityTypeRepository->findBy(['id' => $data['types']->toArray()]) ); - return [ - 'Filtered by activity type: only %list%', - [ - '%list%' => implode(', ', $reasonsNames), - ], - ]; + return ['Filtered by activity type: only %list%', [ + '%list%' => implode(', ou ', $reasonsNames), + ]]; } public function getTitle() diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index 82c821f51..7eacba1ce 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -230,7 +230,7 @@ Average activities linked to an accompanying period visit duration by various pa #filters Filter by reason: Filtrer par sujet d'activité 'Filtered by reasons: only %list%': 'Filtré par sujet: seulement %list%' -'Filtered by activity type: only %list%': "Filtré par type d'activité: seulement %list%" +'Filtered by activity type: only %list%': "Filtré par type d'activité: uniquement %list%" Filtered by date activity: Filtrer par date d'activité Activities after this date: Activités après cette date Activities before this date: Activités avant cette date diff --git a/src/Bundle/ChillActivityBundle/translations/messages.nl.yaml b/src/Bundle/ChillActivityBundle/translations/messages.nl.yaml index d24eacf0a..0403e55ee 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.nl.yaml +++ b/src/Bundle/ChillActivityBundle/translations/messages.nl.yaml @@ -195,7 +195,7 @@ Number of activities: Nombre d'activités #filters Filter by reason: Filtrer par sujet d'activité 'Filtered by reasons: only %list%': 'Filtré par sujet: seulement %list%' -'Filtered by activity type: only %list%': "Filtré par type d'activity: seulement %list%" +'Filtered by activity type: only %list%': "Filtré par type d'activity: uniquement %list%" Filtered by date activity: Filtrer par date d'activité Activities after this date: Activités après cette date Activities before this date: Activités avant cette date From 26cd677501bf04c1ad61e3fa142e0c6e55ad3f11 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 17 Aug 2022 16:07:20 +0200 Subject: [PATCH 08/10] exports: activity new indicators works + improve translations --- .../LinkedToACP/AvgActivityDuration.php | 27 +++++++++++++++++-- .../LinkedToACP/AvgActivityVisitDuration.php | 27 +++++++++++++++++-- .../LinkedToACP/SumActivityDuration.php | 27 +++++++++++++++++-- .../LinkedToACP/SumActivityVisitDuration.php | 27 +++++++++++++++++-- .../translations/messages.fr.yml | 8 ++++++ 5 files changed, 108 insertions(+), 8 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php index 327dc9e30..1ae5d1830 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php @@ -2,17 +2,30 @@ namespace Chill\ActivityBundle\Export\Export\LinkedToACP; +use Chill\ActivityBundle\Entity\Activity; use Chill\ActivityBundle\Export\Declarations; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; use Chill\MainBundle\Export\ExportInterface; +use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; use Closure; +use Doctrine\ORM\EntityManagerInterface; +use Doctrine\ORM\EntityRepository; +use Doctrine\ORM\Query; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Role\Role; class AvgActivityDuration implements ExportInterface, GroupedExportInterface { + protected EntityRepository $repository; + + public function __construct( + EntityManagerInterface $em + ) { + $this->repository = $em->getRepository(Activity::class); + } + public function buildForm(FormBuilderInterface $builder) { // TODO: Implement buildForm() method. @@ -35,7 +48,11 @@ class AvgActivityDuration implements ExportInterface, GroupedExportInterface public function getLabels($key, array $values, $data) { - // TODO: Implement getLabels() method. + if ('export_avg_activity_duration' !== $key) { + throw new LogicException("the key {$key} is not used by this export"); + } + + return static fn ($value) => '_header' === $value ? 'Average activities linked to an accompanying period duration' : $value; } public function getQueryKeys($data): array @@ -55,7 +72,13 @@ class AvgActivityDuration implements ExportInterface, GroupedExportInterface public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { - // TODO: Implement initiateQuery() method. + $qb = $this->repository->createQueryBuilder('activity') + ->join('activity.accompanyingPeriod', 'acp') + ; + + $qb->select('AVG(activity.durationTime) as export_avg_activity_duration'); + + return $qb; } public function requiredRole(): Role diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php index 96c7941e9..b03378b16 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php @@ -2,17 +2,30 @@ namespace Chill\ActivityBundle\Export\Export\LinkedToACP; +use Chill\ActivityBundle\Entity\Activity; use Chill\ActivityBundle\Export\Declarations; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; use Chill\MainBundle\Export\ExportInterface; +use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; use Closure; +use Doctrine\ORM\EntityManagerInterface; +use Doctrine\ORM\EntityRepository; +use Doctrine\ORM\Query; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Role\Role; class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterface { + protected EntityRepository $repository; + + public function __construct( + EntityManagerInterface $em + ) { + $this->repository = $em->getRepository(Activity::class); + } + public function buildForm(FormBuilderInterface $builder) { // TODO: Implement buildForm() method. @@ -35,7 +48,11 @@ class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterfac public function getLabels($key, array $values, $data) { - // TODO: Implement getLabels() method. + if ('export_avg_activity_visit_duration' !== $key) { + throw new LogicException("the key {$key} is not used by this export"); + } + + return static fn ($value) => '_header' === $value ? 'Average activities linked to an accompanying period visit duration' : $value; } public function getQueryKeys($data): array @@ -55,7 +72,13 @@ class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterfac public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { - // TODO: Implement initiateQuery() method. + $qb = $this->repository->createQueryBuilder('activity') + ->join('activity.accompanyingPeriod', 'acp') + ; + + $qb->select('AVG(activity.travelTime) as export_avg_activity_visit_duration'); + + return $qb; } public function requiredRole(): Role diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php index 40f8977a3..3ab192702 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php @@ -2,17 +2,30 @@ namespace Chill\ActivityBundle\Export\Export\LinkedToACP; +use Chill\ActivityBundle\Entity\Activity; use Chill\ActivityBundle\Export\Declarations; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; use Chill\MainBundle\Export\ExportInterface; +use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; use Closure; +use Doctrine\ORM\EntityManagerInterface; +use Doctrine\ORM\EntityRepository; +use Doctrine\ORM\Query; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Role\Role; class SumActivityDuration implements ExportInterface, GroupedExportInterface { + protected EntityRepository $repository; + + public function __construct( + EntityManagerInterface $em + ) { + $this->repository = $em->getRepository(Activity::class); + } + public function buildForm(FormBuilderInterface $builder) { // TODO: Implement buildForm() method. @@ -35,7 +48,11 @@ class SumActivityDuration implements ExportInterface, GroupedExportInterface public function getLabels($key, array $values, $data) { - // TODO: Implement getLabels() method. + if ('export_sum_activity_duration' !== $key) { + throw new LogicException("the key {$key} is not used by this export"); + } + + return static fn ($value) => '_header' === $value ? 'Sum activities linked to an accompanying period duration' : $value; } public function getQueryKeys($data): array @@ -55,7 +72,13 @@ class SumActivityDuration implements ExportInterface, GroupedExportInterface public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { - // TODO: Implement initiateQuery() method. + $qb = $this->repository->createQueryBuilder('activity') + ->join('activity.accompanyingPeriod', 'acp') + ; + + $qb->select('SUM(activity.durationTime) as export_sum_activity_duration'); + + return $qb; } public function requiredRole(): Role diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php index 1bbc83a86..452fc4de7 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php @@ -2,17 +2,30 @@ namespace Chill\ActivityBundle\Export\Export\LinkedToACP; +use Chill\ActivityBundle\Entity\Activity; use Chill\ActivityBundle\Export\Declarations; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; use Chill\MainBundle\Export\ExportInterface; +use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; use Closure; +use Doctrine\ORM\EntityManagerInterface; +use Doctrine\ORM\EntityRepository; +use Doctrine\ORM\Query; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Role\Role; class SumActivityVisitDuration implements ExportInterface, GroupedExportInterface { + protected EntityRepository $repository; + + public function __construct( + EntityManagerInterface $em + ) { + $this->repository = $em->getRepository(Activity::class); + } + public function buildForm(FormBuilderInterface $builder) { // TODO: Implement buildForm() method. @@ -35,7 +48,11 @@ class SumActivityVisitDuration implements ExportInterface, GroupedExportInterfac public function getLabels($key, array $values, $data) { - // TODO: Implement getLabels() method. + if ('export_sum_activity_visit_duration' !== $key) { + throw new LogicException("the key {$key} is not used by this export"); + } + + return static fn ($value) => '_header' === $value ? 'Sum activities linked to an accompanying period visit duration' : $value; } public function getQueryKeys($data): array @@ -55,7 +72,13 @@ class SumActivityVisitDuration implements ExportInterface, GroupedExportInterfac public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { - // TODO: Implement initiateQuery() method. + $qb = $this->repository->createQueryBuilder('activity') + ->join('activity.accompanyingPeriod', 'acp') + ; + + $qb->select('SUM(activity.travelTime) as export_sum_activity_visit_duration'); + + return $qb; } public function requiredRole(): Role diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index 7eacba1ce..1d7d61592 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -218,13 +218,21 @@ Exports of activities linked to an accompanying period: Exports des activités l Number of activities linked to an accompanying period: Nombre d'activités liées à un parcours Count activities linked to an accompanying period: Nombre d'activités Count activities linked to an accompanying period by various parameters.: Compte le nombre d'activités enregistrées et liées à un parcours en fonction de différents paramètres. + Sum activity linked to an accompanying period duration: Somme de la durée des activités +Sum activities linked to an accompanying period duration: Somme de la durée des activités liées à un parcours Sum activities linked to an accompanying period duration by various parameters.: Additionne la durée des activités en fonction de différents paramètres. + Sum activity linked to an accompanying period visit duration: Somme de la durée de déplacement des activités +Sum activities linked to an accompanying period visit duration: Somme de la durée de déplacement des activités liées à un parcours Sum activities linked to an accompanying period visit duration by various parameters.: Additionne la durée de déplacement des activités en fonction de différents paramètres. + Average activity linked to an accompanying period duration: Moyenne de la durée des activités +Average activities linked to an accompanying period duration: Moyenne de la durée des activités liées à un parcours Average activities linked to an accompanying period duration by various parameters.: Moyenne de la durée des activités en fonction de différents paramètres. + Average activity linked to an accompanying period visit duration: Moyenne de la durée de déplacement des activités +Average activities linked to an accompanying period visit duration: Moyenne de la durée de déplacement des activités liées à un parcours Average activities linked to an accompanying period visit duration by various parameters.: Moyenne de la durée de déplacement des activités en fonction de différents paramètres. #filters From c199bb55347ad38a59facad5e2376a8de90adc4f Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 17 Aug 2022 16:51:21 +0200 Subject: [PATCH 09/10] exports: activity improve translations --- .../Export/LinkedToPerson/ListActivity.php | 2 +- .../LinkedToPerson/StatActivityDuration.php | 2 +- .../translations/messages.fr.yml | 24 ++++++++----------- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php index 3ded55b56..21a68fb93 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php @@ -183,7 +183,7 @@ class ListActivity implements ListInterface, GroupedExportInterface public function getTitle() { - return 'List activities linked to a person'; + return 'List activity linked to a person'; } public function getType(): string diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php index 94903b282..5fae246f8 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php @@ -73,7 +73,7 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface throw new LogicException(sprintf('The key %s is not used by this export', $key)); } - $header = self::SUM === $this->action ? 'Sum of activities duration' : false; + $header = self::SUM === $this->action ? 'Sum activities linked to a person duration' : false; return static fn (string $value) => '_header' === $value ? $header : $value; } diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index 1d7d61592..f6bfafc41 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -204,42 +204,38 @@ The activity has been successfully removed.: L'activité a été supprimée. # exports Exports of activities linked to a person: Exports des activités liées à une personne - Number of activities linked to a person: Nombre d'activités liées à une personne Count activities linked to a person: Nombre d'activités Count activities linked to a person by various parameters.: Compte le nombre d'activités enregistrées et liées à une personne en fonction de différents paramètres. -Sum activity linked to a person duration: Total de la durée des activités +Sum activity linked to a person duration: Durée des activités +Sum activities linked to a person duration: Durée des activités liés à un usager Sum activities linked to a person duration by various parameters.: Additionne la durée des activités en fonction de différents paramètres. -List activities linked to a person: Liste les activités +List activity linked to a person: Liste les activités +List activities linked to a person: Liste des activités liés à un usager List activities linked to a person description: Crée la liste des activités en fonction de différents paramètres. Exports of activities linked to an accompanying period: Exports des activités liées à un parcours - Number of activities linked to an accompanying period: Nombre d'activités liées à un parcours Count activities linked to an accompanying period: Nombre d'activités Count activities linked to an accompanying period by various parameters.: Compte le nombre d'activités enregistrées et liées à un parcours en fonction de différents paramètres. - Sum activity linked to an accompanying period duration: Somme de la durée des activités Sum activities linked to an accompanying period duration: Somme de la durée des activités liées à un parcours Sum activities linked to an accompanying period duration by various parameters.: Additionne la durée des activités en fonction de différents paramètres. - Sum activity linked to an accompanying period visit duration: Somme de la durée de déplacement des activités Sum activities linked to an accompanying period visit duration: Somme de la durée de déplacement des activités liées à un parcours Sum activities linked to an accompanying period visit duration by various parameters.: Additionne la durée de déplacement des activités en fonction de différents paramètres. - Average activity linked to an accompanying period duration: Moyenne de la durée des activités Average activities linked to an accompanying period duration: Moyenne de la durée des activités liées à un parcours Average activities linked to an accompanying period duration by various parameters.: Moyenne de la durée des activités en fonction de différents paramètres. - Average activity linked to an accompanying period visit duration: Moyenne de la durée de déplacement des activités Average activities linked to an accompanying period visit duration: Moyenne de la durée de déplacement des activités liées à un parcours Average activities linked to an accompanying period visit duration by various parameters.: Moyenne de la durée de déplacement des activités en fonction de différents paramètres. #filters -Filter by reason: Filtrer par sujet d'activité +Filter by reason: Filtrer les activités par sujet 'Filtered by reasons: only %list%': 'Filtré par sujet: seulement %list%' 'Filtered by activity type: only %list%': "Filtré par type d'activité: uniquement %list%" -Filtered by date activity: Filtrer par date d'activité +Filtered by date activity: Filtrer les activités par date Activities after this date: Activités après cette date Activities before this date: Activités avant cette date "Filtered by date of activity: only between %date_from% and %date_to%": "Filtré par date de l'activité: uniquement entre %date_from% et %date_to%" @@ -251,7 +247,7 @@ Implied in an activity before this date: Impliqué dans une activité avant cett Filtered by person having an activity between %date_from% and %date_to% with reasons %reasons_name%: Filtré par personnes associées à une activité entre %date_from% et %date_to% avec les sujets %reasons_name% Activity reasons for those activities: Sujets de ces activités -Filter by activity type: Filtrer par type d'activité +Filter by activity type: Filtrer les activités par type #aggregators Activity type: Type d'activité @@ -260,9 +256,9 @@ By reason: Par sujet By category of reason: Par catégorie de sujet Reason's level: Niveau du sujet Group by reasons: Sujet d'activité -Aggregate by activity user: Grouper par utilisateur lié à l'activité -Aggregate by activity type: Grouper par type d'activité -Aggregate by activity reason: Grouper par sujet de l'activité +Aggregate by activity user: Grouper les activités par utilisateur +Aggregate by activity type: Grouper les activités par type +Aggregate by activity reason: Grouper les activités par sujet Last activities: Les dernières activités From d04d758f27a3457edf178ad8e06965d367f39fa9 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 17 Aug 2022 17:14:24 +0200 Subject: [PATCH 10/10] exports: activityDate filter enable to activity linked to acl --- .../Export/Filter/ActivityDateFilter.php | 29 +++++-------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php index 977fa2f9e..4b20553af 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php @@ -13,11 +13,11 @@ namespace Chill\ActivityBundle\Export\Filter; use Chill\ActivityBundle\Export\Declarations; use Chill\MainBundle\Export\FilterInterface; +use Chill\MainBundle\Form\Type\ChillDateType; use Chill\MainBundle\Form\Type\Export\FilterType; use DateTime; use Doctrine\ORM\Query\Expr; use Doctrine\ORM\QueryBuilder; -use Symfony\Component\Form\Extension\Core\Type\DateType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormError; use Symfony\Component\Form\FormEvent; @@ -60,34 +60,21 @@ class ActivityDateFilter implements FilterInterface public function applyOn(): string { - return Declarations::ACTIVITY_PERSON; + return Declarations::ACTIVITY; } public function buildForm(FormBuilderInterface $builder) { - $builder->add( - 'date_from', - DateType::class, - [ + $builder + ->add('date_from', ChillDateType::class, [ 'label' => 'Activities after this date', 'data' => new DateTime(), - 'attr' => ['class' => 'datepicker'], - 'widget' => 'single_text', - 'format' => 'dd-MM-yyyy', - ] - ); - - $builder->add( - 'date_to', - DateType::class, - [ + ]) + ->add('date_to', ChillDateType::class, [ 'label' => 'Activities before this date', 'data' => new DateTime(), - 'attr' => ['class' => 'datepicker'], - 'widget' => 'single_text', - 'format' => 'dd-MM-yyyy', - ] - ); + ]) + ; $builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) { /** @var \Symfony\Component\Form\FormInterface $filterForm */