personnalisation par niveau01 (ref #162)
This commit is contained in:
parent
7444af740e
commit
92a0d91a1d
@ -194,8 +194,9 @@ class PurgeFileCommand extends Command
|
||||
foreach (iterator_to_array($finder) as $file) {
|
||||
$name = $file->getRelativePathname();
|
||||
if($name!="logo.png") {
|
||||
$entity=$this->em->getRepository("CadolesCoreBundle:Niveau01")->findBy(["logo"=>"uploads/niveau01/".$name]);
|
||||
if(!$entity) {
|
||||
$logo=$this->em->getRepository("CadolesCoreBundle:Niveau01")->findBy(["logo"=>"uploads/niveau01/".$name]);
|
||||
$header=$this->em->getRepository("CadolesCoreBundle:Niveau01")->findBy(["header"=>"uploads/niveau01/".$name]);
|
||||
if(!$logo&&!$header) {
|
||||
$this->writeln($name);
|
||||
$url=$directory."/".$name;
|
||||
if($fs->exists($url)) {
|
||||
|
@ -43,20 +43,35 @@ class Niveau01Controller extends Controller
|
||||
$draw= $request->query->get('draw');
|
||||
$order= $request->query->get('order');
|
||||
|
||||
// Modo ?
|
||||
$ismodo=false;
|
||||
if($this->getUser()->getRole()=="ROLE_MODO") {
|
||||
$ismodo=true;
|
||||
}
|
||||
|
||||
// Nombre total d'enregistrement
|
||||
$total = $em->createQueryBuilder()->select('COUNT(table)')->from($this->labelentity,'table')->getQuery()->getSingleScalarResult();
|
||||
if($ismodo)
|
||||
$total = $em->createQueryBuilder()->select('COUNT(table)')->from("CadolesCoreBundle:UserModo",'table')->where("table.user = :user")->setParameter("user", $this->getUser())->getQuery()->getSingleScalarResult();
|
||||
else
|
||||
$total = $em->createQueryBuilder()->select('COUNT(table)')->from($this->labelentity,'table')->getQuery()->getSingleScalarResult();
|
||||
|
||||
// Nombre d'enregistrement filtré
|
||||
if($search["value"]=="")
|
||||
$totalf = $total;
|
||||
else {
|
||||
$totalf= $em->createQueryBuilder()
|
||||
$qb = $em->createQueryBuilder()
|
||||
->select('COUNT(table)')
|
||||
->from($this->labelentity,'table')
|
||||
->where('table.label LIKE :value')
|
||||
->setParameter("value", "%".$search["value"]."%")
|
||||
->getQuery()
|
||||
->getSingleScalarResult();
|
||||
->setParameter("value", "%".$search["value"]."%");
|
||||
if($ismodo)
|
||||
$qb ->from("CadolesCoreBundle:UserModo","usermodo")
|
||||
->andwhere("usermodo.user = :user")
|
||||
->andWhere("usermodo.niveau01=table")
|
||||
->setParameter("user", $this->getUser());
|
||||
|
||||
|
||||
$totalf = $qb->getQuery()->getSingleScalarResult();
|
||||
}
|
||||
|
||||
// Construction du tableau de retour
|
||||
@ -70,8 +85,15 @@ class Niveau01Controller extends Controller
|
||||
// Parcours des Enregistrement
|
||||
$qb = $em->createQueryBuilder();
|
||||
$qb->select('table')->from($this->labelentity,'table');
|
||||
if($ismodo) {
|
||||
$qb->from("CadolesCoreBundle:UserModo","usermodo")
|
||||
->where("usermodo.user = :user")
|
||||
->andWhere("usermodo.niveau01=table")
|
||||
->setParameter("user", $this->getUser());
|
||||
}
|
||||
|
||||
if($search["value"]!="") {
|
||||
$qb ->where('table.label LIKE :value')
|
||||
$qb ->andwhere('table.label LIKE :value')
|
||||
->setParameter("value", "%".$search["value"]."%");
|
||||
}
|
||||
switch($order[0]["column"]) {
|
||||
@ -84,7 +106,7 @@ class Niveau01Controller extends Controller
|
||||
|
||||
foreach($datas as $data) {
|
||||
$action ="<a href='".$this->generateUrl('cadoles_core_config_niveau01_update', array('id'=>$data->getId()))."'><i class='fa fa-file fa-fw'></i></a>";
|
||||
if($data->getId()>0) $action.="<a href='".$this->generateUrl('cadoles_core_config_niveau01_delete', array('id'=>$data->getId()))."'><i class='fa fa-trash fa-fw'></i></a>";
|
||||
if($data->getId()>0&&!$ismodo) $action.="<a href='".$this->generateUrl('cadoles_core_config_niveau01_delete', array('id'=>$data->getId()))."'><i class='fa fa-trash fa-fw'></i></a>";
|
||||
array_push($output["data"],array($action,$data->getLabel()));
|
||||
}
|
||||
|
||||
@ -97,6 +119,10 @@ class Niveau01Controller extends Controller
|
||||
// Initialisation de l'enregistrement
|
||||
$data = new Niveau01();
|
||||
|
||||
// Interdit pour les modos
|
||||
if($this->getUser()->getRole()=="ROLE_MODO")
|
||||
throw $this->createNotFoundException('Permission denied');
|
||||
|
||||
// Création du formulaire
|
||||
$form = $this->createForm(Niveau01Type::class,$data,array(
|
||||
"mode" => "submit",
|
||||
@ -136,10 +162,16 @@ class Niveau01Controller extends Controller
|
||||
|
||||
public function updateAction($id,Request $request)
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
// Récupération de l'enregistrement courant
|
||||
$data=$this->getData($id);
|
||||
|
||||
// Vérifier que cet enregistrement est modifiable
|
||||
// Modification modo que si niveau modéré
|
||||
if($this->getUser()->getRole()=="ROLE_MODO") {
|
||||
$usermodo=$em->getRepository("CadolesCoreBundle:UserModo")->findOneBy(["user"=>$this->getUser(),"niveau01"=>$data]);
|
||||
if(!$usermodo) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
// Création du formulaire
|
||||
$form = $this->createForm(Niveau01Type::class,$data,array(
|
||||
@ -156,7 +188,6 @@ class Niveau01Controller extends Controller
|
||||
|
||||
// Sur validation
|
||||
if ($form->get('submit')->isClicked() && $form->isValid()) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$data = $form->getData();
|
||||
|
||||
// Sauvegarde
|
||||
@ -184,7 +215,9 @@ class Niveau01Controller extends Controller
|
||||
// Récupération de l'enregistrement courant
|
||||
$data=$this->getData($id);
|
||||
|
||||
// Vérifier que cet enregistrement est supprimable
|
||||
// Interdit pour les modos
|
||||
if($this->getUser()->getRole()=="ROLE_MODO")
|
||||
throw $this->createNotFoundException('Permission denied');
|
||||
|
||||
// Création du formulaire
|
||||
$form = $this->createForm(Niveau01Type::class,$data,array(
|
||||
@ -228,6 +261,15 @@ class Niveau01Controller extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
public function headerAction()
|
||||
{
|
||||
return $this->render('CadolesCoreBundle:Niveau01:header.html.twig',[
|
||||
'useheader' => false,
|
||||
'usemenu' => false,
|
||||
'usesidebar' => false,
|
||||
]);
|
||||
}
|
||||
|
||||
protected function getDatas()
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
@ -43,22 +43,45 @@ class Niveau02Controller extends Controller
|
||||
$draw= $request->query->get('draw');
|
||||
$order= $request->query->get('order');
|
||||
|
||||
// Modo ?
|
||||
$ismodo=false;
|
||||
if($this->getUser()->getRole()=="ROLE_MODO") {
|
||||
$ismodo=true;
|
||||
}
|
||||
|
||||
|
||||
// Nombre total d'enregistrement
|
||||
$total = $em->createQueryBuilder()->select('COUNT(table)')->from($this->labelentity,'table')->getQuery()->getSingleScalarResult();
|
||||
if($ismodo) {
|
||||
$total = $em->createQueryBuilder()->select('COUNT(table)')
|
||||
->from($this->labelentity,'table')
|
||||
->from("CadolesCoreBundle:UserModo","usermodo")
|
||||
->Where("table.niveau01=usermodo.niveau01")
|
||||
->andWhere("usermodo.user=:user")
|
||||
->setParameter("user",$this->getUser())
|
||||
->getQuery()->getSingleScalarResult();
|
||||
}
|
||||
else
|
||||
$total = $em->createQueryBuilder()->select('COUNT(table)')->from($this->labelentity,'table')->getQuery()->getSingleScalarResult();
|
||||
|
||||
// Nombre d'enregistrement filtré
|
||||
if($search["value"]=="")
|
||||
$totalf = $total;
|
||||
else {
|
||||
$totalf= $em->createQueryBuilder()
|
||||
$qb = $em ->createQueryBuilder()
|
||||
->select('COUNT(table)')
|
||||
->from($this->labelentity,'table')
|
||||
->from("CadolesCoreBundle:Niveau01",'nv1')
|
||||
->where('table.niveau01=nv1.id')
|
||||
->andwhere('table.label LIKE :value or nv1.label LIKE :value')
|
||||
->setParameter("value", "%".$search["value"]."%")
|
||||
->getQuery()
|
||||
->getSingleScalarResult();
|
||||
->setParameter("value", "%".$search["value"]."%");
|
||||
if($ismodo) {
|
||||
$qb ->from("CadolesCoreBundle:UserModo","usermodo")
|
||||
->andwhere("table.niveau01=usermodo.niveau01")
|
||||
->andWhere("usermodo.user=:user")
|
||||
->setParameter("user",$this->getUser());
|
||||
}
|
||||
|
||||
$totalf = $qb->getQuery()->getSingleScalarResult();
|
||||
}
|
||||
|
||||
// Construction du tableau de retour
|
||||
@ -79,6 +102,13 @@ class Niveau02Controller extends Controller
|
||||
$qb ->andwhere('table.label LIKE :value or nv1.label LIKE :value')
|
||||
->setParameter("value", "%".$search["value"]."%");
|
||||
}
|
||||
if($ismodo) {
|
||||
$qb->from("CadolesCoreBundle:UserModo","usermodo")
|
||||
->andWhere("table.niveau01=usermodo.niveau01")
|
||||
->andWhere("usermodo.user=:user")
|
||||
->setParameter("user",$this->getUser());
|
||||
}
|
||||
|
||||
switch($order[0]["column"]) {
|
||||
case 1 :
|
||||
$qb->orderBy('nv1.label',$order[0]["dir"]);
|
||||
@ -107,7 +137,7 @@ class Niveau02Controller extends Controller
|
||||
$data = new Niveau02();
|
||||
|
||||
// Création du formulaire
|
||||
$form = $this->createForm(Niveau02Type::class,$data,array("mode"=>"submit"));
|
||||
$form = $this->createForm(Niveau02Type::class,$data,array("mode"=>"submit","user"=>$this->getUser()));
|
||||
|
||||
// Récupération des data du formulaire
|
||||
$form->handleRequest($request);
|
||||
@ -141,13 +171,19 @@ class Niveau02Controller extends Controller
|
||||
|
||||
public function updateAction($id,Request $request)
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
// Récupération de l'enregistrement courant
|
||||
$data=$this->getData($id);
|
||||
|
||||
// Vérifier que cet enregistrement est modifiable
|
||||
// Suppression modo que si niveau modéré
|
||||
if($this->getUser()->getRole()=="ROLE_MODO") {
|
||||
$usermodo=$em->getRepository("CadolesCoreBundle:UserModo")->findOneBy(["user"=>$this->getUser(),"niveau01"=>$data->getNiveau01()]);
|
||||
if(!$usermodo) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
// Création du formulaire
|
||||
$form = $this->createForm(Niveau02Type::class,$data,array("mode"=>"update"));
|
||||
$form = $this->createForm(Niveau02Type::class,$data,array("mode"=>"update","user"=>$this->getUser()));
|
||||
|
||||
// Récupération des data du formulaire
|
||||
$form->handleRequest($request);
|
||||
@ -157,7 +193,6 @@ class Niveau02Controller extends Controller
|
||||
|
||||
// Sur validation
|
||||
if ($form->get('submit')->isClicked() && $form->isValid()) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$data = $form->getData();
|
||||
|
||||
// Sauvegarde
|
||||
@ -182,13 +217,19 @@ class Niveau02Controller extends Controller
|
||||
|
||||
public function deleteAction($id,Request $request)
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
// Récupération de l'enregistrement courant
|
||||
$data=$this->getData($id);
|
||||
|
||||
// Vérifier que cet enregistrement est supprimable
|
||||
// Suppression modo que si niveau modéré
|
||||
if($this->getUser()->getRole()=="ROLE_MODO") {
|
||||
$usermodo=$em->getRepository("CadolesCoreBundle:UserModo")->findOneBy(["user"=>$this->getUser(),"niveau01"=>$data->getNiveau01()]);
|
||||
if(!$usermodo) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
// Création du formulaire
|
||||
$form = $this->createForm(Niveau02Type::class,$data,array("mode"=>"delete"));
|
||||
$form = $this->createForm(Niveau02Type::class,$data,array("mode"=>"delete","user"=>$this->getUser()));
|
||||
|
||||
// Récupération des data du formulaire
|
||||
$form->handleRequest($request);
|
||||
@ -198,7 +239,6 @@ class Niveau02Controller extends Controller
|
||||
|
||||
// Sur validation
|
||||
if ($form->get('submit')->isClicked() && $form->isValid()) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$em->remove($data);
|
||||
$em->flush();
|
||||
|
||||
|
@ -44,6 +44,36 @@ class Niveau01
|
||||
*/
|
||||
private $logo;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
*/
|
||||
private $header;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
*/
|
||||
private $colormain;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
*/
|
||||
private $fontcolorhover;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
*/
|
||||
private $colorbody;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
*/
|
||||
private $fontfacetitle;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
*/
|
||||
private $fontfacebody;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
*/
|
||||
@ -465,4 +495,148 @@ class Niveau01
|
||||
{
|
||||
return $this->alerts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set header
|
||||
*
|
||||
* @param string $header
|
||||
*
|
||||
* @return Niveau01
|
||||
*/
|
||||
public function setHeader($header)
|
||||
{
|
||||
$this->header = $header;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get header
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHeader()
|
||||
{
|
||||
return $this->header;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set colormain
|
||||
*
|
||||
* @param string $colormain
|
||||
*
|
||||
* @return Niveau01
|
||||
*/
|
||||
public function setColormain($colormain)
|
||||
{
|
||||
$this->colormain = $colormain;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get colormain
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getColormain()
|
||||
{
|
||||
return $this->colormain;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set fontcolorhover
|
||||
*
|
||||
* @param string $fontcolorhover
|
||||
*
|
||||
* @return Niveau01
|
||||
*/
|
||||
public function setFontcolorhover($fontcolorhover)
|
||||
{
|
||||
$this->fontcolorhover = $fontcolorhover;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fontcolorhover
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFontcolorhover()
|
||||
{
|
||||
return $this->fontcolorhover;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set colorbody
|
||||
*
|
||||
* @param string $colorbody
|
||||
*
|
||||
* @return Niveau01
|
||||
*/
|
||||
public function setColorbody($colorbody)
|
||||
{
|
||||
$this->colorbody = $colorbody;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get colorbody
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getColorbody()
|
||||
{
|
||||
return $this->colorbody;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set fontfacetitle
|
||||
*
|
||||
* @param string $fontfacetitle
|
||||
*
|
||||
* @return Niveau01
|
||||
*/
|
||||
public function setFontfacetitle($fontfacetitle)
|
||||
{
|
||||
$this->fontfacetitle = $fontfacetitle;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fontfacetitle
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFontfacetitle()
|
||||
{
|
||||
return $this->fontfacetitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set fontfacebody
|
||||
*
|
||||
* @param string $fontfacebody
|
||||
*
|
||||
* @return Niveau01
|
||||
*/
|
||||
public function setFontfacebody($fontfacebody)
|
||||
{
|
||||
$this->fontfacebody = $fontfacebody;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fontfacebody
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFontfacebody()
|
||||
{
|
||||
return $this->fontfacebody;
|
||||
}
|
||||
}
|
||||
|
@ -283,6 +283,25 @@
|
||||
if(!is_null($niveau01->getLogo()))
|
||||
$session->set("sublogo", $niveau01->getLogo());
|
||||
|
||||
if(!is_null($niveau01->getHeader()))
|
||||
$session->set("header", $niveau01->getHeader());
|
||||
|
||||
if(!is_null($niveau01->getColormain()))
|
||||
$session->set("colormain", $niveau01->getColormain());
|
||||
|
||||
if(!is_null($niveau01->getFontcolorhover()))
|
||||
$session->set("fontcolorhover", $niveau01->getFontcolorhover());
|
||||
|
||||
if(!is_null($niveau01->getColorbody()))
|
||||
$session->set("colorbody", $niveau01->getColorbody());
|
||||
|
||||
if(!is_null($niveau01->getFontfacebody()))
|
||||
$session->set("fontfacebody", $niveau01->getFontfacebody());
|
||||
|
||||
if(!is_null($niveau01->getFontfacetitle()))
|
||||
$session->set("fontfacetitle", $niveau01->getFontfacetitle());
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -57,7 +57,68 @@ class Niveau01Type extends AbstractType
|
||||
)
|
||||
);
|
||||
|
||||
$choices=array(
|
||||
"Helvetica" => "Helvetica",
|
||||
"Peacesans" => "Peacesans",
|
||||
"Acme-Regular" => "Acme-Regular",
|
||||
"Redressed" => "Redressed",
|
||||
"Roboto-Regular" => "Roboto-Regular",
|
||||
"Justanotherhand-Regular" => "Justanotherhand-Regular",
|
||||
"Lato-Regular" => "Lato-Regular",
|
||||
|
||||
"ABeeZee-Regular" => "ABeeZee-Regular",
|
||||
"AlfaSlabOne-Regular" => "AlfaSlabOne-Regular",
|
||||
"Anton-Regular" => "Anton-Regular",
|
||||
"FredokaOne-Regular" => "FredokaOne-Regular",
|
||||
"Overpass-Black" => "Overpass-Black",
|
||||
"Righteous-Regular" => "Righteous-Regular",
|
||||
"Signika-Regular" => "Signika-Regular",
|
||||
"Teko-Bold" => "Teko-Bold",
|
||||
"LuckiestGuy-Regular" => "LuckiestGuy-Regular",
|
||||
|
||||
"Baloo-Regular" => "Baloo-Regular",
|
||||
"CarterOne-Regular" => "CarterOne-Regular",
|
||||
"Chewy-Regular" => "Chewy-Regular",
|
||||
"Courgette-Regular" => "Courgette-Regular",
|
||||
"LexendDeca-Regular" => "LexendDeca-Regular",
|
||||
"RubikMonoOne-Regular" => "RubikMonoOne-Regular",
|
||||
"SigmarOne-Regular" => "SigmarOne-Regular",
|
||||
"Viga-Regular" => "Viga-Regular",
|
||||
);
|
||||
|
||||
$builder->add('colormain',
|
||||
TextType::class,
|
||||
array("label" => "Couleur principale",
|
||||
"attr" => array("class" => "pick-a-color form-control"),
|
||||
'required' => false));
|
||||
|
||||
$builder->add('fontcolorhover',
|
||||
TextType::class,
|
||||
array("label" => "Couleur de texte sur couleur Principale",
|
||||
"attr" => array("class" => "pick-a-color form-control"),
|
||||
'required' => false));
|
||||
|
||||
$builder->add('colorbody',
|
||||
TextType::class,
|
||||
array("label" => "Couleur de fond des pages",
|
||||
"attr" => array("class" => "pick-a-color form-control"),
|
||||
'required' => false));
|
||||
|
||||
$builder->add("fontfacebody", ChoiceType::class,
|
||||
array("label" =>"Police principale",
|
||||
"attr" => array("class" => "form-control"),
|
||||
'required' => false,
|
||||
"choices" => $choices));
|
||||
|
||||
$builder->add("fontfacetitle", ChoiceType::class,
|
||||
array("label" =>"Police pour les titres",
|
||||
"attr" => array("class" => "form-control"),
|
||||
'required' => false,
|
||||
"choices" => $choices));
|
||||
|
||||
|
||||
$builder->add('logo',HiddenType::class);
|
||||
$builder->add('header',HiddenType::class);
|
||||
|
||||
// Si masteridentity = LDAP alors on demande obligatoirement le filtre des utilisateurs qui appartiennent à ce niveau01
|
||||
if($options["masteridentity"]=="LDAP")
|
||||
|
@ -18,6 +18,7 @@ use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\Query\Expr\Join;
|
||||
|
||||
class Niveau02Type extends AbstractType
|
||||
{
|
||||
@ -31,16 +32,37 @@ class Niveau02Type extends AbstractType
|
||||
)
|
||||
);
|
||||
|
||||
$builder->add('niveau01',
|
||||
EntityType::class,
|
||||
array(
|
||||
"class" => "CadolesCoreBundle:Niveau01",
|
||||
"label" => $session->get('labelniveau01'),
|
||||
"choice_label" => "label",
|
||||
"disabled" => ($options["mode"]!="submit"?true:false),
|
||||
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px","readonly" => ($options["mode"]!="submit"?true:false))
|
||||
)
|
||||
);
|
||||
if($options["user"]->getRole()=="ROLE_MODO") {
|
||||
$userid=$options["user"]->getId();
|
||||
$builder->add('niveau01',
|
||||
EntityType::class,
|
||||
array(
|
||||
"class" => "CadolesCoreBundle:Niveau01",
|
||||
"label" => $session->get('labelniveau01'),
|
||||
"choice_label" => "label",
|
||||
"disabled" => ($options["mode"]!="submit"?true:false),
|
||||
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px","readonly" => ($options["mode"]!="submit"?true:false)),
|
||||
"query_builder"=> function (EntityRepository $er) use($userid) {
|
||||
$result=$er->createQueryBuilder("table")->innerJoin("CadolesCoreBundle:UserModo", "usermodo", Join::WITH, "table.id = usermodo.niveau01");
|
||||
$result->andWhere("usermodo.user = :userid");
|
||||
$result->setParameter('userid', $userid);
|
||||
return $result;
|
||||
},
|
||||
)
|
||||
);
|
||||
}
|
||||
else {
|
||||
$builder->add('niveau01',
|
||||
EntityType::class,
|
||||
array(
|
||||
"class" => "CadolesCoreBundle:Niveau01",
|
||||
"label" => $session->get('labelniveau01'),
|
||||
"choice_label" => "label",
|
||||
"disabled" => ($options["mode"]!="submit"?true:false),
|
||||
"attr" => array("class" => "form-control", "style" => "margin-bottom:15px","readonly" => ($options["mode"]!="submit"?true:false))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$builder->add('label',
|
||||
TextType::class, array(
|
||||
@ -73,7 +95,8 @@ class Niveau02Type extends AbstractType
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'data_class' => 'Cadoles\CoreBundle\Entity\Niveau02',
|
||||
'mode' => "string"
|
||||
'mode' => "string",
|
||||
'user' => 'Cadoles\CoreBundle\Entity\User',
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -327,6 +327,9 @@ cadoles_core_config_niveau01_logo:
|
||||
path: /config/niveau01/logo
|
||||
defaults: { _controller: CadolesCoreBundle:Niveau01:logo }
|
||||
|
||||
cadoles_core_config_niveau01_header:
|
||||
path: /config/niveau01/header
|
||||
defaults: { _controller: CadolesCoreBundle:Niveau01:header }
|
||||
|
||||
#== Niveau02 =============================================================================================================
|
||||
cadoles_core_config_niveau02:
|
||||
|
@ -1,14 +1,14 @@
|
||||
{% set logo = "transnum-logo.png" %}
|
||||
|
||||
{% set fgheader = "" %}
|
||||
{% set header = "transnum-header.png" %}
|
||||
{% set header = "" %}
|
||||
{% set heightheader = "" %}
|
||||
|
||||
{% set colormain = "2176ad" %}
|
||||
{% set colormain = "" %}
|
||||
{% set fontcolorhover = "" %}
|
||||
{% set colorbody = "eeeeee" %}
|
||||
{% set colorbody = "" %}
|
||||
|
||||
{% set fontfacetitle = "LexendDeca-Regular" %}
|
||||
{% set fontfacetitle = "" %}
|
||||
{% set fontfacebody = "" %}
|
||||
|
||||
{{
|
||||
|
@ -53,15 +53,56 @@
|
||||
{% if masteridentity=="SSO" %}
|
||||
{{ form_row(form.attributes) }}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="width:150px; margin:10px auto;">
|
||||
<img id="niveau01_logo_img" src="/{{ alias }}/{{ niveau01.logo }}" style="width:90px;height:auto;margin:auto;display:block;margin-bottom:5px;">
|
||||
{{ form_widget(form.logo) }}
|
||||
<a class="btn btn-info" style="width:150px" data-toggle="modal" data-target="#mymodal" onClick="ModalLoad('mymodal','Logo','{{ path('cadoles_core_config_niveau01_logo') }}');" title='Ajouter un Logo'>Modifier</a>
|
||||
<a class="btn btn-danger" onClick="delLogo()" title='Détacher' style="width:100%">Détacher le Logo</a>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-pencil fa-fw"></i> Logo
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<div style="width:150px; margin:10px auto;">
|
||||
<img id="niveau01_logo_img" src="/{{ alias }}/{{ niveau01.logo }}" style="width:90px;height:auto;margin:auto;display:block;margin-bottom:5px;">
|
||||
{{ form_widget(form.logo) }}
|
||||
<a class="btn btn-info" style="width:150px" data-toggle="modal" data-target="#mymodal" onClick="ModalLoad('mymodal','Logo','{{ path('cadoles_core_config_niveau01_logo') }}');" title='Ajouter un Logo'>Modifier</a>
|
||||
<a class="btn btn-danger" onClick="delLogo()" title='Détacher' style="width:100%">Détacher le Logo</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-pencil fa-fw"></i> Style
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
{{ form_row(form.colormain) }}
|
||||
{{ form_row(form.fontcolorhover) }}
|
||||
{{ form_row(form.colorbody) }}
|
||||
{{ form_row(form.fontfacebody) }}
|
||||
{{ form_row(form.fontfacetitle) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-pencil fa-fw"></i> Bannière
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<div style="width:100%; margin:10px auto;">
|
||||
<img id="niveau01_header_img" src="/{{ alias }}/{{ niveau01.header }}" style="width:100%;height:auto;margin:auto;display:block;margin-bottom:5px;">
|
||||
{{ form_widget(form.header) }}
|
||||
<a class="btn btn-info" style="width:100%" data-toggle="modal" data-target="#mymodal" onClick="ModalLoad('mymodal','Bannière','{{ path('cadoles_core_config_niveau01_header') }}');" title='Ajouter une Bannière'>Modifier</a>
|
||||
<a class="btn btn-danger" onClick="delHeader()" title='Détacher' style="width:100%">Détacher la Bannière</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ form_end(form) }}
|
||||
@ -72,4 +113,8 @@
|
||||
$("#niveau01_logo_img").attr("src","");
|
||||
$("#niveau01_logo").val(null);
|
||||
}
|
||||
function delHeader() {
|
||||
$("#niveau01_header_img").attr("src","");
|
||||
$("#niveau01_header").val(null);
|
||||
}
|
||||
{% endblock %}
|
@ -0,0 +1,36 @@
|
||||
{% extends '@CadolesCore/base.html.twig' %}
|
||||
|
||||
{% block pagewrapper %}
|
||||
<h3 class="page-header">Téléchargez votre Bannière</h3>
|
||||
<a class="btn btn-default" onClick="closeModal();">Annuler</a>
|
||||
|
||||
<form action="{{ oneup_uploader_endpoint('niveau01') }}" class="dropzone" id="MyDropZone" style="margin-top:10px">
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
||||
{% block localjavascript %}
|
||||
Dropzone.options.MyDropZone = {
|
||||
acceptedMimeTypes: 'image/*',
|
||||
maxFiles: 1,
|
||||
resizeWidth:500,
|
||||
|
||||
success: function( file, response ){
|
||||
parent.$("#niveau01_header").val("uploads/niveau01/"+response["file"]);
|
||||
parent.$("#niveau01_header_img").attr("src","/{{ alias }}/uploads/niveau01/"+response["file"]);
|
||||
closeModal();
|
||||
}
|
||||
}
|
||||
|
||||
function closeModal() {
|
||||
window.parent.$("#mymodal").modal('hide');
|
||||
}
|
||||
|
||||
$(window).load(function () {
|
||||
// On vérifie que l'execution se fait bien dans le cadre d'une modal
|
||||
if(!window.parent.$("#mymodal #framemodal").length) {
|
||||
$(location).attr('href',"{{ path('cadoles_core_home') }}");
|
||||
}
|
||||
});
|
||||
{% endblock %}
|
@ -3,7 +3,9 @@
|
||||
{% block pagewrapper %}
|
||||
<h1 class="page-header">Gestion des {{ labelsniveau01 }} </h1>
|
||||
|
||||
{% if is_granted('ROLE_ADMIN') %}
|
||||
<p><a class="btn btn-success" href={{ path('cadoles_core_config_niveau01_submit') }}>Ajouter</a></p>
|
||||
{% endif %}
|
||||
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
|
@ -129,7 +129,7 @@ INSERT IGNORE permmodo (`route`, `visible`) VALUES
|
||||
('cadoles_core_config_datauser',0),
|
||||
('cadoles_core_config_datausers',0),
|
||||
('cadoles_core_config_whitelist',0),
|
||||
('cadoles_core_config_niveau01',0),
|
||||
('cadoles_core_config_niveau01',1),
|
||||
('cadoles_core_config_niveau02',1),
|
||||
('cadoles_core_config_group',1),
|
||||
('cadoles_core_config_registration',1),
|
||||
@ -140,6 +140,7 @@ INSERT IGNORE permmodo (`route`, `visible`) VALUES
|
||||
('cadoles_portal_config_alert',1),
|
||||
('cadoles_portal_config_calendar',1),
|
||||
('cadoles_portal_config_blog',1),
|
||||
('cadoles_portal_config_project',1),
|
||||
('cadoles_portal_config_flux',1),
|
||||
('cadoles_portal_config_notice',1),
|
||||
('cadoles_portal_config_icon',1),
|
||||
|
Loading…
Reference in New Issue
Block a user