Commit 4d76f5e1 authored by Chrystel Moreau's avatar Chrystel Moreau
Browse files

ajout option visualiser parcours participant

parent c43ebef4
......@@ -177,3 +177,7 @@ $container[App\Action\DashboardCloAction::class] = function ($c) {
$container[App\Action\DashboardCloParticipantFormAction::class] = function ($c) {
return new App\Action\DashboardCloParticipantFormAction($c->get('view'), $c->get('logger'), $c->get('em'));
};
$container[App\Action\DashboardCloParticipantParcoursAction::class] = function ($c) {
return new App\Action\DashboardCloParticipantParcoursAction($c->get('view'), $c->get('logger'), $c->get('em'));
};
\ No newline at end of file
......@@ -53,7 +53,7 @@ $app->map(['GET', 'POST'],'/dashboard-participant-sondage-formation', App\Action
$app->get('/dashboard-participant-parcours', App\Action\DashboardParticipantParcoursAction::class)
->add(App\Middleware\TokenMiddleware::class)
->setName('dashboard_participant_sondage');
->setName('dashboard_participant_parcours');
$app->map(['GET', 'POST'],'/dashboard-participant-parcours-formation', App\Action\DashboardParticipantParcoursFormationAction::class)
->add(App\Middleware\TokenMiddleware::class)
......@@ -162,3 +162,6 @@ $app->map(['GET', 'POST', 'PUT'], '/dashboard-clo-participant-form', App\Action\
->add(App\Middleware\TokenMiddleware::class)
->setName('dashboard_clo_participant_form');
$app->get('/dashboard-clo-participant-parcours', App\Action\DashboardCloParticipantParcoursAction::class)
->add(App\Middleware\TokenMiddleware::class)
->setName('dashboard_clo_participant_parcours');
\ No newline at end of file
<?php
namespace App\Action;
use Slim\Views\Twig;
use Psr\Log\LoggerInterface;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
final class DashboardCloParticipantParcoursAction
{
private $view;
private $logger;
private $em;
public function __construct(Twig $view, LoggerInterface $logger, EntityManagerInterface $em)
{
$this->view = $view;
$this->logger = $logger;
$this->em = $em;
}
public function __invoke(Request $request, Response $response, $args)
{
$this->logger->info("dashboard page action dispatched");
$params = $request->getQueryParams();
$token = $params['token'];
$roleSI = $request->getAttribute('roleSI');
if ( ($roleSI != 'admin') && ($roleSI != 'clo') ) {
return $response->withStatus(401);
}
$a = [
'token' => $token
];
if (array_key_exists('id', $params)) {
$participant = $this->em->find('App\Entity\Participant', $params['id']);
$a['participant'] = $participant;
}
else {
return $response->withStatus(400);
}
$a['pa_4_am'] = $this->getParcours('2017-07-04','08:00:00','13:00:00',$participant->getId());
$a['pa_4_pm'] = $this->getParcours('2017-07-04','12:00:00','19:00:00',$participant->getId());
$a['pa_5_am'] = $this->getParcours('2017-07-05','08:00:00','13:00:00',$participant->getId());
$a['pa_5_pm'] = $this->getParcours('2017-07-05','12:00:00','19:00:00',$participant->getId());
$a['pa_6_am'] = $this->getParcours('2017-07-06','08:00:00','13:00:00',$participant->getId());
$a['pa_6_pm'] = $this->getParcours('2017-07-06','12:00:00','19:00:00',$participant->getId());
$a['pa_7_am'] = $this->getParcours('2017-07-07','08:00:00','13:00:00',$participant->getId());
$a['pa_7_pm'] = $this->getParcours('2017-07-07','12:00:00','19:00:00',$participant->getId());
if (array_key_exists('jour', $params)) {
$agendas = $this->getAgendas($params['jour'],$params['debut'],$params['fin'],$participant->getId());
$a['agendas'] = $agendas;
$response = $response->write(json_encode($agendas))->withHeader('Content-type', 'application/json');
}
else {
$this->view->render($response, 'dashboard_clo_participant_parcours.twig', $a);
}
return $response;
}
//select *,
// (select count(*) from participant_x_agenda pa where pa.id_agenda=a.id) as nb_inscrits,
// (select count(*) from participant_x_agenda p2 where p2.id_agenda=a.id and p2.id_participant=100) as check from agenda a;
public function getAgendas($jour,$debut,$fin,$id) {
$date_debut=$jour." ".$debut;
$date_fin=$jour." ".$fin;
$dql = "SELECT a as agenda, ";
$dql .= "(select count(pa) from App\Entity\ParticipantAgenda pa where pa.agenda=a.id) as nb_inscrits, ";
$dql .= "(select count(p2) from App\Entity\ParticipantAgenda p2 where p2.agenda=a.id and p2.participant=$id) as check, ";
$dql .= "(select count(p3) from App\Entity\ParticipantAgenda p3 LEFT JOIN p3.agenda ag where p3.participant=$id and ag.dateDebut between '$date_debut' and '$date_fin' and ag.dateFin between '$date_debut' and '$date_fin' as inscrit ";
$dql .= "FROM App\Entity\Agenda a ";
$dql .= "WHERE a.dateDebut between '$date_debut' and '$date_fin' and a.dateFin between '$date_debut' and '$date_fin'";
$query = $this->em->createQuery($dql);
return $query->getResult();
}
public function getParcours($jour,$debut,$fin,$id) {
$date_debut=$jour." ".$debut;
$date_fin=$jour." ".$fin;
$dql = "SELECT pa FROM App\Entity\ParticipantAgenda pa LEFT JOIN pa.agenda a ";
$dql .= "WHERE pa.participant=$id ";
$dql .= "AND a.dateDebut between '$date_debut' and '$date_fin' and a.dateFin between '$date_debut' and '$date_fin'";
$query = $this->em->createQuery($dql);
return $query->getResult();
}
}
......@@ -45,11 +45,7 @@ final class DashboardParticipantParcoursAction
$a['pa_7_pm'] = $this->getParcours('2017-07-07','12:00:00','19:00:00',$participant->getId());
if (array_key_exists('jour', $params)) {
//$j=explode("-",$params['jour']);
//if ($params['debut'] == '08:00:00'){ $a['jour'] = $j[2].' Juillet 2017 - Matin';}
//if ($params['debut'] == '13:00:00'){ $a['jour'] = $j[2].' Juillet 2017 - Après-midi';}
if (array_key_exists('jour', $params)) {
$agendas = $this->getAgendas($params['jour'],$params['debut'],$params['fin'],$participant->getId());
$a['agendas'] = $agendas;
$response = $response->write(json_encode($agendas))->withHeader('Content-type', 'application/json');
......
......@@ -11,7 +11,7 @@
<a href="dashboard-home?token={{ token }}"><i class="fa fa-home"></i> Home</a>
</li>
<!--
<!--
<li class="navbar-dashboard-item">
<a href="dashboard-participant-sondage?token={{ token }}"><i class="fa fa-address-card-o"></i> Sondage</a>
</li>
......
......@@ -17,7 +17,7 @@
</ul>
</nav>
{% block content_dashboard_admin %}{% endblock %}
{% block content_dashboard_clo %}{% endblock %}
</div>
{% endblock %}
{% extends "base_dashboard_clo.twig" %}
{% block title %}CLO{% endblock %}
{% block content_dashboard_admin %}
<div class="content-dashboard-admin">
{% block content_dashboard_clo %}
<div class="content-dashboard-clo">
<div class="title-main">
<div class="title-main-content">Dashboard CLO Home</div>
</div>
......@@ -13,18 +13,35 @@
<table id="tab-clo-participants" class="table table-striped table-bordered">
<thead>
<tr>
<th>Présence</th>
<th>Participant</th>
<th>Email</th>
<th>Emploi</th>
<th>Statut</th>
<th>Edition</th>
<th>Présence</th>
<th>Parcours</th>
</tr>
</thead>
<tbody>
{% for participant in participants %}
<tr>
<td class="text-center">
{% if participant.getPresent() == true %}
<i class="fa fa-check-circle-o"></i> &nbsp;
<a href="dashboard-clo-participant-form?token={{ token }}&id={{ participant.id }}&present=false"
class="btn btn-danger btn-clo-nopresent fa fa-check-square-o"
data-toggle="tooltip" title="Invalider la presence aux JDEV">
</a>
{% else %}
<a href="dashboard-clo-participant-form?token={{ token }}&id={{ participant.id }}&present=true"
class="btn btn-success btn-clo-present fa fa-check-square-o"
data-toggle="tooltip" title="Valider la presence aux JDEV">
</a>
{% endif %}
</td>
<td>{{ participant.getNom()|upper }} {{ participant.getPrenom() }}</td>
<td><a href="mailto:{{ participant.getEmail() }}"><i class="fa fa-envelope"></i></a></td>
<td>{{ participant.getEmploi() }}</td>
......@@ -43,22 +60,13 @@
data-toggle="tooltip" title="Éditer">
</a>
</td>
<td class="text-center">
{% if participant.getPresent() == true %}
<i class="fa fa-check-circle-o"></i> &nbsp;
<a href="dashboard-clo-participant-form?token={{ token }}&id={{ participant.id }}&present=false"
class="btn btn-danger btn-clo-nopresent fa fa-check-square-o"
data-toggle="tooltip" title="Invalider la presence aux JDEV">
</a>
{% else %}
<a href="dashboard-clo-participant-form?token={{ token }}&id={{ participant.id }}&present=true"
class="btn btn-success btn-clo-present fa fa-check-square-o"
data-toggle="tooltip" title="Valider la presence aux JDEV">
</a>
{% endif %}
</td>
<a href="dashboard-clo-participant-parcours?token={{ token }}&id={{ participant.id }}"
class="btn btn-warning fa fa-calendar btn-info"
data-toggle="tooltip" title="Parcours">
</a>
</td>
</tr>
{% endfor %}
</tbody>
......
{% extends "base_dashboard_clo.twig" %}
{% block title %}CLO{% endblock %}
{% block content_dashboard_admin %}
{% block content_dashboard_clo %}
<div class="content-dashboard-clo">
<div class="title-main">
<div class="title-main-content">
......
{% extends "base_dashboard_clo.twig" %}
{% block title %}CLO{% endblock %}
{% block content_dashboard_clo %}
<div class="content-dashboard-clo">
<div class="title-main">
<div class="title-main-content">Visualisation du parcours de {{ participant.getNom() }}</div>
</div>
<div>
<div id="seances">
Vous devez selectionner une demi-journée pour visualier les sessions de formation.<p>
<form id="form_inscription">
<input type="hidden" id="token" name="token" value="{{ token }}">
<table id="tab_son_parcours" class="table table-bordered">
<thead>
<tr>
<th class="td-parcours">04 Juillet 2017</th>
<th class="td-parcours">05 Juillet 2017</th>
<th class="td-parcours">06 Juillet 2017</th>
<th class="td-parcours">07 Juillet 2017</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="dashboard-participant-parcours?token={{ token }}&jour=2017-07-04&debut=08:00:00&fin=13:00:00" class="btn btn-info btn-sm btn-block btn-jour" value="04 Juillet 2017 - Matin">Matin</a>
{% if pa_4_am %}
{% for p in pa_4_am %}
<b>Formation</b> : {{ p.getAgenda().getFormation().getNom() }}<br>
<b>Horaire</b> : {{ p.getAgenda().getDateDebut() | date("H:i") }} - {{ p.getAgenda().getDateFin() | date("H:i") }}<br>
<b>Salle</b> : {{ p.getAgenda().getSalle().getNom() }}<br>
{% endfor %}
{% else %}
pas d'inscription
{% endif %}
</td>
<td><a href="dashboard-participant-parcours?token={{ token }}&jour=2017-07-05&debut=08:00:00&fin=13:00:00" class="btn btn-info btn-sm btn-block btn-jour" value="05 Juillet 2017 - Matin">Matin</a>
{% if pa_5_am %}
{% for p in pa_5_am %}
<b>Formation</b> : {{ p.getAgenda().getFormation().getNom() }}<br>
<b>Horaire</b> : {{ p.getAgenda().getDateDebut() | date("H:i") }} - {{ p.getAgenda().getDateFin() | date("H:i") }}<br>
<b>Salle</b> : {{ p.getAgenda().getSalle().getNom() }}<br>
{% endfor %}
{% else %}
pas d'inscription
{% endif %}
</td>
<td><a href="dashboard-participant-parcours?token={{ token }}&jour=2017-07-06&debut=08:00:00&fin=13:00:00" class="btn btn-info btn-sm btn-block btn-jour" value="06 Juillet 2017 - Matin">Matin</a>
{% if pa_6_am %}
{% for p in pa_6_am %}
<b>Formation</b> : {{ p.getAgenda().getFormation().getNom() }}<br>
<b>Horaire</b> : {{ p.getAgenda().getDateDebut() | date("H:i") }} - {{ p.getAgenda().getDateFin() | date("H:i") }}<br>
<b>Salle</b> : {{ p.getAgenda().getSalle().getNom() }}<br>
{% endfor %}
{% else %}
pas d'inscription
{% endif %}
</td>
<td><a href="dashboard-participant-parcours?token={{ token }}&jour=2017-07-07&debut=08:00:00&fin=13:00:00" class="btn btn-info btn-sm btn-block btn-jour" value="07 Juillet 2017 - Matin">Matin</a>
{% if pa_7_am %}
{% for p in pa_7_am %}
<b>Formation</b> : {{ p.getAgenda().getFormation().getNom() }}<br>
<b>Horaire</b> : {{ p.getAgenda().getDateDebut() | date("H:i") }} - {{ p.getAgenda().getDateFin() | date("H:i") }}<br>
<b>Salle</b> : {{ p.getAgenda().getSalle().getNom() }}<br>
{% endfor %}
{% else %}
pas d'inscription
{% endif %}
</td>
</tr>
<tr>
<td><a href="dashboard-participant-parcours?token={{ token }}&jour=2017-07-04&debut=13:00:00&fin=19:00:00" class="btn btn-primary btn-sm btn-block btn-jour" value="04 Juillet 2017 - Après-Midi">Après-Midi</a>
{% if pa_4_pm %}
{% for p in pa_4_pm %}
<b>Formation</b> : {{ p.getAgenda().getFormation().getNom() }}<br>
<b>Horaire</b> : {{ p.getAgenda().getDateDebut() | date("H:i") }} - {{ p.getAgenda().getDateFin() | date("H:i") }}<br>
<b>Salle</b> : {{ p.getAgenda().getSalle().getNom() }}<br>
{% endfor %}
{% else %}
pas d'inscription
{% endif %}
</td>
<td><a href="dashboard-participant-parcours?token={{ token }}&jour=2017-07-05&debut=13:00:00&fin=19:00:00" class="btn btn-primary btn-sm btn-block btn-jour" value="05 Juillet 2017 - Après-Midi">Après-Midi</a>
{% if pa_5_pm %}
{% for p in pa_4_pm %}
<b>Formation</b> : {{ p.getAgenda().getFormation().getNom() }}<br>
<b>Horaire</b> : {{ p.getAgenda().getDateDebut() | date("H:i") }} - {{ p.getAgenda().getDateFin() | date("H:i") }}<br>
<b>Salle</b> : {{ p.getAgenda().getSalle().getNom() }}<br>
{% endfor %}
{% else %}
pas d'inscription
{% endif %}
</td>
<td><a href="dashboard-participant-parcours?token={{ token }}&jour=2017-07-06&debut=13:00:00&fin=19:00:00" class="btn btn-primary btn-sm btn-block btn-jour" value="06 Juillet 2017 - Après-Midi">Après-Midi</a>
{% if pa_6_pm %}
{% for p in pa_6_pm %}
<b>Formation</b> : {{ p.getAgenda().getFormation().getNom() }}<br>
<b>Horaire</b> : {{ p.getAgenda().getDateDebut() | date("H:i") }} - {{ p.getAgenda().getDateFin() | date("H:i") }}<br>
<b>Salle</b> : {{ p.getAgenda().getSalle().getNom() }}<br>
{% endfor %}
{% else %}
pas d'inscription
{% endif %}
</td>
<td><a href="dashboard-participant-parcours?token={{ token }}&jour=2017-07-07&debut=13:00:00&fin=19:00:00" class="btn btn-primary btn-sm btn-block btn-jour" value="07 Juillet 2017 - Après-Midi">Après-Midi</a>
{% if pa_7_pm %}
{% for p in pa_7_pm %}
<b>Formation</b> : {{ p.getAgenda().getFormation().getNom() }}<br>
<b>Horaire</b> : {{ p.getAgenda().getDateDebut() | date("H:i") }} - {{ p.getAgenda().getDateFin() | date("H:i") }}<br>
<b>Salle</b> : {{ p.getAgenda().getSalle().getNom() }}<br>
{% endfor %}
{% else %}
pas d'inscription
{% endif %}
</td>
</tr>
</tbody>
</table>
</form>
</div>
<hr>
<div class="panel panel-default" id="inscription" style="display:none">
<div class="panel-heading" id="panel-inscription"></div>
<div class="panel-body">
<div id="chart-legend" class="chart-legend"></div>
<canvas id="plot" data-type="Line" width="500" height="350"></canvas>
</div>
</div>
<div class="modal fade" id="participant_inscription" role="dialog" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="titre_modal"></h4>
</div>
<div class="modal-body" id="body_modal">
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</div>
<center>
<a href="dashboard-clo?token={{ token }}" id="btn-back-clo-participants" class="btn btn-snow">
Retour liste des participants
</a>
</center>
</div>
{% endblock %}
\ No newline at end of file
......@@ -2,11 +2,8 @@
{% block title %}CLOAdmin{% endblock %}
{% block content_dashboard_cloadmin %}
{% if role == 'admin' %}
<div class="content-dashboard-admin">
{% else %}
<div class="content-dashboard-clo-admin">
{% endif %}
<div class="title-main">
<div class="title-main-content">Dashboard CLO-ADMIN</div>
</div>
......
......@@ -61,9 +61,19 @@ $(document).ready(function() {
});
}
});
$('#tab-clo-participants').DataTable( {
dom: 'ilfrtp'
});
$('#tab_son_parcours').DataTable({
"dom": 't',
"ordering": false
} );
});
......
......@@ -52,13 +52,6 @@ $(document).ready(function(){
// Gestion du parcours
// ======================================================================
$('#tab_mon_parcours').DataTable({
"dom": 'Bt',
buttons: [
{extend: 'excel',text: 'Enregistrer votre parcours au format Excel',filename:'jdev2017-parcours'}
],
"ordering": false
} );
$('.btn-inscription-formation').on('click', function(e) {
e.preventDefault();
......@@ -95,6 +88,15 @@ $(document).ready(function(){
});
$('#tab_mon_parcours').DataTable({
"dom": 'Bt',
buttons: [
{extend: 'excel',text: 'Enregistrer votre parcours au format Excel',filename:'jdev2017-parcours'}
],
"ordering": false
} );
// Gestion via ChartJS
var ctx = document.getElementById("plot");
var myBarChart=null;
......
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