diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/BlogController.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/BlogController.php index 255f8aa5..1d1953b9 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/BlogController.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/BlogController.php @@ -352,6 +352,23 @@ class BlogController extends Controller if (!$entity) throw $this->createNotFoundException('Unable to find entity.'); } + // On recherche la premiere page associé au groupe du blog + $idpage=null; + $idgroup=null; + if($id!=0) { + $groups=$entity->getGroups(); + if($groups[0]) { + if($groups[0]->getFgcanshare()) { + $pages=$groups[0]->getPages(); + if($pages) { + $idpage=$pages[0]->getId(); + $groups=$pages[0]->getGroups(); + $idgroup=$groups[0]->getId(); + } + } + } + } + // Permissions $user=$this->getUser(); if($access=="config") { @@ -402,7 +419,9 @@ class BlogController extends Controller 'blogs' => $blogs, 'countarticles' => $count, 'pagination' => $pagination, - 'page' => $page + 'page' => $page, + 'idpage' => $idpage, + 'idgroup' => $idgroup ]); } diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/BlogarticleController.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/BlogarticleController.php index af464a4a..f30d3d98 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/BlogarticleController.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/BlogarticleController.php @@ -44,6 +44,13 @@ class BlogarticleController extends Controller $entity = new Blogarticle(); $blog=$em->getRepository("CadolesPortalBundle:Blog")->find($idblog); if($blog) $entity->setBlog($blog); + + $pageid=$request->get("page"); + if($pageid) { + $page=$em->getRepository("CadolesPortalBundle:Page")->find($pageid); + $groups=$page->getGroups(); + $idgroup=$groups[0]->getId(); + } $form = $this->entityForm($entity,$access); $form->handleRequest($request); @@ -68,7 +75,10 @@ class BlogarticleController extends Controller } } - return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_blogarticle_view',["id"=>$entity->getId()])); + if(is_null($pageid)) + return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_blogarticle_view',["id"=>$entity->getId()])); + else + return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_page_view',["id"=>$pageid,"usage"=>"group","group"=>$idgroup])); } return $this->render($this->labelentity.':edit.html.twig', [ @@ -79,7 +89,8 @@ class BlogarticleController extends Controller 'entity' => $entity, 'mode' => "submit", 'access' => $access, - 'form' => $form->createView() + 'form' => $form->createView(), + 'pageid' => $pageid ]); } @@ -160,6 +171,21 @@ class BlogarticleController extends Controller $entity = $em->getRepository($this->labelentity)->find($id); if (!$entity) throw $this->createNotFoundException('Unable to find entity.'); + // On recherche la premiere page associé au groupe du blog + $groups=$entity->getBlog()->getGroups(); + $idpage=null; + $idgroup=null; + if($groups[0]) { + if($groups[0]->getFgcanshare()) { + $pages=$groups[0]->getPages(); + if($pages) { + $idpage=$pages[0]->getId(); + $groups=$pages[0]->getGroups(); + $idgroup=$groups[0]->getId(); + } + } + } + // Permissions $user=$this->getUser(); if($access=="config") { @@ -200,7 +226,9 @@ class BlogarticleController extends Controller 'canupdate' => $canupdate, 'canadd' => $canadd, 'blogs' => $blogs, - 'blogarticles' => $blogarticles + 'blogarticles' => $blogarticles, + 'idpage' => $idpage, + 'idgroup' => $idgroup, ]); } diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/CalendarController.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/CalendarController.php index 5a8b7eff..48f3fd6a 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/CalendarController.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/CalendarController.php @@ -332,6 +332,23 @@ class CalendarController extends Controller if (!$entity) throw $this->createNotFoundException('Unable to find entity.'); } + // On recherche la premiere page associé au groupe du calendrier + $idpage=null; + $idgroup=null; + if($id!=0) { + $groups=$entity->getGroups(); + if($groups[0]) { + if($groups[0]->getFgcanshare()) { + $pages=$groups[0]->getPages(); + if($pages) { + $idpage=$pages[0]->getId(); + $groups=$pages[0]->getGroups(); + $idgroup=$groups[0]->getId(); + } + } + } + } + // Permissions if($access=="config") { $canupdate = true; @@ -371,7 +388,10 @@ class CalendarController extends Controller 'entity' => $entity, 'access' => $access, 'canupdate' => $canupdate, - 'calendars' => $calendars + 'calendars' => $calendars, + 'idpage' => $idpage, + 'idgroup' => $idgroup + ]); } diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/ProjectController.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/ProjectController.php index fbdc9164..896560e0 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/ProjectController.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/ProjectController.php @@ -354,9 +354,10 @@ class ProjectController extends Controller // On recherche la premiere page associé au groupe du projet $idpage=null; + $idgroup=null; if($id!=0) { $groups=$entity->getGroups(); - if($groups) { + if($groups[0]) { if($groups[0]->getFgcanshare()) { $pages=$groups[0]->getPages(); if($pages) { diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/ProjecttaskController.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/ProjecttaskController.php index 063af716..5e629360 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/ProjecttaskController.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/ProjecttaskController.php @@ -202,7 +202,7 @@ class ProjecttaskController extends Controller $groups=$entity->getProject()->getGroups(); $idpage=null; $idgroup=null; - if($groups) { + if($groups[0]) { if($groups[0]->getFgcanshare()) { $pages=$groups[0]->getPages(); if($pages) { diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Blog/view.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Blog/view.html.twig index af11487b..559e32d5 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Blog/view.html.twig +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Blog/view.html.twig @@ -11,7 +11,12 @@ {% else %} -
+
+ {% if not idpage is empty %} + Revenir sur le Groupe + {% endif %} +
+