Mise à jour affichage des critères

This commit is contained in:
Michael RICOIS 2015-01-23 14:39:25 +00:00
parent e4cb72d7c0
commit 0eb0240d27
10 changed files with 186 additions and 234 deletions

View File

@ -138,8 +138,8 @@ class DashboardController extends Zend_Controller_Action
public function ciblageAction()
{
$request = $this->getRequest();
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$comptageId = $request->getParam('id');
@ -164,29 +164,58 @@ class DashboardController extends Zend_Controller_Action
//Construction affichage des critères
$infosCriteres = array();
$allFields = $fields->getItems(true);
foreach ( $allFields as $key => $params ) {
foreach ( $allFields as $key => $params )
{
$valueSelected = $sessionValue->getSelectedValue($key);
if ( $valueSelected !== false ) {
$inValue = $valueSelected['in'];
$exValue = $valueSelected['ex'];
if ( $valueSelected !== null ) {
$isMultiple = $fields->isMultiple($key);
$inValue = array();
if ( array_key_exists('in', $valueSelected) ) {
$inValue = $valueSelected['in'];
}
$exValue = array();
if ( array_key_exists('in', $valueSelected) ) {
$exValue = $valueSelected['ex'];
}
Zend_Registry::get('firebug')->info($key);
Zend_Registry::get('firebug')->info($inValue);
$inLabel = array();
if ( count($inValue)>0 ) {
if ( is_array($inValue) && count($inValue) > 0 ) {
foreach ( $inValue as $value ) {
if ( array_key_exists($value, $params['values']) ) {
if ( $isMultiple === true ) {
$inLabel[] = $fields->labelValueDetail($key, $value);
}
else if ( array_key_exists($value, $params['values']) ) {
$inLabel[] = $params['values'][$value];
}
}
} else {
if ( array_key_exists($inValue, $params['values']) ) {
$inLabel[] = $params['values'][$inValue];
}
}
$exLabel = array();
if ( count($exValue)>0 ) {
if ( is_array($exValue) && count($exValue)>0 ) {
foreach ( $exValue as $value ) {
if ( array_key_exists($value, $params['values']) ) {
if ( $isMultiple === true ) {
$inLabel[] = $fields->labelValueDetail($key, $value);
}
else if ( array_key_exists($value, $params['values']) ) {
$exLabel[] = $params['values'][$value];
}
}
} else {
if ( array_key_exists($exValue, $params['values']) ) {
$exLabel[] = $params['values'][$inValue];
}
}
$infosCriteres[$key] = array(
'label' => $params['label'],

View File

@ -373,7 +373,7 @@ class GestionController extends Zend_Controller_Action
}
}
$this->view->infos = $infosCriteres;
$this->view->criteres = $infosCriteres;
}

View File

@ -1,51 +1,56 @@
<ul class="chemin clearfix rounded_t">
<li class="e0"><a class="lir" href="/">Accueil</a></li>
<li><a href="/dashboard/index"><span>Tableau de bord</span></a></li>
<li class="last"><span>Detail du ciblage (<?=$this->comptageRef?>)</span></li>
</ul>
<div class="container">
<div id="dashboard" style="padding:10px">
<div class="btn-group" style="margin-bottom:10px;">
<a type="button" class="btn btn-default" href="<?=$this->url(array('controller'=> 'index','action'=>'index',
'id'=>$this->comptageId))?>">Charger les critères de ciblage dans l'interface</a>
<a type="button" class="btn btn-default update" href="<?=$this->url(array('controller'=> 'comptage',
'action'=>'update', 'id'=>$this->comptageId))?>">Actualiser le comptage</a>
<a type="button" class="btn btn-default enrichissementref" href="<?=$this->url(array('controller'=> 'enrichissement',
'action'=>'reference', 'id'=>$this->comptageId))?>">Commander un enrichissement</a>
</div>
<a href="<?=$this->url(array('controller'=> 'index','action'=>'index', 'id'=>$this->comptageId))?>">Charger les critères de ciblage dans l'interface</a> |
<a class="update" href="<?=$this->url(array('controller'=> 'comptage','action'=>'update', 'id'=>$this->comptageId))?>">Actualiser le comptage</a> |
<a class="enrichissementref" href="<?=$this->url(array('controller'=> 'enrichissement','action'=>'reference', 'id'=>$this->comptageId))?>">Commander un enrichissement</a>
<fieldset>
<legend>Critères</legend>
<div id="dashboard">
<div class="panel panel-info">
<div class="panel-heading"><h3 class="panel-title">Critères</h3></div>
<table class="table table-bordered table-condensed">
<?php foreach ( $this->criteres as $criteres ) { ?>
<div>
<h3><?=$criteres['label']?></h3>
<?php if (is_string($criteres['in'])) {?>
<div><?=$criteres['in']?></div>
<?php } else {?>
<?php if ( is_array($criteres['in']) && count($criteres['in'])>0 ) { ?>
<div>
<p>Inclus :</p>
<tr class="active">
<td colspan="2"><?=$criteres['label']?></td>
</tr>
<?php if ( is_string($criteres['in']) ) {?>
<tr>
<td><?=$criteres['in']?></td>
<td>Calcul intermédiaire</td>
</tr>
<?php } else {?>
<?php if ( is_array($criteres['in']) && count($criteres['in'])>0 ) { ?>
<?php foreach( $criteres['in'] as $item ) {?>
<p><?=$item?></p>
<tr>
<td><?=$item?><span class="label label-success pull-right">inclus</span></td>
<td>Calcul intermédiaire</td>
</tr>
<?php }?>
</div>
<?php }?>
<?php if ( is_array($criteres['ex']) && count($criteres['ex'])>0 ) { ?>
<div>
<p>Exclus :</p>
<?php foreach( $criteres['ex'] as $item ) {?>
<p><?=$item?></p>
<tr>
<td><?=$item?><span class="label label-danger pull-right">exclus</span></td>
<td>Calcul intermédiaire</td>
</tr>
<?php }?>
</div>
<?php }?>
<?php }?>
<?php }?>
</div>
<?php }?>
</fieldset>
</table>
</div>
<fieldset>
<legend>Comptages</legend>
<table class="comptages" style="width:100%">
<div class="panel panel-info">
<div class="panel-heading"><h3 class="panel-title">Comptages</h3></div>
<table class="comptage table table-bordered">
<thead>
<tr>
<th>Date</th>
@ -54,23 +59,22 @@
</tr>
</thead>
<tbody>
<?php foreach($this->comptages as $comptage):?>
<?php foreach($this->comptages as $comptage) {?>
<tr>
<th><?=substr($comptage['dateAjout'],8,2).'/'.substr($comptage['dateAjout'],5,2).'/'.substr($comptage['dateAjout'],0,4)
.' '.substr($comptage['dateAjout'],11,2).':'.substr($comptage['dateAjout'],14,2).':'.substr($comptage['dateAjout'],17,2)?></th>
<th><?=number_format($comptage['resultat'], 0, '', ' ')?></th>
<th><?=number_format($comptage['uniteInsee'], 0, '', ' ')?></th>
</tr>
<?php endforeach;?>
<?php }?>
</tbody>
</table>
</fieldset>
</table>
</div>
<fieldset>
<legend>Enrichissements</legend>
<?php if ( count($this->enrichissements)>0 ) {?>
<table style="width:100%">
<div class="panel panel-info">
<div class="panel-heading"><h3 class="panel-title">Enrichissements</h3></div>
<?php if ( count($this->enrichissements) > 0 ) {?>
<table class="table table-bordered">
<thead>
<tr>
<th>Date</th>
@ -80,48 +84,52 @@
</tr>
</thead>
<tbody>
<?php foreach($this->enrichissements as $item):?>
<?php foreach($this->enrichissements as $item) {?>
<tr>
<th><?=$item['dateAdded']?></th>
<th><?=$item['reference']?></th>
<th><?=number_format($item['nbLigneTotales'], 0, '', ' ')?></th>
<td>
<?php if($item['dateStart']>0): ?>
<?php if($item['dateStart']>0) { ?>
<a href="/enrichissement/download/id/<?=$item['id']?>"><?=$item['fichier']?></a>
<?php else: ?>
<?php } else { ?>
En attente de traitement
<?php endif; ?>
<?php }?>
</td>
</tr>
<?php endforeach;?>
<?php }?>
</tbody>
</table>
<?php } else {?>
<div class="panel-body">
<a href="#myModal" role="button" class="btn btn-primary" data-toggle="modal" data-load-remote="<?=$this->url(array('controller'=> 'enrichissement','action'=>'reference', 'id'=>$this->comptageId))?>" data-remote-target="#myModal .modal-body">Commander un enrichissement</a>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">Commande d'un enrichissment</h4>
</div>
<div class="modal-body">
Chargement...
<div class="progress progress-striped active">
<div class="progress-bar" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 100%">
<span class="sr-only">100% Complete</span>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary submit">Save changes</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">Commande d'un enrichissment</h4>
</div>
<div class="modal-body">
Chargement...
<div class="progress progress-striped active">
<div class="progress-bar" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 100%">
<span class="sr-only">100% Complete</span>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary submit">Save changes</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</div>
<?php }?>
</fieldset>
</div>
</div>
</div>

View File

@ -1,5 +1,4 @@
<div class="container">
<div id="dashboard">
<div id="dashboard" class="container">
<h2>Liste de vos ciblages</h2>
@ -29,6 +28,7 @@
</tbody>
</table>
<?php if (count($this->page)>1) {?>
<div class="btn-group">
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'ciblages', 'page'=>1), null, true)?>" class="btn btn-default">&laquo;</a>
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'ciblages', 'page'=>$this->page-1), null, true)?>" class="btn btn-default">&lsaquo;</a>
@ -36,10 +36,10 @@
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'ciblages', 'page'=>$this->page+1), null, true)?>" class="btn btn-default">&rsaquo;</a>
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'ciblages', 'page'=>$this->nbPages), null, true)?>" class="btn btn-default">&raquo;</a>
</div>
<?php }?>
<?php } else {?>
<p>Aucun ciblage.<p>
<?php }?>
</div>
</div>

View File

@ -16,7 +16,7 @@
<div id="lastCiblage">
<h2><?=$this->translate('Vos derniers ciblages')?></h2>
<?php if(count($this->comptages) > 0):?>
<table>
<table class="table table-bordered">
<thead>
<tr>
<th><?=$this->translate('Référence')?></th>
@ -48,7 +48,7 @@
<div id="lastEnrichissement">
<h2><?=$this->translate('Vos derniers enrichissements')?></h2>
<?php if(count($this->enrichissements) > 0):?>
<table>
<table class="table table-bordered">
<thead>
<tr>
<th>Référence</th>

View File

@ -1,21 +1,28 @@
<?php if (count($this->inLabels)>0) {?>
<div class="list-group">
<ul class="list-group">
<?php foreach ($this->inLabels as $i => $item) {?>
<a href="<?=$this->url(array('controller'=>'index', 'action'=>'remove', 'critere'=>$this->critereName, 'in'=>$i ),
null, true)?>" class="list-group-item remove"><?=$item?>
<button type="button" class="close"><span aria-hidden="true">&times;</span><span class="sr-only">Supprimer</span></button>
</a>
<li class="list-group-item">
<a class="close" href="<<?=$this->url(array('controller'=>'index', 'action'=>'remove',
'critere'=>$this->critereName, 'in'=>$i ), 'default', true)?>" aria-hidden="true">&times;</a>
<?=$item?>
</li>
<?php }?>
</div>
</ul>
<?php }?>
<?php if (count($this->exLabels)>0) {?>
<div class="list-group">
<ul class="list-group">
<?php foreach ($this->exLabels as $i => $item) {?>
<a href="<?=$this->url(array('controller'=>'index', 'action'=>'remove', 'critere'=>$this->critereName, 'ex'=>$i ),
null, true)?>" class="list-group-item remove"><?=$item?>
<button type="button" class="close"><span aria-hidden="true">&times;</span><span class="sr-only">Supprimer</span></button>
</a>
<li class="list-group-item">
<a class="close" title="Supprimer" href="<?=$this->url(array('controller'=>'index',
'action'=>'remove', 'critere'=>$this->critereName, 'ex'=>$i ), 'default', true)?>"
aria-hidden="true">&times;</a>
<?=$item?>
</li>
<?php }?>
</div>
</ul>
<?php }?>

View File

@ -260,7 +260,6 @@ class Scores_Ciblage_FieldList
'minmax' => 'number',
'activated' => true,
),
'geo' => array(
'label' => "Localisation géographique",
'desc' => "",
@ -271,7 +270,6 @@ class Scores_Ciblage_FieldList
),
'activated' => true,
),
'geo_domtom' => array(
'label' => "Exclure les DOM-TOM",
'desc' => "Exclure les établissements situés dans les DOM-TOM",
@ -853,12 +851,12 @@ class Scores_Ciblage_FieldList
$values = $info['values'];
}
//Override info with values from getMinMax
// --- Override info with values from getMinMax
if ( array_key_exists('minmax', $info) ) {
$values = $this->getMinMax($key);
}
//Override info with values from Database - Mettre en cache
// --- Override info with values from Database - Mettre en cache
if ( array_key_exists('sql', $info) ) {
$values = $this->getDbValues($key);
}
@ -868,7 +866,7 @@ class Scores_Ciblage_FieldList
public function isMultiple($key)
{
if ( is_array( $this->items[$key]['type']) ) {
if ( is_array($this->items[$key]['type']) ) {
return true;
}
@ -1484,11 +1482,18 @@ class Scores_Ciblage_FieldList
case 'geo':
return $this->labelValueGeo($value);
break;
case 'cj':
return $this->labelValueCj($value);
break;
case 'ape_etab':
case 'ape_entrep':
return $this->labelValueApe($value);
break;
}
}
/**
*
* Label pour geo
* @param unknown $code
* @return boolean
*/
@ -1518,7 +1523,32 @@ class Scores_Ciblage_FieldList
$communes = $codePostauxM->fetchRow($sql);
return $communes->Commune;
}
return false;
}
/**
* Label pour cj
* @param unknown $code
*/
protected function labelValueCj($code)
{
$fjM = new Application_Model_CiblageFormeJuridique();
$sql = $fjM->select()->where('fjCode = ?', $code);
$result = $fjM->fetchRow($sql);
return $result->fjLibelle;
}
/**
* Label pour ape_etab et ape_entrep
* @param unknown $code
*/
protected function labelValueApe($code)
{
$nafM = new Application_Model_CiblageNaf();
$sql = $nafM->select()->where('code = ?', $code);
$result = $nafM->fetchRow($sql);
return $result->lib;
}
}

View File

@ -13,7 +13,7 @@ $(document).ready(function(){
bgiframe: true,
title: title,
width: 500,
height: 200,
height: 500,
modal: true,
open: function(event, ui) {
$(this).html('Chargement...').load(href);

View File

@ -1,55 +1,3 @@
#dashboard {
background-color:#ffffff;
}
#dashboard h2 {
margin:10px 0;
}
#dashboard .reference {
font-weight:bold;
}
#dashboard .date {
font-style: italic;
}
#dashboard fieldset {
border:1px solid black;
padding: 10px 20px;
}
#dashboard table {
border-collapse: separate;
width:100%;
}
#dashboard tr th , #dashboard tr td {
height:20px;
padding:5px;
border:1px solid silver;
margin-top:2px;
}
#dashboard tbody tr {
background-repeat: repeat-x;
}
#dashboard thead tr {
background-color: #DFE8E7;
}
#dashboard tbody tr:hover {
background-repeat: repeat-x;
}
#dashboard .previsua
{
border-collapse: separate;
border-spacing: 1px 1px;
font-size:12px;
}
#rechercheCiblage {
margin:5px 0;
}
@ -86,74 +34,4 @@ ul.ui-autocomplete {
#lastEnrichissement {
margin:5px 0;
}
.rounded_t {
border-radius: 5px 5px 0 0;
position: relative;
z-index: 1;
}
.chemin {
background: url("/themes/default/images/chemin/bg-blanc.gif") repeat-x scroll left center transparent;
/*border: 1px solid #C8C8C8;*/
color: #00288C;
font-size: 14px;
height: 30px;
line-height: 30px;
/*padding-right: 35px;*/
position: relative;
/*width: 958px;*/
z-index: 3;
}
.chemin .e0 {
background: url("/themes/default/images/chemin/bg-gris.gif") repeat-x scroll 0 0 transparent;
padding: 0;
}
.chemin li {
background: url("/themes/default/images/chemin/fleche1.gif") no-repeat scroll 0 0 transparent;
float: left;
list-style: none outside none;
padding-left: 20px;
}
.chemin .e0 a {
background: url("/themes/default/images/chemin/ico-home.gif") no-repeat scroll 0 0 transparent;
padding: 30px 0 0;
width: 34px;
}
.chemin li a {
background: url("/themes/default/images/chemin/bg-gris.gif") repeat-x scroll 0 0 transparent;
color: #FFFFFF;
float: left;
padding: 0 12px 0 9px;
}
.chemin a {
text-decoration: none;
}
.lir {
background-repeat: no-repeat;
height: 0 !important;
overflow: hidden;
}
.chemin .last {
display: block;
float: none;
}
.chemin .last h1, .chemin .last span, .chemin .last h1, .chemin .last a {
background: url("/themes/default/images/chemin/fleche2.gif") no-repeat scroll 0 0 transparent;
color: #141414;
display: block;
height: 30px;
line-height: 30px;
overflow: hidden;
padding-left: 28px;
text-decoration: none;
}

View File

@ -24,7 +24,6 @@ body {
background-color: #f5f5f5;
}
/* Custom page CSS
-------------------------------------------------- */
/* Not required for template or sticky footer method. */
@ -43,10 +42,11 @@ code {
}
#panel div.alert {
margin-bottom:0 !important;
margin-bottom:0 !important;
}
div.ciblage-tag-items span.label {
display:inline-block;
margin:2px;
}
display:inline-block;
margin:2px;
}