This commit is contained in:
root 2019-11-29 16:27:34 +01:00
parent 0900c8c532
commit b214ebe981
15 changed files with 477 additions and 113 deletions

View File

@ -41,7 +41,6 @@ security:
check_path: /saml/acs check_path: /saml/acs
access_control: access_control:
- { path: ^/websocket, roles: [ROLE_ADMIN, ROLE_MODO, ROLE_ANIM, ROLE_USER] }
- { path: ^/user, roles: [ROLE_ADMIN, ROLE_MODO, ROLE_ANIM, ROLE_USER] } - { path: ^/user, roles: [ROLE_ADMIN, ROLE_MODO, ROLE_ANIM, ROLE_USER] }
- { path: ^/config, roles: [ROLE_ADMIN, ROLE_MODO] } - { path: ^/config, roles: [ROLE_ADMIN, ROLE_MODO] }

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

@ -58,9 +58,12 @@ apps=`cat /tmp/lstpaquetfinal.txt`
# Construction de la chaine de parametre # Construction de la chaine de parametre
mac=`echo $(rawurlencode "${mac}")` mac=`echo $(rawurlencode "${mac}")`
etab=`echo $(rawurlencode "${etab}")`
eole_module=`echo $(rawurlencode "${eole_module}")`
eole_release=`echo $(rawurlencode "${eole_release}")`
apps=`echo $(rawurlencode "${apps}")` apps=`echo $(rawurlencode "${apps}")`
data="idserver=$mac&idlocal=$rne&name=$etab&module=$eole_module&version=$eole_release"
data="idserver=$mac&idlocal=$rne&name=$etab&module=$eole_module&version=$eole_release&apps=$apps"
curl --request POST \ curl --request POST \
--url ${serveurstat} \ --url ${serveurstat} \
@ -69,6 +72,6 @@ curl --request POST \
--header 'cache-control: no-cache' \ --header 'cache-control: no-cache' \
--header 'content-type: application/x-www-form-urlencoded' \ --header 'content-type: application/x-www-form-urlencoded' \
--header 'postman-token: e8cbba3a-9e51-204b-b742-a5b7a083738d' \ --header 'postman-token: e8cbba3a-9e51-204b-b742-a5b7a083738d' \
--data ${data} --data ${data} &

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', 'SCRUM', '{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');
@ -12,7 +12,7 @@ DELETE FROM `config` WHERE `changeable` = 0;
INSERT IGNORE INTO `config` (`order`, `visible`, `changeable`, `required`, `type`, `id`, `value`, `grouped`, `help`) VALUES INSERT IGNORE INTO `config` (`order`, `visible`, `changeable`, `required`, `type`, `id`, `value`, `grouped`, `help`) VALUES
('001', 1, 1, 1, 'string', 'appname', 'Ninestat', '', 'Le titre de votre site'), ('001', 1, 1, 1, 'string', 'appname', 'Ninestat', '', 'Le titre de votre site'),
('002', 1, 0, 1, 'string', 'version', '1.0.0', '', 'Version de l\'application'), ('002', 1, 0, 1, 'string', 'version', '1.0.0', '', 'Version de l\'application'),
('003', 1, 1, 0, 'string', 'subappname', 'Statistiques Envole', '', 'Le sous titre de votre site'), ('003', 1, 1, 0, 'string', 'subappname', 'Statistique Envole', '', 'Le sous titre de votre site'),
('004', 1, 1, 1, 'logo', 'logo', 'uploads/logo/logo.png', '', 'Le logo de votre site'), ('004', 1, 1, 1, 'logo', 'logo', 'uploads/logo/logo.png', '', 'Le logo de votre site'),
('005', 0, 1, 0, 'theme', 'theme', '', '', 'Le theme de votre site'), ('005', 0, 1, 0, 'theme', 'theme', '', '', 'Le theme de votre site'),
('006', 0, 1, 0, 'datauser', 'datauser', '', '', 'Parametrage des champs utilisateurs : obligatoire / facultatif / caché'), ('006', 0, 1, 0, 'datauser', 'datauser', '', '', 'Parametrage des champs utilisateurs : obligatoire / facultatif / caché'),
@ -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

@ -58,19 +58,18 @@ class ApiController extends Controller
foreach($apps as $app) { foreach($apps as $app) {
$tmp=explode("-",$app); $tmp=explode("-",$app);
$tmpname=""; $tmpname="";
for($i=1;$i<count($tmp)-2;$i++) { for($i=0;$i<count($tmp)-2;$i++) {
$tmpname.=$tmp[$i]; $tmpname.=$tmp[$i];
if(($i+1)<(count($tmp)-2)) $tmpname.="-"; if(($i+1)<(count($tmp)-2)) $tmpname.="-";
} }
if($tmpname=="moodle-update") $tmpname="moodle";
if($this->fgdebug) echo $tmpname."<br>"; if($this->fgdebug) echo $tmpname."<br>";
$tbapps["$tmpname"]=$app; $tbapps["$tmpname"]=$app;
} }
// Pour chaque apps // Pour chaque apps
foreach($tbapps as $name => $version) { foreach($tbapps as $package => $version) {
$application=$em->getRepository('CadolesCoreBundle:Application')->findOneBy(["name"=>$name]); $application=$em->getRepository('CadolesCoreBundle:Application')->findOneBy(["package"=>$package]);
if($application) { if($application) {
$serveurapplication=$em->getRepository('CadolesCoreBundle:ServerApplication')->findOneBy(["server"=>$server,"application"=>$application]); $serveurapplication=$em->getRepository('CadolesCoreBundle:ServerApplication')->findOneBy(["server"=>$server,"application"=>$application]);
if(!$serveurapplication) { if(!$serveurapplication) {

View File

@ -0,0 +1,140 @@
<?php
namespace Cadoles\CoreBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Cadoles\CoreBundle\Entity\Application;
use Cadoles\CoreBundle\Form\ApplicationType;
class ApplicationController extends Controller
{
private $labelentity = 'CadolesCoreBundle:Application';
public function listAction(Request $request)
{
$em = $this->getDoctrine()->getManager();
$applications = $em->getRepository($this->labelentity)->findAll();
return $this->render('CadolesCoreBundle:Application:list.html.twig',[
"applications"=>$applications,
"useheader"=>true,
"usesidebar"=>true,
"usemenu"=>false
]);
}
public function submitAction(Request $request)
{
// Initialisation de l'enregistrement
$em = $this->getDoctrine()->getManager();
$data = new Application();
// Création du formulaire
$form = $this->createForm(ApplicationType::class,$data,array("mode"=>"submit"));
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur erreur
$this->getErrorForm(null,$form,$request,$data,"submit");
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
$em->persist($data);
$em->flush();
// Retour à la liste
return $this->redirectToRoute("cadoles_core_config_application");
}
// Affichage du formulaire
return $this->render($this->labelentity.':edit.html.twig', [
'useheader' => true,
'usesidebar' => true,
'usemenu' => false,
'application' => $data,
'mode' => 'submit',
'form' => $form->createView()
]);
}
public function updateAction($id,Request $request)
{
// Initialisation de l'enregistrement
$em = $this->getDoctrine()->getManager();
$data=$em->getRepository($this->labelentity)->find($id);
// Création du formulaire
$form = $this->createForm(ApplicationType::class,$data,array("mode"=>"update"));
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur erreur
$this->getErrorForm(null,$form,$request,$data,"update");
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
$em->persist($data);
$em->flush();
// Retour à la liste
return $this->redirectToRoute("cadoles_core_config_application");
}
// Affichage du formulaire
return $this->render($this->labelentity.':edit.html.twig', [
'useheader' => true,
'usesidebar' => true,
'usemenu' => false,
'application' => $data,
'mode' => 'update',
'form' => $form->createView()
]);
}
public function deleteAction($id,Request $request)
{
// Initialisation de l'enregistrement
$em = $this->getDoctrine()->getManager();
$data=$em->getRepository($this->labelentity)->find($id);
$error=false;
if($error)
return $this->redirectToRoute("cadoles_core_config_application_update",["id"=>$id]);
else {
$em->remove($data);
$em->flush();
// Retour à la liste
return $this->redirectToRoute("cadoles_core_config_application");
}
}
protected function getErrorForm($id,$form,$request,$data,$mode) {
if ($form->get('submit')->isClicked()&&$mode=="delete") {
}
if ($form->get('submit')->isClicked() && $mode=="submit") {
}
if ($form->get('submit')->isClicked() && !$form->isValid()) {
$this->get('session')->getFlashBag()->clear();
$validator = $this->get('validator');
$errors = $validator->validate($data);
foreach( $errors as $error ) {
$request->getSession()->getFlashBag()->add("error", $error->getMessage());
}
$errors = $form->getErrors();
foreach( $errors as $error ) {
$request->getSession()->getFlashBag()->add("error", $error->getMessage());
}
}
}
}

View File

@ -69,13 +69,42 @@ class CoreController extends Controller
} }
// Total servers
$servers = $em->getRepository("CadolesCoreBundle:Server")->findAll(); $servers = $em->getRepository("CadolesCoreBundle:Server")->findAll();
// Total by module
$totalmodules = $em->createQueryBuilder()
->select('COUNT(s.module) total','s.module label')
->from('CadolesCoreBundle:Server','s')
->groupBy('s.module');
// Total by version
$totalversions = $em->createQueryBuilder()
->select('COUNT(s.version) total','s.version label')
->from('CadolesCoreBundle:Server','s')
->groupBy('s.version');
// Total applications
$applications = $em->getRepository("CadolesCoreBundle:ServerApplication")->findAll();
// Total by apps
$totalapplications = $em->createQueryBuilder()
->select('COUNT(a.package) total','a.name label')
->from('CadolesCoreBundle:ServerApplication','sa')
->from('CadolesCoreBundle:Application','a')
->where('sa.application=a.id')
->groupBy('a.package')
->orderBy('total','DESC');
return $this->render('CadolesCoreBundle:Core:home.html.twig',[ return $this->render('CadolesCoreBundle:Core:home.html.twig',[
'useheader' => true, 'useheader' => true,
'usemenu' => false, 'usemenu' => false,
'usesidebar' => false, 'usesidebar' => false,
'servers' => $servers, 'totalserveurs' => count($servers),
'totalbymodules' => $totalmodules->getQuery()->getResult(),
'totalbyversions' => $totalversions->getQuery()->getResult(),
'totalapplications' => count($applications),
'totalbyapplications' => $totalapplications->getQuery()->getResult()
]); ]);
} }
} }

View File

@ -8,9 +8,6 @@ use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Filesystem\Filesystem;
use Cadoles\CoreBundle\Entity\Scrum;
use Cadoles\CoreBundle\Form\ScrumType;
class GroupController extends Controller class GroupController extends Controller
{ {
private $labelentity="CadolesCoreBundle:Group"; private $labelentity="CadolesCoreBundle:Group";

View File

@ -0,0 +1,61 @@
<?php
namespace Cadoles\CoreBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\ButtonType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\EntityManager;
class ApplicationType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('submit',
SubmitType::class, [
"label" => "Valider",
"attr" => ["class" => "btn btn-success"]
]
);
$builder->add('name',
TextType::class, [
"label" =>"Nom"
]
);
$builder->add('package',
TextType::class, [
"label" =>"Paquet"
]
);
$builder->add('description',
TextareaType::class, [
"label" =>"Paquet",
"required" => false,
"attr" => array("rows" => '4')
]
);
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'Cadoles\CoreBundle\Entity\Application',
'mode' => 'string'
));
}
}

View File

@ -1,79 +0,0 @@
<?php
namespace Cadoles\CoreBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\ButtonType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\ColorType;
use Cadoles\CoreBundle\Form\IconChoiceType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Ivory\CKEditorBundle\Form\Type\CKEditorType;
use Tetranz\Select2EntityBundle\Form\Type\Select2EntityType;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\EntityManager;
class ScrumType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
if($options["mode"]!="view") {
$builder
->add('submit', SubmitType::class, [
'label' => 'Valider',
'attr' => ['class' => 'btn btn-success']
]);
$builder
->add('title', TextType::class, [
'label' => 'Titre',
'attr' => ['class' => 'form-control', 'style' => 'margin-bottom:15px']
]);
$builder
->add('groups', Select2EntityType::class, [
'label' => 'Visible pour les Groupes',
'class' => 'CadolesCoreBundle:Group',
'text_property' => 'label',
'multiple' => true,
'remote_route' => 'cadoles_core_user_group_ajax_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 un groupe',
]);
}
else {
$builder
->add('description',CKEditorType::class,[
'config_name' => 'full_config',
'label' => 'Description',
'mapped' => false,
'required' => false,
'config' => ['height' => '300px','filebrowserUploadRoute' => 'cadoles_core_user_scrum_upload'],
]);
}
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'Cadoles\CoreBundle\Entity\Scrum',
'mode' => "string"
));
}
}

View File

@ -144,5 +144,20 @@ cadoles_core_api:
defaults: { _controller: CadolesCoreBundle:Api:api} defaults: { _controller: CadolesCoreBundle:Api:api}
methods: ["post"] methods: ["post"]
#== Application ============================================================================================================
cadoles_core_config_application:
path: /config/application
defaults: { _controller: CadolesCoreBundle:Application:list }
cadoles_core_config_application_submit:
path: /config/application/submit
defaults: { _controller: CadolesCoreBundle:Application:submit }
cadoles_core_config_application_update:
path: /config/application/update/{id}
defaults: { _controller: CadolesCoreBundle:Application:update }
cadoles_core_config_application_delete:
path: /config/application/delete/{id}
defaults: { _controller: CadolesCoreBundle:Application:delete }

View File

@ -0,0 +1,61 @@
{% extends 'CadolesCoreBundle::base.html.twig' %}
{% block pagewrapper %}
{{ form_start(form) }}
<h1 class="page-header">
{% if mode=="update" %}
Modification APPLICATION
{% elseif mode=="submit" %}
Création APPLICATION
{% endif %}
</h1>
{{ form_widget(form.submit) }}
<a class="btn btn-secondary" href={{ path('cadoles_core_config_application') }}>Annuler</a>
{% if mode=="update" %}
<a href="{{ path('cadoles_core_config_application_delete',{'id':application.id}) }}"
class="btn btn-danger float-right"
data-method="delete"
data-confirm="Êtes-vous sûr de vouloir supprimer cet entregistrement ?">
Supprimer
</a>
{% endif %}
<br><br>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{% if app.session.flashbag.has('notice') %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{% for flashMessage in app.session.flashbag.get('notice') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-table fa-fw"></i> Information
</div>
<div class="panel-body">
{{ form_row(form.name) }}
{{ form_row(form.package) }}
{{ form_row(form.description) }}
</div>
</div>
{{ form_end(form) }}
{% endblock %}
{% block localjavascript %}
{% endblock %}

View File

@ -0,0 +1,51 @@
{% extends "CadolesCoreBundle::base.html.twig" %}
{% block pagewrapper %}
<h1 class="page-header">
APPLICATIONS
</h1>
<p><a class="btn btn-success" href={{ path('cadoles_core_config_application_submit') }}>Ajouter</a></p>
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-table fa-fw"></i> Liste des Applications
</div>
<div class="panel-body">
<div class="dataTable_wrapper">
<table class="table table-striped table-bordered table-hover" id="dataTables" style="width:100%">
<thead>
<tr>
<th width="70px" class="no-sort">Action</th>
<th>Application</th>
<th class="no-string">Paquet</th>
</tr>
</thead>
<tbody>
{% for application in applications %}
<tr>
<td>
<a href="{{path("cadoles_core_config_application_update",{id:application.id})}}"><i class="fa fa-file"></i></a>
</td>
<td>{{application.name}}</td>
<td>{{application.package}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endblock %}
{% block localjavascript %}
$(document).ready(function() {
$('#dataTables').DataTable({
columnDefs: [ { "targets": "no-sort", "orderable": false }, { "targets": "no-string", "type" : "num" } ],
responsive: true,
iDisplayLength: 100,
order: [[ 1, "asc" ]]
});
});
{% endblock %}

View File

@ -1,24 +1,108 @@
{% extends '@CadolesCore/base.html.twig' %} {% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %} {% block pagewrapper %}
<div class="row"> <div class="row" style="margin-top:20px">
<div style="width: 400px;margin: auto;text-align: center;margin-top: 50px;"> <div class="col-md-6" style="padding:20px;text-align:center;">
<a href="{{ path("cadoles_core_home") }}"> <div class="col-md-12">
<img id="logo" src="/{{ alias }}/{{ app.session.get('logo') }}"> <h1 style="margin-top:0px"><i class="fa fa-server fa-fw"></i>Serveurs = {{ totalserveurs }} </h1>
</div>
<h1>{{ app.session.get('appname') }}</h1>
</a> <div class="col-md-6" >
<h1>Serveurs par Module</h1>
<div id='bymodule-chart'></div>
<div id="bymodule-legend"></div>
</div>
<div class="col-md-6" >
<h1>Serveurs par Version</h1>
<div id='byversion-chart'></div>
<div id="byversion-legend"></div>
</div>
</div>
<div class="col-md-6" style="padding:20px;text-align:center;margin: 0px;">
<div class="col-md-12">
<h1 style="margin-top:0px; margin-bottom:25px""><i class="fa fa-cubes fa-fw"></i>Applications = {{ totalapplications }} </h1>
</div>
<h1>Applications Installées</h1>
<div class="col-md-8" >
<div id='byapplication-chart'></div>
</div>
<div id="byapplication-legend" class="col-md-4"></div>
</div> </div>
</div> </div>
<div id='morris-donut-chart'></div>
{% endblock %} {% endblock %}
{% block localjavascript %} {% block localjavascript %}
$(document).ready(function() { $(document).ready(function() {
Morris.Donut({ //== byModule
element: 'morris-donut-chart', var bymodule = Morris.Donut({
data: [ {'label':'01','value':100},{'label':'02','value':200} ], element: 'bymodule-chart',
data: [
{% for total in totalbymodules %}
{'label':'{{ total.label }}','value':{{ total.total }}},
{% endfor %}
],
resize: true resize: true
}); });
bymodule.options.data.forEach(function(label, i) {
var legendItem = $('<span style="margin:auto; width: 50%;display: block;text-align: left;"></span>').text( label['label'] + " ( " +label['value'] + " )" ).prepend('<span>&nbsp;</span>');
legendItem.find('span')
.css('backgroundColor', bymodule.options.colors[i])
.css('width', '20px')
.css('display', 'inline-block')
.css('margin', '5px');
$('#bymodule-legend').append(legendItem)
});
//== byVersion
var byversion = Morris.Donut({
element: 'byversion-chart',
data: [
{% for total in totalbyversions %}
{'label':'{{ total.label }}','value':{{ total.total }}},
{% endfor %}
],
resize: true
});
byversion.options.data.forEach(function(label, i) {
var legendItem = $('<span style="margin:auto; width: 50%;display: block;text-align: left;"></span>').text( label['label'] + " ( " +label['value'] + " )" ).prepend('<span>&nbsp;</span>');
legendItem.find('span')
.css('backgroundColor', byversion.options.colors[i])
.css('width', '20px')
.css('display', 'inline-block')
.css('margin', '5px');
$('#byversion-legend').append(legendItem)
});
//== byApplication
var byapplication = Morris.Donut({
element: 'byapplication-chart',
data: [
{% for total in totalbyapplications %}
{
'label':'{{ total.label }}',
'value':{{ total.total }},
},
{% endfor %}
],
resize: true
});
byapplication.options.data.forEach(function(label, i) {
var legendItem = $('<span style="display: block;text-align: left;"></span>').text( label['label'] + " ( " +label['value'] + " )" ).prepend('<span>&nbsp;</span>');
legendItem.find('span')
.css('backgroundColor', byapplication.options.colors[i])
.css('width', '20px')
.css('display', 'inline-block')
.css('margin', '0px 5px 5px 0px');
$('#byapplication-legend').append(legendItem)
});
}); });
{% endblock %} {% endblock %}

View File

@ -21,6 +21,12 @@
<i class="fa fa-child fa-fw"></i> Utilisateurs</i> <i class="fa fa-child fa-fw"></i> Utilisateurs</i>
</a> </a>
</li> </li>
<li>
<a href="{{ path('cadoles_core_config_application') }}">
<i class="fa fa-cubes fa-fw"></i> Applications</i>
</a>
</li>
</ul> </ul>
</li> </li>