suppression du = dans les noms de groupe scribe
This commit is contained in:
parent
8dec77a946
commit
4a941665dc
|
@ -119,6 +119,19 @@ class ScriptCommand extends Command
|
||||||
$this->writeln("");
|
$this->writeln("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"renamegroup"]);
|
||||||
|
if(!$script) {
|
||||||
|
$this->writelnred("== SCRIPT = renamegroup");
|
||||||
|
$this->renamegroup();
|
||||||
|
|
||||||
|
$script=new Script();
|
||||||
|
$script->setName("renamegroup");
|
||||||
|
$this->em->persist($script);
|
||||||
|
$this->em->flush();
|
||||||
|
$this->writeln("");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,6 +241,53 @@ class ScriptCommand extends Command
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function renamegroup(){
|
||||||
|
|
||||||
|
$groups = $this->em->getRepository('CadolesCoreBundle:Group')->findAll();
|
||||||
|
foreach($groups as $group) {
|
||||||
|
// Si présence d'un = dans le label
|
||||||
|
if(stripos($group->getLabel(),"=")!==false) {
|
||||||
|
$newname=str_replace("=","-",$group->getLabel());
|
||||||
|
|
||||||
|
$this->writeln("Renommer groupe = ".$group->getLabel());
|
||||||
|
|
||||||
|
// Renommer les pages
|
||||||
|
$pages = $this->em->getRepository('CadolesPortalBundle:Page')->findBy(["name"=>$group->getLabel()]);
|
||||||
|
foreach($pages as $page) {
|
||||||
|
$page->setName($newname);
|
||||||
|
$this->em->persist($page);
|
||||||
|
$this->em->flush();
|
||||||
|
}
|
||||||
|
// Renommer calendrier
|
||||||
|
$calendars = $this->em->getRepository('CadolesPortalBundle:Calendar')->findBy(["name"=>$group->getLabel()]);
|
||||||
|
foreach($calendars as $calendar) {
|
||||||
|
$calendar->setName($newname);
|
||||||
|
$this->em->persist($calendar);
|
||||||
|
$this->em->flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Renommer blog
|
||||||
|
$blogs = $this->em->getRepository('CadolesPortalBundle:Blog')->findBy(["name"=>$group->getLabel()]);
|
||||||
|
foreach($blogs as $blog) {
|
||||||
|
$blog->setName($newname);
|
||||||
|
$this->em->persist($blog);
|
||||||
|
$this->em->flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Renommer projet
|
||||||
|
$projects = $this->em->getRepository('CadolesPortalBundle:Project')->findBy(["name"=>$group->getLabel()]);
|
||||||
|
foreach($projects as $project) {
|
||||||
|
$project->setName($newname);
|
||||||
|
$this->em->persist($project);
|
||||||
|
$this->em->flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
$group->setLabel($newname);
|
||||||
|
$this->em->persist($group);
|
||||||
|
$this->em->flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -111,25 +111,25 @@ class SynchroCommand extends Command
|
||||||
|
|
||||||
// Eleves
|
// Eleves
|
||||||
$ldapfilter="(&(uid=*)(ENTPersonProfils=eleve))";
|
$ldapfilter="(&(uid=*)(ENTPersonProfils=eleve))";
|
||||||
$label="PROFIL = Elèves";
|
$label="PROFIL - Elèves";
|
||||||
$this->writeln(" - $label");
|
$this->writeln(" - $label");
|
||||||
if(!$simulate) $this->addmodGroup($label,$ldapfilter,false);
|
if(!$simulate) $this->addmodGroup($label,$ldapfilter,false);
|
||||||
|
|
||||||
// Enseignants
|
// Enseignants
|
||||||
$ldapfilter="(|(&(uid=*)(ENTPersonProfils=enseignant))(&(uid=*)(typeadmin=0))(&(uid=*)(typeadmin=2)))";
|
$ldapfilter="(|(&(uid=*)(ENTPersonProfils=enseignant))(&(uid=*)(typeadmin=0))(&(uid=*)(typeadmin=2)))";
|
||||||
$label="PROFIL = Enseignants";
|
$label="PROFIL - Enseignants";
|
||||||
$this->writeln(" - $label");
|
$this->writeln(" - $label");
|
||||||
if(!$simulate) $this->addmodGroup($label,$ldapfilter,true);
|
if(!$simulate) $this->addmodGroup($label,$ldapfilter,true);
|
||||||
|
|
||||||
// Responsables
|
// Responsables
|
||||||
$ldapfilter="(&(uid=*)(ENTPersonProfils=responsable))";
|
$ldapfilter="(&(uid=*)(ENTPersonProfils=responsable))";
|
||||||
$label="PROFIL = Responsables";
|
$label="PROFIL - Responsables";
|
||||||
$this->writeln(" - $label");
|
$this->writeln(" - $label");
|
||||||
if(!$simulate) $this->addmodGroup($label,$ldapfilter,false);
|
if(!$simulate) $this->addmodGroup($label,$ldapfilter,false);
|
||||||
|
|
||||||
// Administratifs
|
// Administratifs
|
||||||
$ldapfilter="(&(uid=*)(ENTPersonProfils=administratif))";
|
$ldapfilter="(&(uid=*)(ENTPersonProfils=administratif))";
|
||||||
$label="PROFIL = Administratifs";
|
$label="PROFIL - Administratifs";
|
||||||
$this->writeln(" - $label");
|
$this->writeln(" - $label");
|
||||||
if(!$simulate) $this->addmodGroup($label,$ldapfilter,true);
|
if(!$simulate) $this->addmodGroup($label,$ldapfilter,true);
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ class SynchroCommand extends Command
|
||||||
$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)))";
|
||||||
|
|
||||||
$label="CLASSE = ".$result["cn"];
|
$label="CLASSE - ".$result["cn"];
|
||||||
$this->writeln(" - $label");
|
$this->writeln(" - $label");
|
||||||
if(!$simulate) $this->addmodGroup($label,$ldapfilter,true);
|
if(!$simulate) $this->addmodGroup($label,$ldapfilter,true);
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ class SynchroCommand extends Command
|
||||||
$cn=$result["cn"];
|
$cn=$result["cn"];
|
||||||
$ldapfilter="(|(&(type=Option)(cn=$cn))(&(type=Equipe)(cn=profs-$cn))(&(ENTPersonProfils=Administratif)(divcod=$cn)))";
|
$ldapfilter="(|(&(type=Option)(cn=$cn))(&(type=Equipe)(cn=profs-$cn))(&(ENTPersonProfils=Administratif)(divcod=$cn)))";
|
||||||
|
|
||||||
$label="OPTION = ".$result["cn"];
|
$label="OPTION - ".$result["cn"];
|
||||||
$this->writeln(" - $label");
|
$this->writeln(" - $label");
|
||||||
if(!$simulate) $this->addmodGroup($label,$ldapfilter,true);
|
if(!$simulate) $this->addmodGroup($label,$ldapfilter,true);
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ class SynchroCommand extends Command
|
||||||
$cn=$result["cn"];
|
$cn=$result["cn"];
|
||||||
$ldapfilter="(&(type=Groupe)(cn=$cn))";
|
$ldapfilter="(&(type=Groupe)(cn=$cn))";
|
||||||
|
|
||||||
$label="GROUPE = ".$result["cn"];
|
$label="GROUPE - ".$result["cn"];
|
||||||
$this->writeln(" - $label");
|
$this->writeln(" - $label");
|
||||||
if(!$simulate) $this->addmodGroup($label,$ldapfilter,true);
|
if(!$simulate) $this->addmodGroup($label,$ldapfilter,true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue