Compare commits

..

No commits in common. "ab2129de6efaee617fe515a8ca7a7ddcafe78e95" and "b14a2b3434a27a8024e5e2e7f0259c4093c1845e" have entirely different histories.

21 changed files with 157 additions and 380 deletions

View File

@ -8,6 +8,7 @@ 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,11 +16,6 @@ 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;
@ -33,8 +28,6 @@ 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()
{ {
@ -83,9 +76,8 @@ class SynchroCommand extends Command
$this->writeln('== SYNCHONISATION ANNUAIRE =========================='); $this->writeln('== SYNCHONISATION ANNUAIRE ==========================');
$this->writeln('====================================================='); $this->writeln('=====================================================');
$this->ldap = $this->container->get('cadoles.core.service.ldap'); $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('=====================================================');
@ -93,7 +85,7 @@ class SynchroCommand extends Command
$this->writeln('====================================================='); $this->writeln('=====================================================');
$this->ldap_basedn = $this->container->getParameter('ldap_basedn'); $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');
@ -134,7 +126,7 @@ class SynchroCommand extends Command
$this->writeln(''); $this->writeln('');
$this->writeln('== CLASSES =========================================='); $this->writeln('== CLASSES ==========================================');
$results = $this->ldap->search("type=Classe", ['cn','description','gidNumber'], $this->ldap_basedn); $results = $ldap->search("type=Classe", ['cn','description','gidNumber'], $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)))";
@ -163,7 +155,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 = $this->ldap->search($niveau01->getLdapfilter(), $fieldstoread, $this->ldap_basedn); $results = $ldap->search($niveau01->getLdapfilter(), $fieldstoread, $ldap_basedn);
$nbuserstotal=count($results); $nbuserstotal=count($results);
// Pour chaque utilisateur ldap // Pour chaque utilisateur ldap
@ -255,8 +247,7 @@ class SynchroCommand extends Command
$this->writeln('== '.$group->getLabel()); $this->writeln('== '.$group->getLabel());
if(!is_null($ldapfilter)) { if(!is_null($ldapfilter)) {
$results = $this->ldap->search($ldapfilter,[$ldap_username,"memberuid"] , $this->ldap_basedn); $results = $ldap->search($ldapfilter,[$ldap_username,"memberuid"] , $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
@ -342,7 +333,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[$data["username"]]); unset($flipped[$user->getUsername()]);
} }
$this->em->clear(); $this->em->clear();
@ -369,17 +360,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 = $this->ldap->search($criteria, array('cn'), $subbranch); $results = $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) $this->ldap->modifyNiveau01($data,$data->getLabel()); if(!$simulate) $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) $this->ldap->addNiveau01($data); if(!$simulate) $ldap->addNiveau01($data);
} }
} }
@ -396,17 +387,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 = $this->ldap->search($criteria, array('cn'), $subbranch); $results = $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) $this->ldap->modifyNiveau02($data,$data->getLabel()); if(!$simulate) $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) $this->ldap->addNiveau02($data); if(!$simulate) $ldap->addNiveau02($data);
} }
} }
@ -423,17 +414,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 = $this->ldap->search($criteria, array('cn'), $subbranch); $results = $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) $this->ldap->modifyGroup($data,$data->getLabel()); if(!$simulate) $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) $this->ldap->addGroup($data); if(!$simulate) $ldap->addGroup($data);
} }
} }
@ -450,7 +441,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 = $this->ldap->search($criteria, array('uid'), $subbranch); $results = $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()) {
@ -467,16 +458,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) $this->ldap->modifyUser($data); if(!$simulate) $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) $this->ldap->addUser($data); if(!$simulate) $ldap->addUser($data);
} }
// Rattachement à Niveau01 et Niveau02 // Rattachement à Niveau01 et Niveau02
if(!$simulate) $this->ldap->addGroupUser($data); if(!$simulate) $ldap->addGroupUser($data);
} }
$this->writeln(''); $this->writeln('');
@ -492,21 +483,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 = $this->ldap->search($criteria, array('cn'), $subbranch); $results = $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=$this->ldap->getNiveau01DN($data->getLabel()); $dn=$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"],$this->ldap->getUserDN($userniveau01)); array_push($attrs["cadolesMember"],$ldap->getUserDN($userniveau01));
$this->writeln(' > '.$userniveau01->getUsername()); $this->writeln(' > '.$userniveau01->getUsername());
} }
if(!$simulate) $this->ldap->ldapModify($dn, $attrs); if(!$simulate) $ldap->ldapModify($dn, $attrs);
} }
} }
@ -523,21 +514,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 = $this->ldap->search($criteria, array('cn'), $subbranch); $results = $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=$this->ldap->getNiveau02DN($data->getLabel()); $dn=$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"],$this->ldap->getUserDN($userniveau01)); array_push($attrs["cadolesMember"],$ldap->getUserDN($userniveau01));
$this->writeln(' > '.$userniveau01->getUsername()); $this->writeln(' > '.$userniveau01->getUsername());
} }
if(!$simulate) $this->ldap->ldapModify($dn, $attrs); if(!$simulate) $ldap->ldapModify($dn, $attrs);
} }
} }
@ -555,21 +546,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 = $this->ldap->search($criteria, array('cn'), $subbranch); $results = $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=$this->ldap->getGroupDN($data->getLabel()); $dn=$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"],$this->ldap->getUserDN($usergroupe->getUser())); array_push($attrs["cadolesMember"],$ldap->getUserDN($usergroupe->getUser()));
$this->writeln(' > '.$usergroupe->getUser()->getUsername()); $this->writeln(' > '.$usergroupe->getUser()->getUsername());
} }
if(!$simulate) $this->ldap->ldapModify($dn, $attrs); if(!$simulate) $ldap->ldapModify($dn, $attrs);
} }
} }
@ -585,14 +576,14 @@ class SynchroCommand extends Command
$criteria = '(cn=*)'; $criteria = '(cn=*)';
$subbranch=$baseNiveau01; $subbranch=$baseNiveau01;
$results = $this->ldap->search($criteria, array('cn'), $subbranch); $results = $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=$this->ldap->getNiveau01DN($result["cn"]); $dn=$ldap->getNiveau01DN($result["cn"]);
if(!$simulate) $this->ldap->deleteByDN($dn); if(!$simulate) $ldap->deleteByDN($dn);
} }
} }
@ -602,14 +593,14 @@ class SynchroCommand extends Command
$criteria = '(cn=*)'; $criteria = '(cn=*)';
$subbranch=$baseNiveau02; $subbranch=$baseNiveau02;
$results = $this->ldap->search($criteria, array('cn'), $subbranch); $results = $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=$this->ldap->getNiveau02DN($result["cn"]); $dn=$ldap->getNiveau02DN($result["cn"]);
if(!$simulate) $this->ldap->deleteByDN($dn); if(!$simulate) $ldap->deleteByDN($dn);
} }
} }
@ -620,14 +611,14 @@ class SynchroCommand extends Command
$criteria = '(cn=*)'; $criteria = '(cn=*)';
$subbranch=$baseGroup; $subbranch=$baseGroup;
$results = $this->search($criteria, array('cn'), $subbranch); $results = $ldap->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=$this->ldap->getGroupDN($result["cn"]); $dn=$ldap->getGroupDN($result["cn"]);
if(!$simulate) $this->ldap->deleteByDN($dn); if(!$simulate) $ldap->deleteByDN($dn);
} }
} }
@ -637,14 +628,14 @@ class SynchroCommand extends Command
$criteria = '(uid=*)'; $criteria = '(uid=*)';
$subbranch=$baseUser; $subbranch=$baseUser;
$results = $this->ldap->search($criteria, array('uid'), $subbranch); $results = $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) $this->ldap->deleteByDN($dn); if(!$simulate) $ldap->deleteByDN($dn);
} }
} }
} }
@ -663,14 +654,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(false); $group->setFgcancreatepage(true);
$group->setFgcancreateblog(false); $group->setFgcancreateblog(true);
$group->setFgcancreatecalendar(false); $group->setFgcancreatecalendar(true);
} }
$group->setLabel($label); $group->setLabel($label);
@ -679,52 +670,8 @@ 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) {
@ -733,18 +680,10 @@ 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 $this->em->persist($member);
$ldap_template = $this->container->getParameter('ldap_template'); $this->em->flush();
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->flush();
} }
protected function addUser($niveau01,$username,$firstname,$lastname,$email,$usersadmin) { protected function addUser($niveau01,$username,$firstname,$lastname,$email,$usersadmin) {
@ -763,18 +702,9 @@ 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}kiCU5m1uSvZhdgI1Ga9gdq/8HUBjSIpX (-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}eyoxoh9yJzJyNAacnf9gxyZbtRWITzXF
', '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,7 +298,10 @@ 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(
@ -407,7 +410,9 @@ 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();
$fields=$this->getDefaultDatauser(); $config=$em->getRepository('CadolesCoreBundle:Config')->find("datauser");
$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") {
@ -620,7 +625,9 @@ 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);
$fields=$this->getDefaultDatauser(); $config=$em->getRepository('CadolesCoreBundle:Config')->find("datauser");
$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") {
@ -980,64 +987,6 @@ 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,10 +276,6 @@ 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;
@ -440,7 +436,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_ANIM")) 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_USER")) 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,73 +861,6 @@ 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,10 +1933,11 @@ class PagewidgetController extends Controller
if(!$cansee) throw $this->createNotFoundException('Permission denied'); if(!$cansee) throw $this->createNotFoundException('Permission denied');
} }
if($usage!="group"||!$group) { if($usage!="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', [
@ -2033,33 +2034,30 @@ 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]); foreach($messages as $key => $message) {
foreach($messages as $key => $message) { // persistante collection à revoir
// persistante collection à revoir if($message->getSees()->count()>0) {
if($message->getSees()->count()>0) { if($message->getSees()->contains($user) ) {
if($message->getSees()->contains($user) ) {
unset($messages[$key]); unset($messages[$key]);
}
} }
} }
foreach($messages as $key => $message) {
$tmp=["id" => $message->getId(), "user" => $message->getUser(), "date"=>$message->getSubmitdate(), "topic"=>$message->getTopic()];
array_push($mymsg,$tmp);
}
} }
$ord = array(); foreach($messages as $key => $message) {
foreach ($mymsg as $key => $value){ $tmp=["id" => $message->getId(), "user" => $message->getUser(), "date"=>$message->getSubmitdate(), "topic"=>$message->getTopic()];
$ord[] = $value['date']; array_push($mymsg,$tmp);
} }
array_multisort($ord, SORT_DESC, $mymsg);
} }
$ord = array();
foreach ($mymsg as $key => $value){
$ord[] = $value['date'];
}
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,20 +260,6 @@ 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,6 +242,9 @@
{% 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,7 +23,6 @@
{% 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">
@ -47,10 +46,8 @@
<span class="title">{{ entity.name }}</span> <span class="title">{{ entity.name }}</span>
</div> </div>
<div class="widgetbody" style="{{ stylewidgetbodyframe }}; overflow-y:auto; {%if entity.border %} padding-left: 10px; {%endif%}"> <div class="widgetbody" style="{{ stylewidgetbodyframe }}; overflow-y:auto;">
{% 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>
--> -->
@ -59,4 +56,7 @@
{% endif %} {% endif %}
</div> </div>
{%endif%} <script>
</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="color:#{{colorbodyfont}}; cursor:pointer" onClick="delFile('widget-{{ entity.id}}','{{file.name }}')" class="item-delete"> <a style="{{ stylewidgetbody }} cursor:pointer" onClick="delFile('widget-{{ entity.id}}','{{file.name }}')" class="item-delete">
<i style="color:#{{colorbodyfont}}" class="fa fa-trash" title="Supprimer le fichier"></i> <i style="{{ stylewidgetbody }}" 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="color:#{{colorbodyfont}}">{{ file.name }}</h2> <h2 style="{{ stylewidgetbody }}">{{ file.name }}</h2>
</div> </div>
</div> </div>
</a> </a>
@ -96,16 +96,19 @@
{% if canadd %} {% if canadd %}
<div class="grid-item grid-small"> <div class="grid-item grid-small">
<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;"> <div class="grid-item-content">
<div class="item-link clearfix"> <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="grid-item-logo"> <div class="item-link clearfix">
<img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_add.png"> <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="{{ stylewidgetbody }}">Ajouter un fichier</h2>
</div>
</div> </div>
<div class="grid-item-title"> </a>
<h2>Ajouter un fichier</h2> </div>
</div>
</div>
</div>
</div> </div>
{% endif %} {% endif %}
</div> </div>

View File

@ -56,7 +56,6 @@
{% 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 %}
@ -117,7 +116,6 @@
{% 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; {{ stylewidgetbodyframe }}" class="{% if entity.autoajust %}frameajust {% endif %}"></iframe> <iframe src="{{ path(tool,{'colorbodyback':colorbodyback,'colorbodyfont':colorbodyfont}) }}" style="margin-top:30px" 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 %}" style="{{ stylewidgetbodyframe }}"></iframe> <iframe src="{{ path(tool) }}" class="{% if entity.autoajust %}frameajust {% endif %}"></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,16 +48,11 @@
<span class="title">{{ entity.name }}</span> <span class="title">{{ entity.name }}</span>
</div> </div>
{% if files|length>0 or canupdate %} {% if files|length>0 %}
<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 and not canupdate %} {% if loop.index==1 %}
<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 %}
@ -79,24 +74,6 @@
</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,9 +55,24 @@
<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>
@ -80,7 +95,7 @@
</div> </div>
<div class="caption"> <div class="caption">
<div class="grid-item-title" style="position:inherit; width:85%"> <div class="grid-item-title" style="position:inherit">
{{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 }}
@ -92,7 +107,6 @@
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
{% endif %}
</div> </div>

View File

@ -19,7 +19,6 @@
{% 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">
@ -28,8 +27,8 @@
</div> </div>
{% endif %} {% endif %}
{% set canadd = false %}
<div class="widgetheader" style="{{ stylewidgetheader }};"> <div class="widgetheader" style="{{ stylewidgetbodyimage }}; height:100%;">
{% 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 }}" />
@ -38,11 +37,9 @@
{% 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 }}
@ -59,16 +56,13 @@
</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%}
<br> <i style="color: #FFF" class="fa fa-star" title="Manager"></i>
<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%} {%endif%}<br>
</h2> {{ member.user.lastname }} {{ member.user.firstname }}
</div> </div>
</div> </div>
</div> </div>
@ -84,7 +78,7 @@
<div class="grid-item-title"> <div class="grid-item-title">
<h2 style="{{ stylewidgetbodyreverse }};">Ajouter un membre</h2> Ajouter un membre
</div> </div>
</div> </div>
</a> </a>

View File

@ -53,7 +53,6 @@
<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>
@ -163,8 +162,6 @@
{% 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 %}" style="{{ stylewidgetbodyframe }}"></iframe> <iframe src="{{ url }}" class="{% if entity.autoajust %}frameajust {% endif %}"></iframe>
</div> </div>
{% endif %} {% endif %}
</div> </div>

View File

@ -48,11 +48,12 @@ 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) { if(!$usergroup) die("noingroup".$user->getUserName());
$usergroup->setKeyvalue($key); $usergroup->setKeyvalue($key);
$em->persist($usergroup);
$em->flush(); // Sauvegarde
} $em->persist($usergroup);
$em->flush();
// Récupération des message du groupe // Récupération des message du groupe
@ -74,8 +75,7 @@ class ChatController extends Controller
'border' => $border, 'border' => $border,
'colorbodyback' => $colorbodyback, 'colorbodyback' => $colorbodyback,
'colorbodyfont' => $colorbodyfont, 'colorbodyfont' => $colorbodyfont,
'ingroup' => ($usergroup), 'fgmanager' => ($usergroup->getFgmanager()||$user->getRole()=="ROLE_ADMIN"||$user->getRole()=="ROLE_MODO"),
'fgmanager' => ($usergroup&&($usergroup->getFgmanager()||$user->getRole()=="ROLE_ADMIN"||$user->getRole()=="ROLE_MODO")),
'form' => $form->createView() 'form' => $form->createView()
]); ]);
} }

View File

@ -51,14 +51,13 @@
{% 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) }}
<input id="sendbymail" type="checkbox" id="item_essential" name="item[essential]" style="float:right" class='switch' ></input> <input id="sendbymail" type="checkbox" id="item_essential" name="item[essential]" style="float:right" class='switch' ></input>
<label class="custom-control-label" for="sendbymail">Envoyer par Mail ?</label> <label class="custom-control-label" for="sendbymail">Envoyer par Mail ?</label>
<a id="sendbtn" class="btn btn-success" style="margin-top:5px; width:100%; margin-bottom:15px">Envoyer</a> <a id="sendbtn" class="btn btn-success" style="margin-top:5px; width:100%; margin-bottom:15px">Envoyer</a>
</div> </div>
@ -110,7 +109,6 @@
</div> </div>
{{ form_end(form) }} {{ form_end(form) }}
{% endif %}
{% endblock %} {% endblock %}
{% block localexternalscript %} {% block localexternalscript %}