mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
merge exports branch into calendar branch
This commit is contained in:
@@ -22,6 +22,7 @@ use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
|
||||
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
||||
use Chill\MainBundle\Repository\LocationRepository;
|
||||
use Chill\MainBundle\Repository\UserRepositoryInterface;
|
||||
use Chill\MainBundle\Security\Resolver\CenterResolverManagerInterface;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Privacy\PrivacyEvent;
|
||||
@@ -41,7 +42,6 @@ use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
use function array_key_exists;
|
||||
|
||||
@@ -57,6 +57,8 @@ final class ActivityController extends AbstractController
|
||||
|
||||
private ActivityTypeRepository $activityTypeRepository;
|
||||
|
||||
private CenterResolverManagerInterface $centerResolver;
|
||||
|
||||
private EntityManagerInterface $entityManager;
|
||||
|
||||
private EventDispatcherInterface $eventDispatcher;
|
||||
@@ -86,7 +88,9 @@ final class ActivityController extends AbstractController
|
||||
EventDispatcherInterface $eventDispatcher,
|
||||
LoggerInterface $logger,
|
||||
SerializerInterface $serializer,
|
||||
UserRepositoryInterface $userRepository
|
||||
UserRepositoryInterface $userRepository,
|
||||
CenterResolverManagerInterface $centerResolver
|
||||
|
||||
) {
|
||||
$this->activityACLAwareRepository = $activityACLAwareRepository;
|
||||
$this->activityTypeRepository = $activityTypeRepository;
|
||||
@@ -101,6 +105,8 @@ final class ActivityController extends AbstractController
|
||||
$this->logger = $logger;
|
||||
$this->serializer = $serializer;
|
||||
$this->userRepository = $userRepository;
|
||||
$this->centerResolver = $centerResolver;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -203,7 +209,7 @@ final class ActivityController extends AbstractController
|
||||
// $this->denyAccessUnlessGranted('CHILL_ACTIVITY_UPDATE', $entity);
|
||||
|
||||
$form = $this->createForm(ActivityType::class, $entity, [
|
||||
'center' => $entity->getCenter(),
|
||||
'center' => $this->centerResolver->resolveCenters($entity)[0] ?? null,
|
||||
'role' => new Role('CHILL_ACTIVITY_UPDATE'),
|
||||
'activityType' => $entity->getActivityType(),
|
||||
'accompanyingPeriod' => $accompanyingPeriod,
|
||||
@@ -431,7 +437,7 @@ final class ActivityController extends AbstractController
|
||||
$this->denyAccessUnlessGranted(ActivityVoter::CREATE, $entity);
|
||||
|
||||
$form = $this->createForm(ActivityType::class, $entity, [
|
||||
'center' => $entity->getCenter(),
|
||||
'center' => $this->centerResolver->resolveCenters($entity)[0] ?? null,
|
||||
'role' => new Role('CHILL_ACTIVITY_CREATE'),
|
||||
'activityType' => $entity->getActivityType(),
|
||||
'accompanyingPeriod' => $accompanyingPeriod,
|
||||
|
@@ -61,8 +61,6 @@ class ChillActivityExtension extends Extension implements PrependExtensionInterf
|
||||
ActivityVoter::DELETE => [ActivityVoter::SEE_DETAILS],
|
||||
ActivityVoter::SEE_DETAILS => [ActivityVoter::SEE],
|
||||
ActivityVoter::FULL => [
|
||||
ActivityVoter::CREATE_PERSON,
|
||||
ActivityVoter::CREATE_ACCOMPANYING_COURSE,
|
||||
ActivityVoter::DELETE,
|
||||
ActivityVoter::UPDATE,
|
||||
],
|
||||
|
@@ -16,8 +16,8 @@ use Chill\DocStoreBundle\Entity\StoredObject;
|
||||
use Chill\MainBundle\Entity\Center;
|
||||
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
|
||||
use Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable;
|
||||
use Chill\MainBundle\Entity\HasCenterInterface;
|
||||
use Chill\MainBundle\Entity\HasScopeInterface;
|
||||
use Chill\MainBundle\Entity\HasCentersInterface;
|
||||
use Chill\MainBundle\Entity\HasScopesInterface;
|
||||
use Chill\MainBundle\Entity\Location;
|
||||
use Chill\MainBundle\Entity\Scope;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
@@ -55,7 +55,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
||||
* getUserFunction="getUser",
|
||||
* path="scope")
|
||||
*/
|
||||
class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterface, HasCenterInterface, HasScopeInterface
|
||||
class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterface, HasCentersInterface, HasScopesInterface
|
||||
{
|
||||
public const SENTRECEIVED_RECEIVED = 'received';
|
||||
|
||||
@@ -306,13 +306,17 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
||||
* get the center
|
||||
* center is extracted from person.
|
||||
*/
|
||||
public function getCenter(): ?Center
|
||||
public function getCenters(): iterable
|
||||
{
|
||||
if ($this->person instanceof Person) {
|
||||
return $this->person->getCenter();
|
||||
return [$this->person->getCenter()];
|
||||
}
|
||||
|
||||
return null;
|
||||
if ($this->getAccompanyingPeriod() instanceof AccompanyingPeriod) {
|
||||
return $this->getAccompanyingPeriod()->getCenters() ?? [];
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getComment(): CommentEmbeddable
|
||||
@@ -422,6 +426,19 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
||||
return $this->scope;
|
||||
}
|
||||
|
||||
public function getScopes(): iterable
|
||||
{
|
||||
if (null !== $this->getAccompanyingPeriod()) {
|
||||
return $this->getAccompanyingPeriod()->getScopes();
|
||||
}
|
||||
|
||||
if (null !== $this->getPerson()) {
|
||||
return [$this->scope];
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getSentReceived(): string
|
||||
{
|
||||
return $this->sentReceived;
|
||||
|
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Aggregator\ACPAggregators;
|
||||
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\PersonBundle\Repository\SocialWork\SocialActionRepository;
|
||||
use Chill\PersonBundle\Templating\Entity\SocialActionRender;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use function in_array;
|
||||
|
||||
class BySocialActionAggregator implements AggregatorInterface
|
||||
{
|
||||
private SocialActionRender $actionRender;
|
||||
|
||||
private SocialActionRepository $actionRepository;
|
||||
|
||||
public function __construct(
|
||||
SocialActionRender $actionRender,
|
||||
SocialActionRepository $actionRepository
|
||||
) {
|
||||
$this->actionRender = $actionRender;
|
||||
$this->actionRepository = $actionRepository;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('socialaction', $qb->getAllAliases(), true)) {
|
||||
$qb->join('activity.socialActions', 'socialaction');
|
||||
}
|
||||
|
||||
$qb->addSelect('socialaction.id AS socialaction_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('socialaction_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('socialaction_aggregator');
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ACTIVITY_ACP;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
// no form
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
return function ($value) {
|
||||
if ('_header' === $value) {
|
||||
return 'Social action';
|
||||
}
|
||||
|
||||
$sa = $this->actionRepository->find($value);
|
||||
|
||||
return $this->actionRender->renderString($sa, []);
|
||||
};
|
||||
}
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return ['socialaction_aggregator'];
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Group activity by linked socialaction';
|
||||
}
|
||||
}
|
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Aggregator\ACPAggregators;
|
||||
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository;
|
||||
use Chill\PersonBundle\Templating\Entity\SocialIssueRender;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use function in_array;
|
||||
|
||||
class BySocialIssueAggregator implements AggregatorInterface
|
||||
{
|
||||
private SocialIssueRender $issueRender;
|
||||
|
||||
private SocialIssueRepository $issueRepository;
|
||||
|
||||
public function __construct(
|
||||
SocialIssueRepository $issueRepository,
|
||||
SocialIssueRender $issueRender
|
||||
) {
|
||||
$this->issueRepository = $issueRepository;
|
||||
$this->issueRender = $issueRender;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('socialissue', $qb->getAllAliases(), true)) {
|
||||
$qb->join('activity.socialIssues', 'socialissue');
|
||||
}
|
||||
|
||||
$qb->addSelect('socialissue.id AS socialissue_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('socialissue_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('socialissue_aggregator');
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ACTIVITY_ACP;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
// no form
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
return function ($value): string {
|
||||
if ('_header' === $value) {
|
||||
return 'Social issues';
|
||||
}
|
||||
|
||||
$i = $this->issueRepository->find($value);
|
||||
|
||||
return $this->issueRender->renderString($i, []);
|
||||
};
|
||||
}
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return ['socialissue_aggregator'];
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Group activity by linked socialissue';
|
||||
}
|
||||
}
|
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Aggregator\ACPAggregators;
|
||||
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\ThirdPartyBundle\Repository\ThirdPartyRepository;
|
||||
use Chill\ThirdPartyBundle\Templating\Entity\ThirdPartyRender;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use function in_array;
|
||||
|
||||
class ByThirdpartyAggregator implements AggregatorInterface
|
||||
{
|
||||
private ThirdPartyRender $thirdPartyRender;
|
||||
|
||||
private ThirdPartyRepository $thirdPartyRepository;
|
||||
|
||||
public function __construct(
|
||||
ThirdPartyRepository $thirdPartyRepository,
|
||||
ThirdPartyRender $thirdPartyRender
|
||||
) {
|
||||
$this->thirdPartyRepository = $thirdPartyRepository;
|
||||
$this->thirdPartyRender = $thirdPartyRender;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('thirdparty', $qb->getAllAliases(), true)) {
|
||||
$qb->join('activity.thirdParties', 'thirdparty');
|
||||
}
|
||||
|
||||
$qb->addSelect('thirdparty.id AS thirdparty_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('thirdparty_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('thirdparty_aggregator');
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ACTIVITY_ACP;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
// no form
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
return function ($value): string {
|
||||
if ('_header' === $value) {
|
||||
return 'Accepted thirdparty';
|
||||
}
|
||||
|
||||
$tp = $this->thirdPartyRepository->find($value);
|
||||
|
||||
return $this->thirdPartyRender->renderString($tp, []);
|
||||
};
|
||||
}
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return ['thirdparty_aggregator'];
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Group activity by linked thirdparties';
|
||||
}
|
||||
}
|
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Aggregator\ACPAggregators;
|
||||
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\MainBundle\Repository\UserRepository;
|
||||
use Chill\MainBundle\Templating\Entity\UserRender;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use function in_array;
|
||||
|
||||
class ByUserAggregator implements AggregatorInterface
|
||||
{
|
||||
private UserRender $userRender;
|
||||
|
||||
private UserRepository $userRepository;
|
||||
|
||||
public function __construct(
|
||||
UserRepository $userRepository,
|
||||
UserRender $userRender
|
||||
) {
|
||||
$this->userRepository = $userRepository;
|
||||
$this->userRender = $userRender;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('user', $qb->getAllAliases(), true)) {
|
||||
$qb->join('activity.users', 'user');
|
||||
}
|
||||
|
||||
$qb->addSelect('user.id AS users_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('users_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('users_aggregator');
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ACTIVITY_ACP;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
// no form
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
return function ($value): string {
|
||||
if ('_header' === $value) {
|
||||
return 'Accepted users';
|
||||
}
|
||||
|
||||
$u = $this->userRepository->find($value);
|
||||
|
||||
return $this->userRender->renderString($u, []);
|
||||
};
|
||||
}
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return ['users_aggregator'];
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Group activity by linked users';
|
||||
}
|
||||
}
|
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Aggregator\ACPAggregators;
|
||||
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use RuntimeException;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class DateAggregator implements AggregatorInterface
|
||||
{
|
||||
private const CHOICES = [
|
||||
'by month' => 'month',
|
||||
'by week' => 'week',
|
||||
'by year' => 'year',
|
||||
];
|
||||
|
||||
private const DEFAULT_CHOICE = 'year';
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$order = null;
|
||||
|
||||
switch ($data['frequency']) {
|
||||
case 'month':
|
||||
$fmt = 'MM';
|
||||
|
||||
break;
|
||||
|
||||
case 'week':
|
||||
$fmt = 'IW';
|
||||
|
||||
break;
|
||||
|
||||
case 'year':
|
||||
$fmt = 'YYYY'; $order = 'DESC';
|
||||
|
||||
break; // order DESC does not works !
|
||||
|
||||
default:
|
||||
throw new RuntimeException(sprintf("The frequency data '%s' is invalid.", $data['frequency']));
|
||||
}
|
||||
|
||||
$qb->addSelect(sprintf("TO_CHAR(activity.date, '%s') AS date_aggregator", $fmt));
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('date_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('date_aggregator');
|
||||
}
|
||||
|
||||
$orderBy = $qb->getDQLPart('orderBy');
|
||||
|
||||
if (!empty($orderBy)) {
|
||||
$qb->addOrderBy('date_aggregator', $order);
|
||||
} else {
|
||||
$qb->orderBy('date_aggregator', $order);
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ACTIVITY_ACP;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder->add('frequency', ChoiceType::class, [
|
||||
'choices' => self::CHOICES,
|
||||
'multiple' => false,
|
||||
'expanded' => true,
|
||||
'empty_data' => self::DEFAULT_CHOICE,
|
||||
'data' => self::DEFAULT_CHOICE,
|
||||
]);
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
return static function ($value) use ($data): string {
|
||||
if ('_header' === $value) {
|
||||
return 'by ' . $data['frequency'];
|
||||
}
|
||||
|
||||
switch ($data['frequency']) {
|
||||
case 'month':
|
||||
$month = DateTime::createFromFormat('!m', $value);
|
||||
|
||||
return sprintf(
|
||||
'%02d (%s)',
|
||||
$value,
|
||||
$month->format('M')
|
||||
);
|
||||
|
||||
case 'week':
|
||||
//return $this->translator->trans('for week') .' '. $value ;
|
||||
|
||||
case 'year':
|
||||
//return $this->translator->trans('in year') .' '. $value ;
|
||||
|
||||
default:
|
||||
return $value;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return ['date_aggregator'];
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Group activity by date';
|
||||
}
|
||||
}
|
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Aggregator\ACPAggregators;
|
||||
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\MainBundle\Repository\LocationTypeRepository;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use function in_array;
|
||||
|
||||
class LocationTypeAggregator implements AggregatorInterface
|
||||
{
|
||||
private LocationTypeRepository $locationTypeRepository;
|
||||
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
LocationTypeRepository $locationTypeRepository,
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
) {
|
||||
$this->locationTypeRepository = $locationTypeRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('location', $qb->getAllAliases(), true)) {
|
||||
$qb->join('activity.location', 'location');
|
||||
}
|
||||
|
||||
$qb->addSelect('IDENTITY(location.locationType) AS locationtype_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('locationtype_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('locationtype_aggregator');
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ACTIVITY_ACP;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
// no form
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
return function ($value): string {
|
||||
if ('_header' === $value) {
|
||||
return 'Accepted locationtype';
|
||||
}
|
||||
|
||||
$lt = $this->locationTypeRepository->find($value);
|
||||
|
||||
return $this->translatableStringHelper->localize(
|
||||
$lt->getTitle()
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return ['locationtype_aggregator'];
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Group activity by locationtype';
|
||||
}
|
||||
}
|
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Aggregator\ACPAggregators;
|
||||
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\MainBundle\Repository\ScopeRepository;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use function in_array;
|
||||
|
||||
class UserScopeAggregator implements AggregatorInterface
|
||||
{
|
||||
private ScopeRepository $scopeRepository;
|
||||
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(
|
||||
ScopeRepository $scopeRepository,
|
||||
TranslatableStringHelper $translatableStringHelper
|
||||
) {
|
||||
$this->scopeRepository = $scopeRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('user', $qb->getAllAliases(), true)) {
|
||||
$qb->join('activity.user', 'user');
|
||||
}
|
||||
|
||||
$qb->addSelect('IDENTITY(user.mainScope) AS userscope_aggregator');
|
||||
|
||||
$groupBy = $qb->getDQLPart('groupBy');
|
||||
|
||||
if (!empty($groupBy)) {
|
||||
$qb->addGroupBy('userscope_aggregator');
|
||||
} else {
|
||||
$qb->groupBy('userscope_aggregator');
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ACTIVITY_ACP;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
// no form
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
return function ($value): string {
|
||||
if ('_header' === $value) {
|
||||
return 'Scope';
|
||||
}
|
||||
|
||||
$s = $this->scopeRepository->find($value);
|
||||
|
||||
return $this->translatableStringHelper->localize(
|
||||
$s->getName()
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
{
|
||||
return ['userscope_aggregator'];
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Group activity by userscope';
|
||||
}
|
||||
}
|
@@ -11,15 +11,15 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Aggregator;
|
||||
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\ActivityBundle\Repository\ActivityTypeRepository;
|
||||
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Closure;
|
||||
use Doctrine\ORM\Query\Expr\Join;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use function in_array;
|
||||
|
||||
class ActivityTypeAggregator implements AggregatorInterface
|
||||
{
|
||||
@@ -37,23 +37,31 @@ class ActivityTypeAggregator implements AggregatorInterface
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
public function addRole()
|
||||
public function addRole(): ?string
|
||||
{
|
||||
return new Role(ActivityStatsVoter::STATS);
|
||||
return null;
|
||||
}
|
||||
|
||||
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(), true)) {
|
||||
$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()
|
||||
public function applyOn(): string
|
||||
{
|
||||
return 'activity';
|
||||
return Declarations::ACTIVITY;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
|
@@ -11,29 +11,33 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Aggregator;
|
||||
|
||||
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\MainBundle\Repository\UserRepository;
|
||||
use Chill\MainBundle\Templating\Entity\UserRender;
|
||||
use Closure;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
|
||||
class ActivityUserAggregator implements AggregatorInterface
|
||||
{
|
||||
public const KEY = 'activity_user_id';
|
||||
|
||||
private UserRender $userRender;
|
||||
|
||||
private UserRepository $userRepository;
|
||||
|
||||
public function __construct(
|
||||
UserRepository $userRepository
|
||||
UserRepository $userRepository,
|
||||
UserRender $userRender
|
||||
) {
|
||||
$this->userRepository = $userRepository;
|
||||
$this->userRender = $userRender;
|
||||
}
|
||||
|
||||
public function addRole()
|
||||
public function addRole(): ?string
|
||||
{
|
||||
return new Role(ActivityStatsVoter::STATS);
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
@@ -47,7 +51,7 @@ class ActivityUserAggregator implements AggregatorInterface
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return 'activity';
|
||||
return Declarations::ACTIVITY;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
@@ -62,10 +66,12 @@ class ActivityUserAggregator implements AggregatorInterface
|
||||
|
||||
return function ($value) {
|
||||
if ('_header' === $value) {
|
||||
return 'activity user';
|
||||
return 'Activity user';
|
||||
}
|
||||
|
||||
return $this->userRepository->find($value)->getUsername();
|
||||
$u = $this->userRepository->find($value);
|
||||
|
||||
return $this->userRender->renderString($u, []);
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -9,11 +9,11 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Aggregator;
|
||||
namespace Chill\ActivityBundle\Export\Aggregator\PersonAggregators;
|
||||
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\ActivityBundle\Repository\ActivityReasonCategoryRepository;
|
||||
use Chill\ActivityBundle\Repository\ActivityReasonRepository;
|
||||
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
||||
use Chill\MainBundle\Export\AggregatorInterface;
|
||||
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
@@ -23,7 +23,6 @@ use Doctrine\ORM\QueryBuilder;
|
||||
use RuntimeException;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
use function array_key_exists;
|
||||
@@ -47,9 +46,9 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
public function addRole()
|
||||
public function addRole(): ?string
|
||||
{
|
||||
return new Role(ActivityStatsVoter::STATS);
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
@@ -104,9 +103,9 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali
|
||||
}
|
||||
}
|
||||
|
||||
public function applyOn()
|
||||
public function applyOn(): string
|
||||
{
|
||||
return 'activity';
|
||||
return Declarations::ACTIVITY_PERSON;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
24
src/Bundle/ChillActivityBundle/Export/Declarations.php
Normal file
24
src/Bundle/ChillActivityBundle/Export/Declarations.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export;
|
||||
|
||||
/**
|
||||
* This class declare constants used for the export framework.
|
||||
*/
|
||||
abstract class Declarations
|
||||
{
|
||||
public const ACTIVITY = 'activity';
|
||||
|
||||
public const ACTIVITY_ACP = 'activity_linked_to_acp';
|
||||
|
||||
public const ACTIVITY_PERSON = 'activity_linked_to_person';
|
||||
}
|
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
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 Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\Query;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
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.
|
||||
}
|
||||
|
||||
public function getAllowedFormattersTypes(): array
|
||||
{
|
||||
return [FormatterInterface::TYPE_TABULAR];
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Average activities linked to an accompanying period duration by various parameters.';
|
||||
}
|
||||
|
||||
public function getGroup(): string
|
||||
{
|
||||
return 'Exports of activities linked to an accompanying period';
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
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
|
||||
{
|
||||
return ['export_avg_activity_duration'];
|
||||
}
|
||||
|
||||
public function getResult($qb, $data)
|
||||
{
|
||||
return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Average activity linked to an accompanying period duration';
|
||||
}
|
||||
|
||||
public function getType(): string
|
||||
{
|
||||
return Declarations::ACTIVITY;
|
||||
}
|
||||
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
||||
{
|
||||
$qb = $this->repository->createQueryBuilder('activity')
|
||||
->join('activity.accompanyingPeriod', 'acp');
|
||||
|
||||
$qb->select('AVG(activity.durationTime) as export_avg_activity_duration');
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
||||
public function requiredRole(): string
|
||||
{
|
||||
return ActivityStatsVoter::STATS;
|
||||
}
|
||||
|
||||
public function supportsModifiers(): array
|
||||
{
|
||||
return [
|
||||
Declarations::ACTIVITY,
|
||||
Declarations::ACTIVITY_ACP,
|
||||
//PersonDeclarations::ACP_TYPE,
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
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 Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\Query;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
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.
|
||||
}
|
||||
|
||||
public function getAllowedFormattersTypes(): array
|
||||
{
|
||||
return [FormatterInterface::TYPE_TABULAR];
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Average activities linked to an accompanying period visit duration by various parameters.';
|
||||
}
|
||||
|
||||
public function getGroup(): string
|
||||
{
|
||||
return 'Exports of activities linked to an accompanying period';
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
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
|
||||
{
|
||||
return ['export_avg_activity_visit_duration'];
|
||||
}
|
||||
|
||||
public function getResult($qb, $data)
|
||||
{
|
||||
return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Average activity linked to an accompanying period visit duration';
|
||||
}
|
||||
|
||||
public function getType(): string
|
||||
{
|
||||
return Declarations::ACTIVITY;
|
||||
}
|
||||
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
||||
{
|
||||
$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(): string
|
||||
{
|
||||
return ActivityStatsVoter::STATS;
|
||||
}
|
||||
|
||||
public function supportsModifiers(): array
|
||||
{
|
||||
return [
|
||||
Declarations::ACTIVITY,
|
||||
Declarations::ACTIVITY_ACP,
|
||||
//PersonDeclarations::ACP_TYPE,
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
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 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;
|
||||
|
||||
class CountActivity implements ExportInterface, GroupedExportInterface
|
||||
{
|
||||
protected EntityRepository $repository;
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em
|
||||
) {
|
||||
$this->repository = $em->getRepository(Activity::class);
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
}
|
||||
|
||||
public function getAllowedFormattersTypes(): array
|
||||
{
|
||||
return [FormatterInterface::TYPE_TABULAR];
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Count activities linked to an accompanying period by various parameters.';
|
||||
}
|
||||
|
||||
public function getGroup(): string
|
||||
{
|
||||
return 'Exports of activities linked to an accompanying period';
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
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): array
|
||||
{
|
||||
return ['export_count_activity'];
|
||||
}
|
||||
|
||||
public function getResult($qb, $data)
|
||||
{
|
||||
return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Count activities linked to an accompanying period';
|
||||
}
|
||||
|
||||
public function getType(): string
|
||||
{
|
||||
return Declarations::ACTIVITY;
|
||||
}
|
||||
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
||||
{
|
||||
$qb = $this->repository->createQueryBuilder('activity')
|
||||
->join('activity.accompanyingPeriod', 'acp');
|
||||
|
||||
$qb->select('COUNT(activity.id) as export_count_activity');
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
||||
public function requiredRole(): string
|
||||
{
|
||||
return ActivityStatsVoter::STATS;
|
||||
}
|
||||
|
||||
public function supportsModifiers(): array
|
||||
{
|
||||
return [
|
||||
Declarations::ACTIVITY,
|
||||
Declarations::ACTIVITY_ACP,
|
||||
//PersonDeclarations::ACP_TYPE,
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
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 Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\Query;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
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.
|
||||
}
|
||||
|
||||
public function getAllowedFormattersTypes(): array
|
||||
{
|
||||
return [FormatterInterface::TYPE_TABULAR];
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Sum activities linked to an accompanying period duration by various parameters.';
|
||||
}
|
||||
|
||||
public function getGroup(): string
|
||||
{
|
||||
return 'Exports of activities linked to an accompanying period';
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
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
|
||||
{
|
||||
return ['export_sum_activity_duration'];
|
||||
}
|
||||
|
||||
public function getResult($qb, $data)
|
||||
{
|
||||
return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Sum activity linked to an accompanying period duration';
|
||||
}
|
||||
|
||||
public function getType(): string
|
||||
{
|
||||
return Declarations::ACTIVITY;
|
||||
}
|
||||
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
||||
{
|
||||
$qb = $this->repository->createQueryBuilder('activity')
|
||||
->join('activity.accompanyingPeriod', 'acp');
|
||||
|
||||
$qb->select('SUM(activity.durationTime) as export_sum_activity_duration');
|
||||
|
||||
return $qb;
|
||||
}
|
||||
|
||||
public function requiredRole(): string
|
||||
{
|
||||
return ActivityStatsVoter::STATS;
|
||||
}
|
||||
|
||||
public function supportsModifiers(): array
|
||||
{
|
||||
return [
|
||||
Declarations::ACTIVITY,
|
||||
Declarations::ACTIVITY_ACP,
|
||||
//PersonDeclarations::ACP_TYPE,
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
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 Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\Query;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
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.
|
||||
}
|
||||
|
||||
public function getAllowedFormattersTypes(): array
|
||||
{
|
||||
return [FormatterInterface::TYPE_TABULAR];
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Sum activities linked to an accompanying period visit duration by various parameters.';
|
||||
}
|
||||
|
||||
public function getGroup(): string
|
||||
{
|
||||
return 'Exports of activities linked to an accompanying period';
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
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
|
||||
{
|
||||
return ['export_sum_activity_visit_duration'];
|
||||
}
|
||||
|
||||
public function getResult($qb, $data)
|
||||
{
|
||||
return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR);
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Sum activity linked to an accompanying period visit duration';
|
||||
}
|
||||
|
||||
public function getType(): string
|
||||
{
|
||||
return Declarations::ACTIVITY;
|
||||
}
|
||||
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
||||
{
|
||||
$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(): string
|
||||
{
|
||||
return ActivityStatsVoter::STATS;
|
||||
}
|
||||
|
||||
public function supportsModifiers(): array
|
||||
{
|
||||
return [
|
||||
Declarations::ACTIVITY,
|
||||
Declarations::ACTIVITY_ACP,
|
||||
//PersonDeclarations::ACP_TYPE,
|
||||
];
|
||||
}
|
||||
}
|
@@ -9,18 +9,20 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Export;
|
||||
namespace Chill\ActivityBundle\Export\Export\LinkedToPerson;
|
||||
|
||||
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\Query;
|
||||
use LogicException;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
|
||||
class CountActivity implements ExportInterface
|
||||
class CountActivity implements ExportInterface, GroupedExportInterface
|
||||
{
|
||||
protected ActivityRepository $activityRepository;
|
||||
|
||||
@@ -41,7 +43,12 @@ class CountActivity implements ExportInterface
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
return 'Count activities by various parameters.';
|
||||
return 'Count activities linked to a person by various parameters.';
|
||||
}
|
||||
|
||||
public function getGroup(): string
|
||||
{
|
||||
return 'Exports of activities linked to a person';
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
@@ -50,7 +57,7 @@ class CountActivity implements ExportInterface
|
||||
throw new LogicException("the key {$key} is not used by this export");
|
||||
}
|
||||
|
||||
return static fn ($value) => '_header' === $value ? 'Number of activities' : $value;
|
||||
return static fn ($value) => '_header' === $value ? 'Number of activities linked to a person' : $value;
|
||||
}
|
||||
|
||||
public function getQueryKeys($data)
|
||||
@@ -65,24 +72,23 @@ class CountActivity implements ExportInterface
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
return 'Count activities';
|
||||
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 = [])
|
||||
{
|
||||
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
||||
|
||||
$qb = $this
|
||||
->activityRepository
|
||||
->createQueryBuilder('activity')
|
||||
->select('COUNT(activity.id) as export_count_activity')
|
||||
$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);
|
||||
@@ -90,13 +96,17 @@ class CountActivity implements ExportInterface
|
||||
return $qb;
|
||||
}
|
||||
|
||||
public function requiredRole()
|
||||
public function requiredRole(): string
|
||||
{
|
||||
return new Role(ActivityStatsVoter::STATS);
|
||||
return ActivityStatsVoter::STATS;
|
||||
}
|
||||
|
||||
public function supportsModifiers()
|
||||
{
|
||||
return ['person', 'activity'];
|
||||
return [
|
||||
Declarations::ACTIVITY,
|
||||
Declarations::ACTIVITY_PERSON,
|
||||
//PersonDeclarations::PERSON_TYPE,
|
||||
];
|
||||
}
|
||||
}
|
@@ -9,21 +9,23 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Export;
|
||||
namespace Chill\ActivityBundle\Export\Export\LinkedToPerson;
|
||||
|
||||
use Chill\ActivityBundle\Entity\ActivityReason;
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\ActivityBundle\Repository\ActivityRepository;
|
||||
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
||||
use Chill\MainBundle\Export\FormatterInterface;
|
||||
use Chill\MainBundle\Export\GroupedExportInterface;
|
||||
use Chill\MainBundle\Export\ListInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Chill\PersonBundle\Export\Declarations as PersonDeclarations;
|
||||
use DateTime;
|
||||
use Doctrine\DBAL\Exception\InvalidArgumentException;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Query;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Symfony\Component\Validator\Constraints\Callback;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
@@ -32,7 +34,7 @@ use function array_key_exists;
|
||||
use function count;
|
||||
use function in_array;
|
||||
|
||||
class ListActivity implements ListInterface
|
||||
class ListActivity implements ListInterface, GroupedExportInterface
|
||||
{
|
||||
protected EntityManagerInterface $entityManager;
|
||||
|
||||
@@ -94,7 +96,12 @@ class ListActivity implements ListInterface
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
return 'List activities';
|
||||
return 'List activities linked to a person description';
|
||||
}
|
||||
|
||||
public function getGroup(): string
|
||||
{
|
||||
return 'Exports of activities linked to a person';
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
@@ -180,12 +187,12 @@ class ListActivity implements ListInterface
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
return 'List activities';
|
||||
return 'List activity 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 = [])
|
||||
@@ -267,13 +274,17 @@ class ListActivity implements ListInterface
|
||||
return $qb;
|
||||
}
|
||||
|
||||
public function requiredRole()
|
||||
public function requiredRole(): string
|
||||
{
|
||||
return new Role(ActivityStatsVoter::LISTS);
|
||||
return ActivityStatsVoter::LISTS;
|
||||
}
|
||||
|
||||
public function supportsModifiers()
|
||||
{
|
||||
return ['activity', 'person'];
|
||||
return [
|
||||
Declarations::ACTIVITY,
|
||||
Declarations::ACTIVITY_PERSON,
|
||||
//PersonDeclarations::PERSON_TYPE,
|
||||
];
|
||||
}
|
||||
}
|
@@ -9,23 +9,26 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Export;
|
||||
namespace Chill\ActivityBundle\Export\Export\LinkedToPerson;
|
||||
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\ActivityBundle\Repository\ActivityRepository;
|
||||
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
||||
use Chill\MainBundle\Entity\Center;
|
||||
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\Query;
|
||||
use LogicException;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
|
||||
/**
|
||||
* This export allow to compute stats on activity duration.
|
||||
*
|
||||
* The desired stat must be given in constructor.
|
||||
*/
|
||||
class StatActivityDuration implements ExportInterface
|
||||
class StatActivityDuration implements ExportInterface, GroupedExportInterface
|
||||
{
|
||||
public const SUM = 'sum';
|
||||
|
||||
@@ -59,17 +62,22 @@ class StatActivityDuration implements ExportInterface
|
||||
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.';
|
||||
}
|
||||
}
|
||||
|
||||
public function getGroup(): string
|
||||
{
|
||||
return 'Exports of activities linked to a person';
|
||||
}
|
||||
|
||||
public function getLabels($key, array $values, $data)
|
||||
{
|
||||
if ('export_stat_activity' !== $key) {
|
||||
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;
|
||||
}
|
||||
@@ -87,19 +95,19 @@ class StatActivityDuration implements ExportInterface
|
||||
public function getTitle()
|
||||
{
|
||||
if (self::SUM === $this->action) {
|
||||
return 'Sum activity duration';
|
||||
return 'Sum activity linked to a person duration';
|
||||
}
|
||||
}
|
||||
|
||||
public function getType()
|
||||
public function getType(): string
|
||||
{
|
||||
return 'activity';
|
||||
return Declarations::ACTIVITY;
|
||||
}
|
||||
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
||||
{
|
||||
$centers = array_map(
|
||||
static fn (array $el): string => $el['center'],
|
||||
static fn (array $el): Center => $el['center'],
|
||||
$acl
|
||||
);
|
||||
|
||||
@@ -118,13 +126,17 @@ class StatActivityDuration implements ExportInterface
|
||||
->setParameter(':centers', $centers);
|
||||
}
|
||||
|
||||
public function requiredRole()
|
||||
public function requiredRole(): string
|
||||
{
|
||||
return new Role(ActivityStatsVoter::STATS);
|
||||
return ActivityStatsVoter::STATS;
|
||||
}
|
||||
|
||||
public function supportsModifiers()
|
||||
{
|
||||
return ['person', 'activity'];
|
||||
return [
|
||||
Declarations::ACTIVITY,
|
||||
Declarations::ACTIVITY_PERSON,
|
||||
//PersonDeclarations::PERSON_TYPE,
|
||||
];
|
||||
}
|
||||
}
|
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Filter\ACPFilters;
|
||||
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
||||
use Chill\PersonBundle\Templating\Entity\SocialActionRender;
|
||||
use Doctrine\ORM\Query\Expr\Andx;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use function in_array;
|
||||
|
||||
class BySocialActionFilter implements FilterInterface
|
||||
{
|
||||
private SocialActionRender $actionRender;
|
||||
|
||||
public function __construct(SocialActionRender $actionRender)
|
||||
{
|
||||
$this->actionRender = $actionRender;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$where = $qb->getDQLPart('where');
|
||||
|
||||
if (!in_array('socialaction', $qb->getAllAliases(), true)) {
|
||||
$qb->join('activity.socialActions', 'socialaction');
|
||||
}
|
||||
|
||||
$clause = $qb->expr()->in('socialaction.id', ':socialactions');
|
||||
|
||||
if ($where instanceof Andx) {
|
||||
$where->add($clause);
|
||||
} else {
|
||||
$where = $qb->expr()->andX($clause);
|
||||
}
|
||||
|
||||
$qb->add('where', $where);
|
||||
$qb->setParameter('socialactions', $data['accepted_socialactions']);
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ACTIVITY_ACP;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder->add('accepted_socialactions', EntityType::class, [
|
||||
'class' => SocialAction::class,
|
||||
'choice_label' => function (SocialAction $sa) {
|
||||
return $this->actionRender->renderString($sa, []);
|
||||
},
|
||||
'multiple' => true,
|
||||
'expanded' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
$actions = [];
|
||||
|
||||
foreach ($data['accepted_socialactions'] as $sa) {
|
||||
$actions[] = $this->actionRender->renderString($sa, []);
|
||||
}
|
||||
|
||||
return ['Filtered activity by linked socialaction: only %actions%', [
|
||||
'%actions%' => implode(', ou ', $actions),
|
||||
]];
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Filter activity by linked socialaction';
|
||||
}
|
||||
}
|
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Filter\ACPFilters;
|
||||
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
|
||||
use Chill\PersonBundle\Templating\Entity\SocialIssueRender;
|
||||
use Doctrine\ORM\Query\Expr\Andx;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use function in_array;
|
||||
|
||||
class BySocialIssueFilter implements FilterInterface
|
||||
{
|
||||
private SocialIssueRender $issueRender;
|
||||
|
||||
public function __construct(SocialIssueRender $issueRender)
|
||||
{
|
||||
$this->issueRender = $issueRender;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$where = $qb->getDQLPart('where');
|
||||
|
||||
if (!in_array('socialissue', $qb->getAllAliases(), true)) {
|
||||
$qb->join('activity.socialIssues', 'socialissue');
|
||||
}
|
||||
|
||||
$clause = $qb->expr()->in('socialissue.id', ':socialissues');
|
||||
|
||||
if ($where instanceof Andx) {
|
||||
$where->add($clause);
|
||||
} else {
|
||||
$where = $qb->expr()->andX($clause);
|
||||
}
|
||||
|
||||
$qb->add('where', $where);
|
||||
$qb->setParameter('socialissues', $data['accepted_socialissues']);
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ACTIVITY_ACP;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder->add('accepted_socialissues', EntityType::class, [
|
||||
'class' => SocialIssue::class,
|
||||
'choice_label' => function (SocialIssue $si) {
|
||||
return $this->issueRender->renderString($si, []);
|
||||
},
|
||||
'multiple' => true,
|
||||
'expanded' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
$issues = [];
|
||||
|
||||
foreach ($data['accepted_socialissues'] as $si) {
|
||||
$issues[] = $this->issueRender->renderString($si, []);
|
||||
}
|
||||
|
||||
return ['Filtered activity by linked socialissue: only %issues%', [
|
||||
'%issues%' => implode(', ou ', $issues),
|
||||
]];
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Filter activity by linked socialissue';
|
||||
}
|
||||
}
|
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Filter\ACPFilters;
|
||||
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\MainBundle\Templating\Entity\UserRender;
|
||||
use Doctrine\ORM\Query\Expr\Andx;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use function in_array;
|
||||
|
||||
class ByUserFilter implements FilterInterface
|
||||
{
|
||||
private UserRender $userRender;
|
||||
|
||||
public function __construct(UserRender $userRender)
|
||||
{
|
||||
$this->userRender = $userRender;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$where = $qb->getDQLPart('where');
|
||||
|
||||
if (!in_array('user', $qb->getAllAliases(), true)) {
|
||||
$qb->join('activity.users', 'user');
|
||||
}
|
||||
|
||||
$clause = $qb->expr()->in('user.id', ':users');
|
||||
|
||||
if ($where instanceof Andx) {
|
||||
$where->add($clause);
|
||||
} else {
|
||||
$where = $qb->expr()->andX($clause);
|
||||
}
|
||||
|
||||
$qb->add('where', $where);
|
||||
$qb->setParameter('users', $data['accepted_users']);
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ACTIVITY_ACP;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder->add('accepted_users', EntityType::class, [
|
||||
'class' => User::class,
|
||||
'choice_label' => function (User $u) {
|
||||
return $this->userRender->renderString($u, []);
|
||||
},
|
||||
'multiple' => true,
|
||||
'expanded' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
$users = [];
|
||||
|
||||
foreach ($data['accepted_users'] as $u) {
|
||||
$users[] = $this->userRender->renderString($u, []);
|
||||
}
|
||||
|
||||
return ['Filtered activity by linked users: only %users%', [
|
||||
'%users%' => implode(', ou ', $users),
|
||||
]];
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Filter activity by linked users';
|
||||
}
|
||||
}
|
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Filter\ACPFilters;
|
||||
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Doctrine\ORM\Query\Expr\Andx;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class EmergencyFilter implements FilterInterface
|
||||
{
|
||||
private const CHOICES = [
|
||||
'activity is emergency' => true,
|
||||
'activity is not emergency' => false,
|
||||
];
|
||||
|
||||
private const DEFAULT_CHOICE = false;
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(TranslatorInterface $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$where = $qb->getDQLPart('where');
|
||||
|
||||
$clause = $qb->expr()->eq('activity.emergency', ':emergency');
|
||||
|
||||
if ($where instanceof Andx) {
|
||||
$where->add($clause);
|
||||
} else {
|
||||
$where = $qb->expr()->andX($clause);
|
||||
}
|
||||
|
||||
$qb->add('where', $where);
|
||||
$qb->setParameter('emergency', $data['accepted_emergency']);
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ACTIVITY_ACP;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder->add('accepted_emergency', ChoiceType::class, [
|
||||
'choices' => self::CHOICES,
|
||||
'multiple' => false,
|
||||
'expanded' => true,
|
||||
'empty_data' => self::DEFAULT_CHOICE,
|
||||
'data' => self::DEFAULT_CHOICE,
|
||||
]);
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
foreach (self::CHOICES as $k => $v) {
|
||||
if ($v === $data['accepted_emergency']) {
|
||||
$choice = $k;
|
||||
}
|
||||
}
|
||||
|
||||
return ['Filtered activity by emergency: only %emergency%', [
|
||||
'%emergency%' => $this->translator->trans($choice),
|
||||
]];
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Filter activity by emergency';
|
||||
}
|
||||
}
|
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Filter\ACPFilters;
|
||||
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Entity\LocationType;
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Doctrine\ORM\Query\Expr\Andx;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use function in_array;
|
||||
|
||||
class LocationTypeFilter implements FilterInterface
|
||||
{
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('location', $qb->getAllAliases(), true)) {
|
||||
$qb->join('activity.location', 'location');
|
||||
}
|
||||
|
||||
$where = $qb->getDQLPart('where');
|
||||
$clause = $qb->expr()->in('location.locationType', ':locationtype');
|
||||
|
||||
if ($where instanceof Andx) {
|
||||
$where->add($clause);
|
||||
} else {
|
||||
$where = $qb->expr()->andX($clause);
|
||||
}
|
||||
|
||||
$qb->add('where', $where);
|
||||
$qb->setParameter('locationtype', $data['accepted_locationtype']);
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ACTIVITY_ACP;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder->add('accepted_locationtype', EntityType::class, [
|
||||
'class' => LocationType::class,
|
||||
'choice_label' => function (LocationType $type) {
|
||||
return $this->translatableStringHelper->localize($type->getTitle());
|
||||
},
|
||||
'multiple' => true,
|
||||
'expanded' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
$types = [];
|
||||
|
||||
foreach ($data['accepted_locationtype'] as $type) {
|
||||
$types[] = $this->translatableStringHelper->localize(
|
||||
$type->getTitle()
|
||||
);
|
||||
}
|
||||
|
||||
return ['Filtered activity by locationtype: only %types%', [
|
||||
'%types%' => implode(', ou ', $types),
|
||||
]];
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Filter activity by locationtype';
|
||||
}
|
||||
}
|
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Filter\ACPFilters;
|
||||
|
||||
use Chill\ActivityBundle\Entity\Activity;
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Doctrine\ORM\Query\Expr\Andx;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class SentReceivedFilter implements FilterInterface
|
||||
{
|
||||
private const CHOICES = [
|
||||
'is sent' => Activity::SENTRECEIVED_SENT,
|
||||
'is received' => Activity::SENTRECEIVED_RECEIVED,
|
||||
];
|
||||
|
||||
private const DEFAULT_CHOICE = Activity::SENTRECEIVED_SENT;
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(TranslatorInterface $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$where = $qb->getDQLPart('where');
|
||||
|
||||
$clause = $qb->expr()->eq('activity.sentReceived', ':sentreceived');
|
||||
|
||||
if ($where instanceof Andx) {
|
||||
$where->add($clause);
|
||||
} else {
|
||||
$where = $qb->expr()->andX($clause);
|
||||
}
|
||||
|
||||
$qb->add('where', $where);
|
||||
$qb->setParameter('sentreceived', $data['accepted_sentreceived']);
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ACTIVITY_ACP;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder->add('accepted_sentreceived', ChoiceType::class, [
|
||||
'choices' => self::CHOICES,
|
||||
'multiple' => false,
|
||||
'expanded' => true,
|
||||
'empty_data' => self::DEFAULT_CHOICE,
|
||||
'data' => self::DEFAULT_CHOICE,
|
||||
]);
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
$sentreceived = array_flip(self::CHOICES)[$data['accepted_sentreceived']];
|
||||
|
||||
return ['Filtered activity by sentreceived: only %sentreceived%', [
|
||||
'%sentreceived%' => $this->translator->trans($sentreceived),
|
||||
]];
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Filter activity by sentreceived';
|
||||
}
|
||||
}
|
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Filter\ACPFilters;
|
||||
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\MainBundle\Templating\Entity\UserRender;
|
||||
use Doctrine\ORM\Query\Expr\Andx;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
class UserFilter implements FilterInterface
|
||||
{
|
||||
private UserRender $userRender;
|
||||
|
||||
public function __construct(UserRender $userRender)
|
||||
{
|
||||
$this->userRender = $userRender;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$where = $qb->getDQLPart('where');
|
||||
|
||||
$clause = $qb->expr()->in('activity.user', ':users');
|
||||
|
||||
if ($where instanceof Andx) {
|
||||
$where->add($clause);
|
||||
} else {
|
||||
$where = $qb->expr()->andX($clause);
|
||||
}
|
||||
|
||||
$qb->add('where', $where);
|
||||
$qb->setParameter('users', $data['accepted_users']);
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ACTIVITY_ACP;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder->add('accepted_users', EntityType::class, [
|
||||
'class' => User::class,
|
||||
'choice_label' => function (User $u) {
|
||||
return $this->userRender->renderString($u, []);
|
||||
},
|
||||
'multiple' => true,
|
||||
'expanded' => true,
|
||||
'label' => 'Creators',
|
||||
]);
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
$users = [];
|
||||
|
||||
foreach ($data['accepted_users'] as $u) {
|
||||
$users[] = $this->userRender->renderString($u, []);
|
||||
}
|
||||
|
||||
return ['Filtered activity by user: only %users%', [
|
||||
'%users%' => implode(', ou ', $users),
|
||||
]];
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Filter activity by user';
|
||||
}
|
||||
}
|
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Filter\ACPFilters;
|
||||
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\MainBundle\Entity\Scope;
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Doctrine\ORM\Query\Expr\Andx;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use function in_array;
|
||||
|
||||
class UserScopeFilter implements FilterInterface
|
||||
{
|
||||
private TranslatableStringHelper $translatableStringHelper;
|
||||
|
||||
public function __construct(TranslatableStringHelper $translatableStringHelper)
|
||||
{
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
}
|
||||
|
||||
public function addRole(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
if (!in_array('user', $qb->getAllAliases(), true)) {
|
||||
$qb->join('activity.user', 'user');
|
||||
}
|
||||
|
||||
$where = $qb->getDQLPart('where');
|
||||
|
||||
$clause = $qb->expr()->in('user.mainScope', ':userscope');
|
||||
|
||||
if ($where instanceof Andx) {
|
||||
$where->add($clause);
|
||||
} else {
|
||||
$where = $qb->expr()->andX($clause);
|
||||
}
|
||||
|
||||
$qb->add('where', $where);
|
||||
$qb->setParameter('userscope', $data['accepted_userscope']);
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::ACTIVITY_ACP;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder->add('accepted_userscope', EntityType::class, [
|
||||
'class' => Scope::class,
|
||||
'choice_label' => function (Scope $s) {
|
||||
return $this->translatableStringHelper->localize(
|
||||
$s->getName()
|
||||
);
|
||||
},
|
||||
'multiple' => true,
|
||||
'expanded' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
$scopes = [];
|
||||
|
||||
foreach ($data['accepted_userscope'] as $s) {
|
||||
$scopes[] = $this->translatableStringHelper->localize(
|
||||
$s->getName()
|
||||
);
|
||||
}
|
||||
|
||||
return ['Filtered activity by userscope: only %scopes%', [
|
||||
'%scopes%' => implode(', ou ', $scopes),
|
||||
]];
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return 'Filter activity by userscope';
|
||||
}
|
||||
}
|
@@ -11,12 +11,13 @@ declare(strict_types=1);
|
||||
|
||||
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;
|
||||
@@ -32,7 +33,7 @@ class ActivityDateFilter implements FilterInterface
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function addRole()
|
||||
public function addRole(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -57,36 +58,22 @@ class ActivityDateFilter implements FilterInterface
|
||||
$qb->setParameter('date_to', $data['date_to']);
|
||||
}
|
||||
|
||||
public function applyOn()
|
||||
public function applyOn(): string
|
||||
{
|
||||
return 'activity';
|
||||
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 */
|
||||
|
@@ -12,8 +12,8 @@ declare(strict_types=1);
|
||||
namespace Chill\ActivityBundle\Export\Filter;
|
||||
|
||||
use Chill\ActivityBundle\Entity\ActivityType;
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\ActivityBundle\Repository\ActivityTypeRepository;
|
||||
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
||||
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
@@ -22,7 +22,6 @@ use Doctrine\ORM\Query\Expr\Join;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
use function count;
|
||||
@@ -41,15 +40,15 @@ class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInter
|
||||
$this->activityTypeRepository = $activityTypeRepository;
|
||||
}
|
||||
|
||||
public function addRole()
|
||||
public function addRole(): ?string
|
||||
{
|
||||
return new Role(ActivityStatsVoter::STATS);
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$where = $qb->getDQLPart('where');
|
||||
$clause = $qb->expr()->in('activity.type', ':selected_activity_types');
|
||||
$clause = $qb->expr()->in('activity.activityType', ':selected_activity_types');
|
||||
|
||||
if ($where instanceof Expr\Andx) {
|
||||
$where->add($clause);
|
||||
@@ -61,39 +60,33 @@ class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInter
|
||||
$qb->setParameter('selected_activity_types', $data['types']);
|
||||
}
|
||||
|
||||
public function applyOn()
|
||||
public function applyOn(): string
|
||||
{
|
||||
return 'activity';
|
||||
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()
|
||||
|
@@ -9,11 +9,11 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Filter;
|
||||
namespace Chill\ActivityBundle\Export\Filter\PersonFilters;
|
||||
|
||||
use Chill\ActivityBundle\Entity\ActivityReason;
|
||||
use Chill\ActivityBundle\Export\Declarations;
|
||||
use Chill\ActivityBundle\Repository\ActivityReasonRepository;
|
||||
use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter;
|
||||
use Chill\MainBundle\Export\ExportElementValidatedInterface;
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
@@ -23,7 +23,6 @@ use Doctrine\ORM\Query\Expr\Join;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
use function array_key_exists;
|
||||
@@ -43,9 +42,9 @@ class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInt
|
||||
$this->activityReasonRepository = $activityReasonRepository;
|
||||
}
|
||||
|
||||
public function addRole()
|
||||
public function addRole(): ?string
|
||||
{
|
||||
return new Role(ActivityStatsVoter::STATS);
|
||||
return null;
|
||||
}
|
||||
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
@@ -79,9 +78,9 @@ class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInt
|
||||
$qb->setParameter('selected_activity_reasons', $data['reasons']);
|
||||
}
|
||||
|
||||
public function applyOn()
|
||||
public function applyOn(): string
|
||||
{
|
||||
return 'activity';
|
||||
return Declarations::ACTIVITY_PERSON;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
@@ -9,7 +9,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\ActivityBundle\Export\Filter;
|
||||
namespace Chill\ActivityBundle\Export\Filter\PersonFilters;
|
||||
|
||||
use Chill\ActivityBundle\Entity\ActivityReason;
|
||||
use Chill\ActivityBundle\Repository\ActivityReasonRepository;
|
||||
@@ -52,7 +52,7 @@ class PersonHavingActivityBetweenDateFilter implements ExportElementValidatedInt
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function addRole()
|
||||
public function addRole(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -102,7 +102,7 @@ class PersonHavingActivityBetweenDateFilter implements ExportElementValidatedInt
|
||||
$qb->setParameter('person_having_activity_reasons', $data['reasons']);
|
||||
}
|
||||
|
||||
public function applyOn()
|
||||
public function applyOn(): string
|
||||
{
|
||||
return Declarations::PERSON_IMPLIED_IN;
|
||||
}
|
@@ -14,17 +14,20 @@ namespace Chill\ActivityBundle\Form;
|
||||
use Chill\ActivityBundle\Entity\Activity;
|
||||
use Chill\ActivityBundle\Entity\ActivityPresence;
|
||||
use Chill\ActivityBundle\Entity\ActivityReason;
|
||||
use Chill\ActivityBundle\Security\Authorization\ActivityVoter;
|
||||
use Chill\DocStoreBundle\Form\StoredObjectType;
|
||||
use Chill\MainBundle\Entity\Center;
|
||||
use Chill\MainBundle\Entity\Location;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Form\Type\ChillCollectionType;
|
||||
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||
use Chill\MainBundle\Form\Type\CommentType;
|
||||
use Chill\MainBundle\Form\Type\PickUserDynamicType;
|
||||
use Chill\MainBundle\Form\Type\PrivateCommentType;
|
||||
use Chill\MainBundle\Form\Type\ScopePickerType;
|
||||
use Chill\MainBundle\Form\Type\UserPickerType;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
|
||||
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
|
||||
@@ -50,6 +53,7 @@ use Symfony\Component\Form\FormEvents;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use function in_array;
|
||||
|
||||
class ActivityType extends AbstractType
|
||||
@@ -109,19 +113,18 @@ class ActivityType extends AbstractType
|
||||
$activityType = $options['activityType'];
|
||||
|
||||
// TODO revoir la gestion des center au niveau du form des activité.
|
||||
if ($options['center']) {
|
||||
if ($options['center'] instanceof Center && null !== $options['data']->getPerson()) {
|
||||
$builder->add('scope', ScopePickerType::class, [
|
||||
'center' => $options['center'],
|
||||
'role' => $options['role'],
|
||||
// TODO make required again once scope and rights are fixed
|
||||
'required' => false,
|
||||
'role' => ActivityVoter::CREATE === (string) $options['role'] ? ActivityVoter::CREATE_PERSON : (string) $options['role'],
|
||||
'required' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
/** @var ? \Chill\PersonBundle\Entity\AccompanyingPeriod $accompanyingPeriod */
|
||||
$accompanyingPeriod = null;
|
||||
|
||||
if ($options['accompanyingPeriod']) {
|
||||
if ($options['accompanyingPeriod'] instanceof AccompanyingPeriod) {
|
||||
$accompanyingPeriod = $options['accompanyingPeriod'];
|
||||
}
|
||||
|
||||
@@ -218,12 +221,10 @@ class ActivityType extends AbstractType
|
||||
]);
|
||||
}
|
||||
|
||||
if ($activityType->isVisible('user') && $options['center']) {
|
||||
$builder->add('user', UserPickerType::class, [
|
||||
if ($activityType->isVisible('user') && $options['center'] instanceof Center) {
|
||||
$builder->add('user', PickUserDynamicType::class, [
|
||||
'label' => $activityType->getLabel('user'),
|
||||
'required' => $activityType->isRequired('user'),
|
||||
'center' => $options['center'],
|
||||
'role' => $options['role'],
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -442,8 +443,8 @@ class ActivityType extends AbstractType
|
||||
|
||||
$resolver
|
||||
->setRequired(['center', 'role', 'activityType', 'accompanyingPeriod'])
|
||||
->setAllowedTypes('center', ['null', 'Chill\MainBundle\Entity\Center'])
|
||||
->setAllowedTypes('role', 'Symfony\Component\Security\Core\Role\Role')
|
||||
->setAllowedTypes('center', ['null', Center::class])
|
||||
->setAllowedTypes('role', [Role::class, 'string'])
|
||||
->setAllowedTypes('activityType', \Chill\ActivityBundle\Entity\ActivityType::class)
|
||||
->setAllowedTypes('accompanyingPeriod', [\Chill\PersonBundle\Entity\AccompanyingPeriod::class, 'null']);
|
||||
}
|
||||
|
@@ -120,3 +120,11 @@
|
||||
|
||||
{{ form_end(edit_form) }}
|
||||
{# {{ form(delete_form) }} #}
|
||||
|
||||
{% block js %}
|
||||
{{ encore_entry_script_tags('mod_pickentity_type') }}
|
||||
{% endblock %}
|
||||
|
||||
{% block css %}
|
||||
{{ encore_entry_link_tags('mod_pickentity_type') }}
|
||||
{% endblock %}
|
@@ -46,7 +46,7 @@
|
||||
|
||||
{% include 'ChillActivityBundle:Activity:list.html.twig' with {'context': 'person'} %}
|
||||
|
||||
{% if is_granted('CHILL_ACTIVITY_CREATE_PERSON', person) %}
|
||||
{% if is_granted('CHILL_ACTIVITY_CREATE', person) %}
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li>
|
||||
<a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'accompanying_period_id': accompanying_course_id}) }}"
|
||||
|
@@ -119,3 +119,11 @@
|
||||
</li>
|
||||
</ul>
|
||||
{{ form_end(form) }}
|
||||
|
||||
{% block js %}
|
||||
{{ encore_entry_script_tags('mod_pickentity_type') }}
|
||||
{% endblock %}
|
||||
|
||||
{% block css %}
|
||||
{{ encore_entry_link_tags('mod_pickentity_type') }}
|
||||
{% endblock %}
|
@@ -133,7 +133,7 @@ class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
|
||||
|
||||
// change attribute CREATE
|
||||
if (self::CREATE === $attribute) {
|
||||
$attribute = self::CREATE_PERSON;
|
||||
return $this->voterHelper->voteOnAttribute(self::CREATE_PERSON, $subject->getPerson(), $token);
|
||||
}
|
||||
} elseif ($subject->getAccompanyingPeriod() instanceof AccompanyingPeriod) {
|
||||
if (!$this->security->isGranted(AccompanyingPeriodVoter::SEE, $subject->getAccompanyingPeriod())) {
|
||||
@@ -144,7 +144,8 @@ class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
|
||||
if (AccompanyingPeriod::STEP_CLOSED === $subject->getAccompanyingPeriod()->getStep()) {
|
||||
return false;
|
||||
}
|
||||
$attribute = self::CREATE_ACCOMPANYING_COURSE;
|
||||
|
||||
return $this->voterHelper->voteOnAttribute(self::CREATE_ACCOMPANYING_COURSE, $subject->getAccompanyingPeriod(), $token);
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException('Could not determine context of activity.');
|
||||
@@ -158,12 +159,12 @@ class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
|
||||
|
||||
// transform the attribute
|
||||
if (self::CREATE === $attribute) {
|
||||
$attribute = self::CREATE_ACCOMPANYING_COURSE;
|
||||
return $this->voterHelper->voteOnAttribute(self::CREATE_ACCOMPANYING_COURSE, $subject, $token);
|
||||
}
|
||||
} elseif ($subject instanceof Person) {
|
||||
// transform the attribute
|
||||
if (self::CREATE === $attribute) {
|
||||
$attribute = self::CREATE_PERSON;
|
||||
return $this->voterHelper->voteOnAttribute(self::CREATE_PERSON, $subject, $token);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -130,8 +130,10 @@ class ActivityContext implements
|
||||
return $this->personRender->renderString($p, []);
|
||||
},
|
||||
'multiple' => false,
|
||||
'required' => false,
|
||||
'expanded' => true,
|
||||
'label' => $options[$key . 'Label'],
|
||||
'placeholder' => $this->translator->trans('Any person selected'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@@ -3,26 +3,48 @@ services:
|
||||
autowire: true
|
||||
autoconfigure: true
|
||||
|
||||
chill.activity.export.count_activity:
|
||||
class: Chill\ActivityBundle\Export\Export\CountActivity
|
||||
## Indicators
|
||||
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:
|
||||
class: Chill\ActivityBundle\Export\Export\StatActivityDuration
|
||||
chill.activity.export.sum_activity_duration_linked_to_person:
|
||||
class: Chill\ActivityBundle\Export\Export\LinkedToPerson\StatActivityDuration
|
||||
tags:
|
||||
- { name: chill.export, alias: 'sum_activity_duration' }
|
||||
- { name: chill.export, alias: 'sum_activity_duration_linked_to_person' }
|
||||
|
||||
chill.activity.export.list_activity:
|
||||
class: Chill\ActivityBundle\Export\Export\ListActivity
|
||||
chill.activity.export.list_activity_linked_to_person:
|
||||
class: Chill\ActivityBundle\Export\Export\LinkedToPerson\ListActivity
|
||||
tags:
|
||||
- { name: chill.export, alias: 'list_activity' }
|
||||
- { name: chill.export, alias: 'list_activity_linked_to_person' }
|
||||
|
||||
chill.activity.export.reason_filter:
|
||||
class: Chill\ActivityBundle\Export\Filter\ActivityReasonFilter
|
||||
chill.activity.export.count_activity_linked_to_acp:
|
||||
class: Chill\ActivityBundle\Export\Export\LinkedToACP\CountActivity
|
||||
tags:
|
||||
- { name: chill.export_filter, alias: 'activity_reason_filter' }
|
||||
- { 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.type_filter:
|
||||
class: Chill\ActivityBundle\Export\Filter\ActivityTypeFilter
|
||||
tags:
|
||||
@@ -33,15 +55,61 @@ services:
|
||||
tags:
|
||||
- { name: chill.export_filter, alias: 'activity_date_filter' }
|
||||
|
||||
chill.activity.export.reason_filter:
|
||||
class: Chill\ActivityBundle\Export\Filter\PersonFilters\ActivityReasonFilter
|
||||
tags:
|
||||
- { name: chill.export_filter, alias: 'activity_reason_filter' }
|
||||
|
||||
chill.activity.export.person_having_an_activity_between_date_filter:
|
||||
class: Chill\ActivityBundle\Export\Filter\PersonHavingActivityBetweenDateFilter
|
||||
class: Chill\ActivityBundle\Export\Filter\PersonFilters\PersonHavingActivityBetweenDateFilter
|
||||
tags:
|
||||
- #0 register as a filter
|
||||
name: chill.export_filter
|
||||
alias: 'activity_person_having_ac_bw_date_filter'
|
||||
|
||||
chill.activity.export.locationtype_filter:
|
||||
class: Chill\ActivityBundle\Export\Filter\ACPFilters\LocationTypeFilter
|
||||
tags:
|
||||
- { name: chill.export_filter, alias: 'activity_locationtype_filter' }
|
||||
|
||||
chill.activity.export.byuser_filter: # TMS (M2M)
|
||||
class: Chill\ActivityBundle\Export\Filter\ACPFilters\ByUserFilter
|
||||
tags:
|
||||
- { name: chill.export_filter, alias: 'activity_byuser_filter' }
|
||||
|
||||
chill.activity.export.emergency_filter:
|
||||
class: Chill\ActivityBundle\Export\Filter\ACPFilters\EmergencyFilter
|
||||
tags:
|
||||
- { name: chill.export_filter, alias: 'activity_emergency_filter' }
|
||||
|
||||
chill.activity.export.sentreceived_filter:
|
||||
class: Chill\ActivityBundle\Export\Filter\ACPFilters\SentReceivedFilter
|
||||
tags:
|
||||
- { name: chill.export_filter, alias: 'activity_sentreceived_filter' }
|
||||
|
||||
chill.activity.export.bysocialaction_filter:
|
||||
class: Chill\ActivityBundle\Export\Filter\ACPFilters\BySocialActionFilter
|
||||
tags:
|
||||
- { name: chill.export_filter, alias: 'activity_bysocialaction_filter' }
|
||||
|
||||
chill.activity.export.bysocialissue_filter:
|
||||
class: Chill\ActivityBundle\Export\Filter\ACPFilters\BySocialIssueFilter
|
||||
tags:
|
||||
- { name: chill.export_filter, alias: 'activity_bysocialissue_filter' }
|
||||
|
||||
chill.activity.export.user_filter: # Creator (M2O)
|
||||
class: Chill\ActivityBundle\Export\Filter\ACPFilters\UserFilter
|
||||
tags:
|
||||
- { name: chill.export_filter, alias: 'activity_user_filter' }
|
||||
|
||||
chill.activity.export.userscope_filter:
|
||||
class: Chill\ActivityBundle\Export\Filter\ACPFilters\UserScopeFilter
|
||||
tags:
|
||||
- { name: chill.export_filter, alias: 'activity_userscope_filter' }
|
||||
|
||||
## Aggregators
|
||||
chill.activity.export.reason_aggregator:
|
||||
class: Chill\ActivityBundle\Export\Aggregator\ActivityReasonAggregator
|
||||
class: Chill\ActivityBundle\Export\Aggregator\PersonAggregators\ActivityReasonAggregator
|
||||
tags:
|
||||
- { name: chill.export_aggregator, alias: activity_reason_aggregator }
|
||||
|
||||
@@ -54,3 +122,38 @@ services:
|
||||
class: Chill\ActivityBundle\Export\Aggregator\ActivityUserAggregator
|
||||
tags:
|
||||
- { name: chill.export_aggregator, alias: activity_user_aggregator }
|
||||
|
||||
chill.activity.export.locationtype_aggregator:
|
||||
class: Chill\ActivityBundle\Export\Aggregator\ACPAggregators\LocationTypeAggregator
|
||||
tags:
|
||||
- { name: chill.export_aggregator, alias: activity_locationtype_aggregator }
|
||||
|
||||
chill.activity.export.date_aggregator:
|
||||
class: Chill\ActivityBundle\Export\Aggregator\ACPAggregators\DateAggregator
|
||||
tags:
|
||||
- { name: chill.export_aggregator, alias: activity_date_aggregator }
|
||||
|
||||
chill.activity.export.byuser_aggregator:
|
||||
class: Chill\ActivityBundle\Export\Aggregator\ACPAggregators\ByUserAggregator
|
||||
tags:
|
||||
- { name: chill.export_aggregator, alias: activity_byuser_aggregator }
|
||||
|
||||
chill.activity.export.bythirdparty_aggregator:
|
||||
class: Chill\ActivityBundle\Export\Aggregator\ACPAggregators\ByThirdpartyAggregator
|
||||
tags:
|
||||
- { name: chill.export_aggregator, alias: activity_bythirdparty_aggregator }
|
||||
|
||||
chill.activity.export.bysocialaction_aggregator:
|
||||
class: Chill\ActivityBundle\Export\Aggregator\ACPAggregators\BySocialActionAggregator
|
||||
tags:
|
||||
- { name: chill.export_aggregator, alias: activity_bysocialaction_aggregator }
|
||||
|
||||
chill.activity.export.bysocialissue_aggregator:
|
||||
class: Chill\ActivityBundle\Export\Aggregator\ACPAggregators\BySocialIssueAggregator
|
||||
tags:
|
||||
- { name: chill.export_aggregator, alias: activity_bysocialissue_aggregator }
|
||||
|
||||
chill.activity.export.userscope_aggregator:
|
||||
class: Chill\ActivityBundle\Export\Aggregator\ACPAggregators\UserScopeAggregator
|
||||
tags:
|
||||
- { name: chill.export_aggregator, alias: activity_userscope_aggregator }
|
||||
|
@@ -203,18 +203,39 @@ 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
|
||||
Count activities: Nombre d'activités
|
||||
Count activities by various parameters.: Compte le nombre d'activités enregistrées 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
|
||||
Number of activities: Nombre d'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
|
||||
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: 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 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'activity: seulement %list%"
|
||||
Filtered by date activity: Filtrer par date d'activité
|
||||
'Filtered by activity type: only %list%': "Filtré par type d'activité: uniquement %list%"
|
||||
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%"
|
||||
@@ -226,18 +247,59 @@ 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
|
||||
|
||||
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
|
||||
Filter activity by linked users: Filtrer les activités par TMS
|
||||
'Filtered activity by linked users: only %users%': "Filtré par TMS: uniquement %users%"
|
||||
Accepted users: TMS(s)
|
||||
Filter activity by emergency: Filtrer les activités par urgence
|
||||
'Filtered activity by emergency: only %emergency%': "Filtré par urgence: uniquement si %emergency%"
|
||||
activity is emergency: l'activité est urgente
|
||||
activity is not emergency: l'activité n'est pas urgente
|
||||
Filter activity by sentreceived: Filtrer les activités par envoyé/reçu
|
||||
'Filtered activity by sentreceived: only %sentreceived%': "Filtré par envoyé/reçu: uniquement %sentreceived%"
|
||||
Accepted sentreceived: ''
|
||||
is sent: envoyé
|
||||
is received: reçu
|
||||
Filter activity by linked socialaction: Filtrer les activités par action liée
|
||||
'Filtered activity by linked socialaction: only %actions%': "Filtré par action liée: uniquement %actions%"
|
||||
Filter activity by linked socialissue: Filtrer les activités par problématique liée
|
||||
'Filtered activity by linked socialissue: only %issues%': "Filtré par problématique liée: uniquement %issues%"
|
||||
Filter activity by user: Filtrer les activités par créateur
|
||||
'Filtered activity by user: only %users%': "Filtré par créateur: uniquement %users%"
|
||||
Creators: Créateurs
|
||||
Filter activity by userscope: Filtrer les activités par service du créateur
|
||||
'Filtered activity by userscope: only %scopes%': "Filtré par service du créateur: uniquement %scopes%"
|
||||
Accepted userscope: Services
|
||||
|
||||
#aggregators
|
||||
Activity type: Type d'activité
|
||||
Activity user: Utilisateur lié à l'activity
|
||||
Activity user: Utilisateur lié à l'activité
|
||||
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: Aggréger par utilisateur lié à l'activité
|
||||
Aggregate by activity type: Aggréger par type d'activité
|
||||
Aggregate by activity reason: Aggréger 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
|
||||
|
||||
Group activity by locationtype: Grouper les activités par type de localisation
|
||||
Group activity by date: Grouper les activités par date
|
||||
Frequency: Fréquence
|
||||
by month: Par mois
|
||||
by week: Par semaine
|
||||
for week: Semaine
|
||||
by year: Par année
|
||||
in year: En
|
||||
Group activity by linked users: Grouper les activités par TMS impliqué
|
||||
Group activity by linked thirdparties: Grouper les activités par tiers impliqué
|
||||
Accepted thirdparty: Tiers impliqué
|
||||
Group activity by linked socialaction: Grouper les activités par action liée
|
||||
Group activity by linked socialissue: Grouper les activités par problématique liée
|
||||
Group activity by userscope: Grouper les activités par service du créateur
|
||||
|
||||
Last activities: Les dernières activités
|
||||
|
||||
|
@@ -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
|
||||
@@ -217,9 +217,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: Aggréger par utilisateur lié à l'activité
|
||||
Aggregate by activity type: Aggréger par type d'activité
|
||||
Aggregate by activity reason: Aggréger par sujet de l'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é
|
||||
|
||||
Last activities: Les dernières activités
|
||||
|
||||
|
Reference in New Issue
Block a user