Affichage des criteres d'un ciblage client

This commit is contained in:
Michael RICOIS 2013-01-09 11:38:22 +00:00
parent e1305a5365
commit 75e191cbf0
3 changed files with 91 additions and 2 deletions

View File

@ -255,9 +255,41 @@ class GestionController extends Zend_Controller_Action
$this->view->comptages = $comptages;
}
/**
* Affichage des critères du ciblage
*/
public function ciblagecriteresAction()
{
$this->_helper->layout()->disableLayout();
$request = $this->getRequest();
$id = $request->getParam('id');
//Lecture des paramètres du ciblage
$criteresM = new Application_Model_Criteres();
$sql = $criteresM->select()
->where('id = ?', $id);
$criteres = $criteresM->fetchRow($sql)->toArray();
$decodeCriteres = json_decode($criteres['criteres'], true);
$fields = new Scores_Fields();
//Construction affichage des critères
foreach ( $decodeCriteres as $key => $item ) {
$inValue = $fields->getValueLabel($key, $item['in']);
$exValue = $fields->getValueLabel($key, $item['ex']);
//Add label to struct for display
$infosCriteres[] = array(
'label' => $fields->getLabel($key),
'in' => $inValue,
'ex' => $exValue,
);
}
$this->view->criteres = $infosCriteres;
}
/**

View File

@ -0,0 +1,32 @@
<fieldset>
<legend>Critères</legend>
<?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>
<?php foreach( $criteres['in'] as $item ) {?>
<p><?=$item?></p>
<?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>
<?php }?>
</div>
<?php }?>
<?php }?>
</div>
<?php }?>
</fieldset>

View File

@ -30,7 +30,7 @@ $Years = date('Y') - $YearBegin;
<th><b>Actions</b></th>
</tr>
<?php foreach($this->comptages as $comptage): ?>
<tr>
<tr id="<?=$comptage['idDefinition']?>">
<td><?=$comptage['idDefinition']?></td>
<td><?=$comptage['dateAjout']?></td>
<td><?=$comptage['reference']?></td>
@ -43,4 +43,29 @@ $Years = date('Y') - $YearBegin;
<?php endforeach; ?>
</table>
</div>
</div>
</div>
<script>
$('table tr').on('click', function(){
var href = '/gestion/ciblagecriteres/id/'+$(this).attr('id');
if (href!='#' || href!='') {
var title = $(this).attr('title');
var dialogOpts = {
bgiframe: true,
title: title,
width: 650,
height: 600,
modal: true,
open: function(event, ui) {
$(this).html('Chargement...');
$(this).load(href);
},
buttons: {
Quitter: function() { $(this).dialog('close'); }
},
close: function() { $('#dialog').remove(); }
};
$('<div id="dialog"></div>').dialog(dialogOpts);
return false;
}
});
</script>