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: parameters:
locale: fr locale: fr
monolog:
handlers:
main:
type: rotating_file
path: '%kernel.logs_dir%/%kernel.environment%.log'
level: debug
max_files: 10
framework: framework:
#esi: ~ #esi: ~
#translator: { fallbacks: ['%locale%'] } #translator: { fallbacks: ['%locale%'] }

View File

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

View File

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

View File

@ -25,7 +25,7 @@ class SecurityController extends Controller
\phpCAS::setDebug(false); \phpCAS::setDebug(false);
\phpCAS::client(CAS_VERSION_2_0, $this->getParameter('cas_host'), $this->getParameter('cas_port'), is_null($this->getParameter('cas_path')) ? '' : $this->getParameter('cas_path'), false); \phpCAS::client(CAS_VERSION_2_0, $this->getParameter('cas_host'), $this->getParameter('cas_port'), is_null($this->getParameter('cas_path')) ? '' : $this->getParameter('cas_path'), false);
\phpCAS::setNoCasServerValidation(); \phpCAS::setNoCasServerValidation();
// Authentification // Authentification
\phpCAS::forceAuthentication(); \phpCAS::forceAuthentication();
@ -46,19 +46,19 @@ class SecurityController extends Controller
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
if(isset($attributes[$this->getParameter('user_attr_cas_username')])) if(isset($attributes[$this->getParameter('user_attr_cas_username')]))
$username = $attributes[$this->getParameter('user_attr_cas_username')]; $username = $attributes[$this->getParameter('user_attr_cas_username')];
if(isset($attributes[$this->getParameter('user_attr_cas_mail')])) if(isset($attributes[$this->getParameter('user_attr_cas_mail')]))
$email = $attributes[$this->getParameter('user_attr_cas_mail')]; $email = $attributes[$this->getParameter('user_attr_cas_mail')];
if(isset($attributes[$this->getParameter('user_attr_cas_lastname')])) if(isset($attributes[$this->getParameter('user_attr_cas_lastname')]))
$lastname = $attributes[$this->getParameter('user_attr_cas_lastname')]; $lastname = $attributes[$this->getParameter('user_attr_cas_lastname')];
if(isset($attributes[$this->getParameter('user_attr_cas_firstname')])) if(isset($attributes[$this->getParameter('user_attr_cas_firstname')]))
$firstname = $attributes[$this->getParameter('user_attr_cas_firstname')]; $firstname = $attributes[$this->getParameter('user_attr_cas_firstname')];
$user = $em->getRepository('CadolesCoreBundle:User')->findOneBy(array("username"=>$username)); $user = $em->getRepository('CadolesCoreBundle:User')->findOneBy(array("username"=>$username));
$exists = $user ? true : false; $exists = $user ? true : false;
if (!$exists) { if (!$exists) {
// Là c'est normal que potentiellement il n'existe pas il faut donc l'autogénérer // Là c'est normal que potentiellement il n'existe pas il faut donc l'autogénérer
$user = new User(); $user = new User();
@ -73,23 +73,23 @@ class SecurityController extends Controller
$user->setRole("ROLE_USER"); $user->setRole("ROLE_USER");
$em->persist($user); $em->persist($user);
$em->flush(); $em->flush();
} }
else { else {
$user->setLastname($lastname); $user->setLastname($lastname);
$user->setFirstname((isset($firstname)?$firstname:null)); $user->setFirstname((isset($firstname)?$firstname:null));
$user->setEmail($email); $user->setEmail($email);
$em->persist($user); $em->persist($user);
$em->flush(); $em->flush();
} }
// Calcul Service // Calcul Service
/* /*
$user = $em->getRepository('CadolesCoreBundle:User')->calculateServices($user, $attributes); $user = $em->getRepository('CadolesCoreBundle:User')->calculateServices($user, $attributes);
// Attributs calculés // Attributs calculés
$attributes = $em->getRepository('CadolesCoreBundle:User')->calculateAttributes($user, $attributes); $attributes = $em->getRepository('CadolesCoreBundle:User')->calculateAttributes($user, $attributes);
*/ */
// Sauvegarde des attributes en session // Sauvegarde des attributes en session

View File

@ -29,8 +29,8 @@ class PurgeServerCommand extends Command
->setName('Core:PurgeServer') ->setName('Core:PurgeServer')
->setDescription('Purge Server not updated') ->setDescription('Purge Server not updated')
->setHelp('This command Purge the obsolete Server') ->setHelp('This command Purge the obsolete Server')
->addArgument('cronid', InputArgument::OPTIONAL, 'ID Cron Job') ->addArgument('cronid', InputArgument::OPTIONAL, 'ID Cron Job')
->addArgument('lastchance', InputArgument::OPTIONAL, 'Lastchance to run the cron') ->addArgument('lastchance', InputArgument::OPTIONAL, 'Lastchance to run the cron')
; ;
} }
@ -44,11 +44,11 @@ class PurgeServerCommand extends Command
$alias = $this->container->getParameter('alias'); $alias = $this->container->getParameter('alias');
$this->writelnred(''); $this->writelnred('');
$this->writelnred('== Core:PurgeServer'); $this->writelnred('== Core:PurgeServer');
$this->writelnred('=========================================================================================================='); $this->writelnred('==========================================================================================================');
$now=new \DateTime('now'); $now=new \DateTime('now');
$now->sub(new \DateInterval('P3M')); $now->sub(new \DateInterval('P6M'));
$servers=$this->em->getRepository("CadolesCoreBundle:Server")->findAll(); $servers=$this->em->getRepository("CadolesCoreBundle:Server")->findAll();
foreach($servers as $server) { foreach($servers as $server) {
@ -62,12 +62,12 @@ class PurgeServerCommand extends Command
return 1; return 1;
} }
private function writelnred($string) { private function writelnred($string) {
$this->output->writeln('<fg=red>'.$string.'</>'); $this->output->writeln('<fg=red>'.$string.'</>');
$this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n"); $this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n");
} }
private function writeln($string) { private function writeln($string) {
$this->output->writeln($string); $this->output->writeln($string);
$this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n"); $this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n");
} }
} }

View File

@ -4,7 +4,7 @@ SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'; SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
INSERT IGNORE INTO `user` (`id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`) VALUES 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'), ('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'), ('061', 1, 1, 1, 'font', 'fontfacebody', 'Helvetica', '', 'Police des titres de votre site'),
('200', 1, 0, 1, 'boolean', 'PROXYactivate', '1', '', 'Définit un Proxy'), ('200', 1, 0, 1, 'boolean', 'PROXYactivate', '0', '', 'Définit un Proxy'),
('201', 1, 0, 1, 'string', 'PROXYserver', '192.168.57.160', 'PROXYactivate','Adresse du Proxy'), ('201', 1, 0, 1, 'string', 'PROXYserver', '', 'PROXYactivate','Adresse du Proxy'),
('202', 1, 0, 1, 'string', 'PROXYport', '8080', 'PROXYactivate','Port 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); $response = \Unirest\Request::get($url.'/rest/user/'.$masterapikey.'/'.$user->getUsername(),$headers,$query);
// Mise à jour du user // Mise à jour du user
$user->setAvatar($response->body->user->avatar); if($response->code!=500) {
$user->setRole($response->body->user->role); $user->setAvatar($response->body->user->avatar);
$em->persist($user); $user->setRole($response->body->user->role);
$em->flush(); $em->persist($user);
// Mise à jour des groupes // Mise à jour des groupes
$groups=$response->body->groups; $groups=$response->body->groups;
$mygroup=[]; $mygroup=[];
foreach($groups as $groupexternal) { foreach($groups as $groupexternal) {
// Le groupe existe-t-il // Le groupe existe-t-il
$group=$em->getRepository("CadolesCoreBundle:Group")->findOneBy(["idexternal"=>$groupexternal->id]); $group=$em->getRepository("CadolesCoreBundle:Group")->findOneBy(["idexternal"=>$groupexternal->id]);
if(!$group) if(!$group)
$group = new Group(); $group = new Group();
$group->setIdexternal($groupexternal->id); $group->setIdexternal($groupexternal->id);
$group->setLabel($groupexternal->title); $group->setLabel($groupexternal->title);
$em->persist($group); $em->persist($group);
$em->flush(); $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 // 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(); $em = $this->getDoctrine()->getManager();
$user=$this->getUser(); $user=$this->getUser();
@ -164,6 +166,15 @@ class CoreController extends Controller
->where('s.etab=e') ->where('s.etab=e')
->andWhere('e.libelle_academie=:acad') ->andWhere('e.libelle_academie=:acad')
->setParameter('acad',$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 // Total by module
$totalmodules = $em->createQueryBuilder() $totalmodules = $em->createQueryBuilder()
@ -176,6 +187,14 @@ class CoreController extends Controller
->groupBy('s.module') ->groupBy('s.module')
->orderBy('total','DESC') ->orderBy('total','DESC')
->addOrderBy('label','ASC'); ->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 // Total by version
$totalversions = $em->createQueryBuilder() $totalversions = $em->createQueryBuilder()
@ -188,7 +207,15 @@ class CoreController extends Controller
->groupBy('s.version') ->groupBy('s.version')
->orderBy('total','DESC') ->orderBy('total','DESC')
->addOrderBy('label','ASC'); ->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 // Total by Secteur
$totalbysecteurs = $em->createQueryBuilder() $totalbysecteurs = $em->createQueryBuilder()
->select('COUNT(e.secteur_public_prive_libe) total','e.secteur_public_prive_libe label') ->select('COUNT(e.secteur_public_prive_libe) total','e.secteur_public_prive_libe label')
@ -200,6 +227,14 @@ class CoreController extends Controller
->groupBy('e.secteur_public_prive_libe') ->groupBy('e.secteur_public_prive_libe')
->orderBy('total','DESC') ->orderBy('total','DESC')
->addOrderBy('label','ASC'); ->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 // Total by Nature
$totalbynatures = $em->createQueryBuilder() $totalbynatures = $em->createQueryBuilder()
@ -212,6 +247,14 @@ class CoreController extends Controller
->groupBy('e.nature_uai_libe') ->groupBy('e.nature_uai_libe')
->orderBy('total','DESC') ->orderBy('total','DESC')
->addOrderBy('label','ASC'); ->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 // Total applications
$applications = $em->createQueryBuilder() $applications = $em->createQueryBuilder()
@ -225,6 +268,10 @@ class CoreController extends Controller
->andWhere('sa.server=s') ->andWhere('sa.server=s')
->andWhere(('sa.application=a')) ->andWhere(('sa.application=a'))
->setParameter('acad',$acad); ->setParameter('acad',$acad);
if($application!="all") {
$applications->andWhere('a.name=:application')
->setParameter('application',$application);
}
// Total by apps // Total by apps
$totalapplications = $em->createQueryBuilder() $totalapplications = $em->createQueryBuilder()
@ -241,6 +288,10 @@ class CoreController extends Controller
->groupBy('a.package') ->groupBy('a.package')
->orderBy('total','DESC') ->orderBy('total','DESC')
->addOrderBy('label','ASC'); ->addOrderBy('label','ASC');
if($application!="all") {
$totalapplications->andWhere('a.name=:application')
->setParameter('application',$application);
}
// Servers // Servers
$etabs = $em->createQueryBuilder() $etabs = $em->createQueryBuilder()
@ -264,6 +315,7 @@ class CoreController extends Controller
'totalbysecteurs' => $totalbysecteurs->getQuery()->getResult(), 'totalbysecteurs' => $totalbysecteurs->getQuery()->getResult(),
'totalbynatures' => $totalbynatures->getQuery()->getResult(), 'totalbynatures' => $totalbynatures->getQuery()->getResult(),
'by' => "acad", 'by' => "acad",
'ssby' => $application,
'servers' => $servers->getQuery()->getResult(), 'servers' => $servers->getQuery()->getResult(),
'byname' => $acad, 'byname' => $acad,
]); ]);

View File

@ -62,7 +62,7 @@ class Etab
/** /**
* @ORM\Column(type="string", length=100, nullable=true) * @ORM\Column(type="string", length=100, nullable=true)
*/ */
private $code_region; private $code_region;
/** /**
* @ORM\Column(type="string", length=100, nullable=true) * @ORM\Column(type="string", length=100, nullable=true)
@ -77,7 +77,7 @@ class Etab
/** /**
* @ORM\Column(type="string", length=100, nullable=true) * @ORM\Column(type="string", length=100, nullable=true)
*/ */
private $appellation_officielle; private $appellation_officielle;
/** /**
* @ORM\Column(type="string", length=100, nullable=true) * @ORM\Column(type="string", length=100, nullable=true)

View File

@ -8,48 +8,48 @@ cadoles_core_server:
defaults: { _controller: CadolesCoreBundle:Core:server } defaults: { _controller: CadolesCoreBundle:Core:server }
cadoles_core_acad: cadoles_core_acad:
path: /acad/{acad} path: /acad/{acad}/{application}
defaults: { _controller: CadolesCoreBundle:Core:acad } defaults: { _controller: CadolesCoreBundle:Core:acad, application:"all" }
cadoles_core_application: cadoles_core_application:
path: /application/{application} path: /application/{application}
defaults: { _controller: CadolesCoreBundle:Core:application } defaults: { _controller: CadolesCoreBundle:Core:application }
#== Theme ================================================================================================================ #== Theme ================================================================================================================
cadoles_core_theme_setconfig: cadoles_core_theme_setconfig:
path: /theme/setconfig path: /theme/setconfig
defaults: { _controller: CadolesCoreBundle:Theme:setconfig } defaults: { _controller: CadolesCoreBundle:Theme:setconfig }
cadoles_core_config_theme: cadoles_core_config_theme:
path: /config/theme path: /config/theme
defaults: { _controller: CadolesCoreBundle:Theme:list } defaults: { _controller: CadolesCoreBundle:Theme:list }
cadoles_core_config_theme_selec: cadoles_core_config_theme_selec:
path: /config/theme/select/{name} path: /config/theme/select/{name}
defaults: { _controller: CadolesCoreBundle:Theme:select, name:"" } defaults: { _controller: CadolesCoreBundle:Theme:select, name:"" }
#== Security Auth ======================================================================================================== #== Security Auth ========================================================================================================
cadoles_core_login: cadoles_core_login:
path: /login path: /login
defaults: { _controller: CadolesCoreBundle:Security:login } defaults: { _controller: CadolesCoreBundle:Security:login }
cadoles_core_logout: cadoles_core_logout:
path: /logout path: /logout
defaults: { _controller: CadolesCoreBundle:Security:logout } defaults: { _controller: CadolesCoreBundle:Security:logout }
cadoles_core_checkuser: cadoles_core_checkuser:
path: /checkuser path: /checkuser
defaults: { _controller: CadolesCoreBundle:Security:checkuser } defaults: { _controller: CadolesCoreBundle:Security:checkuser }
cadoles_core_kill: cadoles_core_kill:
path: /kill path: /kill
defaults: { _controller: CadolesCoreBundle:Security:kill } defaults: { _controller: CadolesCoreBundle:Security:kill }
cadoles_core_ldap_login: cadoles_core_ldap_login:
path: /ldaplogin path: /ldaplogin
defaults: { _controller: CadolesCoreBundle:Security:login } defaults: { _controller: CadolesCoreBundle:Security:login }
#== Crop Image =========================================================================================================== #== Crop Image ===========================================================================================================
@ -66,50 +66,50 @@ cadoles_core_crop02:
#-- Access config #-- Access config
cadoles_core_config_file_upload: cadoles_core_config_file_upload:
path: /config/file/upload/{id}/{type} path: /config/file/upload/{id}/{type}
defaults: { _controller: CadolesCoreBundle:File:upload, access: config } defaults: { _controller: CadolesCoreBundle:File:upload, access: config }
cadoles_core_config_file_delete: cadoles_core_config_file_delete:
path: /config/file/delete/ path: /config/file/delete/
defaults: { _controller: CadolesCoreBundle:File:delete, access: config } defaults: { _controller: CadolesCoreBundle:File:delete, access: config }
cadoles_core_config_file_view: cadoles_core_config_file_view:
path: /config/file/view/{directory}/{filename} path: /config/file/view/{directory}/{filename}
defaults: { _controller: CadolesCoreBundle:File:view, access: config } defaults: { _controller: CadolesCoreBundle:File:view, access: config }
cadoles_core_config_file_show: cadoles_core_config_file_show:
path: /config/file/show/{directory}/{filename} path: /config/file/show/{directory}/{filename}
defaults: { _controller: CadolesCoreBundle:File:show, access: config } defaults: { _controller: CadolesCoreBundle:File:show, access: config }
cadoles_core_config_file_download: cadoles_core_config_file_download:
path: /config/file/download/{directory}/{filename} path: /config/file/download/{directory}/{filename}
defaults: { _controller: CadolesCoreBundle:File:download, access: config } defaults: { _controller: CadolesCoreBundle:File:download, access: config }
#-- Access user #-- Access user
cadoles_core_user_file_upload: cadoles_core_user_file_upload:
path: /user/config/file/upload/{id}/{type} path: /user/config/file/upload/{id}/{type}
defaults: { _controller: CadolesCoreBundle:File:upload, access: user } defaults: { _controller: CadolesCoreBundle:File:upload, access: user }
cadoles_core_user_file_delete: cadoles_core_user_file_delete:
path: /user/file/delete path: /user/file/delete
defaults: { _controller: CadolesCoreBundle:File:delete, access: user } defaults: { _controller: CadolesCoreBundle:File:delete, access: user }
cadoles_core_user_file_view: cadoles_core_user_file_view:
path: file/view/{directory}/{filename} path: file/view/{directory}/{filename}
defaults: { _controller: CadolesCoreBundle:File:view, access: user } defaults: { _controller: CadolesCoreBundle:File:view, access: user }
cadoles_core_user_file_download: cadoles_core_user_file_download:
path: file/download/{directory}/{filename} path: file/download/{directory}/{filename}
defaults: { _controller: CadolesCoreBundle:File:download, access: user } defaults: { _controller: CadolesCoreBundle:File:download, access: user }
cadoles_core_user_file_show: cadoles_core_user_file_show:
path: file/show/{directory}/{filename} path: file/show/{directory}/{filename}
defaults: { _controller: CadolesCoreBundle:File:show, access: user } defaults: { _controller: CadolesCoreBundle:File:show, access: user }
#== Home Config ========================================================================================================== #== Home Config ==========================================================================================================
cadoles_core_config: cadoles_core_config:
path: /config/home path: /config/home
defaults: { _controller: CadolesCoreBundle:Config:home } defaults: { _controller: CadolesCoreBundle:Config:home }
#== Commun Config Commun ================================================================================================= #== Commun Config Commun =================================================================================================
@ -151,8 +151,8 @@ cadoles_core_user_group_ajax_list:
#== API =================================================================================================================== #== API ===================================================================================================================
cadoles_core_api: cadoles_core_api:
path: /api path: /api
defaults: { _controller: CadolesCoreBundle:Api:api} defaults: { _controller: CadolesCoreBundle:Api:api}
methods: ["post"] #methods: ["post"]
#== Application ============================================================================================================ #== Application ============================================================================================================
cadoles_core_config_application: cadoles_core_config_application:

View File

@ -6,7 +6,18 @@
{% block pagewrapper %} {% block pagewrapper %}
{%if by is defined %} {%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 %} {% endif %}
@ -17,7 +28,7 @@
{%if totalapplications is defined %} {%if totalapplications is defined %}
<h1 style="text-align:center; margin-top:0px""><i class="fa fa-cubes fa-fw"></i>Applications = {{ totalapplications }} </h1> <h1 style="text-align:center; margin-top:0px""><i class="fa fa-cubes fa-fw"></i>Applications = {{ totalapplications }} </h1>
{% endif %} {% endif %}
<div class="row" style="margin-top:20px"> <div class="row" style="margin-top:20px">
{% if totalbyapplications is defined %} {% if totalbyapplications is defined %}
{% if totalbyacademies is defined %} {% if totalbyacademies is defined %}
@ -25,13 +36,13 @@
{%else%} {%else%}
<div class="col-md-8" style="text-align:center;"> <div class="col-md-8" style="text-align:center;">
{%endif%} {%endif%}
<h1>Applications Installées</h1> <h1>Applications Installées</h1>
<div class="col-md-7" > <div class="col-md-7" >
<div id='byapplication-chart'></div> <div id='byapplication-chart'></div>
</div> </div>
<div id="byapplication-legend" class="col-md-5"></div> <div id="byapplication-legend" class="col-md-5"></div>
</div> </div>
{% endif %} {% endif %}
{% if totalbyacademies is defined %} {% if totalbyacademies is defined %}
@ -65,7 +76,7 @@
<div id='bynature-chart' style="height:250px"></div> <div id='bynature-chart' style="height:250px"></div>
<div id="bynature-legend"></div> <div id="bynature-legend"></div>
</div> </div>
</div> </div>
{% if by is defined and app.user %} {% if by is defined and app.user %}
@ -85,10 +96,10 @@
</thead> </thead>
{% for server in servers %} {% for server in servers %}
{% for serverapplication in server.serverapplications %} {% 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> <tr>
<td>{{server.etab.numerouai}}</td> <td>{{server.etab.numerouai}}</td>
<td>{{server.etab.denominationprincipale}}</td> <td>{{server.etab.appellationofficielle}}</td>
<td>{{server.etab.adresseuai}}</td> <td>{{server.etab.adresseuai}}</td>
<td>{{server.etab.libellecommune}}</td> <td>{{server.etab.libellecommune}}</td>
<td>{{server.etab.secteurpublicprivelibe}}</td> <td>{{server.etab.secteurpublicprivelibe}}</td>
@ -127,9 +138,9 @@
maxZoom: 20 maxZoom: 20
}).addTo(macarte); }).addTo(macarte);
} }
$(document).ready(function() { $(document).ready(function() {
initMap(); initMap();
marker=[]; marker=[];
{% for etab in etabs %} {% for etab in etabs %}
@ -138,7 +149,7 @@
html ="<h3>Etablissement</h3>"; html ="<h3>Etablissement</h3>";
{% if(etab.id!=-100) %} {% if(etab.id!=-100) %}
html+="<b>UAI</b> = {{etab.numerouai}}<br>"; 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>Adresse</b> = {{etab.adresseuai}} {{etab.codecommune}} {{etab.libellecommune}}<br>";
html+="<b>Académie</b> = {{etab.libelleacademie}}<br>"; html+="<b>Académie</b> = {{etab.libelleacademie}}<br>";
html+="<b>Secteur</b> = {{etab.secteurpublicprivelibe}}<br>"; html+="<b>Secteur</b> = {{etab.secteurpublicprivelibe}}<br>";
@ -159,7 +170,7 @@
{% if totalbyacademies is defined %} {% if totalbyacademies is defined %}
var byacademie = Morris.Donut({ var byacademie = Morris.Donut({
element: 'byacademie-chart', element: 'byacademie-chart',
data: [ data: [
{% for total in totalbyacademies %} {% for total in totalbyacademies %}
{'label':'{{ total.label }}','value':{{ total.total }}}, {'label':'{{ total.label }}','value':{{ total.total }}},
{% endfor %} {% endfor %}
@ -168,7 +179,11 @@
}); });
byacademie.options.data.forEach(function(label, i) { 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 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>'); 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>');
@ -184,7 +199,7 @@
//== byNature //== byNature
var bynature = Morris.Donut({ var bynature = Morris.Donut({
element: 'bynature-chart', element: 'bynature-chart',
data: [ data: [
{% for total in totalbynatures %} {% for total in totalbynatures %}
{'label':'{{ total.label }}','value':{{ total.total }}}, {'label':'{{ total.label }}','value':{{ total.total }}},
{% endfor %} {% endfor %}
@ -205,7 +220,7 @@
//== bySecteur //== bySecteur
var bysecteur = Morris.Donut({ var bysecteur = Morris.Donut({
element: 'bysecteur-chart', element: 'bysecteur-chart',
data: [ data: [
{% for total in totalbysecteurs %} {% for total in totalbysecteurs %}
{'label':'{{ total.label }}','value':{{ total.total }}}, {'label':'{{ total.label }}','value':{{ total.total }}},
{% endfor %} {% endfor %}
@ -226,7 +241,7 @@
//== byModule //== byModule
var bymodule = Morris.Donut({ var bymodule = Morris.Donut({
element: 'bymodule-chart', element: 'bymodule-chart',
data: [ data: [
{% for total in totalbymodules %} {% for total in totalbymodules %}
{'label':'{{ total.label }}','value':{{ total.total }}}, {'label':'{{ total.label }}','value':{{ total.total }}},
{% endfor %} {% endfor %}
@ -247,7 +262,7 @@
//== byVersion //== byVersion
var byversion = Morris.Donut({ var byversion = Morris.Donut({
element: 'byversion-chart', element: 'byversion-chart',
data: [ data: [
{% for total in totalbyversions %} {% for total in totalbyversions %}
{'label':'{{ total.label }}','value':{{ total.total }}}, {'label':'{{ total.label }}','value':{{ total.total }}},
{% endfor %} {% endfor %}
@ -262,14 +277,14 @@
.css('width', '20px') .css('width', '20px')
.css('display', 'inline-block') .css('display', 'inline-block')
.css('margin', '5px'); .css('margin', '5px');
$('#byversion-legend').append(legendItem) $('#byversion-legend').append(legendItem)
}); });
//== byApplication //== byApplication
{% if totalbyapplications is defined %} {% if totalbyapplications is defined %}
var byapplication = Morris.Donut({ var byapplication = Morris.Donut({
element: 'byapplication-chart', element: 'byapplication-chart',
data: [ data: [
{% for total in totalbyapplications %} {% for total in totalbyapplications %}
{ {
'label':'{{ total.label }}', 'label':'{{ total.label }}',
@ -281,7 +296,11 @@
}); });
byapplication.options.data.forEach(function(label, i) { 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 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>'); 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>');
@ -290,8 +309,8 @@
.css('width', '20px') .css('width', '20px')
.css('display', 'inline-block') .css('display', 'inline-block')
.css('margin', '0px 5px 5px 0px'); .css('margin', '0px 5px 5px 0px');
$('#byapplication-legend').append(legendItem) $('#byapplication-legend').append(legendItem)
}); });
{% endif %} {% endif %}
@ -308,7 +327,7 @@
function showModal(id) { function showModal(id) {
var url="{{ path('cadoles_core_server',{id:'xx'})}}"; var url="{{ path('cadoles_core_server',{id:'xx'})}}";
url=url.replace('xx',id); url=url.replace('xx',id);
console.log("pouet"); console.log("pouet");
@ -317,4 +336,4 @@
$("#mymodal").modal('show'); $("#mymodal").modal('show');
} }
{% endblock %} {% endblock %}

View File

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