redirection vers le groupe après signature de la charte

This commit is contained in:
afornerot 2021-05-21 11:00:34 +02:00
parent 2b4d048f9d
commit 2679d8f629
3 changed files with 10 additions and 5 deletions

View File

@ -59,17 +59,18 @@ class CoreController extends Controller
// Chargement des chartes à signer // Chargement des chartes à signer
if($user) { if($user) {
$notices=$em->getRepository("CadolesPortalBundle:Notice")->getNoticeToRead($user); $notices=$em->getRepository("CadolesPortalBundle:Notice")->getNoticeToRead($user);
if(! $notices->isEmpty()) { if(! $notices->isEmpty()) {
$notices=$em->getRepository("CadolesPortalBundle:Notice")->getNoticeUser($user,false); $notices=$em->getRepository("CadolesPortalBundle:Notice")->getNoticeUser($user,false);
return $this->render('CadolesPortalBundle:Notice:mustread.html.twig',[ return $this->render('CadolesPortalBundle:Notice:mustread.html.twig',[
'useheader' => true, 'useheader' => true,
'usemenu' => false, 'usemenu' => false,
'usesidebar' => false, 'usesidebar' => false,
'maxwidth' => true, 'maxwidth' => true,
'mustread' => true, 'mustread' => true,
'notices' => $notices 'notices' => $notices,
'id' => $id,
]); ]);
} }

View File

@ -210,6 +210,10 @@ class NoticeController extends Controller
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$user=$this->getUser(); $user=$this->getUser();
$notices=$em->getRepository("CadolesPortalBundle:Notice")->getNoticeToRead($user); $notices=$em->getRepository("CadolesPortalBundle:Notice")->getNoticeToRead($user);
// Récupération redirection potentielle
$id = $request->get('id');
foreach($notices as $notice) { foreach($notices as $notice) {
$users=$notice->getUsers(); $users=$notice->getUsers();
@ -223,7 +227,7 @@ class NoticeController extends Controller
} }
} }
return $this->redirectToRoute("cadoles_core_home"); return $this->redirectToRoute("cadoles_core_home",["id"=>$id]);
} }
public function viewAction(Request $request) { public function viewAction(Request $request) {

View File

@ -18,7 +18,7 @@
{% endfor %} {% endfor %}
<form name="toread" method="post"> <form name="toread" method="post">
<input style="float:left; zoom:1.7;margin:5px 0px 0px 0px;" type="checkbox" id="readcharte" name="readcharte" value="0"> <input style="float:left; zoom:1.7;margin:5px 0px 0px 0px;" type="checkbox" id="readcharte" name="readcharte" value="0">
<span style="float:left; zoom: 1.7;margin-top: 3px;">Accepter la charte d'utilisation</span> <span style="float:left; zoom: 1.7;margin-top: 3px;">Accepter la charte d'utilisation</span>
</form> </form>
@ -37,7 +37,7 @@
function haveRead() { function haveRead() {
if($("#readcharte").val()=="1") { if($("#readcharte").val()=="1") {
document.location.href ="{{ path("cadoles_portal_user_notice_haveread") }}"; document.location.href ="{{ path("cadoles_portal_user_notice_haveread",{id:id}) }}";
} }
} }
{% endblock %} {% endblock %}