mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
improve activity
This commit is contained in:
parent
7dc70baf57
commit
d9c1f52894
@ -72,6 +72,7 @@ class ActivityController extends AbstractController
|
|||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
$view = null;
|
$view = null;
|
||||||
|
// TODO: add pagination
|
||||||
|
|
||||||
[$person, $accompanyingPeriod] = $this->getEntity($request);
|
[$person, $accompanyingPeriod] = $this->getEntity($request);
|
||||||
|
|
||||||
@ -80,10 +81,9 @@ class ActivityController extends AbstractController
|
|||||||
->getReachableCircles($this->getUser(), new Role('CHILL_ACTIVITY_SEE'),
|
->getReachableCircles($this->getUser(), new Role('CHILL_ACTIVITY_SEE'),
|
||||||
$person->getCenter());
|
$person->getCenter());
|
||||||
|
|
||||||
$activities = $em->getRepository('ChillActivityBundle:Activity')->findBy(
|
$activities = $em->getRepository(Activity::class)
|
||||||
['person' => $person, 'scope' => $reachableScopes],
|
->findByPersonImplied($person, $reachableScopes)
|
||||||
['date' => 'DESC'],
|
;
|
||||||
);
|
|
||||||
|
|
||||||
$event = new PrivacyEvent($person, array(
|
$event = new PrivacyEvent($person, array(
|
||||||
'element_class' => Activity::class,
|
'element_class' => Activity::class,
|
||||||
|
@ -67,18 +67,6 @@ class MenuBuilder implements LocalMenuBuilderInterface
|
|||||||
'order' => 201
|
'order' => 201
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->authorizationHelper->userHasAccess($user, $person, $roleAdd)) {
|
|
||||||
$menu->addChild($this->translator->trans('Add a new activity'), [
|
|
||||||
'route' => 'chill_activity_activity_new',
|
|
||||||
'routeParameters' => [
|
|
||||||
'person_id' => $person->getId()
|
|
||||||
]
|
|
||||||
])
|
|
||||||
->setExtras([
|
|
||||||
'order' => 200
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getMenuIds(): array
|
public static function getMenuIds(): array
|
||||||
|
@ -39,4 +39,29 @@ class ActivityRepository extends ServiceEntityRepository
|
|||||||
parent::__construct($registry, Activity::class);
|
parent::__construct($registry, Activity::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function findByPersonImplied($person, array $scopes, $orderBy = [ 'date' => 'DESC'], $limit = 100, $offset = 0)
|
||||||
|
{
|
||||||
|
$qb = $this->createQueryBuilder('a');
|
||||||
|
$qb->select('a');
|
||||||
|
|
||||||
|
$qb
|
||||||
|
// TODO add acl
|
||||||
|
//->where($qb->expr()->in('a.scope', ':scopes'))
|
||||||
|
//->setParameter('scopes', $scopes)
|
||||||
|
->andWhere(
|
||||||
|
$qb->expr()->orX(
|
||||||
|
$qb->expr()->eq('a.person', ':person'),
|
||||||
|
':person MEMBER OF a.persons'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
->setParameter('person', $person)
|
||||||
|
;
|
||||||
|
|
||||||
|
foreach ($orderBy as $k => $dir) {
|
||||||
|
$qb->addOrderBy('a.'.$k, $dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $qb->getQuery()
|
||||||
|
->getResult();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<button class="sc-button bt-update" type="submit">{{ 'Save activity'|trans }}</button>
|
<button class="sc-button bt-update" type="submit">{{ 'Save'|trans }}</button>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{{ form_end(edit_form) }}
|
{{ form_end(edit_form) }}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
</p>
|
</p>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
||||||
<div class="flex-table list-records {{ context }}">
|
<div class="flex-table list-records context-{{ context }}">
|
||||||
<!--
|
<!--
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -55,6 +55,20 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% if context == 'person' and activity.accompanyingPeriod is not empty %}
|
||||||
|
<div class="accompanyingPeriodLink" style="margin-top: 1rem">
|
||||||
|
<a
|
||||||
|
href="{{ chill_path_add_return_path(
|
||||||
|
"chill_person_accompanying_course_index",
|
||||||
|
{ 'accompanying_period_id': activity.accompanyingPeriod.id }
|
||||||
|
) }}"
|
||||||
|
>
|
||||||
|
<i class="fa fa-random"></i>
|
||||||
|
{{ activity.accompanyingPeriod.id }}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="item-col">
|
<div class="item-col">
|
||||||
<ul class="list-content">
|
<ul class="list-content">
|
||||||
@ -154,6 +168,7 @@
|
|||||||
%}
|
%}
|
||||||
<div class="item-row details">
|
<div class="item-row details">
|
||||||
<div class="item-col">
|
<div class="item-col">
|
||||||
|
|
||||||
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': context, 'with_display': 'row', 'entity': activity } %}
|
{% include 'ChillActivityBundle:Activity:concernedGroups.html.twig' with {'context': context, 'with_display': 'row', 'entity': activity } %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -170,10 +185,13 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<ul class="record_actions">
|
{% if context != 'person' %}
|
||||||
|
{# TODO set this condition in configuration #}
|
||||||
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'accompanying_period_id': accompanying_course_id}) }}" class="sc-button bt-create">
|
<a href="{{ path('chill_activity_activity_new', {'person_id': person_id, 'accompanying_period_id': accompanying_course_id}) }}" class="sc-button bt-create">
|
||||||
{{ 'Add a new activity' | trans }}
|
{{ 'Add a new activity' | trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
@ -98,7 +98,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<button class="sc-button bt-create" type="submit">
|
<button class="sc-button bt-create" type="submit">
|
||||||
{{ 'Add a new activity'|trans }}
|
{{ 'Create'|trans }}
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -117,7 +117,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="sc-button bt-update" href="{{ path('chill_activity_activity_edit', { 'id': entity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}">
|
<a class="sc-button bt-update" href="{{ path('chill_activity_activity_edit', { 'id': entity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id }) }}">
|
||||||
{{ 'Edit the activity'|trans }}
|
{{ 'Edit'|trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{# TODO
|
{# TODO
|
||||||
|
Loading…
x
Reference in New Issue
Block a user