svg modele scribe

This commit is contained in:
afornerot 2019-09-30 16:30:52 +02:00
parent 0dcbb47d90
commit 6b3c52e453
17 changed files with 337 additions and 136 deletions

View File

@ -16,6 +16,11 @@ use Cadoles\CoreBundle\Entity\Niveau02;
use Cadoles\CoreBundle\Entity\User;
use Cadoles\CoreBundle\Entity\Group;
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 $config;
@ -28,6 +33,8 @@ class SynchroCommand extends Command
private $output;
private $filesystem;
private $rootlog;
private $ldap;
private $ldap_basedn;
protected function configure()
{
@ -76,8 +83,9 @@ class SynchroCommand extends Command
$this->writeln('== SYNCHONISATION ANNUAIRE ==========================');
$this->writeln('=====================================================');
$ldap = $this->container->get('cadoles.core.service.ldap');
if(!$ldap->isEnabled()) {
$this->ldap = $this->container->get('cadoles.core.service.ldap');
if(!$this->ldap->isEnabled()) {
if($masteridentity =="LDAP") {
$this->writeln('');
$this->writeln('=====================================================');
@ -85,7 +93,7 @@ class SynchroCommand extends Command
$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_username = $this->container->getParameter('ldap_username');
$ldap_firstname = $this->container->getParameter('ldap_firstname');
@ -126,7 +134,7 @@ class SynchroCommand extends Command
$this->writeln('');
$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) {
$cn=$result["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
$this->writeln("== Récupération des utilisateurs de l'annuaire");
$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);
// Pour chaque utilisateur ldap
@ -247,7 +255,8 @@ class SynchroCommand extends Command
$this->writeln('== '.$group->getLabel());
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) {
if(isset($result["memberuid"])) {
// Si memberid est un tableau il y a plusieur user dedans
@ -333,7 +342,7 @@ class SynchroCommand extends Command
}
else {
//on peut unset les recherches suivantes seront plus rapide
unset($flipped[$user->getUsername()]);
unset($flipped[$data["username"]]);
}
$this->em->clear();
@ -360,17 +369,17 @@ class SynchroCommand extends Command
foreach($datas as $data) {
$criteria = '(cn='.$data->getLabel().')';
$subbranch=$baseNiveau01;
$results = $ldap->search($criteria, array('cn'), $subbranch);
$results = $this->ldap->search($criteria, array('cn'), $subbranch);
// Mise à jour si elle existe
if(count($results) > 0) {
$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
else {
$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) {
$criteria = '(cn='.$data->getLabel().')';
$subbranch=$baseNiveau02;
$results = $ldap->search($criteria, array('cn'), $subbranch);
$results = $this->ldap->search($criteria, array('cn'), $subbranch);
// Mise à jour si elle existe
if(count($results) > 0) {
$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
else {
$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) {
$criteria = '(cn='.$data->getLabel().')';
$subbranch=$baseGroup;
$results = $ldap->search($criteria, array('cn'), $subbranch);
$results = $this->ldap->search($criteria, array('cn'), $subbranch);
// Mise à jour si elle existe
if(count($results) > 0) {
$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
else {
$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) {
$criteria = '(uid='.$data->getUsername().')';
$subbranch=$baseUser;
$results = $ldap->search($criteria, array('uid'), $subbranch);
$results = $this->ldap->search($criteria, array('uid'), $subbranch);
// S'assurer que SIREN correspond au Niveau01
if($data->getNiveau01()->getSiren()!=$data->getSiren()) {
@ -458,16 +467,16 @@ class SynchroCommand extends Command
// Mise à jour si elle existe
if(count($results) > 0) {
$this->writeln(' - Modification dans annuaire >> '.$data->getUsername());
if(!$simulate) $ldap->modifyUser($data);
if(!$simulate) $this->ldap->modifyUser($data);
}
// Sinon création de la fiche
else {
$this->writeln(' - Création dans annuaire >> '.$data->getUsername());
if(!$simulate) $ldap->addUser($data);
if(!$simulate) $this->ldap->addUser($data);
}
// Rattachement à Niveau01 et Niveau02
if(!$simulate) $ldap->addGroupUser($data);
if(!$simulate) $this->ldap->addGroupUser($data);
}
$this->writeln('');
@ -483,21 +492,21 @@ class SynchroCommand extends Command
foreach($datas as $data) {
$criteria = '(cn='.$data->getLabel().')';
$subbranch=$baseniveau01;
$results = $ldap->search($criteria, array('cn'), $subbranch);
$results = $this->ldap->search($criteria, array('cn'), $subbranch);
// Mise à jour des membres du groupes
if(count($results) > 0) {
$this->writeln(' - '.$data->getLabel());
$dn=$ldap->getNiveau01DN($data->getLabel());
$dn=$this->ldap->getNiveau01DN($data->getLabel());
$attrs["memberuid"]=array();
$attrs["cadolesMember"]=array();
foreach($data->getUsers() as $userniveau01) {
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());
}
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) {
$criteria = '(cn='.$data->getLabel().')';
$subbranch=$baseniveau02;
$results = $ldap->search($criteria, array('cn'), $subbranch);
$results = $this->ldap->search($criteria, array('cn'), $subbranch);
// Mise à jour des membres du groupes
if(count($results) > 0) {
$this->writeln(' - '.$data->getLabel());
$dn=$ldap->getNiveau02DN($data->getLabel());
$dn=$this->ldap->getNiveau02DN($data->getLabel());
$attrs["memberuid"]=array();
$attrs["cadolesMember"]=array();
foreach($data->getUsers() as $userniveau01) {
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());
}
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) {
$criteria = '(cn='.$data->getLabel().')';
$subbranch=$baseGroup;
$results = $ldap->search($criteria, array('cn'), $subbranch);
$results = $this->ldap->search($criteria, array('cn'), $subbranch);
// Mise à jour des membres du groupes
if(count($results) > 0) {
$this->writeln(' - '.$data->getLabel());
$dn=$ldap->getGroupDN($data->getLabel());
$dn=$this->ldap->getGroupDN($data->getLabel());
$attrs["memberuid"]=array();
$attrs["cadolesMember"]=array();
foreach($data->getUsers() as $usergroupe) {
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());
}
if(!$simulate) $ldap->ldapModify($dn, $attrs);
if(!$simulate) $this->ldap->ldapModify($dn, $attrs);
}
}
@ -576,14 +585,14 @@ class SynchroCommand extends Command
$criteria = '(cn=*)';
$subbranch=$baseNiveau01;
$results = $ldap->search($criteria, array('cn'), $subbranch);
$results = $this->ldap->search($criteria, array('cn'), $subbranch);
foreach($results as $result) {
$data = $this->em->getRepository('CadolesCoreBundle:Niveau01')->findBy(array('label' => $result["cn"]));
if($data) $this->writeln(' - Existe dans bundle >> '.$result["cn"]);
else {
$this->writeln(' - A supprimer dans annuaire >> '.$result["cn"]);
$dn=$ldap->getNiveau01DN($result["cn"]);
if(!$simulate) $ldap->deleteByDN($dn);
$dn=$this->ldap->getNiveau01DN($result["cn"]);
if(!$simulate) $this->ldap->deleteByDN($dn);
}
}
@ -593,14 +602,14 @@ class SynchroCommand extends Command
$criteria = '(cn=*)';
$subbranch=$baseNiveau02;
$results = $ldap->search($criteria, array('cn'), $subbranch);
$results = $this->ldap->search($criteria, array('cn'), $subbranch);
foreach($results as $result) {
$data = $this->em->getRepository('CadolesCoreBundle:Niveau02')->findBy(array('label' => $result["cn"]));
if($data) $this->writeln(' - Existe dans bundle >> '.$result["cn"]);
else {
$this->writeln(' - A supprimer dans annuaire >> '.$result["cn"]);
$dn=$ldap->getNiveau02DN($result["cn"]);
if(!$simulate) $ldap->deleteByDN($dn);
$dn=$this->ldap->getNiveau02DN($result["cn"]);
if(!$simulate) $this->ldap->deleteByDN($dn);
}
}
@ -611,14 +620,14 @@ class SynchroCommand extends Command
$criteria = '(cn=*)';
$subbranch=$baseGroup;
$results = $ldap->search($criteria, array('cn'), $subbranch);
$results = $this->search($criteria, array('cn'), $subbranch);
foreach($results as $result) {
$data = $this->em->getRepository('CadolesCoreBundle:Group')->findBy(array('label' => $result["cn"]));
if($data) $this->writeln(' - Existe dans bundle >> '.$result["cn"]);
else {
$this->writeln(' - A supprimer dans annuaire >> '.$result["cn"]);
$dn=$ldap->getGroupDN($result["cn"]);
if(!$simulate) $ldap->deleteByDN($dn);
$dn=$this->ldap->getGroupDN($result["cn"]);
if(!$simulate) $this->ldap->deleteByDN($dn);
}
}
@ -628,14 +637,14 @@ class SynchroCommand extends Command
$criteria = '(uid=*)';
$subbranch=$baseUser;
$results = $ldap->search($criteria, array('uid'), $subbranch);
$results = $this->ldap->search($criteria, array('uid'), $subbranch);
foreach($results as $result) {
$data = $this->em->getRepository('CadolesCoreBundle:User')->findBy(array('username' => $result["uid"]));
if($data) $this->writeln(' - Existe dans bundle >> '.$result["uid"]);
else {
$this->writeln(' - A supprimer dans annuaire >> '.$result["uid"]);
$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) {
$portal_activate = $this->container->getParameter('portal_activate');
$group=$this->em->getRepository('CadolesCoreBundle:Group')->findOneBy(array('fgtemplate' => true, 'label' => $label));
if(!$group) {
$group=new Group();
$group->setFgcanshare($fgcanshare);
$group->setFgcancreatepage(true);
$group->setFgcancreateblog(true);
$group->setFgcancreatecalendar(true);
$group->setFgcancreatepage(false);
$group->setFgcancreateblog(false);
$group->setFgcancreatecalendar(false);
}
$group->setLabel($label);
@ -670,8 +679,52 @@ class SynchroCommand extends Command
$group->setLdapfilter($ldapfilter);
$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->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) {
@ -680,11 +733,19 @@ class SynchroCommand extends Command
$member= new UserGroup();
$member->setGroup($group);
$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->flush();
}
}
protected function addUser($niveau01,$username,$firstname,$lastname,$email,$usersadmin) {
$user = new User();
@ -702,9 +763,18 @@ class SynchroCommand extends Command
if(in_array($username,$usersadmin))
$user->setRole("ROLE_ADMIN");
else
else {
$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->flush();
}

View File

@ -5,11 +5,10 @@ SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
INSERT IGNORE INTO `niveau01` (`id`, `label`, `siren`) VALUES
(-100, 'DRAAF', '130007107');
(-100, 'scribe26', '0000000A');
INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES
(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}eyoxoh9yJzJyNAacnf9gxyZbtRWITzXF
', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple');
(-100, -100, 'admin', 'Administrateur', 'scribe26', 'PWD_CAS', 'admin@scribe26.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '0000000A', 'simple');
@ -25,7 +24,6 @@ INSERT IGNORE INTO `sidebar` (`id`, `parent_id`, `roworder`, `label`, `path`, `f
(1200, NULL, 1200, 'ORGANISATION', NULL, 'fa-sitemap', 'ROLE_ADMIN,ROLE_MODO', ''),
(1210, 1200, 1210, 'Listes Blanche', 'cadoles_core_config_whitelist', 'fa-tasks', 'ROLE_ADMIN,ROLE_MODO', ''),
(1220, 1200, 1220, 'Niveau 01', 'cadoles_core_config_niveau01', 'fa-building', 'ROLE_ADMIN,ROLE_MODO', ''),
(1230, 1200, 1230, 'Niveau 02', 'cadoles_core_config_niveau02', 'fa-sitemap', 'ROLE_ADMIN,ROLE_MODO', ''),
(1240, 1200, 1240, 'Groupes', 'cadoles_core_config_group', 'fa-users', 'ROLE_ADMIN,ROLE_MODO', ''),
(1250, 1200, 1250, 'Inscriptions', 'cadoles_core_config_registration', 'fa-pencil-square-o', 'ROLE_ADMIN,ROLE_MODO', ''),
(1260, 1200, 1260, 'Utilisateurs', 'cadoles_core_config_user', 'fa-child', 'ROLE_ADMIN,ROLE_MODO', ''),

View File

@ -298,10 +298,7 @@ class UserController extends Controller
$data->setVisible(true);
$data->setBelongingpopulation("authlevel");
$data->setAuthlevel("simple");
$config=$em->getRepository('CadolesCoreBundle:Config')->find("datauser");
$fields=$config->getValue();
$fields=json_decode($fields,true);
$fields=$this->getDefaultDatauser();
// Création du formulaire
$form = $this->createForm(UserType::class,$data,array(
@ -410,9 +407,7 @@ class UserController extends Controller
// Récupération de l'enregistrement courant
$data=$this->getData($id);
$oldpassword=$data->getPassword();
$config=$em->getRepository('CadolesCoreBundle:Config')->find("datauser");
$fields=$config->getValue();
$fields=json_decode($fields,true);
$fields=$this->getDefaultDatauser();
// 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") {
@ -625,9 +620,7 @@ class UserController extends Controller
// Récupération de l'enregistrement courant
$data=$this->getData($id);
$config=$em->getRepository('CadolesCoreBundle:Config')->find("datauser");
$fields=$config->getValue();
$fields=json_decode($fields,true);
$fields=$this->getDefaultDatauser();
// 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") {
@ -987,6 +980,64 @@ class UserController extends Controller
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) {
if ($form->get('submit')->isClicked()&&$mode=="delete") {
}

View File

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

View File

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

View File

@ -23,6 +23,7 @@
{% set colorbodyfont = color['fontcolorhover'] %}
{% 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">
{% if canupdate %}
<div class="widgetmenu">
@ -46,8 +47,10 @@
<span class="title">{{ entity.name }}</span>
</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})) }}
{% 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>
-->
@ -56,7 +59,4 @@
{% endif %}
</div>
<script>
</script>
{%endif%}

View File

@ -9,7 +9,7 @@
{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %}
{% set stylewidgetheader = constants.mystylewidgetheader(entity) %}
{% set stylewidgetbody = constants.mystylewidgetbody(entity) %}
{% set stylewidgetbodyreverse = constants.mystylewidgetbodyreverse(entity) %}
{% set color = app.session.get('color') %}
@ -95,7 +95,7 @@
{% endfor %}
{% if canadd %}
<div class="grid-item grid-small">
<div class="grid-item grid-small" 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':'all'}) }}');" title='Ajouter des fichiers'>
<div class="item-link clearfix">
@ -104,7 +104,7 @@
</div>
<div class="grid-item-title">
<h2 style="{{ stylewidgetbody }}">Ajouter un fichier</h2>
<h2 style="{{ stylewidgetbodyreverse }}">Ajouter un fichier</h2>
</div>
</div>
</a>

View File

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

View File

@ -33,7 +33,7 @@
{% if onheader %}
<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>
{% else %}
<div class="widgetheader" style="{{ stylewidgetheader }}">
@ -46,7 +46,7 @@
</div>
<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>
{% endif %}
</div>

View File

@ -9,7 +9,7 @@
{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %}
{% set stylewidgetheader = constants.mystylewidgetheader(entity) %}
{% set stylewidgetbody = constants.mystylewidgetbody(entity) %}
{% set stylewidgetbodyreverse = constants.mystylewidgetbodyreverse(entity) %}
{% set color = app.session.get('color') %}
@ -48,11 +48,16 @@
<span class="title">{{ entity.name }}</span>
</div>
{% if files|length>0 %}
{% if files|length>0 or canupdate %}
<div class="widgetbody" style="{{ stylewidgetbody }}">
<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 %}
{% if loop.index==1 %}
{% if loop.index==1 and not canupdate %}
<div class="grid-sizer grid-image"></div>
<div class="grid-gutter-sizer grid-gutter-sizer-image"></div>
{% endif %}
@ -74,6 +79,24 @@
</div>
</div>
{% 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>
{% endif %}

View File

@ -55,24 +55,9 @@
<span class="title">{{ entity.name }}</span>
</div>
{% set firstflux="" %}
{% if messages is not empty %}
<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-sizer {{stylegrid}}"></div>
<div class="grid-gutter-sizer {{stylegrid}}-gutter-sizer"></div>
@ -107,6 +92,7 @@
{% endfor %}
</div>
</div>
{% endif %}
</div>

View File

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

View File

@ -46,7 +46,7 @@
</div>
<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>
{% endif %}
</div>

View File

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

View File

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