Commit 5aaf5e52 authored by Chrystel Moreau's avatar Chrystel Moreau
Browse files

merge des base_dashboard ADMIN/CLO/CLO_ADMIN

parent 5c2bf392
......@@ -57,15 +57,15 @@ $container[App\Action\ConnexionAction::class] = function ($c) {
// =============================================================
$container[App\Action\DashboardAction::class] = function ($c) {
return new App\Action\DashboardAction($c->get('view'), $c->get('logger'), $c->get('em'));
return new App\Action\DashboardAction($c->get('view'), $c->get('logger'), $c->get('em'), $c->get('settings'));
};
$container[App\Action\DashboardParticipantSondageAction::class] = function ($c) {
return new App\Action\DashboardParticipantSondageAction($c->get('view'), $c->get('logger'), $c->get('em'));
return new App\Action\DashboardParticipantSondageAction($c->get('view'), $c->get('logger'), $c->get('em'), $c->get('settings'));
};
$container[App\Action\DashboardParticipantSondageFormationAction::class] = function ($c) {
return new App\Action\DashboardParticipantSondageFormationAction($c->get('view'), $c->get('logger'), $c->get('em'));
return new App\Action\DashboardParticipantSondageFormationAction($c->get('view'), $c->get('logger'), $c->get('em'), $c->get('settings'));
};
......@@ -115,29 +115,43 @@ $container[App\Action\DashboardAdminRoleFormAction::class] = function ($c) {
};
$container[App\Action\DashboardAdminPreAgendaAction::class] = function ($c) {
return new App\Action\DashboardAdminPreAgendaAction($c->get('view'), $c->get('logger'), $c->get('em'));
return new App\Action\DashboardAdminPreAgendaAction($c->get('view'), $c->get('logger'), $c->get('em'), $c->get('settings'));
};
$container[App\Action\DashboardAdminPreAgendaFormAction::class] = function ($c) {
return new App\Action\DashboardAdminPreAgendaFormAction($c->get('view'), $c->get('logger'), $c->get('em'));
return new App\Action\DashboardAdminPreAgendaFormAction($c->get('view'), $c->get('logger'), $c->get('em'), $c->get('settings'));
};
$container[App\Action\DashboardAdminAgendaAction::class] = function ($c) {
return new App\Action\DashboardAdminAgendaAction($c->get('view'), $c->get('logger'), $c->get('em'));
return new App\Action\DashboardAdminAgendaAction($c->get('view'), $c->get('logger'), $c->get('em'), $c->get('settings'));
};
$container[App\Action\DashboardAdminAgendaFormAction::class] = function ($c) {
return new App\Action\DashboardAdminAgendaFormAction($c->get('view'), $c->get('logger'), $c->get('em'));
return new App\Action\DashboardAdminAgendaFormAction($c->get('view'), $c->get('logger'), $c->get('em'), $c->get('settings'));
};
$container[App\Action\DashboardAdminOrganismeAction::class] = function ($c) {
return new App\Action\DashboardAdminOrganismeAction($c->get('view'), $c->get('logger'), $c->get('em'));
};
$container[App\Action\DashboardAdminParticipantAction::class] = function ($c) {
return new App\Action\DashboardAdminParticipantAction($c->get('view'), $c->get('logger'), $c->get('em'));
$container[App\Action\DashboardAdminParticipantGestionAction::class] = function ($c) {
return new App\Action\DashboardAdminParticipantGestionAction($c->get('view'), $c->get('logger'), $c->get('em'));
};
$container[App\Action\DashboardAdminParticipantFormAction::class] = function ($c) {
return new App\Action\DashboardAdminParticipantFormAction($c->get('view'), $c->get('logger'), $c->get('em'));
};
$container[App\Action\DashboardAdminParticipantParcoursAction::class] = function ($c) {
return new App\Action\DashboardAdminParticipantParcoursAction($c->get('view'), $c->get('logger'), $c->get('em'));
};
$container[App\Action\DashboardAdminPaiementAction::class] = function ($c) {
return new App\Action\DashboardAdminPaiementAction($c->get('view'), $c->get('logger'), $c->get('em'));
};
$container[App\Action\DashboardAdminSalleAction::class] = function ($c) {
return new App\Action\DashboardAdminSalleAction($c->get('view'), $c->get('logger'), $c->get('em'));
};
......@@ -157,27 +171,20 @@ $container[App\Action\DashboardAdminOrganismeFormAction::class] = function ($c)
// =============================================================
// Dashboard CLO-Admin
// =============================================================
$container[App\Action\DashboardCloAdminAction::class] = function ($c) {
return new App\Action\DashboardCloAdminAction($c->get('view'), $c->get('logger'), $c->get('em'));
};
//$container[App\Action\DashboardCloAdminAction::class] = function ($c) {
// return new App\Action\DashboardCloAdminAction($c->get('view'), $c->get('logger'), $c->get('em'));
//};
$container[App\Action\AdminValidPaiementAction::class] = function ($c) {
return new App\Action\AdminValidPaiementAction($c->get('view'), $c->get('logger'), $c->get('em'), $c->get('mailer'), $c->get('settings'));
};
//$container[App\Action\AdminValidPaiementAction::class] = function ($c) {
// return new App\Action\AdminValidPaiementAction($c->get('view'), $c->get('logger'), $c->get('em'), $c->get('mailer'), $c->get('settings'));
//};
// =============================================================
// Dashboard CLO
// =============================================================
$container[App\Action\DashboardCloAction::class] = function ($c) {
return new App\Action\DashboardCloAction($c->get('view'), $c->get('logger'), $c->get('em'));
};
$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
//$container[App\Action\DashboardCloAction::class] = function ($c) {
// return new App\Action\DashboardCloAction($c->get('view'), $c->get('logger'), $c->get('em'));
//};
;
\ No newline at end of file
......@@ -116,9 +116,24 @@ $app->get('/dashboard-admin-organisme', App\Action\DashboardAdminOrganismeAction
->add(App\Middleware\TokenMiddleware::class)
->setName('dashboard_admin_organisme');
$app->get('/dashboard-admin-participant', App\Action\DashboardAdminParticipantAction::class)
$app->get('/dashboard-admin-participant-gestion', App\Action\DashboardAdminParticipantGestionAction::class)
->add(App\Middleware\TokenMiddleware::class)
->setName('dashboard_admin_participant');
->setName('dashboard_admin_participant_gestion');
$app->map(['GET', 'POST', 'PUT'], '/dashboard-admin-participant-form', App\Action\DashboardAdminParticipantFormAction::class)
->add(App\Middleware\TokenMiddleware::class)
->setName('dashboard_admin_participant_form');
$app->get('/dashboard-admin-participant-parcours', App\Action\DashboardAdminParticipantParcoursAction::class)
->add(App\Middleware\TokenMiddleware::class)
->setName('dashboard_admin_participant_parcours');
$app->get('/dashboard-admin-paiement', App\Action\DashboardAdminPaiementAction::class)
->add(App\Middleware\TokenMiddleware::class)
->setName('dashboard_admin_paiement');
$app->get('/dashboard-admin-salle', App\Action\DashboardAdminSalleAction::class)
->add(App\Middleware\TokenMiddleware::class)
......@@ -157,11 +172,3 @@ $app->post('/admin-valid-paiement', App\Action\AdminValidPaiementAction::class)
$app->get('/dashboard-clo', App\Action\DashboardCloAction::class)
->add(App\Middleware\TokenMiddleware::class)
->setName('dashboard_clo_home');
$app->map(['GET', 'POST', 'PUT'], '/dashboard-clo-participant-form', App\Action\DashboardCloParticipantFormAction::class)
->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
......@@ -40,8 +40,12 @@ return [
'label' => 'JDEV2017',
'url' => 'jdev2017.fr',
'email' => 'jdev2017-inscription@services.cnrs.fr',
'date_debut' => '04/07/2017',
'date_fin' => '07/07/2017'
'date_debut' => '2017-07-04', //'04/07/2017',
'date_fin' => '2017-07-07', //'07/07/2017',
'j1' => '2017-07-04',
'j2' => '2017-07-05',
'j3' => '2017-07-06',
'j4' => '2017-07-07',
]
]
];
......@@ -9,16 +9,18 @@ use Psr\Http\Message\ResponseInterface as Response;
final class DashboardAction
{
private $view;
private $logger;
private $em;
private $view;
private $logger;
private $em;
private $settings;
public function __construct(Twig $view, LoggerInterface $logger, EntityManagerInterface $em)
{
$this->view = $view;
$this->logger = $logger;
$this->em = $em;
}
public function __construct(Twig $view, LoggerInterface $logger, EntityManagerInterface $em, $settings)
{
$this->view = $view;
$this->logger = $logger;
$this->em = $em;
$this->settings = $settings;
}
public function __invoke(Request $request, Response $response, $args)
{
......@@ -33,7 +35,8 @@ final class DashboardAction
$this->view->render($response, 'dashboard_home.twig', [
'page' => 'dashboard',
'token' => $token,
'participant' => $participant
'participant' => $participant,
'jdev' => $this->settings['jdev']
]);
return $response;
......
......@@ -40,6 +40,7 @@ final class DashboardAdminAction
$this->view->render($response, 'dashboard_admin_home.twig', [
'page' => 'dashboard-admin',
'token' => $token,
'role_si'=> $roleSI,
'organisateurs' => $organisateurs,
'invites' => $invites,
'sponsors' => $sponsors,
......
......@@ -34,8 +34,9 @@ final class DashboardAdminAddEditSalleAction
if($request->isGet()) {
$a = [
'page' => 'dashboard-admin-add-edit-salle',
'token' => $token
'page' => 'dashboard-admin-add-edit-salle',
'token' => $token,
'role_si'=> $roleSI
];
if (array_key_exists('salle_id', $params)) {
$salle = $this->em->find('App\Entity\Salle', $params['salle_id']);
......
......@@ -12,12 +12,14 @@ final class DashboardAdminAgendaAction
private $view;
private $logger;
private $em;
private $settings;
public function __construct(Twig $view, LoggerInterface $logger, EntityManagerInterface $em)
public function __construct(Twig $view, LoggerInterface $logger, EntityManagerInterface $em, $settings)
{
$this->view = $view;
$this->logger = $logger;
$this->em = $em;
$this->settings = $settings;
}
public function __invoke(Request $request, Response $response, $args)
......@@ -33,15 +35,17 @@ final class DashboardAdminAgendaAction
}
$a = [
'page' => 'dashboard-participant-sondage',
'token' => $token
'token' => $token,
'role_si'=> $roleSI,
'jdev' => $this->settings['jdev']
];
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';}
$a['jour'] = $params['jour'];
if ($params['debut'] == '08:00:00'){ $a['journee'] = ' - Matin';}
if ($params['debut'] == '13:00:00'){ $a['journee'] = ' - Après-midi';}
$agendas = $this->getAgendas($params['jour'],$params['debut'],$params['fin']);
$a['agendas'] = $agendas;
......
......@@ -12,12 +12,14 @@ final class DashboardAdminAgendaFormAction
private $view;
private $logger;
private $em;
private $settings;
public function __construct(Twig $view, LoggerInterface $logger, EntityManagerInterface $em)
public function __construct(Twig $view, LoggerInterface $logger, EntityManagerInterface $em, $settings)
{
$this->view = $view;
$this->logger = $logger;
$this->em = $em;
$this->settings = $settings;
}
public function __invoke(Request $request, Response $response, $args)
......@@ -38,7 +40,9 @@ final class DashboardAdminAgendaFormAction
$a = [
'page' => 'dashboard',
'token' => $token,
'formations' => $formations
'role_si'=> $roleSI,
'formations' => $formations,
'jdev' => $this->settings['jdev']
];
if (array_key_exists('agenda_id', $params)) {
......
......@@ -37,6 +37,7 @@ final class DashboardAdminFormationAction
$this->view->render($response, 'dashboard_admin_formation.twig', [
'page' => 'dashboard-admin-formation',
'token' => $token,
'role_si'=> $roleSI,
'formations' => $formations
]);
......
......@@ -39,6 +39,7 @@ final class DashboardAdminFormationFormAction
$a = [
'page' => 'dashboard',
'token' => $token,
'role_si'=> $roleSI,
'thematiques' => $thematiques
];
if (array_key_exists('formation_id', $params)) {
......
......@@ -37,6 +37,7 @@ final class DashboardAdminOrganismeAction
$this->view->render($response, 'dashboard_admin_organisme.twig', [
'page' => 'dashboard-admin-organisme',
'token' => $token,
'role_si'=> $roleSI,
'organismes' => $organismes
]);
......
......@@ -35,7 +35,8 @@ final class DashboardAdminOrganismeFormAction
if($request->isGet()) {
$a = [
'page' => 'dashboard',
'token' => $token
'token' => $token,
'role_si'=> $roleSI
];
if (array_key_exists('organisme_id', $params)) {
$organisme = $this->em->find('App\Entity\Organisme', $params['organisme_id']);
......
<?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 DashboardAdminPaiementAction
{
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 admin page action dispatched");
$params = $request->getQueryParams();
$token = $params['token'];
$roleSI = $request->getAttribute('roleSI');
if ( ($roleSI != 'clo_admin') && ($roleSI != 'admin') ){
return $response->withStatus(401);
}
$participants = $this->getParticipants();
$this->view->render($response, 'dashboard_admin_paiement.twig', [
'page' => 'dashboard-admin-paiement',
'token' => $token,
'role_si'=> $roleSI,
'participants' => $participants
]);
return $response;
}
private function getParticipants()
{
$dql = "SELECT p FROM App\Entity\Participant p WHERE p.role = 'Participant' and p.emailValide='t' ORDER BY p.nom";
$query = $this->em->createQuery($dql);
return $query->getResult();
}
}
<?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 DashboardAdminParticipantFormAction
{
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);
}
if($request->isGet()) {
$a = [
'token' => $token,
'role_si'=> $roleSI
];
if (array_key_exists('id', $params)) {
$participant = $this->em->find('App\Entity\Participant', $params['id']);
$a['participant'] = $participant;
}
else {
return $response->withStatus(400);
}
if (array_key_exists('present', $params)) {
$valid=$params['present'];
if ($valid == 'true') {
$participant->setPresent(true);
}
if ($valid == 'false') {
$participant->setPresent(false);
}
$this->em->flush();
$this->view->render($response, 'dashboard_admin_participant_gestion.twig', $a);
}
else {
$this->view->render($response, 'dashboard_admin_participant_form.twig', $a);
}
}
if($request->isPut()) {
$parsedBody = $request->getParsedBody();
$participant = $this->em->find('App\Entity\Participant', $parsedBody['participant_id']);
$participant->setNom($parsedBody['nom']);
$participant->setPrenom($parsedBody['prenom']);
$participant->setStatut($parsedBody['statut']);
$participant->setEmploi($parsedBody['emploi']);
$organisme = $this->em->find('App\Entity\Organisme', $parsedBody['organisme']);
$participant->setOrganisme($organisme);
$participant->setUnite($parsedBody['unite']);
$participant->setRole($parsedBody['role']);
$participant->setRegion($parsedBody['region']);
if (isset($parsedBody['mailing_list']) && $parsedBody['mailing_list'] == 'on') {
$participant->setMailingList(true);
} else {
$participant->setMailingList(false);
}
if (isset($parsedBody['evenement_social']) && $parsedBody['evenement_social'] == 'on') {
$participant->setEvenementSocial(true);
} else {
$participant->setEvenementSocial(false);
}
$this->em->flush();
$response = $response->write('Participant id=' . $participant->getId() . ' modifié')->withStatus(201);
}
return $response;
}
}
......@@ -7,7 +7,7 @@ use Doctrine\ORM\EntityManagerInterface;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
final class DashboardAdminParticipantAction
final class DashboardAdminParticipantGestionAction
{
private $view;
private $logger;
......@@ -28,15 +28,16 @@ final class DashboardAdminParticipantAction
$token = $params['token'];
$roleSI = $request->getAttribute('roleSI');
if ($roleSI != 'admin') {
return $response->withStatus(401);
if (($roleSI != 'clo') && ($roleSI != 'admin') ){
return $response->withStatus(401);
}
$participants = $this->getParticipants();
$this->view->render($response, 'dashboard_admin_participant.twig', [
'page' => 'dashboard-admin-participant',
$this->view->render($response, 'dashboard_admin_participant_gestion.twig', [
'page' => 'dashboard-admin-participant-gestion',
'token' => $token,
'role_si'=> $roleSI,
'participants' => $participants
]);
......@@ -49,5 +50,5 @@ final class DashboardAdminParticipantAction
$query = $this->em->createQuery($dql);
return $query->getResult();
}
}
<?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 DashboardAdminParticipantParcoursAction
{
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,
'role_si'=> $roleSI
];
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