This commit is contained in:
afornerot 2019-07-04 16:11:50 +02:00
parent 3d77248b3d
commit c0936a53ba
42 changed files with 1731 additions and 233 deletions

View File

@ -8,7 +8,7 @@ INSERT IGNORE INTO `niveau01` (`id`, `label`, `siren`) VALUES
(-100, 'DRAAF', '130007107'); (-100, 'DRAAF', '130007107');
INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES
(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}KYFkIhUXbGQ8luMLxpsdl5OtVq4aZ/GN (-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}otHXvfP0WOEFQYGgcJCVwAZ8h4HHrHOP
', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple'); ', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple');
@ -32,14 +32,15 @@ INSERT IGNORE INTO `sidebar` (`id`, `parent_id`, `roworder`, `label`, `path`, `f
(1270, 1200, 1270, 'Import Utilisateurs', 'cadoles_core_config_importuser', 'fa-download', 'ROLE_ADMIN,ROLE_MODO', 'importuser_activate'), (1270, 1200, 1270, 'Import Utilisateurs', 'cadoles_core_config_importuser', 'fa-download', 'ROLE_ADMIN,ROLE_MODO', 'importuser_activate'),
(1500, NULL, 1500, 'PORTAIL', NULL, 'fa-cubes', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'), (1500, NULL, 1500, 'PORTAIL', NULL, 'fa-cubes', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1510, 1500, 1510, 'Pages', 'cadoles_portal_config_page', 'fa-file', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'), (1510, 1500, 1510, 'Modèles de Page', 'cadoles_portal_config_pagetemplate', 'fa-copy', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1520, 1500, 1520, 'Items', 'cadoles_portal_config_item', 'fa-desktop', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'), (1520, 1500, 1520, 'Pages', 'cadoles_portal_config_page', 'fa-file', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1530, 1500, 1530, 'Annonces', 'cadoles_portal_config_alert', 'fa-bell', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'), (1530, 1500, 1530, 'Items', 'cadoles_portal_config_item', 'fa-desktop', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1540, 1500, 1540, 'Calendriers', 'cadoles_portal_config_calendar', 'fa-calendar', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'), (1540, 1500, 1540, 'Annonces', 'cadoles_portal_config_alert', 'fa-bell', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1550, 1500, 1550, 'Blogs', 'cadoles_portal_config_blog', 'fa-paper-plane', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'), (1550, 1500, 1550, 'Calendriers', 'cadoles_portal_config_calendar', 'fa-calendar', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1560, 1500, 1560, 'Flux', 'cadoles_portal_config_flux', 'fa-rss', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'), (1560, 1500, 1560, 'Blogs', 'cadoles_portal_config_blog', 'fa-paper-plane', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1570, 1500, 1570, 'Chartes', 'cadoles_portal_config_notice', 'fa-info', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'), (1570, 1500, 1570, 'Flux', 'cadoles_portal_config_flux', 'fa-rss', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1580, 1500, 1580, 'Icônes', 'cadoles_portal_config_icon', 'fa-bug', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'), (1580, 1500, 1580, 'Chartes', 'cadoles_portal_config_notice', 'fa-info', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1590, 1500, 1590, 'Icônes', 'cadoles_portal_config_icon', 'fa-bug', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(2500, NULL, 2500, 'MODULES', NULL, 'fa-cubes', 'ROLE_ADMIN,ROLE_MODO', 'module_activate'), (2500, NULL, 2500, 'MODULES', NULL, 'fa-cubes', 'ROLE_ADMIN,ROLE_MODO', 'module_activate'),
(2510, 2500, 2510, 'Pages', 'cadoles_portal_config_page', 'fa-file', 'ROLE_ADMIN,ROLE_MODO', 'page_activate'), (2510, 2500, 2510, 'Pages', 'cadoles_portal_config_page', 'fa-file', 'ROLE_ADMIN,ROLE_MODO', 'page_activate'),
@ -103,6 +104,7 @@ INSERT IGNORE permmodo (`route`, `visible`) VALUES
('cadoles_core_config_registration',1), ('cadoles_core_config_registration',1),
('cadoles_core_config_user',1), ('cadoles_core_config_user',1),
('cadoles_core_config_importuser',0), ('cadoles_core_config_importuser',0),
('cadoles_portal_config_pagetemplate',1),
('cadoles_portal_config_page',1), ('cadoles_portal_config_page',1),
('cadoles_portal_config_item',1), ('cadoles_portal_config_item',1),
('cadoles_portal_config_alert',1), ('cadoles_portal_config_alert',1),

View File

@ -107,7 +107,7 @@ class CoreController extends Controller
// Calcul des pages de l'utilisateur // Calcul des pages de l'utilisateur
$this->getDoctrine()->getRepository("CadolesPortalBundle:Page")->getPagesUser($user,$id,$entity,$pagesuser,$pagesadmin,$pagesshared); $this->getDoctrine()->getRepository("CadolesPortalBundle:Page")->getPagesUser($user,$id,$entity,$pagesuser,$pagesadmin,$groupsshared);
// si aucune page = page par défaut // si aucune page = page par défaut
if(!$entity) { if(!$entity) {
@ -126,9 +126,9 @@ class CoreController extends Controller
'access' => "user", 'access' => "user",
'pagesadmin' => $pagesadmin, 'pagesadmin' => $pagesadmin,
'pagesuser' => $pagesuser, 'pagesuser' => $pagesuser,
'pagesshared' => $pagesshared, 'groupsshared' => $groupsshared,
'canadd' => $this->get('session')->get('cancreatepage'), 'canadd' => $this->get('session')->get('cancreatepage'),
'widgets' => $this->getDoctrine()->getRepository("CadolesPortalBundle:Widget")->findAll() 'widgets' => $this->getDoctrine()->getRepository("CadolesPortalBundle:Widget")->getWidgetAccess("user")
]); ]);
} }

View File

@ -8,11 +8,14 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Form\FormError; use Symfony\Component\Form\FormError;
use Ramsey\Uuid\Uuid;
use Cadoles\CoreBundle\Entity\Group; use Cadoles\CoreBundle\Entity\Group;
use Cadoles\CoreBundle\Entity\Usergroup; use Cadoles\CoreBundle\Entity\Usergroup;
use Cadoles\CoreBundle\Entity\Usermodo; use Cadoles\CoreBundle\Entity\Usermodo;
use Cadoles\CoreBundle\Form\GroupType; use Cadoles\CoreBundle\Form\GroupType;
use Cadoles\PortalBundle\Entity\Calendar;
use Cadoles\PortalBundle\Entity\Blog;
class GroupController extends Controller class GroupController extends Controller
{ {
@ -289,6 +292,7 @@ class GroupController extends Controller
$search= $request->query->get('search'); $search= $request->query->get('search');
$draw= $request->query->get('draw'); $draw= $request->query->get('draw');
$order= $request->query->get('order'); $order= $request->query->get('order');
$fgcanshare= $request->query->get('fgcanshare');
// Nombre total d'enregistrement // Nombre total d'enregistrement
$qb = $em->createQueryBuilder(); $qb = $em->createQueryBuilder();
@ -380,6 +384,7 @@ class GroupController extends Controller
$datas=$qb->setFirstResult($start)->setMaxResults($length)->getQuery()->getResult(); $datas=$qb->setFirstResult($start)->setMaxResults($length)->getQuery()->getResult();
foreach($datas as $data) { foreach($datas as $data) {
// Action // Action
$action = ""; $action = "";
if($group->getLdapfilter()==""&&$group->getAttributes()=="") if($group->getLdapfilter()==""&&$group->getAttributes()=="")
@ -388,7 +393,16 @@ class GroupController extends Controller
// Avatar // Avatar
$avatar="<img src='/".$this->container->getParameter('alias')."/uploads/avatar/".$data->getAvatar()."' style='width:30px;background-color:#337ab7;margin:auto;display:block;'>"; $avatar="<img src='/".$this->container->getParameter('alias')."/uploads/avatar/".$data->getAvatar()."' style='width:30px;background-color:#337ab7;margin:auto;display:block;'>";
array_push($output["data"],array("DT_RowId"=>"user".$data->getId(),$action,$avatar,$data->getUsername(),$data->getEmail())); // Flag manager
$fgmanager="";
if($fgcanshare) {
$usergroup=$em->getRepository("CadolesCoreBundle:UserGroup")->findOneBy(["user"=>$data->getId(),"group"=>$id]);
$checked=($usergroup->getFgmanager()?"checked":"");
$fgmanager="<input type='checkbox' class='switch' onChange='switchManager(".$data->getId().");' $checked>";
}
array_push($output["data"],array("DT_RowId"=>"user".$data->getId(),$action,$avatar,$data->getUsername(),$data->getEmail(),$fgmanager));
} }
// Retour // Retour
@ -449,15 +463,41 @@ class GroupController extends Controller
return $response; return $response;
} }
public function submitAction(Request $request) public function switchmanagerAction(Request $request)
{ {
// S'assurer que c'est un appel ajax
if (!$request->isXmlHttpRequest()) {
return new JsonResponse(array('message' => 'Interdit'), 400);
}
$em = $this->getDoctrine()->getManager();
$output=array();
$userid=$request->request->get('user');
$groupid=$request->request->get('group');
$data = $em->getRepository("CadolesCoreBundle:Usergroup")->findOneBy(array("user"=>$userid,"group"=>$groupid));
if($data) $data->setFgmanager(!$data->getFgmanager());
$em->persist($data);
$em->flush();
$response = new Response(json_encode($output));
$response->headers->set('Content-Type', 'application/json');
return $response;
}
public function submitAction(Request $request, $access="config")
{
$em = $this->getDoctrine()->getManager();
// Initialisation de l'enregistrement // Initialisation de l'enregistrement
$data = new Group(); $data = new Group();
$data->setFgopen(false); $data->setFgopen(false);
$data->setFgcanshare(true); $data->setFgcanshare(false);
$data->setFgcancreatepage(true); $data->setFgcancreatepage(false);
$data->setFgcancreatecalendar(true); $data->setFgcancreatecalendar(false);
$data->setFgcancreateblog(true); $data->setFgcancreateblog(false);
// Création du formulaire // Création du formulaire
$form = $this->createForm(GroupType::class,$data,array( $form = $this->createForm(GroupType::class,$data,array(
@ -482,38 +522,54 @@ class GroupController extends Controller
if($data->getLdapfilter()!="") $data->setFgopen(false); if($data->getLdapfilter()!="") $data->setFgopen(false);
if($data->getAttributes()!="") $data->setFgopen(false); if($data->getAttributes()!="") $data->setFgopen(false);
$em = $this->getDoctrine()->getManager(); // Icon
$idicon = $form->get('idicon')->getData();
$icon=$em->getRepository("CadolesPortalBundle:Icon")->findoneby(["id"=>$idicon]);
$data->setIcon($icon);
// Sauvegarde // Sauvegarde
$em->persist($data); $em->persist($data);
$em->flush(); $em->flush();
// On s'assure que le groupe de travail à bien page d'accueil / calendrier / blog associé
// Sinon on les génère
$this->ctrlFgcanshare($data);
// Retour à la liste // Retour à la liste
return $this->redirectToRoute("cadoles_core_config_group_users",["id"=>$data->getId()]); return $this->redirectToRoute("cadoles_core_config_group_users",["id"=>$data->getId()]);
} }
// Affichage du formulaire // Affichage du formulaire
$icons=$this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findBy(["user"=>null]);
$iconsuser=null;
if($access=="user") $iconsuser=$this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findBy(["user"=>$this->getUser()]);
return $this->render($this->labelentity.':edit.html.twig', [ return $this->render($this->labelentity.':edit.html.twig', [
'useheader' => true, 'useheader' => true,
'usemenu' => false, 'usemenu' => false,
'usesidebar' => true, 'usesidebar' => true,
$this->labeldata => $data, $this->labeldata => $data,
'mode' => 'submit', 'mode' => 'submit',
'access' => 'access',
'icons' => $icons,
'iconsuser' => $iconsuser,
'form' => $form->createView() 'form' => $form->createView()
]); ]);
} }
public function updateAction($id,Request $request) public function updateAction($id,Request $request,$access="config")
{ {
// Récupération de l'enregistrement courant // Récupération de l'enregistrement courant
$em = $this->getDoctrine()->getManager();
$data=$this->getData($id); $data=$this->getData($id);
// Création du formulaire // Création du formulaire
$form = $this->createForm(GroupType::class,$data,array( $form = $this->createForm(GroupType::class,$data,array(
"mode"=>"update", "mode" => "update",
"updatelimite"=>($data->getFgAll()||$data->getFgTemplate()), "updatelimite" => ($data->getFgAll()||$data->getFgTemplate()),
"masteridentity"=> $this->GetParameter("masteridentity"), "masteridentity" => $this->GetParameter("masteridentity"),
"portal_activate"=>$this->getParameter("portal_activate") "portal_activate" => $this->getParameter("portal_activate"),
"idicon" => ($data->getIcon()?$data->getIcon()->getId():null),
) )
); );
@ -525,25 +581,34 @@ class GroupController extends Controller
// Sur validation // Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) { if ($form->get('submit')->isClicked() && $form->isValid()) {
$masteridentity=$this->GetParameter("masteridentity");
$em = $this->getDoctrine()->getManager();
$data = $form->getData(); $data = $form->getData();
$masteridentity=$this->GetParameter("masteridentity");
if($masteridentity!="LDAP") $data->setLdapfilter(null); if($masteridentity!="LDAP") $data->setLdapfilter(null);
if($masteridentity!="SSO") $data->setAttributes(null); if($masteridentity!="SSO") $data->setAttributes(null);
if($data->getLdapfilter()!="") $data->setFgopen(false); if($data->getLdapfilter()!="") $data->setFgopen(false);
if($data->getAttributes()!="") $data->setFgopen(false); if($data->getAttributes()!="") $data->setFgopen(false);
// Icon
$idicon = $form->get('idicon')->getData();
$icon=$this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findoneby(["id"=>$idicon]);
$data->setIcon($icon);
// Sauvegarde // Sauvegarde
$em->persist($data); $em->persist($data);
$em->flush(); $em->flush();
// On s'assure que le groupe de travail à bien page d'accueil / calendrier / blog associé
// Sinon on les génère
$this->ctrlFgcanshare($data);
// Retour à la liste // Retour à la liste
return $this->redirectToRoute($this->labelroute); return $this->redirectToRoute($this->labelroute);
} }
$icons=$em->getRepository("CadolesPortalBundle:Icon")->findBy(["user"=>null]);
$iconsuser=null;
if($access=="user") $iconsuser=$em()->getRepository("CadolesPortalBundle:Icon")->findBy(["user"=>$this->getUser()]);
// Affichage du formulaire // Affichage du formulaire
return $this->render($this->labelentity.':edit.html.twig', [ return $this->render($this->labelentity.':edit.html.twig', [
@ -552,6 +617,9 @@ class GroupController extends Controller
'usesidebar' => true, 'usesidebar' => true,
$this->labeldata => $data, $this->labeldata => $data,
'mode' => 'update', 'mode' => 'update',
'access' => $access,
'icons' => $icons,
'iconsuser' => $iconsuser,
'form' => $form->createView() 'form' => $form->createView()
]); ]);
} }
@ -618,6 +686,49 @@ class GroupController extends Controller
]); ]);
} }
protected function ctrlFgcanshare($group) {
$em = $this->getDoctrine()->getManager();
if($group->getFgcanshare()) {
// On regarde s'il a au moins une page
if($group->getPages()->isEmpty()) {
$page=$this->getDoctrine()->getRepository("CadolesPortalBundle:Page")->clonePage(null,$group->getPagetemplate());
$group->addPage($page);
$page->setName("Groupe = ".$group->getLabel());
$em->persist($page);
$em->persist($group);
$em->flush();
}
// On regarde s'il a au moins un calendrier
if($group->getCalendars()->isEmpty()) {
$calendar=new Calendar();
$key = Uuid::uuid4();
$calendar->setName("Groupe = ".$group->getLabel());
$calendar->setKeyvalue($key);
$calendar->addGroup($group);
$calendar->setColor($group->getColor());
$calendar->setType(0);
$em->persist($calendar);
$em->flush();
}
// On regarde s'il a au moins un blog
if($group->getBlogs()->isEmpty()) {
$blog=new Blog();
$blog->setName("Groupe = ".$group->getLabel());
$blog->addGroup($group);
$em->persist($blog);
$em->flush();
}
}
}
protected function getDatas() protected function getDatas()
{ {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
@ -661,6 +772,9 @@ class GroupController extends Controller
$tmp=$this->getEntityBy("CadolesCoreBundle:Niveau02","label",$data->getLabel()); $tmp=$this->getEntityBy("CadolesCoreBundle:Niveau02","label",$data->getLabel());
if($tmp) $form->addError(new FormError('Un niveau de rang 02 utilise déjà ce label')); if($tmp) $form->addError(new FormError('Un niveau de rang 02 utilise déjà ce label'));
if($data->getFgcanshare()&&is_null($data->getPagetemplate()))
$form->addError(new FormError("Un groupe de travail doit avoir un modèle de page d'accueil"));
} }
if ($form->get('submit')->isClicked() && !$form->isValid()) { if ($form->get('submit')->isClicked() && !$form->isValid()) {

View File

@ -314,7 +314,7 @@ class UserController extends Controller
$group->setUser($data); $group->setUser($data);
$datagroup = $em->getRepository("CadolesCoreBundle:Group")->find($idgroup); $datagroup = $em->getRepository("CadolesCoreBundle:Group")->find($idgroup);
$user->setGroup($datagroup); $group->setGroup($datagroup);
$em->persist($group); $em->persist($group);
$em->flush(); $em->flush();

View File

@ -29,6 +29,20 @@ class Group
*/ */
private $label; private $label;
/**
* @var string
*
* @ORM\Column(name="description", type="text", nullable=true)
*/
private $description;
/**
* @var string
*
* @ORM\Column(name="color", type="string", length=24, nullable=true)
*/
private $color;
/** /**
* @ORM\Column(type="boolean", options={"default" : false}) * @ORM\Column(type="boolean", options={"default" : false})
*/ */
@ -74,6 +88,23 @@ class Group
*/ */
private $attributes; private $attributes;
/**
* @ORM\ManyToOne(targetEntity="Cadoles\PortalBundle\Entity\Icon", inversedBy="groups")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $icon;
/**
* @ORM\ManyToOne(targetEntity="User", inversedBy="ownergroups")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $owner;
/**
* @ORM\ManyToOne(targetEntity="Cadoles\PortalBundle\Entity\Page", inversedBy="templategroups")
*/
private $pagetemplate;
/** /**
* @var ArrayCollection $users * @var ArrayCollection $users
* @var UserGroup * @var UserGroup
@ -97,7 +128,6 @@ class Group
*/ */
protected $pages; protected $pages;
/** /**
* @ORM\ManyToMany(targetEntity="Cadoles\PortalBundle\Entity\Flux", mappedBy="groups") * @ORM\ManyToMany(targetEntity="Cadoles\PortalBundle\Entity\Flux", mappedBy="groups")
*/ */
@ -671,4 +701,124 @@ class Group
{ {
return $this->blogs; return $this->blogs;
} }
/**
* Set description
*
* @param string $description
*
* @return Group
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* Get description
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* Set icon
*
* @param \Cadoles\PortalBundle\Entity\Icon $icon
*
* @return Group
*/
public function setIcon(\Cadoles\PortalBundle\Entity\Icon $icon = null)
{
$this->icon = $icon;
return $this;
}
/**
* Get icon
*
* @return \Cadoles\PortalBundle\Entity\Icon
*/
public function getIcon()
{
return $this->icon;
}
/**
* Set owner
*
* @param \Cadoles\CoreBundle\Entity\User $owner
*
* @return Group
*/
public function setOwner(\Cadoles\CoreBundle\Entity\User $owner = null)
{
$this->owner = $owner;
return $this;
}
/**
* Get owner
*
* @return \Cadoles\CoreBundle\Entity\User
*/
public function getOwner()
{
return $this->owner;
}
/**
* Set color
*
* @param string $color
*
* @return Group
*/
public function setColor($color)
{
$this->color = $color;
return $this;
}
/**
* Get color
*
* @return string
*/
public function getColor()
{
return $this->color;
}
/**
* Set pagetemplate
*
* @param \Cadoles\PortalBundle\Entity\Page $pagetemplate
*
* @return Group
*/
public function setPagetemplate(\Cadoles\PortalBundle\Entity\Page $pagetemplate = null)
{
$this->pagetemplate = $pagetemplate;
return $this;
}
/**
* Get pagetemplate
*
* @return \Cadoles\PortalBundle\Entity\Page
*/
public function getPagetemplate()
{
return $this->pagetemplate;
}
} }

View File

@ -87,7 +87,7 @@ class Niveau01
private $modos; private $modos;
/** /**
* @ORM\ManyToMany(targetEntity="Cadoles\PortalBundle\Entity\Item", mappedBy="groups") * @ORM\ManyToMany(targetEntity="Cadoles\PortalBundle\Entity\Item", mappedBy="niveau01s")
*/ */
protected $items; protected $items;

View File

@ -78,7 +78,7 @@ class Registration implements UserInterface, \Serializable
private $keyvalue; private $keyvalue;
/** /**
* @ORM\ManyToOne(targetEntity="Statut") * @ORM\ManyToOne(targetEntity="Statut", inversedBy="registrations")
* @ORM\JoinColumn(nullable=false) * @ORM\JoinColumn(nullable=false)
*/ */
private $statut; private $statut;

View File

@ -179,6 +179,14 @@ class User implements UserInterface, \Serializable
*/ */
private $groups; private $groups;
/**
* @var ArrayCollection $ownergroups
* @var Group
*
* @ORM\OneToMany(targetEntity="Group", mappedBy="owner", cascade={"persist"}, orphanRemoval=false)
*/
private $ownergroups;
/** /**
* @var ArrayCollection $groups * @var ArrayCollection $groups
* @var UserGroup * @var UserGroup
@ -1297,4 +1305,38 @@ class User implements UserInterface, \Serializable
{ {
return $this->icons; return $this->icons;
} }
/**
* Add ownergroup
*
* @param \Cadoles\CoreBundle\Entity\Group $ownergroup
*
* @return User
*/
public function addOwnergroup(\Cadoles\CoreBundle\Entity\Group $ownergroup)
{
$this->ownergroups[] = $ownergroup;
return $this;
}
/**
* Remove ownergroup
*
* @param \Cadoles\CoreBundle\Entity\Group $ownergroup
*/
public function removeOwnergroup(\Cadoles\CoreBundle\Entity\Group $ownergroup)
{
$this->ownergroups->removeElement($ownergroup);
}
/**
* Get ownergroups
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getOwnergroups()
{
return $this->ownergroups;
}
} }

View File

@ -35,6 +35,10 @@ class UserGroup
*/ */
private $group; private $group;
/**
* @ORM\Column(type="boolean", options={"default" : false})
*/
private $fgmanager = false;
/** /**
@ -94,4 +98,28 @@ class UserGroup
{ {
return $this->group; return $this->group;
} }
/**
* Set fgmanager
*
* @param boolean $fgmanager
*
* @return UserGroup
*/
public function setFgmanager($fgmanager)
{
$this->fgmanager = $fgmanager;
return $this;
}
/**
* Get fgmanager
*
* @return boolean
*/
public function getFgmanager()
{
return $this->fgmanager;
}
} }

View File

@ -35,13 +35,26 @@ class GroupType extends AbstractType
$choices=array("oui" => "1","non" => "0"); $choices=array("oui" => "1","non" => "0");
$builder->add("fgcanshare", $builder->add("fgcanshare",
ChoiceType::class,array( ChoiceType::class,array(
"label" =>"Partage dans le groupe activé", "label" =>"Groupe de Travail",
'disabled' => ($options["mode"]=="delete"?true:false), 'disabled' => ($options["mode"]=="delete"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px"), "attr" => array("class" => "form-control", "style" => "margin-bottom:15px"),
"choices" => $choices "choices" => $choices
) )
); );
$builder->add('pagetemplate',
EntityType::class,[
"class" => "CadolesPortalBundle:Page",
"label" => "Modèle de Page pour l'accueil du groupe",
"required" => false,
"choice_label" => "name",
"query_builder"=> function (EntityRepository $er) {
return $er->createQueryBuilder('page')->where('page.parentfor=:parentfor')->setParameter('parentfor', 'group');
},
"disabled" => ($options["mode"]=="delete"||$options["masteridentity"]!="SQL"?true:false),
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px","readonly" => ($options["mode"]=="delete"?true:false))
]);
$builder->add("fgcancreatepage", $builder->add("fgcancreatepage",
ChoiceType::class,array( ChoiceType::class,array(
"label" =>"Permission de créer des Pages", "label" =>"Permission de créer des Pages",
@ -190,6 +203,21 @@ class GroupType extends AbstractType
]); ]);
} }
$builder->add('idicon', HiddenType::class,['mapped'=> false,'data' => $options["idicon"]]);
$builder->add('color', TextType::class, [
'label' => "Couleur",
'required' => false,
'attr' => array("class" => "pick-a-color")
]);
$builder->add("description", TextareaType::class, [
"label" => 'Description',
"required" => false,
"disabled" => ($options["mode"]=="delete"?true:false),
"attr" => array("rows" => '4')
]);
if(!$options["updatelimite"]) { if(!$options["updatelimite"]) {
$builder->add('label', $builder->add('label',
TextType::class, array( TextType::class, array(
@ -267,7 +295,8 @@ class GroupType extends AbstractType
'mode' => "string", 'mode' => "string",
'masteridentity' => "string", 'masteridentity' => "string",
'portal_activate' => "boolean", 'portal_activate' => "boolean",
'updatelimite' => "boolean" 'updatelimite' => "boolean",
'idicon' => "string",
)); ));
} }
} }

View File

@ -41,6 +41,7 @@ cadoles_core_ldap_login:
path: /ldaplogin path: /ldaplogin
defaults: { _controller: CadolesCoreBundle:Security:login } defaults: { _controller: CadolesCoreBundle:Security:login }
#== Crop Image =========================================================================================================== #== Crop Image ===========================================================================================================
cadoles_core_crop01: cadoles_core_crop01:
path: /crop01 path: /crop01
@ -50,6 +51,7 @@ cadoles_core_crop02:
path: /crop02 path: /crop02
defaults: { _controller: CadolesCoreBundle:Crop:crop02 } defaults: { _controller: CadolesCoreBundle:Crop:crop02 }
#== File ================================================================================================================= #== File =================================================================================================================
#-- Access config #-- Access config
cadoles_core_config_file_upload: cadoles_core_config_file_upload:
@ -93,6 +95,7 @@ cadoles_core_user_file_show:
path: file/show/{directory}/{filename} path: file/show/{directory}/{filename}
defaults: { _controller: CadolesCoreBundle:File:show, access: user } defaults: { _controller: CadolesCoreBundle:File:show, access: user }
#== Ajax ================================================================================================================= #== Ajax =================================================================================================================
cadoles_core_ajax_country_list: cadoles_core_ajax_country_list:
path: /ajax/country/list path: /ajax/country/list
@ -128,6 +131,7 @@ cadoles_core_config:
path: /config/home path: /config/home
defaults: { _controller: CadolesCoreBundle:Config:home } defaults: { _controller: CadolesCoreBundle:Config:home }
#== Commun Config Commun ================================================================================================= #== Commun Config Commun =================================================================================================
cadoles_core_config_commun: cadoles_core_config_commun:
path: /config/commun path: /config/commun
@ -165,6 +169,7 @@ cadoles_core_config_datausers:
path: /config/commun/datausers path: /config/commun/datausers
defaults: { _controller: CadolesCoreBundle:Config:datausers } defaults: { _controller: CadolesCoreBundle:Config:datausers }
#== Registration ========================================================================================================= #== Registration =========================================================================================================
#-- Access config #-- Access config
cadoles_core_config_registration: cadoles_core_config_registration:
@ -282,6 +287,7 @@ cadoles_core_config_niveau01_logo:
path: /config/niveau01/logo path: /config/niveau01/logo
defaults: { _controller: CadolesCoreBundle:Niveau01:logo } defaults: { _controller: CadolesCoreBundle:Niveau01:logo }
#== Niveau02 ============================================================================================================= #== Niveau02 =============================================================================================================
cadoles_core_config_niveau02: cadoles_core_config_niveau02:
path: /config/niveau02 path: /config/niveau02
@ -303,6 +309,7 @@ cadoles_core_config_niveau02_ajax_list:
path: /config/niveau02/ajax/list path: /config/niveau02/ajax/list
defaults: { _controller: CadolesCoreBundle:Niveau02:ajaxlist } defaults: { _controller: CadolesCoreBundle:Niveau02:ajaxlist }
#== Group ================================================================================================================ #== Group ================================================================================================================
cadoles_core_config_group: cadoles_core_config_group:
path: /config/group path: /config/group
@ -344,6 +351,11 @@ cadoles_core_config_group_ajax_usergroup_del:
path: /config/group/ajax/usergroupdel path: /config/group/ajax/usergroupdel
defaults: { _controller: CadolesCoreBundle:Group:usergroupdel } defaults: { _controller: CadolesCoreBundle:Group:usergroupdel }
cadoles_core_config_group_ajax_switchmanager:
path: /config/group/ajax/switchmanager
defaults: { _controller: CadolesCoreBundle:Group:switchmanager }
#== Whitelist ============================================================================================================ #== Whitelist ============================================================================================================
cadoles_core_config_whitelist: cadoles_core_config_whitelist:
path: /config/whitelist path: /config/whitelist

View File

@ -35,19 +35,16 @@
{% endif %} {% endif %}
<div class="row"> <div class="row">
{% if form.label is defined %} <div class="col-sm-6">
<div class="col-sm-6">
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-pencil fa-fw"></i> Informations
</div>
<div class="panel-body"> <div class="panel panel-primary">
{{ form_label(form.label) }} <div class="panel-heading">
{{ form_widget(form.label) }} <i class="fa fa-pencil fa-fw"></i> Informations
</div>
{{ form_label(form.fgopen) }} <div class="panel-body">
{{ form_widget(form.fgopen) }} {% if form.label is defined %}
{{ form_row(form.label) }}
{% if form.fgassoc is defined %} {% if form.fgassoc is defined %}
{% if masteridentity=="LDAP" %} {% if masteridentity=="LDAP" %}
@ -60,13 +57,63 @@
{{ form_row(form.attributes) }} {{ form_row(form.attributes) }}
{% endif %} {% endif %}
{% endif %} {% endif %}
</div> {% endif %}
{{ form_row(form.description) }}
{{ form_row(form.color) }}
</div> </div>
</div> </div>
{% endif %}
{% if form.fgcanshare is defined %} {% if form.fgcanshare is defined or form.fgopen is defined %}
<div class="col-sm-6"> <div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-pencil fa-fw"></i> Configuration du Groupe
</div>
<div class="panel-body">
{% if form.fgopen is defined %}
{{ form_row(form.fgopen) }}
{% endif %}
{% if form.fgcanshare is defined %}
{{ form_row(form.fgcanshare) }}
<div id="pagetemplate">{{ form_row(form.pagetemplate) }}</div>
{% endif %}
</div>
</div>
{% endif %}
<div id="diviconsel" class="col-md-12 text-left" style="height:140px; padding:20px; text-align:center; background-color: {{ group.color ? "#"~group.color : '#000000' }};">
{% if group.icon %}
<img src="/{{ alias }}/{{ group.icon.label }}" height="100" />
{% endif %}
</div>
<div class="col-md-12" style="text-align:center;padding:0px">
{{ form_row(form.idicon) }}
<a class="btn btn-success" data-toggle="modal" data-target="#selicon" title='Ajouter' style="width:100%">Selectionner un Icône</a>
<a class="btn btn-danger" onClick="delIcon()" title='Détacher' style="width:100%">Détacher l'Icône</a>
</div>
</div>
<div class="col-sm-6">
{% if form.fgcanshare is defined %}
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-pencil fa-fw"></i> Permissions Portail
</div>
<div class="panel-body">
{{ form_label(form.fgcancreatepage) }}
{{ form_widget(form.fgcancreatepage) }}
{{ form_label(form.fgcancreatecalendar) }}
{{ form_widget(form.fgcancreatecalendar) }}
{{ form_label(form.fgcancreateblog) }}
{{ form_widget(form.fgcancreateblog) }}
</div>
</div>
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-pencil fa-fw"></i> Elements du Portail <i class="fa fa-pencil fa-fw"></i> Elements du Portail
@ -82,37 +129,55 @@
{{ form_row(form.notices) }} {{ form_row(form.notices) }}
</div> </div>
</div> </div>
</div> {% endif %}
</div>
</div>
<div class="col-sm-6"> <div id="selicon" class="modal fade bs-item-modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="panel panel-primary"> <div class="modal-dialog modal-lg">
<div class="panel-heading"> <div class="modal-content">
<i class="fa fa-pencil fa-fw"></i> Permissions Portail <div class="modal-header">
</div> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">SELECTIONNER UN ICONE</h4>
</div>
<div class="panel-body"> <div class="modal-body">
{{ form_label(form.fgcanshare) }} <div class="form-group row clearfix">
{{ form_widget(form.fgcanshare) }} <div class="col-md-12" style="margin-bottom:15px">
<a onclick="$('#selicon').modal('hide');" class="btn btn-default">Annuler</a>
{% if access=="user" %}
<a href="{{ path('cadoles_portal_user_icon') }}" target="_parent" class="btn btn-default">Gérer mes Icônes</a>
{% endif %}
</div>
{{ form_label(form.fgcancreatepage) }} <div class="col-md-12">
{{ form_widget(form.fgcancreatepage) }} {% if iconsuser is not empty %}
<h3>Mes Icônes</h3>
{% for icon in iconsuser %}
<a style="cursor:pointer" onClick="selIcon({{ icon.id }})">
<img id="icon-{{ icon.id }}" class="grid-item-img" height="40" src="/{{ alias }}/{{ icon.label }}" style="padding:2px">
</a>
{% endfor %}
{{ form_label(form.fgcancreatecalendar) }} <h3>Icônes Communs</h3>
{{ form_widget(form.fgcancreatecalendar) }} {% endif %}
{% for icon in icons %}
{{ form_label(form.fgcancreateblog) }} <a style="cursor:pointer" onClick="selIcon({{ icon.id }})">
{{ form_widget(form.fgcancreateblog) }} <img id="icon-{{ icon.id }}" class="grid-item-img" height="40" src="/{{ alias }}/{{ icon.label }}" style="padding:2px">
</a>
{% endfor %}
</div>
</div> </div>
</div> </div>
</div> </div>
{% endif %} </div>
</div> </div>
{{ form_end(form) }} {{ form_end(form) }}
{% endblock %} {% endblock %}
{% block localjavascript %} {% block localjavascript %}
$('document').ready(function(){ $('document').ready(function(){
{% if masteridentity=="LDAP" %} {% if masteridentity=="LDAP" %}
fgaff=($("#group_ldapfilter").val()!=""); fgaff=($("#group_ldapfilter").val()!="");
if(!fgaff) { if(!fgaff) {
@ -161,8 +226,34 @@
} }
}); });
{% endif %} {% endif %}
hideshow();
}); });
$(document.body).on("change","#group_fgcanshare",function(){
hideshow();
});
function selIcon(idicon) {
$("#group_idicon").val(idicon);
$("#diviconsel img").remove();
$("#icon-"+idicon).clone().appendTo($("#diviconsel"));
$("#diviconsel img").attr("height","100px");
$('#selicon').modal('hide');
}
function delIcon() {
$("#diviconsel img").remove();
$("#group_idicon").val(null);
}
function hideshow() {
if($("#group_fgcanshare").val()==1)
$("#pagetemplate").show();
else {
$("#pagetemplate").hide();
}
}
{% endblock %} {% endblock %}

View File

@ -18,9 +18,9 @@
<th width="130px" class="no-sort">Action</th> <th width="130px" class="no-sort">Action</th>
<th>Label</th> <th>Label</th>
<th>Ouvert</th> <th>Ouvert</th>
<th class="no-sort">Filtre</th> <th class="no-sort {% if masteridentity=="SQL" %} no-visible {% endif %}">Filtre</th>
{% if portal_activate %} {% if portal_activate %}
<th>Partage</th> <th>Groupe de Travail</th>
<th>Création Pages</th> <th>Création Pages</th>
<th>Création Calendriers</th> <th>Création Calendriers</th>
<th>Création Blogs</th> <th>Création Blogs</th>
@ -37,7 +37,7 @@
{% block localjavascript %} {% block localjavascript %}
$(document).ready(function() { $(document).ready(function() {
$('#dataTables').DataTable({ $('#dataTables').DataTable({
columnDefs: [ { "targets": 'no-sort', "orderable": false } ], columnDefs: [ { "targets": 'no-sort', "orderable": false },{ "targets": 'no-visible', "visible": false } ],
responsive: true, responsive: true,
iDisplayLength: 100, iDisplayLength: 100,
order: [[ 1, "asc" ]], order: [[ 1, "asc" ]],

View File

@ -45,6 +45,7 @@
<th width="70px" class="no-sort">Avatar</th> <th width="70px" class="no-sort">Avatar</th>
<th width="200px">Login</th> <th width="200px">Login</th>
<th>Email</th> <th>Email</th>
<th class="no-sort {% if not group.fgcanshare %}no-visible{% endif %}">Manager</th>
</tr> </tr>
</thead> </thead>
</table> </table>
@ -68,15 +69,26 @@
}); });
$('#dataTablesin').DataTable({ $('#dataTablesin').DataTable({
columnDefs: [ { "targets": 'no-sort', "orderable": false } ], columnDefs: [ { "targets": 'no-sort', "orderable": false },{ "targets": 'no-visible', "visible": false } ],
responsive: true, responsive: true,
iDisplayLength: 100, iDisplayLength: 100,
order: [[ 2, "asc" ]], order: [[ 2, "asc" ]],
processing: true, processing: true,
serverSide: true, serverSide: true,
ajax: "{{ path('cadoles_core_config_group_ajax_usersin',{'id':group.id}) }}", ajax: {
"url": "{{ path('cadoles_core_config_group_ajax_usersin',{'id':group.id}) }}",
"data": function ( d ) {
return $.extend( {}, d, {
"fgcanshare": {{ group.fgcanshare }}
});
}
},
"drawCallback": function(settings) {
$(".switch").bootstrapSwitch();
},
}); });
}); });
function addUsers(userid) { function addUsers(userid) {
@ -122,4 +134,15 @@
} }
}); });
} }
function switchManager(id) {
$.ajax({
method: "POST",
url: "{{ path('cadoles_core_config_group_ajax_switchmanager') }}",
data: {
"group": {{ group.id }},
"user": id,
}
});
}
{% endblock %} {% endblock %}

View File

@ -43,7 +43,7 @@
<br> <br>
{% endif %} {% endif %}
{% if info %} {% if info is defined and info %}
<div class='alert alert-info' style='margin: 5px 0px'> <div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br> <strong>Information</strong><br>
{{ info }}<br> {{ info }}<br>

View File

@ -27,17 +27,17 @@
{% if access=="config" %} {% if access=="config" %}
<th width="90px" class="no-sort">Action</th> <th width="90px" class="no-sort">Action</th>
{% endif %} {% endif %}
<th width="70px" class="no-sort {% if fields["avatar"].perm==0 %}no-visible{% endif %}">Avatar</th> <th width="70px" class="no-sort {% if fields["avatar"] is defined and fields["avatar"].perm==0 %}no-visible{% endif %}">Avatar</th>
<th width="200px class=="{% if fields["login"].perm==0 %}no-visible{% endif %}">Login</th> <th width="200px class=="{% if fields["login"] is defined and fields["login"].perm==0 %}no-visible{% endif %}">Login</th>
<th class="{% if fields["lastname"].perm==0 %}no-visible{% endif %}">Nom</th> <th class="{% if fields["lastname"] is defined and fields["lastname"].perm==0 %}no-visible{% endif %}">Nom</th>
<th class="{% if fields["firstname"].perm==0 %}no-visible{% endif %}">Prénom</th> <th class="{% if fields["firstname"] is defined and fields["firstname"].perm==0 %}no-visible{% endif %}">Prénom</th>
<th class="{% if fields["email"].perm==0 %}no-visible{% endif %}">Email</th> <th class="{% if fields["email"] is defined and fields["email"].perm==0 %}no-visible{% endif %}">Email</th>
<th class="{% if fields["niveau01"].perm==0 %}no-visible{% endif %}">{{ labelniveau01 }}</th> <th class="{% if fields["niveau01"] is defined and fields["niveau01"].perm==0 %}no-visible{% endif %}">{{ labelniveau01 }}</th>
{% if viewniveau02 %} {% if viewniveau02 %}
<th class="no-sort {% if fields["niveau02"].perm==0 %}no-visible{% endif %}">{{ labelniveau02 }}</th> <th class="no-sort {% if fields["niveau02"] is defined and fields["niveau02"].perm==0 %}no-visible{% endif %}">{{ labelniveau02 }}</th>
{% endif %} {% endif %}
<th class="no-sort {% if fields["group"].perm==0 %}no-visible{% endif %}">Groupes</th> <th class="no-sort {% if fields["group"] is defined and fields["group"].perm==0 %}no-visible{% endif %}">Groupes</th>
<th class="{% if fields["role"].perm==0 %}no-visible{% endif %}">Rôle</th> <th class="{% if fields["role"] is defined and fields["role"].perm==0 %}no-visible{% endif %}">Rôle</th>
</tr> </tr>
</thead> </thead>
</table> </table>

View File

@ -340,6 +340,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(false); $entityWidget->setAutoajust(false);
$entityWidget->setBorder(true); $entityWidget->setBorder(true);
$entityWidget->setOpened(true); $entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": [{"id": "url", "loc": "col1", "type": "string", "label": "URL", "value": "", "mandatory": "true"}]}'); $parameter = json_decode('{"fields": [{"id": "url", "loc": "col1", "type": "string", "label": "URL", "value": "", "mandatory": "true"}]}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
@ -359,6 +360,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(true); $entityWidget->setAutoajust(true);
$entityWidget->setBorder(true); $entityWidget->setBorder(true);
$entityWidget->setOpened(true); $entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": [{"id": "modedesktop", "loc": "col1", "type": "desktopmode", "label": "Mode Affichage", "value": "0", "mandatory": "true"},{"id": "withbookmark", "loc": "col1", "type": "withbookmark", "label": "Avec Favoris", "value": "0", "mandatory": "true"},{"id": "itemcategory", "loc": "col1", "type": "itemcategory", "label": "Catégorie Affichée", "value": "", "mandatory": "false"}]}'); $parameter = json_decode('{"fields": [{"id": "modedesktop", "loc": "col1", "type": "desktopmode", "label": "Mode Affichage", "value": "0", "mandatory": "true"},{"id": "withbookmark", "loc": "col1", "type": "withbookmark", "label": "Avec Favoris", "value": "0", "mandatory": "true"},{"id": "itemcategory", "loc": "col1", "type": "itemcategory", "label": "Catégorie Affichée", "value": "", "mandatory": "false"}]}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
@ -378,6 +380,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(true); $entityWidget->setAutoajust(true);
$entityWidget->setBorder(true); $entityWidget->setBorder(true);
$entityWidget->setOpened(true); $entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": [{"id": "alertcategory", "loc": "col1", "type": "alertcategory", "label": "Catégorie Affichée", "value": "", "mandatory": "false"}]}'); $parameter = json_decode('{"fields": [{"id": "alertcategory", "loc": "col1", "type": "alertcategory", "label": "Catégorie Affichée", "value": "", "mandatory": "false"}]}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
@ -397,6 +400,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(true); $entityWidget->setAutoajust(true);
$entityWidget->setBorder(true); $entityWidget->setBorder(true);
$entityWidget->setOpened(true); $entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": []}'); $parameter = json_decode('{"fields": []}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
@ -416,6 +420,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(true); $entityWidget->setAutoajust(true);
$entityWidget->setBorder(true); $entityWidget->setBorder(true);
$entityWidget->setOpened(true); $entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": [{"id": "modedesktop", "loc": "col1", "type": "desktopmode", "label": "Mode Affichage", "value": "0", "mandatory": "true"}]}'); $parameter = json_decode('{"fields": [{"id": "modedesktop", "loc": "col1", "type": "desktopmode", "label": "Mode Affichage", "value": "0", "mandatory": "true"}]}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
@ -435,6 +440,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(true); $entityWidget->setAutoajust(true);
$entityWidget->setBorder(true); $entityWidget->setBorder(true);
$entityWidget->setOpened(true); $entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": [{"id": "url", "loc": "col1", "type": "string", "label": "URL", "value": "", "mandatory": "true"},{"id": "target", "loc": "col1", "type": "target", "label": "Ouvrir le lien dans", "value": "0", "mandatory": "true"}]}'); $parameter = json_decode('{"fields": [{"id": "url", "loc": "col1", "type": "string", "label": "URL", "value": "", "mandatory": "true"},{"id": "target", "loc": "col1", "type": "target", "label": "Ouvrir le lien dans", "value": "0", "mandatory": "true"}]}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
@ -454,6 +460,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(true); $entityWidget->setAutoajust(true);
$entityWidget->setBorder(true); $entityWidget->setBorder(true);
$entityWidget->setOpened(true); $entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": [{"id": "html", "loc": "col5", "type": "ckeditor", "label": "Texte", "value": "", "mandatory": "false"}]}'); $parameter = json_decode('{"fields": [{"id": "html", "loc": "col5", "type": "ckeditor", "label": "Texte", "value": "", "mandatory": "false"}]}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
@ -473,6 +480,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(false); $entityWidget->setAutoajust(false);
$entityWidget->setBorder(false); $entityWidget->setBorder(false);
$entityWidget->setOpened(true); $entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": [{"id": "interval", "loc": "col1", "type": "integer", "label": "Interval en seconde entre 2 images", "value": "5", "mandatory": "false"}]}'); $parameter = json_decode('{"fields": [{"id": "interval", "loc": "col1", "type": "integer", "label": "Interval en seconde entre 2 images", "value": "5", "mandatory": "false"}]}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
@ -492,6 +500,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(true); $entityWidget->setAutoajust(true);
$entityWidget->setBorder(true); $entityWidget->setBorder(true);
$entityWidget->setOpened(true); $entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": []}'); $parameter = json_decode('{"fields": []}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
@ -511,6 +520,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(true); $entityWidget->setAutoajust(true);
$entityWidget->setBorder(true); $entityWidget->setBorder(true);
$entityWidget->setOpened(true); $entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": []}'); $parameter = json_decode('{"fields": []}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
@ -530,6 +540,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(true); $entityWidget->setAutoajust(true);
$entityWidget->setBorder(true); $entityWidget->setBorder(true);
$entityWidget->setOpened(true); $entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": [{"id": "nbday", "loc": "col1", "type": "integer", "label": "Nombre de jours affichés", "value": "15", "mandatory": "true"}]}'); $parameter = json_decode('{"fields": [{"id": "nbday", "loc": "col1", "type": "integer", "label": "Nombre de jours affichés", "value": "15", "mandatory": "true"}]}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
@ -548,6 +559,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(true); $entityWidget->setAutoajust(true);
$entityWidget->setBorder(true); $entityWidget->setBorder(true);
$entityWidget->setOpened(true); $entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": [{"id": "nbarticle", "loc": "col1", "type": "integer", "label": "Nombre d\'articles affichés", "value": "10", "mandatory": "true"}]}'); $parameter = json_decode('{"fields": [{"id": "nbarticle", "loc": "col1", "type": "integer", "label": "Nombre d\'articles affichés", "value": "10", "mandatory": "true"}]}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
@ -567,6 +579,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(true); $entityWidget->setAutoajust(true);
$entityWidget->setBorder(true); $entityWidget->setBorder(true);
$entityWidget->setOpened(true); $entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": [{"id": "url", "loc": "col1", "type": "string", "label": "URL du Flux RSS", "value": "", "mandatory": "true"},{"id": "nbarticle", "loc": "col1", "type": "integer", "label": "Nombre d\'articles affichés (0 pour tout)", "value": "10", "mandatory": "true"}]}'); $parameter = json_decode('{"fields": [{"id": "url", "loc": "col1", "type": "string", "label": "URL du Flux RSS", "value": "", "mandatory": "true"},{"id": "nbarticle", "loc": "col1", "type": "integer", "label": "Nombre d\'articles affichés (0 pour tout)", "value": "10", "mandatory": "true"}]}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
@ -597,6 +610,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(true); $entityWidget->setAutoajust(true);
$entityWidget->setBorder(true); $entityWidget->setBorder(true);
$entityWidget->setOpened(true); $entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": [{"id": "modedesktop", "loc": "col1", "type": "desktopmode", "label": "Mode Affichage", "value": "0", "mandatory": "true"},{"id": "Applications", "loc": "col1", "type": "appexternal", "label": "Applications à affichier", "value": "", "mandatory": "false"}]}'); $parameter = json_decode('{"fields": [{"id": "modedesktop", "loc": "col1", "type": "desktopmode", "label": "Mode Affichage", "value": "0", "mandatory": "true"},{"id": "Applications", "loc": "col1", "type": "appexternal", "label": "Applications à affichier", "value": "", "mandatory": "false"}]}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
@ -617,6 +631,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(false); $entityWidget->setAutoajust(false);
$entityWidget->setBorder(false); $entityWidget->setBorder(false);
$entityWidget->setOpened(true); $entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$entityWidget->setColorbodyback("ffffff"); $entityWidget->setColorbodyback("ffffff");
$parameter = json_decode('{"fields": [{"id": "seetitle", "loc": "col1", "type": "boolean", "label": "Afficher le titre", "value": "0", "mandatory": "true"},{"id": "seeicon", "loc": "col1", "type": "boolean", "label": "Afficher l\'icone", "value": "0", "mandatory": "true"}]}'); $parameter = json_decode('{"fields": [{"id": "seetitle", "loc": "col1", "type": "boolean", "label": "Afficher le titre", "value": "0", "mandatory": "true"},{"id": "seeicon", "loc": "col1", "type": "boolean", "label": "Afficher l\'icone", "value": "0", "mandatory": "true"}]}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
@ -636,6 +651,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(false); $entityWidget->setAutoajust(false);
$entityWidget->setBorder(true); $entityWidget->setBorder(true);
$entityWidget->setOpened(true); $entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": [{"id": "clock", "loc": "col1", "type": "clock", "label": "Mode d\'affichage", "value": "0", "mandatory": "true"}]}'); $parameter = json_decode('{"fields": [{"id": "clock", "loc": "col1", "type": "clock", "label": "Mode d\'affichage", "value": "0", "mandatory": "true"}]}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
@ -654,6 +670,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(false); $entityWidget->setAutoajust(false);
$entityWidget->setBorder(true); $entityWidget->setBorder(true);
$entityWidget->setOpened(true); $entityWidget->setOpened(true);
$entityWidget->setAccess(["config","user","group"]);
$parameter = json_decode('{"fields": []}'); $parameter = json_decode('{"fields": []}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);

View File

@ -27,6 +27,7 @@ class PageController extends Controller
'useheader' => true, 'useheader' => true,
'usemenu' => false, 'usemenu' => false,
'usesidebar' => true, 'usesidebar' => true,
'istemplate' => false,
]); ]);
} }
@ -53,7 +54,10 @@ class PageController extends Controller
if($alluser=="false") { if($alluser=="false") {
$qbase->where("table.user is null"); $qbase->where("table.user is null");
$qbase->andWhere('table.parentfor is null') ;
$qsearch->where("table.user is null"); $qsearch->where("table.user is null");
$qsearch->andWhere('table.parentfor is null') ;
} }
else { else {
$qbase->from('CadolesCoreBundle:User','user') $qbase->from('CadolesCoreBundle:User','user')
@ -68,6 +72,7 @@ class PageController extends Controller
else else
$qsearch->andWhere('table.id LIKE :value OR table.name LIKE :value OR user.username LIKE :value') ; $qsearch->andWhere('table.id LIKE :value OR table.name LIKE :value OR user.username LIKE :value') ;
$qsearch->setParameter("value", "%".$search["value"]."%"); $qsearch->setParameter("value", "%".$search["value"]."%");
// Nombre total d'enregistrement // Nombre total d'enregistrement
@ -474,7 +479,7 @@ class PageController extends Controller
'canupdate' => $canupdate 'canupdate' => $canupdate
]); ]);
} }
// Type Editeur // Type Widgets
if($entity->getPageCategory()->getId()==2) { if($entity->getPageCategory()->getId()==2) {
return $this->render($this->labelentity.':viewwidget.html.twig', [ return $this->render($this->labelentity.':viewwidget.html.twig', [
'useheader' => ($access=="config"), 'useheader' => ($access=="config"),
@ -483,7 +488,8 @@ class PageController extends Controller
'entity' => $entity, 'entity' => $entity,
'access' => $access, 'access' => $access,
'canupdate' => $canupdate, 'canupdate' => $canupdate,
'widgets' => $this->getDoctrine()->getRepository("CadolesPortalBundle:Widget")->findAll() 'mode' => "view",
'widgets' => $this->getDoctrine()->getRepository("CadolesPortalBundle:Widget")->getWidgetAccess($access)
]); ]);
} }
// Type Editeur // Type Editeur

View File

@ -0,0 +1,288 @@
<?php
namespace Cadoles\PortalBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Filesystem\Filesystem;
use Cadoles\PortalBundle\Entity\Page;
use Cadoles\PortalBundle\Form\PagetemplateSubmitType;
use Cadoles\PortalBundle\Form\PageSubmitType;
use Cadoles\PortalBundle\Form\PageUpdateToolType;
use Cadoles\PortalBundle\Form\PageUpdateURLType;
use Cadoles\PortalBundle\Form\PageUpdateWidgetType;
use Cadoles\PortalBundle\Form\PageUpdateEditorType;
use Cadoles\PortalBundle\Form\PageShareType;
class PagetemplateController extends Controller
{
private $labelentity="CadolesPortalBundle:Page";
private $routeprimary="cadoles_portal_config_pagetemplate";
public function listAction()
{
return $this->render('CadolesPortalBundle:Pagetemplate:list.html.twig',[
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
]);
}
public function ajaxlistAction(Request $request,$access="config")
{
// S'assurer que c'est un appel ajax
if (!$request->isXmlHttpRequest()) {
return new JsonResponse(array('message' => 'Interdit'), 400);
}
$em = $this->getDoctrine()->getManager();
$start=$request->query->get('start');
$length= $request->query->get('length');
$search= $request->query->get('search');
$draw= $request->query->get('draw');
$order= $request->query->get('order');
// Query de base
$qbase=$em->createQueryBuilder()->from($this->labelentity,'table');
$qsearch=$em->createQueryBuilder()->from($this->labelentity,'table');
$qbase->where("table.user is null");
$qbase->andWhere('table.parentfor is not null') ;
$qsearch->where("table.user is null");
$qsearch->andWhere('table.parentfor is not null') ;
$qsearch->andwhere('table.id LIKE :value OR table.name LIKE :value OR table.parentfor LIKE :value');
$qsearch->setParameter("value", "%".$search["value"]."%");
// Nombre total d'enregistrement
$total = $qbase->select('COUNT(table)')->getQuery()->getSingleScalarResult();
// Nombre d'enregistrement filtré
if($search["value"]=="")
$totalf = $total;
else
$totalf= $qsearch->select('COUNT(table)')->getQuery()->getSingleScalarResult();
// Parcours des Enregistrement
if($search["value"]=="")
$qb = $qbase->select('table');
else
$qb = $qsearch->select('table');
// Order
switch($order[0]["column"]) {
case 1 :
$qb->orderBy('table.roworder',$order[0]["dir"]);
break;
case 2 :
$qb->orderBy('table.name',$order[0]["dir"]);
break;
case 3 :
$qb->orderBy('table.parentfor',$order[0]["dir"]);
break;
}
// Execution de la requete d'affichage
$datas=$qb->setFirstResult($start)->setMaxResults($length)->getQuery()->getResult();
// Construction du tableau de retour
$output = array(
'draw' => $draw,
'recordsFiltered' => $totalf,
'recordsTotal' => $total,
'data' => array(),
);
foreach($datas as $data) {
$route=str_replace("_config_","_".$access."_",$this->routeprimary);
$action = "";
//$action.="<a href='".$this->generateUrl($route.'_update', array('id'=>$data->getId()))."'><i class='fa fa-file fa-fw'></i></a>";
$action.="<a href='".$this->generateUrl($route.'_delete', array('id'=>$data->getId()))."' data-method='delete'><i class='fa fa-trash fa-fw fa-2x'></i></a>";
$action.="<a href='".$this->generateUrl($route.'_view', array('id'=>$data->getId()))."'><i class='fa fa-eye fa-2x'></i></a>";
array_push($output["data"],[
$action,
$data->getRoworder(),
$data->getName(),
$data->getParentfor(),
]);
}
// Retour
return new Response(json_encode($output), 200);
}
public function ajaxseleclistAction(Request $request)
{
// S'assurer que c'est un appel ajax
if (!$request->isXmlHttpRequest()) {
return new JsonResponse(array('message' => 'Interdit'), 400);
}
$output=array();
$em = $this->getDoctrine()->getManager();
$page_limit=$request->query->get('page_limit');
$q=$request->query->get('q');
$qb = $em->createQueryBuilder();
$qb->select('table')->from("CadolesPortalBundle:Page",'table')
->where('table.name LIKE :value')
->setParameter("value", "%".$q."%")
->orderBy('table.name');
$datas=$qb->setFirstResult(0)->setMaxResults($page_limit)->getQuery()->getResult();
foreach($datas as $data) {
array_push($output,array("id"=>$data->getId(),"text"=>$data->getName()));
}
$response = new Response(json_encode($output));
$response->headers->set('Content-Type', 'application/json');
return $response;
}
private function entityForm(Page $entity,$access="config")
{
$route=str_replace("_config_","_".$access."_",$this->routeprimary);
if ($this->getDoctrine()->getManager()->contains($entity)) {
return $this->createForm(PageUpdateWidgetType::class, $entity, [
"mode" => "update",
"access" => $access,
"for" => $entity->getParentfor(),
]);
}
else {
return $this->createForm(PagetemplateSubmitType::class, $entity, [
"mode" => "update",
"access" => $access
]);
}
}
public function submitAction(Request $request,$access="config")
{
if($access=="user"&&!$this->get('session')->get('cancreatepage'))
throw $this->createNotFoundException('Permission denied');
$pagecategory=$this->getDoctrine()->getRepository("CadolesPortalBundle:Pagecategory")->find(2);
$entity = new Page();
$entity->setMaxwidth(0);
$entity->setRoworder(0);
$entity->setParentfor("user");
$entity->setPagecategory($pagecategory);
$form = $this->entityForm($entity,$access);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
if($access=="user") $entity->setUser($this->getUser());
$em->persist($entity);
$em->flush();
$route=str_replace("_config_","_".$access."_",$this->routeprimary);
return $this->redirect($this->generateUrl($route.'_update',["id"=>$entity->getId()]));
}
return $this->render('CadolesPortalBundle:Pagetemplate:submit.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => ($access=="config"),
'maxwidth' => ($access=="user"),
'entity' => $entity,
'mode' => "submit",
'access' => $access,
'form' => $form->createView()
]);
}
public function updateAction(Request $request, $id,$access="config")
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($this->labelentity)->find($id);
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
// Création du formulaire
$form = $this->entityForm($entity,$access);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($entity);
$em->flush();
return $this->redirect($this->generateUrl($this->routeprimary.'_view',["id"=>$id]));
}
return $this->render('CadolesPortalBundle:Page:updatewidget.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => ($access=="config"),
'maxwidth' => ($access=="user"),
'entity' => $entity,
'access' => $access,
'mode' => "updatetemplate",
'form' => $form->createView(),
]);
}
public function deleteAction(Request $request, $id,$access="config")
{
$em = $this->getDoctrine()->getManager();
$entity = $this->getDoctrine()->getRepository($this->labelentity)->find($id);
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
// On s'assure que l'utilisateur à la permission de supprimer
if($access=="user") {
$em->getRepository($this->labelentity)->getPermission($this->getUser(),$entity,$cansee,$canupdate);
if(!$canupdate) throw $this->createNotFoundException('Permission denied');
}
// On s'assure que le template est supprimable
$info="";
$group = $em->getRepository("CadolesCoreBundle:Group")->findOneBy(["pagetemplate"=>$entity]);
if(!$group) {
// Suppression
$em->remove($entity);
$em->flush();
}
else {
$this->get('session')->getFlashBag()->clear();
$request->getSession()->getFlashBag()->add("error", "Impossible de supprimer ce modèle, il est utilisé par au moins un groupe");
}
// Retour
return $this->redirect($this->generateUrl($this->routeprimary));
}
public function viewAction($id,$access=null) {
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($this->labelentity)->find($id);
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
// Permissions
$canupdate = true;
return $this->render($this->labelentity.':viewwidget.html.twig', [
'useheader' => ($access=="config"),
'usemenu' => false,
'usesidebar' => ($access=="config"),
'entity' => $entity,
'access' => $access,
'canupdate' => $canupdate,
'mode' => "viewtemplate",
'widgets' => $this->getDoctrine()->getRepository("CadolesPortalBundle:Widget")->getWidgetAccess($access)
]);
}
}

View File

@ -38,7 +38,7 @@ class PagewidgetController extends Controller
return $results; return $results;
} }
private function entityForm(Pagewidget $entity,$idpage,$id,$access="config") private function entityForm(Pagewidget $entity,$idpage,$id,$access="config",$by="view")
{ {
if ($this->getDoctrine()->getManager()->contains($entity)) { if ($this->getDoctrine()->getManager()->contains($entity)) {
$widgettype= $this->getDoctrine()->getManager()->getRepository("CadolesPortalBundle:Pagewidget")->find($id)->getWidget(); $widgettype= $this->getDoctrine()->getManager()->getRepository("CadolesPortalBundle:Pagewidget")->find($id)->getWidget();
@ -73,7 +73,7 @@ class PagewidgetController extends Controller
$param = $widgettype->getParameter(); $param = $widgettype->getParameter();
return $this->createForm(PagewidgetType::class, $entity, [ return $this->createForm(PagewidgetType::class, $entity, [
'param' => $param, 'param' => $param,
'mode' => "submit", 'mode' => ($by=="view"?"submit":"submittemplate"),
'access' => $access, 'access' => $access,
'idicon' => $widgettype->getIcon()->getId(), 'idicon' => $widgettype->getIcon()->getId(),
'method' => 'POST', 'method' => 'POST',
@ -83,10 +83,12 @@ class PagewidgetController extends Controller
public function submitAction(Request $request,$idpage,$idwidgettype,$access="config") public function submitAction(Request $request,$idpage,$idwidgettype,$access="config")
{ {
$by=$request->query->get('by');
$entity = new Pagewidget(); $entity = new Pagewidget();
$form = $this->entityForm($entity,$idpage,$idwidgettype,$access); $form = $this->entityForm($entity,$idpage,$idwidgettype,$access,$by);
$form->handleRequest($request); $form->handleRequest($request);
// On s'assure que la page où l'on souhaite insérer un widget est bien du bon type // On s'assure que la page où l'on souhaite insérer un widget est bien du bon type
$page=$this->getDoctrine()->getRepository("CadolesPortalBundle:Page")->findoneby(["id"=>$idpage]); $page=$this->getDoctrine()->getRepository("CadolesPortalBundle:Page")->findoneby(["id"=>$idpage]);
if (!$page) if (!$page)
@ -125,8 +127,12 @@ class PagewidgetController extends Controller
$em->persist($entity); $em->persist($entity);
$em->flush(); $em->flush();
if($access=="config") if($access=="config") {
return $this->redirect($this->generateUrl('cadoles_portal_config_page_view',["id"=>$idpage])); if($by=="view")
return $this->redirect($this->generateUrl('cadoles_portal_config_page_view',["id"=>$idpage]));
else
return $this->redirect($this->generateUrl('cadoles_portal_config_pagetemplate_view',["id"=>$idpage]));
}
else else
return $this->redirect($this->generateUrl('cadoles_core_home',["id"=>$idpage])); return $this->redirect($this->generateUrl('cadoles_core_home',["id"=>$idpage]));
} }
@ -143,7 +149,7 @@ class PagewidgetController extends Controller
'entity' => $entity, 'entity' => $entity,
'icons' => $icons, 'icons' => $icons,
'iconsuser' => $iconsuser, 'iconsuser' => $iconsuser,
'mode' => "submit", 'mode' => ($by=="view"?"submit":"submittemplate"),
'access' => $access, 'access' => $access,
'idpage' => $idpage, 'idpage' => $idpage,
'form' => $form->createView(), 'form' => $form->createView(),
@ -152,6 +158,8 @@ class PagewidgetController extends Controller
public function updateAction(Request $request,$idpage,$idwidget,$access="config") public function updateAction(Request $request,$idpage,$idwidget,$access="config")
{ {
$by=$request->query->get('by');
// Recherche du pagewidget // Recherche du pagewidget
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($this->labelentity)->find($idwidget); $entity = $em->getRepository($this->labelentity)->find($idwidget);
@ -164,7 +172,7 @@ class PagewidgetController extends Controller
} }
// Création du formulaire // Création du formulaire
$form = $this->entityForm($entity,$idpage,$idwidget,$access); $form = $this->entityForm($entity,$idpage,$idwidget,$access,$by);
$form->handleRequest($request); $form->handleRequest($request);
// Validation // Validation
@ -194,7 +202,10 @@ class PagewidgetController extends Controller
$em->persist($entity); $em->persist($entity);
$em->flush(); $em->flush();
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_page_view',["id"=>$idpage])); if($by=="view")
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_page_view',["id"=>$idpage]));
else
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_pagetemplate_view',["id"=>$idpage]));
} }
$icons=$this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findBy(["user"=>null]); $icons=$this->getDoctrine()->getRepository("CadolesPortalBundle:Icon")->findBy(["user"=>null]);
@ -209,7 +220,7 @@ class PagewidgetController extends Controller
'entity' => $entity, 'entity' => $entity,
'icons' => $icons, 'icons' => $icons,
'iconsuser' => $iconsuser, 'iconsuser' => $iconsuser,
'mode' => "update", 'mode' => ($by=="view"?"update":"updatetemplate"),
'access' => $access, 'access' => $access,
'idpage' => $idpage, 'idpage' => $idpage,
'form' => $form->createView(), 'form' => $form->createView(),
@ -985,7 +996,7 @@ class PagewidgetController extends Controller
"image" => $imgurl, "image" => $imgurl,
// "color" => $flux->getColor(), // "color" => $flux->getColor(),
"fluxid" => 0, "fluxid" => 0,
"fluxname" => $entity->getName(), "fluxtitle" => $entity->getName(),
)); ));
$nbflux++; $nbflux++;
@ -1023,12 +1034,14 @@ class PagewidgetController extends Controller
$canupdate = true; $canupdate = true;
} }
else { else {
// On s'assure que l'utilisateur à la permission de voir // On s'assure que l'utilisateur à la permission de voir
$page=$entity->getPage(); $page=$entity->getPage();
$em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate); $em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate);
if(!$cansee) throw $this->createNotFoundException('Permission denied'); if(!$cansee) throw $this->createNotFoundException('Permission denied');
} }
// Récupération des paramétres du widget // Récupération des paramétres du widget
$modedesktop=0; $modedesktop=0;
foreach($entity->getParameter()["fields"] as $parameter) { foreach($entity->getParameter()["fields"] as $parameter) {
@ -1048,7 +1061,7 @@ class PagewidgetController extends Controller
// Render // Render
return $this->render($this->labelentity.':viewbookmark.html.twig', [ return $this->render($this->labelentity.':viewbookmark.html.twig', [
'entity' => $entity, 'entity' => $entity,
'canadd' => ($user), 'canadd' => $canupdate,
'canupdate' => $canupdate, 'canupdate' => $canupdate,
'modedesktop' => $modedesktop, 'modedesktop' => $modedesktop,
'bookmarks' => $bookmarks, 'bookmarks' => $bookmarks,
@ -1333,6 +1346,10 @@ class PagewidgetController extends Controller
$tmp['calendar'] = $calendar->getId(); $tmp['calendar'] = $calendar->getId();
$tmp['editable'] = $calendar->getCanupdate(); $tmp['editable'] = $calendar->getCanupdate();
// Si évènement sur la journée on enlève une 1 seconde à la date de fin
if($tmp['allDay'])
$tmp['end']->sub(new \DateInterval('PT1S'));
array_push($events,$tmp); array_push($events,$tmp);
} }
} }

View File

@ -73,7 +73,6 @@ class Icon
*/ */
private $widgets; private $widgets;
/** /**
* @var ArrayCollection $bookmarks * @var ArrayCollection $bookmarks
* @var Bookmark * @var Bookmark
@ -81,6 +80,16 @@ class Icon
* @ORM\OneToMany(targetEntity="Bookmark", mappedBy="icon", cascade={"persist"}, orphanRemoval=false) * @ORM\OneToMany(targetEntity="Bookmark", mappedBy="icon", cascade={"persist"}, orphanRemoval=false)
*/ */
private $bookmarks; private $bookmarks;
/**
* @var ArrayCollection $groups
* @var Group
*
* @ORM\OneToMany(targetEntity="Cadoles\CoreBundle\Entity\Group", mappedBy="icon", cascade={"persist"}, orphanRemoval=false)
*/
private $groups;
/** /**
* Constructor * Constructor
*/ */
@ -355,4 +364,38 @@ class Icon
{ {
return $this->bookmarks; return $this->bookmarks;
} }
/**
* Add group
*
* @param \Cadoles\CoreBundle\Entity\Group $group
*
* @return Icon
*/
public function addGroup(\Cadoles\CoreBundle\Entity\Group $group)
{
$this->groups[] = $group;
return $this;
}
/**
* Remove group
*
* @param \Cadoles\CoreBundle\Entity\Group $group
*/
public function removeGroup(\Cadoles\CoreBundle\Entity\Group $group)
{
$this->groups->removeElement($group);
}
/**
* Get groups
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getGroups()
{
return $this->groups;
}
} }

View File

@ -67,6 +67,13 @@ class Page
*/ */
private $template; private $template;
/**
* @var string
*
* @ORM\Column(name="parentfor", type="string", nullable=true)
*/
protected $parentfor;
/** /**
* @var string * @var string
* *
@ -96,13 +103,37 @@ class Page
/** /**
* @var ArrayCollection $pagewidgets * @var ArrayCollection $pagewidgets
* @var Order * @var Pagewidget
* *
* @ORM\OneToMany(targetEntity="Pagewidget", mappedBy="page", cascade={"persist"}, orphanRemoval=true) * @ORM\OneToMany(targetEntity="Pagewidget", mappedBy="page", cascade={"persist"}, orphanRemoval=true)
* @ORM\OrderBy({"loc" = "ASC", "roworder" = "ASC"}) * @ORM\OrderBy({"loc" = "ASC", "roworder" = "ASC"})
*/ */
private $pagewidgets; private $pagewidgets;
/**
* @ORM\ManyToOne(targetEntity="Page", inversedBy="pages")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $page;
/**
* @var ArrayCollection $pages
* @var Page
*
* @ORM\OneToMany(targetEntity="Page", mappedBy="page", cascade={"persist"}, orphanRemoval=false)
*/
private $pages;
/**
* @var ArrayCollection $templategroups
* @var Group
*
* @ORM\OneToMany(targetEntity="Cadoles\CoreBundle\Entity\Group", mappedBy="pagetemplate", cascade={"persist"}, orphanRemoval=false)
*/
private $templategroups;
/* champs calculé non stocké en base */ /* champs calculé non stocké en base */
private $canupdate; private $canupdate;
@ -118,7 +149,6 @@ class Page
/** /**
* Constructor * Constructor
*/ */
@ -126,6 +156,7 @@ class Page
{ {
$this->groups = new \Doctrine\Common\Collections\ArrayCollection(); $this->groups = new \Doctrine\Common\Collections\ArrayCollection();
$this->pagewidgets = new \Doctrine\Common\Collections\ArrayCollection(); $this->pagewidgets = new \Doctrine\Common\Collections\ArrayCollection();
$this->pages = new \Doctrine\Common\Collections\ArrayCollection();
} }
/** /**
@ -282,6 +313,30 @@ class Page
return $this->template; return $this->template;
} }
/**
* Set parentfor
*
* @param string $parentfor
*
* @return Page
*/
public function setParentfor($parentfor)
{
$this->parentfor = $parentfor;
return $this;
}
/**
* Get parentfor
*
* @return string
*/
public function getParentfor()
{
return $this->parentfor;
}
/** /**
* Set roles * Set roles
* *
@ -421,4 +476,96 @@ class Page
{ {
return $this->pagewidgets; return $this->pagewidgets;
} }
/**
* Set page
*
* @param \Cadoles\PortalBundle\Entity\Page $page
*
* @return Page
*/
public function setPage(\Cadoles\PortalBundle\Entity\Page $page = null)
{
$this->page = $page;
return $this;
}
/**
* Get page
*
* @return \Cadoles\PortalBundle\Entity\Page
*/
public function getPage()
{
return $this->page;
}
/**
* Add page
*
* @param \Cadoles\PortalBundle\Entity\Page $page
*
* @return Page
*/
public function addPage(\Cadoles\PortalBundle\Entity\Page $page)
{
$this->pages[] = $page;
return $this;
}
/**
* Remove page
*
* @param \Cadoles\PortalBundle\Entity\Page $page
*/
public function removePage(\Cadoles\PortalBundle\Entity\Page $page)
{
$this->pages->removeElement($page);
}
/**
* Get pages
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getPages()
{
return $this->pages;
}
/**
* Add templategroup
*
* @param \Cadoles\CoreBundle\Entity\Group $templategroup
*
* @return Page
*/
public function addTemplategroup(\Cadoles\CoreBundle\Entity\Group $templategroup)
{
$this->templategroups[] = $templategroup;
return $this;
}
/**
* Remove templategroup
*
* @param \Cadoles\CoreBundle\Entity\Group $templategroup
*/
public function removeTemplategroup(\Cadoles\CoreBundle\Entity\Group $templategroup)
{
$this->templategroups->removeElement($templategroup);
}
/**
* Get templategroups
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getTemplategroups()
{
return $this->templategroups;
}
} }

View File

@ -12,6 +12,7 @@ use Symfony\Component\Validator\Constraints as Assert;
* @ORM\Entity * @ORM\Entity
* @ORM\Table(name="widget") * @ORM\Table(name="widget")
* @ORM\HasLifecycleCallbacks * @ORM\HasLifecycleCallbacks
* @ORM\Entity(repositoryClass="Cadoles\PortalBundle\Repository\WidgetRepository")
*/ */
class Widget class Widget
{ {
@ -108,6 +109,13 @@ class Widget
*/ */
protected $colorbodyfont; protected $colorbodyfont;
/**
* @var string
*
* @ORM\Column(name="access", type="array", nullable=true)
*/
protected $access;
/** /**
* @var string * @var string
* *
@ -136,7 +144,6 @@ class Widget
return $this; return $this;
} }
/** /**
* Constructor * Constructor
*/ */
@ -443,6 +450,30 @@ class Widget
return $this->colorbodyfont; return $this->colorbodyfont;
} }
/**
* Set access
*
* @param string $access
*
* @return Widget
*/
public function setAccess($access)
{
$this->access = $access;
return $this;
}
/**
* Get access
*
* @return string
*/
public function getAccess()
{
return $this->access;
}
/** /**
* Set parameter * Set parameter
* *

View File

@ -31,28 +31,16 @@ class BlogWriterType extends AbstractType
'class' => 'CadolesCoreBundle:User', 'class' => 'CadolesCoreBundle:User',
'query_builder' => function(EntityRepository $er) use ($id,$access) { 'query_builder' => function(EntityRepository $er) use ($id,$access) {
$qb= $er->createQueryBuilder('user'); $qb= $er->createQueryBuilder('user');
if($access=="config") return $qb->select('user')
return $qb->select('user')
->from('CadolesPortalBundle:Blog','blog') ->from('CadolesPortalBundle:Blog','blog')
->where('blog.id=:blog') ->andwhere('blog.id=:blog')
->from('CadolesCoreBundle:UserGroup','usergroup') ->from('CadolesCoreBundle:UserGroup','usergroup')
->andwhere("usergroup.group MEMBER OF blog.groups AND usergroup.user=user") ->andwhere("usergroup.group MEMBER OF blog.groups")
->orwhere($qb->expr()->like('blog.roles', $qb->expr()->concat($qb->expr()->literal('%'),$qb->expr()->concat('user.role',$qb->expr()->literal('%'))))) ->andwhere("usergroup.user=user")
->setParameter('blog',$id); ->setParameter('blog',$id);
else
return $qb->select('user')
->from('CadolesPortalBundle:Blog','blog')
->andwhere('blog.id=:blog')
->from('CadolesCoreBundle:UserGroup','usergroup')
->andwhere("usergroup.group MEMBER OF blog.groups")
->andwhere("usergroup.user=user")
->setParameter('blog',$id);
}, },
'choice_label' => 'username', 'choice_label' => 'username',
'multiple' => true, 'multiple' => true,

View File

@ -64,17 +64,18 @@ class BlogarticleType extends AbstractType
'query_builder' => function(EntityRepository $er) use ($user) { 'query_builder' => function(EntityRepository $er) use ($user) {
$qb=$er->createQueryBuilder('blog'); $qb=$er->createQueryBuilder('blog');
return $qb->select('blog') return $qb->select('blog')
->andwhere(':user MEMBER OF blog.writers') ->where('blog.user=:user')
->orwhere(':user MEMBER OF blog.writers')
->from('CadolesCoreBundle:UserGroup','usergroup')
->orwhere('usergroup.group MEMBER OF blog.groups AND usergroup.user=:user AND usergroup.fgmanager=:flag')
->from('CadolesCoreBundle:User','user') ->from('CadolesCoreBundle:User','user')
->andwhere("user=:user") ->andwhere("user=:user")
->from('CadolesCoreBundle:UserGroup','usergroup') ->setparameter('user',$user)
->andwhere('usergroup.group MEMBER OF blog.groups AND usergroup.user=:user') ->setparameter('flag',true);
->orwhere($qb->expr()->like('blog.roles', $qb->expr()->concat($qb->expr()->literal('%'),$qb->expr()->concat('user.role',$qb->expr()->literal('%')))))
->orwhere('blog.user=:user')
->setparameter('user',$user);
}, },
]); ]);
} }

View File

@ -40,7 +40,7 @@ class PageUpdateWidgetType extends AbstractType
'required' => false 'required' => false
]); ]);
if($options["access"]=="config") { if($options["access"]=="config"&&$options["for"]!="group") {
$builder $builder
->add('roles', ChoiceType::class, [ ->add('roles', ChoiceType::class, [
"label" => 'Visible pour les Rôles', "label" => 'Visible pour les Rôles',
@ -80,7 +80,8 @@ class PageUpdateWidgetType extends AbstractType
$resolver->setDefaults([ $resolver->setDefaults([
'data_class' => 'Cadoles\PortalBundle\Entity\Page', 'data_class' => 'Cadoles\PortalBundle\Entity\Page',
'access' => 'string', 'access' => 'string',
'mode' => 'string' 'mode' => 'string',
'for' => 'string'
]); ]);
} }
} }

View File

@ -0,0 +1,54 @@
<?php
namespace Cadoles\PortalBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\OptionsResolver\OptionsResolver;
class PagetemplateSubmitType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('submit', SubmitType::class, [
"label" => ($options["mode"]=="delete"?"Confirmer la Suppression":"Valider"),
"attr" => ($options["mode"]=="delete"?array("class" => "btn btn-danger"):array("class" => "btn btn-success"))
])
->add('name', TextType::class, [
'label' => 'Nom'
])
->add('parentfor', ChoiceType::class, [
"label" => 'Modèle pour les',
"choices" => [
"Utilisateurs" => 'user',
"Groupes" => 'group',
],
])
->add('roworder', IntegerType::class, [
'label' => 'Ordre',
])
->add('maxwidth', IntegerType::class, [
'label' => "Largeur maximum (0 pour largeur de l'écran)",
]);
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'Cadoles\PortalBundle\Entity\Page',
'mode' => 'string',
'access' => 'string'
]);
}
}

View File

@ -120,6 +120,7 @@ class BlogRepository extends EntityRepository
$groups=($user?$user->getGroups():[]); $groups=($user?$user->getGroups():[]);
// La blog est-elle dans les blogs associées à un partage de group ? // La blog est-elle dans les blogs associées à un partage de group ?
/*
$inblogsshared=$this->createQueryBuilder('blog') $inblogsshared=$this->createQueryBuilder('blog')
->from('CadolesCoreBundle:Group','g') ->from('CadolesCoreBundle:Group','g')
->from('CadolesCoreBundle:UserGroup','ug') ->from('CadolesCoreBundle:UserGroup','ug')
@ -138,6 +139,7 @@ class BlogRepository extends EntityRepository
->setParameter('user',$user) ->setParameter('user',$user)
->getQuery()->getResult(); ->getQuery()->getResult();
if($inblogsshared) $cansee=true; if($inblogsshared) $cansee=true;
*/
// La blog est-elle dans les blogs associées au role de l'utilisateur ? // La blog est-elle dans les blogs associées au role de l'utilisateur ?
foreach($roles as $role) { foreach($roles as $role) {
@ -162,7 +164,14 @@ class BlogRepository extends EntityRepository
->setParameter("group",$group->getGroup()); ->setParameter("group",$group->getGroup());
$inbloggroup=$qb->getQuery()->getResult(); $inbloggroup=$qb->getQuery()->getResult();
if($inbloggroup) $cansee=true; if($inbloggroup) {
$cansee=true;
// Est-il manager du groupe
if($group->getGroup()->getFgcanshare()) {
if($group->getFgmanager()) $canadd=true;
}
}
} }
// utilisateur a-t-il la permission d'écriture // utilisateur a-t-il la permission d'écriture
@ -175,6 +184,7 @@ class BlogRepository extends EntityRepository
$canadd=false; $canadd=false;
if($user) { if($user) {
// Peut ecrire ceux qui sont déclaré comme écrivain
$qb = $this->createQueryBuilder("blog"); $qb = $this->createQueryBuilder("blog");
$qb ->andWhere("blog.id=:id") $qb ->andWhere("blog.id=:id")
->andwhere(':user MEMBER OF blog.writers') ->andwhere(':user MEMBER OF blog.writers')
@ -183,13 +193,37 @@ class BlogRepository extends EntityRepository
->andwhere("user=:user") ->andwhere("user=:user")
->from('CadolesCoreBundle:UserGroup','usergroup') ->from('CadolesCoreBundle:UserGroup','usergroup')
->andwhere('usergroup.group MEMBER OF blog.groups AND usergroup.user=:user') ->andwhere('usergroup.group MEMBER OF blog.groups')
->orwhere($qb->expr()->like('blog.roles', $qb->expr()->concat($qb->expr()->literal('%'),$qb->expr()->concat('user.role',$qb->expr()->literal('%'))))) ->andwhere('usergroup.user=:user')
->setParameter("id",$blog->getId()) ->setParameter("id",$blog->getId())
->setparameter('user',$user); ->setparameter('user',$user);
$inblogwriters=$qb->getQuery()->getResult(); $inblogwriters=$qb->getQuery()->getResult();
if($inblogwriters) $canadd=true; if($inblogwriters) $canadd=true;
// Peut ecrire ceux qui sont manager du groupe auquel est rattaché le blog
$qb = $this->createQueryBuilder("blog");
$qb ->andWhere("blog.id=:id")
->from('CadolesCoreBundle:User','user')
->andwhere("user=:user")
->from('CadolesCoreBundle:UserGroup','usergroup')
->andwhere('usergroup.group MEMBER OF blog.groups')
->andwhere('usergroup.user=:user')
->andwhere('usergroup.fgmanager=:flag')
->from('CadolesCoreBundle:Group','groupe')
->andwhere('groupe=usergroup.group')
->andwhere('groupe.fgcanshare=:flag')
->setParameter("id",$blog->getId())
->setparameter('user',$user)
->setparameter('flag',true);
$inblogwriters=$qb->getQuery()->getResult();
if($inblogwriters) $canadd=true;
} }
return $canadd; return $canadd;

View File

@ -90,7 +90,7 @@ class CalendarRepository extends EntityRepository
// Permission sur les calendars // Permission sur les calendars
foreach($calendarsadmin as $calendaradmin) { foreach($calendarsadmin as $calendaradmin) {
$calendaradmin->setCanupdate(false); $calendaradmin->setCanupdate($this->getInwriter($user,$calendaradmin));
} }
} }
@ -108,27 +108,8 @@ class CalendarRepository extends EntityRepository
$roles=($user?$user->getRoles():["ROLE_ANONYME"]); $roles=($user?$user->getRoles():["ROLE_ANONYME"]);
$groups=($user?$user->getGroups():[]); $groups=($user?$user->getGroups():[]);
// La calendar est-elle dans les calendars associées à un partage de group ?
$incalendarsshared=$this->createQueryBuilder('calendar')
->from('CadolesCoreBundle:Group','g')
->from('CadolesCoreBundle:UserGroup','ug')
->from('CadolesCoreBundle:UserGroup','proprio')
->where('g.fgcanshare=:fgcanshare')
->andWhere('calendar.id = :id')
->andWhere('g=ug.group')
->andWhere('ug.user=:user')
->andWhere('g MEMBER OF calendar.groups')
->andWhere('calendar.user != :user')
->andWhere('calendar.user is not null')
->andWhere('proprio.user=calendar.user')
->andWhere('proprio.group=g')
->setParameter("id",$calendar->getId())
->setParameter('fgcanshare',true)
->setParameter('user',$user)
->getQuery()->getResult();
if($incalendarsshared) $cansee=true;
// La calendar est-elle dans les calendars associées au role de l'utilisateur ? // Le calendar est-il dans les calendars associées au role de l'utilisateur ?
foreach($roles as $role) { foreach($roles as $role) {
$qb = $this->createQueryBuilder("calendar"); $qb = $this->createQueryBuilder("calendar");
$qb ->where($qb->expr()->like('calendar.roles', $qb->expr()->literal("%$role%"))) $qb ->where($qb->expr()->like('calendar.roles', $qb->expr()->literal("%$role%")))
@ -139,8 +120,7 @@ class CalendarRepository extends EntityRepository
if($incalendarrole) $cansee=true; if($incalendarrole) $cansee=true;
} }
// Le calendar est-il dans les calendars associées aux groupes de l'utilisateur ?
// La calendar est-elle dans les calendars associées aux groupes de l'utilisateur ?
foreach($groups as $group) { foreach($groups as $group) {
$qb = $this->createQueryBuilder("calendar"); $qb = $this->createQueryBuilder("calendar");
$qb ->where(":group MEMBER OF calendar.groups") $qb ->where(":group MEMBER OF calendar.groups")
@ -151,8 +131,46 @@ class CalendarRepository extends EntityRepository
->setParameter("group",$group->getGroup()); ->setParameter("group",$group->getGroup());
$incalendargroup=$qb->getQuery()->getResult(); $incalendargroup=$qb->getQuery()->getResult();
if($incalendargroup) $cansee=true; if($incalendargroup) {
$cansee=true;
// Est-il manager du groupe
if($group->getGroup()->getFgcanshare()) {
if($group->getFgmanager()) $canupdate=true;
}
}
} }
} }
} }
public function getInwriter($user,$calendar) {
$canadd=false;
if($user) {
// Peut ecrire ceux qui sont manager du groupe auquel est rattaché le calendar
$qb = $this->createQueryBuilder("calendar");
$qb ->andWhere("calendar.id=:id")
->from('CadolesCoreBundle:User','user')
->andwhere("user=:user")
->from('CadolesCoreBundle:UserGroup','usergroup')
->andwhere('usergroup.group MEMBER OF calendar.groups')
->andwhere('usergroup.user=:user')
->andwhere('usergroup.fgmanager=:flag')
->from('CadolesCoreBundle:Group','groupe')
->andwhere('groupe=usergroup.group')
->andwhere('groupe.fgcanshare=:flag')
->setParameter("id",$calendar->getId())
->setparameter('user',$user)
->setparameter('flag',true);
$inblogwriters=$qb->getQuery()->getResult();
if($inblogwriters) $canadd=true;
}
return $canadd;
}
} }

View File

@ -5,6 +5,7 @@ namespace Cadoles\PortalBundle\Repository;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Cadoles\PortalBundle\Entity\Page; use Cadoles\PortalBundle\Entity\Page;
use Cadoles\PortalBundle\Entity\Pagewidget;
use Cadoles\PortalBundle\Entity\Pagecategory; use Cadoles\PortalBundle\Entity\Pagecategory;
class PageRepository extends EntityRepository class PageRepository extends EntityRepository
@ -17,13 +18,58 @@ class PageRepository extends EntityRepository
// &$pages = les pages système de l'utilistauer // &$pages = les pages système de l'utilistauer
// &$pagesshared = les pages partagées pour l'utilisateur // &$pagesshared = les pages partagées pour l'utilisateur
public function getPagesUser($user,$id,&$entity,&$pagesuser,&$pages,&$pagesshared) public function getPagesUser($user,$id,&$entity,&$pagesuser,&$pages,&$groupsshared)
{ {
// Profilage // Profilage
$roles=($user?$user->getRoles():["ROLE_ANONYME"]); $roles=($user?$user->getRoles():["ROLE_ANONYME"]);
$groups=($user?$user->getGroups():[]); $groups=($user?$user->getGroups():[]);
// Récupération des pages de l'utilisateur
// CREATION DES PAGES TEMPLATE UTILISATEUR
if($user) {
// Initialisation du calcul des templates
$templatesnotorder=new ArrayCollection();
// Récupération des templates par rôles
foreach($roles as $role) {
$qb = $this->createQueryBuilder("page");
$qb ->where($qb->expr()->like('page.roles', $qb->expr()->literal("%$role%")))
->andWhere("page.user is null")
->andWhere("page.parentfor='user'");
$templatesroles=$qb->getQuery()->getResult();
foreach($templatesroles as $templaterole) {
if(!$templatesnotorder->contains($templaterole)) $templatesnotorder->add($templaterole);
}
}
// Récupération des templates par group
foreach($groups as $group) {
$qb = $this->createQueryBuilder("page");
$qb ->where(":group MEMBER OF page.groups")
->andWhere("page.user is null")
->andWhere("page.parentfor='user'")
->setParameter("group",$group->getGroup());
$templatesgroups=$qb->getQuery()->getResult();
foreach($templatesgroups as $templategroup) {
if(!$templatesnotorder->contains($templategroup)) $templatesnotorder->add($templategroup);
}
}
// Pour chaque template associé au profil de l'utilisateur on s'assure qu'il possède bien la page
foreach($templatesnotorder as $template) {
$exist=$this->getEntityManager()->getRepository("CadolesPortalBundle:Page")->findBy(["page"=>$template]);
if(!$exist) {
$page=$this->clonePage($user,$template);
}
}
}
// GENERATION DES PAGES UTILISATEURS
// Une page utilisateur est une page dont il est le propriétaire mais qui n'est pas partagé dans un groupe
$pagesuser=false; $pagesuser=false;
if($user) { if($user) {
$qb = $this->createQueryBuilder('page'); $qb = $this->createQueryBuilder('page');
@ -32,16 +78,64 @@ class PageRepository extends EntityRepository
->orderBy('page.roworder', 'ASC') ->orderBy('page.roworder', 'ASC')
->addOrderBy('page.name', 'ASC'); ->addOrderBy('page.name', 'ASC');
$pagesuser=$qb->getQuery()->getResult(); $pagesuser=$qb->getQuery()->getResult();
foreach($pagesuser as $key => $pageuser) {
if(!($pageuser->getGroups()->isEmpty()))
unset($pagesuser[$key]);
}
} }
// Permission sur les pages // Permission sur les pages = il a forcement le droit des les modifier : elles sont à lui
if($pagesuser) { if($pagesuser) {
foreach($pagesuser as $pageuser) { foreach($pagesuser as $pageuser) {
$pageuser->setCanupdate(true); $pageuser->setCanupdate(true);
} }
} }
// Pages partagées
// GENERATION DES PAGES GROUPES DE TRAVAIL
// Une page groupe de travail est une page associée à un groupe fgcanshare sur lequel l'utilisateur est inscrit
if($user) {
// En premier lieu on liste les groupes de travail de l'utilisateur
$groupsshared=$this ->getEntityManager()->createQueryBuilder()
->select('g')
->from('CadolesCoreBundle:Group','g')
->from('CadolesCoreBundle:UserGroup','ug')
->where('g.fgcanshare=:fgcanshare')
->andWhere('g=ug.group')
->andWhere('ug.user=:user')
->setParameter('fgcanshare',true)
->setParameter('user',$user)
->getQuery()->getResult();
// Pour chaque groupe de travail : on s'assure que le groupe possède au moins une page
// Sinon création de la page template associée au groupe
foreach($groupsshared as $key => $groupshared) {
$pagesshared=$this ->createQueryBuilder('page')
->from('CadolesCoreBundle:Group','g')
->where('g.id=:id')
->andWhere('g MEMBER OF page.groups')
->setParameter('id',$groupshared->getId())
->getQuery()->getResult();
if(empty($pagesshared)) {
unset($groupsshared[$key]);
}
else {
// Si l'utilisateur est manager du group il aura les permissions de modification sur la page
$usergroup=$this->getEntityManager()->getRepository("CadolesCoreBundle:UserGroup")->findOneBy(["user"=>$user,"group"=>$groupshared]);
if($usergroup&&$usergroup->getFgmanager()) {
foreach($pagesshared as $key2 => $pageshared) {
$pagesshared[$key2]->setCanupdate(true);
}
}
$groupsshared[$key]->pagesshared=$pagesshared;
}
}
}
$pagesshared=false; $pagesshared=false;
if($user) { if($user) {
$pagesshared=$this->createQueryBuilder('page') $pagesshared=$this->createQueryBuilder('page')
@ -63,7 +157,7 @@ class PageRepository extends EntityRepository
->getQuery()->getResult(); ->getQuery()->getResult();
} }
// GENERATION DES PAGES ADMINISTRATEUR
// Initialisation du calcul des pages // Initialisation du calcul des pages
$pagesnotorder=new ArrayCollection(); $pagesnotorder=new ArrayCollection();
@ -71,7 +165,8 @@ class PageRepository extends EntityRepository
foreach($roles as $role) { foreach($roles as $role) {
$qb = $this->createQueryBuilder("page"); $qb = $this->createQueryBuilder("page");
$qb ->where($qb->expr()->like('page.roles', $qb->expr()->literal("%$role%"))) $qb ->where($qb->expr()->like('page.roles', $qb->expr()->literal("%$role%")))
->andWhere("page.user is null"); ->andWhere("page.user is null")
->andWhere("page.parentfor is null");
$pagesroles=$qb->getQuery()->getResult(); $pagesroles=$qb->getQuery()->getResult();
foreach($pagesroles as $pagerole) { foreach($pagesroles as $pagerole) {
@ -81,14 +176,17 @@ class PageRepository extends EntityRepository
// Récupération des pages par group // Récupération des pages par group
foreach($groups as $group) { foreach($groups as $group) {
$qb = $this->createQueryBuilder("page"); if(!$group->getGroup()->getFgcanshare()) {
$qb ->where(":group MEMBER OF page.groups") $qb = $this->createQueryBuilder("page");
->andWhere("page.user is null") $qb ->where(":group MEMBER OF page.groups")
->setParameter("group",$group->getGroup()); ->andWhere("page.user is null")
->andWhere("page.parentfor is null")
->setParameter("group",$group->getGroup());
$pagesgroups=$qb->getQuery()->getResult(); $pagesgroups=$qb->getQuery()->getResult();
foreach($pagesgroups as $pagegroup) { foreach($pagesgroups as $pagegroup) {
if(!$pagesnotorder->contains($pagegroup)) $pagesnotorder->add($pagegroup); if(!$pagesnotorder->contains($pagegroup)) $pagesnotorder->add($pagegroup);
}
} }
} }
@ -120,10 +218,12 @@ class PageRepository extends EntityRepository
$have=true; $have=true;
} }
} }
if($pagesshared) { if($groupsshared) {
foreach($pagesshared as $v) { foreach($groupsshared as $groupshared) {
if($v == $entity) foreach($groupshared->pagesshared as $v) {
$have=true; if($v == $entity)
$have=true;
}
} }
} }
@ -141,12 +241,12 @@ class PageRepository extends EntityRepository
// ou On récupère la premiere page de l'utilisateur // ou On récupère la premiere page de l'utilisateur
if(!$entity && !empty($pagesuser)) { if(!$entity && !empty($pagesuser)) {
$entity=$pagesuser[0]; $entity=$pagesuser[$this->firstkey($pagesuser)];
} }
// ou On récupère la premiere page partagées // ou On récupère la premiere page partagées
if(!$entity && !empty($pagesshared)) { if(!$entity && !empty($pagesshared)) {
$entity=$pagesshared[0]; $entity=$pagesshared[$this->firstkey($pagesshared)];
} }
} }
@ -165,6 +265,7 @@ class PageRepository extends EntityRepository
$groups=($user?$user->getGroups():[]); $groups=($user?$user->getGroups():[]);
// La page est-elle dans les pages associées à un partage de group ? // La page est-elle dans les pages associées à un partage de group ?
/*
$inpagesshared=$this->createQueryBuilder('page') $inpagesshared=$this->createQueryBuilder('page')
->from('CadolesCoreBundle:Group','g') ->from('CadolesCoreBundle:Group','g')
->from('CadolesCoreBundle:UserGroup','ug') ->from('CadolesCoreBundle:UserGroup','ug')
@ -183,6 +284,7 @@ class PageRepository extends EntityRepository
->setParameter('user',$user) ->setParameter('user',$user)
->getQuery()->getResult(); ->getQuery()->getResult();
if($inpagesshared) $cansee=true; if($inpagesshared) $cansee=true;
*/
// La page est-elle dans les pages associées au role de l'utilisateur ? // La page est-elle dans les pages associées au role de l'utilisateur ?
foreach($roles as $role) { foreach($roles as $role) {
@ -207,8 +309,64 @@ class PageRepository extends EntityRepository
->setParameter("group",$group->getGroup()); ->setParameter("group",$group->getGroup());
$inpagegroup=$qb->getQuery()->getResult(); $inpagegroup=$qb->getQuery()->getResult();
if($inpagegroup) $cansee=true; if($inpagegroup) {
$cansee=true;
// Est-il manager du groupe
if($group->getGroup()->getFgcanshare()) {
if($group->getFgmanager()) $canupdate=true;
}
}
} }
} }
} }
public function clonePage($user,$template) {
$page=new Page();
$page->setName($template->getName());
$page->setRoworder($template->getRoworder());
$page->setMaxwidth($template->getMaxwidth());
$page->setUrl($template->getUrl());
$page->setHtml($template->getHtml());
$page->setTemplate($template->getTemplate());
$page->setPagecategory($template->getPagecategory());
$page->setUser($user);
$page->setPage($template);
$this->getEntityManager()->persist($page);
$this->getEntityManager()->flush();
$widgets=$template->getPagewidgets();
foreach($widgets as $widget) {
$pagewidget=new Pagewidget();
$pagewidget->setName($widget->getName());
$pagewidget->setLoc($widget->getLoc());
$pagewidget->setRoworder($widget->getRoworder());
$pagewidget->setHeight($widget->getHeight());
$pagewidget->setAutoajust($widget->getAutoajust());
$pagewidget->setBorder($widget->getBorder());
$pagewidget->setOpened($widget->getOpened());
$pagewidget->setColorheaderback($widget->getColorheaderback());
$pagewidget->setColorheaderfont($widget->getColorheaderfont());
$pagewidget->setColorbodyback($widget->getColorbodyback());
$pagewidget->setColorbodyfont($widget->getColorbodyfont());
$pagewidget->setParameter($widget->getParameter());
$pagewidget->setPage($page);
$pagewidget->setWidget($widget->getWidget());
$pagewidget->setIcon($widget->getIcon());
$this->getEntityManager()->persist($pagewidget);
$this->getEntityManager()->flush();
// dupliquer slide et bookmarks ??
}
return $page;
}
private function firstkey($array) {
foreach($array as $key => $unused) {
return $key;
}
return NULL;
}
} }

View File

@ -0,0 +1,18 @@
<?php
namespace Cadoles\PortalBundle\Repository;
use Doctrine\ORM\EntityRepository;
class WidgetRepository extends EntityRepository
{
// getWidgetAccess
public function getWidgetAccess($access)
{
$qb = $this->createQueryBuilder("widget");
$qb ->where($qb->expr()->like('widget.access', $qb->expr()->literal("%$access%")));
$widgets=$qb->getQuery()->getResult();
return $widgets;
}
}

View File

@ -220,6 +220,32 @@ cadoles_portal_config_ajax_notice_seleclist:
path: /config/notice/ajax/selectlist path: /config/notice/ajax/selectlist
defaults: { _controller: CadolesPortalBundle:Notice:ajaxseleclist } defaults: { _controller: CadolesPortalBundle:Notice:ajaxseleclist }
#== PAGE TEMPLATE ========================================================================================================================================
#-- Access config
cadoles_portal_config_pagetemplate:
path: /config/template
defaults: { _controller: CadolesPortalBundle:Pagetemplate:list }
cadoles_portal_config_pagetemplate_ajax_list:
path: /config/template/ajax/list
defaults: { _controller: CadolesPortalBundle:Pagetemplate:ajaxlist, access: config }
cadoles_portal_config_pagetemplate_submit:
path: /config/template/submit
defaults: { _controller: CadolesPortalBundle:Pagetemplate:submit, access: config }
cadoles_portal_config_pagetemplate_update:
path: /config/template/update/{id}
defaults: { _controller: CadolesPortalBundle:Pagetemplate:update, access: config }
cadoles_portal_config_pagetemplate_delete:
path: /config/template/delete/{id}
defaults: { _controller: CadolesPortalBundle:Pagetemplate:delete, access: config }
cadoles_portal_config_pagetemplate_view:
path: /config/template/view/{id}
defaults: { _controller: CadolesPortalBundle:Pagetemplate:view, access: config }
#== PAGE ================================================================================================================================================= #== PAGE =================================================================================================================================================
@ -670,7 +696,7 @@ cadoles_portal_config_panelwidget_view_rss:
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewrss, access: config } defaults: { _controller: CadolesPortalBundle:Pagewidget:viewrss, access: config }
cadoles_portal_config_panelwidget_view_bookmark: cadoles_portal_config_panelwidget_view_bookmark:
path: /pagewidget/view/bookmark/{id} path: /config/pagewidget/view/bookmark/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewbookmark, access: config } defaults: { _controller: CadolesPortalBundle:Pagewidget:viewbookmark, access: config }
cadoles_portal_config_panelwidget_view_link: cadoles_portal_config_panelwidget_view_link:
@ -710,11 +736,11 @@ cadoles_portal_config_panelwidget_view_clock:
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewclock, access: config } defaults: { _controller: CadolesPortalBundle:Pagewidget:viewclock, access: config }
cadoles_portal_config_panelwidget_view_calculator: cadoles_portal_config_panelwidget_view_calculator:
path: config/pagewidget/view/calculator/{id} path: /config/pagewidget/view/calculator/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewcalculator, access: config } defaults: { _controller: CadolesPortalBundle:Pagewidget:viewcalculator, access: config }
cadoles_portal_config_panelwidget_view_appexternal: cadoles_portal_config_panelwidget_view_appexternal:
path: config/pagewidget/view/appexternal/{id} path: /config/pagewidget/view/appexternal/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewappexternal, access: config } defaults: { _controller: CadolesPortalBundle:Pagewidget:viewappexternal, access: config }
#-- Access user #-- Access user

View File

@ -104,6 +104,7 @@
function showBlog(id,canupdate) { function showBlog(id,canupdate) {
// Rendre actif le page en cours dans le menu // Rendre actif le page en cours dans le menu
$(".navbar-top-links li").removeClass("active"); $(".navbar-top-links li").removeClass("active");
$(".nav-pills li").removeClass("active");
$("#menublog-"+id).addClass("active"); $("#menublog-"+id).addClass("active");
} }

View File

@ -36,27 +36,44 @@
{% endfor %} {% endfor %}
</ul> </ul>
{% if pagesshared is not empty %} <ul id="pagesgroup" class="nav navbar-top-links navbar-left">
<ul id="pagesshared" class="nav navbar-top-links navbar-left"> {% for groupshared in groupsshared %}
<li class="dropdown"> {% if groupshared.pagesshared|length == 1 %}
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Partagés <span class="caret"></span></a> {% set page = groupshared.pagesshared[0] %}
<ul class="dropdown-menu"> {% set forcereload=true %}
{% for page in pagesshared %} {% if page.pagecategory.id==1 %}
{% set forcereload=true %} {% set forcereload=false %}
{% if page.pagecategory.id==1 %} {% endif %}
{% set forcereload=false %}
{% endif %} {% if entity.id is defined and page.id==entity.id %}
<li id="menupage-{{page.id}}" class="active" style="cursor:pointer"><a onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}',{{forcereload}})">Groupe = {{ groupshared.label }}</a></li>
{% else %}
<li id="menupage-{{page.id}}"><a style="cursor:pointer" onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}',{{forcereload}})">Groupe = {{ groupshared.label }}</a></li>
{% endif %}
{% else %}
<ul id="pagesshared" class="nav navbar-top-links navbar-left">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Groupe = {{ groupshared.label }}<span class="caret"></span></a>
<ul class="dropdown-menu">
{% for page in groupshared.pagesshared %}
{% set forcereload=true %}
{% if page.pagecategory.id==1 %}
{% set forcereload=false %}
{% endif %}
{% if entity.id is defined and page.id==entity.id %}
<li id="menupage-{{page.id}}" class="active" style="cursor:pointer"><a onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}',{{forcereload}})">{{ page.name }}</a></li>
{% else %}
<li id="menupage-{{page.id}}"><a style="cursor:pointer" onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}',{{forcereload}})">{{ page.name }}</a></li>
{% endif %}
{% endfor %}
</ul>
</li>
</ul>
{% endif %}
{% endfor %}
</ul>
{% if entity.id is defined and page.id==entity.id %}
<li id="menupage-{{page.id}}" class="active" style="cursor:pointer"><a onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}',{{forcereload}})">{{ page.name }}</a></li>
{% else %}
<li id="menupage-{{page.id}}"><a style="cursor:pointer" onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}',{{forcereload}})">{{ page.name }}</a></li>
{% endif %}
{% endfor %}
</ul>
</li>
</ul>
{% endif %}
<div id="menupageaction"> <div id="menupageaction">
{% if canadd %} {% if canadd %}
@ -136,6 +153,14 @@
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% for groupshared in groupsshared %}
{% for page in groupshared.pagesshared %}
{% if page.id==entity.id %}
showPage({{ page.id }}, {{ page.pagecategory.id }},{{ page.canupdate }});
{% endif %}
{% endfor %}
{% endfor %}
// Rendre les pages user déplacable // Rendre les pages user déplacable
$("#pagesuser").sortable({ $("#pagesuser").sortable({
axis: "x", axis: "x",

View File

@ -143,6 +143,8 @@
<h1 class="page-header"> <h1 class="page-header">
{% if mode=="update" %} {% if mode=="update" %}
Modification Page Widget Modification Page Widget
{% elseif mode=="updatetemplate" %}
Modification Modèle de Page
{% elseif mode=="submit" %} {% elseif mode=="submit" %}
Création Page Widget Création Page Widget
{% endif %} {% endif %}
@ -151,7 +153,11 @@
<p> <p>
{{ form_widget(form.submit) }} {{ form_widget(form.submit) }}
{% if access=="config" %} {% if access=="config" %}
<a class="btn btn-default" href="{{ path('cadoles_portal_config_page_view',{id:entity.id}) }}">Annuler</a> {% if mode=="updatetemplate" %}
<a class="btn btn-default" href="{{ path('cadoles_portal_config_pagetemplate_view',{id:entity.id}) }}">Annuler</a>
{% else %}
<a class="btn btn-default" href="{{ path('cadoles_portal_config_page_view',{id:entity.id}) }}">Annuler</a>
{% endif %}
{% else %} {% else %}
<a class="btn btn-default" href="{{ path('cadoles_core_home',{id:entity.id}) }}">Annuler</a> <a class="btn btn-default" href="{{ path('cadoles_core_home',{id:entity.id}) }}">Annuler</a>
{% endif %} {% endif %}
@ -164,6 +170,15 @@
Supprimer Supprimer
</a> </a>
{% endif %} {% endif %}
{% if mode=="updatetemplate" %}
<a href={{ path('cadoles_portal_'~access~'_pagetemplate_delete',{'id':entity.id}) }}
class="btn btn-danger pull-right"
data-method="delete" data-csrf="_token:{{ 'csrf' }}"
data-confirm="Êtes-vous sûr de vouloir supprimer ce modèle ?">
Supprimer
</a>
{% endif %}
</p> </p>
{% if app.session.flashbag.has('error') %} {% if app.session.flashbag.has('error') %}

View File

@ -5,10 +5,15 @@
{% block pagewrapper %} {% block pagewrapper %}
{% if access=="config" %} {% if access=="config" %}
<div class="pagemenu"> <div class="pagemenu">
<a href="{{ path('cadoles_portal_config_page_view', {id:entity.id})}}">{{ entity.name }}</a> {% set template="" %}
{% if mode=="viewtemplate" %}
{% set template="template" %}
{% endif %}
<a href='{{ path('cadoles_portal_config_page_update', {id:entity.id}) }}' title='Modifier le panel'><i class='fa fa-file fa-fw'></i></a> <a href="{{ path('cadoles_portal_config_page'~template~'_view', {id:entity.id})}}">{{ entity.name }}</a>
<a href='{{ path('cadoles_portal_config_page_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_page'~template~'_update', {id:entity.id}) }}' title='Modifier le panel'><i class='fa fa-file fa-fw'></i></a>
<a href='{{ path('cadoles_portal_config_page'~template~'_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='' style='cursor:pointer' data-toggle='modal' data-target='#selwidget' title='Ajouter un widget'><i class='fa fa-cubes fa-fw'></i></a> <a href='' style='cursor:pointer' data-toggle='modal' data-target='#selwidget' title='Ajouter un widget'><i class='fa fa-cubes fa-fw'></i></a>
</div> </div>
{% endif %} {% endif %}
@ -21,7 +26,7 @@
<div id="tolocalize" style="display:none"> <div id="tolocalize" style="display:none">
{% for pagewidget in entity.pagewidgets %} {% for pagewidget in entity.pagewidgets %}
{{ render(url(pagewidget.widget.routeview|replace({'_config_':'_'~access~'_'}),{id:pagewidget.id})) }} {{ render(url(pagewidget.widget.routeview|replace({'_config_':'_'~access~'_'}),{id:pagewidget.id,by:mode})) }}
{% endfor %} {% endfor %}
</div> </div>
@ -301,7 +306,7 @@
// Création d'un widget selectionné // Création d'un widget selectionné
function selWidget(idwidgettype) { function selWidget(idwidgettype) {
var url="{{ path('cadoles_portal_'~access~'_pagewidget_widget_sumbit',{idpage:entity.id,idwidgettype:'xx'})}}"; var url="{{ path('cadoles_portal_'~access~'_pagewidget_widget_sumbit',{idpage:entity.id,idwidgettype:'xx','by':mode})}}";
url=url.replace('xx',idwidgettype); url=url.replace('xx',idwidgettype);
$(location).attr('href', url); $(location).attr('href', url);
@ -309,7 +314,7 @@
// Modifciation d'un widget // Modifciation d'un widget
function modWidget(idwidget) { function modWidget(idwidget) {
var url="{{ path('cadoles_portal_'~access~'_pagewidget_widget_update',{idpage:entity.id,idwidget:'xx'})}}"; var url="{{ path('cadoles_portal_'~access~'_pagewidget_widget_update',{idpage:entity.id,idwidget:'xx','by':mode})}}";
url=url.replace('xx',idwidget); url=url.replace('xx',idwidget);
$(location).attr('href', url); $(location).attr('href', url);

View File

@ -0,0 +1,56 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
<h1>
Gestion des Modèles de Page
</h1>
<p>
<a href="{{ path('cadoles_portal_config_pagetemplate_submit') }}" class="btn btn-success">Ajouter un Modèle</a>
</p>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-table fa-fw"></i> Liste des Modèles
</div>
<div class="panel-body">
<div class="dataTable_wrapper">
<table class="table table-striped table-bordered table-hover" id="dataTables" style="width:100%">
<thead>
<tr>
<th width="100px" class="no-sort">Action</th>
<th>Ordre</th>
<th>Nom</th>
<th>Pour</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
{% endblock %}
{% block localjavascript %}
$(document).ready(function() {
$('#dataTables').DataTable({
columnDefs: [ { "targets": 'no-sort', "orderable": false } ],
responsive: true,
iDisplayLength: 100,
order: [[ 1, "asc" ]],
processing: true,
serverSide: true,
ajax: "{{ path('cadoles_portal_config_pagetemplate_ajax_list') }}",
});
});
{% endblock %}

View File

@ -0,0 +1,49 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{{ form_start(form) }}
<h1>
Nouvelle Modèle de Page
</h1>
<p>
{{ form_widget(form.submit) }}
{% if access=="config" %}
<a class="btn btn-default" href="{{ path('cadoles_portal_config_pagetemplate') }}">Annuler</a>
{% else %}
<a class="btn btn-default" href="{{ path('cadoles_core_home') }}">Annuler</a>
{% endif %}
</p>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{% if app.session.flashbag.has('notice') %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{% for flashMessage in app.session.flashbag.get('notice') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-pencil fa-fw"></i> Informations
</div>
<div class="panel-body">
{{ form_row(form.name) }}
{{ form_row(form.parentfor) }}
{{ form_row(form.roworder) }}
{{ form_row(form.maxwidth) }}
</div>
</div>
{{ form_end(form) }}
{% endblock %}

View File

@ -3,9 +3,9 @@
{% block pagewrapper %} {% block pagewrapper %}
{{ form_start(form) }} {{ form_start(form) }}
<h1 class="page-header"> <h1 class="page-header">
{% if mode=="update" %} {% if mode=="update" or mode=="updatetemplate" %}
Modification Widget Modification Widget
{% elseif mode=="submit" %} {% elseif mode=="submit" or mode=="submittemplate" %}
Création Widget Création Widget
{% endif %} {% endif %}
</h1> </h1>
@ -14,7 +14,11 @@
{{ form_widget(form.submit) }} {{ form_widget(form.submit) }}
{% if access=="config" %} {% if access=="config" %}
<a class="btn btn-default" href="{{ path('cadoles_portal_config_page_view',{id:idpage}) }}">Annuler</a> {% if mode=="update" %}
<a class="btn btn-default" href="{{ path('cadoles_portal_config_page_view',{id:idpage}) }}">Annuler</a>
{% else %}
<a class="btn btn-default" href="{{ path('cadoles_portal_config_pagetemplate_view',{id:idpage}) }}">Annuler</a>
{% endif %}
{% else %} {% else %}
{% if mode=="update" %} {% if mode=="update" %}
<a class="btn btn-default" href="{{ path('cadoles_portal_user_page_view',{id:idpage}) }}">Annuler</a> <a class="btn btn-default" href="{{ path('cadoles_portal_user_page_view',{id:idpage}) }}">Annuler</a>

View File

@ -47,7 +47,7 @@
<span class="title">{{ entity.name }}</span> <span class="title">{{ entity.name }}</span>
</div> </div>
<div class="widgetbody" style="{{ stylewidgetbody }}"> <div class="widgetbody" style="{{ stylewidgetbody }} {% if not entity.border %} padding-top:10px; {% endif %}">
{% if bookmarks is not empty %} {% if bookmarks is not empty %}
<div class="bookmark-container"> <div class="bookmark-container">
<div class="grid clearfix"> <div class="grid clearfix">
@ -56,7 +56,9 @@
{% for bookmark in bookmarks %} {% for bookmark in bookmarks %}
<div class="grid-item {{ stylegrid }}"> <div class="grid-item {{ stylegrid }}">
<div class="grid-item-content" style="background-color: {{ bookmark.color ? "#"~bookmark.color : '#000' }};"> <div class="grid-item-content" style="background-color: {{ bookmark.color ? "#"~bookmark.color : '#000' }};">
<a style="cursor:pointer" onClick="modBookmark({{ bookmark.id }})" class="item-update"><i style="color: #FFF" class="fa fa-file" title="Modifier le favori"></i></a> {% if canupdate %}
<a style="cursor:pointer" onClick="modBookmark({{ bookmark.id }})" class="item-update"><i style="color: #FFF" class="fa fa-file" title="Modifier le favori"></i></a>
{% endif %}
{% if bookmark.target == 'frame' %} {% if bookmark.target == 'frame' %}
<a class="linktosonde" data-sonde="{{ bookmark.title }}" style="cursor:pointer" onClick="showFrameitem('bookmark{{ bookmark.id }}','{{ bookmark.url }}')"> <a class="linktosonde" data-sonde="{{ bookmark.title }}" style="cursor:pointer" onClick="showFrameitem('bookmark{{ bookmark.id }}','{{ bookmark.url }}')">

View File

@ -32,8 +32,9 @@
> Favorie sur appexternal > Favorie sur appexternal
> Montée de version LemonLDAP > Montée de version LemonLDAP
> France Connect Agent > France Connect Agent
> Page Blanche paramétrable
> Fiche user paramétrable
> Index sur group.fgall > Index sur group.fgall
> Pb sur widget editor et la couleur du texte si fond pas blanc
> Pb sur widget flux et la couleur du texte si fond pas blanc

View File

@ -43,14 +43,15 @@ INSERT IGNORE INTO `sidebar` (`id`, `parent_id`, `roworder`, `label`, `path`, `f
(1270, 1200, 1270, 'Import Utilisateurs', 'cadoles_core_config_importuser', 'fa-download', 'ROLE_ADMIN,ROLE_MODO', 'importuser_activate'), (1270, 1200, 1270, 'Import Utilisateurs', 'cadoles_core_config_importuser', 'fa-download', 'ROLE_ADMIN,ROLE_MODO', 'importuser_activate'),
(1500, NULL, 1500, 'PORTAIL', NULL, 'fa-cubes', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'), (1500, NULL, 1500, 'PORTAIL', NULL, 'fa-cubes', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1510, 1500, 1510, 'Pages', 'cadoles_portal_config_page', 'fa-file', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'), (1510, 1500, 1510, 'Modèles de Page', 'cadoles_portal_config_pagetemplate', 'fa-copy', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1520, 1500, 1520, 'Items', 'cadoles_portal_config_item', 'fa-desktop', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'), (1520, 1500, 1520, 'Pages', 'cadoles_portal_config_page', 'fa-file', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1530, 1500, 1530, 'Annonces', 'cadoles_portal_config_alert', 'fa-bell', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'), (1530, 1500, 1530, 'Items', 'cadoles_portal_config_item', 'fa-desktop', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1540, 1500, 1540, 'Calendriers', 'cadoles_portal_config_calendar', 'fa-calendar', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'), (1540, 1500, 1540, 'Annonces', 'cadoles_portal_config_alert', 'fa-bell', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1550, 1500, 1550, 'Blogs', 'cadoles_portal_config_blog', 'fa-paper-plane', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'), (1550, 1500, 1550, 'Calendriers', 'cadoles_portal_config_calendar', 'fa-calendar', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1560, 1500, 1560, 'Flux', 'cadoles_portal_config_flux', 'fa-rss', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'), (1560, 1500, 1560, 'Blogs', 'cadoles_portal_config_blog', 'fa-paper-plane', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1570, 1500, 1570, 'Chartes', 'cadoles_portal_config_notice', 'fa-info', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'), (1570, 1500, 1570, 'Flux', 'cadoles_portal_config_flux', 'fa-rss', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1580, 1500, 1580, 'Icônes', 'cadoles_portal_config_icon', 'fa-bug', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'), (1580, 1500, 1580, 'Chartes', 'cadoles_portal_config_notice', 'fa-info', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(1590, 1500, 1590, 'Icônes', 'cadoles_portal_config_icon', 'fa-bug', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
(2500, NULL, 2500, 'MODULES', NULL, 'fa-cubes', 'ROLE_ADMIN,ROLE_MODO', 'module_activate'), (2500, NULL, 2500, 'MODULES', NULL, 'fa-cubes', 'ROLE_ADMIN,ROLE_MODO', 'module_activate'),
(2510, 2500, 2510, 'Pages', 'cadoles_portal_config_page', 'fa-file', 'ROLE_ADMIN,ROLE_MODO', 'page_activate'), (2510, 2500, 2510, 'Pages', 'cadoles_portal_config_page', 'fa-file', 'ROLE_ADMIN,ROLE_MODO', 'page_activate'),
@ -120,6 +121,7 @@ INSERT IGNORE permmodo (`route`, `visible`) VALUES
('cadoles_core_config_registration',1), ('cadoles_core_config_registration',1),
('cadoles_core_config_user',1), ('cadoles_core_config_user',1),
('cadoles_core_config_importuser',0), ('cadoles_core_config_importuser',0),
('cadoles_portal_config_pagetemplate',1),
('cadoles_portal_config_page',1), ('cadoles_portal_config_page',1),
('cadoles_portal_config_item',1), ('cadoles_portal_config_item',1),
('cadoles_portal_config_alert',1), ('cadoles_portal_config_alert',1),