This commit is contained in:
afornerot 2022-12-05 16:10:39 +01:00
parent b19b9a50c4
commit e04e359feb
11 changed files with 175 additions and 101 deletions

View File

@ -11,6 +11,14 @@ imports:
parameters:
locale: fr
monolog:
handlers:
main:
type: rotating_file
path: '%kernel.logs_dir%/%kernel.environment%.log'
level: debug
max_files: 10
framework:
#esi: ~
#translator: { fallbacks: ['%locale%'] }

View File

@ -1,7 +1,5 @@
#!/bin/bash
export HTTP_PROXY="192.168.57.160:8080"
export HTTPS_PROXY="192.168.57.160:8080"
cd /var/www/html/ninestat

View File

@ -1,8 +1,5 @@
#!/bin/bash
# Suppression des logs trop ancien
find var/logs -mindepth 1 -mtime +7 -delete
# Installation des dépendances composer
composer install

View File

@ -48,7 +48,7 @@ class PurgeServerCommand extends Command
$this->writelnred('==========================================================================================================');
$now=new \DateTime('now');
$now->sub(new \DateInterval('P3M'));
$now->sub(new \DateInterval('P6M'));
$servers=$this->em->getRepository("CadolesCoreBundle:Server")->findAll();
foreach($servers as $server) {

View File

@ -4,7 +4,7 @@ SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
INSERT IGNORE INTO `user` (`id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`) VALUES
(-100, 'admin', 'Administrateur', 'STAT', '{SSHA}euZCgZjWhBu0xUZI9lPK2ncV9oaB+Jqo', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN');
(-100, 'admin', 'Administrateur', 'STAT', '{SSHA}euZCgZjWhBu0xUZI9lPK2ncV9oaB+Jqo', 'tina-boot@ac-dijon.fr', 'admin.jpg', 'ROLE_ADMIN');
@ -31,7 +31,7 @@ INSERT IGNORE INTO `config` (`order`, `visible`, `changeable`, `required`, `type
('060', 1, 1, 1, 'font', 'fontfacetitle', 'Anton-Regular', '', 'Police des titres de votre site'),
('061', 1, 1, 1, 'font', 'fontfacebody', 'Helvetica', '', 'Police des titres de votre site'),
('200', 1, 0, 1, 'boolean', 'PROXYactivate', '1', '', 'Définit un Proxy'),
('201', 1, 0, 1, 'string', 'PROXYserver', '192.168.57.160', 'PROXYactivate','Adresse du Proxy'),
('202', 1, 0, 1, 'string', 'PROXYport', '8080', 'PROXYactivate','Port du Proxy');
('200', 1, 0, 1, 'boolean', 'PROXYactivate', '0', '', 'Définit un Proxy'),
('201', 1, 0, 1, 'string', 'PROXYserver', '', 'PROXYactivate','Adresse du Proxy'),
('202', 1, 0, 1, 'string', 'PROXYport', '', 'PROXYactivate','Port du Proxy');

View File

@ -44,29 +44,31 @@ class CoreController extends Controller
$response = \Unirest\Request::get($url.'/rest/user/'.$masterapikey.'/'.$user->getUsername(),$headers,$query);
// Mise à jour du user
$user->setAvatar($response->body->user->avatar);
$user->setRole($response->body->user->role);
$em->persist($user);
$em->flush();
if($response->code!=500) {
$user->setAvatar($response->body->user->avatar);
$user->setRole($response->body->user->role);
$em->persist($user);
// Mise à jour des groupes
$groups=$response->body->groups;
$mygroup=[];
// Mise à jour des groupes
$groups=$response->body->groups;
$mygroup=[];
foreach($groups as $groupexternal) {
// Le groupe existe-t-il
$group=$em->getRepository("CadolesCoreBundle:Group")->findOneBy(["idexternal"=>$groupexternal->id]);
if(!$group)
$group = new Group();
$group->setIdexternal($groupexternal->id);
$group->setLabel($groupexternal->title);
$em->persist($group);
foreach($groups as $groupexternal) {
// Le groupe existe-t-il
$group=$em->getRepository("CadolesCoreBundle:Group")->findOneBy(["idexternal"=>$groupexternal->id]);
if(!$group)
$group = new Group();
$group->setIdexternal($groupexternal->id);
$group->setLabel($groupexternal->title);
$em->persist($group);
$em->flush();
}
// Sauvegarde en session des groupes de l'utilisateur
$this->get('session')->set("groups",$groups);
$em->flush();
}
// Sauvegarde en session des groupes de l'utilisateur
$this->get('session')->set("groups",$groups);
}
// Total servers
@ -150,7 +152,7 @@ class CoreController extends Controller
]);
}
public function acadAction($acad, Request $request)
public function acadAction($acad, $application="all", Request $request)
{
$em = $this->getDoctrine()->getManager();
$user=$this->getUser();
@ -164,6 +166,15 @@ class CoreController extends Controller
->where('s.etab=e')
->andWhere('e.libelle_academie=:acad')
->setParameter('acad',$acad);
if($application!="all") {
$servers->from('CadolesCoreBundle:ServerApplication','sa')
->from('CadolesCoreBundle:Application','a')
->andWhere('sa.server=s')
->andWhere('sa.application=a')
->andWhere('a.name=:application')
->setParameter('application',$application);
}
// Total by module
$totalmodules = $em->createQueryBuilder()
@ -176,6 +187,14 @@ class CoreController extends Controller
->groupBy('s.module')
->orderBy('total','DESC')
->addOrderBy('label','ASC');
if($application!="all") {
$totalmodules->from('CadolesCoreBundle:ServerApplication','sa')
->from('CadolesCoreBundle:Application','a')
->andWhere('sa.server=s')
->andWhere('sa.application=a')
->andWhere('a.name=:application')
->setParameter('application',$application);
}
// Total by version
$totalversions = $em->createQueryBuilder()
@ -188,6 +207,14 @@ class CoreController extends Controller
->groupBy('s.version')
->orderBy('total','DESC')
->addOrderBy('label','ASC');
if($application!="all") {
$totalversions->from('CadolesCoreBundle:ServerApplication','sa')
->from('CadolesCoreBundle:Application','a')
->andWhere('sa.server=s')
->andWhere('sa.application=a')
->andWhere('a.name=:application')
->setParameter('application',$application);
}
// Total by Secteur
$totalbysecteurs = $em->createQueryBuilder()
@ -200,6 +227,14 @@ class CoreController extends Controller
->groupBy('e.secteur_public_prive_libe')
->orderBy('total','DESC')
->addOrderBy('label','ASC');
if($application!="all") {
$totalbysecteurs->from('CadolesCoreBundle:ServerApplication','sa')
->from('CadolesCoreBundle:Application','a')
->andWhere('sa.server=s')
->andWhere('sa.application=a')
->andWhere('a.name=:application')
->setParameter('application',$application);
}
// Total by Nature
$totalbynatures = $em->createQueryBuilder()
@ -212,6 +247,14 @@ class CoreController extends Controller
->groupBy('e.nature_uai_libe')
->orderBy('total','DESC')
->addOrderBy('label','ASC');
if($application!="all") {
$totalbynatures->from('CadolesCoreBundle:ServerApplication','sa')
->from('CadolesCoreBundle:Application','a')
->andWhere('sa.server=s')
->andWhere('sa.application=a')
->andWhere('a.name=:application')
->setParameter('application',$application);
}
// Total applications
$applications = $em->createQueryBuilder()
@ -225,6 +268,10 @@ class CoreController extends Controller
->andWhere('sa.server=s')
->andWhere(('sa.application=a'))
->setParameter('acad',$acad);
if($application!="all") {
$applications->andWhere('a.name=:application')
->setParameter('application',$application);
}
// Total by apps
$totalapplications = $em->createQueryBuilder()
@ -241,6 +288,10 @@ class CoreController extends Controller
->groupBy('a.package')
->orderBy('total','DESC')
->addOrderBy('label','ASC');
if($application!="all") {
$totalapplications->andWhere('a.name=:application')
->setParameter('application',$application);
}
// Servers
$etabs = $em->createQueryBuilder()
@ -264,6 +315,7 @@ class CoreController extends Controller
'totalbysecteurs' => $totalbysecteurs->getQuery()->getResult(),
'totalbynatures' => $totalbynatures->getQuery()->getResult(),
'by' => "acad",
'ssby' => $application,
'servers' => $servers->getQuery()->getResult(),
'byname' => $acad,
]);

View File

@ -8,12 +8,12 @@ cadoles_core_server:
defaults: { _controller: CadolesCoreBundle:Core:server }
cadoles_core_acad:
path: /acad/{acad}
defaults: { _controller: CadolesCoreBundle:Core:acad }
path: /acad/{acad}/{application}
defaults: { _controller: CadolesCoreBundle:Core:acad, application:"all" }
cadoles_core_application:
path: /application/{application}
defaults: { _controller: CadolesCoreBundle:Core:application }
defaults: { _controller: CadolesCoreBundle:Core:application }
#== Theme ================================================================================================================
@ -152,7 +152,7 @@ cadoles_core_user_group_ajax_list:
cadoles_core_api:
path: /api
defaults: { _controller: CadolesCoreBundle:Api:api}
methods: ["post"]
#methods: ["post"]
#== Application ============================================================================================================
cadoles_core_config_application:

View File

@ -6,7 +6,18 @@
{% block pagewrapper %}
{%if by is defined %}
<h1 style="text-align:center">{{byname}}</h1>
<h1 style="text-align:center">
{% if by=="acad" %}
<a href="{{ path("cadoles_core_acad",{"acad":byname}) }}">
{% else %}
<a href "{{ path("cadoles_core_application",{"application":byname}) }}">
{% endif %}
{{byname}}</a>
{%if ssby is defined and ssby!="all" %}
<br>{{ssby}}
{% endif %}
</h1>
{% endif %}
@ -85,10 +96,10 @@
</thead>
{% for server in servers %}
{% for serverapplication in server.serverapplications %}
{% if by=="acad" or (by=="application" and serverapplication.application.name==byname) %}
{% if server.etab and ((by=="acad" and (ssby=="all" or ssby==serverapplication.application.name)) or (by=="application" and serverapplication.application.name==byname)) %}
<tr>
<td>{{server.etab.numerouai}}</td>
<td>{{server.etab.denominationprincipale}}</td>
<td>{{server.etab.appellationofficielle}}</td>
<td>{{server.etab.adresseuai}}</td>
<td>{{server.etab.libellecommune}}</td>
<td>{{server.etab.secteurpublicprivelibe}}</td>
@ -138,7 +149,7 @@
html ="<h3>Etablissement</h3>";
{% if(etab.id!=-100) %}
html+="<b>UAI</b> = {{etab.numerouai}}<br>";
html+="<b>Nom</b> = {{etab.denominationprincipale}}<br>";
html+="<b>Nom</b> = {{etab.appellationofficielle}}<br>";
html+="<b>Adresse</b> = {{etab.adresseuai}} {{etab.codecommune}} {{etab.libellecommune}}<br>";
html+="<b>Académie</b> = {{etab.libelleacademie}}<br>";
html+="<b>Secteur</b> = {{etab.secteurpublicprivelibe}}<br>";
@ -168,7 +179,11 @@
});
byacademie.options.data.forEach(function(label, i) {
var url = "{{ path("cadoles_core_acad",{"acad":"xx"}) }}";
{% if byname is defined %}
var url = "{{ path("cadoles_core_acad",{"acad":"xx","application":byname}) }}";
{% else %}
var url = "{{ path("cadoles_core_acad",{"acad":"xx"}) }}";
{% endif %}
var url = url.replace("xx",label['label']);
var legendItem = $('<span style="margin:auto; display: block;text-align: left;"></span>').html( "<a href='"+url+"'>"+label['label'] + "</a> ( " +label['value'] + " )" ).prepend('<span>&nbsp;</span>');
@ -281,7 +296,11 @@
});
byapplication.options.data.forEach(function(label, i) {
var url = "{{ path("cadoles_core_application",{"application":"xx"}) }}";
{% if byname is defined %}
var url = "{{ path("cadoles_core_acad",{"acad":byname,"application":"xx"}) }}";
{% else %}
var url = "{{ path("cadoles_core_application",{"application":"xx"}) }}";
{% endif %}
var url = url.replace("xx",label['label']);
var legendItem = $('<span style="margin:auto; display: block;text-align: left;"></span>').html( "<a href='"+url+"'>"+label['label'] + "</a> ( " +label['value'] + " )" ).prepend('<span>&nbsp;</span>');

View File

@ -30,7 +30,7 @@
<b>Etablissement</b><br>
{% if(server.etab.id!=-100) %}
<b>UAI</b> = {{server.etab.numerouai}}<br>
<b>Nom</b> = {{server.etab.denominationprincipale}}<br>
<b>Nom</b> = {{server.etab.appellationofficielle}}<br>
<b>Adresse</b> = {{server.etab.adresseuai}} {{server.etab.codecommune}} {{server.etab.libellecommune}}<br>
<b>Académie</b> = {{server.etab.libelleacademie}}<br>
<b>Secteur</b> = {{server.etab.secteurpublicprivelibe}}<br>