MAJ
This commit is contained in:
parent
7135be80d3
commit
21ddf64775
@ -10,35 +10,9 @@ class DashboardController extends Libs_Controller
|
|||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
$object = new Object_Dashboard();
|
$object = new Object_Dashboard();
|
||||||
|
|
||||||
$this->view->comptages = $object->index();
|
$this->view->comptages = $object->index();
|
||||||
|
$this->view->enrichissements = $object->enrichissements();
|
||||||
$auth = Zend_Auth::getInstance();
|
|
||||||
$user = $auth->getIdentity();
|
|
||||||
|
|
||||||
|
|
||||||
//Affichage des derniers enrichissements
|
|
||||||
$enrichissementsM = new Table_EnrichissementIdentifiants();
|
|
||||||
|
|
||||||
$sql = $enrichissementsM->select()
|
|
||||||
->setIntegrityCheck(false)
|
|
||||||
->from(
|
|
||||||
array('i' => 'enrichissement_identifiants'),
|
|
||||||
array('id', 'reference', 'fichier', 'nbLigneTotales', 'nbLigneTraites', 'error', 'dateAdded', 'dateStart', 'dateStop')
|
|
||||||
)
|
|
||||||
->join(
|
|
||||||
array('c' => 'comptages'), 'i.idComptage = c.id',
|
|
||||||
array('')
|
|
||||||
)
|
|
||||||
->join(
|
|
||||||
array('criteres' => 'criteres'), 'i.idCriteres = criteres.id',
|
|
||||||
array('')
|
|
||||||
)
|
|
||||||
->where('criteres.idClient = ?', $user->idClient)
|
|
||||||
->where('criteres.login = ?', $user->username)
|
|
||||||
->order('dateAdded DESC');
|
|
||||||
|
|
||||||
$enrichissements = $enrichissementsM->fetchAll($sql);
|
|
||||||
$this->view->assign('enrichissements', $enrichissements);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,11 @@ class EnrichissementController extends Zend_Controller_Action
|
|||||||
$idCriteres = $request->getParam('id', null);
|
$idCriteres = $request->getParam('id', null);
|
||||||
$idProfil = $request->getParam('profil', null);
|
$idProfil = $request->getParam('profil', null);
|
||||||
|
|
||||||
|
$comptage = new Table_Comptages();
|
||||||
|
$sql = $comptage->select()->where('idDefinition = ?', $idCriteres);
|
||||||
|
$result = $comptage->fetchRow($sql);
|
||||||
|
$idComptage = $result['idDefinition'];
|
||||||
|
|
||||||
//Vérifier les profils du client
|
//Vérifier les profils du client
|
||||||
if ( $idProfil===null ){
|
if ( $idProfil===null ){
|
||||||
//Selection du profil du client
|
//Selection du profil du client
|
||||||
@ -105,21 +110,22 @@ class EnrichissementController extends Zend_Controller_Action
|
|||||||
|
|
||||||
//Récupération des SIRET
|
//Récupération des SIRET
|
||||||
require_once 'Scores/Ciblage.php';
|
require_once 'Scores/Ciblage.php';
|
||||||
$ciblage = new Ciblage($values);
|
$ciblage = new Ciblage($values, true);
|
||||||
$infosExtraction = $ciblage->execute(true);
|
$infosExtraction = $ciblage->execute(true);
|
||||||
|
|
||||||
//Attention calcul uniteInsee réelle
|
//Attention calcul uniteInsee réelle
|
||||||
//car si donnée insee alors toutes les lignes doivent être comptés en unité insee
|
//car si donnée insee alors toutes les lignes doivent être comptés en unité insee
|
||||||
$data = array(
|
$data = array(
|
||||||
'idComptage' => $idComptage,
|
'idComptage' => $idComptage,
|
||||||
|
'reference' => $this->getRequest()->getParam('ref'),
|
||||||
'idCriteres' => $criteres->id,
|
'idCriteres' => $criteres->id,
|
||||||
'idProfil' => $idProfil,
|
'idProfil' => $idProfil,
|
||||||
'identifiants' => $infosExtraction['result'],
|
'identifiants' => json_encode($infosExtraction),
|
||||||
'idProfil' => $idProfil,
|
'idProfil' => $idProfil,
|
||||||
'fichier' => '',
|
'fichier' => '',
|
||||||
'nbLigneTotales' => $infosExtraction['total'],
|
'nbLigneTotales' => count($infosExtraction),
|
||||||
'nbLigneTraites' => '',
|
'nbLigneTraites' => count($infosExtraction),
|
||||||
'uniteInsee' => $infosExtraction['insee'],
|
'uniteInsee' => $ciblage->calculRedevanceInsee(),
|
||||||
'error' => '',
|
'error' => '',
|
||||||
'dateAdded' => date('YmdHis'),
|
'dateAdded' => date('YmdHis'),
|
||||||
);
|
);
|
||||||
|
@ -90,7 +90,7 @@ class Object_Codepostaux extends Libs_Row
|
|||||||
|
|
||||||
foreach($departements as $nom) {
|
foreach($departements as $nom) {
|
||||||
$structure[] = array(
|
$structure[] = array(
|
||||||
'data' => $nom['libdep'],
|
'data' => $nom['numdep'].' '.$nom['libdep'],
|
||||||
'attr' => array('id' => 'adr_dept:'.$nom['numdep'],
|
'attr' => array('id' => 'adr_dept:'.$nom['numdep'],
|
||||||
'niveau' => 1,
|
'niveau' => 1,
|
||||||
'class' => $this->_getClass('adr_dept:'.$nom['numdep'], 1)
|
'class' => $this->_getClass('adr_dept:'.$nom['numdep'], 1)
|
||||||
@ -112,7 +112,7 @@ class Object_Codepostaux extends Libs_Row
|
|||||||
|
|
||||||
foreach($codepostaux as $nom) {
|
foreach($codepostaux as $nom) {
|
||||||
$structure[] = array(
|
$structure[] = array(
|
||||||
'data' => $nom['Commune'],
|
'data' => $nom['Codepos'].' '.$nom['Commune'],
|
||||||
'attr' => array('id'=> 'adr_com:'.$nom['INSEE'],
|
'attr' => array('id'=> 'adr_com:'.$nom['INSEE'],
|
||||||
'niveau' => 2,
|
'niveau' => 2,
|
||||||
'class' => $this->_getClass('adr_com:'.$nom['INSEE'], 2)
|
'class' => $this->_getClass('adr_com:'.$nom['INSEE'], 2)
|
||||||
|
@ -73,23 +73,23 @@ class Object_Comptage extends Libs_Row
|
|||||||
foreach($valeurs as $valeur) {
|
foreach($valeurs as $valeur) {
|
||||||
$vil .= 'adr_com:'.trim($valeur).',';
|
$vil .= 'adr_com:'.trim($valeur).',';
|
||||||
}
|
}
|
||||||
$vil = substr($vil, 0, strlen($vil)-1);
|
//$vil = substr($vil, 0, strlen($vil)-1);
|
||||||
}
|
}
|
||||||
if($session->getCritere('adr_reg')) {
|
if($session->getCritere('adr_reg')) {
|
||||||
$valeurs = explode(',', $session->getCritere('adr_reg'));
|
$valeurs = explode(',', $session->getCritere('adr_reg'));
|
||||||
foreach($valeurs as $valeur) {
|
foreach($valeurs as $valeur) {
|
||||||
$reg .= 'adr_reg:'.trim($valeur).',';
|
$reg .= 'adr_reg:'.trim($valeur).',';
|
||||||
}
|
}
|
||||||
$reg = substr($reg, 0, strlen($reg)-1);
|
//$reg = substr($reg, 0, strlen($reg)-1);
|
||||||
}
|
}
|
||||||
if($session->getCritere('adr_dept')) {
|
if($session->getCritere('adr_dept')) {
|
||||||
$valeurs = explode(',', $session->getCritere('adr_dept'));
|
$valeurs = explode(',', $session->getCritere('adr_dept'));
|
||||||
foreach($valeurs as $valeur) {
|
foreach($valeurs as $valeur) {
|
||||||
$dept .= 'adr_dept:'.trim($valeur).',';
|
$dept .= 'adr_dept:'.trim($valeur).',';
|
||||||
}
|
}
|
||||||
$dept = substr($dept, 0, strlen($dept)-1);
|
//$dept = substr($dept, 0, strlen($dept)-1);
|
||||||
}
|
}
|
||||||
$valeur = implode('', array($vil, $reg, $dept));
|
$valeur = $vil.$dept.$reg;
|
||||||
$session->setCritere($key, $valeur);
|
$session->setCritere($key, $valeur);
|
||||||
}
|
}
|
||||||
require_once 'Scores/Field.php';
|
require_once 'Scores/Field.php';
|
||||||
|
@ -43,6 +43,31 @@ Class Object_Dashboard
|
|||||||
return ($results);
|
return ($results);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function enrichissements()
|
||||||
|
{
|
||||||
|
$enrichissementsM = new Table_EnrichissementIdentifiants();
|
||||||
|
$auth = Zend_Auth::getInstance();
|
||||||
|
$user = $auth->getIdentity();
|
||||||
|
$sql = $enrichissementsM->select()
|
||||||
|
->setIntegrityCheck(false)
|
||||||
|
->from(
|
||||||
|
array('i' => 'enrichissement_identifiants'),
|
||||||
|
array('id', 'reference', 'fichier', 'nbLigneTotales', 'nbLigneTraites', 'error', 'dateAdded', 'dateStart', 'dateStop')
|
||||||
|
)
|
||||||
|
->join(
|
||||||
|
array('c' => 'comptages'), 'i.idComptage = c.id',
|
||||||
|
array('')
|
||||||
|
)
|
||||||
|
->join(
|
||||||
|
array('criteres' => 'criteres'), 'i.idCriteres = criteres.id',
|
||||||
|
array('')
|
||||||
|
)
|
||||||
|
->where('criteres.idClient = ?', $user->idClient)
|
||||||
|
->where('criteres.login = ?', $user->username)
|
||||||
|
->order('dateAdded DESC');
|
||||||
|
return ($enrichissementsM->fetchAll($sql));
|
||||||
|
}
|
||||||
|
|
||||||
public function menu()
|
public function menu()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
class Table_EnrichissementCommandes extends Zend_Db_Table_Abstract
|
||||||
|
{
|
||||||
|
public $_name = 'enrichissement_commandes';
|
||||||
|
}
|
@ -200,7 +200,7 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
|
|||||||
}
|
}
|
||||||
/* Modifier les données */
|
/* Modifier les données */
|
||||||
$return = '<textarea rows="5" style="border:1px inset silver;width:60%" class="criteres complited'.$type.'" id="textarea_'.$name.'" name="'.$name.'">'.$session->getCritere($name).'</textarea>';
|
$return = '<textarea rows="5" style="border:1px inset silver;width:60%" class="criteres complited'.$type.'" id="textarea_'.$name.'" name="'.$name.'">'.$session->getCritere($name).'</textarea>';
|
||||||
$return .= '<a href="" class="autocomplet" textarea="'.$name.'">Valider</a>';
|
$return .= '<a href="" class="autocomplet" textarea="'.$name.'">Valider</a> <a href="">Aide</a>';
|
||||||
return ($return);
|
return ($return);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
|
|
||||||
<div id="lastEnrichissement">
|
<div id="lastEnrichissement">
|
||||||
<h2>Vos derniers enrichissements</h2>
|
<h2>Vos derniers enrichissements</h2>
|
||||||
<?php if(count($this->enrichissement) > 0):?>
|
<?php if(count($this->enrichissements) > 0):?>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -64,7 +64,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php foreach($this->enrichissement as $item):?>
|
<?php foreach($this->enrichissements as $item):?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?=$item['reference']?></td>
|
<td><?=$item['reference']?></td>
|
||||||
<td><?=number_format($item['nbLigneTotales'], 0, ',', ' ')?></td>
|
<td><?=number_format($item['nbLigneTotales'], 0, ',', ' ')?></td>
|
||||||
|
@ -2,19 +2,12 @@
|
|||||||
<ul id="fieldsblock">
|
<ul id="fieldsblock">
|
||||||
<li><?php echo $this->Field('adr_com', $this->fields->get('adr_com'));?></li>
|
<li><?php echo $this->Field('adr_com', $this->fields->get('adr_com'));?></li>
|
||||||
<li style="background-image:none;height:80px;">
|
<li style="background-image:none;height:80px;">
|
||||||
<img style="float:right" src="/themes/default/images/help.png" />
|
|
||||||
<?php echo $this->Field('vil', $this->fields->get('adr_com'), 'text');?>
|
<?php echo $this->Field('vil', $this->fields->get('adr_com'), 'text');?>
|
||||||
</li>
|
</li>
|
||||||
<li style="background-image:none;height:80px;">
|
<li style="background-image:none;height:80px;">
|
||||||
<i>Indiquez les noms ou les codes des départements séparés par des virgules.
|
|
||||||
Si vous disposez d'une liste sous forme excel glissez le fichier dans l'encadré,
|
|
||||||
Pour la corse vous pouvez indiquer 20 ou 2A, 2B, pour les DOM-TOM vous pouvez indiquer deux ou trois chiffres,
|
|
||||||
exemple : 97 ou 971, 972...</i>
|
|
||||||
<?php echo $this->Field('adr_dept', $this->fields->get('adr_dept'), 'text');?>
|
<?php echo $this->Field('adr_dept', $this->fields->get('adr_dept'), 'text');?>
|
||||||
</li>
|
</li>
|
||||||
<li style="background-image:none;height:80px;">
|
<li style="background-image:none;height:80px;">
|
||||||
<i>Indiquez les noms ou les codes (insee) des régions séparés par des virgules.
|
|
||||||
Si vous disposez d'une liste sous forme excel glissez le fichier dans l'encadré</i>
|
|
||||||
<?php echo $this->Field('adr_reg', $this->fields->get('adr_reg'), 'text');?>
|
<?php echo $this->Field('adr_reg', $this->fields->get('adr_reg'), 'text');?>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -1,29 +1,33 @@
|
|||||||
<h1>Vos critères de selections</h1>
|
|
||||||
<style>
|
<style>
|
||||||
.color {
|
.color {
|
||||||
background-color:#DEDEDE;
|
background-color:#DEDEDE;
|
||||||
}
|
}
|
||||||
|
a
|
||||||
|
{
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
#criteres_ra
|
#criteres_ra
|
||||||
{
|
{
|
||||||
|
width:93%;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#criteres_ra tr td {
|
#criteres_ra tr td {
|
||||||
border-left: 1px solid black;
|
border-left: 1px solid black;
|
||||||
|
border-right: 1px solid black;
|
||||||
padding-left:5px;
|
padding-left:5px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<table id="criteres_ra" style="margin-top:15px">
|
<table id="criteres_ra" style="margin:10px">
|
||||||
<tr>
|
<tr>
|
||||||
<td><b>Champ séléction</b></td>
|
<td id="Valide" style="text-align: center" colspan="3"><a class="saveciblage" href="/comptage/savedialog">Valider mon comptage</a></td>
|
||||||
<td><b>Votre critère</b></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<?php $color = 0;foreach($this->criteres as $critere => $valeur):?>
|
<?php $color = 0;foreach($this->criteres as $critere => $valeur):?>
|
||||||
<?php $label = $this->field->get($critere); ?>
|
<?php $label = $this->field->get($critere); ?>
|
||||||
<?php if($valeur != 'tous' and $valeur != null and $valeur != 'null' and $valeur != ','):?>
|
<?php if($valeur != 'tous' and $valeur != null and $valeur != 'null' and $valeur != ',' and $critere != 'adr_com'):?>
|
||||||
<?php $valeur = explode(',', $valeur); ?>
|
<?php $valeur = explode(',', $valeur); ?>
|
||||||
<tr <?php echo ((($color%2) == 0)?'class="color"':''); $color++;?>>
|
<tr <?php echo ((($color%2) == 0)?'class="color"':''); $color++;?>>
|
||||||
<td valign="top" style="width:150px">
|
<td valign="top" style="padding:5px;width:150px">
|
||||||
<?php echo $label['label'];?>
|
<?php echo $label['label'];?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@ -39,10 +43,11 @@
|
|||||||
<?php echo $val;?>
|
<?php echo $val;?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td style="text-align: center">
|
||||||
<a class="remove" href="index/remove/critere/<?php echo $critere;?>">
|
<a class="remove" href="index/remove/critere/<?php echo $critere;?>">
|
||||||
<img src="/themes/default/images/cross.png" />
|
<img width="14px;" src="/themes/default/images/cross.png" />
|
||||||
</a>
|
</a>
|
||||||
|
<img src="/themes/default/images/help.png" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endif;?>
|
<?php endif;?>
|
||||||
|
@ -14,7 +14,6 @@ set_include_path(implode(PATH_SEPARATOR, array(
|
|||||||
realpath(APPLICATION_PATH . '/../library'),
|
realpath(APPLICATION_PATH . '/../library'),
|
||||||
get_include_path(),
|
get_include_path(),
|
||||||
)));
|
)));
|
||||||
|
|
||||||
/** Zend_Application */
|
/** Zend_Application */
|
||||||
require_once 'Zend/Application.php';
|
require_once 'Zend/Application.php';
|
||||||
|
|
||||||
@ -55,33 +54,37 @@ try {
|
|||||||
}
|
}
|
||||||
//Définition bdd metier
|
//Définition bdd metier
|
||||||
try {
|
try {
|
||||||
$dbMetier = Zend_Db::factory('Mysqli', $dbConfig->jo);
|
$dbMetier = Zend_Db::factory($dbConfig->jo);
|
||||||
} catch ( Exception $e ) {
|
} catch ( Exception $e ) {
|
||||||
exit ( $e->getMessage() );
|
exit ( $e->getMessage() );
|
||||||
}
|
}
|
||||||
|
|
||||||
$liste = array();
|
$liste = array();
|
||||||
|
|
||||||
if ($opts->id) {
|
if ($opts->id)
|
||||||
|
{
|
||||||
|
|
||||||
$commandesM = new Table_EnrichissementCommandes($db);
|
//$commandesM = new Table_EnrichissementCommandes($db);
|
||||||
$commande = $commandesM->find(intval($opts->id))->current();
|
$sql = $db->select()
|
||||||
|
->from('enrichissement_identifiants')
|
||||||
$identifiants = json_decode($commande->identifiants, true);
|
->where('idComptage = ?', intval($opts->id));
|
||||||
|
$commande = $db->fetchRow($sql);
|
||||||
$profilM = new Table_EnrichissementProfils($db);
|
$identifiants = json_decode($commande['identifiants'], true);
|
||||||
$profil = $profilM->find($commande->idProfil);
|
|
||||||
|
|
||||||
$dataProfil = json_decode($profil->criteres, true);
|
|
||||||
|
|
||||||
} else if ($opts->file) {
|
|
||||||
|
|
||||||
|
//$profilM = new Table_EnrichissementProfils($db);
|
||||||
|
$sql = $db->select()
|
||||||
|
->from('enrichissement_profils')
|
||||||
|
->where('id = ?', $commande['idProfil']);
|
||||||
|
$profil = $db->fetchRow($sql);
|
||||||
|
$dataProfil = json_decode($profil['criteres'], true);
|
||||||
|
} else if ($opts->file)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( count($identifiants)>0 && count($dataProfil)>0 )
|
if ( count($identifiants)>0 && count($dataProfil)>0 )
|
||||||
{
|
{
|
||||||
$outFile = uniqid($commande->reference.'-');
|
$outFile = uniqid($commande->reference.'-').'.csv';
|
||||||
|
|
||||||
require_once 'Scores/Enrichissement.php';
|
require_once 'Scores/Enrichissement.php';
|
||||||
$dico = new Enrichissement();
|
$dico = new Enrichissement();
|
||||||
@ -98,7 +101,7 @@ if ( count($identifiants)>0 && count($dataProfil)>0 )
|
|||||||
|
|
||||||
//Construction de la requete SQL
|
//Construction de la requete SQL
|
||||||
if ( array_key_exists('sql', $fields[$item]) ) {
|
if ( array_key_exists('sql', $fields[$item]) ) {
|
||||||
$sql.= ' '.$sql;
|
$sql.= '';
|
||||||
} else {
|
} else {
|
||||||
$sql.= ' '.$fields[$item]['column'].' AS '.$item.',';
|
$sql.= ' '.$fields[$item]['column'].' AS '.$item.',';
|
||||||
}
|
}
|
||||||
@ -116,14 +119,12 @@ if ( count($identifiants)>0 && count($dataProfil)>0 )
|
|||||||
if (count($tabEnteteLabel)>0){
|
if (count($tabEnteteLabel)>0){
|
||||||
fputcsv($fp, $tabEnteteLabel, ',', '"');
|
fputcsv($fp, $tabEnteteLabel, ',', '"');
|
||||||
}
|
}
|
||||||
|
$model = $sql;
|
||||||
foreach ($identifiants as $siret )
|
foreach ($identifiants as $siret )
|
||||||
{
|
{
|
||||||
$sql.= ' FROM etablissements_act WHERE siren='.substr($siret,0,9).' AND nic='.substr($siret,9,5);
|
$sql = $model .' FROM etablissements_act WHERE siren='.substr($siret,0,9).' AND nic='.substr($siret,9,5);
|
||||||
|
$result = $dbMetier->fetchAll($sql);
|
||||||
$result = $dbMetier->fetchAssoc($sql);
|
|
||||||
$tabData = $result[0];
|
$tabData = $result[0];
|
||||||
|
|
||||||
//Trier pour la sortie
|
//Trier pour la sortie
|
||||||
$tabSortie = array();
|
$tabSortie = array();
|
||||||
foreach($tabEntete as $key){
|
foreach($tabEntete as $key){
|
||||||
@ -133,6 +134,7 @@ if ( count($identifiants)>0 && count($dataProfil)>0 )
|
|||||||
|
|
||||||
$row++;
|
$row++;
|
||||||
}
|
}
|
||||||
|
echo $row .' Lignes !';
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@ define('APPLICATION_ENV', 'production');
|
|||||||
|
|
||||||
// Ensure library/ is on include_path
|
// Ensure library/ is on include_path
|
||||||
set_include_path(implode(PATH_SEPARATOR, array(
|
set_include_path(implode(PATH_SEPARATOR, array(
|
||||||
realpath(APPLICATION_PATH . '/../library'),
|
realpath(APPLICATION_PATH . '/../library'),
|
||||||
get_include_path(),
|
get_include_path(),
|
||||||
)));
|
)));
|
||||||
|
|
||||||
/** Zend_Application */
|
/** Zend_Application */
|
||||||
@ -67,9 +67,7 @@ Class extract
|
|||||||
return ($return);
|
return ($return);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function localisationArbo($name, $liste)
|
protected function localisationArbo($name, $valeur)
|
||||||
{
|
|
||||||
foreach($liste as $valeur)
|
|
||||||
{
|
{
|
||||||
if(strlen($valeur) == 2) {
|
if(strlen($valeur) == 2) {
|
||||||
switch($name) {
|
switch($name) {
|
||||||
@ -97,15 +95,32 @@ Class extract
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return ($return);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ($return);
|
public function getMinMax($name, $valeur)
|
||||||
|
{
|
||||||
|
$valeur = explode(',', $valeur);
|
||||||
|
if(count($valeur) > 1)
|
||||||
|
{
|
||||||
|
$sql = 'SELECT min, max FROM minmax WHERE cle ="'.$name.'"';
|
||||||
|
$result = $this->db->query($sql);
|
||||||
|
$result = $result->fetchAll();
|
||||||
|
if(empty($valeur[0])){
|
||||||
|
echo $name;
|
||||||
|
$valeur[0] = $result[0]['min'];
|
||||||
|
}
|
||||||
|
if(empty($valeur[1])){
|
||||||
|
$valeur[1] = $result[0]['max'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ($valeur);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCli()
|
public function getCli()
|
||||||
{
|
{
|
||||||
require_once('Scores/Ciblage.php');
|
require_once('Scores/Ciblage.php');
|
||||||
require_once('Scores/Field.php');
|
//require_once('Scores/Field.php');
|
||||||
|
|
||||||
$sql = 'SELECT id, idDefinition, uniteInsee FROM comptages WHERE id = '.$this->reference;
|
$sql = 'SELECT id, idDefinition, uniteInsee FROM comptages WHERE id = '.$this->reference;
|
||||||
$fetch = $this->db->query($sql);
|
$fetch = $this->db->query($sql);
|
||||||
@ -121,21 +136,32 @@ Class extract
|
|||||||
$structure = json_decode($result[0]['criteres']);
|
$structure = json_decode($result[0]['criteres']);
|
||||||
$element = array();
|
$element = array();
|
||||||
foreach ($structure as $name => $valeur){
|
foreach ($structure as $name => $valeur){
|
||||||
$type = explode(':', $valeur);
|
if($name == 'adr_com') {
|
||||||
if($type[0] == 'adr_dept') {
|
$liste = explode(',', $valeur);
|
||||||
$array['adr_com'] = $this->localisationArbo($type[0], explode(',', $type[1]));
|
$codes = array();
|
||||||
|
foreach ($liste as $element) {
|
||||||
|
$val = explode(':', $element);
|
||||||
|
if(!empty($val[1]))
|
||||||
|
$codes = array_merge($this->localisationArbo($val[0], $val[1]), $codes);
|
||||||
}
|
}
|
||||||
if($name == 'cj') {
|
$array['adr_com'] = $codes;
|
||||||
|
}
|
||||||
|
else if($name == 'cj') {
|
||||||
$array['cj'] = $this->getCj(explode(',', $valeur));
|
$array['cj'] = $this->getCj(explode(',', $valeur));
|
||||||
}
|
}
|
||||||
}
|
else if($name == 'ape_etab')
|
||||||
$array['ape_etab'] = explode(',', $structure->ape_etab);
|
$array['ape_etab'] = explode(',', $structure->ape_etab);
|
||||||
$ciblage = new Ciblage($array);
|
else {
|
||||||
|
$valeur = $this->getMinMax($name, $valeur);
|
||||||
|
$array[$name] = $valeur;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$ciblage = new Ciblage($array, true);
|
||||||
$res = $ciblage->execute(true);
|
$res = $ciblage->execute(true);
|
||||||
$data = array(
|
$data = array(
|
||||||
'idComptage' => $idComptage,
|
'idComptage' => $idComptage,
|
||||||
'idCriteres' => $idCriteres,
|
'idCriteres' => $idCriteres,
|
||||||
'idProfil' => 0,
|
'idProfil' => 1,
|
||||||
'reference' => 'batch',
|
'reference' => 'batch',
|
||||||
'identifiants' => json_encode($res),
|
'identifiants' => json_encode($res),
|
||||||
'nbLigneTotales' => count($res),
|
'nbLigneTotales' => count($res),
|
||||||
@ -143,14 +169,13 @@ Class extract
|
|||||||
'uniteInsee' => $uniteInsee,
|
'uniteInsee' => $uniteInsee,
|
||||||
'error' => 0
|
'error' => 0
|
||||||
);
|
);
|
||||||
//$this->db->insert('enrichissement_identifiants',$data);
|
$this->db->insert('enrichissement_identifiants',$data);
|
||||||
$fd = fopen($idComptage.'_batch'.date('Y-m-d-hms').'.csv', 'x+');
|
$fd = fopen($idComptage.'_batch'.date('Y-m-d-hms').'.csv', 'x+');
|
||||||
try {
|
try {
|
||||||
$array = array();
|
$array = array();
|
||||||
foreach($res as $field) {
|
foreach($res as $field) {
|
||||||
fputcsv($fd, array($field), ';');
|
fputcsv($fd, array($field), ';');
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch(Exception $e) {
|
} catch(Exception $e) {
|
||||||
echo $e->getMessage();
|
echo $e->getMessage();
|
||||||
}
|
}
|
||||||
@ -159,5 +184,5 @@ Class extract
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$a = new extract('20');
|
$a = new extract('36');
|
||||||
$a->getCli();
|
$a->getCli();
|
@ -6,6 +6,7 @@ Class Ciblage
|
|||||||
private $sphinx;
|
private $sphinx;
|
||||||
private $alpha = '';
|
private $alpha = '';
|
||||||
private $presentRcs = 0;
|
private $presentRcs = 0;
|
||||||
|
private $need;
|
||||||
|
|
||||||
public $index = 'ciblage';
|
public $index = 'ciblage';
|
||||||
|
|
||||||
@ -24,6 +25,7 @@ Class Ciblage
|
|||||||
|
|
||||||
protected function setMinMax($name, $valeur)
|
protected function setMinMax($name, $valeur)
|
||||||
{
|
{
|
||||||
|
if(!$this->need) {
|
||||||
if(!empty($name)) {
|
if(!empty($name)) {
|
||||||
$default = Fields::getMinMax($name);
|
$default = Fields::getMinMax($name);
|
||||||
|
|
||||||
@ -31,11 +33,13 @@ Class Ciblage
|
|||||||
if(empty($valeur[1])){$valeur[1] = $default[0]['max'];}
|
if(empty($valeur[1])){$valeur[1] = $default[0]['max'];}
|
||||||
}
|
}
|
||||||
return ($valeur);
|
return ($valeur);
|
||||||
|
}
|
||||||
|
return ($valeur);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __construct($structure, $need = false)
|
public function __construct($structure, $need = false)
|
||||||
{
|
{
|
||||||
|
$this->need = true;
|
||||||
$this->sphinx = new SphinxClient();
|
$this->sphinx = new SphinxClient();
|
||||||
$this->sphinx->SetServer($this->sphinx_host, $this->sphinx_port);
|
$this->sphinx->SetServer($this->sphinx_host, $this->sphinx_port);
|
||||||
$this->sphinx->SetMatchMode(SPH_MATCH_EXTENDED2);
|
$this->sphinx->SetMatchMode(SPH_MATCH_EXTENDED2);
|
||||||
@ -75,7 +79,6 @@ Class Ciblage
|
|||||||
return ($resSphinx['total_found']);
|
return ($resSphinx['total_found']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function getSiret($structure)
|
protected function getSiret($structure)
|
||||||
{
|
{
|
||||||
$siret = array();
|
$siret = array();
|
||||||
@ -190,7 +193,7 @@ Class Ciblage
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function capital($valeur) {
|
protected function capital($valeur) {
|
||||||
//$valeur = $this->setMinMax($name, $valeur);
|
$valeur = $this->setMinMax($name, $valeur);
|
||||||
|
|
||||||
$this->setFilterRange('capital', $valeur);
|
$this->setFilterRange('capital', $valeur);
|
||||||
}
|
}
|
||||||
@ -221,7 +224,7 @@ Class Ciblage
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function teff_etab($valeur) {
|
protected function teff_etab($valeur) {
|
||||||
$valeur = $this->setMinMax($name, $valeur);
|
//$valeur = $this->setMinMax($name, $valeur);
|
||||||
|
|
||||||
$this->setFilterRange('teff_etab', $valeur);
|
$this->setFilterRange('teff_etab', $valeur);
|
||||||
}
|
}
|
||||||
|
@ -784,7 +784,7 @@ Class Fields
|
|||||||
$result = $table->fetchAll($sql)->toArray();
|
$result = $table->fetchAll($sql)->toArray();
|
||||||
|
|
||||||
foreach ($result as $res) {
|
foreach ($result as $res) {
|
||||||
$return[] = $res['INSEE'];
|
$return[] = trim($res['INSEE']);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'adr_dept':
|
case 'adr_dept':
|
||||||
@ -796,13 +796,12 @@ Class Fields
|
|||||||
->setIntegrityCheck(false);
|
->setIntegrityCheck(false);
|
||||||
$result = $table->fetchAll($sql)->toArray();
|
$result = $table->fetchAll($sql)->toArray();
|
||||||
foreach ($result as $res) {
|
foreach ($result as $res) {
|
||||||
$return[] = $res['INSEE'];
|
$return[] = trim($res['INSEE']);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
return (array($valeur));
|
return (array($valeur));
|
||||||
|
|
||||||
return ($return);
|
return ($return);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ $(document).ready(function(){
|
|||||||
function(){ $('#control').css('display', 'none'); }
|
function(){ $('#control').css('display', 'none'); }
|
||||||
);
|
);
|
||||||
|
|
||||||
$('#saveciblage').on('click', function(){
|
$('.saveciblage').on('click', function(){
|
||||||
var title = 'Sauvegarde du profil de ciblage';
|
var title = 'Sauvegarde du profil de ciblage';
|
||||||
var href = $(this).attr('href');
|
var href = $(this).attr('href');
|
||||||
var dialogOpts = {
|
var dialogOpts = {
|
||||||
|
@ -15,6 +15,18 @@ em { font-style: italic }
|
|||||||
a img { border:none } /* Gets rid of IE's blue borders */
|
a img { border:none } /* Gets rid of IE's blue borders */
|
||||||
|
|
||||||
|
|
||||||
|
#Valide
|
||||||
|
{
|
||||||
|
padding:5px;
|
||||||
|
border:1px solid black;
|
||||||
|
background-color:#182838;
|
||||||
|
}
|
||||||
|
|
||||||
|
#Valide a
|
||||||
|
{
|
||||||
|
color:white;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
/* Main
|
/* Main
|
||||||
----------------------------------*/
|
----------------------------------*/
|
||||||
body {
|
body {
|
||||||
|
Loading…
Reference in New Issue
Block a user