Merge branch 'master' into dist/envole/6/master

This commit is contained in:
Arnaud Fornerot 2019-10-04 11:40:46 +02:00
commit ab2129de6e
21 changed files with 380 additions and 157 deletions

View File

@ -8,7 +8,6 @@ EOLE_VERSION=2.6
EOLE_RELEASE=2.6.2 EOLE_RELEASE=2.6.2
PKGAPPS=web PKGAPPS=web
################################ ################################
# Début de zone à ne pas éditer # Début de zone à ne pas éditer
################################ ################################

View File

@ -16,6 +16,11 @@ use Cadoles\CoreBundle\Entity\Niveau02;
use Cadoles\CoreBundle\Entity\User; use Cadoles\CoreBundle\Entity\User;
use Cadoles\CoreBundle\Entity\Group; use Cadoles\CoreBundle\Entity\Group;
use Cadoles\CoreBundle\Entity\UserGroup; use Cadoles\CoreBundle\Entity\UserGroup;
use Cadoles\PortalBundle\Entity\Calendar;
use Cadoles\PortalBundle\Entity\Blog;
use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
global $bdd01; global $bdd01;
global $config; global $config;
@ -28,6 +33,8 @@ class SynchroCommand extends Command
private $output; private $output;
private $filesystem; private $filesystem;
private $rootlog; private $rootlog;
private $ldap;
private $ldap_basedn;
protected function configure() protected function configure()
{ {
@ -76,8 +83,9 @@ class SynchroCommand extends Command
$this->writeln('== SYNCHONISATION ANNUAIRE =========================='); $this->writeln('== SYNCHONISATION ANNUAIRE ==========================');
$this->writeln('====================================================='); $this->writeln('=====================================================');
$ldap = $this->container->get('cadoles.core.service.ldap'); $this->ldap = $this->container->get('cadoles.core.service.ldap');
if(!$ldap->isEnabled()) {
if(!$this->ldap->isEnabled()) {
if($masteridentity =="LDAP") { if($masteridentity =="LDAP") {
$this->writeln(''); $this->writeln('');
$this->writeln('====================================================='); $this->writeln('=====================================================');
@ -85,7 +93,7 @@ class SynchroCommand extends Command
$this->writeln('====================================================='); $this->writeln('=====================================================');
$ldap_basedn = $this->container->getParameter('ldap_basedn'); $this->ldap_basedn = $this->container->getParameter('ldap_basedn');
$ldap_template = $this->container->getParameter('ldap_template'); $ldap_template = $this->container->getParameter('ldap_template');
$ldap_username = $this->container->getParameter('ldap_username'); $ldap_username = $this->container->getParameter('ldap_username');
$ldap_firstname = $this->container->getParameter('ldap_firstname'); $ldap_firstname = $this->container->getParameter('ldap_firstname');
@ -126,7 +134,7 @@ class SynchroCommand extends Command
$this->writeln(''); $this->writeln('');
$this->writeln('== CLASSES =========================================='); $this->writeln('== CLASSES ==========================================');
$results = $ldap->search("type=Classe", ['cn','description','gidNumber'], $ldap_basedn); $results = $this->ldap->search("type=Classe", ['cn','description','gidNumber'], $this->ldap_basedn);
foreach($results as $result) { foreach($results as $result) {
$cn=$result["cn"]; $cn=$result["cn"];
$ldapfilter="(|(&(type=Classe)(cn=$cn))(&(type=Equipe)(cn=profs-$cn))(&(ENTPersonProfils=Administratif)(divcod=$cn)))"; $ldapfilter="(|(&(type=Classe)(cn=$cn))(&(type=Equipe)(cn=profs-$cn))(&(ENTPersonProfils=Administratif)(divcod=$cn)))";
@ -155,7 +163,7 @@ class SynchroCommand extends Command
// On execute le filtre d'appartenance à ce niveau // On execute le filtre d'appartenance à ce niveau
$this->writeln("== Récupération des utilisateurs de l'annuaire"); $this->writeln("== Récupération des utilisateurs de l'annuaire");
$niveau01=$this->em->getRepository('CadolesCoreBundle:Niveau01')->find($data["id"]); $niveau01=$this->em->getRepository('CadolesCoreBundle:Niveau01')->find($data["id"]);
$results = $ldap->search($niveau01->getLdapfilter(), $fieldstoread, $ldap_basedn); $results = $this->ldap->search($niveau01->getLdapfilter(), $fieldstoread, $this->ldap_basedn);
$nbuserstotal=count($results); $nbuserstotal=count($results);
// Pour chaque utilisateur ldap // Pour chaque utilisateur ldap
@ -247,7 +255,8 @@ class SynchroCommand extends Command
$this->writeln('== '.$group->getLabel()); $this->writeln('== '.$group->getLabel());
if(!is_null($ldapfilter)) { if(!is_null($ldapfilter)) {
$results = $ldap->search($ldapfilter,[$ldap_username,"memberuid"] , $ldap_basedn); $results = $this->ldap->search($ldapfilter,[$ldap_username,"memberuid"] , $this->ldap_basedn);
foreach($results as $result) { foreach($results as $result) {
if(isset($result["memberuid"])) { if(isset($result["memberuid"])) {
// Si memberid est un tableau il y a plusieur user dedans // Si memberid est un tableau il y a plusieur user dedans
@ -333,7 +342,7 @@ class SynchroCommand extends Command
} }
else { else {
//on peut unset les recherches suivantes seront plus rapide //on peut unset les recherches suivantes seront plus rapide
unset($flipped[$user->getUsername()]); unset($flipped[$data["username"]]);
} }
$this->em->clear(); $this->em->clear();
@ -360,17 +369,17 @@ class SynchroCommand extends Command
foreach($datas as $data) { foreach($datas as $data) {
$criteria = '(cn='.$data->getLabel().')'; $criteria = '(cn='.$data->getLabel().')';
$subbranch=$baseNiveau01; $subbranch=$baseNiveau01;
$results = $ldap->search($criteria, array('cn'), $subbranch); $results = $this->ldap->search($criteria, array('cn'), $subbranch);
// Mise à jour si elle existe // Mise à jour si elle existe
if(count($results) > 0) { if(count($results) > 0) {
$this->writeln(' - Modification dans annuaire >> '.$data->getLabel()); $this->writeln(' - Modification dans annuaire >> '.$data->getLabel());
if(!$simulate) $ldap->modifyNiveau01($data,$data->getLabel()); if(!$simulate) $this->ldap->modifyNiveau01($data,$data->getLabel());
} }
// Sinon création de la fiche // Sinon création de la fiche
else { else {
$this->writeln(' - Création dans annuaire >> '.$data->getLabel()); $this->writeln(' - Création dans annuaire >> '.$data->getLabel());
if(!$simulate) $ldap->addNiveau01($data); if(!$simulate) $this->ldap->addNiveau01($data);
} }
} }
@ -387,17 +396,17 @@ class SynchroCommand extends Command
foreach($datas as $data) { foreach($datas as $data) {
$criteria = '(cn='.$data->getLabel().')'; $criteria = '(cn='.$data->getLabel().')';
$subbranch=$baseNiveau02; $subbranch=$baseNiveau02;
$results = $ldap->search($criteria, array('cn'), $subbranch); $results = $this->ldap->search($criteria, array('cn'), $subbranch);
// Mise à jour si elle existe // Mise à jour si elle existe
if(count($results) > 0) { if(count($results) > 0) {
$this->writeln(' - Modification dans annuaire >> '.$data->getLabel()); $this->writeln(' - Modification dans annuaire >> '.$data->getLabel());
if(!$simulate) $ldap->modifyNiveau02($data,$data->getLabel()); if(!$simulate) $this->ldap->modifyNiveau02($data,$data->getLabel());
} }
// Sinon création de la fiche // Sinon création de la fiche
else { else {
$this->writeln(' - Création dans annuaire >> '.$data->getLabel()); $this->writeln(' - Création dans annuaire >> '.$data->getLabel());
if(!$simulate) $ldap->addNiveau02($data); if(!$simulate) $this->ldap->addNiveau02($data);
} }
} }
@ -414,17 +423,17 @@ class SynchroCommand extends Command
foreach($datas as $data) { foreach($datas as $data) {
$criteria = '(cn='.$data->getLabel().')'; $criteria = '(cn='.$data->getLabel().')';
$subbranch=$baseGroup; $subbranch=$baseGroup;
$results = $ldap->search($criteria, array('cn'), $subbranch); $results = $this->ldap->search($criteria, array('cn'), $subbranch);
// Mise à jour si elle existe // Mise à jour si elle existe
if(count($results) > 0) { if(count($results) > 0) {
$this->writeln(' - Modification dans annuaire >> '.$data->getLabel()); $this->writeln(' - Modification dans annuaire >> '.$data->getLabel());
if(!$simulate) $ldap->modifyGroup($data,$data->getLabel()); if(!$simulate) $this->ldap->modifyGroup($data,$data->getLabel());
} }
// Sinon création de la fiche // Sinon création de la fiche
else { else {
$this->writeln(' - Création dans annuaire >> '.$data->getLabel()); $this->writeln(' - Création dans annuaire >> '.$data->getLabel());
if(!$simulate) $ldap->addGroup($data); if(!$simulate) $this->ldap->addGroup($data);
} }
} }
@ -441,7 +450,7 @@ class SynchroCommand extends Command
foreach($datas as $data) { foreach($datas as $data) {
$criteria = '(uid='.$data->getUsername().')'; $criteria = '(uid='.$data->getUsername().')';
$subbranch=$baseUser; $subbranch=$baseUser;
$results = $ldap->search($criteria, array('uid'), $subbranch); $results = $this->ldap->search($criteria, array('uid'), $subbranch);
// S'assurer que SIREN correspond au Niveau01 // S'assurer que SIREN correspond au Niveau01
if($data->getNiveau01()->getSiren()!=$data->getSiren()) { if($data->getNiveau01()->getSiren()!=$data->getSiren()) {
@ -458,16 +467,16 @@ class SynchroCommand extends Command
// Mise à jour si elle existe // Mise à jour si elle existe
if(count($results) > 0) { if(count($results) > 0) {
$this->writeln(' - Modification dans annuaire >> '.$data->getUsername()); $this->writeln(' - Modification dans annuaire >> '.$data->getUsername());
if(!$simulate) $ldap->modifyUser($data); if(!$simulate) $this->ldap->modifyUser($data);
} }
// Sinon création de la fiche // Sinon création de la fiche
else { else {
$this->writeln(' - Création dans annuaire >> '.$data->getUsername()); $this->writeln(' - Création dans annuaire >> '.$data->getUsername());
if(!$simulate) $ldap->addUser($data); if(!$simulate) $this->ldap->addUser($data);
} }
// Rattachement à Niveau01 et Niveau02 // Rattachement à Niveau01 et Niveau02
if(!$simulate) $ldap->addGroupUser($data); if(!$simulate) $this->ldap->addGroupUser($data);
} }
$this->writeln(''); $this->writeln('');
@ -483,21 +492,21 @@ class SynchroCommand extends Command
foreach($datas as $data) { foreach($datas as $data) {
$criteria = '(cn='.$data->getLabel().')'; $criteria = '(cn='.$data->getLabel().')';
$subbranch=$baseniveau01; $subbranch=$baseniveau01;
$results = $ldap->search($criteria, array('cn'), $subbranch); $results = $this->ldap->search($criteria, array('cn'), $subbranch);
// Mise à jour des membres du groupes // Mise à jour des membres du groupes
if(count($results) > 0) { if(count($results) > 0) {
$this->writeln(' - '.$data->getLabel()); $this->writeln(' - '.$data->getLabel());
$dn=$ldap->getNiveau01DN($data->getLabel()); $dn=$this->ldap->getNiveau01DN($data->getLabel());
$attrs["memberuid"]=array(); $attrs["memberuid"]=array();
$attrs["cadolesMember"]=array(); $attrs["cadolesMember"]=array();
foreach($data->getUsers() as $userniveau01) { foreach($data->getUsers() as $userniveau01) {
array_push($attrs["memberuid"],$userniveau01->getUsername()); array_push($attrs["memberuid"],$userniveau01->getUsername());
array_push($attrs["cadolesMember"],$ldap->getUserDN($userniveau01)); array_push($attrs["cadolesMember"],$this->ldap->getUserDN($userniveau01));
$this->writeln(' > '.$userniveau01->getUsername()); $this->writeln(' > '.$userniveau01->getUsername());
} }
if(!$simulate) $ldap->ldapModify($dn, $attrs); if(!$simulate) $this->ldap->ldapModify($dn, $attrs);
} }
} }
@ -514,21 +523,21 @@ class SynchroCommand extends Command
foreach($datas as $data) { foreach($datas as $data) {
$criteria = '(cn='.$data->getLabel().')'; $criteria = '(cn='.$data->getLabel().')';
$subbranch=$baseniveau02; $subbranch=$baseniveau02;
$results = $ldap->search($criteria, array('cn'), $subbranch); $results = $this->ldap->search($criteria, array('cn'), $subbranch);
// Mise à jour des membres du groupes // Mise à jour des membres du groupes
if(count($results) > 0) { if(count($results) > 0) {
$this->writeln(' - '.$data->getLabel()); $this->writeln(' - '.$data->getLabel());
$dn=$ldap->getNiveau02DN($data->getLabel()); $dn=$this->ldap->getNiveau02DN($data->getLabel());
$attrs["memberuid"]=array(); $attrs["memberuid"]=array();
$attrs["cadolesMember"]=array(); $attrs["cadolesMember"]=array();
foreach($data->getUsers() as $userniveau01) { foreach($data->getUsers() as $userniveau01) {
array_push($attrs["memberuid"],$userniveau01->getUsername()); array_push($attrs["memberuid"],$userniveau01->getUsername());
array_push($attrs["cadolesMember"],$ldap->getUserDN($userniveau01)); array_push($attrs["cadolesMember"],$this->ldap->getUserDN($userniveau01));
$this->writeln(' > '.$userniveau01->getUsername()); $this->writeln(' > '.$userniveau01->getUsername());
} }
if(!$simulate) $ldap->ldapModify($dn, $attrs); if(!$simulate) $this->ldap->ldapModify($dn, $attrs);
} }
} }
@ -546,21 +555,21 @@ class SynchroCommand extends Command
foreach($datas as $data) { foreach($datas as $data) {
$criteria = '(cn='.$data->getLabel().')'; $criteria = '(cn='.$data->getLabel().')';
$subbranch=$baseGroup; $subbranch=$baseGroup;
$results = $ldap->search($criteria, array('cn'), $subbranch); $results = $this->ldap->search($criteria, array('cn'), $subbranch);
// Mise à jour des membres du groupes // Mise à jour des membres du groupes
if(count($results) > 0) { if(count($results) > 0) {
$this->writeln(' - '.$data->getLabel()); $this->writeln(' - '.$data->getLabel());
$dn=$ldap->getGroupDN($data->getLabel()); $dn=$this->ldap->getGroupDN($data->getLabel());
$attrs["memberuid"]=array(); $attrs["memberuid"]=array();
$attrs["cadolesMember"]=array(); $attrs["cadolesMember"]=array();
foreach($data->getUsers() as $usergroupe) { foreach($data->getUsers() as $usergroupe) {
array_push($attrs["memberuid"],$usergroupe->getUser()->getUsername()); array_push($attrs["memberuid"],$usergroupe->getUser()->getUsername());
array_push($attrs["cadolesMember"],$ldap->getUserDN($usergroupe->getUser())); array_push($attrs["cadolesMember"],$this->ldap->getUserDN($usergroupe->getUser()));
$this->writeln(' > '.$usergroupe->getUser()->getUsername()); $this->writeln(' > '.$usergroupe->getUser()->getUsername());
} }
if(!$simulate) $ldap->ldapModify($dn, $attrs); if(!$simulate) $this->ldap->ldapModify($dn, $attrs);
} }
} }
@ -576,14 +585,14 @@ class SynchroCommand extends Command
$criteria = '(cn=*)'; $criteria = '(cn=*)';
$subbranch=$baseNiveau01; $subbranch=$baseNiveau01;
$results = $ldap->search($criteria, array('cn'), $subbranch); $results = $this->ldap->search($criteria, array('cn'), $subbranch);
foreach($results as $result) { foreach($results as $result) {
$data = $this->em->getRepository('CadolesCoreBundle:Niveau01')->findBy(array('label' => $result["cn"])); $data = $this->em->getRepository('CadolesCoreBundle:Niveau01')->findBy(array('label' => $result["cn"]));
if($data) $this->writeln(' - Existe dans bundle >> '.$result["cn"]); if($data) $this->writeln(' - Existe dans bundle >> '.$result["cn"]);
else { else {
$this->writeln(' - A supprimer dans annuaire >> '.$result["cn"]); $this->writeln(' - A supprimer dans annuaire >> '.$result["cn"]);
$dn=$ldap->getNiveau01DN($result["cn"]); $dn=$this->ldap->getNiveau01DN($result["cn"]);
if(!$simulate) $ldap->deleteByDN($dn); if(!$simulate) $this->ldap->deleteByDN($dn);
} }
} }
@ -593,14 +602,14 @@ class SynchroCommand extends Command
$criteria = '(cn=*)'; $criteria = '(cn=*)';
$subbranch=$baseNiveau02; $subbranch=$baseNiveau02;
$results = $ldap->search($criteria, array('cn'), $subbranch); $results = $this->ldap->search($criteria, array('cn'), $subbranch);
foreach($results as $result) { foreach($results as $result) {
$data = $this->em->getRepository('CadolesCoreBundle:Niveau02')->findBy(array('label' => $result["cn"])); $data = $this->em->getRepository('CadolesCoreBundle:Niveau02')->findBy(array('label' => $result["cn"]));
if($data) $this->writeln(' - Existe dans bundle >> '.$result["cn"]); if($data) $this->writeln(' - Existe dans bundle >> '.$result["cn"]);
else { else {
$this->writeln(' - A supprimer dans annuaire >> '.$result["cn"]); $this->writeln(' - A supprimer dans annuaire >> '.$result["cn"]);
$dn=$ldap->getNiveau02DN($result["cn"]); $dn=$this->ldap->getNiveau02DN($result["cn"]);
if(!$simulate) $ldap->deleteByDN($dn); if(!$simulate) $this->ldap->deleteByDN($dn);
} }
} }
@ -611,14 +620,14 @@ class SynchroCommand extends Command
$criteria = '(cn=*)'; $criteria = '(cn=*)';
$subbranch=$baseGroup; $subbranch=$baseGroup;
$results = $ldap->search($criteria, array('cn'), $subbranch); $results = $this->search($criteria, array('cn'), $subbranch);
foreach($results as $result) { foreach($results as $result) {
$data = $this->em->getRepository('CadolesCoreBundle:Group')->findBy(array('label' => $result["cn"])); $data = $this->em->getRepository('CadolesCoreBundle:Group')->findBy(array('label' => $result["cn"]));
if($data) $this->writeln(' - Existe dans bundle >> '.$result["cn"]); if($data) $this->writeln(' - Existe dans bundle >> '.$result["cn"]);
else { else {
$this->writeln(' - A supprimer dans annuaire >> '.$result["cn"]); $this->writeln(' - A supprimer dans annuaire >> '.$result["cn"]);
$dn=$ldap->getGroupDN($result["cn"]); $dn=$this->ldap->getGroupDN($result["cn"]);
if(!$simulate) $ldap->deleteByDN($dn); if(!$simulate) $this->ldap->deleteByDN($dn);
} }
} }
@ -628,14 +637,14 @@ class SynchroCommand extends Command
$criteria = '(uid=*)'; $criteria = '(uid=*)';
$subbranch=$baseUser; $subbranch=$baseUser;
$results = $ldap->search($criteria, array('uid'), $subbranch); $results = $this->ldap->search($criteria, array('uid'), $subbranch);
foreach($results as $result) { foreach($results as $result) {
$data = $this->em->getRepository('CadolesCoreBundle:User')->findBy(array('username' => $result["uid"])); $data = $this->em->getRepository('CadolesCoreBundle:User')->findBy(array('username' => $result["uid"]));
if($data) $this->writeln(' - Existe dans bundle >> '.$result["uid"]); if($data) $this->writeln(' - Existe dans bundle >> '.$result["uid"]);
else { else {
$this->writeln(' - A supprimer dans annuaire >> '.$result["uid"]); $this->writeln(' - A supprimer dans annuaire >> '.$result["uid"]);
$dn='uid='.$result["uid"].','.$baseUser; $dn='uid='.$result["uid"].','.$baseUser;
if(!$simulate) $ldap->deleteByDN($dn); if(!$simulate) $this->ldap->deleteByDN($dn);
} }
} }
} }
@ -654,14 +663,14 @@ class SynchroCommand extends Command
} }
protected function addmodGroup($label,$ldapfilter,$fgcanshare) { protected function addmodGroup($label,$ldapfilter,$fgcanshare) {
$portal_activate = $this->container->getParameter('portal_activate');
$group=$this->em->getRepository('CadolesCoreBundle:Group')->findOneBy(array('fgtemplate' => true, 'label' => $label)); $group=$this->em->getRepository('CadolesCoreBundle:Group')->findOneBy(array('fgtemplate' => true, 'label' => $label));
if(!$group) { if(!$group) {
$group=new Group(); $group=new Group();
$group->setFgcanshare($fgcanshare); $group->setFgcanshare($fgcanshare);
$group->setFgcancreatepage(true); $group->setFgcancreatepage(false);
$group->setFgcancreateblog(true); $group->setFgcancreateblog(false);
$group->setFgcancreatecalendar(true); $group->setFgcancreatecalendar(false);
} }
$group->setLabel($label); $group->setLabel($label);
@ -670,8 +679,52 @@ class SynchroCommand extends Command
$group->setLdapfilter($ldapfilter); $group->setLdapfilter($ldapfilter);
$group->setFgtemplate(true); $group->setFgtemplate(true);
if($portal_activate) {
$pagetemplate=$this->em->getRepository("CadolesPortalBundle:Page")->find(-110);
if($pagetemplate) $group->setPagetemplate($pagetemplate);
}
$this->em->persist($group); $this->em->persist($group);
$this->em->flush(); $this->em->flush();
if($fgcanshare && $portal_activate) {
// On regarde s'il a au moins une page
if($group->getPages()->isEmpty()) {
$page=$this->em->getRepository("CadolesPortalBundle:Page")->clonePage(null,$group->getPagetemplate());
$group->addPage($page);
$page->setName($group->getLabel());
$this->em->persist($page);
$this->em->persist($group);
$this->em->flush();
}
// On regarde s'il a au moins un calendrier
if($group->getCalendars()->isEmpty()) {
$calendar=new Calendar();
$key = Uuid::uuid4();
$calendar->setName($group->getLabel());
$calendar->setKeyvalue($key);
$calendar->addGroup($group);
$calendar->setColor($group->getColor());
$calendar->setType(0);
$this->em->persist($calendar);
$this->em->flush();
}
// On regarde s'il a au moins un blog
if($group->getBlogs()->isEmpty()) {
$blog=new Blog();
$blog->setName($group->getLabel());
$blog->addGroup($group);
$this->em->persist($blog);
$this->em->flush();
}
}
} }
protected function addtoGroup($user,$group) { protected function addtoGroup($user,$group) {
@ -680,11 +733,19 @@ class SynchroCommand extends Command
$member= new UserGroup(); $member= new UserGroup();
$member->setGroup($group); $member->setGroup($group);
$member->setUser($user); $member->setUser($user);
}
// Si modèle scribe
$ldap_template = $this->container->getParameter('ldap_template');
if($ldap_template=="scribe") {
$ldapfilter="(|(&(uid=".$user->getUsername().")(ENTPersonProfils=enseignant))(&(uid=".$user->getUsername().")(typeadmin=0))(&(uid=".$user->getUsername().")(typeadmin=2)))";
$results = $this->ldap->search($ldapfilter, ['uid'], $this->ldap_basedn);
if($results) $member->setFgmanager(true);
}
$this->em->persist($member); $this->em->persist($member);
$this->em->flush(); $this->em->flush();
} }
}
protected function addUser($niveau01,$username,$firstname,$lastname,$email,$usersadmin) { protected function addUser($niveau01,$username,$firstname,$lastname,$email,$usersadmin) {
$user = new User(); $user = new User();
@ -702,9 +763,18 @@ class SynchroCommand extends Command
if(in_array($username,$usersadmin)) if(in_array($username,$usersadmin))
$user->setRole("ROLE_ADMIN"); $user->setRole("ROLE_ADMIN");
else else {
$user->setRole("ROLE_USER"); $user->setRole("ROLE_USER");
// Si modèle scribe
$ldap_template = $this->container->getParameter('ldap_template');
if($ldap_template=="scribe") {
$ldapfilter="(|(&(uid=".$user->getUsername().")(ENTPersonProfils=enseignant))(&(uid=".$user->getUsername().")(typeadmin=0))(&(uid=".$user->getUsername().")(typeadmin=2)))";
$results = $this->ldap->search($ldapfilter, ['uid'], $this->ldap_basedn);
if($results) $user->setRole("ROLE_ANIM");
}
}
$this->em->persist($user); $this->em->persist($user);
$this->em->flush(); $this->em->flush();
} }

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}eyoxoh9yJzJyNAacnf9gxyZbtRWITzXF (-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}kiCU5m1uSvZhdgI1Ga9gdq/8HUBjSIpX
', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple'); ', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple');

View File

@ -298,10 +298,7 @@ class UserController extends Controller
$data->setVisible(true); $data->setVisible(true);
$data->setBelongingpopulation("authlevel"); $data->setBelongingpopulation("authlevel");
$data->setAuthlevel("simple"); $data->setAuthlevel("simple");
$fields=$this->getDefaultDatauser();
$config=$em->getRepository('CadolesCoreBundle:Config')->find("datauser");
$fields=$config->getValue();
$fields=json_decode($fields,true);
// Création du formulaire // Création du formulaire
$form = $this->createForm(UserType::class,$data,array( $form = $this->createForm(UserType::class,$data,array(
@ -410,9 +407,7 @@ class UserController extends Controller
// Récupération de l'enregistrement courant // Récupération de l'enregistrement courant
$data=$this->getData($id); $data=$this->getData($id);
$oldpassword=$data->getPassword(); $oldpassword=$data->getPassword();
$config=$em->getRepository('CadolesCoreBundle:Config')->find("datauser"); $fields=$this->getDefaultDatauser();
$fields=$config->getValue();
$fields=json_decode($fields,true);
// Si un acces modo via console d'admin on s'assure qu'il a les droit dessus sinon retour à la liste // Si un acces modo via console d'admin on s'assure qu'il a les droit dessus sinon retour à la liste
if($this->isGranted('ROLE_MODO')&&$access=="config") { if($this->isGranted('ROLE_MODO')&&$access=="config") {
@ -625,9 +620,7 @@ class UserController extends Controller
// Récupération de l'enregistrement courant // Récupération de l'enregistrement courant
$data=$this->getData($id); $data=$this->getData($id);
$config=$em->getRepository('CadolesCoreBundle:Config')->find("datauser"); $fields=$this->getDefaultDatauser();
$fields=$config->getValue();
$fields=json_decode($fields,true);
// Si un acces modo via console d'admin on s'assure qu'il a les droit dessus sinon retour à la liste // Si un acces modo via console d'admin on s'assure qu'il a les droit dessus sinon retour à la liste
if($this->isGranted('ROLE_MODO')&&$access=="config") { if($this->isGranted('ROLE_MODO')&&$access=="config") {
@ -987,6 +980,64 @@ class UserController extends Controller
return $datas; return $datas;
} }
protected function getDefaultDatauser()
{
$em = $this->getDoctrine()->getManager();
$config=$em->getRepository('CadolesCoreBundle:Config')->find("datauser");
$fields=$config->getValue();
$fields=json_decode($fields,true);
if($fields=="") {
// Valeur par défaut 0=caché / 1=falcultatif / 2=obligatoire
$fields["firstname"]["perm"]=1;
$fields["firstname"]["label"]="Prénom";
$fields["visible"]["perm"]=2;
$fields["visible"]["label"]="Visible";
$fields["authlevel"]["perm"]=2;
$fields["authlevel"]["label"]="Niveau d'authentification";
$fields["belongingpopulation"]["perm"]=2;
$fields["belongingpopulation"]["label"]="Population d'appartenance";
$fields["job"]["perm"]=1;
$fields["job"]["label"]="Métier";
$fields["position"]["perm"]=1;
$fields["position"]["label"]="Fonction";
$fields["niveau02"]["perm"]=1;
$fields["niveau02"]["label"]="Niveau 02";
$fields["usualname"]["perm"]=1;
$fields["usualname"]["label"]="Nom d'Usage";
$fields["gender"]["perm"]=1;
$fields["gender"]["label"]="Sexe";
$fields["givensname"]["perm"]=1;
$fields["givensname"]["label"]="Autre Prénom";
$fields["telephonenumber"]["perm"]=1;
$fields["telephonenumber"]["label"]="Téléphone";
$fields["postaladress"]["perm"]=1;
$fields["postaladress"]["label"]="Adresse";
$fields["birthdate"]["perm"]=1;
$fields["birthdate"]["label"]="Date de Naissance";
$fields["birthcountry"]["perm"]=1;
$fields["birthcountry"]["label"]="Pays de Naissance";
$fields["birthplace"]["perm"]=1;
$fields["birthplace"]["label"]="Ville de Naissance";
}
return $fields;
}
protected function getErrorForm($id,$form,$request,$data,$mode) { protected function getErrorForm($id,$form,$request,$data,$mode) {
if ($form->get('submit')->isClicked()&&$mode=="delete") { if ($form->get('submit')->isClicked()&&$mode=="delete") {
} }

View File

@ -276,6 +276,10 @@ span.item-drag {
height: auto; height: auto;
} }
.grid-item-img {
filter: drop-shadow(1px 1px 1px #222);
}
.grid-item .grid-item-title { .grid-item .grid-item-title {
display: inline-block; display: inline-block;
vertical-align: top; vertical-align: top;
@ -436,7 +440,7 @@ a.item-heart {
.grid .grid-image { .grid .grid-image {
width:19.2%; width:19.2%;
height:auto; height:auto;
margin: 1% 0px 0px 0px; /*margin: 1% 0px 0px 0px;*/
} }
.grid .grid-image .item-link { .grid .grid-image .item-link {

View File

@ -10,7 +10,7 @@
</h1> </h1>
{% set permgroup = app.session.get('permgroup') %} {% set permgroup = app.session.get('permgroup') %}
{% if is_granted('ROLE_ADMIN') or is_granted('ROLE_MODO') or (is_granted('ROLE_ANIM') and (permgroup=="ROLE_ADMIN" or permgroup=="ROLE_USER")) or (is_granted('ROLE_USER') and permgroup=="ROLE_USER") %} {% if is_granted('ROLE_ADMIN') or is_granted('ROLE_MODO') or (is_granted('ROLE_ANIM') and (permgroup=="ROLE_ADMIN" or permgroup=="ROLE_ANIM")) or (is_granted('ROLE_USER') and permgroup=="ROLE_USER") %}
<p><a class="btn btn-success" href={{ path('cadoles_core_'~access~'_group_submit') }}> <p><a class="btn btn-success" href={{ path('cadoles_core_'~access~'_group_submit') }}>
{% if access=="config" %} {% if access=="config" %}
Ajouter Ajouter

View File

@ -861,6 +861,73 @@ class InitDataCommand extends ContainerAwareCommand
} }
} }
// Template Group
$entityPage = $em->getRepository('CadolesPortalBundle:Page')->find(-110);
if(!$entityPage) {
$entityPagecategory = $em->getRepository('CadolesPortalBundle:Pagecategory')->find(2);
$entityPage = new Page();
$entityPage->setId(-110);
$entityPage->setRowOrder(0);
$entityPage->setName('Accueil Groupe');
$entityPage->setParentfor('Groupe');
$entityPage->setMaxwidth(1500);
$entityPage->setPagecategory($entityPagecategory);
$entityPage->setTemplate('{"rows":[{"id":0,"cols":[{"id":0,"size": 4,"rows":[]},{"id":1,"size": 8,"rows":[{"id":0,"cols":[{"id":0,"size": 12}]},{"id":1,"cols":[{"id":0,"size": 6},{"id":1,"size": 6}]}]}]}]}');
$em->persist($entityPage);
$em->flush();
// Widget Nos Liens
$fields=["fields"=>[["id"=>"modedesktop","value"=>2]]];
$this->addWidget(-120,$entityPage,-1960,"R1C1",1,"Nos Liens",true,$fields);
// Widget Nos Fichiers
$fields=["fields"=>[]];
$this->addWidget(-130,$entityPage,-1920,"R1C1",2,"Nos Fichiers",true,$fields);
// Widget Info Page
$fields=["fields"=>[]];
$this->addWidget(-140,$entityPage,-1860,"R1C1",3,"Information Page",true,$fields);
// Widget Notre Blog
$fields=["fields"=>[["id"=>"nbarticle","value"=>5]]];
$this->addWidget(-150,$entityPage,-1890,"R1C2R1C1",1,"Notre Blog",false,$fields);
// Widget Notre Calendrier
$fields=["fields"=>[["id"=>"nbday","value"=>30]]];
$this->addWidget(-160,$entityPage,-1900,"R1C2R2C1",1,"Notre Calendrier",true,$fields);
// Chat
$fields=["fields"=>[]];
$this->addWidget(-170,$entityPage,-1840,"R1C2R2C2",1,"Chat",true,$fields);
}
$output->writeln(''); $output->writeln('');
} }
private function addWidget($id,$entityPage,$widgetid,$loc,$order,$title,$border,$fields) {
$em = $this->getContainer()->get('doctrine')->getEntityManager();
$entityPagewidget = $em->getRepository('CadolesPortalBundle:Pagewidget')->find($id);
if(!$entityPagewidget) {
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find($widgetid);
$entityPagewidget = new Pagewidget();
$entityPagewidget->setId($id);
$entityPagewidget->setLoc($loc);
$entityPagewidget->setRoworder($order);
$entityPagewidget->setName($title);
$entityPagewidget->setHeight($entityWidget->getHeight());
$entityPagewidget->setAutoajust($entityWidget->getAutoajust());
$entityPagewidget->setBorder($border);
$entityPagewidget->setOpened($entityWidget->getOpened());
$entityPagewidget->setIcon($entityWidget->getIcon());
$entityPagewidget->setPage($entityPage);
$entityPagewidget->setWidget($entityWidget);
$entityPagewidget->setParameter($fields);
$em->persist($entityPagewidget);
$em->flush();
}
}
} }

View File

@ -1933,11 +1933,10 @@ class PagewidgetController extends Controller
if(!$cansee) throw $this->createNotFoundException('Permission denied'); if(!$cansee) throw $this->createNotFoundException('Permission denied');
} }
if($usage!="group") { if($usage!="group"||!$group) {
$group=$em->getRepository("CadolesCoreBundle:Group")->findOneBy(["fgall"=>true])->getId(); $group=$em->getRepository("CadolesCoreBundle:Group")->findOneBy(["fgall"=>true])->getId();
} }
dump($group);
// Render // Render
return $this->render($this->labelentity.':viewchat.html.twig', [ return $this->render($this->labelentity.':viewchat.html.twig', [
@ -2034,6 +2033,7 @@ class PagewidgetController extends Controller
$mygroups=[]; $mygroups=[];
$mymsg= []; $mymsg= [];
$this->getDoctrine()->getRepository("CadolesPortalBundle:Page")->getPagesUser($user,null,$default,$pagesuser,$pagesadmin,$groupsshared); $this->getDoctrine()->getRepository("CadolesPortalBundle:Page")->getPagesUser($user,null,$default,$pagesuser,$pagesadmin,$groupsshared);
if(is_array($groupsshared)) {
foreach($groupsshared as $groupshared) { foreach($groupsshared as $groupshared) {
// On récupère l'ensemble des messages du groupes // On récupère l'ensemble des messages du groupes
$messages=$this->getDoctrine()->getRepository("CadolesWebsocketBundle:Message")->findBy(["group"=>$groupshared]); $messages=$this->getDoctrine()->getRepository("CadolesWebsocketBundle:Message")->findBy(["group"=>$groupshared]);
@ -2058,6 +2058,8 @@ class PagewidgetController extends Controller
$ord[] = $value['date']; $ord[] = $value['date'];
} }
array_multisort($ord, SORT_DESC, $mymsg); array_multisort($ord, SORT_DESC, $mymsg);
}
// Render // Render
return $this->render($this->labelentity.':viewgroupmessage.html.twig', [ return $this->render($this->labelentity.':viewgroupmessage.html.twig', [

View File

@ -260,6 +260,20 @@ class PageRepository extends EntityRepository
$id=$pages->current()->getId(); $id=$pages->current()->getId();
$entity = $this->find($id); $entity = $this->find($id);
} }
// Si aucune page profilé on récupère la premiere page perso
if(!$entity) {
if($pagesuser)
$entity=$pagesuser[0];
}
// Si aucune page profilé on récupère la premiere page perso
if(!$entity) {
if($groupsshared) {
if($groupsshared[0])
$entity=$groupsshared[0]->pagesshared[0];
}
}
} }
// ou On récupère la premiere page de l'utilisateur // ou On récupère la premiere page de l'utilisateur

View File

@ -242,9 +242,6 @@
{% set stylewidgetbodyframe = "" %} {% set stylewidgetbodyframe = "" %}
{% set stylewidgetbodyframe = stylewidgetbodyframe ~ "background-color: #" ~ colorbodyback ~ "; " %} {% set stylewidgetbodyframe = stylewidgetbodyframe ~ "background-color: #" ~ colorbodyback ~ "; " %}
{% set stylewidgetbodyframe = stylewidgetbodyframe ~ "color: #" ~ colorbodyfont ~ "; " %} {% set stylewidgetbodyframe = stylewidgetbodyframe ~ "color: #" ~ colorbodyfont ~ "; " %}
{% if entity.border %}
{% set stylewidgetbodyframe = stylewidgetbodyframe ~ "padding: 0px 0px 0px 10px; " %}
{% endif %}
{% if not entity.autoajust %} {% if not entity.autoajust %}
{% set stylewidgetbodyframe = stylewidgetbodyframe ~ "height: " ~ (entity.height-50-2) ~ "px;" %} {% set stylewidgetbodyframe = stylewidgetbodyframe ~ "height: " ~ (entity.height-50-2) ~ "px;" %}
{% endif %} {% endif %}

View File

@ -23,6 +23,7 @@
{% set colorbodyfont = color['fontcolorhover'] %} {% set colorbodyfont = color['fontcolorhover'] %}
{% endif %} {% endif %}
{% if app.user %}
<div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px"> <div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
{% if canupdate %} {% if canupdate %}
<div class="widgetmenu"> <div class="widgetmenu">
@ -46,8 +47,10 @@
<span class="title">{{ entity.name }}</span> <span class="title">{{ entity.name }}</span>
</div> </div>
<div class="widgetbody" style="{{ stylewidgetbodyframe }}; overflow-y:auto;"> <div class="widgetbody" style="{{ stylewidgetbodyframe }}; overflow-y:auto; {%if entity.border %} padding-left: 10px; {%endif%}">
{% if group is not null %}
{{ render(url('cadoles_websocket_chat',{'id':group,'framed':true,'border':entity.border,'colorbodybacklight':colorbodyback, 'colorbodyback':colorbodyback,'colorbodyfont':colorbodyfont})) }} {{ render(url('cadoles_websocket_chat',{'id':group,'framed':true,'border':entity.border,'colorbodybacklight':colorbodyback, 'colorbodyback':colorbodyback,'colorbodyfont':colorbodyfont})) }}
{% endif %}
<!-- <!--
<iframe src="{{ path(tool,{'id':group,'framed':true,'border':entity.border,'colorbodybacklight':colorbodyback, 'colorbodyback':colorbodyback,'colorbodyfont':colorbodyfont}) }}" class="{% if entity.autoajust %}frameajust {% endif %}"></iframe> <iframe src="{{ path(tool,{'id':group,'framed':true,'border':entity.border,'colorbodybacklight':colorbodyback, 'colorbodyback':colorbodyback,'colorbodyfont':colorbodyfont}) }}" class="{% if entity.autoajust %}frameajust {% endif %}"></iframe>
--> -->
@ -56,7 +59,4 @@
{% endif %} {% endif %}
</div> </div>
<script> {%endif%}
</script>

View File

@ -9,7 +9,7 @@
{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %} {% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %}
{% set stylewidgetheader = constants.mystylewidgetheader(entity) %} {% set stylewidgetheader = constants.mystylewidgetheader(entity) %}
{% set stylewidgetbody = constants.mystylewidgetbody(entity) %} {% set stylewidgetbody = constants.mystylewidgetbody(entity) %}
{% set stylewidgetbodyreverse = constants.mystylewidgetbodyreverse(entity) %}
{% set color = app.session.get('color') %} {% set color = app.session.get('color') %}
@ -65,8 +65,8 @@
<div class="grid-item grid-small"> <div class="grid-item grid-small">
<div class="grid-item-content"> <div class="grid-item-content">
{% if canadd %} {% if canadd %}
<a style="{{ stylewidgetbody }} cursor:pointer" onClick="delFile('widget-{{ entity.id}}','{{file.name }}')" class="item-delete"> <a style="color:#{{colorbodyfont}}; cursor:pointer" onClick="delFile('widget-{{ entity.id}}','{{file.name }}')" class="item-delete">
<i style="{{ stylewidgetbody }}" class="fa fa-trash" title="Supprimer le fichier"></i> <i style="color:#{{colorbodyfont}}" class="fa fa-trash" title="Supprimer le fichier"></i>
</a> </a>
{% endif %} {% endif %}
@ -86,7 +86,7 @@
</div> </div>
<div class="grid-item-title"> <div class="grid-item-title">
<h2 style="{{ stylewidgetbody }}">{{ file.name }}</h2> <h2 style="color:#{{colorbodyfont}}">{{ file.name }}</h2>
</div> </div>
</div> </div>
</a> </a>
@ -96,18 +96,15 @@
{% if canadd %} {% if canadd %}
<div class="grid-item grid-small"> <div class="grid-item grid-small">
<div class="grid-item-content"> <div data-toggle="modal" data-target="#mymodal" onClick="ModalLoad('mymodal','Fichiers','{{ path('cadoles_core_'~access~'_file_upload',{'id': 'widget-'~entity.id,'type':'all'}) }}');" title='Ajouter des fichiers' class="grid-item-content" style="background-color: #{{color['main']}};cursor:pointer;">
<a style="{{ stylewidgetmenu }}" data-toggle="modal" data-target="#mymodal" onClick="ModalLoad('mymodal','Fichiers','{{ path('cadoles_core_'~access~'_file_upload',{'id': 'widget-'~entity.id,'type':'all'}) }}');" title='Ajouter des fichiers'>
<div class="item-link clearfix"> <div class="item-link clearfix">
<div class="grid-item-logo"> <div class="grid-item-logo">
<img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_add.png" /> <img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_add.png">
</div> </div>
<div class="grid-item-title"> <div class="grid-item-title">
<h2 style="{{ stylewidgetbody }}">Ajouter un fichier</h2> <h2>Ajouter un fichier</h2>
</div> </div>
</div> </div>
</a>
</div> </div>
</div> </div>
{% endif %} {% endif %}

View File

@ -56,6 +56,7 @@
{% set firstflux="" %} {% set firstflux="" %}
{% if fluxs is defined and fluxs is not empty %}
<div class="widgetbody" style="{{ stylewidgetbody }} "> <div class="widgetbody" style="{{ stylewidgetbody }} ">
{% if fluxs is defined %} {% if fluxs is defined %}
{% if fluxs|length > 1 %} {% if fluxs|length > 1 %}
@ -116,6 +117,7 @@
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
{% endif %}
</div> </div>

View File

@ -33,7 +33,7 @@
{% if onheader %} {% if onheader %}
<div class="widgetheader" style="{{ stylewidgetbodyimage }}"> <div class="widgetheader" style="{{ stylewidgetbodyimage }}">
<iframe src="{{ path(tool,{'colorbodyback':colorbodyback,'colorbodyfont':colorbodyfont}) }}" style="margin-top:30px" class="{% if entity.autoajust %}frameajust {% endif %}"></iframe> <iframe src="{{ path(tool,{'colorbodyback':colorbodyback,'colorbodyfont':colorbodyfont}) }}" style="margin-top:30px; {{ stylewidgetbodyframe }}" class="{% if entity.autoajust %}frameajust {% endif %}"></iframe>
</div> </div>
{% else %} {% else %}
<div class="widgetheader" style="{{ stylewidgetheader }}"> <div class="widgetheader" style="{{ stylewidgetheader }}">
@ -46,7 +46,7 @@
</div> </div>
<div class="widgetbody" style="{{ stylewidgetbodyframe }}"> <div class="widgetbody" style="{{ stylewidgetbodyframe }}">
<iframe src="{{ path(tool) }}" class="{% if entity.autoajust %}frameajust {% endif %}"></iframe> <iframe src="{{ path(tool) }}" class="{% if entity.autoajust %}frameajust {% endif %}" style="{{ stylewidgetbodyframe }}"></iframe>
</div> </div>
{% endif %} {% endif %}
</div> </div>

View File

@ -9,7 +9,7 @@
{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %} {% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %}
{% set stylewidgetheader = constants.mystylewidgetheader(entity) %} {% set stylewidgetheader = constants.mystylewidgetheader(entity) %}
{% set stylewidgetbody = constants.mystylewidgetbody(entity) %} {% set stylewidgetbody = constants.mystylewidgetbody(entity) %}
{% set stylewidgetbodyreverse = constants.mystylewidgetbodyreverse(entity) %}
{% set color = app.session.get('color') %} {% set color = app.session.get('color') %}
@ -48,11 +48,16 @@
<span class="title">{{ entity.name }}</span> <span class="title">{{ entity.name }}</span>
</div> </div>
{% if files|length>0 %} {% if files|length>0 or canupdate %}
<div class="widgetbody" style="{{ stylewidgetbody }}"> <div class="widgetbody" style="{{ stylewidgetbody }}">
<div class="grid clearfix"> <div class="grid clearfix">
{% if canupdate %}
<div class="grid-sizer grid-image"></div>
<div class="grid-gutter-sizer"></div>
{% endif %}
{% for file in files|sort %} {% for file in files|sort %}
{% if loop.index==1 %} {% if loop.index==1 and not canupdate %}
<div class="grid-sizer grid-image"></div> <div class="grid-sizer grid-image"></div>
<div class="grid-gutter-sizer grid-gutter-sizer-image"></div> <div class="grid-gutter-sizer grid-gutter-sizer-image"></div>
{% endif %} {% endif %}
@ -74,6 +79,24 @@
</div> </div>
</div> </div>
{% endfor %} {% endfor %}
{% if canadd %}
<div class="grid-item grid-list" style="{{ stylewidgetbodyreverse }};">
<div class="grid-item-content">
<a style="{{ stylewidgetmenu }}" data-toggle="modal" data-target="#mymodal" onClick="ModalLoad('mymodal','Fichiers','{{ path('cadoles_core_'~access~'_file_upload',{'id': 'widget-'~entity.id,'type':'image'}) }}');" title='Ajouter des fichiers'>
<div class="item-link clearfix">
<div class="grid-item-logo">
<img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_add.png" />
</div>
<div class="grid-item-title">
<h2 style="{{ stylewidgetbodyreverse }}">Ajouter une image</h2>
</div>
</div>
</a>
</div>
</div>
{% endif %}
</div> </div>
</div> </div>
{% endif %} {% endif %}

View File

@ -55,24 +55,9 @@
<span class="title">{{ entity.name }}</span> <span class="title">{{ entity.name }}</span>
</div> </div>
{% set firstflux="" %}
{% if messages is not empty %}
<div class="widgetbody" style="{{ stylewidgetbody }} "> <div class="widgetbody" style="{{ stylewidgetbody }} ">
{% if fluxs is defined %}
{% if fluxs|length > 1 %}
<div class="cat-list-feed" onClick="showFlux({{ entity.id}},'all')" style="color:#{{ color['fontcolorhover'] }}; background-color: #{{ color['main'] }}">Tout</div>
{% for flux in fluxs %}
{% set stylefeed = "background-color: #" ~ color['main'] ~ ";" %}
{% if flux.color is not null %}
{% set stylefeed = "background-color: #" ~ flux.color ~ ";" %}
{% endif %}
<div class="cat-list-feed" onClick="showFlux({{ entity.id}},{{ flux.id }})" style="{{ stylefeed }} color:#{{ color['fontcolorhover'] }};">{{ flux.title }}</div>
{% endfor %}
{% endif %}
{% endif %}
<div class="grid clearfix"> <div class="grid clearfix">
<div class="grid-sizer {{stylegrid}}"></div> <div class="grid-sizer {{stylegrid}}"></div>
<div class="grid-gutter-sizer {{stylegrid}}-gutter-sizer"></div> <div class="grid-gutter-sizer {{stylegrid}}-gutter-sizer"></div>
@ -95,7 +80,7 @@
</div> </div>
<div class="caption"> <div class="caption">
<div class="grid-item-title" style="position:inherit"> <div class="grid-item-title" style="position:inherit; width:85%">
{{message.user.lastname}} {{message.user.firstname}}<br> {{message.user.lastname}} {{message.user.firstname}}<br>
<small>{{message.date|date('d/m/Y H:i')}}</small><br><br> <small>{{message.date|date('d/m/Y H:i')}}</small><br><br>
{{ message.topic | raw }} {{ message.topic | raw }}
@ -107,6 +92,7 @@
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
{% endif %}
</div> </div>

View File

@ -19,6 +19,7 @@
{% set stylelink = "color:#" ~ color['fontcolorhover'] %} {% set stylelink = "color:#" ~ color['fontcolorhover'] %}
{% endif %} {% endif %}
<div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px"> <div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
{% if canupdate %} {% if canupdate %}
<div class="widgetmenu"> <div class="widgetmenu">
@ -27,8 +28,8 @@
</div> </div>
{% endif %} {% endif %}
{% set canadd = false %}
<div class="widgetheader" style="{{ stylewidgetbodyimage }}; height:100%;"> <div class="widgetheader" style="{{ stylewidgetheader }};">
{% set style = "width: 90px;display: block;margin: auto; padding: 10px 0px 10px 0px; position: inherit;height: auto;" %} {% set style = "width: 90px;display: block;margin: auto; padding: 10px 0px 10px 0px; position: inherit;height: auto;" %}
{% if icon %} {% if icon %}
<img src="/{{ alias }}{{ icon }}" class="logo" style="{{ style }}" /> <img src="/{{ alias }}{{ icon }}" class="logo" style="{{ style }}" />
@ -37,9 +38,11 @@
{% endif %} {% endif %}
</div> </div>
{% set canadd = false %}
<div class="widgetbody" style="{{ stylewidgetbody }}"> <div class="widgetbody" style="{{ stylewidgetbody }}">
<div style="text-align: center;">
<div style="text-align: center; margin-top:40px;">
{%if usage=="group" %}<small>Groupe<br></small>{% endif %} {%if usage=="group" %}<small>Groupe<br></small>{% endif %}
<span style="font-size:120%">{{ title }}</span><br><br> <span style="font-size:120%">{{ title }}</span><br><br>
{{ description | raw }} {{ description | raw }}
@ -56,13 +59,16 @@
</div> </div>
<div class="grid-item-title"> <div class="grid-item-title">
<h2 style="{{ stylewidgetbodyreverse }};">
{{ member.user.lastname }} {{ member.user.firstname }}
{%if member.fgmanager%} {%if member.fgmanager%}
<i style="color: #FFF" class="fa fa-star" title="Manager"></i> <br>
<i style="{{ stylewidgetbodyreverse }};" class="fa fa-star" title="Manager"></i>
{% if member.user==app.user %} {% if member.user==app.user %}
{% set canadd=true %} {% set canadd=true %}
{% endif %} {% endif %}
{%endif%}<br> {%endif%}
{{ member.user.lastname }} {{ member.user.firstname }} </h2>
</div> </div>
</div> </div>
</div> </div>
@ -78,7 +84,7 @@
<div class="grid-item-title"> <div class="grid-item-title">
Ajouter un membre <h2 style="{{ stylewidgetbodyreverse }};">Ajouter un membre</h2>
</div> </div>
</div> </div>
</a> </a>

View File

@ -53,6 +53,7 @@
<span class="title">{{ entity.name }}</span> <span class="title">{{ entity.name }}</span>
</div> </div>
{% if canadd or bookmarks is not empty or items is not empty %}
<div class="widgetbody" style="{{ stylewidgetbody }}"> <div class="widgetbody" style="{{ stylewidgetbody }}">
<div class="grid clearfix"> <div class="grid clearfix">
<div class="grid-sizer {{ stylegrid }}"></div> <div class="grid-sizer {{ stylegrid }}"></div>
@ -162,6 +163,8 @@
{% endif %} {% endif %}
</div> </div>
</div> </div>
{% endif %}
</div> </div>

View File

@ -46,7 +46,7 @@
</div> </div>
<div class="widgetbody" style="{{ stylewidgetbodyframe }}"> <div class="widgetbody" style="{{ stylewidgetbodyframe }}">
<iframe src="{{ url }}" class="{% if entity.autoajust %}frameajust {% endif %}"></iframe> <iframe src="{{ url }}" class="{% if entity.autoajust %}frameajust {% endif %}" style="{{ stylewidgetbodyframe }}"></iframe>
</div> </div>
{% endif %} {% endif %}
</div> </div>

View File

@ -48,12 +48,11 @@ class ChatController extends Controller
// Génération d'une clé temporaire d'accès au chat // Génération d'une clé temporaire d'accès au chat
$key = Uuid::uuid4(); $key = Uuid::uuid4();
$usergroup=$em->getRepository("CadolesCoreBundle:UserGroup")->findOneBy(["group"=>$group,"user"=>$user]); $usergroup=$em->getRepository("CadolesCoreBundle:UserGroup")->findOneBy(["group"=>$group,"user"=>$user]);
if(!$usergroup) die("noingroup".$user->getUserName()); if($usergroup) {
$usergroup->setKeyvalue($key); $usergroup->setKeyvalue($key);
// Sauvegarde
$em->persist($usergroup); $em->persist($usergroup);
$em->flush(); $em->flush();
}
// Récupération des message du groupe // Récupération des message du groupe
@ -75,7 +74,8 @@ class ChatController extends Controller
'border' => $border, 'border' => $border,
'colorbodyback' => $colorbodyback, 'colorbodyback' => $colorbodyback,
'colorbodyfont' => $colorbodyfont, 'colorbodyfont' => $colorbodyfont,
'fgmanager' => ($usergroup->getFgmanager()||$user->getRole()=="ROLE_ADMIN"||$user->getRole()=="ROLE_MODO"), 'ingroup' => ($usergroup),
'fgmanager' => ($usergroup&&($usergroup->getFgmanager()||$user->getRole()=="ROLE_ADMIN"||$user->getRole()=="ROLE_MODO")),
'form' => $form->createView() 'form' => $form->createView()
]); ]);
} }

View File

@ -51,6 +51,7 @@
{% endblock %} {% endblock %}
{% block pagewrapper %} {% block pagewrapper %}
{% if app.user and ingroup %}
{{ form_start(form) }} {{ form_start(form) }}
<div class='row'> <div class='row'>
{{ form_widget(form.message) }} {{ form_widget(form.message) }}
@ -109,6 +110,7 @@
</div> </div>
{{ form_end(form) }} {{ form_end(form) }}
{% endif %}
{% endblock %} {% endblock %}
{% block localexternalscript %} {% block localexternalscript %}