Commit fddf1c9e authored by Chrystel Moreau's avatar Chrystel Moreau
Browse files

add version dans les setting + gestion des options selon la version

parent a0103d82
......@@ -98,7 +98,7 @@ $container[App\Action\DashboardParticipantPresenceAction::class] = function ($c)
// Dashboard Admin
// =============================================================
$container[App\Action\DashboardAdminAction::class] = function ($c) {
return new App\Action\DashboardAdminAction($c->get('view'), $c->get('logger'), $c->get('em'));
return new App\Action\DashboardAdminAction($c->get('view'), $c->get('logger'), $c->get('em'), $c->get('settings'));
};
$container[App\Action\AdminValidRoleAction::class] = function ($c) {
......@@ -114,19 +114,19 @@ $container[App\Action\DashboardAdminInscriptionAction::class] = function ($c) {
};
$container[App\Action\DashboardAdminFormationAction::class] = function ($c) {
return new App\Action\DashboardAdminFormationAction($c->get('view'), $c->get('logger'), $c->get('em'));
return new App\Action\DashboardAdminFormationAction($c->get('view'), $c->get('logger'), $c->get('em'), $c->get('settings'));
};
$container[App\Action\DashboardAdminFormationFormAction::class] = function ($c) {
return new App\Action\DashboardAdminFormationFormAction($c->get('view'), $c->get('logger'), $c->get('em'));
return new App\Action\DashboardAdminFormationFormAction($c->get('view'), $c->get('logger'), $c->get('em'), $c->get('settings'));
};
$container[App\Action\DashboardAdminRoleAction::class] = function ($c) {
return new App\Action\DashboardAdminRoleAction($c->get('view'), $c->get('logger'), $c->get('em'));
return new App\Action\DashboardAdminRoleAction($c->get('view'), $c->get('logger'), $c->get('em'), $c->get('settings'));
};
$container[App\Action\DashboardAdminRoleFormAction::class] = function ($c) {
return new App\Action\DashboardAdminRoleFormAction($c->get('view'), $c->get('logger'), $c->get('em'));
return new App\Action\DashboardAdminRoleFormAction($c->get('view'), $c->get('logger'), $c->get('em'), $c->get('settings'));
};
$container[App\Action\DashboardAdminPreAgendaAction::class] = function ($c) {
......@@ -146,15 +146,15 @@ $container[App\Action\DashboardAdminAgendaFormAction::class] = function ($c) {
};
$container[App\Action\DashboardAdminOrganismeAction::class] = function ($c) {
return new App\Action\DashboardAdminOrganismeAction($c->get('view'), $c->get('logger'), $c->get('em'));
return new App\Action\DashboardAdminOrganismeAction($c->get('view'), $c->get('logger'), $c->get('em'), $c->get('settings'));
};
$container[App\Action\DashboardAdminParticipantGestionAction::class] = function ($c) {
return new App\Action\DashboardAdminParticipantGestionAction($c->get('view'), $c->get('logger'), $c->get('em'));
return new App\Action\DashboardAdminParticipantGestionAction($c->get('view'), $c->get('logger'), $c->get('em'), $c->get('settings'));
};
$container[App\Action\DashboardAdminParticipantFormAction::class] = function ($c) {
return new App\Action\DashboardAdminParticipantFormAction($c->get('view'), $c->get('logger'), $c->get('em'));
return new App\Action\DashboardAdminParticipantFormAction($c->get('view'), $c->get('logger'), $c->get('em'), $c->get('settings'));
};
......@@ -185,15 +185,15 @@ $container[App\Action\AdminValidPaiementAction::class] = function ($c) {
};
$container[App\Action\DashboardAdminSalleAction::class] = function ($c) {
return new App\Action\DashboardAdminSalleAction($c->get('view'), $c->get('logger'), $c->get('em'));
return new App\Action\DashboardAdminSalleAction($c->get('view'), $c->get('logger'), $c->get('em'), $c->get('settings'));
};
$container[App\Action\DashboardAdminAddEditSalleAction::class] = function ($c) {
return new App\Action\DashboardAdminAddEditSalleAction($c->get('view'), $c->get('logger'), $c->get('em'));
return new App\Action\DashboardAdminAddEditSalleAction($c->get('view'), $c->get('logger'), $c->get('em'), $c->get('settings'));
};
$container[App\Action\DashboardAdminThematiqueAction::class] = function ($c) {
return new App\Action\DashboardAdminThematiqueAction($c->get('view'), $c->get('logger'), $c->get('em'));
return new App\Action\DashboardAdminThematiqueAction($c->get('view'), $c->get('logger'), $c->get('em'), $c->get('settings'));
};
$container[App\Action\DashboardAdminThematiquePreAgendaAction::class] = function ($c) {
......@@ -205,7 +205,7 @@ $container[App\Action\DashboardAdminThematiqueAgendaAction::class] = function ($
};
$container[App\Action\DashboardAdminOrganismeFormAction::class] = function ($c) {
return new App\Action\DashboardAdminOrganismeFormAction($c->get('view'), $c->get('logger'), $c->get('em'));
return new App\Action\DashboardAdminOrganismeFormAction($c->get('view'), $c->get('logger'), $c->get('em'), $c->get('settings'));
};
$container[App\Action\DashboardAdminSessionPreAgendaAction::class] = function ($c) {
......
......@@ -25,27 +25,28 @@ return [
'dev_mode' => true,
'connection_options' => [
'driver' => 'pdo_pgsql',
'host' => 'cencosdev.oamp.lan', // cencosdev.oamp.lan
'host' => 'cencosdev.oamp.lan', // cencosdev.oamp.lan (dev), cesamdb.oamp.lan (prod)
'user' => 'jdev',
'password' => 'jdev2017',
'dbname' => 'jdev2017'
]
],
'mailer' => [
'host' => 'localhost', //localhost, smtp.osupytheas.fr
'port' => 1025 // 1025, 25
'host' => 'localhost', //localhost (dev), smtp.osupytheas.fr (prod)
'port' => 1025 // 1025 (dev), 25 (prod)
],
// JDEV settings
'jdev' => [
'label' => 'JDEV2017',
'url' => 'jdev2017.fr',
'email' => 'jdev2017-inscription@services.cnrs.fr',
'email' => 'jdev2017-inscription@univ-amu.fr',
'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',
'version' => 3, // 1 version de base, 2 version avec le sondage actif, 3 version avec racap sondage & parcours, 4 version durant les JDEVs
]
]
];
......@@ -22,14 +22,13 @@ final class DashboardAction
$this->settings = $settings;
}
public function __invoke(Request $request, Response $response, $args)
public function __invoke(Request $request, Response $response, $args)
{
$this->logger->info("dashboard page action dispatched");
$params = $request->getQueryParams();
$token = $params['token'];
$email = $request->getAttribute('email');
$participant = $this->getParticipant($email);
$this->view->render($response, 'dashboard_home.twig', [
......
......@@ -12,23 +12,26 @@ final class DashboardAdminAction
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->view = $view;
$this->logger = $logger;
$this->em = $em;
$this->settings = $settings;
}
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 != 'admin') && ($roleSI != 'clo_admin') ){
if ( ($roleSI != 'admin') && ($roleSI != 'clo_admin') && ($roleSI != 'clo') && ($roleSI != 'clo_pgm') ){
return $response->withStatus(401);
}
......@@ -44,7 +47,8 @@ final class DashboardAdminAction
'organisateurs' => $organisateurs,
'invites' => $invites,
'sponsors' => $sponsors,
'exposants' => $exposants
'exposants' => $exposants,
'jdev' => $this->settings['jdev']
]);
return $response;
......
......@@ -9,18 +9,21 @@ use Psr\Http\Message\ResponseInterface as Response;
final class DashboardAdminAddEditSalleAction
{
private $view;
private $logger;
private $em;
private $view;
private $logger;
private $em;
private $settings;
public function __construct(Twig $view, LoggerInterface $logger, EntityManagerInterface $em, $settings)
{
$this->view = $view;
$this->logger = $logger;
$this->em = $em;
$this->settings = $settings;
}
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)
public function __invoke(Request $request, Response $response, $args)
{
$this->logger->info("dashboard admin add edit salle page action dispatched");
......@@ -36,7 +39,8 @@ final class DashboardAdminAddEditSalleAction
$a = [
'page' => 'dashboard-admin-add-edit-salle',
'token' => $token,
'role_si'=> $roleSI
'role_si'=> $roleSI,
'jdev' => $this->settings['jdev']
];
if (array_key_exists('salle_id', $params)) {
$salle = $this->em->find('App\Entity\Salle', $params['salle_id']);
......
......@@ -75,9 +75,8 @@ final class DashboardAdminAnnulerSessionAction
{
$body = 'Bonjour ' . $participant->getPrenom() . ' ' . $participant->getNom() . PHP_EOL;
$body .= PHP_EOL;
$body .= 'La formation ' . $agenda->getFormation()->getNom() . ' (' . $agenda->getDateDebut()->format('d-m-Y H:i') . ' - ' . $agenda->getDateFin()->format('d-m-Y H:i') . ') vient d\'être annulée.' . PHP_EOL;
$body .= 'Vous n\'avez donc plus d\'inscription à une formation dans ce créneau horaire. ';
$body .= 'Vous pouvez vous reinscrire dans une autre formation si vous le souhaitez ';
$body .= 'La session de formation ' . $agenda->getFormation()->getNom() . ' (' . $agenda->getDateDebut()->format('d-m-Y H:i') . ' - ' . $agenda->getDateFin()->format('d-m-Y H:i') . ') vient d\'être annulée.' . PHP_EOL;
$body .= 'Vous pouvez vous inscrire dans une autre session de formation si vous le souhaitez ';
$body .= PHP_EOL;
$body .= 'Bien cordialement' . PHP_EOL;
$body .= 'Le comité d\'organisation des ' . $this->settings['jdev']['label'];
......
......@@ -12,13 +12,15 @@ final class DashboardAdminFormationAction
private $view;
private $logger;
private $em;
public function __construct(Twig $view, LoggerInterface $logger, EntityManagerInterface $em)
private $settings;
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,8 @@ final class DashboardAdminFormationAction
'page' => 'dashboard-admin-formation',
'token' => $token,
'role_si'=> $roleSI,
'formations' => $formations
'formations' => $formations,
'jdev' => $this->settings['jdev']
]);
......
......@@ -12,13 +12,15 @@ final class DashboardAdminFormationFormAction
private $view;
private $logger;
private $em;
public function __construct(Twig $view, LoggerInterface $logger, EntityManagerInterface $em)
private $settings;
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)
......@@ -40,7 +42,8 @@ final class DashboardAdminFormationFormAction
'page' => 'dashboard',
'token' => $token,
'role_si'=> $roleSI,
'thematiques' => $thematiques
'thematiques' => $thematiques,
'jdev' => $this->settings['jdev']
];
if (array_key_exists('formation_id', $params)) {
$formation = $this->em->find('App\Entity\Formation', $params['formation_id']);
......
......@@ -12,13 +12,15 @@ final class DashboardAdminOrganismeAction
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,8 @@ final class DashboardAdminOrganismeAction
'page' => 'dashboard-admin-organisme',
'token' => $token,
'role_si'=> $roleSI,
'organismes' => $organismes
'organismes' => $organismes,
'jdev' => $this->settings['jdev']
]);
return $response;
......@@ -46,7 +49,7 @@ final class DashboardAdminOrganismeAction
private function getOrganismes()
{
$dql = "SELECT o FROM App\Entity\Organisme o ORDER BY o.nbPlaces DESC";
$dql = "SELECT o FROM App\Entity\Organisme o ORDER BY o.nbPlaces DESC,o.label";
$query = $this->em->createQuery($dql);
return $query->getResult();
}
......
......@@ -12,12 +12,14 @@ final class DashboardAdminOrganismeFormAction
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)
......@@ -36,7 +38,8 @@ final class DashboardAdminOrganismeFormAction
$a = [
'page' => 'dashboard',
'token' => $token,
'role_si'=> $roleSI
'role_si'=> $roleSI,
'jdev' => $this->settings['jdev']
];
if (array_key_exists('organisme_id', $params)) {
$organisme = $this->em->find('App\Entity\Organisme', $params['organisme_id']);
......
......@@ -12,13 +12,15 @@ final class DashboardAdminParticipantFormAction
private $view;
private $logger;
private $em;
public function __construct(Twig $view, LoggerInterface $logger, EntityManagerInterface $em)
private $settings;
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)
......@@ -36,7 +38,8 @@ final class DashboardAdminParticipantFormAction
if($request->isGet()) {
$a = [
'token' => $token,
'role_si'=> $roleSI
'role_si'=> $roleSI,
'jdev' => $this->settings['jdev']
];
if (array_key_exists('id', $params)) {
......
......@@ -12,12 +12,14 @@ final class DashboardAdminParticipantGestionAction
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->view = $view;
$this->logger = $logger;
$this->em = $em;
$this->settings = $settings;
}
public function __invoke(Request $request, Response $response, $args)
......@@ -38,7 +40,8 @@ final class DashboardAdminParticipantGestionAction
'page' => 'dashboard-admin-participant-gestion',
'token' => $token,
'role_si'=> $roleSI,
'participants' => $participants
'participants' => $participants,
'jdev' => $this->settings['jdev']
]);
return $response;
......
......@@ -12,12 +12,14 @@ final class DashboardAdminRoleAction
private $view;
private $logger;
private $em;
public function __construct(Twig $view, LoggerInterface $logger, EntityManagerInterface $em)
private $settings;
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)
......@@ -40,7 +42,8 @@ final class DashboardAdminRoleAction
'token' => $token,
'role_si'=> $roleSI,
'organisateurs' => $organisateurs,
'roles' => $roles
'roles' => $roles,
'jdev' => $this->settings['jdev']
]);
......
......@@ -12,15 +12,16 @@ final class DashboardAdminRoleFormAction
private $view;
private $logger;
private $em;
public function __construct(Twig $view, LoggerInterface $logger, EntityManagerInterface $em)
private $settings;
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)
{
$this->logger->info("dashboard page action dispatched");
......@@ -37,7 +38,8 @@ final class DashboardAdminRoleFormAction
$a = [
'page' => 'dashboard',
'token' => $token,
'role_si'=> $roleSI
'role_si'=> $roleSI,
'jdev' => $this->settings['jdev']
];
if (array_key_exists('role_id', $params)) {
$role = $this->em->find('App\Entity\Role', $params['role_id']);
......
......@@ -9,18 +9,20 @@ use Psr\Http\Message\ResponseInterface as Response;
final class DashboardAdminSalleAction
{
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 __invoke(Request $request, Response $response, $args)
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)
{
$this->logger->info("dashboard admin salle page action dispatched");
......@@ -38,7 +40,8 @@ final class DashboardAdminSalleAction
'page' => 'dashboard-admin-salle',
'token' => $token,
'role_si'=> $roleSI,
'salles' => $salles
'salles' => $salles,
'jdev' => $this->settings['jdev']
]);
return $response;
......
......@@ -12,12 +12,14 @@ final class DashboardAdminThematiqueAction
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->view = $view;
$this->logger = $logger;
$this->em = $em;
$this->settings = $settings;
}
public function __invoke(Request $request, Response $response, $args)
......@@ -38,7 +40,8 @@ final class DashboardAdminThematiqueAction
'page' => 'dashboard-admin-thematique',
'token' => $token,
'role_si'=> $roleSI,
'thematiques' => $thematiques
'thematiques' => $thematiques,
'jdev' => $this->settings['jdev']
]);
return $response;
......
......@@ -2,21 +2,20 @@
{% block title %}Participant{% endblock %}
{% block content %}
<div class="container">
{% set version = 3 %}
<div class="container">
<div class="visible-xs-block visible-sm-block btn-group btn-group-justified navbar-jdev-dashboard-xs" role="group">
<a class="btn btn-default" href="dashboard-home?token={{ token }}">Home</a>
<a class="btn btn-default" href="dashboard-participant-sondage?token={{ token }}">Sondage</a>
{% if jdev.version >= 2 %}
<a class="btn btn-default" href="dashboard-participant-sondage?token={{ token }}">Sondage</a>
{% endif %}
{% if jdev.version >= 3 %}
<a class="btn btn-default" href="dashboard-participant-agenda?token={{ token }}">Agenda JDEVs</a>
<a class="btn btn-default" href="dashboard-participant-parcours?token={{ token }}">Parcours</a>
{% endif %}
<a class="btn btn-default" href="dashboard-participant-agenda?token={{ token }}">Agenda JDEVs</a>
{% if version == 3 %}
<a class="btn btn-default" href="dashboard-participant-parcours?token={{ token }}">Mon Parcours</a>
{% if jdev.version >= 4 %}
<a class="btn btn-default" href="dashboard-participant-presence?token={{ token }}">Présence</a>
{% endif %}
<!--
<a class="btn btn-default" href="dashboard-participant-presence?token={{ token }}">Présence</a>
-->
</div>
<nav class="hidden-xs hidden-sm navbar-dashboard">
......@@ -25,13 +24,14 @@
<li class="navbar-dashboard-item active">
<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 }}"
data-toggle="tooltip" data-placement="bottom" title="Visualisation de votre sondage">
<i class="fa fa-calendar-o"></i> Sondage</a>
</li>
{% if version == 3 %}
{% if jdev.version >= 2 %}
<li class="navbar-dashboard-item">
<a href="dashboard-participant-sondage?token={{ token }}"
data-toggle="tooltip" data-placement="bottom" title="Visualisation de votre sondage">
<i class="fa fa-calendar-o"></i> Sondage</a>
</li>
{% endif %}
{% if jdev.version >= 3 %}
<li class="navbar-dashboard-item">
<a href="dashboard-participant-agenda?token={{ token }}"