Commit 4fd918d8 authored by Patrick Etcheverry's avatar Patrick Etcheverry

- Ajout de Paginator à la vue de gestion des Démarches au niveau de l'étape

parent 78da2ab0
......@@ -268,25 +268,41 @@ class ScenarisationStageController extends Controller
* Displays some drag&drop tables to edit the processes in which the main scenarisationStage appears
* @param ScenarisationStage $scenarisationStage
*/
public function processManagementAction(ScenarisationStage $scenarisationStage)
public function associateToProcessAction(Request $request, ScenarisationStage $scenarisationStage)
{
$manager = $this->container->get('doctrine')->getEntityManager('default');
// Récupérer toutes les démarches
// On récupère la liste des démarches (et leur étapes)
$dql_get_all_processes = $manager->createQuery ('
/*$dql_get_all_processes = $manager->createQuery ('
select process,stageOrder,stage
FROM ScenarisationProcessBundle:ScenarisationProcess process
JOIN process.scenarisationStageOrder stageOrder
JOIN stageOrder.scenarisationStage stage
ORDER BY stageOrder.position');
$allProcesses = $dql_get_all_processes->getResult();
$allProcesses = $dql_get_all_processes->getResult();*/
$dql_get_all_processes = $manager->createQuery ('
select process,stageOrder,stage
FROM ScenarisationProcessBundle:ScenarisationProcess process
LEFT JOIN process.scenarisationStageOrder stageOrder
LEFT JOIN stageOrder.scenarisationStage stage
ORDER BY process.title, stageOrder.position');
$paginator = $this->get('knp_paginator');
$allProcesses = $paginator->paginate(
$dql_get_all_processes,
$request->query->getInt('page', 1),/*page number*/
2,/*limit per page*/
array('wrap-queries'=>true) // Obligatoire pour faire fonctionner le order by
);
return $this->render('ScenarisationProcessBundle:scenarisationstage:processManagement.html.twig', array(
'processes' => $allProcesses,
'scenarisationStage' => $scenarisationStage
));
}
}
......@@ -48,9 +48,9 @@ scenarisation_stage_question_positions_AJAX_CALL:
methods: GET
# This route show a view to manage the questions of a process (and their position)
scenarisation_stage_process_management:
scenarisation_stage_associate_to_process:
path: /{id}/process-management
defaults: { _controller: "ScenarisationProcessBundle:ScenarisationStage:processManagement" }
defaults: { _controller: "ScenarisationProcessBundle:ScenarisationStage:associateToProcess" }
methods: GET
# This route add a stage to a process
......
......@@ -27,7 +27,7 @@
<a href="{{ path('scenarisation_stage_edit', { 'id': scenarisationStage.id }) }}">{{'edit'|trans}}</a>
</li>
<li>
<a href="{{ path('scenarisation_stage_process_management', { 'id': scenarisationStage.id }) }}">{{'scenarisationStage.associateToAprocess'|trans }}</a>
<a href="{{ path('scenarisation_stage_associate_to_process', { 'id': scenarisationStage.id }) }}">{{'scenarisationStage.associateToAprocess'|trans }}</a>
</li>
<li>
<a href="{{ path('scenarisation_stage_question_management', { 'id': scenarisationStage.id }) }}">{{ 'scenarisationStage.questionsManagement'|trans }}</a>
......
......@@ -7,9 +7,9 @@
{% if processes is not empty %}
<h2>{{ scenarisationStage.title }}</h2>
<hr/>
{% for process in processes %}
<p>
<a href="{{path('scenarisation_process_stage_management', {'id' : process.id} ) }}">
{{ process.title }}
......@@ -19,25 +19,31 @@
<i class="fa fa-plus" aria-hidden="true"></i>
</a>
</p>
{% if (process.scenarisationStageOrder) is not empty %}
<table id="{{process.id}}" class="table table-striped">
<thead>
<tr>
<th>{{'position'|trans}}</th>
<th>{{'title'|trans}}</th>
</tr>
</thead>
<tbody>
{% for scenarisationStageOrder in process.scenarisationStageOrder %}
<tr>
<td>{{ scenarisationStageOrder.position }}</td>
<td>{{ scenarisationStageOrder.scenarisationStage.title }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p> The scenarisation process is empty </p>
{% endif %}
<table id="{{process.id}}" class="table table-striped">
<thead>
<tr>
<th>{{'position'|trans}}</th>
<th>{{'title'|trans}}</th>
</tr>
</thead>
<tbody>
{% for scenarisationStageOrder in process.scenarisationStageOrder %}
<tr>
<td>{{ scenarisationStageOrder.position }}</td>
<td>{{ scenarisationStageOrder.scenarisationStage.title }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endfor %}
<div class="navigation text-center">
{{ knp_pagination_render(processes) }}
</div>
{% endif %}
<ul>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment