diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php index 9d07c19e..4f91fa94 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Command/InitDataCommand.php @@ -714,7 +714,24 @@ class InitDataCommand extends ContainerAwareCommand $em->remove($entityWidget); } - + // Widget Mes Groupes + $entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1830); + if(!$entityWidget) $entityWidget = new Widget(); + $entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_users.png"]); + $entityWidget->setId(-1830); + $entityWidget->setRoworder(2); + $entityWidget->setIcon($entityicon); + $entityWidget->setName('Mes Groupes de Travail'); + $entityWidget->setDescription("Affiche la liste de vos groupes de travail"); + $entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_group"); + $entityWidget->setHeight("630"); + $entityWidget->setAutoajust(true); + $entityWidget->setBorder(true); + $entityWidget->setOpened(true); + $entityWidget->setAccess(["config","user","group"]); + $parameter = json_decode('{"fields": []}'); + $entityWidget->setParameter($parameter); + $em->persist($entityWidget); // Widget Séparateur $entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1600); diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagewidgetController.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagewidgetController.php index 7f0d4a88..ceb9b8ec 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagewidgetController.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/PagewidgetController.php @@ -1922,4 +1922,49 @@ class PagewidgetController extends Controller 'group' => $group, ]); } + + + public function viewgroupAction(Request $request,$id,$access="config") { + $usage=$request->query->get('usage'); + $group=$request->query->get('group'); + $user=$this->getUser(); + + $em = $this->getDoctrine()->getManager(); + $entity = $em->getRepository($this->labelentity)->find($id); + if (!$entity) throw $this->createNotFoundException('Unable to find entity.'); + + // Permissions + if($access=="config") { + $canupdate = true; + } + else { + // On s'assure que l'utilisateur à la permission de voir + $page=$entity->getPage(); + $em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate); + if(!$cansee) throw $this->createNotFoundException('Permission denied'); + } + + $mygroups=[]; + foreach($this->getUser()->getGroups() as $usergroup) { + if($usergroup->getGroup()->getFgcanshare()) { + $title=$usergroup->getGroup()->getLabel(); + $icon=null; + if($usergroup->getGroup()->getIcon()) + $icon="/".$group->getIcon()->getLabel(); + + + array_push($mygroups,["title"=>$title,"icon"=>$icon]); + } + } + + // Render + return $this->render($this->labelentity.':viewgroup.html.twig', [ + 'entity' => $entity, + 'canadd' => ($user), + 'canupdate' => $canupdate, + 'usage' => $usage, + 'groups' => $mygroups, + + ]); + } } diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/config/routing.yml b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/config/routing.yml index 3320e0fc..1107dbf0 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/config/routing.yml +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/config/routing.yml @@ -763,6 +763,10 @@ cadoles_portal_config_panelwidget_view_chat: path: /config/pagewidget/view/chat/{id} defaults: { _controller: CadolesPortalBundle:Pagewidget:viewchat, access: config } +cadoles_portal_config_panelwidget_view_group: + path: /config/pagewidget/view/group/{id} + defaults: { _controller: CadolesPortalBundle:Pagewidget:viewgroup, access: config } + #-- Access user cadoles_portal_user_pagewidget_widget_sumbit: path: /user/pagewidget/submit/{idpage}/{idwidgettype} @@ -863,3 +867,8 @@ cadoles_portal_user_panelwidget_view_info: cadoles_portal_user_panelwidget_view_chat: path: /pagewidget/view/chat/{id} defaults: { _controller: CadolesPortalBundle:Pagewidget:viewchat, access: user } + +cadoles_portal_user_panelwidget_view_group: + path: /pagewidget/view/group/{id} + defaults: { _controller: CadolesPortalBundle:Pagewidget:viewgroup, access: user } + diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewgroup.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewgroup.html.twig new file mode 100644 index 00000000..120f0823 --- /dev/null +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Pagewidget/viewgroup.html.twig @@ -0,0 +1,62 @@ +{% set theme = app.session.get('theme') %} +{% if theme is not empty %} + {{ include('@Theme/'~theme~'/function.html.twig') }} +{% endif %} + +{% import "@CadolesPortal/Pagewidget/constants.twig" as constants %} + +{% set stylewidget = constants.mystylewidget(entity) %} +{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %} +{% set stylewidgetheader = constants.mystylewidgetheader(entity) %} +{% set stylewidgetbody = constants.mystylewidgetbody(entity) %} +{% set stylewidgetbodyreverse = constants.mystylewidgetbodyreverse(entity) %} + + +
+ {% if canupdate %} +
+ {% if canupdate %} + + + {% endif %} +
+ {% endif %} + + +
+ {% if entity.icon %} + + {% else %} + + {% endif %} + {{ entity.name }} +
+ +
+
+
+
+ {% for group in groups %} +
+
+ + + +
+ {{ group.title }} +
+
+
+ {% endfor %} +
+
+
+ + +