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

This commit is contained in:
Arnaud Fornerot 2019-12-16 17:04:33 +01:00
commit 742383206e
27 changed files with 328 additions and 68 deletions

View File

@ -8,7 +8,7 @@ INSERT IGNORE INTO `niveau01` (`id`, `label`, `siren`) VALUES
(-100, 'Interne', 'SIREN'); (-100, 'Interne', 'SIREN');
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}aTs3IqgN93ehIEqy93uWTTyxg5wNa+80 (-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}XeJxoO2l4dkHFX78WQ1Ik30sjLt3kffh
', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple'); ', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple');

View File

@ -186,6 +186,17 @@ class ConfigController extends Controller
return $response; return $response;
} }
public function datauserdefaultAction(Request $request)
{
$em = $this->getDoctrine()->getManager();
$config=$em->getRepository('CadolesCoreBundle:Config')->find("datauser");
$config->setValue("");
$em->persist($config);
$em->flush();
return $this->redirectToRoute('cadoles_core_config_datauser');
}
public function datauserAction(Request $request) public function datauserAction(Request $request)
{ {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
@ -282,6 +293,17 @@ class ConfigController extends Controller
]); ]);
} }
public function datausersdefaultAction(Request $request)
{
$em = $this->getDoctrine()->getManager();
$config=$em->getRepository('CadolesCoreBundle:Config')->find("datausers");
$config->setValue("");
$em->persist($config);
$em->flush();
return $this->redirectToRoute('cadoles_core_config_datausers');
}
public function datausersAction(Request $request) public function datausersAction(Request $request)
{ {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
@ -315,6 +337,12 @@ class ConfigController extends Controller
$fields["group"]["perm"]=1; $fields["group"]["perm"]=1;
$fields["group"]["label"]="Groupes"; $fields["group"]["label"]="Groupes";
$fields["job"]["perm"]=1;
$fields["job"]["label"]="Métier";
$fields["position"]["perm"]=1;
$fields["position"]["label"]="Fonction";
$fields["role"]["perm"]=1; $fields["role"]["perm"]=1;
$fields["role"]["label"]="Rôles"; $fields["role"]["label"]="Rôles";

View File

@ -703,6 +703,7 @@ class GroupController extends Controller
$data->setFgtemplate(false); $data->setFgtemplate(false);
if($data->getLdapfilter()!="") $data->setFgopen(false); if($data->getLdapfilter()!="") $data->setFgopen(false);
if($data->getAttributes()!="") $data->setFgopen(false); if($data->getAttributes()!="") $data->setFgopen(false);
if($access=="user") $data->setOwner($this->getUser());
// Icon // Icon
$idicon = $form->get('idicon')->getData(); $idicon = $form->get('idicon')->getData();
@ -713,20 +714,6 @@ class GroupController extends Controller
$em->persist($data); $em->persist($data);
$em->flush(); $em->flush();
// Si acces par user on ajoute forcement le owner comme membre du groupe en tant que manager
/*
if($access=="user") {
$key = Uuid::uuid4();
$usergroup=new Usergroup;
$usergroup->setUser($this->getUser());
$usergroup->setGroup($data);
$usergroup->setFgmanager(true);
$usergroup->setKeyvalue($key);
$em->persist($usergroup);
$em->flush();
}
*/
// On s'assure que le propriétaire est bien membre du groupe // On s'assure que le propriétaire est bien membre du groupe
$this->ctrlOwner($data); $this->ctrlOwner($data);
@ -932,7 +919,7 @@ class GroupController extends Controller
protected function ctrlOwner($group) { protected function ctrlOwner($group) {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
if($group->getOwner()) { if($group->getOwner()) {
$usergroup=$em->getRepository("CadolesCoreBundle:Usergroup")->findOneBy(["user"=>$group->getOwner()]); $usergroup=$em->getRepository("CadolesCoreBundle:Usergroup")->findOneBy(["group"=>$group,"user"=>$group->getOwner()]);
if(!$usergroup) { if(!$usergroup) {
$key = Uuid::uuid4(); $key = Uuid::uuid4();
$usergroup=new Usergroup; $usergroup=new Usergroup;
@ -1037,6 +1024,13 @@ class GroupController extends Controller
$tmp=$this->getEntityBy("CadolesCoreBundle:Niveau02","label",$data->getLabel()); $tmp=$this->getEntityBy("CadolesCoreBundle:Niveau02","label",$data->getLabel());
if($tmp) $form->addError(new FormError('Un niveau de rang 02 utilise déjà ce label')); if($tmp) $form->addError(new FormError('Un niveau de rang 02 utilise déjà ce label'));
// On s'assure que le label ne contient pas des caractères speciaux
$string = preg_replace('~[^ @a-zA-Z0-9._-]~', '', $data->getLabel());
if($string!=$data->getLabel())
{
$form->addError(new FormError('Caractères interdit dans ce label'));
}
if($data->getFgcanshare()&&is_null($data->getPagetemplate())) if($data->getFgcanshare()&&is_null($data->getPagetemplate()))
$form->addError(new FormError("Un groupe de travail doit avoir un modèle de page d'accueil")); $form->addError(new FormError("Un groupe de travail doit avoir un modèle de page d'accueil"));
} }

View File

@ -282,6 +282,13 @@ class Niveau01Controller extends Controller
$tmp=$this->getEntityBy("CadolesCoreBundle:Niveau02","label",$data->getLabel()); $tmp=$this->getEntityBy("CadolesCoreBundle:Niveau02","label",$data->getLabel());
if($tmp) $form->addError(new FormError('Un niveau de rang 02 utilise déjà ce label')); if($tmp) $form->addError(new FormError('Un niveau de rang 02 utilise déjà ce label'));
// On s'assure que le label ne contient pas des caractères speciaux
$string = preg_replace('~[^@a-zA-Z0-9._-]~', '', $data->getLabel());
if($string!=$data->getLabel())
{
$form->addError(new FormError('Caractères interdit dans ce label'));
}
} }
if ($form->get('submit')->isClicked() && !$form->isValid()) { if ($form->get('submit')->isClicked() && !$form->isValid()) {

View File

@ -267,6 +267,13 @@ class Niveau02Controller extends Controller
$tmp=$this->getEntityBy("CadolesCoreBundle:Niveau01","label",$data->getLabel()); $tmp=$this->getEntityBy("CadolesCoreBundle:Niveau01","label",$data->getLabel());
if($tmp) $form->addError(new FormError('Un niveau de rang 01 utilise déjà ce label')); if($tmp) $form->addError(new FormError('Un niveau de rang 01 utilise déjà ce label'));
// On s'assure que le label ne contient pas des caractères speciaux
$string = preg_replace('~[^@a-zA-Z0-9._-]~', '', $data->getLabel());
if($string!=$data->getLabel())
{
$form->addError(new FormError('Caractères interdit dans ce label'));
}
} }
if ($form->get('submit')->isClicked() && !$form->isValid()) { if ($form->get('submit')->isClicked() && !$form->isValid()) {

View File

@ -214,6 +214,14 @@ class UserController extends Controller
break; break;
case 10 : case 10 :
$qb->orderBy('user.job',$order[0]["dir"]);
break;
case 11 :
$qb->orderBy('user.position',$order[0]["dir"]);
break;
case 12 :
$qb->orderBy('user.role',$order[0]["dir"]); $qb->orderBy('user.role',$order[0]["dir"]);
break; break;
} }
@ -245,6 +253,14 @@ class UserController extends Controller
break; break;
case 8 : case 8 :
$qb->orderBy('user.job',$order[0]["dir"]);
break;
case 9 :
$qb->orderBy('user.position',$order[0]["dir"]);
break;
case 10 :
$qb->orderBy('user.role',$order[0]["dir"]); $qb->orderBy('user.role',$order[0]["dir"]);
break; break;
} }
@ -279,6 +295,8 @@ class UserController extends Controller
array_push($tmp,$data->getNiveau01()->getLabel()); array_push($tmp,$data->getNiveau01()->getLabel());
if($viewniveau02) array_push($tmp,($data->getNiveau02()!==null?$data->getNiveau02()->getLabel():"")); if($viewniveau02) array_push($tmp,($data->getNiveau02()!==null?$data->getNiveau02()->getLabel():""));
array_push($tmp,$groups); array_push($tmp,$groups);
array_push($tmp,$data->getJob());
array_push($tmp,$data->getPosition());
array_push($tmp,$data->getRole()); array_push($tmp,$data->getRole());
array_push($output["data"],$tmp); array_push($output["data"],$tmp);
@ -654,7 +672,7 @@ class UserController extends Controller
$fields=$this->getDefaultDatauser(); $fields=$this->getDefaultDatauser();
// 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')) {
$niveau01=$data->getNiveau01(); $niveau01=$data->getNiveau01();
$modos=$this->get('security.token_storage')->getToken()->getUser()->getmodos(); $modos=$this->get('security.token_storage')->getToken()->getUser()->getmodos();
$fgperm=false; $fgperm=false;

View File

@ -91,6 +91,10 @@ class Niveau01
*/ */
protected $items; protected $items;
/**
* @ORM\ManyToMany(targetEntity="Cadoles\PortalBundle\Entity\Alert", mappedBy="niveau01s")
*/
protected $alerts;
/** /**
* Constructor * Constructor
@ -427,4 +431,38 @@ class Niveau01
{ {
return $this->items; return $this->items;
} }
/**
* Add alert
*
* @param \Cadoles\PortalBundle\Entity\Alert $alert
*
* @return Niveau01
*/
public function addAlert(\Cadoles\PortalBundle\Entity\Alert $alert)
{
$this->alerts[] = $alert;
return $this;
}
/**
* Remove alert
*
* @param \Cadoles\PortalBundle\Entity\Alert $alert
*/
public function removeAlert(\Cadoles\PortalBundle\Entity\Alert $alert)
{
$this->alerts->removeElement($alert);
}
/**
* Get alerts
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getAlerts()
{
return $this->alerts;
}
} }

View File

@ -165,10 +165,18 @@ cadoles_core_config_datauser:
path: /config/commun/datauser path: /config/commun/datauser
defaults: { _controller: CadolesCoreBundle:Config:datauser } defaults: { _controller: CadolesCoreBundle:Config:datauser }
cadoles_core_config_datauserdefault:
path: /config/commun/datauserdefault
defaults: { _controller: CadolesCoreBundle:Config:datauserdefault }
cadoles_core_config_datausers: cadoles_core_config_datausers:
path: /config/commun/datausers path: /config/commun/datausers
defaults: { _controller: CadolesCoreBundle:Config:datausers } defaults: { _controller: CadolesCoreBundle:Config:datausers }
cadoles_core_config_datausersdefault:
path: /config/commun/datausersdefault
defaults: { _controller: CadolesCoreBundle:Config:datausersdefault }
#== Registration ========================================================================================================= #== Registration =========================================================================================================
#-- Access config #-- Access config

View File

@ -1,4 +1,28 @@
services: services:
Cadoles\CoreBundle\Command\InitDataCommand:
tags:
- { name: 'console.command', command: 'Core:InitData' }
Cadoles\CoreBundle\Command\OnlyCommand:
tags:
- { name: 'console.command', command: 'Core:Only' }
Cadoles\CoreBundle\Command\PurgeFileCommand:
tags:
- { name: 'console.command', command: 'Core:PurgeFile' }
Cadoles\CoreBundle\Command\PurgeRegistrationCommand:
tags:
- { name: 'console.command', command: 'Core:PurgeRegistration' }
Cadoles\CoreBundle\Command\SetPasswordCommand:
tags:
- { name: 'console.command', command: 'Core:SetPassword' }
Cadoles\CoreBundle\Command\SynchroCommand:
tags:
- { name: 'console.command', command: 'Core:Synchro' }
cadoles.core.session.listener: cadoles.core.session.listener:
public: true public: true
class: Cadoles\CoreBundle\EventListener\sessionListener class: Cadoles\CoreBundle\EventListener\sessionListener
@ -136,3 +160,5 @@ services:

View File

@ -274,7 +274,7 @@ span.item-drag {
.grid-item .item-link img { .grid-item .item-link img {
display: block; display: block;
max-width: 100%; max-width: 100%;
max-height: 110px; //max-height: 110px;
height: auto; height: auto;
} }
@ -500,7 +500,7 @@ a.item-heart {
word-wrap: break-word; word-wrap: break-word;
width: 100%; width: 100%;
display: block; display: block;
line-height: initial; line-height: 14px;
padding: 0px; padding: 0px;
} }
@ -513,9 +513,9 @@ a.item-heart {
.grid .grid-preview .grid-item-title small { .grid .grid-preview .grid-item-title small {
margin-bottom: 10px; margin-bottom: 10px;
font-size:9px;
} }
@media (max-width: 991px) { @media (max-width: 991px) {
.grid .grid-preview { .grid .grid-preview {
width:32.666666667%; width:32.666666667%;

View File

@ -64,14 +64,7 @@ body.simple {
min-width: 138px; min-width: 138px;
} }
.grid .grid-preview .grid-item-title {
font-size:14px;
line-height: 8px;
}
.grid .grid-preview .grid-item-title small {
font-size:9px;
}
.widget-bordered .grid-preview img { .widget-bordered .grid-preview img {
border-radius: 0px; border-radius: 0px;

View File

@ -11,6 +11,16 @@
</h1> </h1>
{{ form_widget(form.submit) }} {{ form_widget(form.submit) }}
{% if mode=="datauser" %}
<a class="btn btn-danger" href={{ path('cadoles_core_config_datauserdefault') }}
data-method="delete" data-csrf="_token:{{ 'csrf' }}"
data-confirm="Êtes-vous sûr de vouloir revenir aux valeurs par défaut ?">Valeurs par défaut</a>
{% else %}
<a class="btn btn-danger" href={{ path('cadoles_core_config_datausersdefault') }}
data-method="delete" data-csrf="_token:{{ 'csrf' }}"
data-confirm="Êtes-vous sûr de vouloir revenir aux valeurs par défaut ?">Valeurs par défaut</a>
{% endif %}
<br><br> <br><br>
{% if app.session.flashbag.has('error') %} {% if app.session.flashbag.has('error') %}

View File

@ -45,6 +45,9 @@
<div class="panel-body"> <div class="panel-body">
{% if form.label is defined %} {% if form.label is defined %}
{{ form_row(form.label) }} {{ form_row(form.label) }}
<div class='alert alert-info' style='font-size: 80%;padding: 5px;margin-top: -10px;'>
Caractères interdits = accent, espace, caractères spéciaux sauf @ . - _<br>
</div>
{% if form.fgassoc is defined %} {% if form.fgassoc is defined %}
{% if masteridentity=="LDAP" %} {% if masteridentity=="LDAP" %}

View File

@ -40,6 +40,10 @@
<div class="panel-body"> <div class="panel-body">
{{ form_row(form.label) }} {{ form_row(form.label) }}
<div class='alert alert-info' style='font-size: 80%;padding: 5px;margin-top: -10px;'>
Caractères interdits = accent, espace, caractères spéciaux sauf @ . - _<br>
</div>
{{ form_row(form.siren) }} {{ form_row(form.siren) }}
{{ form_row(form.showsubappname) }} {{ form_row(form.showsubappname) }}
{% if masteridentity=="LDAP" %} {% if masteridentity=="LDAP" %}

View File

@ -41,6 +41,10 @@
<div class="panel-body"> <div class="panel-body">
{{ form_row(form.niveau01) }} {{ form_row(form.niveau01) }}
{{ form_row(form.label) }} {{ form_row(form.label) }}
<div class='alert alert-info' style='font-size: 80%;padding: 5px;margin-top: -10px;'>
Caractères interdits = accent, espace, caractères spéciaux sauf @ . - _<br>
</div>
{{ form_row(form.siret) }} {{ form_row(form.siret) }}
{{ form_row(form.postaladress) }} {{ form_row(form.postaladress) }}
</div> </div>

View File

@ -1,5 +1,9 @@
{% extends '@CadolesCore/base.html.twig' %} {% extends '@CadolesCore/base.html.twig' %}
{% block localstyle %}
th { font-size: 10px; }
td { font-size: 10px; }
{% endblock %}
{% block pagewrapper %} {% block pagewrapper %}
{% if access=="config" %} {% if access=="config" %}
<h1 class="page-header">Gestion des Utilisateurs</h1> <h1 class="page-header">Gestion des Utilisateurs</h1>
@ -21,7 +25,7 @@
<div class="panel-body"> <div class="panel-body">
<div class="dataTable_wrapper"> <div class="dataTable_wrapper">
<table class="table table-striped table-bordered table-hover" id="dataTables" style="width:100%"> <table class="table table-striped table-bordered table-hover" id="dataTables" style="width:100%: font-size:11px;">
<thead> <thead>
<tr> <tr>
{% if access=="config" %} {% if access=="config" %}
@ -31,13 +35,15 @@
<th width="200px class=="{% if fields["login"] is defined and fields["login"].perm==0 %}no-visible{% endif %}">Login</th> <th width="200px class=="{% if fields["login"] is defined and fields["login"].perm==0 %}no-visible{% endif %}">Login</th>
<th class="{% if fields["lastname"] is defined and fields["lastname"].perm==0 %}no-visible{% endif %}">Nom</th> <th class="{% if fields["lastname"] is defined and fields["lastname"].perm==0 %}no-visible{% endif %}">Nom</th>
<th class="{% if fields["firstname"] is defined and fields["firstname"].perm==0 %}no-visible{% endif %}">Prénom</th> <th class="{% if fields["firstname"] is defined and fields["firstname"].perm==0 %}no-visible{% endif %}">Prénom</th>
<th class="{% if fields["email"] is defined and fields["email"].perm==0 %}no-visible{% endif %}">Email</th> <th class="{% if fields["email"] is defined and fields["email"].perm==0 %}no-visible{% endif %}" style="width:100px">Email</th>
<th class="{% if fields["telephonenumber"] is defined and fields["telephonenumber"].perm==0 %}no-visible{% endif %}">Téléphone</th> <th class="{% if fields["telephonenumber"] is defined and fields["telephonenumber"].perm==0 %}no-visible{% endif %}">Téléphone</th>
<th class="{% if fields["niveau01"] is defined and fields["niveau01"].perm==0 %}no-visible{% endif %}">{{ labelniveau01 }}</th> <th class="{% if fields["niveau01"] is defined and fields["niveau01"].perm==0 %}no-visible{% endif %}">{{ labelniveau01 }}</th>
{% if viewniveau02 %} {% if viewniveau02 %}
<th class="no-sort {% if fields["niveau02"] is defined and fields["niveau02"].perm==0 %}no-visible{% endif %}">{{ labelniveau02 }}</th> <th class="no-sort {% if fields["niveau02"] is defined and fields["niveau02"].perm==0 %}no-visible{% endif %}">{{ labelniveau02 }}</th>
{% endif %} {% endif %}
<th class="no-sort {% if fields["group"] is defined and fields["group"].perm==0 %}no-visible{% endif %}">Groupes</th> <th class="no-sort {% if fields["group"] is defined and fields["group"].perm==0 %}no-visible{% endif %}">Groupes</th>
<th class="{% if fields["job"] is defined and fields["job"].perm==0 %}no-visible{% endif %}">Métier</th>
<th class="{% if fields["position"] is defined and fields["position"].perm==0 %}no-visible{% endif %}">Fonction</th>
<th class="{% if fields["role"] is defined and fields["role"].perm==0 %}no-visible{% endif %}">Rôle</th> <th class="{% if fields["role"] is defined and fields["role"].perm==0 %}no-visible{% endif %}">Rôle</th>
</tr> </tr>
</thead> </thead>

View File

@ -30,7 +30,7 @@ class CronCommand extends ContainerAwareCommand
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)
{ {
$entityManager = $this->getContainer()->get('doctrine')->getEntityManager(); $entityManager = $this->getContainer()->get('doctrine')->getManager();
$this->output = $output; $this->output = $output;
$this->filesystem = new Filesystem(); $this->filesystem = new Filesystem();
@ -105,6 +105,7 @@ class CronCommand extends ContainerAwareCommand
$parameter = new ArrayInput($jsonparameter); $parameter = new ArrayInput($jsonparameter);
// Executer la commande // Executer la commande
$returnCode=false;
try{ try{
$returnCode = $command->run($parameter, $output); $returnCode = $command->run($parameter, $output);

View File

@ -83,6 +83,29 @@ class InitDataCommand extends ContainerAwareCommand
$entity->setJsonargument('{"simulate":"false"}'); $entity->setJsonargument('{"simulate":"false"}');
$this->entityManager->persist($entity); $this->entityManager->persist($entity);
} }
// Job synchronisation onlyoffice
// Toute les 1h // Désactivé par défaut
$widonlyoffice_sync = $this->getContainer()->getParameter('widonlyoffice_sync');
$entity = $this->entityManager->getRepository('CadolesCronBundle:Cron')->find(105);
if(!$entity&&$widonlyoffice_sync) {
$entity = new Cron;
$nextdate=$entity->getSubmitdate();
$nextdate->setTime(3,0);
$entity->setCommand("Core:Only");
$entity->setDescription("Synchronisation des Only Office");
$entity->setId(105);
$entity->setRepeatcall(0);
$entity->setRepeatexec(0);
$entity->setRepeatinterval(3600);
$entity->setNextexecdate($entity->getSubmitdate());
$entity->setJsonargument('{"simulate":"false"}');
$this->entityManager->persist($entity);
}
elseif($entity&&!$widonlyoffice_sync) {
$this->entityManager->remove($entity);
}
// Job purge des registrations obsolètes // Job purge des registrations obsolètes
// Toute les 5mn // Toute les 5mn
$entity = $this->entityManager->getRepository('CadolesCronBundle:Cron')->find(110); $entity = $this->entityManager->getRepository('CadolesCronBundle:Cron')->find(110);

View File

@ -141,6 +141,8 @@ class CronController extends Controller
public function execAction(Request $request, $id) public function execAction(Request $request, $id)
{ {
set_time_limit(0);
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($this->labelentity)->find($id); $entity = $em->getRepository($this->labelentity)->find($id);

View File

@ -422,7 +422,7 @@ class InitDataCommand extends ContainerAwareCommand
// Item Limesurvey // Item Limesurvey
if($activate_widlimesurvey) { if($activate_widlimesurvey) {
$widlimesurvey_url =$this->getContainer()->getParameter('widlimesurvey_url'); $widlimesurvey_url =$this->getContainer()->getParameter('widlimesurvey_url')."/admin";
$entityItem = $em->getRepository('CadolesPortalBundle:Item')->find(-374); $entityItem = $em->getRepository('CadolesPortalBundle:Item')->find(-374);
if(!$entityItem) { if(!$entityItem) {
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_limesurvey.png"]); $entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_limesurvey.png"]);

View File

@ -69,7 +69,7 @@ class AlertController extends Controller
$data = new Alert(); $data = new Alert();
// Création du formulaire // Création du formulaire
$form = $this->createForm(AlertType::class,$data,array("mode"=>"submit")); $form = $this->createForm(AlertType::class,$data,array("mode"=>"submit","labelniveau01" => $this->GetParameter("labelsniveau01")));
// Récupération des data du formulaire // Récupération des data du formulaire
$form->handleRequest($request); $form->handleRequest($request);
@ -111,7 +111,8 @@ class AlertController extends Controller
// Création du formulaire // Création du formulaire
$form = $this->createForm(AlertType::class,$data,array( $form = $this->createForm(AlertType::class,$data,array(
"mode" => "update" "mode" => "update",
"labelniveau01" => $this->GetParameter("labelsniveau01")
)); ));
// Récupération des data du formulaire // Récupération des data du formulaire

View File

@ -737,6 +737,7 @@ class PagewidgetController extends Controller
// Profilage // Profilage
$user=$this->getUser(); $user=$this->getUser();
$roles=($user?$user->getRoles():["ROLE_ANONYME"]); $roles=($user?$user->getRoles():["ROLE_ANONYME"]);
$niveau01=($user?$user->getNiveau01():null);
$groups=($user?$user->getGroups():[]); $groups=($user?$user->getGroups():[]);
// Initialisation du calcul des alerts // Initialisation du calcul des alerts
@ -765,6 +766,28 @@ class PagewidgetController extends Controller
} }
} }
// Récupération par Niveau01
$qb = $em->createQueryBuilder();
$qb->select('alert')
->from("CadolesPortalBundle:Alert", 'alert')
->where(":niveau01 MEMBER OF alert.niveau01s")
->andWhere('alert.publishedat <= :today')
->andWhere($qb->expr()->orX(
$qb->expr()->gt('alert.unpublishedat', ':today'),
$qb->expr()->isNull('alert.unpublishedat')
))
->setParameter("niveau01",$niveau01)
->setParameter('today', date('Y-m-d'));
if($idalertcategory && $alertcategoryfilter) {
$qb->andWhere("alert.alertcategory=:alertcategory")
->setParameter("alertcategory",$alertcategoryfilter);
}
$alertsniveau01s=$qb->getQuery()->getResult();
foreach($alertsniveau01s as $alertsniveau01) {
if(!$alerts->contains($alertsniveau01s)) $alerts->add($alertsniveau01);
}
// Récupération des alerts par group // Récupération des alerts par group
foreach($groups as $group) { foreach($groups as $group) {
$qb = $em->createQueryBuilder(); $qb = $em->createQueryBuilder();
@ -1907,7 +1930,7 @@ class PagewidgetController extends Controller
// Render // Render
return $this->render($this->labelentity.':viewinfo.html.twig', [ return $this->render($this->labelentity.':viewinfo.html.twig', [
'entity' => $entity, 'entity' => $entity,
'canadd' => ($user), 'canadd' => $canupdate,
'canupdate' => $canupdate, 'canupdate' => $canupdate,
'usage' => $usage, 'usage' => $usage,
'icon' => $icon, 'icon' => $icon,

View File

@ -82,6 +82,16 @@ class Alert
*/ */
protected $groups; protected $groups;
/**
* @ORM\ManyToMany(targetEntity="Cadoles\CoreBundle\Entity\Niveau01", inversedBy="alerts", cascade={"persist"})
* @ORM\JoinTable(name="alertniveau01",
* joinColumns={@ORM\JoinColumn(name="alert", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="niveau01", referencedColumnName="id")}
* )
*/
protected $niveau01s;
// Is Online // Is Online
public function isOnline() public function isOnline()
{ {
@ -346,4 +356,38 @@ class Alert
{ {
return $this->groups; return $this->groups;
} }
/**
* Add niveau01
*
* @param \Cadoles\CoreBundle\Entity\Niveau01 $niveau01
*
* @return Alert
*/
public function addNiveau01(\Cadoles\CoreBundle\Entity\Niveau01 $niveau01)
{
$this->niveau01s[] = $niveau01;
return $this;
}
/**
* Remove niveau01
*
* @param \Cadoles\CoreBundle\Entity\Niveau01 $niveau01
*/
public function removeNiveau01(\Cadoles\CoreBundle\Entity\Niveau01 $niveau01)
{
$this->niveau01s->removeElement($niveau01);
}
/**
* Get niveau01s
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getNiveau01s()
{
return $this->niveau01s;
}
} }

View File

@ -57,6 +57,24 @@ class AlertType extends AbstractType
"disabled" => ($options["mode"]=="delete"?true:false), "disabled" => ($options["mode"]=="delete"?true:false),
]) ])
->add('niveau01s', Select2EntityType::class, [
'label' => 'Visible pour les '.$options["labelniveau01"],
'class' => 'CadolesCoreBundle:Niveau01',
'text_property' => 'label',
'multiple' => true,
'remote_route' => 'cadoles_core_ajax_niveau01_list',
'primary_key' => 'id',
'text_property' => 'label',
'minimum_input_length' => 0,
'page_limit' => 100,
'allow_clear' => true,
'delay' => 250,
'cache' => false,
'cache_timeout' => 60000,
'language' => 'fr',
'placeholder' => 'Selectionner des '.$options["labelniveau01"],
])
->add('groups', Select2EntityType::class, [ ->add('groups', Select2EntityType::class, [
'label' => 'Visible pour les Groupes', 'label' => 'Visible pour les Groupes',
'class' => 'CadolesCoreBundle:Group', 'class' => 'CadolesCoreBundle:Group',
@ -106,6 +124,7 @@ class AlertType extends AbstractType
$resolver->setDefaults([ $resolver->setDefaults([
'data_class' => 'Cadoles\PortalBundle\Entity\Alert', 'data_class' => 'Cadoles\PortalBundle\Entity\Alert',
'mode' => "string", 'mode' => "string",
'labelniveau01' => "string",
]); ]);
} }
} }

View File

@ -60,6 +60,7 @@
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
{{ form_row(form.roles) }} {{ form_row(form.roles) }}
{{ form_row(form.niveau01s) }}
{{ form_row(form.groups) }} {{ form_row(form.groups) }}
</div> </div>

View File

@ -28,7 +28,6 @@
</div> </div>
{% endif %} {% endif %}
{% set canadd = false %}
<div class="widgetheader" style="{{ stylewidgetheader }}; padding-top:10px;"> <div class="widgetheader" style="{{ stylewidgetheader }}; padding-top:10px;">
{% set style = "margin: auto; display: inherit;background-color:transparent;" %} {% set style = "margin: auto; display: inherit;background-color:transparent;" %}
{% if icon %} {% if icon %}
@ -51,33 +50,12 @@
<div class="grid clearfix"> <div class="grid clearfix">
<div class="grid-sizer grid-small"></div> <div class="grid-sizer grid-small"></div>
<div class="grid-gutter-sizer"></div> <div class="grid-gutter-sizer"></div>
{% for member in members %}
<div class="grid-item grid-small" style="{{ stylewidgetbodyreverse }};">
<div class="grid-item-content">
<div class="grid-item-logo">
<img onclick="seeUser({{member.user.id}})" src="/{{ alias }}/uploads/avatar/{{ member.user.avatar}}" class="grid-item-img avatar" height="110" style="cursor:pointer;">
</div>
<div class="grid-item-title">
<h2 style="{{ stylewidgetbodyreverse }};">
{{ member.user.lastname }} {{ member.user.firstname }}
{%if member.fgmanager%}
<br>
<i style="{{ stylewidgetbodyreverse }};" class="fa fa-star" title="Manager"></i>
{% if member.user==app.user %}
{% set canadd=true %}
{% endif %}
{%endif%}
</h2>
</div>
</div>
</div>
{% endfor %}
{% if canadd==true %} {% if canadd==true %}
<div class="grid-item grid-small" style="{{ stylewidgetbodyreverse }}; height:150px"> <div class="grid-item grid-small" style="{{ stylewidgetbodyreverse }};">
<a href="{{path('cadoles_core_user_group_users',{'id':id})}}" target="_top" style="{{ stylewidgetbodyreverse }};">
<div class="grid-item-content"> <div class="grid-item-content">
<a href="{{path('cadoles_core_user_group_users',{'id':id})}}" target="_top" style="{{ stylewidgetbodyreverse }};">
<div class="item-link clearfix">
<div class="grid-item-logo"> <div class="grid-item-logo">
<img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_add.png" /> <img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_add.png" />
</div> </div>
@ -89,7 +67,28 @@
</div> </div>
</a> </a>
</div> </div>
</div>
{% endif %} {% endif %}
{% for member in members %}
<div class="grid-item grid-small" style="{{ stylewidgetbodyreverse }};">
<div class="grid-item-content">
<div class="item-link clearfix">
<div class="grid-item-logo">
<img onclick="seeUser({{member.user.id}})" src="/{{ alias }}/uploads/avatar/{{ member.user.avatar}}" class="grid-item-img avatar" height="110" style="cursor:pointer;">
</div>
<div class="grid-item-title">
<h2 style="{{ stylewidgetbodyreverse }};">
{{ member.user.lastname }} {{ member.user.firstname }}
</h2>
</div>
</div>
</div>
</div>
{% endfor %}
</div> </div>
{% endif %} {% endif %}
</div> </div>

View File

@ -300,6 +300,7 @@ parameters:
%end if %end if
%else %else
activate_widonlyoffice: false activate_widonlyoffice: false
widonlyoffice_sync: false
%end if %end if
%if %%getVar("ninegate_activate_widopensondage", 'non') == "oui" %if %%getVar("ninegate_activate_widopensondage", 'non') == "oui"