retour sur page groupe blog et calendrier (ref #168)

This commit is contained in:
afornerot 2020-06-23 14:53:16 +02:00
parent be3cfa2814
commit 8f85f5eb5e
13 changed files with 124 additions and 26 deletions

View File

@ -352,6 +352,23 @@ class BlogController extends Controller
if (!$entity) throw $this->createNotFoundException('Unable to find entity.'); 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 // Permissions
$user=$this->getUser(); $user=$this->getUser();
if($access=="config") { if($access=="config") {
@ -402,7 +419,9 @@ class BlogController extends Controller
'blogs' => $blogs, 'blogs' => $blogs,
'countarticles' => $count, 'countarticles' => $count,
'pagination' => $pagination, 'pagination' => $pagination,
'page' => $page 'page' => $page,
'idpage' => $idpage,
'idgroup' => $idgroup
]); ]);
} }

View File

@ -44,6 +44,13 @@ class BlogarticleController extends Controller
$entity = new Blogarticle(); $entity = new Blogarticle();
$blog=$em->getRepository("CadolesPortalBundle:Blog")->find($idblog); $blog=$em->getRepository("CadolesPortalBundle:Blog")->find($idblog);
if($blog) $entity->setBlog($blog); 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 = $this->entityForm($entity,$access);
$form->handleRequest($request); $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', [ return $this->render($this->labelentity.':edit.html.twig', [
@ -79,7 +89,8 @@ class BlogarticleController extends Controller
'entity' => $entity, 'entity' => $entity,
'mode' => "submit", 'mode' => "submit",
'access' => $access, '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); $entity = $em->getRepository($this->labelentity)->find($id);
if (!$entity) throw $this->createNotFoundException('Unable to find entity.'); 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 // Permissions
$user=$this->getUser(); $user=$this->getUser();
if($access=="config") { if($access=="config") {
@ -200,7 +226,9 @@ class BlogarticleController extends Controller
'canupdate' => $canupdate, 'canupdate' => $canupdate,
'canadd' => $canadd, 'canadd' => $canadd,
'blogs' => $blogs, 'blogs' => $blogs,
'blogarticles' => $blogarticles 'blogarticles' => $blogarticles,
'idpage' => $idpage,
'idgroup' => $idgroup,
]); ]);
} }

View File

@ -332,6 +332,23 @@ class CalendarController extends Controller
if (!$entity) throw $this->createNotFoundException('Unable to find entity.'); 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 // Permissions
if($access=="config") { if($access=="config") {
$canupdate = true; $canupdate = true;
@ -371,7 +388,10 @@ class CalendarController extends Controller
'entity' => $entity, 'entity' => $entity,
'access' => $access, 'access' => $access,
'canupdate' => $canupdate, 'canupdate' => $canupdate,
'calendars' => $calendars 'calendars' => $calendars,
'idpage' => $idpage,
'idgroup' => $idgroup
]); ]);
} }

View File

@ -354,9 +354,10 @@ class ProjectController extends Controller
// On recherche la premiere page associé au groupe du projet // On recherche la premiere page associé au groupe du projet
$idpage=null; $idpage=null;
$idgroup=null;
if($id!=0) { if($id!=0) {
$groups=$entity->getGroups(); $groups=$entity->getGroups();
if($groups) { if($groups[0]) {
if($groups[0]->getFgcanshare()) { if($groups[0]->getFgcanshare()) {
$pages=$groups[0]->getPages(); $pages=$groups[0]->getPages();
if($pages) { if($pages) {

View File

@ -202,7 +202,7 @@ class ProjecttaskController extends Controller
$groups=$entity->getProject()->getGroups(); $groups=$entity->getProject()->getGroups();
$idpage=null; $idpage=null;
$idgroup=null; $idgroup=null;
if($groups) { if($groups[0]) {
if($groups[0]->getFgcanshare()) { if($groups[0]->getFgcanshare()) {
$pages=$groups[0]->getPages(); $pages=$groups[0]->getPages();
if($pages) { if($pages) {

View File

@ -11,7 +11,12 @@
<a href='{{ path('cadoles_portal_config_blog_delete', { id: entity.id }) }}' data-method='delete' data-confirm='Êtes-vous sûr de vouloir supprimer ?' title='Supprimer'><i class='fa fa-trash fa-fw'></i></a> <a href='{{ path('cadoles_portal_config_blog_delete', { id: entity.id }) }}' data-method='delete' data-confirm='Êtes-vous sûr de vouloir supprimer ?' title='Supprimer'><i class='fa fa-trash fa-fw'></i></a>
</div> </div>
{% else %} {% else %}
<br> <div style="margin:10px 0px 10px 0px; text-align:left;height:34px;">
{% if not idpage is empty %}
<a href="{{path('cadoles_portal_user_page_view',{id:idpage,usage:'group',group:idgroup})}}" class="btn btn-success">Revenir sur le Groupe</a>
{% endif %}
</div>
<ul class="nav navbar-default nav-pills"> <ul class="nav navbar-default nav-pills">
<li id="menublog-0" class="{% if entity.id is not defined %}active{%endif%}" style="cursor:pointer"> <li id="menublog-0" class="{% if entity.id is not defined %}active{%endif%}" style="cursor:pointer">
<a href="{{ path("cadoles_portal_user_blog_view") }}"> <a href="{{ path("cadoles_portal_user_blog_view") }}">

View File

@ -19,7 +19,11 @@
{% set blogid=entity.blog.id %} {% set blogid=entity.blog.id %}
{%endif%} {%endif%}
<a class="btn btn-default" href='{{ path('cadoles_portal_'~access~'_blog_view',{'id':blogid})}}'>Annuler</a> {% if pageid is empty %}
<a class="btn btn-default" href='{{ path('cadoles_portal_'~access~'_blog_view',{'id':blogid})}}'>Annuler</a>
{% else %}
<a class="btn btn-default" href="{{path('cadoles_core_home',{id:pageid})}}" target="_top">Annuler</a>
{% endif %}
{% endif %} {% endif %}
{% if mode=="update" %} {% if mode=="update" %}

View File

@ -31,7 +31,12 @@
<a href="{{ path('cadoles_portal_config_blog_view', {id:entity.blog.id})}}">{{ entity.blog.name }}</a> <a href="{{ path('cadoles_portal_config_blog_view', {id:entity.blog.id})}}">{{ entity.blog.name }}</a>
</div> </div>
{% else %} {% else %}
<br> <div style="margin:10px 0px 10px 0px; text-align:left; height:34px">
{% if not idpage is empty %}
<a href="{{path('cadoles_portal_user_page_view',{id:idpage,usage:'group',group:idgroup})}}" class="btn btn-success">Revenir sur le Groupe</a>
{% endif %}
</div>
<ul class="nav navbar-default nav-pills"> <ul class="nav navbar-default nav-pills">
<li id="menublog-0" class="{% if entity.id is not defined %}active{%endif%}" style="cursor:pointer"> <li id="menublog-0" class="{% if entity.id is not defined %}active{%endif%}" style="cursor:pointer">
<a href="{{ path("cadoles_portal_user_blog_view") }}"> <a href="{{ path("cadoles_portal_user_blog_view") }}">

View File

@ -10,24 +10,36 @@
<a href='{{ path('cadoles_portal_config_calendar_delete', { id: entity.id }) }}' data-method='delete' data-confirm='Êtes-vous sûr de vouloir supprimer ?' title='Supprimer le panel'><i class='fa fa-trash fa-fw'></i></a> <a href='{{ path('cadoles_portal_config_calendar_delete', { id: entity.id }) }}' data-method='delete' data-confirm='Êtes-vous sûr de vouloir supprimer ?' title='Supprimer le panel'><i class='fa fa-trash fa-fw'></i></a>
</div> </div>
{% else %} {% else %}
<br> <div style="margin:10px 0px 10px 0px; text-align:left;height:34px;">
{% if not idpage is empty %}
<a href="{{path('cadoles_portal_user_page_view',{id:idpage,usage:'group',group:idgroup})}}" class="btn btn-success">Revenir sur le Groupe</a>
{% endif %}
</div>
<ul class="nav navbar-default nav-pills"> <ul class="nav navbar-default nav-pills">
<li id="menucalendar-0" class="{% if entity.id is not defined %}active{%endif%}" style="cursor:pointer"><a onClick="showCalendar(0,{{ canupdate }})">Tout</a></li> <li id="menucalendar-0" class="{% if entity.id is not defined %}active{%endif%}" style="cursor:pointer">
<a href="{{ path("cadoles_portal_user_calendar_view") }}">
Tout
</a>
</li>
{% for calendar in calendars %} {% for calendar in calendars %}
<li id="menucalendar-{{calendar.id}}" data-open="{% if calendar.canupdate %}true{%endif%}" class="{% if entity.id is defined and entity.id==calendar.id%}active{%endif%}" style="cursor:pointer"> <li id="menucalendar-{{calendar.id}}" data-open="{% if calendar.canupdate %}true{%endif%}" class="{% if entity.id is defined and entity.id==calendar.id%}active{%endif%}" style="cursor:pointer">
<a onClick="showCalendar({{ calendar.id }},{{ calendar.canupdate }})">
<a href="{{ path("cadoles_portal_user_calendar_view",{'id':calendar.id}) }}">
{% if not calendar.groups is empty %} {% if not calendar.groups is empty %}
<i class="fa fa-users fa-fw"></i> <i class="fa fa-users fa-fw"></i>
{% elseif app.user==calendar.user %} {% elseif app.user==calendar.user %}
<i class="fa fa-user fa-fw"></i> <i class="fa fa-user fa-fw"></i>
{%endif%} {%endif%}
{{ calendar.name }} {{ calendar.name }}
{% if not calendar.canupdate %} {% if calendar.canupdate %}
<i class="fa fa-pencil"></i>
{% else %}
<i class="fa fa-lock"></i> <i class="fa fa-lock"></i>
{% endif %} {% endif %}
</a> </a>
</li> </li>
{% endfor %} {% endfor %}

View File

@ -29,11 +29,12 @@
<a title="Gérer mes Blogs" href='{{ path('cadoles_portal_config_blog') }}' style="{{ stylewidgetmenu }}"><i class="fa fa-plus fa-fw"></i></a> <a title="Gérer mes Blogs" href='{{ path('cadoles_portal_config_blog') }}' style="{{ stylewidgetmenu }}"><i class="fa fa-plus fa-fw"></i></a>
{% else %} {% else %}
{% set idblog = "" %} {% set idblog = "" %}
{% set url= path('cadoles_portal_user_blog_view') %} {% set url= path('cadoles_portal_user_blogarticle_submit') %}
{% if usage=="group" and firstblog is defined %} {% if usage=="group" and firstblog is defined %}
{% set url= path('cadoles_portal_user_blog_view',{id:firstblog}) %} {% set url= path('cadoles_portal_user_blogarticle_submit',{idblog:firstblog,page:entity.page.id}) %}
{% endif %} {% endif %}
<a title="Gérer mes Blogs" onClick="showFrameitem('blog','{{ url }}',true)" style="{{ stylewidgetmenu }}"><i class="fa fa-plus fa-fw"></i></a>
<a title="Créer un Article" onClick="showFrameitem('blog','{{ url }}',true)" style="{{ stylewidgetmenu }}"><i class="fa fa-plus fa-fw"></i></a>
{% endif %} {% endif %}
</div> </div>

View File

@ -30,7 +30,7 @@
{% if usage=="group" and firstcalendar is defined %} {% if usage=="group" and firstcalendar is defined %}
{% set url= path('cadoles_portal_'~access~'_calendar_view',{id:firstcalendar}) %} {% set url= path('cadoles_portal_'~access~'_calendar_view',{id:firstcalendar}) %}
{% endif %} {% endif %}
<a title="Gérer mes Calendriers" onClick="showFrameitem('calendar','{{ url }}',true)" style="{{ stylewidgetmenu }}"><i class="fa fa-plus fa-fw"></i></a> <a title="Gérer mes Calendriers" onClick="showFrameitem('calendar','{{ url }}',true)" style="{{ stylewidgetmenu }}"><i class="fa fa-calendar fa-fw"></i></a>
{% endif %} {% endif %}
</div> </div>

View File

@ -60,7 +60,7 @@
{% if projecttask.projecttasktag %} {% if projecttask.projecttasktag %}
{% set colortask = projecttask.projecttasktag.color %} {% set colortask = projecttask.projecttasktag.color %}
{% endif %} {% endif %}
<div class="grid-item-content" style="background-color:#{{ colortask }}"> <div class="grid-item-content" style="background-color:#{{ colortask }}; {%if not entity.border%}padding:5px;{%endif%}">
<a title="Voir la Tâche" href="{{ path('cadoles_portal_'~access~'_projecttask_view',{'id':projecttask.id,page:entity.page.id}) }}"> <a title="Voir la Tâche" href="{{ path('cadoles_portal_'~access~'_projecttask_view',{'id':projecttask.id,page:entity.page.id}) }}">
<div class="item-link clearfix"> <div class="item-link clearfix">

View File

@ -11,13 +11,16 @@
<a href='{{ path('cadoles_portal_config_project_writer', {id:entity.id}) }}' title='Permission'><i class='fa fa-users fa-fw'></i></a> <a href='{{ path('cadoles_portal_config_project_writer', {id:entity.id}) }}' title='Permission'><i class='fa fa-users fa-fw'></i></a>
<a href='{{ path('cadoles_portal_config_project_delete', { id: entity.id }) }}' data-method='delete' data-confirm='Êtes-vous sûr de vouloir supprimer ?' title='Supprimer'><i class='fa fa-trash fa-fw'></i></a> <a href='{{ path('cadoles_portal_config_project_delete', { id: entity.id }) }}' data-method='delete' data-confirm='Êtes-vous sûr de vouloir supprimer ?' title='Supprimer'><i class='fa fa-trash fa-fw'></i></a>
</div> </div>
<div style="margin:10px 0px 10px 0px; text-align:left; display:inline-block;width:49%"></div>
{% endif %} {% endif %}
<div style="margin:10px 0px 10px 0px; text-align:left; display:inline-block;width:49%"> {% if access!="config" %}
{% if not idpage is empty %} <div style="margin:10px 0px 10px 0px; text-align:left; display:inline-block;width:49%">
<a href="{{path('cadoles_portal_user_page_view',{id:idpage,usage:'group',group:idgroup})}}" class="btn btn-success">Revenir sur le Groupe</a> {% if not idpage is empty %}
{% endif %} <a href="{{path('cadoles_portal_user_page_view',{id:idpage,usage:'group',group:idgroup})}}" class="btn btn-success">Revenir sur le Groupe</a>
</div> {% endif %}
</div>
{% endif %}
<div style="margin:10px 0px 10px 0px; text-align:right; display:inline-block;width:50%"> <div style="margin:10px 0px 10px 0px; text-align:right; display:inline-block;width:50%">
<label for="alltask" class="control-label">Afficher les tâches fermées</label> <label for="alltask" class="control-label">Afficher les tâches fermées</label>