This commit is contained in:
Michael RICOIS 2014-07-16 19:02:47 +00:00
parent b627553f6b
commit 210701a2c9
17 changed files with 209 additions and 221 deletions

View File

@ -4,10 +4,8 @@ class DashboardController extends Zend_Controller_Action
public function init()
{
$this->view->headLink()
->appendStylesheet('/themes/default/styles/dashboard.css', 'all')
->appendStylesheet('/libs/jqpagination/jqpagination.css', 'all');
->appendStylesheet('/themes/default/styles/dashboard.css', 'all');
$this->view->headScript()
->appendFile('/libs/jqpagination/jquery.jqpagination.min.js', 'text/javascript')
->appendFile('/themes/default/scripts/dashboard.js', 'text/javascript');
}
@ -377,8 +375,7 @@ class DashboardController extends Zend_Controller_Action
$result = $profilsM->fetchRow($sql);
if ($result) {
$criteres = json_decode($result['criteres'], true);
require_once 'Scores/Enrichissement.php';
$enrichissement = new Enrichissement();
$enrichissement = new Scores_Ciblage_Extract();
$data = $enrichissement->getFields();
$profilLabels = array();
foreach ( $data as $key => $item ) {

View File

@ -16,6 +16,7 @@ class FieldsController extends Zend_Controller_Action
->appendFile('/libs/tree-3.0.2/jstree.min.js', 'text/javascript')
->appendFile('/libs/slider/bootstrap-slider.min.js')
->appendFile('/libs/daterangepicker/daterangepicker.js')
->appendFile('/themes/default/scripts/scripts.js', 'text/javascript')
->appendFile('/themes/default/scripts/fields.js', 'text/javascript');
$families = array(
@ -73,11 +74,12 @@ class FieldsController extends Zend_Controller_Action
$parent = $request->getParam('id');
$level = $request->getParam('level');
//Init
if ( $parent === null ) {
$this->view->init = true;
}
// Init
elseif ( $parent === '#' ) {
// First level
elseif ( $parent == '#' ) {
$scoresFields = new Scores_Ciblage_FieldList();
$session = new Scores_Ciblage_Session($scoresFields);
$values = $session->getTreeValues($key, null, $level);

View File

@ -73,42 +73,35 @@ class IndexController extends Zend_Controller_Action
$this->_helper->layout()->disableLayout();
$request = $this->getRequest();
$critere = $request->getParam('key');
$key = $request->getParam('key');
$fields = new Scores_Ciblage_FieldList();
$sessionValue = new Scores_Ciblage_Session($fields);
$values = $sessionValue->getSelectedValue($key);
$this->view->assign('critereName', $critere);
if ( $valueSelected !== false ) {
$inValue = $valueSelected['in'];
$exValue = $valueSelected['ex'];
$inLabel = array();
if ( count($inValue)>0 ) {
foreach ( $inValue as $value ) {
if ( array_key_exists($value, $params['values']) ) {
$inLabel[] = $params['values'][$value];
}
$inLabels = array();
if (count($values['in'])>0) {
foreach ($values['in'] as $value) {
$inLabels[$value] = $fields->labelValueDetail($key, $value);
}
$this->view->assign('inLabels', $inLabel);
$this->view->assign('inValues', $inValue);
}
$exLabel = array();
if ( count($exValue)>0 ) {
foreach ( $exValue as $value ) {
if ( array_key_exists($value, $params['values']) ) {
$exLabel[] = $params['values'][$value];
}
$exLabels = array();
if (count($values['ex'])>0) {
foreach ($values['ex'] as $value) {
$exLabels[$value] = $fields->labelValueDetail($key, $value);
}
$this->view->assign('exLabels', $exLabel);
$this->view->assign('exValues', $exValue);
}
}
Zend_Registry::get('firebug')->info('LABEL');
Zend_Registry::get('firebug')->info($inLabels);
$this->view->critereName = $key;
$this->view->inLabels = $inLabels;
$this->view->exLabels = $exLabels;
}
public function removeAction()

View File

@ -7,12 +7,7 @@ class UserController extends Zend_Controller_Action
*/
public function loginAction()
{
$this->view->headLink()
->appendStylesheet('/themes/default/styles/signin.css', 'all');
$this->view->inlineScript()
->appendFile('/libs/jquery/jquery-1.10.1.min.js')
->appendFile('/libs/jquery/jquery.infieldlabel.min.js');
$this->view->headLink()->appendStylesheet('/themes/default/styles/signin.css', 'all');
//@todo : gestion des affichages particuliers pour les clients
$this->view->headTitle()->append('Connexion');

View File

@ -1,13 +1,11 @@
<div class="container">
<div id="dashboard">
<div id="dashboard" class="clearfix">
<div style="margin:5px 0;">
<h2>Liste de vos ciblages</h2>
<?php if(count($this->ciblages)>0) {?>
<table class="ciblage">
<table class="ciblage table table-bordered">
<thead>
<tr>
<th>Référence</th>
@ -31,31 +29,17 @@
</tbody>
</table>
<div style="margin:5px auto;width:333px;">
<div class="pagination">
<a href="#" class="first" data-action="first">&laquo;</a>
<a href="#" class="previous" data-action="previous">&lsaquo;</a>
<input type="text" readonly="readonly" data-current-page="<?=$this->page?>" data-max-page="<?=$this->nbPages?>" />
<a href="#" class="next" data-action="next">&rsaquo;</a>
<a href="#" class="last" data-action="last">&raquo;</a>
</div>
<script>
$('.pagination').jqPagination({
page_string: "Page {current_page} sur {max_page}",
paged: function(page) {
window.location.href = window.location.href + '/page/'+page;
}
});
</script>
<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>
<button type="button" class="btn btn-default"><?=$this->page?> / <?=$this->nbPages?></button>
<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 } else {?>
<p>Aucun ciblage.<p>
<?php }?>
</div>
</div>
</div>

View File

@ -4,8 +4,8 @@
<h2>Fichiers en cours d'enrichissement</h2>
<?php if(count($this->encours) > 0):?>
<table>
<?php if(count($this->encours) > 0) {?>
<table class="table table-bordered">
<thead>
<tr>
<th>Référence</th>
@ -16,7 +16,7 @@
</tr>
</thead>
<tbody>
<?php $i=0; foreach($this->encours as $item):?>
<?php $i=0; foreach($this->encours as $item) {?>
<tr>
<td><?=$item['reference']?></td>
<td><?=number_format($item['nbLigneTotales'], 0, ',', ' ')?></td>
@ -30,17 +30,17 @@
<?php } ?>
</td>
</tr>
<?php endforeach;?>
<?php }?>
</tbody>
</table>
<?php else:?>
<?php } else {?>
<p>Aucun enrichissement en cours.<p>
<?php endif;?>
<?php }?>
<h2>Fichiers enrichis</h2>
<?php if(count($this->fini) > 0):?>
<table>
<?php if(count($this->fini) > 0) {?>
<table class="table table-bordered">
<thead>
<tr>
<th>Référence</th>
@ -50,24 +50,23 @@
</tr>
</thead>
<tbody>
<?php foreach($this->fini as $item):?>
<?php foreach($this->fini as $item) {?>
<tr>
<td><?=$item['reference']?></td>
<td><?=number_format($item['nbLigneTotales'], 0, ',', ' ')?></td>
<td><?=$item['dateAdded']?></td>
<td><a href="/enrichissement/download/id/<?php echo $item['id'];?>"><?php echo $item['fichier']; ?></a></td>
</tr>
<?php endforeach;?>
<?php }?>
</tbody>
</table>
<?php else:?>
<?php } else {?>
<p>Aucun enrichissement.<p>
<?php endif;?>
<?php }?>
</div>
<script>
$(document).ready(function()
{
$(document).ready(function(){
$(document).focusin(function(){
timer = setInterval(updateInfo, 10000);
});
@ -78,8 +77,7 @@ $(document).ready(function()
});
var timer;
function updateInfo()
{
function updateInfo(){
$('tr.encours').each(function(){
var objet = $(this);
var id = $(this).attr('id');

View File

@ -25,7 +25,7 @@
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse-2">Situation économique</a>
<a data-toggle="collapse" data-parent="#accordion" href="#collapse-2">Situation &Eacute;conomique</a>
<button type="button" class="close glyphicon glyphicon-chevron-down" data-toggle="collapse" data-target="#collapse-2">
</button>
</h4>
@ -48,7 +48,7 @@
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse-3">Secteur géographique</a>
<a data-toggle="collapse" data-parent="#accordion" href="#collapse-3">Secteur Géographique</a>
<button type="button" class="close glyphicon glyphicon-chevron-down" data-toggle="collapse" data-target="#collapse-3">
</button>
</h4>
@ -71,7 +71,7 @@
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse-4">Situation juridique</a>
<a data-toggle="collapse" data-parent="#accordion" href="#collapse-4">Situation Juridique</a>
<button type="button" class="close glyphicon glyphicon-chevron-down" data-toggle="collapse" data-target="#collapse-4">
</button>
</h4>
@ -94,7 +94,7 @@
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapse-5">Situation financière</a>
<a data-toggle="collapse" data-parent="#accordion" href="#collapse-5">Situation Financière</a>
<button type="button" class="close glyphicon glyphicon-chevron-down" data-toggle="collapse" data-target="#collapse-5">
</button>
</h4>

View File

@ -5,6 +5,7 @@
<script>
$("div#<?=$this->key?>").jstree({
'core': {
'themes' : { 'icons': false, },
'animation': 0,
'check_callback' : true,
'data' : {

View File

@ -1,24 +1,21 @@
<?php if (count($this->inValues)>0) {?>
<?php if (count($this->inLabels)>0) {?>
<ul>
<?php foreach ($this->inValues as $i => $item) {?>
<li><p><?=$this->inLabels[$i]?>
<a class="remove" href="<?=$this->url(array(
'controller'=>'index', 'action'=>'remove',
'critere'=>$this->critereName, 'in'=>$i
), null, true)?>">
<img src="/themes/default/images/cross.png" alt="Supprimer la valeur"></a></p>
</li>
<?php }?>
</ul>
<?php }?>
<?php if (count($this->exValues)>0) {?>
<ul>
<?php foreach ($this->exValues as $i => $item) {?>
<li><?=$this->exLabels[$i]?><a class="remove" href="<?=$this->url(array(
'controller'=>'index', 'action'=>'remove',
'critere'=>$this->critereName, 'ex'=>$i
), null, true)?>">
<?php foreach ($this->inLabels as $i => $item) {?>
<li><?=$item?>
<a class="remove" href="<?=$this->url(array('controller'=>'index', 'action'=>'remove',
'critere'=>$this->critereName, 'in'=>$i ), null, true)?>">
<img src="/themes/default/images/cross.png" alt="Supprimer la valeur"></a>
</li>
<?php }?>
</ul>
<?php }?>
<?php if (count($this->exLabels)>0) {?>
<ul>
<?php foreach ($this->exLabels as $i => $item) {?>
<li><?=$item?>
<a class="remove" href="<?=$this->url(array('controller'=>'index', 'action'=>'remove',
'critere'=>$this->critereName, 'ex'=>$i ), null, true)?>">
<img src="/themes/default/images/cross.png" alt="Supprimer la valeur"></a>
</li>
<?php }?>

View File

@ -14,7 +14,7 @@
'controller'=>'index', 'action'=>'remove', 'critere'=>$critere), null, true)?>" aria-hidden="true">&times;</a>
<strong><?=$item['label']?>:</strong>
<?php if ( $item['in'] == 'Liste' ) { ?>
<a href="<?=$this->url(array('controller'=>'index', 'action'=>'criterelist',
<a class="itemlist" href="<?=$this->url(array('controller'=>'index', 'action'=>'criterelist',
'key'=>$critere), null, true)?>">&Eacute;léments inclus.</a>
<?php } elseif ( !empty($item['in']) ) {?>
<span><?=$item['in']?>.</span>
@ -29,7 +29,7 @@
</div>
<?php }?>
<?php } else {?><div class="alert alert-warning">Aucune sélection.</div><?}?>
<a href="/comptage/reset" class="btn btn-primary btn-block">Initialiser les critères</a>
<a href="/comptage/previsualisation" class="btn btn-primary btn-block">Prévisualiser</a>
<a href="/comptage/savedialog" class="saveciblage btn btn-primary btn-block">Extraire</a>
<a href="/comptage/reset" id="reset" class="btn btn-primary btn-block">Initialiser les critères</a>
<a href="/comptage/previsualisation" id="preview" class="btn btn-primary btn-block">Prévisualiser</a>
<a href="/comptage/savedialog" id="extract" class="saveciblage btn btn-primary btn-block">Extraire</a>
</div>

View File

@ -1,15 +1,19 @@
<?php if ($this->CiblageError) { ?>
<div class="container">
<div class="alert alert-danger">
<?=$this->translate('Erreur ! Le moteur de ciblage n\'est pas disponible !')?>
</div>
</div>
<?php } else {?>
<div class="container col-lg-12">
<div id="actionMessage"></div>
<div class="row">
<div id="tabs" class="col-sm-8 col-md-8 col-lg-8"><?=$this->action('index', 'fields')?></div>
<div id="panel" class="col-sm-4 col-md-4 col-lg-4"><?=$this->action('criteres', 'index')?></div>
</div>
</div>
<?php }?>

View File

@ -1,26 +1,24 @@
<?php echo $this->doctype(); ?>
<?php echo $this->doctype()?>
<html>
<head>
<?php echo $this->headMeta(); ?>
<?php echo $this->headTitle(); ?>
<?php echo $this->headStyle(); ?>
<?php echo $this->headLink(); ?>
<?php echo $this->headScript(); ?>
<?php echo $this->headMeta()?>
<?php echo $this->headTitle()?>
<?php echo $this->headStyle()?>
<?php echo $this->headLink()?>
<?php echo $this->headScript()?>
</head>
<body>
<div id="wrap" class="clearfix">
<div id="wrap">
<?php echo $this->render('header.phtml')?>
<div class="container col-lg-12">
<?php echo $this->layout()->content; ?>
</div>
<?php echo $this->layout()->content?>
</div>
<div id="footer">
<?php echo $this->render('footer.phtml'); ?>
<?php echo $this->render('footer.phtml')?>
</div>
<?php echo $this->inlineScript(); ?>
<?php echo $this->inlineScript()?>
</body>
</html>

View File

@ -1,11 +1,11 @@
<?php echo $this->doctype(); ?>
<?php echo $this->doctype()?>
<html>
<head>
<?php echo $this->headMeta(); ?>
<?php echo $this->headTitle(); ?>
<?php echo $this->headStyle(); ?>
<?php echo $this->headLink(); ?>
<?php echo $this->headScript(); ?>
<?php echo $this->headMeta()?>
<?php echo $this->headTitle()?>
<?php echo $this->headStyle()?>
<?php echo $this->headLink()?>
<?php echo $this->headScript()?>
</head>
<body>
<div id="wrap">
@ -24,9 +24,9 @@
</div>
<div id="footer">
<?php echo $this->render('footer.phtml'); ?>
<?php echo $this->render('footer.phtml')?>
</div>
<?php echo $this->inlineScript(); ?>
<?php echo $this->inlineScript()?>
</body>
</html>

View File

@ -1137,7 +1137,7 @@ class Scores_Ciblage_FieldList
$commune = $codePostauxM->fetchRow($sql);
$departement = 'D'.substr($commune->Codepos,0,2);
$region = $this->getGeoParent($departement);
$region = $this->treeGeoParent($departement);
return array_merge(array($departement), $region);
}
@ -1243,6 +1243,8 @@ class Scores_Ciblage_FieldList
if ( is_array($info['type']) ) {
return true;
} else {
$staticValuesLabel = $this->getItemValues($key);
@ -1307,7 +1309,40 @@ class Scores_Ciblage_FieldList
*/
public function labelValueDetail($key, $value)
{
return $this->labelValueGeo($value);
}
protected function labelValueGeo($code)
{
// R[code] => Régions => recherche département
if ( substr($code,0,1)=='R' ) {
$region = substr($code,1);
$regionM = new Application_Model_CiblageRegions();
$sql = $regionM->select()->where('REGION=?', $region);
$regions = $regionM->fetchRow($sql);
return $regions->NCCENR;
}
// D[code] => Départements => recherche commune
elseif ( substr($code,0,1)=='D' ) {
$departement = substr($code,1);
$departementsM = new Application_Model_CiblageDepartements();
$sql = $departementsM->select()->where('numdep = ?', $departement);
$departements = $departementsM->fetchRow($sql);
return $item->libdep;
} elseif ( substr($code,0,1)=='C' ) {
$insee = substr($code,1);
$codePostauxM = new Application_Model_CiblageCodePostaux();
$sql = $codePostauxM->select()->where('INSEE = ?', $insee);
$communes = $codePostauxM->fetchRow($sql);
return $communes->Commune;
}
return false;
}
}

View File

@ -73,13 +73,9 @@ class Scores_Ciblage_Session
return false;
}
//Control values sent
$staticValuesLabel = $this->fields->getItemValues($key);
$staticValues = array_keys($staticValuesLabel);
$valueToSave = null;
//check data
//Check data
if ( is_array($value) ) {
foreach ( $value as $item ) {
if ( $this->fields->checkValue($key, $item) ){
@ -92,6 +88,9 @@ class Scores_Ciblage_Session
}
}
//Merge with data already in session if needed
//Prepare to save date in session
if ( $valueToSave !== null ) {
//Save the value
@ -184,13 +183,13 @@ class Scores_Ciblage_Session
}
$staticValues = $this->fields->treeValuesGeo($code, $level);
Zend_Registry::get('firebug')->info($valuesChecked);
if ( count($staticValues)>0 ) {
foreach ( $staticValues as $i => $value ) {
if (in_array($value, $valuesChecked)){
if (in_array($value['id'], $valuesChecked)){
$staticValues[$i]['state'] = array('selected' => true);
}
if (in_array($value, $valuesUndetermined)){
if (in_array($value['id'], $valuesUndetermined)){
$staticValues[$i]['state'] = array('undetermined' => true);
}
}

View File

@ -1,26 +1,4 @@
$(document).ready(function(){
/*$('div#criteres a.criterelist').click(function(e){
e.preventDefault();
var title = $(this).attr('title');
var href = $(this).attr('href');
var dialogOpts = {
bgiframe: true,
title: title,
width: 500,
height: 300,
modal: true,
open: function(event, ui) {
$(this).html('Chargement...');
$(this).load(href);
},
buttons: {
Fermer: function() { $(this).dialog('close'); }
},
close: function() { $('#dialogtree').remove(); }
};
$('<div id="dialogcritere"></div>').dialog(dialogOpts);
return false;
});*/
$('div.ciblage-one input[type=radio]').change(function(e){
e.preventDefault();
@ -116,10 +94,12 @@ $(document).ready(function(){
Valider: function() {
var key = $('div.jstree').attr('id');
var elements = [];
$('div.jstree').jstree("get_checked").each(function(){
console.log($('div.jstree').jstree().get_top_selected());
/*$('div.jstree').jstree("get_checked").each(function(){
elements.push(this.id);
});
set(key, elements.join(","));
set(key, elements.join(","));*/
$(this).dialog('close');
},
Fermer: function() { $(this).dialog('close'); }

View File

@ -5,7 +5,29 @@ $(document).ready(function(){
$(this).find('div.modal-dialog').remove();
});
$('body').delegate('.saveciblage', 'click', function(){
$('body').on('click', 'a.itemlist', function(e){
e.preventDefault();
var title = 'OOOOOO';
var href = $(this).attr('href');
var dialogOpts = {
bgiframe: true,
title: title,
width: 500,
height: 200,
modal: true,
open: function(event, ui) {
$(this).html('Chargement...').load(href);
},
buttons: {
Fermer: function() { $(this).dialog('close'); }
},
close: function() { $('#dialog').remove(); }
};
$('<div id="dialog"></div>').dialog(dialogOpts);
return false;
});
$('#extract').on('click', function(){
var title = 'Sauvegarde du profil de ciblage';
var href = $(this).attr('href');
var dialogOpts = {
@ -27,7 +49,8 @@ $(document).ready(function(){
return false;
});
$('body').delegate('.previsualisation', 'click', function(){
$('#preview').on('click', function(e){
e.preventDefault();
var title = 'Prévisualisation de votre ciblage';
var href = $(this).attr('href');
var dialogOpts = {
@ -37,8 +60,7 @@ $(document).ready(function(){
height: 500,
modal: true,
open: function(event, ui) {
$(this).html('Chargement...');
$(this).load(href);
$(this).html('Chargement...').load(href);
},
buttons: {
Commander : function() {
@ -53,22 +75,5 @@ $(document).ready(function(){
return false;
});
$('.mode').click(function() {
var mode = 0;
var obj = $(this).parent('ul#fieldsblock');
$(obj).children('li.advanced').each(function() {
if($(this).css('display')=='none') {
$(this).css('display', 'block');
mode++;
} else {
$(this).css('display', 'none');
}
});
if (mode==0) {
$(this).html('<img src="/themes/default/images/fleche-bas.gif" />');
} else {
$(this).html('<img src="/themes/default/images/fleche-haut.gif" />');
}
});
});