Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
jdev
jdev-boarding
Commits
9cd14650
Commit
9cd14650
authored
Feb 14, 2017
by
François Agneray
Browse files
Admin validation des roles
parent
76636681
Changes
10
Hide whitespace changes
Inline
Side-by-side
app/actions.php
View file @
9cd14650
...
...
@@ -77,6 +77,10 @@ $container[App\Action\DashboardAdminAction::class] = function ($c) {
return
new
App\Action\DashboardAdminAction
(
$c
->
get
(
'view'
),
$c
->
get
(
'logger'
),
$c
->
get
(
'em'
));
};
$container
[
App\Action\AdminValidRoleAction
::
class
]
=
function
(
$c
)
{
return
new
App\Action\AdminValidRoleAction
(
$c
->
get
(
'view'
),
$c
->
get
(
'logger'
),
$c
->
get
(
'em'
),
$c
->
get
(
'mailer'
));
};
$container
[
App\Action\DashboardAdminInscriptionAction
::
class
]
=
function
(
$c
)
{
return
new
App\Action\DashboardAdminInscriptionAction
(
$c
->
get
(
'view'
),
$c
->
get
(
'logger'
),
$c
->
get
(
'em'
));
};
...
...
app/routes.php
View file @
9cd14650
...
...
@@ -56,6 +56,10 @@ $app->get('/dashboard-admin', App\Action\DashboardAdminAction::class)
->
add
(
App\Middleware\TokenMiddleware
::
class
)
->
setName
(
'dashboard_admin_home'
);
$app
->
post
(
'/admin-valid-role'
,
App\Action\AdminValidRoleAction
::
class
)
->
add
(
App\Middleware\TokenMiddleware
::
class
)
->
setName
(
'admin_valid_role'
);
$app
->
get
(
'/dashboard-admin-inscription'
,
App\Action\DashboardAdminInscriptionAction
::
class
)
->
add
(
App\Middleware\TokenMiddleware
::
class
)
->
setName
(
'dashboard_admin_inscription'
);
...
...
app/src/Action/AdminValidRoleAction.php
0 → 100644
View file @
9cd14650
<?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
AdminValidRoleAction
{
private
$view
;
private
$logger
;
private
$em
;
private
$mailer
;
public
function
__construct
(
Twig
$view
,
LoggerInterface
$logger
,
EntityManagerInterface
$em
,
$mailer
)
{
$this
->
view
=
$view
;
$this
->
logger
=
$logger
;
$this
->
em
=
$em
;
$this
->
mailer
=
$mailer
;
}
public
function
__invoke
(
Request
$request
,
Response
$response
,
$args
)
{
$this
->
logger
->
info
(
"admin valid role page action dispatched"
);
$params
=
$request
->
getQueryParams
();
$token
=
$params
[
'token'
];
$roleSI
=
$request
->
getAttribute
(
'roleSI'
);
if
(
$roleSI
!=
'admin'
)
{
return
$response
->
withStatus
(
401
);
}
if
(
!
array_key_exists
(
'email'
,
$params
))
{
return
$response
->
withStatus
(
400
);
}
$participant
=
$this
->
getParticipant
(
$params
[
'email'
]);
if
(
!
$participant
)
{
return
$response
->
withStatus
(
400
);
}
$participant
->
setCloValide
(
true
);
$participant
->
setAccesValide
(
true
);
$this
->
em
->
flush
();
$this
->
sendEmail
(
$participant
);
return
$response
;
}
private
function
getParticipant
(
$email
)
{
$participant
=
$this
->
em
->
getRepository
(
'App\Entity\Participant'
)
->
findOneBy
(
array
(
'email'
=>
strtolower
(
$email
)));
if
(
isset
(
$participant
))
{
return
$participant
;
}
else
{
return
true
;
}
}
private
function
sendEmail
(
$participant
)
{
$body
=
'Bonjour '
.
$participant
->
getPrenom
()
.
' '
.
$participant
->
getNom
()
.
PHP_EOL
;
$body
.
=
PHP_EOL
;
$body
.
=
'Votre compte vient d\'être validé par un membre du comité d\'organisation des JDEV2017.'
.
PHP_EOL
;
$body
.
=
PHP_EOL
;
$body
.
=
'Bien cordialement'
.
PHP_EOL
;
$body
.
=
'Le comité d\'ogranisation des JDEV2017'
;
$message
=
\
Swift_Message
::
newInstance
(
'Validation inscription JDEV2017'
)
->
setFrom
([
'contact@jdev2017.fr'
=>
'jdev2017.fr'
])
->
setTo
([
$participant
->
getEmail
()])
->
setBody
(
$body
);
$this
->
mailer
->
send
(
$message
);
}
}
app/src/Action/DashboardAdminAction.php
View file @
9cd14650
...
...
@@ -58,7 +58,7 @@ final class DashboardAdminAction
private
function
getInvites
()
{
$dql
=
"SELECT p FROM App\Entity\Participant p WHERE p.role = 'Invit
e
' ORDER BY p.dateInscription DESC"
;
$dql
=
"SELECT p FROM App\Entity\Participant p WHERE p.role = 'Invit
é
' ORDER BY p.dateInscription DESC"
;
$query
=
$this
->
em
->
createQuery
(
$dql
);
return
$query
->
getResult
();
}
...
...
app/src/Action/InscriptionAction.php
View file @
9cd14650
...
...
@@ -372,7 +372,7 @@ final class InscriptionAction
$body
.
=
'Bien cordialement'
.
PHP_EOL
;
$body
.
=
'Le comité d\'ogranisation des JDEV2017'
;
$message
=
\
Swift_Message
::
newInstance
(
'
Bienvenue
'
)
$message
=
\
Swift_Message
::
newInstance
(
'
Confirmation inscription aux JDEV 2017
'
)
->
setFrom
([
'contact@jdev2017.fr'
=>
'jdev2017.fr'
])
->
setTo
([
$participant
->
getEmail
()])
->
setBody
(
$body
);
...
...
app/templates/base.twig
View file @
9cd14650
...
...
@@ -87,5 +87,6 @@
<script
src=
"bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js"
></script>
<script
src=
"js/inscription.js"
></script>
<script
src=
"js/connexion.js"
></script>
<script
src=
"js/admin.js"
></script>
</body>
</html>
app/templates/dashboard_admin_home.twig
View file @
9cd14650
...
...
@@ -27,7 +27,7 @@
<td>
{%
if
organisateur.getCloValide
()
==
true
%}
<i
class=
"fa fa-check-square-o"
></i>
{%
else
%}
<a
href=
"valid-clo?email=
{{
organisateur.getEmail
()
}}
&valid=true"
class=
"btn btn-success
"
><i
class=
"fa fa-check-square-o"
></i></a>
{%
endif
%}
<a
class=
"btn btn-success admin-valid-btn"
href=
"admin-valid-role?token=
{{
token
}}
&email=
{{
organisateur.getEmail
()
}}
"
><i
class=
"fa fa-check-square-o"
></i></a>
{%
endif
%}
</td>
</tr>
{%
endfor
%}
...
...
@@ -57,7 +57,7 @@
<td>
{%
if
invite.getCloValide
()
==
true
%}
<i
class=
"fa fa-check-square-o"
></i>
{%
else
%}
<a
href=
"valid-clo?email=
{{
invite.getEmail
()
}}
&valid=true"
class=
"btn btn-success
"
><i
class=
"fa fa-check-square-o"
></i></a>
<a
class=
"btn btn-success admin-valid-btn"
href=
"admin-valid-role?token=
{{
token
}}
&email=
{{
invite.getEmail
()
}}
"
><i
class=
"fa fa-check-square-o"
></i></a>
{%
endif
%}
</td>
</tr>
...
...
@@ -77,7 +77,7 @@
<tr>
<td>
Nom Prénom
</td>
<td
width=
"40%"
>
Email
</td>
<td
width=
"20%"
>
Type de PASS
</td>
<td
width=
"20%"
>
Statut
</td>
</tr>
</thead>
<tbody>
...
...
@@ -85,7 +85,12 @@
<tr>
<td>
{{
sponsor.getNom
()
}}
{{
sponsor.getPrenom
()
}}
</td>
<td>
{{
sponsor.getEmail
()
}}
</td>
<td>
{{
sponsor.getTypeInscription
()
}}
</td>
<td>
{%
if
sponsor.getCloValide
()
==
true
%}
<i
class=
"fa fa-check-square-o"
></i>
{%
else
%}
<a
class=
"btn btn-success admin-valid-btn"
href=
"admin-valid-role?token=
{{
token
}}
&email=
{{
sponsor.getEmail
()
}}
"
><i
class=
"fa fa-check-square-o"
></i></a>
{%
endif
%}
</td>
</tr>
{%
endfor
%}
</tbody>
...
...
@@ -111,7 +116,12 @@
<tr>
<td>
{{
exposant.getNom
()
}}
{{
exposant.getPrenom
()
}}
</td>
<td>
{{
exposant.getEmail
()
}}
</td>
<td>
{{
sponsor.getTypeInscription
()
}}
</td>
<td>
{%
if
exposant.getCloValide
()
==
true
%}
<i
class=
"fa fa-check-square-o"
></i>
{%
else
%}
<a
class=
"btn btn-success admin-valid-btn"
href=
"admin-valid-role?token=
{{
token
}}
&email=
{{
exposant.getEmail
()
}}
"
><i
class=
"fa fa-check-square-o"
></i></a>
{%
endif
%}
</td>
</tr>
{%
endfor
%}
</tbody>
...
...
app/templates/dashboard_home.twig
View file @
9cd14650
...
...
@@ -14,13 +14,17 @@
Vous recevrez trés prochainement un e-mail pour vous prévenir de la validation de votre compte.
</p>
{%
elseif
participant.getPassPrepaye
()
%}
<h4><i
class=
"fa fa-check-square-o"
></i>
Votre
inscription
</h4>
<p>
Nous avons acté votre inscription aux JDEV2017.
<br>
<h4><i
class=
"fa fa-check-square-o"
></i>
Droits d'
inscription
validés
</h4>
<p>
Nous avons acté votre inscription aux JDEV2017
en tant que
{{
participant.getRole
()
}}
.
<br>
Vos frais d'inscription sont pris en charge par votre organisme.
</p>
{%
elseif
participant.getAccesValide
()
%}
<h4><i
class=
"fa fa-check-square-o"
></i>
Droits d'inscription validés
</h4>
<p>
Nous avons acté votre inscription aux JDEV2017 en tant que
{{
participant.getRole
()
}}
.
<br></p>
{%
else
%}
<h4><i
class=
"fa fa-credit-card"
></i>
Finaliser votre inscription
</h4>
<p>
Pour que votre inscription soit prise en compte,
<p>
Nous avons acté votre inscription aux JDEV2017 en tant que
{{
participant.getRole
()
}}
avec un
{{
participant.getTypeInscription
()
}}
.
Cependant pour que votre inscription soit prise en compte,
vous devez la finaliser par le paiement des frais d'inscription sur
la plate-forme
<a
href=
"https://www.azur-colloque.fr/DR12/"
target=
"_blank"
>
AZUR-COLLOQUE
</a>
avant la clôture des inscriptions au 30 mai 2017.
<br>
...
...
@@ -29,7 +33,7 @@
</p>
{%
endif
%}
{%
if
participant.get
Clo
Valide
()
%}
{%
if
participant.get
Acces
Valide
()
%}
<hr>
<h4><i
class=
"fa fa-info-circle"
></i>
Les frais d'inscription couvrent les prestations suivantes
</h4>
<ul>
...
...
public/js/admin.js
0 → 100644
View file @
9cd14650
$
(
document
).
ready
(
function
()
{
$
(
'
.admin-valid-btn
'
).
on
(
'
click
'
,
function
(
e
)
{
e
.
preventDefault
();
var
href
=
$
(
this
).
attr
(
'
href
'
);
$
.
ajax
({
url
:
href
,
type
:
'
POST
'
,
success
:
function
(
text
)
{
location
.
reload
();
},
error
:
function
()
{
alert
(
'
Problème serveur !
'
);
}
});
});
});
\ No newline at end of file
public/js/inscription.js
View file @
9cd14650
...
...
@@ -93,38 +93,38 @@ $(document).ready(function() {
});
var
changePass
=
function
()
{
var
role
=
$
(
'
input[name="role"]:checked
'
).
val
();
var
statut
=
$
(
'
#statut
'
).
val
();
var
role
=
$
(
'
input[name="role"]:checked
'
).
val
();
var
statut
=
$
(
'
#statut
'
).
val
();
switch
(
role
)
{
case
'
Participant
'
:
$
(
'
#type_inscription option
'
).
remove
();
$
(
'
#type_inscription
'
).
append
(
'
<option value="PASS COMPLET">PASS COMPLET</option>
'
);
if
(
statut
==
'
INDUSTRIEL
'
)
{
$
(
'
#type_inscription
'
).
append
(
'
<option value="PASS LIBRE">PASS LIBRE</option>
'
);
}
break
;
case
'
Accompagnant
'
:
$
(
'
#type_inscription option
'
).
remove
();
$
(
'
#type_inscription
'
).
append
(
'
<option value="PASS ACCOMPAGNANT">PASS ACCOMPAGNANT</option>
'
);
break
;
case
'
Organisateur
'
:
$
(
'
#type_inscription option
'
).
remove
();
$
(
'
#type_inscription
'
).
append
(
'
<option value="PASS SPECIAL">PASS SPECIAL</option>
'
);
break
;
case
'
Invite
'
:
$
(
'
#type_inscription option
'
).
remove
();
$
(
'
#type_inscription
'
).
append
(
'
<option value="PASS INVITE">PASS INVITE</option>
'
);
break
;
case
'
Exposant
'
:
$
(
'
#type_inscription option
'
).
remove
();
switch
(
role
)
{
case
'
Participant
'
:
$
(
'
#type_inscription option
'
).
remove
();
$
(
'
#type_inscription
'
).
append
(
'
<option value="PASS COMPLET">PASS COMPLET</option>
'
);
if
(
statut
==
'
INDUSTRIEL
'
)
{
$
(
'
#type_inscription
'
).
append
(
'
<option value="PASS LIBRE">PASS LIBRE</option>
'
);
break
;
case
'
Sponsor
'
:
$
(
'
#type_inscription option
'
).
remove
();
$
(
'
#type_inscription
'
).
append
(
'
<option value="PASS SPONSOR">PASS SPONSOR</option>
'
);
break
;
default
:
break
;
}
}
\ No newline at end of file
}
break
;
case
'
Accompagnant
'
:
$
(
'
#type_inscription option
'
).
remove
();
$
(
'
#type_inscription
'
).
append
(
'
<option value="PASS ACCOMPAGNANT">PASS ACCOMPAGNANT</option>
'
);
break
;
case
'
Organisateur
'
:
$
(
'
#type_inscription option
'
).
remove
();
$
(
'
#type_inscription
'
).
append
(
'
<option value="PASS SPECIAL">PASS SPECIAL</option>
'
);
break
;
case
'
Invité
'
:
$
(
'
#type_inscription option
'
).
remove
();
$
(
'
#type_inscription
'
).
append
(
'
<option value="PASS INVITE">PASS INVITE</option>
'
);
break
;
case
'
Exposant
'
:
$
(
'
#type_inscription option
'
).
remove
();
$
(
'
#type_inscription
'
).
append
(
'
<option value="PASS LIBRE">PASS LIBRE</option>
'
);
break
;
case
'
Sponsor
'
:
$
(
'
#type_inscription option
'
).
remove
();
$
(
'
#type_inscription
'
).
append
(
'
<option value="PASS SPONSOR">PASS SPONSOR</option>
'
);
break
;
default
:
break
;
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment