mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
templates + controller further adapted to work with accompanyingCourse. new and show methods don't work yet due to authorization/voter issues
templates adapted for use with accompanyingCourse tasks also
This commit is contained in:
parent
ead96f3836
commit
b28b4e5fba
@ -29,6 +29,10 @@ use Symfony\Component\Translation\TranslatorInterface;
|
||||
use Chill\TaskBundle\Event\UI\UIEvent;
|
||||
use Chill\MainBundle\Repository\CenterRepository;
|
||||
use Chill\MainBundle\Timeline\TimelineBuilder;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Repository\AccompanyingPeriodRepository;
|
||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
|
||||
/**
|
||||
* Class SingleTaskController
|
||||
@ -53,6 +57,11 @@ class SingleTaskController extends AbstractController
|
||||
* @var LoggerInterface
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* @var RequestStack
|
||||
*/
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* SingleTaskController constructor.
|
||||
@ -62,11 +71,25 @@ class SingleTaskController extends AbstractController
|
||||
public function __construct(
|
||||
EventDispatcherInterface $eventDispatcher,
|
||||
TimelineBuilder $timelineBuilder,
|
||||
LoggerInterface $logger
|
||||
LoggerInterface $logger,
|
||||
RequestStack $requestStack
|
||||
) {
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
$this->timelineBuilder = $timelineBuilder;
|
||||
$this->logger = $logger;
|
||||
$this->request = $requestStack->getCurrentRequest();
|
||||
}
|
||||
|
||||
|
||||
public function getEntity()
|
||||
{
|
||||
if($this->request->query->has('person_id')){
|
||||
return 'person';
|
||||
} else if ($this->request->query->has('course_id')) {
|
||||
return 'course';
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -77,7 +100,6 @@ class SingleTaskController extends AbstractController
|
||||
* )
|
||||
*/
|
||||
public function newAction(
|
||||
Request $request,
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
|
||||
@ -85,18 +107,12 @@ class SingleTaskController extends AbstractController
|
||||
->setAssignee($this->getUser())
|
||||
->setType('task_default')
|
||||
;
|
||||
|
||||
if($request->query->has('person_id')){
|
||||
$entityType = 'person';
|
||||
} else if ($request->query->has('course_id')) {
|
||||
$entityType = 'course';
|
||||
} else {
|
||||
$entityType = null;
|
||||
}
|
||||
|
||||
$entityType = $this->getEntity();
|
||||
|
||||
if ($entityType !== null) {
|
||||
|
||||
$entityId = $request->query->getInt("{$entityType}_id", 0); // sf4 check:
|
||||
$entityId = $this->request->query->getInt("{$entityType}_id", 0); // sf4 check:
|
||||
// prevent error: `Argument 2 passed to ::getInt() must be of the type int, null given`
|
||||
|
||||
if ($entityId === null) {
|
||||
@ -134,12 +150,18 @@ class SingleTaskController extends AbstractController
|
||||
|
||||
}
|
||||
|
||||
// error message: You should associate a person with task in order to check autorizations.
|
||||
// consequently adapting TaskVoter to take into account accompanyinCourse throws new errors linked to authorizationHelper on line 151
|
||||
|
||||
$this->denyAccessUnlessGranted(TaskVoter::CREATE, $task, 'You are not '
|
||||
. 'allowed to create this task');
|
||||
|
||||
// error message: An error has occurred resolving the options of the form "Chill\TaskBundle\Form\SingleTaskType":
|
||||
//The option "center" with value null is expected to be of type "Chill\MainBundle\Entity\Center", but is of type "null".
|
||||
|
||||
$form = $this->setCreateForm($task, new Role(TaskVoter::CREATE));
|
||||
|
||||
$form->handleRequest($request);
|
||||
$form->handleRequest($this->request);
|
||||
|
||||
if ($form->isSubmitted()) {
|
||||
if ($form->isValid()) {
|
||||
@ -184,13 +206,22 @@ class SingleTaskController extends AbstractController
|
||||
* name="chill_task_single_task_show"
|
||||
* )
|
||||
*/
|
||||
public function showAction(Request $request, $id)
|
||||
public function showAction($id)
|
||||
{
|
||||
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$task = $em->getRepository(SingleTask::class)->find($id);
|
||||
|
||||
// In case no task is found
|
||||
|
||||
if (!$task) {
|
||||
throw $this->createNotFoundException('Unable to find Task entity.');
|
||||
}
|
||||
|
||||
// In case task belongs to person
|
||||
|
||||
if ($task->getPerson() !== null) {
|
||||
|
||||
$personId = $task->getPerson()->getId();
|
||||
|
||||
if ($personId === null) {
|
||||
@ -204,23 +235,42 @@ class SingleTaskController extends AbstractController
|
||||
if ($person === null) {
|
||||
throw $this->createNotFoundException("Invalid person id");
|
||||
}
|
||||
}
|
||||
$this->denyAccessUnlessGranted(TaskVoter::SHOW, $task, 'You are not '
|
||||
. 'allowed to view this task');
|
||||
|
||||
if (!$task) {
|
||||
throw $this->createNotFoundException('Unable to find Task entity.');
|
||||
}
|
||||
|
||||
$timeline = $this->timelineBuilder
|
||||
->getTimelineHTML('task', array('task' => $task));
|
||||
|
||||
$event = new PrivacyEvent($person, array(
|
||||
$event = new PrivacyEvent($person, array(
|
||||
'element_class' => SingleTask::class,
|
||||
'element_id' => $task->getId(),
|
||||
'action' => 'show'
|
||||
));
|
||||
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
||||
));
|
||||
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
|
||||
|
||||
}
|
||||
|
||||
// In case task belongs to accompanying course
|
||||
|
||||
if ($task->getCourse() !== null)
|
||||
{
|
||||
$courseId = $task->getCourse()->getId();
|
||||
|
||||
if ($courseId === null) {
|
||||
return new Response("You must provide a course_id", Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
|
||||
$course = $this->getDoctrine()->getManager()
|
||||
->getRepository(AccompanyingPeriod::class)
|
||||
->find($courseId);
|
||||
|
||||
if ($course === null)
|
||||
{
|
||||
throw $this->createNotFoundException("Invalid course id");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->denyAccessUnlessGranted(TaskVoter::SHOW, $task, 'You are not '
|
||||
. 'allowed to view this task');
|
||||
|
||||
$timeline = $this->timelineBuilder
|
||||
->getTimelineHTML('task', array('task' => $task));
|
||||
|
||||
return $this->render('ChillTaskBundle:SingleTask:show.html.twig', array(
|
||||
'task' => $task,
|
||||
@ -236,7 +286,6 @@ class SingleTaskController extends AbstractController
|
||||
* )
|
||||
*/
|
||||
public function editAction(
|
||||
Request $request,
|
||||
$id,
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
@ -273,7 +322,7 @@ class SingleTaskController extends AbstractController
|
||||
|
||||
$form = $event->getForm();
|
||||
|
||||
$form->handleRequest($request);
|
||||
$form->handleRequest($this->request);
|
||||
|
||||
if ($form->isSubmitted()) {
|
||||
if ($form->isValid()) {
|
||||
@ -294,7 +343,7 @@ class SingleTaskController extends AbstractController
|
||||
|
||||
return $this->redirectToRoute(
|
||||
'chill_task_singletask_list',
|
||||
$request->query->get('list_params', [])
|
||||
$this->request->query->get('list_params', [])
|
||||
);
|
||||
|
||||
} else {
|
||||
@ -440,6 +489,7 @@ class SingleTaskController extends AbstractController
|
||||
* Arguments:
|
||||
* - user_id
|
||||
* - scope_id
|
||||
* - course_id
|
||||
* - person_id
|
||||
* - hide_form (hide the form to filter the tasks)
|
||||
* - status: date state, amongst SingleTaskRepository::DATE_STATUSES, or 'closed'
|
||||
@ -450,10 +500,10 @@ class SingleTaskController extends AbstractController
|
||||
* )
|
||||
*/
|
||||
public function listAction(
|
||||
Request $request,
|
||||
PaginatorFactory $paginatorFactory,
|
||||
SingleTaskRepository $taskRepository,
|
||||
PersonRepository $personRepository,
|
||||
AccompanyingPeriodRepository $courseRepository,
|
||||
CenterRepository $centerRepository,
|
||||
FormFactoryInterface $formFactory
|
||||
) {
|
||||
@ -466,12 +516,13 @@ class SingleTaskController extends AbstractController
|
||||
$params['user'] = null;
|
||||
$viewParams['center'] = null;
|
||||
$params['types'] = null;
|
||||
$viewParams['accompanyingCourse'] = null;
|
||||
|
||||
|
||||
// Get parameters from url
|
||||
if (!empty($request->query->get('person_id', NULL))) {
|
||||
if (!empty($this->request->query->get('person_id', NULL))) {
|
||||
|
||||
$personId = $request->query->getInt('person_id', 0);
|
||||
$personId = $this->request->query->getInt('person_id', 0);
|
||||
$person = $personRepository->find($personId);
|
||||
|
||||
if ($person === null) {
|
||||
@ -482,28 +533,42 @@ class SingleTaskController extends AbstractController
|
||||
$viewParams['person'] = $person;
|
||||
$params['person'] = $person;
|
||||
}
|
||||
|
||||
if (!empty($this->request->query->get('course_id', NULL))) {
|
||||
|
||||
$courseId = $this->request->query->getInt('course_id', 0);
|
||||
$course = $courseRepository->find($courseId);
|
||||
|
||||
if ($course === null) {
|
||||
throw $this->createNotFoundException("This accompanying course ' $courseId ' does not exist.");
|
||||
}
|
||||
$this->denyAccessUnlessGranted(AccompanyingPeriodVoter::SEE, $course);
|
||||
|
||||
$viewParams['accompanyingCourse'] = $course;
|
||||
$params['accompanyingCourse'] = $course;
|
||||
}
|
||||
|
||||
if (!empty($request->query->get('center_id', NULL))) {
|
||||
$center = $centerRepository->find($request->query->getInt('center_id'));
|
||||
if (!empty($this->request->query->get('center_id', NULL))) {
|
||||
$center = $centerRepository->find($this->request->query->getInt('center_id'));
|
||||
if ($center === null) {
|
||||
throw $this->createNotFoundException('center not found');
|
||||
}
|
||||
$params['center'] = $center;
|
||||
}
|
||||
|
||||
if(!empty($request->query->get('types', []))) {
|
||||
$types = $request->query->get('types', []);
|
||||
if(!empty($this->request->query->get('types', []))) {
|
||||
$types = $this->request->query->get('types', []);
|
||||
if (count($types) > 0) {
|
||||
$params['types'] = $types;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($request->query->get('user_id', null))) {
|
||||
if ($request->query->get('user_id') === '_unassigned') {
|
||||
if (!empty($this->request->query->get('user_id', null))) {
|
||||
if ($this->request->query->get('user_id') === '_unassigned') {
|
||||
$params['unassigned'] = true;
|
||||
} else {
|
||||
|
||||
$userId = $request->query->getInt('user_id', 0);
|
||||
$userId = $this->request->query->getInt('user_id', 0);
|
||||
$user = $this->getDoctrine()->getManager()
|
||||
->getRepository('ChillMainBundle:User')
|
||||
->find($userId);
|
||||
@ -517,9 +582,9 @@ class SingleTaskController extends AbstractController
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($request->query->get('scope_id'))) {
|
||||
if (!empty($this->request->query->get('scope_id'))) {
|
||||
|
||||
$scopeId = $request->query->getInt('scope_id', 0);
|
||||
$scopeId = $this->request->query->getInt('scope_id', 0);
|
||||
|
||||
$scope = $this->getDoctrine()->getManager()
|
||||
->getRepository('ChillMainBundle:Scope')
|
||||
@ -535,7 +600,7 @@ class SingleTaskController extends AbstractController
|
||||
|
||||
// collect parameters for filter
|
||||
$possibleStatuses = \array_merge(SingleTaskRepository::DATE_STATUSES, [ 'closed' ]);
|
||||
$statuses = $request->query->get('status', $possibleStatuses);
|
||||
$statuses = $this->request->query->get('status', $possibleStatuses);
|
||||
|
||||
// check for invalid statuses
|
||||
$diff = \array_diff($statuses, $possibleStatuses);
|
||||
@ -551,7 +616,7 @@ class SingleTaskController extends AbstractController
|
||||
$tasks_count = 0;
|
||||
|
||||
foreach($statuses as $status) {
|
||||
if($request->query->has('status')
|
||||
if($this->request->query->has('status')
|
||||
&& FALSE === \in_array($status, $statuses)) {
|
||||
continue;
|
||||
}
|
||||
@ -586,6 +651,8 @@ class SingleTaskController extends AbstractController
|
||||
|
||||
if ($viewParams['person'] !== null){
|
||||
$viewParams['layout'] = '@ChillPerson/Person/layout.html.twig';
|
||||
} else if ($viewParams['accompanyingCourse'] !== null){
|
||||
$viewParams['layout'] = '@ChillPerson/AccompanyingCourse/layout.html.twig';
|
||||
} else {
|
||||
$viewParams['layout'] = '@ChillMain/layout.html.twig';
|
||||
}
|
||||
@ -598,7 +665,7 @@ class SingleTaskController extends AbstractController
|
||||
'add_type' => true
|
||||
]);
|
||||
|
||||
$form->handleRequest($request);
|
||||
$form->handleRequest($this->request);
|
||||
|
||||
if (isset($person)) {
|
||||
$event = new PrivacyEvent($person, array(
|
||||
@ -609,14 +676,14 @@ class SingleTaskController extends AbstractController
|
||||
}
|
||||
|
||||
return $this->render('ChillTaskBundle:SingleTask:index.html.twig',
|
||||
\array_merge($viewParams, [ 'form' => $form->createView() ]));
|
||||
array_merge($viewParams, [ 'form' => $form->createView() ]));
|
||||
}
|
||||
|
||||
|
||||
protected function getPersonParam(Request $request, EntityManagerInterface $em)
|
||||
protected function getPersonParam(EntityManagerInterface $em)
|
||||
{
|
||||
$person = $em->getRepository(Person::class)
|
||||
->find($request->query->getInt('person_id'))
|
||||
->find($this->request->query->getInt('person_id'))
|
||||
;
|
||||
|
||||
if (NULL === $person) {
|
||||
@ -629,10 +696,10 @@ class SingleTaskController extends AbstractController
|
||||
return $person;
|
||||
}
|
||||
|
||||
protected function getUserParam(Request $request, EntityManagerInterface $em)
|
||||
protected function getUserParam(EntityManagerInterface $em)
|
||||
{
|
||||
$user = $em->getRepository(User::class)
|
||||
->find($request->query->getInt('user_id'))
|
||||
->find($this->request->query->getInt('user_id'))
|
||||
;
|
||||
|
||||
if (NULL === $user) {
|
||||
|
@ -1,244 +1,256 @@
|
||||
{% macro date_status(title, tasks, count, paginator, status, isSingleStatus, person, user) %}
|
||||
{% if tasks|length > 0 %}
|
||||
<h3>{{ title|trans }}</h3>
|
||||
{% if tasks|length > 0 %}
|
||||
<h3>{{ title|trans }}</h3>
|
||||
|
||||
<table class="table table-bordered border-dark chill-task-list">
|
||||
<tbody>
|
||||
{% for task in tasks %}
|
||||
<tr>
|
||||
<td>
|
||||
<div>
|
||||
<span class="chill-task-list__row__title">{{ task.title }}</span>
|
||||
</div>
|
||||
<table class="table table-bordered border-dark chill-task-list">
|
||||
<tbody>
|
||||
{% for task in tasks %}
|
||||
<tr>
|
||||
<td>
|
||||
<div>
|
||||
<span class="chill-task-list__row__title">{{ task.title }}</span>
|
||||
</div>
|
||||
|
||||
{% if person is null %}
|
||||
<div>
|
||||
<span class="chill-task-list__row__person-for">{{ 'For person'|trans }} :</span> <span class="chill-task-list__row__person"><a href="{{ path('chill_person_view', {person_id : task.person.Id}) }}">{{ task.person}}</a></span>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if person is null %}
|
||||
<div>
|
||||
<span class="chill-task-list__row__person-for">{{ 'For person'|trans }} :</span>
|
||||
<span class="chill-task-list__row__person">
|
||||
<a href="{{ path('chill_person_view', {person_id : task.person.Id}) }}">{{ task.person}}</a>
|
||||
</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div>
|
||||
<span class="chill-task-list__row__type">{{ task_workflow_metadata(task, 'definition.name')|trans }}</span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="chill-task-list__row__type">{{ task_workflow_metadata(task, 'definition.name')|trans }}</span>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{% for place in workflow_marked_places(task) %}
|
||||
<span class="task-status box type-{{ task.type }} place-{{ place }}">{{ place|trans }}</span>
|
||||
{% endfor %}
|
||||
{% if task.assignee is not null %}
|
||||
<div class="chill-task-list__row__assignee"><span class="chill_task-list__row__assignee_by">{{ 'By'|trans }} :</span> {{ task.assignee.username }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div>
|
||||
{% for place in workflow_marked_places(task) %}
|
||||
<span class="task-status box type-{{ task.type }} place-{{ place }}">{{ place|trans }}</span>
|
||||
{% endfor %}
|
||||
{% if task.assignee is not null %}
|
||||
<div class="chill-task-list__row__assignee">
|
||||
<span class="chill_task-list__row__assignee_by">{{ 'By'|trans }} :</span>
|
||||
{{ task.assignee.username }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if task.startDate is not null or task.warningDate is not null or task.endDate is not null %}
|
||||
<div class="chill-task-list__row__dates">
|
||||
<ul class="record_actions column">
|
||||
{% if task.startDate is not null %}
|
||||
<li title="{{ 'Start'|trans|escape('html_attr') }}">
|
||||
<i class="fa fa-play" ></i> {{ task.startDate|format_date('medium') }}
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if task.warningDate is not null %}
|
||||
<li title="{{ 'Warning'|trans|escape('html_attr') }}">
|
||||
<i class="fa fa-exclamation-triangle"></i> {{ task.warningDate|format_date('medium') }}
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if task.endDate is not null %}
|
||||
<li title="{{ 'End'|trans|escape('html_attr') }}">
|
||||
<i class="fa fa-hourglass-end"></i> {{ task.endDate|format_date('medium') }}
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if task.startDate is not null or task.warningDate is not null or task.endDate is not null %}
|
||||
<div class="chill-task-list__row__dates">
|
||||
<ul class="record_actions column">
|
||||
{% if task.startDate is not null %}
|
||||
<li title="{{ 'Start'|trans|escape('html_attr') }}">
|
||||
<i class="fa fa-play"></i>
|
||||
{{ task.startDate|format_date('medium') }}
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if task.warningDate is not null %}
|
||||
<li title="{{ 'Warning'|trans|escape('html_attr') }}">
|
||||
<i class="fa fa-exclamation-triangle"></i>
|
||||
{{ task.warningDate|format_date('medium') }}
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if task.endDate is not null %}
|
||||
<li title="{{ 'End'|trans|escape('html_attr') }}">
|
||||
<i class="fa fa-hourglass-end"></i>
|
||||
{{ task.endDate|format_date('medium') }}
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<ul class="record_actions">
|
||||
{% if workflow_transitions(task)|length > 0 %}
|
||||
<li>
|
||||
<div class="btn-group">
|
||||
<a class="btn btn-task-exchange dropdown-toggle" href="#" role="button"
|
||||
id="taskExchange" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
{{'Change task status'|trans}}
|
||||
</a>
|
||||
<ul class="dropdown-menu" aria-labelledby="taskExchange">
|
||||
{% for transition in workflow_transitions(task) %}
|
||||
<li>
|
||||
<a class="dropdown-item"
|
||||
href="{{ path('chill_task_task_transition', { 'taskId': task.id, 'transition': transition.name, 'kind': 'single-task', 'list_params': app.request.query.all }) }}" class="{{ task_workflow_metadata(task, 'transition.class', transition)|e('html_attr') }}">
|
||||
{{ task_workflow_metadata(task, 'transition.verb', transition)|trans }}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<ul class="record_actions">
|
||||
{% if workflow_transitions(task)|length > 0 %}
|
||||
<li>
|
||||
<div class="btn-group">
|
||||
<a class="btn btn-task-exchange dropdown-toggle" href="#" role="button" id="taskExchange" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
{{'Change task status'|trans}}
|
||||
</a>
|
||||
<ul class="dropdown-menu" aria-labelledby="taskExchange">
|
||||
{% for transition in workflow_transitions(task) %}
|
||||
<li>
|
||||
<a class="dropdown-item" href="{{ path('chill_task_task_transition', { 'taskId': task.id, 'transition': transition.name, 'kind': 'single-task', 'list_params': app.request.query.all }) }}" class="{{ task_workflow_metadata(task, 'transition.class', transition)|e('html_attr') }}">
|
||||
{{ task_workflow_metadata(task, 'transition.verb', transition)|trans }}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
<li>
|
||||
<a href="{{ path('chill_task_single_task_show', { 'id': task.id, 'list_params': app.request.query.all }) }}" class="btn btn-show "></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ path('chill_task_single_task_show', { 'id': task.id, 'list_params': app.request.query.all }) }}" class="btn btn-show "></a>
|
||||
</li>
|
||||
|
||||
{% if is_granted('CHILL_TASK_TASK_UPDATE', task) %}
|
||||
<li>
|
||||
<a href="{{ path('chill_task_single_task_edit', { 'id': task.id, 'list_params': app.request.query.all }) }}" class="btn btn-update "></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if is_granted('CHILL_TASK_TASK_UPDATE', task) %}
|
||||
<li>
|
||||
<a href="{{ path('chill_task_single_task_edit', { 'id': task.id, 'list_params': app.request.query.all }) }}" class="btn btn-update "></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if is_granted('CHILL_TASK_TASK_DELETE', task) %}
|
||||
<li>
|
||||
<a href="{{ path('chill_task_single_task_delete', { 'id': task.id, 'list_params': app.request.query.all } ) }}" class="btn btn-delete "></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% if is_granted('CHILL_TASK_TASK_DELETE', task) %}
|
||||
<li>
|
||||
<a href="{{ path('chill_task_single_task_delete', { 'id': task.id, 'list_params': app.request.query.all } ) }}" class="btn btn-delete "></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% if isSingleStatus %}
|
||||
{% if tasks|length < paginator.getTotalItems %}
|
||||
{{ chill_pagination(paginator) }}
|
||||
{% endif %}
|
||||
{% if isSingleStatus %}
|
||||
{% if tasks|length < paginator.getTotalItems %}
|
||||
{{ chill_pagination(paginator) }}
|
||||
{% endif %}
|
||||
|
||||
<!-- lien retour -->
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
{% if person is not null %}
|
||||
<a href="{{ path('chill_task_singletask_list', {'person_id': person.id}) }}" class="btn btn-cancel">
|
||||
{{ 'Back to the list' | trans }}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if user is not null %}
|
||||
<a href="{{ path('chill_task_singletask_list') }}" class="btn btn-cancel">
|
||||
{{ 'Back to the list' | trans }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
<li>
|
||||
{% if person is not null %}
|
||||
<a href="{{ path('chill_task_single_task_new', {'person_id': person.id}) }}" class="btn btn-create">
|
||||
{{ 'Add a new task' | trans }}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if user is not null %}
|
||||
<a href="{{ path('chill_task_single_task_new') }}" class="btn btn-create">
|
||||
{{ 'Add a new task' | trans }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
</ul>
|
||||
{% else %}
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a href="{{ path('chill_task_singletask_list', app.request.query.all|merge({ 'status': [ status ] })) }}" class="btn btn-misc">
|
||||
{{ 'See more' | trans }}
|
||||
</a>
|
||||
</li>
|
||||
<!-- lien retour -->
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
{% if person is not null %}
|
||||
<a href="{{ path('chill_task_singletask_list', {'person_id': person.id}) }}" class="btn btn-cancel">
|
||||
{{ 'Back to the list' | trans }}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if user is not null %}
|
||||
<a href="{{ path('chill_task_singletask_list') }}" class="btn btn-cancel">
|
||||
{{ 'Back to the list' | trans }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
<li>
|
||||
{% if person is not null %}
|
||||
<a href="{{ path('chill_task_single_task_new', {'person_id': person.id}) }}" class="btn btn-create">
|
||||
{{ 'Add a new task' | trans }}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if user is not null %}
|
||||
<a href="{{ path('chill_task_single_task_new') }}" class="btn btn-create">
|
||||
{{ 'Add a new task' | trans }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
</ul>
|
||||
{% else %}
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a href="{{ path('chill_task_singletask_list', app.request.query.all|merge({ 'status': [ status ] })) }}" class="btn btn-misc">
|
||||
{{ 'See more' | trans }}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% import _self as helper %}
|
||||
|
||||
<h1>{{ app.request.query.get('title', null)|escape('html')|default('Task list'|trans) }}</h1>
|
||||
<h1>{{ app.request.query.get('title', null)|escape('html')|default('Task list'|trans) }}</h1>
|
||||
|
||||
{% if false == app.request.query.boolean('hide_form', false) %}
|
||||
<h2>{{ 'Filter the tasks'|trans }}</h2>
|
||||
{{ form_start(form) }}
|
||||
{{ form_row(form.user_id) }}
|
||||
{% if false == app.request.query.boolean('hide_form', false) %}
|
||||
<h2>{{ 'Filter the tasks'|trans }}</h2>
|
||||
{{ form_start(form) }}
|
||||
{{ form_row(form.user_id) }}
|
||||
|
||||
{% if form.status is defined %}
|
||||
{{ form_row(form.status) }}
|
||||
{% endif %}
|
||||
{% if form.status is defined %}
|
||||
{{ form_row(form.status) }}
|
||||
{% endif %}
|
||||
|
||||
{% if form.types is defined %}
|
||||
{{ form_row(form.types) }}
|
||||
{% endif %}
|
||||
{% if form.types is defined %}
|
||||
{{ form_row(form.types) }}
|
||||
{% endif %}
|
||||
|
||||
{% if form.person_id is defined %}
|
||||
{{ form_row(form.person_id) }}
|
||||
{% endif %}
|
||||
{% if form.person_id is defined %}
|
||||
{{ form_row(form.person_id) }}
|
||||
{% endif %}
|
||||
|
||||
{% if form.center_id is defined %}
|
||||
{{ form_row(form.center_id) }}
|
||||
{% endif %}
|
||||
{% if form.center_id is defined %}
|
||||
{{ form_row(form.center_id) }}
|
||||
{% endif %}
|
||||
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<button type="submit" class="btn btn-submit">{{ 'Filter'|trans }}</button>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<button type="submit" class="btn btn-submit">{{ 'Filter'|trans }}</button>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{{ form_end(form)}}
|
||||
{% endif %}
|
||||
{{ form_end(form)}}
|
||||
{% endif %}
|
||||
|
||||
{% if tasks_count == 0 %}
|
||||
<p class="chill-no-data-statement">{{ "There is no tasks."|trans }}</p>
|
||||
{% if person is not null and is_granted('CHILL_TASK_TASK_CREATE', person) %}
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
{% if person is not null %}
|
||||
<a href="{{ path('chill_task_single_task_new', {'person_id': person.id}) }}" class="btn btn-create">
|
||||
{{ 'Add a new task' | trans }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if tasks_count == 0 %}
|
||||
<p class="chill-no-data-statement">{{ "There is no tasks."|trans }}</p>
|
||||
{% if person is not null and is_granted('CHILL_TASK_TASK_CREATE', person) %}
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
{% if person is not null %}
|
||||
<a href="{{ path('chill_task_single_task_new', {'person_id': person.id}) }}" class="btn btn-create">
|
||||
{{ 'Add a new task' | trans }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
|
||||
{% if false == app.request.query.boolean('hide_form', false) %}
|
||||
<h2>{{ 'Tasks'|trans }}</h2>
|
||||
{% endif %}
|
||||
{% if false == app.request.query.boolean('hide_form', false) %}
|
||||
<h2>{{ 'Tasks'|trans }}</h2>
|
||||
{% endif %}
|
||||
|
||||
{% if person is not null and is_granted('CHILL_TASK_TASK_CREATE', person) %}
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
{% if person is not null %}
|
||||
<a href="{{ path('chill_task_single_task_new', {'person_id': person.id}) }}" class="btn btn-create">
|
||||
{{ 'Add a new task' | trans }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% if person is not null and is_granted('CHILL_TASK_TASK_CREATE', person) %}
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
{% if person is not null %}
|
||||
<a href="{{ path('chill_task_single_task_new', {'person_id': person.id}) }}" class="btn btn-create">
|
||||
{{ 'Add a new task' | trans }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% if single_task_ended_tasks is defined %}
|
||||
{{ helper.date_status('Tasks with expired deadline', single_task_ended_tasks, single_task_ended_count, single_task_ended_paginator, 'ended', isSingleStatus, person) }}
|
||||
{% endif %}
|
||||
{% if single_task_ended_tasks is defined %}
|
||||
{{ helper.date_status('Tasks with expired deadline', single_task_ended_tasks, single_task_ended_count, single_task_ended_paginator, 'ended', isSingleStatus, person) }}
|
||||
{% endif %}
|
||||
|
||||
{% if single_task_warning_tasks is defined %}
|
||||
{{ helper.date_status('Tasks with warning deadline reached', single_task_warning_tasks, single_task_warning_count, single_task_warning_paginator, 'warning', isSingleStatus, person) }}
|
||||
{% endif %}
|
||||
{% if single_task_warning_tasks is defined %}
|
||||
{{ helper.date_status('Tasks with warning deadline reached', single_task_warning_tasks, single_task_warning_count, single_task_warning_paginator, 'warning', isSingleStatus, person) }}
|
||||
{% endif %}
|
||||
|
||||
{% if single_task_current_tasks is defined %}
|
||||
{{ helper.date_status('Current tasks', single_task_current_tasks, single_task_current_count, single_task_current_paginator, 'current', isSingleStatus, person) }}
|
||||
{% endif %}
|
||||
{% if single_task_current_tasks is defined %}
|
||||
{{ helper.date_status('Current tasks', single_task_current_tasks, single_task_current_count, single_task_current_paginator, 'current', isSingleStatus, person) }}
|
||||
{% endif %}
|
||||
|
||||
{% if single_task_not_started_tasks is defined %}
|
||||
{{ helper.date_status('Tasks not started', single_task_not_started_tasks, single_task_not_started_count, single_task_not_started_paginator, 'not_started', isSingleStatus, person) }}
|
||||
{% endif %}
|
||||
{% if single_task_not_started_tasks is defined %}
|
||||
{{ helper.date_status('Tasks not started', single_task_not_started_tasks, single_task_not_started_count, single_task_not_started_paginator, 'not_started', isSingleStatus, person) }}
|
||||
{% endif %}
|
||||
|
||||
{% if single_task_closed_tasks is defined %}
|
||||
{{ helper.date_status('Closed tasks', single_task_closed_tasks, single_task_closed_count, single_task_closed_paginator, 'closed', isSingleStatus, person) }}
|
||||
{% endif %}
|
||||
{% if single_task_closed_tasks is defined %}
|
||||
{{ helper.date_status('Closed tasks', single_task_closed_tasks, single_task_closed_count, single_task_closed_paginator, 'closed', isSingleStatus, person) }}
|
||||
{% endif %}
|
||||
|
||||
{% if isSingleStatus == false %}
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
{% if person is not null and is_granted('CHILL_TASK_TASK_CREATE', person) %}
|
||||
<a href="{{ path('chill_task_single_task_new', {'person_id': person.id}) }}" class="btn btn-create">
|
||||
{{ 'Add a new task' | trans }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% if isSingleStatus == false %}
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
{% if person is not null and is_granted('CHILL_TASK_TASK_CREATE', person) %}
|
||||
<a href="{{ path('chill_task_single_task_new', {'person_id': person.id}) }}" class="btn btn-create">
|
||||
{{ 'Add a new task' | trans }}
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
{% if accompanyingCourse is not null %}
|
||||
<a href="{{ path('chill_task_single_task_new', {'course_id': accompanyingCourse.id}) }}" class="btn btn-create">
|
||||
{{ 'Add a new task' | trans }}
|
||||
</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
@ -15,30 +15,30 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#}
|
||||
|
||||
{% extends '@ChillPerson/Person/layout.html.twig' %}
|
||||
{% extends layout %}
|
||||
|
||||
{% set activeRouteKey = 'chill_task_single_task_new' %}
|
||||
|
||||
{% block title %}{{ 'Task list'|trans }}{% endblock %}
|
||||
{% block title %}
|
||||
{{ 'Task list'|trans }}
|
||||
{% endblock %}
|
||||
|
||||
{% macro thead() %}
|
||||
{% endmacro %}
|
||||
{% macro thead() %}{% endmacro %}
|
||||
|
||||
{% macro row(task) %}
|
||||
{% endmacro %}
|
||||
{% macro row(task) %}{% endmacro %}
|
||||
|
||||
{% block filtertasks %}
|
||||
{% if person is not null %}
|
||||
{% block personcontent %}
|
||||
<div class="tasks">
|
||||
{% include 'ChillTaskBundle:SingleTask:_list.html.twig' %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% else %}
|
||||
{% block content %}
|
||||
<div class="col-md-10 col-xxl tasks">
|
||||
{% include 'ChillTaskBundle:SingleTask:_list.html.twig' %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endif %}
|
||||
{% if person is not null %}
|
||||
{% block personcontent %}
|
||||
<div class="tasks">
|
||||
{% include 'ChillTaskBundle:SingleTask:_list.html.twig' %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% else %}
|
||||
{% block content %}
|
||||
<div class="col-md-10 col-xxl tasks">
|
||||
{% include 'ChillTaskBundle:SingleTask:_list.html.twig' %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
@ -1,11 +1,12 @@
|
||||
services:
|
||||
Chill\TaskBundle\Controller\:
|
||||
resource: '../../Controller'
|
||||
tags: ['controller.service_arguments']
|
||||
Chill\TaskBundle\Controller\:
|
||||
resource: "../../Controller"
|
||||
tags: ["controller.service_arguments"]
|
||||
|
||||
Chill\TaskBundle\Controller\SingleTaskController:
|
||||
arguments:
|
||||
$eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface'
|
||||
$timelineBuilder: '@chill_main.timeline_builder'
|
||||
$logger: '@chill.main.logger'
|
||||
tags: ['controller.service_arguments']
|
||||
Chill\TaskBundle\Controller\SingleTaskController:
|
||||
arguments:
|
||||
$eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface'
|
||||
$timelineBuilder: "@chill_main.timeline_builder"
|
||||
$logger: "@chill.main.logger"
|
||||
$requestStack: '@Symfony\Component\HttpFoundation\RequestStack'
|
||||
tags: ["controller.service_arguments"]
|
||||
|
Loading…
x
Reference in New Issue
Block a user