optimisation sur selection du projet associé à une tache (ref #138)

This commit is contained in:
afornerot 2020-06-08 12:13:43 +02:00
parent 6fb6fe6ab1
commit 354d8df055
5 changed files with 23 additions and 7 deletions

View File

@ -359,7 +359,11 @@ class ProjectController extends Controller
if($groups) { if($groups) {
if($groups[0]->getFgcanshare()) { if($groups[0]->getFgcanshare()) {
$pages=$groups[0]->getPages(); $pages=$groups[0]->getPages();
if($pages) $idpage=$pages[0]->getId(); if($pages) {
$idpage=$pages[0]->getId();
$groups=$pages[0]->getGroups();
$idgroup=$groups[0]->getId();
}
} }
} }
} }
@ -428,7 +432,8 @@ class ProjectController extends Controller
'countarticles' => $count, 'countarticles' => $count,
'pagination' => $pagination, 'pagination' => $pagination,
'page' => $page, 'page' => $page,
'idpage' => $idpage 'idpage' => $idpage,
'idgroup' => $idgroup
]); ]);
} }

View File

@ -51,6 +51,11 @@ class ProjecttaskController extends Controller
$entity->setPriority(0); $entity->setPriority(0);
$entity->setPercentage(0); $entity->setPercentage(0);
$pageid=$request->get("page"); $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 = $this->entityForm($entity,$access);
$form->handleRequest($request); $form->handleRequest($request);
@ -82,7 +87,7 @@ class ProjecttaskController extends Controller
if(is_null($pageid)) if(is_null($pageid))
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_projecttask_view',["id"=>$entity->getId()])); return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_projecttask_view',["id"=>$entity->getId()]));
else else
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_page_view',["id"=>$pageid])); return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_page_view',["id"=>$pageid,"usage"=>"group","group"=>$idgroup]));
} }
return $this->render($this->labelentity.':edit.html.twig', [ return $this->render($this->labelentity.':edit.html.twig', [
@ -196,10 +201,15 @@ class ProjecttaskController extends Controller
// On recherche la premiere page associé au groupe du projet // On recherche la premiere page associé au groupe du projet
$groups=$entity->getProject()->getGroups(); $groups=$entity->getProject()->getGroups();
$idpage=null; $idpage=null;
$idgroup=null;
if($groups) { if($groups) {
if($groups[0]->getFgcanshare()) { if($groups[0]->getFgcanshare()) {
$pages=$groups[0]->getPages(); $pages=$groups[0]->getPages();
if($pages) $idpage=$pages[0]->getId(); if($pages) {
$idpage=$pages[0]->getId();
$groups=$pages[0]->getGroups();
$idgroup=$groups[0]->getId();
}
} }
} }
@ -297,6 +307,7 @@ class ProjecttaskController extends Controller
'projecttasks' => $projecttasks, 'projecttasks' => $projecttasks,
'files' => $files, 'files' => $files,
'idpage' => $idpage, 'idpage' => $idpage,
'idgroup' => $idgroup,
]); ]);
} }

View File

@ -81,7 +81,7 @@
{{ projecttask.user.username }} {{ projecttask.user.username }}
{% endif %} {% endif %}
<br>Crée le {{ projecttask.submit|date("d/m/Y à H:i") }} <br>Crée le {{ projecttask.submit|date("d/m/Y à H:i") }}
<br>Dans le project {{projecttask.project.name }} <br>Dans le projet {{projecttask.project.name }}
</div> </div>
<div class="pull-right" style="margin-top:-5px; width:80px; text-align: center;"> <div class="pull-right" style="margin-top:-5px; width:80px; text-align: center;">

View File

@ -15,7 +15,7 @@
<div style="margin:10px 0px 10px 0px; text-align:left; display:inline-block;width:49%"> <div style="margin:10px 0px 10px 0px; text-align:left; display:inline-block;width:49%">
{% if not idpage is empty %} {% if not idpage is empty %}
<a href="{{path('cadoles_portal_user_page_view',{id:idpage})}}" class="btn btn-default">Revenir sur le Groupe</a> <a href="{{path('cadoles_portal_user_page_view',{id:idpage,usage:'group',group:idgroup})}}" class="btn btn-default">Revenir sur le Groupe</a>
{% endif %} {% endif %}
</div> </div>

View File

@ -37,7 +37,7 @@
{% else %} {% else %}
<div style="margin:10px 0px 10px 0px; text-align:left; display:inline-block;width:49%"> <div style="margin:10px 0px 10px 0px; text-align:left; display:inline-block;width:49%">
{% if not idpage is empty %} {% if not idpage is empty %}
<a href="{{path('cadoles_portal_user_page_view',{id:idpage})}}" class="btn btn-default">Revenir sur le Groupe</a> <a href="{{path('cadoles_portal_user_page_view',{id:idpage,usage:'group',group:idgroup})}}" class="btn btn-default">Revenir sur le Groupe</a>
{% endif %} {% endif %}
</div> </div>