Revue complete du code version 1.2

This commit is contained in:
Michael RICOIS 2012-05-16 08:12:57 +00:00
commit 49aded2279
46 changed files with 2684 additions and 3007 deletions

View File

@ -5,12 +5,53 @@ class ArborescenceController extends Zend_Controller_Action
public function nafAction()
{
$this->_helper->layout()->disableLayout();
$request = $this->getRequest();
$key = $request->getParam('key');
$object = new Object_Naf();
$request = $this->getRequest();
$key = $request->getParam('key');
$niveau = $request->getParam('niveau', 1);
$fields = new Scores_Fields();
$val = $fields->getCritere($key);
$valuesChecked = array();
$valuesUndetermined = array();
if ($val != null){
$valuesChecked = $val['in'];
if (count($valuesChecked)>0) {
foreach($valuesChecked as $value){
$valuesUndetermined = array_merge($valuesUndetermined, $this->getNafParent($value, true));
}
}
}
$nafM = new Application_Model_Naf();
$sql = $nafM->select()->where('niveau = ?', $niveau)->order('code ASC');
$result = $nafM->fetchAll($sql)->toArray();
$tabNaf = array();
foreach($result as $item)
{
if ( $item['niveau']==1 ) {
$data = $item['lib'];
} else {
$data = $item['lib'].' ('.$item['code'].')';
}
$structure = array(
'data' => $data,
'attr' => array('id' => $item['code'], 'niveau' => $item['niveau']),
'state' => 'closed',
'children' => array(),
);
if (in_array($item['code'], $valuesChecked)){
$structure['attr']['class'] = 'jstree-checked';
}
if (in_array($item['code'], $valuesUndetermined)){
$structure['attr']['class'] = 'jstree-undetermined';
}
$tabNaf[] = $structure;
}
$this->view->key = $key;
$this->view->naf = $object->naf($request->getParam('niveau', 1), $key);
$this->view->naf = json_encode($tabNaf);
}
public function nafajaxAction()
@ -18,16 +59,79 @@ class ArborescenceController extends Zend_Controller_Action
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$request = $this->getRequest();
$key = $request->getParam('key');
$object = new Object_Naf();
$request = $this->getRequest();
$key = $request->getParam('key');
$niveau = $request->getParam('niveau', 1);
$niveau = $niveau + 1;
echo $object->ajax($request->getParam('parent', ''),
$request->getParam('niveau', 1),
$request->getParam('key')
);
//Récupération des valeurs enregistrées en session
$fields = new Scores_Fields();
$val = $fields->getCritere($key);
$valuesChecked = array();
$valuesUndetermined = array();
if ($val != null){
$valuesChecked = $val['in'];
if (count($valuesChecked)>0) {
foreach($valuesChecked as $value){
$valuesUndetermined = array_merge($valuesUndetermined, $this->getNafParent($value, true));
}
}
}
$niveau++;
$nafM = new Application_Model_Naf();
$sql = $nafM->select();
if (!empty($parent) && $niveau==2) {
$sql->where('parent = ?', $parent);
} elseif (!empty($parent) && $niveau>2) {
$sql->where("code LIKE '".$parent."%'");
}
$sql->where('niveau = ?', $niveau)->order('code ASC');
$result = $nafM->fetchAll($sql)->toArray();
$tabNaf = array();
foreach($result as $item){
$structure = array(
'data' => $item['code'].' - '.$item['lib'],
'attr' => array('id' => $item['code'], 'niveau' => $item['niveau']),
);
if (in_array($item['code'], $valuesChecked)){
$structure['attr']['class'] = 'jstree-checked';
}
if (in_array($item['code'], $valuesUndetermined)){
$structure['attr']['class'] = 'jstree-undetermined';
}
if ($niveau<5){
$structure['state'] = 'closed';
$structure['children'] = array();
}
$tabNaf[] = $structure;
}
echo json_encode($tabNaf);
}
protected function getNafParent($value, $niveau1 = false)
{
$out = array();
if (strlen($value)>2) {
$niveau = strlen($value)-1;
$new = substr($value,0,$niveau);
$out = array_merge($out, array($new), $this->getNafParent($new, $niveau1));
} elseif (strlen($value)==2 && $niveau1 === true) {
$nafM = new Application_Model_Naf();
$sql = $nafM->select()
->from($nafM, array('parent'))
->where('code = ?', $value);
$result = $nafM->fetchRow($sql);
$out[] = $result->parent;
}
return $out;
}
/* Geographiques */
public function geographiqueAction()
{
@ -62,26 +166,123 @@ class ArborescenceController extends Zend_Controller_Action
{
$this->_helper->layout()->disableLayout();
$object = new Object_Formejuridique();
$key = $this->getRequest()->getParam('key');
$fields = new Scores_Fields();
$val = $fields->getCritere('cj');
$this->view->key = $key;
$this->view->formejuridiques = $object->_getParents();
$valuesChecked = array();
$valuesUndetermined = array();
if ($val != null){
$valuesChecked = $val['in'];
if (count($valuesChecked)>0) {
foreach($valuesChecked as $value){
if (strlen($value)>1) {
$valuesUndetermined = array_merge($valuesUndetermined, array(substr($value,0,1)));
}
}
}
}
$FormeJuridiqueM = new Application_Model_FormeJuridique();
$sql = $FormeJuridiqueM->select()
->where('LENGTH(fjCode) = 1')
->order('fjLibelle ASC');
$formes = $FormeJuridiqueM->fetchAll($sql)->toArray();
$tabFJ = array();
foreach($formes as $forme) {
$structure = array(
'data' => $forme['fjLibelle'],
'attr' => array( 'id' => $forme['fjCode'] ),
'state' => 'closed',
'children' => array(),
);
if (in_array($forme['fjCode'], $valuesChecked)){
$structure['attr']['class'] = 'jstree-checked';
}
if (in_array($forme['fjCode'], $valuesUndetermined)){
$structure['attr']['class'] = 'jstree-undetermined';
}
$tabFJ[] = $structure;
}
$key = $this->getRequest()->getParam('key');
$this->view->key = $key;
$this->view->formejuridiques = json_encode($tabFJ);
}
public function juridiqueajaxAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$object = new Object_Formejuridique();
$request = $this->getRequest();
$id = $request->getParam('id');
echo ($object->_getFils($id));
$request = $this->getRequest();
$id = $request->getParam('id');
$length = strlen($id);
$followingLevel = 5;
if ( $length==1 ) {
$followingLevel = 2;
} elseif ( $length==2 ) {
$followingLevel = 4;
}
$fields = new Scores_Fields();
$val = $fields->getCritere('cj');
$valuesChecked = array();
$valuesUndetermined = array();
if ($val != null){
$valuesChecked = $val['in'];
if (count($valuesChecked)>0) {
foreach($valuesChecked as $value){
if (strlen($value)>$followingLevel) {
$valuesUndetermined = array_merge($valuesUndetermined, substr($value,0,$followingLevel));
}
}
}
}
Zend_Registry::get('firebug')->info($valuesChecked);
if ($length<4) {
$FormeJuridiqueM = new Application_Model_FormeJuridique();
$sql = $FormeJuridiqueM->select()
->where('fjCode LIKE "'.$id.'%"')
->where('LENGTH(fjCode)=?', $followingLevel);
$formes = $FormeJuridiqueM->fetchAll($sql)->toArray();
$tabFJ = array();
foreach($formes as $forme) {
$data = $forme['fjLibelle'];
if ( $followingLevel==4 ) {
$data = $forme['fjLibelle'].' ('.$forme['fjCode'].')';
}
$structure = array(
'data' => $data,
'attr' => array( 'id' => $forme['fjCode'] ),
);
if ( $length<2 ) {
$structure['state'] = 'closed';
$structure['children'] = array();
}
if (in_array($forme['fjCode'], $valuesChecked)){
$structure['attr']['class'] = 'jstree-checked';
}
if (in_array($forme['fjCode'], $valuesUndetermined)){
$structure['attr']['class'] = 'jstree-undetermined';
}
$tabFJ[] = $structure;
}
echo json_encode($tabFJ);
}
}
}

View File

@ -16,27 +16,53 @@ class ComptageController extends Zend_Controller_Action
$cle = $request->getParam('cle');
$valeur = $request->getParam('valeur');
$object = new Object_Comptage();
echo $object->count($cle, $valeur);
//Set the flag for exclusion
$exclude = $request->getParam('exclude');
$ex = false;
if ( !empty($exclude) ) {
$ex = true;
}
$fields = new Scores_Fields();
$fields->setCritere($cle, $valeur, $ex);
//Comptage
require_once 'Scores/Ciblage.php';
$ciblage = new Ciblage($fields->getValues());
$total = $ciblage->execute();
$insee = $ciblage->calculRedevanceInsee();
$fields->setNb('total', $total);
$fields->setNb('insee', $insee);
//@todo : Ajouter les critères sous forme json_encode
//Retour comptage, unité Insee
$result = array(
'count' => number_format($total, 0, '', ' '),
'insee' => number_format($insee, 0, '', ' ')
);
echo json_encode($result);
}
public function resetAction()
{
require_once 'Scores/SessionCiblage.php';
$erreurs = new Zend_Session_Namespace('erreurs');
$session = new SessionCiblage();
$session->clearCiblage();
$fields = new Scores_Fields();
$fields->clearCiblage();
unset($erreurs->erreurs);
$this->_redirect('./');
$this->_redirect('/');
}
public function savedialogAction()
{
$this->_helper->layout()->disableLayout();
//Récupération de la session pour le profil et les valeurs du comptage
require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage();
$criteres = $session->getCriteres();
$fields = new Scores_Fields();
$criteres = $fields->getCriteres();
$this->view->criteres = $criteres;
if (count($criteres) == 0) {
@ -65,8 +91,7 @@ class ComptageController extends Zend_Controller_Action
$criteres = $criteresRow->current();
$structure = json_decode($criteres->criteres, true);
require_once 'Scores/Field.php';
$field = new Fields();
$field = new Scores_Fields();
$values = $field->getValues($structure);
//Comptage

View File

@ -14,7 +14,6 @@ class DashboardController extends Zend_Controller_Action
$this->view->comptages = $object->index();
$this->view->enrichissements = $object->enrichissements();
}
public function ciblagesAction()
@ -29,18 +28,55 @@ class DashboardController extends Zend_Controller_Action
public function ciblageAction()
{
require_once('Scores/Field.php');
$object = new Object_Dashboard();
$request = $this->getRequest();
$comptage = $object->ciblagedetail($request->getParam('id'));
$enrichissement = $object->enrichissement($request->getParam('id'));
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$this->view->comptageId = $request->getParam('id');
$this->view->label = new Fields();
$this->view->criteres = $comptage['criteres'];
$this->view->comptages = $comptage['comptages'];
$this->view->enrichissements = $enrichissement;
$this->view->pathfile = $config->path->data;
$comptageId = $request->getParam('id');
$fields = new Scores_Fields();
//Lecture des paramètres du ciblage
$criteresM = new Application_Model_Criteres();
$sql = $criteresM->select()
->where('idClient = ?', $user->idClient)
->where('login = ?', $user->username)
->where('id = ?', $comptageId);
$criteres = $criteresM->fetchRow($sql)->toArray();
$infosCriteres = array();
if ($criteres != null) {
$decodeCriteres = json_decode($criteres['criteres'], true);
//Construction affichage des critères
foreach ( $decodeCriteres as $key => $item ) {
//Add label to struct for display
$infosCriteres[] = array(
'label' => $fields->getLabel($key),
'in' => $item['in'],
'ex' => $item['ex'],
);
}
//Lecture des comptages
$comptageM = new Application_Model_Comptages();
$sql = $comptageM->select()
->where('idDefinition = ?', $comptageId)
->order('dateAjout DESC');
$comptages = $comptageM->fetchAll($sql)->toArray();
Zend_Registry::get('firebug')->info($comptages[0]);
//Lecture enrichissement existe
//Affichage
$this->view->comptageId = $comptageId;
$this->view->criteres = $infosCriteres;
$this->view->comptages = $comptages;
$this->view->enrichissements = $enrichissement;
}
}
public function rcomptageAction()

View File

@ -8,8 +8,7 @@ class EconomiqueController extends Zend_Controller_Action
public function indexAction()
{
require_once('Scores/Field.php');
$field = new Fields();
$field = new Scores_Fields();
$this->view->fields = $field;
}
@ -17,9 +16,9 @@ class EconomiqueController extends Zend_Controller_Action
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
require_once('Scores/SessionCiblage.php');
$session = new SessionCiblage();
$session->resetFamille('economique');
$fields = new Scores_Fields();
$fields->resetFamille('economique');
}
public function completedAction()
@ -27,15 +26,21 @@ class EconomiqueController extends Zend_Controller_Action
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$request = $this->getRequest();
$q = strtolower($request->getParam('q'));
$separator = ' , ';
$table = new Application_Model_Naf();
$sql = $table->select()
->where('lib LIKE "%'.$this->getRequest()->getParam('q').'%"');
->where('LOWER(lib) LIKE "%'.$q.'%"')
->where('niveau = 5');
$result = $table->fetchAll($sql);
foreach ($result as $item) {
$output[] = array(
'label' => $item->lib . $separator . $item->code,
'value' => $item->code
'label' => $item->lib . $separator . $item->code,
'value' => $item->code
);
}
echo json_encode($output);

View File

@ -104,15 +104,20 @@ class EnrichissementController extends Zend_Controller_Action
$criteres = $criteresRow->current();
$structure = json_decode($criteres->criteres, true);
require_once 'Scores/Field.php';
$field = new Fields();
$values = $field->getValues($structure);
//Récupération des SIRET
require_once 'Scores/Ciblage.php';
$ciblage = new Ciblage($values, true);
$ciblage = new Ciblage($structure, true);
$infosExtraction = $ciblage->execute(true);
/*
* @todo :
* Vérifier le nombre d'éléments avec le nombre de ligne
*
*
*/
//Attention calcul uniteInsee réelle
//car si donnée insee alors toutes les lignes doivent être comptés en unité insee
$data = array(
@ -125,13 +130,13 @@ class EnrichissementController extends Zend_Controller_Action
'fichier' => '',
'nbLigneTotales' => count($infosExtraction),
'nbLigneTraites' => 0,
'uniteInsee' => $ciblage->calculRedevanceInsee(),
'uniteInsee' => $result['uniteInsee'],
'error' => '',
'dateAdded' => date('YmdHms'),
);
$identifiantsM = new Application_Model_EnrichissementIdentifiants();
$idIdentifiant = $identifiantsM->insert($data);
exec('php '.APPLICATION_PATH.'/../batch/enrichissement.php --id '.$idIdentifiant);
//exec('php '.APPLICATION_PATH.'/../batch/enrichissement.php --id '.$idIdentifiant);
}
/**
@ -177,10 +182,9 @@ class EnrichissementController extends Zend_Controller_Action
$sql = $criteres->select()->where('id = ?', $idCritere);
$result = $criteres->fetchRow($sql)->toArray();
$criteres = json_decode($result['criteres'], true);
require_once('Scores/Field.php');
require_once('Scores/Ciblage.php');
$field = new Fields();
$count = new Ciblage($field->getValues($criteres));
require_once 'Scores/Ciblage.php';
$count = new Ciblage($criteres);
$item['resultat'] = $count->execute();
$item['uniteInsee'] = $count->calculRedevanceInsee();
}

View File

@ -8,8 +8,7 @@ class EntrepriseController extends Zend_Controller_Action
public function indexAction()
{
require_once('Scores/Field.php');
$field = new Fields();
$field = new Scores_Fields();
$this->view->fields = $field;
}
@ -17,9 +16,7 @@ class EntrepriseController extends Zend_Controller_Action
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
require_once('Scores/SessionCiblage.php');
$session = new SessionCiblage();
$session->resetFamille('entreprise');
$fields = new Scores_Fields();
$fields->resetFamille('entreprise');
}
}
}

View File

@ -9,10 +9,9 @@ class FinancierController extends Zend_Controller_Action
public function indexAction()
{
require_once('Scores/Field.php');
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$field = new Fields();
$field = new Scores_Fields();
$this->view->fields = $field;
}
@ -20,9 +19,8 @@ class FinancierController extends Zend_Controller_Action
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
require_once('Scores/SessionCiblage.php');
$session = new SessionCiblage();
$session->resetFamille('financier');
$fields = new Scores_Fields();
$fields->resetFamille('financier');
}
}

View File

@ -9,10 +9,9 @@ class GeographiqueController extends Zend_Controller_Action
public function indexAction()
{
require_once('Scores/Field.php');
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$field = new Fields();
$field = new Scores_Fields();
$this->view->fields = $field;
}
@ -20,9 +19,8 @@ class GeographiqueController extends Zend_Controller_Action
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
require_once('Scores/SessionCiblage.php');
$session = new SessionCiblage();
$session->resetFamille('geographique');
$fields = new Scores_Fields();
$fields->resetFamille('geographique');
}
public function completedAction()
@ -31,26 +29,29 @@ class GeographiqueController extends Zend_Controller_Action
$this->_helper->viewRenderer->setNoRender();
$request = $this->getRequest();
if($request->getParam('dep')) {
$output = $this->completedDep($request->getParam('q'));
} else if ($request->getParam('reg')) {
$output = $this->completedReg($request->getParam('q'));
} else if($request->getParam('vil')) {
$output = $this->completedVil($request->getParam('q'));
}else if($request->getParam('adr_com')) {
$output = $this->completedVil($request->getParam('q'));
}else if($request->getParam('adr_com_ex')) {
$output = $this->completedVil($request->getParam('q'));
$q = $request->getParam('q');
//Région
$output = $this->completedReg($q);
//Département
if ( count($output)==0 ) {
$output = $this->completedDep($q);
}
//Ville
if ( count($output)==0 ) {
$output = $this->completedVil($q);
}
echo json_encode($output);
}
protected function completedDep($q)
{
$separator = ' , ';
$table = new Application_Model_Departements();
$sql = $table->select()
->where('libdep LIKE "'.$q.'%"');
$sql = $table->select()->where('libdep LIKE "'.$q.'%"');
$result = $table->fetchAll($sql);
foreach ($result as $item) {
$output[] = array(
@ -63,6 +64,8 @@ class GeographiqueController extends Zend_Controller_Action
protected function completedVil($q)
{
$separator = ' , ';
$table = new Application_Model_CodePostaux();
$separator = ' ';
@ -79,6 +82,8 @@ class GeographiqueController extends Zend_Controller_Action
protected function getDeptFromReg($dep)
{
$separator = ' , ';
$table = new Application_Model_Departements();
$sql = $table->select()
->where('codeRegionInsee = '.$dep);
@ -93,6 +98,8 @@ class GeographiqueController extends Zend_Controller_Action
protected function completedReg($q)
{
$separator = ' , ';
$table = new Application_Model_Regions();
$separator = ' ';

View File

@ -24,23 +24,31 @@ Class IndexController extends Zend_Controller_Action
if($ajax)
$this->_helper->layout()->disableLayout();
require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage();
$session = new Scores_Fields();
require_once 'Scores/Field.php';
$this->view->field = new Fields();
$this->view->field = $session;
$this->view->criteres = $session->getCriteres();
}
public function removeAction()
{
require_once('Scores/SessionCiblage.php');
$this->_helper->layout()->disableLayout();
$session = new SessionCiblage();
$session->unsetCritere($this->getRequest()->getParam('critere'));
$objet = new Object_Comptage();
$objet->count(null, null);
$nameCritereToDelete = $this->getRequest()->getParam('critere');
$fields = new Scores_Fields();
$fields->unsetCritere($nameCritereToDelete);
//Comptage
require_once 'Scores/Ciblage.php';
$ciblage = new Ciblage($fields->getValues());
$total = $ciblage->execute();
$insee = $ciblage->calculRedevanceInsee();
$fields->setNb('total', $total);
$fields->setNb('insee', $insee);
$this->_redirect('/');
}
}
}

View File

@ -9,8 +9,7 @@ class JuridiqueController extends Zend_Controller_Action
public function indexAction()
{
require_once('Scores/Field.php');
$field = new Fields();
$field = new Scores_Fields();
$this->view->fields = $field;
}
@ -18,9 +17,8 @@ class JuridiqueController extends Zend_Controller_Action
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
require_once('Scores/SessionCiblage.php');
$session = new SessionCiblage();
$session->resetFamille('juridique');
$fields = new Scores_Fields();
$fields->resetFamille('juridique');
}
public function completedAction()
@ -30,8 +28,13 @@ class JuridiqueController extends Zend_Controller_Action
$this->_helper->viewRenderer->setNoRender();
$request = $this->getRequest();
$q = strtolower($request->getParam('q'));
$separator = ' , ';
$sql = $table->select()
->where('fjLibelle LIKE "'.$request->getParam('q').'%"');
->where('LOWER(fjLibelle) LIKE "%'.$q.'%"')
->where('LENGTH(fjCode) = 4');
$result = $table->fetchAll($sql);
foreach ($result as $item) {
$output[] = array(

View File

@ -1,85 +1,154 @@
<?php
Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
{
public function Field($name, $field, $type = null)
protected $display = true;
protected $name = '';
public function Field($name)
{
$this->name = $name;
//Read the dico
$fields = new Scores_Fields();
$params = $fields->get($name);
$html = '';
if($field != null) {
$html.= '<div class="fieldgrp">';
if($type == null)
$type = $field['type'];
switch($type)
$label = $labelG = $fields->getLabel($name);
//How many type of fields is defined
$nbFields = count($params['fields']);
$this->display = true;
//If more than one field exist we need to make a special display
if ( $nbFields > 1) {
$html.= '<div class="fieldgrp clearfix">';
$html.= $this->structureLabel($label);
$html.= '<div class="field">';
foreach ( $params['fields'] as $type => $options )
{
case 'select':
$html.= $this->structureHTML(
$field['label'],
$this->selectHTML($name, $field));
break;
case 'selectMultiple':
$html.= $this->structureHTML(
$field['label'],
$this->selectMultipleHTML($name, $field));
break;
case 'intervalSelect':
$html.= $this->structureHTML(
$field['label'],
$this->intervalSelectHTML($name, $field));
break;
case 'interval':
$html.= $this->structureHTML(
$field['label'],
$this->intervalHTML($name, $field));
break;
case 'date':
$html.= $this->structureHTML(
$field['label'],
$this->dateHTML($name, $field));
break;
case 'text':
switch($name) {
case 'reg':
$label = 'Régions';
break;
case 'vil':
case 'adr_com':
$label = 'Villes';
break;
case 'dep':
$label = 'Départements';
break;
default:
$label = $field['label'];
}
$html.= $this->structureHTML(
$label,
$this->textHTML($name, $field, $name), $field['help'][ucfirst($name)]);
break;
case 'textarea':
$html.= $this->structureHTML(
$field['label'],
$this->textareaHTML($name, $field));
break;
case 'radio':
$html.= $this->structureHTML(
$field['label'],
$this->radioHTML($name, $field));
break;
case 'file':
$html.= $this->structureHTML(
$field['label'],
$this->fileuploadHtml($name, $field));
break;
switch ($type) {
case 'tree':
$href = $this->view->url(array('controller' => 'arborescence', 'action' => $options['action'], 'key' => $name));
$html.= '<a class="arborescence" title="'.$options['title'].'" href="'.$href.'">';
$html.= '<img src="/themes/default/images/arborescence.gif" />';
$html.= '</a>';
break;
case 'text':
$html.= '<a class="text" href="#" id="'.$name.'" >';
$html.= '<img style="cursor:pointer" src="/themes/default/images/Textarea.gif" title="'.$options['title'].'"/>';
$html.= '</a>';
break;
}
$html.= '&nbsp;';
}
$html.= '</div>';
$html.= '</div>';
//Masquer les champs
$this->display = false;
}
//Draw fields
foreach ( $params['fields'] as $type => $options )
{
$label = $labelG;
if ( array_key_exists('label', $options) ) {
$label = $options['label'];
}
switch($type)
{
case 'select':
$html.= $this->structureHTML(
$label,
$this->selectHTML($name, $options)
);
break;
case 'selectMultiple':
$html.= $this->structureHTML(
$label,
$this->selectMultipleHTML($name, $options)
);
break;
case 'intervalSelect':
$html.= $this->structureHTML(
$label,
$this->intervalSelectHTML($name, $options)
);
break;
case 'checkbox':
$html.= $this->structureHTML(
$label,
$this->checkboxHTML($name, $options)
);
break;
case 'interval':
$html.= $this->structureHTML(
$label,
$this->intervalHTML($name, $field)
);
break;
case 'date':
$html.= $this->structureHTML(
$field['label'],
$this->dateHTML($name, $field));
break;
case 'text':
switch($name) {
case 'reg':
$label = 'Régions';
break;
case 'dep':
$label = 'Départements';
break;
}
$html.= $this->structureHTML(
$label,
$this->textHTML($name, $options)
);
break;
case 'textarea':
$html.= $this->structureHTML(
$field['label'],
$this->textareaHTML($name, $field)
);
break;
case 'radio':
$html.= $this->structureHTML(
$field['label'],
$this->radioHTML($name, $field));
break;
case 'file':
$html.= $this->structureHTML(
$field['label'],
$this->fileuploadHtml($name, $field));
break;
case 'tree':
//Do nothing
break;
default:
$html.= $this->structureHTML($label, '');
break;
}
}
return $html;
}
private function structureHTML($label, $html, $help = null)
private function structureHTML($label, $html)
{
$out = '';
$out.= $this->structureLabel($label, $help);
$style = '';
$class = ' class="fieldgrp"';
if ( $this->display===false ) {
$style = ' style="display:none;"';
}
$out.= '<div id="field_'.$this->name.'" '.$class.''.$style.'>';
$out.= $this->structureLabel($label);
$out.= '<div class="field">'.$html.'</div>';
$out.= '</div>';
return $out;
}
@ -87,33 +156,32 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
* Définition du label
* @param unknown_type $label
*/
private function structureLabel($label, $help)
private function structureLabel($label)
{
$return = '<label>'.$label.'</label>';
if($help)
$return .= '<p style="font-size:9px;">'.$help.'</p>';
return ($return);
return $return;
}
protected function getMinMax($name, $valeur)
{
if(!empty($name)) {
$default = Fields::getMinMax($name);
//$fields = new Scores_Fields();
//$default = $fields->getMinMax($name);
if(empty($valeur[0])){$valeur[0] = $default[0]['min'];}
if(empty($valeur[1])){$valeur[1] = $default[0]['max'];}
}
return ($valeur);
}
private function intervalSelectHTML($name, $field)
private function intervalSelectHTML($name, $options)
{
$session = new SessionCiblage();
$session = new Scores_Fields();
$sessionValeur = explode(',', $session->getCritere($name));
$minMax = $this->getMinMax($name, array(0,0));
$return = '<select class="intervalSelect" name="'.$name.'1" id="'.$name.'" number="1">';
foreach($field['fields'][$field['type']]['value'] as $elements) {
foreach($options['value'] as $elements) {
if($elements[0] == 0)
$return .= '<option value="'.$minMax[0].'">Min</option>';
else
@ -122,7 +190,7 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
$return .= '</select> à ';
$return .= '<select class="intervalSelect" name="'.$name.'2" id="'.$name.'" number="2">';
foreach($field['fields'][$field['type']]['value'] as $elements) {
foreach($options['value'] as $elements) {
if($elements[1] == 0)
$return .= '<option value="'.$minMax[1].'">Max</option>';
else
@ -134,50 +202,77 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
return ($return);
}
/* Select */
private function selectMultipleHTML($name, $field)
protected function checkboxHTML($name, $options)
{
$session = new SessionCiblage();
$session = new Scores_Fields();
$sessionValeur = $session->getCritere($name);
$sessionValeur = $session->getCritere($name);
/*if(is_array($sessionValeur))
$sessionValeur = implode(',', $sessionValeur);*/
$return = '<select size="'.count($field['fields'][$field['type']]['value']).'" class="criteres '.$field['type']['class'].'" name="'.$name.'" multiple>';
$return .= '<option '.(($sessionValeur == '-')?'selected':'').' value="-">-</option>';
foreach($field['fields'][$field['type']]['value'] as $value => $label) {
$selected = "";
if(($sessionValeur != null) and in_array($value, $sessionValeur) and $sessionValeur != "tous")
$selected = " selected";
$return .= '<option'.$selected.' value="'.$value.'">'.$label.'</option>';
}
$return .= '</select>';
return ($return);
$select = '';
if ($sessionValeur==1) $select = ' checked';
$return = '<input type="checkbox" class="criteres" name="'.$name.'" value="'.$options['value'].'"'.$select.'>';
return $return;
}
/* Select Multiple */
private function selectHTML($name, $field)
/**
*
* @param unknown_type $name
* @param unknown_type $options
* @return string
*/
protected function selectMultipleHTML($name, $options)
{
$session = new SessionCiblage();
$session = new Scores_Fields();
$sessionValeur = $session->getCritere($name);
if(is_array($sessionValeur))
$sessionValeur = implode(',', $sessionValeur);
$return = '<select class="criteres '.$field['type']['class'].'" name="'.$name.'">';
$return .= '<option '.(($sessionValeur == '-')?'selected':'').' value="-">-</option>';
foreach($field['fields'][$field['type']]['value'] as $value => $label) {
$return = '<select size="'.count($options['value']).'" class="criteres " name="'.$name.'" multiple>';
foreach($options['value'] as $value => $label) {
$selected = "";
if(($sessionValeur != null) and $sessionValeur == $value and $sessionValeur != "-")
if( !empty($sessionValeur) ) {
if ( is_array($sessionValeur) && in_array($value, $sessionValeur) ) {
$selected = " selected";
}
}
$return .= '<option'.$selected.' value="'.$value.'">'.$label.'</option>';
}
$return .= '</select>';
$return .= '<a href="#" class="selectMultiple">Sélectionner</a>';
$return .= '&nbsp;<a href="#" class="selectMultipleEx">Exclure</a>';
return $return;
}
/**
*
* @param unknown_type $name
* @param unknown_type $options
* @return string
*/
protected function selectHTML($name, $options)
{
$session = new Scores_Fields();
$sessionValeur = $session->getCritere($name);
if( is_array($sessionValeur) ) {
$sessionValeur = implode(',', $sessionValeur);
}
$return = '<select class="criteres" name="'.$name.'">';
$return .= '<option '.(($sessionValeur == '-')?'selected':'').' value="-">-</option>';
foreach($options['value'] as $value => $label) {
$selected = "";
if( $sessionValeur!==null && $sessionValeur != "-" && $sessionValeur==$value )
$selected = " selected";
$return .= '<option'.$selected.' value="'.$value.'">'.$label.'</option>';
}
$return .= '</select>';
return ($return);
return $return;
}
/* Interval */
private function intervalHTML($name, $field)
{
$session = new SessionCiblage();
$session = new Scores_Fields();
$valeur = $session->getCritere($name);
$valeur = explode(',', $valeur);
@ -187,13 +282,13 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
$return .= ' <a href="" class="interval" id="'.$name.'">Valider</a>';
$return .= '</div>';
return ($return);
return $return;
}
/* Dates */
private function dateHTML($name, $field)
{
$session = new SessionCiblage();
$session = new Scores_Fields();
$return = '<div class="date" >';
$return .= '<input value="'.$session->getCritere($name).'" type="text" class="datepicker" name="'.$name.'1" /> a ';
@ -204,9 +299,9 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
}
/* Textes */
private function textHTML($name, $field, $name)
private function textHTML($name, $options)
{
$session = new SessionCiblage();
$session = new Scores_Fields();
switch($name) {
case 'ape_entrep':
case 'ape_etab':
@ -230,10 +325,10 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
$type= $name;
break;
}
/* 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 .= '<a href="" class="autocomplet" textarea="'.$name.'">Valider</a> <a href="">Aide</a>';
return ($return);
$return = '<input type="text" class="criteres autocomplete" name="'.$name.'" />';
$return .= '<a href="#" class="autocomplete">Sélectionner</a>';
$return .= '&nbsp;<a href="#" class="autocompleteEx">Exclure</a>';
return $return;
}
/* Textarea */

View File

@ -1 +1,18 @@
<?php
<div>
<ul>
<li>Champs de sélection simple
<p>Texte</p>
</li>
<li>
Champs de sélection multiple
<p>Texte</p>
</li>
<li>Arborescence
<p>Texte</p>
</li>
</ul>
</div>

View File

@ -1,16 +1,16 @@
<div id="<?=$this->key?>" class="jstree jstree-default" style="overflow:auto;"></div>
<script>
$("#<?=$this->key?>").jstree({
$("div#<?=$this->key?>").jstree({
"themes" : {
"theme" : "default",
"url" : "/themes/jstree/classic/style.css",
"dots" : true,
"icons" : false,
"icons" : false,
},
"plugins" : ["themes", "json_data", "checkbox"],
"json_data" : {
"data" : <?=$this->regions?>,
"ajax" : {
"json_data" : {
"data" : <?=$this->regions?>,
"ajax" : {
"url" : '<?=$this->url(array('controller'=>'arborescence', 'action'=>'geographiqueajax', 'key'=> $this->key))?>',
"data" : function(n) { return { id: n.attr ? n.attr("id") : '' , niveau : n.attr ? n.attr("niveau") : 1 }; },
"cache" : true,

View File

@ -1,20 +1,20 @@
<div id="<?=$this->key?>" class="jstree jstree-default" style="overflow:auto;"></div>
<script>
$("#<?=$this->key?>").jstree({
$("div#<?=$this->key?>").jstree({
"themes" : {
"theme" : "default",
"url" : "/style.css",
"url" : "/themes/jstree/classic/style.css",
"dots" : true,
"icons" : false,
"icons" : false,
},
"plugins" : ["themes", "json_data", "checkbox"],
"json_data" : {
"data" : <?=$this->formejuridiques?>,
"ajax" : {
"json_data" : {
"data" : <?=$this->formejuridiques?>,
"ajax" : {
"url" : '<?=$this->url(array('controller'=>'arborescence', 'action'=>'juridiqueajax', 'key'=> $this->key))?>',
"data" : function(n)
{
return { id: n.attr ? n.attr("id") : 0 };
"data" : function(n)
{
return { id: n.attr ? n.attr("id") : 0 };
},
"cache" : true,
}

View File

@ -1,16 +1,16 @@
<div id="<?=$this->key?>" class="jstree jstree-default" style="overflow:auto;"></div>
<script>
$("#<?=$this->key?>").jstree({
$("div#<?=$this->key?>").jstree({
"themes" : {
"theme" : "default",
"url" : "/jstree/style.css",
"url" : "/themes/jstree/classic/style.css",
"dots" : true,
"icons" : false,
"icons" : false,
},
"plugins" : ["themes", "json_data", "checkbox"],
"json_data" : {
"data" : <?=$this->naf?>,
"ajax" : {
"json_data" : {
"data" : <?=$this->naf?>,
"ajax" : {
"url" : '<?=$this->url(array('controller'=>'arborescence', 'action'=>'nafajax', 'key'=> $this->key))?>',
"data" : function(n) { return { parent: n.attr ? n.attr("id") : '' , niveau : n.attr ? n.attr("niveau") : 1 }; },
"cache" : true,

View File

@ -1,25 +1,20 @@
<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</span></li>
</ul>
<div id="dashboard" style="padding:10px">
<a href="/dashboard/index">Tableau de bord</a> > Detail du ciblage<br /><br />
<a class="update" href="<?=$this->url(array('controller'=> 'comptage','action'=>'update', 'id'=>$this->comptageId))?>">Actualiser</a> |
<a href="<?=$this->url(array('controller'=> 'index','action'=>'index', 'id'=>$this->comptageId))?>">Recharger les critères de ciblage</a> |
<a class="update" href="<?=$this->url(array('controller'=> 'comptage','action'=>'update', 'id'=>$this->comptageId))?>">Actualiser</a> |
<a href="<?=$this->url(array('controller'=> 'index','action'=>'index', 'id'=>$this->comptageId))?>">Recharger les critères de ciblage</a> |
<a class="enrichissementref" href="<?=$this->url(array('controller'=> 'enrichissement','action'=>'reference', 'id'=>$this->comptageId))?>">Enrichissement</a>
<fieldset>
<legend>Critères</legend>
<?php foreach(json_decode($this->criteres['criteres'], true) as $critere => $valeur): ?>
<?php if(!empty($valeur) and $valeur != ',' and !empty($critere)): ?>
<?php $label = $this->label->get($critere); ?>
<?php if(!is_array($valeur)): ?>
<?php if($label['type'] != 'textarea' and $label['type'] != 'interval') :?>
<?php echo '<b>'.$label['label'] . '</b> : '.$label['fields'][$label['type']]['value'][$valeur];?><br />
<?php else: ?>
<?php echo '<b>'.$label['label'] . '</b>:'.$valeur; ?><br />
<?php endif; ?>
<?php else:?>
<?php echo '<b>'.$label['label'] .'</b> : '. implode(',', $valeur).'<br />'; ?>
<?php endif; ?>
<?php endif; ?>
<?php endforeach;?>
<pre>
<?php print_r($this->criteres)?>
</pre>
</fieldset>
<fieldset>
@ -47,7 +42,7 @@
<fieldset>
<legend>Enrichissements</legend>
<?php if ( count($this->enrichissements)>0 ) {?>
<?php if ( count($this->enrichissements)>0 ) {?>
<table style="width:100%">
<thead>
<tr>

View File

@ -1,9 +1,16 @@
<div id="dashboard">
<ul class="chemin clearfix rounded_t">
<li class="e0"><a class="lir" href="/">Accueil</a></li>
<li>
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'index'))?>">
<span>Tableau de bord</span>
</a>
</li>
<li class="last">
<span>Liste de vos ciblages</span>
</li>
</ul>
<div class="chemin">
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>''))?>">Tableau de bord</a> >
Liste de vos ciblages
</div>
<div id="dashboard">
<div style="margin:5px 0;">
<h2>Liste de vos ciblages</h2>
@ -26,7 +33,7 @@ Liste de vos ciblages
<td class="reference"><?=$item['reference']?></td>
<td class="update resultat"><?=number_format($item['resultat'], 0, ',', ' ')?></td>
<td class="update insee"><?=number_format($item['uniteInsee'], 0, ',', ' ')?></td>
<td class="update date"><?=$item['dateComptage']?></td>
<td class="update date"><?=$item['dateComptage']?></td>
<td><a class="update" href="<?=$this->url(array('controller'=> 'comptage','action'=>'update', 'id'=>$item['id']))?>">Actualiser</a></td>
<td><a href="<?=$this->url(array('controller'=> 'index','action'=>'index', 'id'=>$item['id']))?>">Recharger les critères de ciblage</a></td>
<td><a href="<?=$this->url(array('controller'=> 'dashboard','action'=>'ciblage', 'id'=>$item['id']))?>">Detail</a></td>

View File

@ -1,9 +1,16 @@
<div id="dashboard">
<ul class="chemin clearfix rounded_t">
<li class="e0"><a class="lir" href="/">Accueil</a></li>
<li>
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'index'))?>">
<span>Tableau de bord</span>
</a>
</li>
<li class="last">
<span>Enrichissements</span>
</li>
</ul>
<div class="chemin">
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>''))?>">Tableau de bord</a> >
Enrichissement à partir d'un ciblage
</div>
<div id="dashboard">
<h2>Fichiers en cours d'enrichissement</h2>
@ -15,7 +22,7 @@ Enrichissement à partir d'un ciblage
<th>Nombre de lignes totales</th>
<th>Nombre de lignes traitées</th>
<th>Date</th>
<th>Etat</th>
<th>Etat</th>
</tr>
</thead>
<tbody>
@ -49,7 +56,7 @@ Enrichissement à partir d'un ciblage
<th>Référence</th>
<th>Nombre de lignes totales</th>
<th>Date</th>
<th>Fichier</th>
<th>Fichier</th>
</tr>
</thead>
<tbody>
@ -77,7 +84,7 @@ $(document).ready(function()
$(document).focusout(function(){
clearInterval(timer);
});
timer = setInterval(updateInfo, 10000);
timer = setInterval(updateInfo, 10000);
});
var timer;

View File

@ -1,13 +1,21 @@
<ul class="chemin clearfix rounded_t">
<li class="e0"><a class="lir" href="/">Accueil</a></li>
<li>
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'index'))?>">
<span>Tableau de bord</span>
</a>
</li>
<li class="last">
<span></span>
</li>
</ul>
<div id="dashboard">
<div class="chemin">
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>''))?>">Tableau de bord</a>
</div>
<div id="menu">
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'ciblages'))?>">Liste de vos ciblages</a> -
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'enrichissements'))?>">Liste de vos enrichissements</a> -
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'configuration'))?>">Préférences de l'application</a> -
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'ciblages'))?>">Liste de vos ciblages</a> -
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'enrichissements'))?>">Liste de vos enrichissements</a> -
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'configuration'))?>">Préférences de l'application</a> -
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>''))?>">Enrichissement de fichier</a>
</div>
@ -27,7 +35,7 @@
<th>Nombre d'entité</th>
<th>Unité Insee</th>
<th>Date</th>
<th colspan="4"></th>
<th colspan="4"></th>
</tr>
</thead>
<tbody>
@ -40,14 +48,14 @@
<td><a class="update" href="<?=$this->url(array('controller'=> 'comptage','action'=>'update', 'id'=>$item['id']))?>">Actualiser</a></td>
<td><a href="<?=$this->url(array('controller'=> 'index','action'=>'index', 'id'=>$item['id']))?>">Recharger les critères de ciblage</a></td>
<td><a href="<?=$this->url(array('controller'=> 'dashboard','action'=>'ciblage', 'id'=>$item['id']))?>">Detail</a></td>
<td><a class="enrichissementref" href="<?=$this->url(array('controller'=> 'enrichissement','action'=>'reference', 'id'=>$item['id']))?>">Enrichissement</a></td>
<td><a class="enrichissementref" href="<?=$this->url(array('controller'=> 'enrichissement','action'=>'reference', 'id'=>$item['id']))?>">Enrichissement</a></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<?php else:?>
<p>Aucun ciblage.<p>
<?php endif;?>
<?php endif;?>
</div>
@ -60,7 +68,7 @@
<th>Référence</th>
<th>Nombre de lignes totales</th>
<th>Date</th>
<th>Etat</th>
<th>Etat</th>
</tr>
</thead>
<tbody>
@ -86,4 +94,6 @@
<?php else:?>
<p>Aucun enrichissement.<p>
<?php endif;?>
</div>
</div>

View File

@ -1,46 +1,25 @@
<div id="economique">
<div id="s_economique">
<ul id="fieldsblock">
<li><?php echo $this->Field('capital', $this->fields->get('capital'));?></li>
<li><?php echo $this->Field('ape_etab', $this->fields->get('ape_etab'));?></li>
<li class="ape_etab" style="display:none;background-image:none;height:100px;">
<div id="ape_etab_ex" class="exclusion" style="display:none">
<?php echo $this->Field('ape_etab_ex', $this->fields->get('ape_etab_ex'), 'text');?>
</div>
<div id="ape_etab_in" class="inclusion">
<?php echo $this->Field('ape_etab', $this->fields->get('ape_etab'), 'text');?>
</div>
Valeurs exclusions : <input value="1" type="checkbox" class="checkbox_ex" name="ape_etab" />
</li>
<li class="ape_etab" style="display:none;background-image:none;height:100px;">
<div id="ape_entrep_ex" class="exclusion" style="display:none">
<?php echo $this->Field('ape_entrep_ex', $this->fields->get('ape_entrep_ex'), 'text');?>
</div>
<div id="ape_entrep_in" class="inclusion">
<?php echo $this->Field('ape_entrep', $this->fields->get('ape_entrep'), 'text');?>
</div>
Valeurs exclusions : <input value="1" type="checkbox" class="checkbox_ex" name="ape_entrep" />
</li>
<li><?php echo $this->Field('age_etab', $this->fields->get('age_etab'));?></li>
<li><?php echo $this->Field('teff_etab', $this->fields->get('teff_etab'));?></li>
<li><?php echo $this->Field('teff_etabM', $this->fields->get('teff_etabM'));?></li>
<li><?php echo $this->Field('eff_etab', $this->fields->get('eff_etab'));?></li>
</ul>
</div>
<div id="a_economique" style="display:none">
<ul id="fieldsblock">
<li><?php echo $this->Field('age_entrep', $this->fields->get('age_entrep'));?></li>
<li><?php echo $this->Field('teff_entrep', $this->fields->get('teff_entrep'));?></li>
<li><?php echo $this->Field('teff_entrepM', $this->fields->get('teff_entrepM'));?></li>
<li><?php echo $this->Field('eff_entrep', $this->fields->get('eff_entrep'));?></li>
<li><?php echo $this->Field('nbEtab', $this->fields->get('nbEtab'));?></li>
</ul>
</div>
<li><?=$this->Field('capital')?></li>
<li><?=$this->Field('ape_etab')?></li>
<li><?=$this->Field('ape_entrep')?></li>
<li><?=$this->Field('age_etab')?></li>
<li><?=$this->Field('teff_etab')?></li>
<li><?=$this->Field('eff_etab')?></li>
<div id="a_economique" style="display:none;">
<li><?=$this->Field('age_entrep')?></li>
<li><?=$this->Field('teff_entrep')?></li>
<li><?=$this->Field('eff_entrep')?></li>
<li><?=$this->Field('nbEtab')?></li>
</div>
</ul>
<p>
<a class="mode" id="a_economique" style="cursor:pointer;margin-left:50%">
<img src="/themes/default/images/fleche-bas.gif" />
</a>
</p>
</div>
</div>
<div style="text-align:right;margin-top:20px;">
<a class="resetFamille" id="economique">Réinitialiser les critères economiques</a>

View File

@ -4,26 +4,26 @@
<div id="entreprise">
<div id="s_entreprise">
<ul id="fieldsblock">
<li id="siege"><?=$this->Field('siege', $this->fields->get('siege'));?></li>
<li id="sirenGrp"><?=$this->Field('sirenGrp', $this->fields->get('sirenGrp'));?></li>
<li id="tel"><?=$this->Field('tel', $this->fields->get('tel'));?></li>
<li id="fax"><?=$this->Field('fax', $this->fields->get('fax'));?></li>
<li id="web"><?=$this->Field('web', $this->fields->get('web'));?></li>
<li id="mail"><?=$this->Field('mail', $this->fields->get('mail'));?></li>
<li id="presentRcs"><?=$this->Field('present cs', $this->fields->get('presentRcs'));?></li>
<li id="adrDom"><?=$this->Field('adrDom', $this->fields->get('adrDom'));?></li>
<li id="dirNom"><?=$this->Field('dirNom', $this->fields->get('dirNom'));?></li>
<li id="li_dateCrea_etab"><?=$this->Field('dateCrea_etab', $this->fields->get('dateCrea_etab'));?></li>
<li id="part"><?=$this->Field('part', $this->fields->get('part'));?></li>
<li><?=$this->Field('siege')?></li>
<li><?=$this->Field('groupe')?></li>
<li><?=$this->Field('tel')?></li>
<li><?=$this->Field('fax')?></li>
<li><?=$this->Field('web')?></li>
<li><?=$this->Field('mail')?></li>
<li><?=$this->Field('presentRcs')?></li>
<li><?=$this->Field('adrDom')?></li>
<li><?=$this->Field('dirNom')?></li>
<li><?=$this->Field('dateCrea_etab')?></li>
<li><?=$this->Field('participation')?></li>
</ul>
</div>
<div id="a_entreprise" style="display:none">
<ul id="fieldsblock">
<li id="nbMPublic"><?=$this->Field('nbMPubli', $this->fields->get('nbMPubli'));?></li>
<li id="li_dateCrea_etab" ><?=$this->Field('dateCrea_ent',$this->fields->get('dateCrea_ent'));?></li>
<li id="action"><?=$this->Field('action', $this->fields->get('action'));?></li>
<li id="nbActio"><?=$this->Field('nbActio', $this->fields->get('nbActio'));?></li>
<li id="nbPart"><?=$this->Field('nbPart', $this->fields->get('nbPart'));?></li>
<li><?=$this->Field('nbMPubli')?></li>
<li><?=$this->Field('dateCrea_ent')?></li>
<li><?=$this->Field('action')?></li>
<li><?=$this->Field('nbActio')?></li>
<li><?=$this->Field('nbPart')?></li>
</ul>
</div>
<p>

View File

@ -1,53 +1,29 @@
<div id="financiere">
<div id="s_financier">
<ul id="fieldsblock" style="width:100%;height:100%;">
<li style="background: none; height:80px;">
<div id="bilType_ex" class="exclusion" style="display:none">
<?php echo $this->Field('bilType_ex', $this->fields->get('bilType_ex'));?>
</div>
<div id="bilType_in" class="inclusion">
<?php echo $this->Field('bilType', $this->fields->get('bilType'));?>
</div>
Valeurs exclusions : <input value="1" type="checkbox" class="checkbox_ex" name="bilType" />
</li>
<li style="background: none; height:150px;">
<div id="avisCs_ex" class="exclusion" style="display:none">
<?php echo $this->Field('avisCs_ex', $this->fields->get('avisCs_ex'));?>
</div>
<div id="avisCs_in" class="inclusion">
<?php echo $this->Field('avisCs', $this->fields->get('avisCs'));?>
</div>
Valeurs exclusions : <input value="1" type="checkbox" class="checkbox_ex" name="avisCs" />
</li>
<li><?php echo $this->Field('bilAnnee', $this->fields->get('bilAnnee'));?></li>
<li><?php echo $this->Field('bilCloture', $this->fields->get('bilCloture'));?></li>
<li><?php echo $this->Field('bilDuree', $this->fields->get('bilDuree'));?></li>
<li style="background: none; height:190px;">
<div id="bilTca_ex" class="exclusion" style="display:none">
<?php echo $this->Field('bilTca_ex', $this->fields->get('bilTca_ex'));?>
</div>
<div id="bilTca_in" class="inclusion">
<?php echo $this->Field('bilTca', $this->fields->get('bilTca'));?>
</div>
Valeurs exclusions : <input value="1" type="checkbox" class="checkbox_ex" name="bilTca" />
</li>
<li><?php echo $this->Field('bilFL', $this->fields->get('bilFL'));?></li>
<ul id="fieldsblock">
<li><?=$this->Field('bilType')?></li>
<li><?=$this->Field('avisCs')?></li>
<li><?=$this->Field('bilAnnee')?></li>
<li><?=$this->Field('bilCloture')?></li>
<li><?=$this->Field('bilDuree')?></li>
<li><?=$this->Field('bilTca')?></li>
<li><?=$this->Field('bilFL')?></li>
</ul>
</div>
<div id="a_financiere" style="display:none">
<ul id="fieldsblock">
<li><?php echo $this->Field('bilEE', $this->fields->get('bilEE'));?></li>
<li><?php echo $this->Field('bilFK', $this->fields->get('bilFK'));?></li>
<li><?php echo $this->Field('bilFR', $this->fields->get('bilFR'));?></li>
<li><?php echo $this->Field('bilGF', $this->fields->get('bilGF'));?></li>
<li><?php echo $this->Field('bilGP', $this->fields->get('bilGP'));?></li>
<li><?php echo $this->Field('bilGW', $this->fields->get('bilGW'));?></li>
<li><?php echo $this->Field('bilHD', $this->fields->get('bilHD'));?></li>
<li><?php echo $this->Field('bilHH', $this->fields->get('bilHH'));?></li>
<li><?php echo $this->Field('bilHL', $this->fields->get('bilHL'));?></li>
<li><?php echo $this->Field('bilHM', $this->fields->get('bilHM'));?></li>
<li><?php echo $this->Field('bilHN', $this->fields->get('bilHN'));?></li>
<li><?php echo $this->Field('bilYP', $this->fields->get('bilYP'));?></li>
<li><?=$this->Field('bilEE')?></li>
<li><?=$this->Field('bilFK')?></li>
<li><?=$this->Field('bilFR')?></li>
<li><?=$this->Field('bilGF')?></li>
<li><?=$this->Field('bilGP')?></li>
<li><?=$this->Field('bilGW')?></li>
<li><?=$this->Field('bilHD')?></li>
<li><?=$this->Field('bilHH')?></li>
<li><?=$this->Field('bilHL')?></li>
<li><?=$this->Field('bilHM')?></li>
<li><?=$this->Field('bilHN')?></li>
<li><?=$this->Field('bilYP')?></li>
</ul>
</div>
<p>

View File

@ -1,36 +1,17 @@
<div id="geographique">
<ul id="fieldsblock">
<li><?php echo $this->Field('adr_com', $this->fields->get('adr_com'));?></li>
<li class="adr_com" style="display:none;background-image:none;height:100px;">
<div id="adr_com_ex" class="exclusion" style="display:none">
<?php echo $this->Field('adr_com_ex', $this->fields->get('adr_com_ex'), 'text');?>
</div>
<div id="adr_com_in" class="inclusion">
<?php echo $this->Field('adr_com', $this->fields->get('adr_com'), 'text');?>
</div>
Valeurs exclusions : <input value="1" type="checkbox" class="checkbox_ex" name="adr_com" />
<li>
<?=$this->Field('geo')?>
<?=$this->Field('geo_domtom')?>
<?=$this->Field('geo_etranger')?>
<?=$this->Field('geo_corse')?>
</li>
<li class="adr_com" style="display:none;background-image:none;height:150px;">
<div id="adr_dept_ex" class="exclusion" style="display:none">
<?php echo $this->Field('adr_dept_ex', $this->fields->get('adr_dept_ex'), 'text');?>
</div>
<div id="adr_dept_in" class="inclusion">
<?php echo $this->Field('adr_dept', $this->fields->get('adr_dept'), 'text');?>
</div><br />
Recherche régions : <input type="text" name="" id="textarea_adr_reg" /><br />
Valeurs exclusions : <input value="1" type="checkbox" class="checkbox_ex" name="adr_dept" />
</li>
<li style="height:50px;background-image:none">
Exclure DOM-TOM <input style="float:right" value="1" type="checkbox" class="ex_prede" name="ex_domtom" /><br />
Exclure Etranger <input style="float:right" value="1" type="checkbox" class="ex_prede" name="ex_entr" /><br />
Exclure Corse <input style="float:right" value="1" type="checkbox" class="ex_prede" name="ex_corse" /><br />
</li>
<li><?php echo $this->Field('zus', $this->fields->get('zus'), 'select');?></li>
<li><?php echo $this->Field('zru', $this->fields->get('zru'), 'select');?></li>
<li><?php echo $this->Field('zfu', $this->fields->get('zfu'), 'select');?></li>
<li><?php echo $this->Field('cucs', $this->fields->get('cucs'), 'select');?></li>
<li><?php echo $this->Field('zrr', $this->fields->get('zrr'), 'select');?></li>
<li><?php echo $this->Field('zafr', $this->fields->get('zafr'), 'select');?></li>
<li><?=$this->Field('zus')?></li>
<li><?=$this->Field('zru')?></li>
<li><?=$this->Field('zfu')?></li>
<li><?=$this->Field('cucs')?></li>
<li><?=$this->Field('zrr')?></li>
<li><?=$this->Field('zafr')?></li>
</ul>
</div>
<div style="text-align:right;margin-top:20px;">

View File

@ -4,6 +4,7 @@
}
#criteres {
border: 1px solid;
padding:10px 0;
}
#criteres tr td {
@ -62,12 +63,12 @@
</div>
<div style="text-align:center; border:1px solid; background-color:#182838; padding:5px;">
<div style="text-align:center; border:1px solid #ffffff; background-color:#182838; padding:5px;">
<a style="color:white; text-decoration:none;" href="/comptage/reset">Initialiser les critères</a>
</div>
<div style="text-align:center; border:1px solid; background-color:#182838; padding:5px;">
<div style="text-align:center; border:1px solid #ffffff; background-color:#182838; padding:5px;">
<a style="color:white; text-decoration:none;" class="saveciblage" href="/comptage/savedialog">Sauvegarder</a>
</div>
<div style="text-align:center; border:1px solid; background-color:#182838; padding:5px;">
<div style="text-align:center; border:1px solid #ffffff; background-color:#182838; padding:5px;">
<a style="color:white; text-decoration:none;" class="previsualisation" href="/comptage/previsualisation">Prévisualisation</a>
</div>

View File

@ -1,24 +1,15 @@
<div id="juridique">
<div id="s_juridique">
<ul id="fieldsblock">
<li><?php echo $this->Field('cj', $this->fields->get('cj'));?></li>
<li class="cj" style="display:none;background-image:none;height:100px;">
<div id="cj_text_ex" class="exclusion" style="display:none">
<?php echo $this->Field('cj_ex', $this->fields->get('cj_ex'), 'text');?>
</div>
<div id="cj_text_in" class="inclusion">
<?php echo $this->Field('cj', $this->fields->get('cj'), 'text');?>
</div>
Valeurs exclusions : <input value="1" type="checkbox" class="checkbox_ex" name="cj_text" />
</li>
<li><?php echo $this->Field('actifEco', $this->fields->get('actifEco'));?></li>
<li><?php echo $this->Field('procolHisto', $this->fields->get('procolHisto'));?></li>
<li><?php echo $this->Field('dateImmat', $this->fields->get('dateImmat'));?></li>
<li><?=$this->Field('cj')?></li>
<li><?=$this->Field('actifEco')?></li>
<li><?=$this->Field('procolHisto')?></li>
<li><?=$this->Field('dateImmat')?></li>
</ul>
</div>
<div id="a_juridique" style="display:none">
<ul id="fieldsblock">
<li><?php echo $this->Field('tvaIntraValide', $this->fields->get('tvaIntraValide'));?></li>
<li><?=$this->Field('tvaIntraValide')?></li>
</ul>
</div>
<p>

View File

@ -9,8 +9,7 @@ class Application_Controller_Plugin_Comptage extends Zend_Controller_Plugin_Abst
$action = $request->getActionName();
if ($controller == 'index' && $action == 'index') {
require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage();
$session = new Scores_Fields();
$view = $layout->getView();
$auth = Zend_Auth::getInstance();

View File

@ -4,18 +4,16 @@ class Object_Codepostaux
/* Selection des classes statut pour jstree */
public function _jstree_checked($type)
{
require_once('Scores/SessionCiblage.php');
$session = new SessionCiblage();
$valeurs = $session->getCritere($type);
$fields = new Scores_Fields();
$valeurs = $fields->getCritere($type);
return (substr($valeurs, 0, strlen($valeurs)-1));
}
public function _jstree_undetermined($niveau, $type)
{
require_once('Scores/SessionCiblage.php');
$session = new SessionCiblage();
$table = new Application_Model_Departements();
$valeurs = explode(',', $session->getCritere($type));
$fields = new Scores_Fields();
$valeurs = explode(',', $fields->getCritere($type));
//print_r($valeurs);
/*$valeurs = array_merge($valeurs, explode(',', $session->getCritere('adr_com')));*/
$in = array();
@ -45,11 +43,10 @@ class Object_Codepostaux
public function _getClass($valeur, $niveau)
{
require_once('Scores/SessionCiblage.php');
$session = new SessionCiblage();
$valeurs = explode(',', $valeur);
$key = ((strlen($valeur) < 5)?'adr_dept':'adr_com');
$session = explode(',', $session->getCritere('adr_dept'));
$fields = new Scores_Fields();
$session = explode(',', $fields->getCritere('adr_dept'));
$row = 0;
foreach ($session as $dept) {
if(in_array($dept, $valeurs))
@ -114,8 +111,9 @@ class Object_Codepostaux
foreach($departements as $nom) {
$structure[] = array(
'data' => $nom[0]['numdep'].' '.$nom[0]['libdep'],
'attr' => array('id' => $nom[0]['numdep'],
'data' => $nom[0]['libdep'].' ('.$nom[0]['numdep'].')',
'attr' => array(
'id' => $nom[0]['numdep'],
'niveau' => 1,
'class' => $this->_getClass($nom[0]['numdep'], 1)
),
@ -137,8 +135,9 @@ class Object_Codepostaux
foreach($codepostaux as $nom) {
$structure[] = array(
'data' => $nom['Codepos'].' '.$nom['Commune'],
'attr' => array('id'=> $nom['INSEE'],
'data' => $nom['Commune'].' ('.$nom['Codepos'].')',
'attr' => array(
'id'=> $nom['INSEE'],
'niveau' => 2,
'class' => $this->_getClass($nom['INSEE'], 2)
),

View File

@ -9,11 +9,10 @@ class Object_Comptage
'msg'=> "Référence non définie !"));
} else {
//Session
require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage();
$criteres = $session->getCriteres();
$resultat = $session->getNb('total');
$nbInsee = $session->getNb('insee');
$fields = new Scores_Fields();
$criteres = $fields->getCriteres();
$resultat = $fields->getNb('total');
$nbInsee = $fields->getNb('insee');
//Informations utilisateur
$auth = Zend_Auth::getInstance();
@ -60,91 +59,19 @@ class Object_Comptage
public function count($key, $valeur, $need = false)
{
require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage();
if(in_array($key, array('adr_dept', 'adr_com', 'adr_reg', 'adr_com_ex', 'adr_dept_ex')))
{
$valeurs = explode(',', $valeur);
if($key == 'adr_dept') {
$reg_ = $session->getCritere('adr_reg');
if(!empty($reg_)) {
$reg_ = explode(',', $reg_);
$table = new Application_Model_Departements();
$result = array();
foreach($reg_ as $item) {
$sql = $table->select()->where('codeRegionInsee = ?', $item);
$donner = $table->fetchAll($sql)->toArray();
foreach ($donner as $don) {
$result[] = $don['numdep'];
}
foreach($result as $dep) {
if(in_array($dep, $valeurs)) {
$diff[] = $dep;
}
}
$session->unsetCritereValue('adr_reg', $item);
}
}
}
foreach($valeurs as $valeur)
{
$type = explode(':', $valeur);
if(count($type) == 2) {
$key = $type[0];
$valeur = $type[1];
}
switch($key) {
case 'adr_dept':
case 'adr_reg':
$dept .= trim($valeur).',';
break;
case 'adr_com':
case 'vil':
default:
$vil .= trim($valeur).',';
break;
case 'adr_com_ex':
$adr_com_ex .= trim($valeur).',';
break;
case 'adr_dept_ex':
$adr_dept_ex .= trim($valeur).',';
break;
}
}
if(strlen($dept)>0) {
$dept = substr($dept, 0, strlen($dept)-1);
$session->setCritere('adr_dept', $dept);
}
if(strlen($vil)>0) {
$vil = substr($vil, 0, strlen($vil)-1);
$session->setCritere('adr_com', $vil);
}
if(strlen($adr_com_ex)>0) {
$adr_com_ex = substr($adr_com_ex, 0, strlen($adr_com_ex)-1);
$session->setCritere('adr_com_ex', $adr_com_ex);
}
if(strlen($adr_dept_ex)>0) {
$adr_dept_ex = substr($adr_dept_ex, 0, strlen($adr_dept_ex)-1);
$session->setCritere('adr_dept_ex', $adr_dept_ex);
}
} else
$session->setCritere($key, $valeur);
require_once 'Scores/Field.php';
$field = new Fields();
$fields = new Scores_Fields();
//Comptage
require_once 'Scores/Ciblage.php';
$ciblage = new Ciblage($field->getValues());
$ciblage = new Ciblage($fields->getValues());
if($need) {
return $ciblage->execute(true, 10);
}
$total = $ciblage->execute();
$insee = $ciblage->calculRedevanceInsee();
$session->setNb('total', $total);
$session->setNb('insee', $insee);
$fields->setNb('total', $total);
$fields->setNb('insee', $insee);
//@todo : Ajouter les critères sous forme json_encode

View File

@ -1,75 +0,0 @@
<?php
class Object_Formejuridique
{
protected function _jstree_checked()
{
require_once('Scores/SessionCiblage.php');
$session = new SessionCiblage();
$valeurs = explode(',', $session->getCritere('cj'));
foreach($valeurs as $valeur) {
if($valeur != '')
$return[] = $valeur;
}
if(is_array($return))
return ($return);
return (array($valeurs));
}
protected function _jstree_undetermined()
{
return (array());
}
public function _getClass($valeur)
{
if(in_array($valeur, $this->_jstree_checked()))
return ('jstree-checked');
else if (in_array($valeur, $this->_jstree_undetermined()))
return ('jstree-undetermined');
}
public function _getParents()
{
$formes = new Application_Model_FormeJuridique();
$formes = $formes->fetchAll($formes->select()->where('LENGTH(fjCode) = 1'))->toArray();
$structure = array();
foreach($formes as $forme) {
$structure[] = array(
'data' => $forme['fjCode'].' : '.$forme['fjLibelle'],
'attr' => array('id' => $forme['fjCode'],
'class' => $this->_getClass($forme['fjCode'])),
'state' => 'closed',
'children' => array($this->_getFils($forme['fjCode'])),
);
}
return (json_encode($structure));
}
public function _getFils($fjcode)
{
$lenth = ((strlen($fjcode) == 2)?4:2);
$formes = new Application_Model_FormeJuridique();
$sql = $formes->select()->from('formejuridique', array(
'size' => new Zend_Db_Expr('LENGTH(fjCode)'),
'fjCode',
'fjLibelle'))
->where('fjCode LIKE "'.$fjcode.'%"')
->having('size = ?', $lenth);
$formes = $formes->fetchAll($sql)->toArray();
$structure = array();
foreach($formes as $forme) {
$structure = array(
'data' => $forme['fjCode'].' : '.$forme['fjLibelle'],
'attr' => array('id' => $forme['fjCode'],
'class' => $this->_getClass($forme['fjCode'])),
'state' => 'close',
'children' => (($lenth < 6)?$this->_getFils($forme['fjCode']):array())
);
$tabfj[] = $structure;
}
return ($tabfj);
}
}

View File

@ -1,107 +0,0 @@
<?php
class Object_Naf
{
public function naf($niveau, $key)
{
require_once 'Scores/SessionCiblage.php';
$sessionCiblage = new SessionCiblage();
$val = $sessionCiblage->getCritere($key);
$valuesChecked = array();
$valuesUndetermined = array();
if ($val != null){
$valuesChecked = explode(',',$val);
foreach($valuesChecked as $value){
$valuesUndetermined = array_merge($valuesUndetermined, $this->getNafParent($value, true));
}
}
$nafM = new Application_Model_Naf();
$sql = $nafM->select()->where('niveau = ?', $niveau)->order('code ASC');
$result = $nafM->fetchAll($sql)->toArray();
$tabNaf = array();
foreach($result as $item)
{
$structure = array(
'data' => $item['code'].' - '.$item['lib'],
'attr' => array('id' => $item['code'], 'niveau' => $item['niveau']),
'state' => 'closed',
'children' => array(),
);
if (in_array($item['code'], $valuesChecked)){
$structure['attr']['class'] = 'jstree-checked';
}
if (in_array($item['code'], $valuesUndetermined)){
$structure['attr']['class'] = 'jstree-undetermined';
}
$tabNaf[] = $structure;
}
return json_encode($tabNaf);
}
protected function getNafParent($value, $niveau1 = false)
{
$out = array();
if (strlen($value)>2) {
$niveau = strlen($value)-1;
$new = substr($value,0,$niveau);
$out = array_merge($out, array($new), $this->getNafParent($new, $niveau1));
} elseif (strlen($value)==2 && $niveau1 === true) {
$nafM = new Application_Model_Naf();
$sql = $nafM->select()
->from($nafM, array('parent'))
->where('code = ?', $value);
$result = $nafM->fetchRow($sql);
$out[] = $result->parent;
}
return $out;
}
public function ajax($parent, $niveau, $key)
{
//Récupération des valeurs enregistrées en session
require_once 'Scores/SessionCiblage.php';
$sessionCiblage = new SessionCiblage();
$val = $sessionCiblage->getCritere($key);
$valuesChecked = array();
$valuesUndetermined = array();
if ($val != null){
$valuesChecked = explode(',',$val);
foreach($valuesChecked as $value){
$valuesUndetermined = array_merge($valuesUndetermined, $this->getNafParent($value));
}
}
$niveau++;
$nafM = new Application_Model_Naf();
$sql = $nafM->select();
if (!empty($parent) && $niveau==2) {
$sql->where('parent = ?', $parent);
} elseif (!empty($parent) && $niveau>2) {
$sql->where("code LIKE '".$parent."%'");
}
$sql->where('niveau = ?', $niveau)->order('code ASC');
$result = $nafM->fetchAll($sql)->toArray();
$tabNaf = array();
foreach($result as $item){
$structure = array(
'data' => $item['code'].' - '.$item['lib'],
'attr' => array('id' => $item['code'], 'niveau' => $item['niveau']),
);
if (in_array($item['code'], $valuesChecked)){
$structure['attr']['class'] = 'jstree-checked';
}
if (in_array($item['code'], $valuesUndetermined)){
$structure['attr']['class'] = 'jstree-undetermined';
}
if ($niveau<5){
$structure['state'] = 'closed';
$structure['children'] = array();
}
$tabNaf[] = $structure;
}
return json_encode($tabNaf);
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

928
library/Scores/Fields.php Normal file
View File

@ -0,0 +1,928 @@
<?php
class Scores_Fields
{
/**
* Fields options to display
* [name] => array(
* label =>
* fields => array(
* type => array()
* ...
* )
* famille =>
* activated =>
* type =>
* )
* )
*
* name : the key to retrieve field parameters
* label : the string to display as title
* famille : the key to identify where familly the field belongs to
* activated : true or false
*
* fields : define all different fields for the same element
* => type : which type of element (select, text, tree, ...), it's the key for array
* => value :
* => label (optional) :
* => class :
* @var array
*/
protected $fields = array
(
'siege' => array (
'label' => "Type d'établissement",
'fields' => array(
'select' => array('value' => array('1' => 'Sièges', '0' => 'Secondaires')),
),
'famille' => 'entreprise',
'activated' => true,
),
'groupe' => array(
'label' => "Appartient à un groupe",
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
),
'famille' => 'entreprise',
'activated' => true,
),
'tel' => array(
'label' => 'Téléphone renseigné',
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
),
'famille' => 'entreprise',
'activated' => true,
),
'fax' => array(
'label' => 'Télécopie renseignée',
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
),
'famille' => 'entreprise',
'activated' => true,
),
'web' => array(
'label' => 'Site Web renseigné',
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
),
'famille' => 'entreprise',
'activated' => true,
),
'mail' => array(
'label' => 'Email de contact renseigné',
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
),
'famille' => 'entreprise',
'activated' => true,
),
'presentRcs' => array(
'label' => 'Etablissement présent au RNCS',
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
),
'famille' => 'entreprise',
'activated' => true,
),
'adrDom' => array(
'label' => 'Adresse de domiciliation',
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
),
'famille' => 'entreprise',
'activated' => true,
),
'dirNom' => array(
'label' => 'Nom du principal dirigeant présent',
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
),
'famille' => 'entreprise',
'activated' => true,
),
/* What is this ? */
'lieuAct' => array(
'label' => "Lieu d\'activté",
'fields' => array(
'interval' => array('value' => array('0', '1000')),
'textarea' => array('value' => null)
),
'famille' => 'entreprise',
'activated' => true,
),
'nbMPubli' => array(
'label' => 'Marchés publiques remportés',
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
),
'famille' => 'entreprise',
'activated' => true,
),
'dateCrea_ent' => array(
'label' => "Date de création de l'entreprise",
'fields' => array(
'interval' => array('value' => array('0', '1000'))
),
'famille' => 'entreprise',
'activated' => true,
),
'dateCrea_etab' => array(
'label' => "Date de création de l'établissement",
'fields' => array(
'interval' => array('value' => array('0', '1000'))
),
'famille' => 'entreprise',
'activated' => true,
),
'action' => array(
'label' => 'Présence d\'actionnaires',
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
),
'famille' => 'entreprise',
'activated' => true,
),
'nbActio' => array(
'label' => 'Nombre d\'actionnaires connus',
'fields' => array(
//@todo : getMinMax
'interval' => array('value' => null)
),
'famille' => 'entreprise',
'activated' => true,
),
'participation' => array(
'label' => "Présence de participations",
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
),
'famille' => 'entreprise',
'activated' => true,
),
'nbPart' => array(
'label' => 'Nombre de participations connues',
'fields' => array(
'interval' => array('value' => array('0', '1000'))
),
'famille' => 'entreprise',
'activated' => true,
),
'ape_etab' => array(
'label' => "Activité de l'établissement (Code NAF)",
'fields' => array(
'tree' => array('value' => null, 'action' => 'naf', 'title' => "Arborescence de code NAF etablissement"),
'text' => array('value' => null, 'label' => "Recherche de code NAF", 'title'=>"Selection de code NAF etablissement"),
),
'famille' => 'economique',
'activated' => true,
),
'ape_entrep' => array(
'label' => "Activité de l'entreprise (Code NAF)",
'fields' => array(
'tree' => array('value' => null, 'action' => 'naf', 'title' => "Arborescence de code NAF entreprise"),
'text' => array('value' => null, 'label' => "Recherche de code NAF", 'title'=>"Selection de code NAF entreprise"),
),
'famille' => 'economique',
'activated' => true,
),
'NaceEtab' => array(
'label' => 'Code NACE de l\'établissement',
'fields' => array(
'text' => array('value' => null),
'textarea' => array('value' => null)
),
'famille' => 'economique',
'activated' => true,
),
'NaceEntrep' => array(
'label' => 'Code NACE de l\'entreprise',
'fields' => array(
'text' => array('value' => null),
'textarea' => array('value' => null)
),
'famille' => 'economique',
'activated' => true,
),
'age_etab' => array(
'label' => 'Age de l\'entreprise',
'fields' => array(
'interval' => array('value' => null)
),
'famille' => 'economique',
'activated' => true,
),
'age_entrep' => array(
'label' => 'Age de l\'établissement',
'fields' => array(
'interval' => array('value' => null)
),
'famille' => 'economique',
'activated' => true,
),
'teff_entrep' => array(
'label' => "Tranche d'effectif de l'Entreprise",
'fields' => array(
'selectMultiple' => array(
'value' => array(
'NN' => "Unités non employeuses",
'0' => "0 salarié",
'1' => "1 ou 2 salariés",
'2' => "3 à 5 salariés",
'3' => "6 à 9 salariés",
'11' => "10 à 19 salariés",
'12' => "20 à 49 salariés",
'21' => "50 à 99 salariés",
'22' => "100 à 199 salariés",
'31' => "200 à 249 salariés",
'32' => "250 à 499 salariés",
'41' => "500 à 999 salariés",
'42' => "1 000 à 1 999 salariés",
'51' => "2 000 à 4 999 salariés",
'52' => "5 000 à 9 999 salariés",
'53' => "10 000 salariés et plus",
),
),
),
'famille' => 'economique',
'activated' => true,
),
'teff_etab' => array(
'label' => 'Tranche d\'effectif de l\'établissement',
'fields' => array(
'selectMultiple' => array(
'value' => array(
'NN' => "Unités non employeuses",
'0' => "0 salarié",
'1' => "1 ou 2 salariés",
'2' => "3 à 5 salariés",
'3' => "6 à 9 salariés",
'11' => "10 à 19 salariés",
'12' => "20 à 49 salariés",
'21' => "50 à 99 salariés",
'22' => "100 à 199 salariés",
'31' => "200 à 249 salariés",
'32' => "250 à 499 salariés",
'41' => "500 à 999 salariés",
'42' => "1 000 à 1 999 salariés",
'51' => "2 000 à 4 999 salariés",
'52' => "5 000 à 9 999 salariés",
'53' => "10 000 salariés et plus",
)
),
),
'famille' => 'economique',
'activated' => true,
),
'nbEtab' => array(
'label' => 'Nombre d\'établissements',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'economique',
'activated' => true,
),
'eff_entrep' => array(
'label' => 'Effectif réel de l\'entreprise',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'economique',
'activated' => true,
),
'eff_etab' => array(
'label' => 'Effectif réel de l\'établissement',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'economique',
'activated' => true,
),
'capital' => array(
'label' => 'Capital de l\'entreprise',
'fields' => array(
'intervalSelect' => array(
'value' => array(
array(0, 15000),
array(15000, 30000),
array(30000, 75000),
array(75000, 150000),
array(150000, 750000),
array(750000, 0),
)
)
),
'famille' => 'economique',
'activated' => true,
),
//geographique
'geo' => array(
'label' => 'Localisation géographique',
'fields' => array(
'tree' => array('value' => null, 'action' => 'geographique', 'title' => "Arborescence géographique"),
'text' => array('value' => null, 'label' => "Recherche", 'title'=>"Recherche géographique"),
),
'famille' => 'geographique',
'activated' => true,
),
'geo_domtom' => array(
'label' => 'Exlcure les DOM-TOM',
'fields' => array(
'checkbox' => array('value' => '1'),
),
'famille' => 'geographique',
'activated' => true,
),
'geo_etranger' => array(
'label' => 'Exclure les départements étrangers',
'fields' => array(
'checkbox' => array('value' => '1'),
),
'famille' => 'geographique',
'activated' => true,
),
'geo_corse' => array(
'label' => 'Exclure la corse',
'fields' => array(
'checkbox' => array('value' => '1'),
),
'famille' => 'geographique',
'activated' => true,
),
'adr_reg' => array(
'label' => 'Liste code région',
'fields' => array(
'text' => array('value' => null),
'textarea' => array('value' => null)
),
'famille' => 'geographique',
'activated' => true,
'type' => 'textarea',
'class' => null,
'action' => 'geographique',
'title' => 'Localisation'
),
'zus' => array(
'label' => 'Zones urbaines sensibles',
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
),
'famille' => 'geographique',
'activated' => true,
'type' => 'select',
),
'zru' => array(
'label' => 'Zones de redynamisation urbaine',
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
),
'famille' => 'geographique',
'activated' => true,
'type' => 'select',
),
'zfu' => array(
'label' => 'zones franches urbaines',
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
),
'famille' => 'geographique',
'activated' => true,
'type' => 'select',
),
'cucs' => array(
'label' => 'Contrats urbains de cohésion sociale',
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
),
'famille' => 'geographique',
'activated' => true,
'type' => 'select',
),
'zrr' => array(
'label' => 'Zone de revitalisation rurale',
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
),
'famille' => 'geographique',
'activated' => true,
'type' => 'select',
),
'zafr' => array(
'label' => 'Zones Aide à finalité régionale',
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
),
'famille' => 'geographique',
'activated' => true,
'type' => 'select',
),
/*
* Forme Juridique
*/
'cj' => array(
'label' => 'Forme Juridique',
'fields' => array(
'tree' => array('value' => null, 'action' => 'juridique', 'title' => "Arborescence Forme Juridique"),
'text' => array('value' => null, 'label' => "Recherche", 'title'=>"Recherche Forme Juridique"),
),
'famille' => 'juridique',
'activated' => true,
),
'actifEco' => array(
'label' => 'Établissement économiquement actif',
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
),
'famille' => 'juridique',
'activated' => true,
),
'procolHisto' => array(
'label' => 'Présence procédure collective dans histo',
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
),
'famille' => 'juridique',
'activated' => true,
),
'tvaIntraValide' => array(
'label' => 'Numéro de TVA intracommunautaire valide',
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
),
'famille' => 'juridique',
'activated' => true,
),
'dateImmat' => array(
'label' => 'Date d\'immatriculation',
'fields' => array(
'interval' => array('value' => array('0', '1000'))
),
'famille' => 'juridique',
'activated' => true,
),
//financier
'bilType' => array(
'label' => 'Type du dernier bilan',
'fields' => array(
'selectMultiple' => array('value' => array(
'I' => 'Inconnue',
'R' => 'Réel',
'E' => 'Estimé')
),
),
'famille' => 'financier',
'activated' => true,
),
'avisCs' => array(
'label' => 'Informations de paiements',
'fields' => array(
'selectMultiple' => array('value' => array(
'' => 'Risque indéterminé',
'00' => 'Aucun risque resencé',
'10' => 'Présence d\'impayé(s)',
'15' => 'Présence de privilèges',
'23-29-39-43' => 'Risque moyen',
'21-26-28' => 'Risque important',
'31-50' => 'Risque très important',
'24' => 'Risque dans le groupe')
),
),
'famille' => 'financier',
'activated' => true,
),
'bilDuree' => array(
'label' => 'Durée du dernier bilan en mois',
'fields' => array(
'intervalSelect' => array(
'value' => array(
array(0, 5),
array(5, 10),
array(10, 15),
array(20, 23),
array(23, 0)
)
)
),
'famille' => 'financier',
'activated' => true,
),
'bilTca' => array(
'label' => 'Tranche de CA issue du bilan',
'fields' => array(
'selectMultiple' => array('value' => array(
'0' => 'Non déterminée',
'1' => 'de 500K€ à1M€',
'2' => 'de 1 à 2 ME',
'3' => 'de 2 à 5 ME',
'4' => 'de 5 à 10 ME',
'5' => 'de 10 à 20 ME',
'6' => 'de 20 à 50 ME',
'7' => '50 à 100 ME',
'8' => 'de 100 à 200 ME',
'9' => '+ de 200 ME'
)),
),
'famille' => 'financier',
'activated' => true,
),
'bilAnnee' => array(
'label' => 'Dernière année de bilan',
'fields' => array(
'interval' => array('value' => array('0', '1000'))
),
'famille' => 'financier',
'activated' => true,
),
'bilCloture' => array(
'label' => 'Dernière date de clôture du bilan',
'fields' => array(
'interval' => array('value' => array('0', '1000'))
),
'famille' => 'financier',
'activated' => true,
),
'bilEE' => array(
'label' => 'Total bilan (EE)',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'financier',
'activated' => true,
),
'bilFL' => array(
'label' => 'CA total (FL)',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'financier',
'activated' => true,
),
'bilFK' => array(
'label' => 'Chiffre d\'affaires Export (FK)',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'financier',
'activated' => true,
),
'bilFR' => array(
'label' => 'Produits d\'Exploitation (FR)',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'financier',
'activated' => true,
'type' => 'interval',
'class' => null
),
'bilGF' => array(
'label' => 'Charges d\'Exploitation (GF)',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'financier',
'activated' => true,
),
'bilGP' => array(
'label' => 'Charges Financières (GP)',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'financier',
'activated' => true,
),
'bilGW' => array(
'label' => 'R.C.A.I - Résultat courant av. impôt (GW)',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'financier',
'activated' => true,
),
'bilHD' => array(
'label' => 'Produits Exceptionnels (HD)',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'financier',
'activated' => true,
),
'bilHH' => array(
'label' => 'Charges Exceptionnels (HH)',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'financier',
'activated' => true,
),
'bilHL' => array(
'label' => 'Total des Produits (HL)',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'financier',
'activated' => true,
),
'bilHM' => array(
'label' => 'Total des Charges (HM)',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'financier',
'activated' => true,
),
'bilHN' => array(
'label' => 'Résultat (HN)',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'financier',
'activated' => true,
),
'bilYP' => array(
'label' => 'Effectif salarié (YP)',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'financier',
'activated' => true,
)
);
/**
* Save all information in this array
* The key NB is mandatory as this
* ['NB']['total'] => store the number of elements matches
* ['NB']['insee'] => store the number of elements matches which type is INSEE
* Other keys
* [key][in] => inclusion
* [key][ex] => exclusion
* @var array
*/
protected $ciblage;
protected $total = null;
protected $insee = null;
/**
*
* @param boolean $batch
*/
public function __construct($batch = false)
{
$session = new Zend_Session_Namespace('ciblage');
$this->ciblage = empty($session->ciblage) ? array() : $session->ciblage;
if (isset($this->ciblage['NB']['total'])) { $this->total = $this->ciblage['NB']['total']; }
if (isset($this->ciblage['NB']['insee'])) { $this->insee = $this->ciblage['NB']['insee']; }
if (isset($this->ciblage['NB'])) { unset($this->ciblage['NB']); }
}
/**
* Save data to session
*/
protected function setSession()
{
$session = new Zend_Session_Namespace('ciblage');
$this->ciblage['NB']['total'] = $this->total;
$this->ciblage['NB']['insee'] = $this->insee;
$session->ciblage = $this->ciblage;
}
/**
* Enregistre un critère et sa valeur
* @param string $key
* @param mixed $value
* @param boolean $ex
*/
public function setCritere($key, $value, $ex = false)
{
//Remove critere for these values on all type of fields
if ( in_array($value, array('', '-', null)) ) {
unset($this->ciblage[$key]);
return;
}
$types = array_keys($this->fields[$key]['fields']);
if ( !is_array($value) && !in_array($types[0], array('select', 'checkbox')) ) {
//Remove all space in string value
$value = str_replace(' ', '', $value);
//Try to detect separator and transform as array
if ( preg_match_all('/([0-9A-Z]{1,5})(,|;){0,1}/', $value, $matches) ){
Zend_Registry::get('firebug')->info($matches);
$value = $matches[1];
}
//Add value to the existing
if (array_key_exists($key, $this->ciblage)) {
if ($ex) {
$value = array_merge($this->ciblage[$key]['ex'], $value);
} else {
$value = array_merge($this->ciblage[$key]['in'], $value);
}
}
}
//Remove duplicate values
if (is_array($value) ) {
$value = array_unique($value);
}
//Before to save the value
switch ( $types[0] ) {
case 'interval':
//@todo : Check Min Max
break;
case 'checkbox':
if ( $value==0 ) {
unset($this->ciblage[$key]);
return;
}
break;
}
//Save the value
if ($ex) {
$this->ciblage[$key]['ex'] = $value;
} else {
$this->ciblage[$key]['in'] = $value;
}
$this->setSession();
}
/**
* Définir les critères en une fois
* @param array $criteres Criteres as array with key => val
* @param boolean $inSession pour désactiver l'enregistrement en session
*/
public function setCriteres($criteres, $inSession = true)
{
$this->ciblage = $criteres;
if ( $inSession ) {
$this->setSession();
}
}
/**
* Désactivation d'un critère
* @param string $key
*/
public function unsetCritere($key)
{
if( key_exists($key, $this->ciblage) ) {
unset($this->ciblage[$key]);
$this->setSession();
}
}
/**
* Permet de supprimer une valeur dans une clef de session
* @param string $key
* @param mixed $valeur
*/
public function unsetCritereValue($key, $valeur) {
//@todo provisoir trouver une autre technique plus adapté.
if(key_exists($key, $this->ciblage)) {
$don = explode(',', $this->ciblage[$key]);
foreach ($don as $val) {
if($val == $valeur)
$don[key($don)] = '';
else
$new[] = $val;
}
if(count($new) > 0) {
$don = implode(',', $new);
if(!empty($don))
$this->ciblage[$key] = $don;
} else {
unset($this->ciblage[$key]);
}
$this->setSession();
}
}
/**
* Récupération de la valeur d'un critère
* @param string $key
*/
public function getCritere($key)
{
if(array_key_exists($key, $this->ciblage)) {
return $this->ciblage[$key];
}
return null;
}
/**
* Récupération des critères et de leurs valeurs
*/
public function getCriteres()
{
return $this->ciblage;
}
/**
* Définit un élément de comptage
* @param string $element
* @param integer $nb
*/
public function setNb($element, $nb)
{
$this->{$element} = $nb;
$this->setSession();
}
/**
* Récupére la valeur d'un élément de comptage
* @param string $element
*/
public function getNb($element)
{
return $this->{$element};
}
/**
* Suppression des critères de toutes une famille
* @param string $famille
*/
public function resetFamille($famille)
{
$reference = $this->getByFamille($famille);
foreach($this->ciblage as $name => $valeur) {
if($name != 'null') {
if(array_key_exists($name, $reference)) {
unset($this->ciblage[$name]);
}
}
}
$this->setSession();
}
/**
* Suppression de toutes les valeurs en session
*/
public function clearCiblage()
{
Zend_Session::namespaceUnset('ciblage');
}
public function getValues($val = null)
{
if ( $val === null ) {
$val = $this->getCriteres();
}
return $val;
}
/**
*
* @param unknown_type $name
*/
protected function getMinMax($name)
{
$MinMaxM = new Application_Model_MinMax();
$minmax = $MinMaxM->fetchAll($MinMaxM->select()->where('cle = ?', $name))->toArray();
return $minmax;
}
/**
*
*/
public function getFields() {
return $this->fields;
}
public function get($name)
{
if ($this->fields[$name]['activated'] == true)
return $this->fields[$name];
return null;
}
public function getByFamille($famille)
{
$section = array();
foreach($this->fields as $name => $item) {
if($item['famille'] == $famille) {
$section[$name] = $item;
}
}
return ($section);
}
public function getLabel($name)
{
return $this->fields[$name]['label'];
}
public function getInfoCritere()
{
}
}

View File

@ -1,144 +0,0 @@
<?php
class SessionCiblage
{
protected $valeur;
protected $total = null;
protected $insee = null;
public function __construct()
{
$session = new Zend_Session_Namespace('ciblage');
$this->valeur = empty($session->ciblage) ? array() : $session->ciblage;
if (isset($this->valeur['NB']['total'])){ $this->total = $this->valeur['NB']['total']; }
if (isset($this->valeur['NB']['insee'])){ $this->insee = $this->valeur['NB']['insee']; }
if (isset($this->valeur['NB'])){ unset($this->valeur['NB']); }
}
/**
* Enregistre les informations dans la session
*/
protected function setSession()
{
$session = new Zend_Session_Namespace('ciblage');
$this->valeur['NB']['total'] = $this->total;
$this->valeur['NB']['insee'] = $this->insee;
$session->ciblage = $this->valeur;
}
/**
* Enregistre un critère et sa valeur
* @param unknown_type $key
* @param unknown_type $value
*/
public function setCritere($key, $value)
{
$this->valeur[$key] = $value;
$this->setSession();
}
/**
* Définir les critères en une fois
* @param array $criteres
*/
public function setCriteres($criteres)
{
$this->valeur = $criteres;
$this->setSession();
}
/**
* Désactivation d'un critère
* @param unknown_type $key
*/
public function unsetCritere($key)
{
if(key_exists($key, $this->valeur)) {
unset($this->valeur[$key]);
$this->setSession();
}
}
/*Permet de supprimer une valeur dans une clef de session*/
public function unsetCritereValue($key, $valeur) {
//@todo provisoir trouver une autre technique plus adapté.
if(key_exists($key, $this->valeur)) {
$don = explode(',', $this->valeur[$key]);
foreach ($don as $val) {
if($val == $valeur)
$don[key($don)] = '';
else
$new[] = $val;
}
if(count($new) > 0) {
$don = implode(',', $new);
if(!empty($don))
$this->valeur[$key] = $don;
} else {
unset($this->valeur[$key]);
}
$this->setSession();
}
}
/**
* Récupération de la valeur d'un critère
* @param unknown_type $key
*/
public function getCritere($key)
{
if(array_key_exists($key, $this->valeur)) {
return $this->valeur[$key];
}
return null;
}
/**
* Récupération des critères et de leurs valeurs
*/
public function getCriteres()
{
return $this->valeur;
}
/**
* Définit un élément de comptage
* @param unknown_type $element
* @param unknown_type $nb
*/
public function setNb($element, $nb)
{
$this->{$element} = $nb;
$this->setSession();
}
/**
* Récupére la valeur d'un élément de comptage
* @param unknown_type $element
*/
public function getNb($element)
{
return $this->{$element};
}
public function resetFamille($famille)
{
require_once('Field.php');
$fields = new Fields(null);
$reference = $fields->getByFamille($famille);
foreach($this->valeur as $name => $valeur) {
if($name != 'null') {
if(array_key_exists($name, $reference)) {
unset($this->valeur[$name]);
}
}
}
$this->setSession();
}
public function clearCiblage()
{
Zend_Session::namespaceUnset('ciblage');
}
}

View File

@ -126,7 +126,7 @@ define ( "SPH_GROUPBY_ATTRPAIR", 5 );
function sphPackI64 ( $v )
{
assert ( is_numeric($v) );
// x64
if ( PHP_INT_SIZE>=8 )
{
@ -138,7 +138,7 @@ function sphPackI64 ( $v )
if ( is_int($v) )
return pack ( "NN", $v < 0 ? -1 : 0, $v );
// x32, bcmath
// x32, bcmath
if ( function_exists("bcmul") )
{
if ( bccomp ( $v, 0 ) == -1 )
@ -175,16 +175,16 @@ function sphPackI64 ( $v )
function sphPackU64 ( $v )
{
assert ( is_numeric($v) );
// x64
if ( PHP_INT_SIZE>=8 )
{
assert ( $v>=0 );
// x64, int
if ( is_int($v) )
return pack ( "NN", $v>>32, $v&0xFFFFFFFF );
// x64, bcmath
if ( function_exists("bcmul") )
{
@ -192,12 +192,12 @@ function sphPackU64 ( $v )
$l = bcmod ( $v, 4294967296 );
return pack ( "NN", $h, $l );
}
// x64, no-bcmath
$p = max ( 0, strlen($v) - 13 );
$lo = (int)substr ( $v, $p );
$hi = (int)substr ( $v, 0, $p );
$m = $lo + $hi*1316134912;
$l = $m % 4294967296;
$h = $hi*2328 + (int)($m/4294967296);
@ -208,7 +208,7 @@ function sphPackU64 ( $v )
// x32, int
if ( is_int($v) )
return pack ( "NN", 0, $v );
// x32, bcmath
if ( function_exists("bcmul") )
{
@ -221,7 +221,7 @@ function sphPackU64 ( $v )
$p = max(0, strlen($v) - 13);
$lo = (float)substr($v, $p);
$hi = (float)substr($v, 0, $p);
$m = $lo + $hi*1316134912.0;
$q = floor($m / 4294967296.0);
$l = $m - ($q * 4294967296.0);
@ -277,11 +277,11 @@ function sphUnpackU64 ( $v )
// x32, bcmath
if ( function_exists("bcmul") )
return bcadd ( $lo, bcmul ( $hi, "4294967296" ) );
// x32, no-bcmath
$hi = (float)$hi;
$lo = (float)$lo;
$q = floor($hi/10000000.0);
$r = $hi - $q*10000000.0;
$m = $lo + $r*4967296.0;
@ -324,7 +324,7 @@ function sphUnpackI64 ( $v )
return $lo;
return sprintf ( "%.0f", $lo - 4294967296.0 );
}
$neg = "";
$c = 0;
if ( $hi<0 )
@ -333,7 +333,7 @@ function sphUnpackI64 ( $v )
$lo = ~$lo;
$c = 1;
$neg = "-";
}
}
$hi = sprintf ( "%u", $hi );
$lo = sprintf ( "%u", $lo );
@ -345,7 +345,7 @@ function sphUnpackI64 ( $v )
// x32, no-bcmath
$hi = (float)$hi;
$lo = (float)$lo;
$q = floor($hi/10000000.0);
$r = $hi - $q*10000000.0;
$m = $lo + $r*4967296.0;
@ -510,7 +510,7 @@ class SphinxClient
$this->_path = $host;
return;
}
assert ( is_int($port) );
$this->_host = $host;
$this->_port = $port;
@ -590,14 +590,14 @@ class SphinxClient
$fp = @fsockopen ( $host, $port, $errno, $errstr );
else
$fp = @fsockopen ( $host, $port, $errno, $errstr, $this->_timeout );
if ( !$fp )
{
if ( $this->_path )
$location = $this->_path;
else
$location = "{$this->_host}:{$this->_port}";
$errstr = trim ( $errstr );
$this->_error = "connection to $location failed (errno=$errno, msg=$errstr)";
$this->_connerror = true;
@ -1236,7 +1236,7 @@ class SphinxClient
if ( $type==SPH_ATTR_FLOAT )
{
list(,$uval) = unpack ( "N*", substr ( $response, $p, 4 ) ); $p += 4;
list(,$fval) = unpack ( "f*", pack ( "L", $uval ) );
list(,$fval) = unpack ( "f*", pack ( "L", $uval ) );
$attrvals[$attr] = $fval;
continue;
}
@ -1264,7 +1264,7 @@ class SphinxClient
} else if ( $type==SPH_ATTR_STRING )
{
$attrvals[$attr] = substr ( $response, $p, $val );
$p += $val;
$p += $val;
} else
{
$attrvals[$attr] = sphFixUint($val);
@ -1345,7 +1345,7 @@ class SphinxClient
if ( !isset($opts["passage_boundary"]) ) $opts["passage_boundary"] = "none";
if ( !isset($opts["emit_zones"]) ) $opts["emit_zones"] = false;
if ( !isset($opts["load_files_scattered"]) ) $opts["load_files_scattered"] = false;
/////////////////
// build request
@ -1634,7 +1634,7 @@ class SphinxClient
fclose ( $this->_socket );
$this->_socket = false;
return true;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 415 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 399 B

View File

@ -21,72 +21,23 @@ $(document).ready(function()
});
});
$("div.slider-range").slider({
range: true,
create: function(event, ui) {
var max = $("#"+$(this).attr('input')).attr('max');
var min = $("#"+$(this).attr('input')).attr('min');
$(this).slider( "option", "min", min );
$(this).slider( "option", "max", max );
},
values : [0, 10000000000],
slide: function( event, ui ) {
var name = $(this).attr('input');
$( "#"+name ).val( ui.values[ 0 ] + " , " + ui.values[ 1 ] );
},
step: 10,
stop: function( event, ui ) {
var name = $(this).attr('input');
set(name, ui.values[ 0 ] + "," + ui.values[ 1 ]);
}
});
$("input.datepicker").datepicker({ dateFormat: 'dd/mm/yy' } );
$( "#accordion" ).accordion({
autoHeight: false,
navigation: true,
icons: {
header: "ui-icon-circle-arrow-e",
headerSelected: "ui-icon-circle-arrow-s"
}
});
$( "#toggle" ).button().toggle(function() {
$( "#accordion" ).accordion( "option", "icons", false );
}, function() {
$( "#accordion" ).accordion( "option", "icons", icons );
});
$( ".column" ).sortable({
connectWith: ".column"
});
$( ".portlet" ).addClass( "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" )
.find( ".portlet-header" )
.addClass( "ui-widget-header ui-corner-all" )
.prepend( "<span class='ui-icon ui-icon-minusthick'></span>")
.end()
.find( ".portlet-content" );
$( ".portlet-header .ui-icon" ).click(function() {
$( this ).toggleClass( "ui-icon-minusthick" ).toggleClass( "ui-icon-plusthick" );
$( this ).parents( ".portlet:first" ).find( ".portlet-content" ).toggle();
});
$( ".column" ).disableSelection();
$('#tabs').delegate('select.criteres', 'change', function(e){
var valeur = $(this, ':selected').val();
e.stopPropagation();
set($(this).attr('name'), valeur);
if ( !$(this).attr('size') ){
var valeur = $(this, ':selected').val();
set($(this).attr('name'), valeur);
}
});
$('#tabs').delegate('input[type=checkbox].criteres', 'click', function(e){
e.stopPropagation();
set($(this).attr('name'), $(this).val());
if($(this).is(':checked')) {
set($(this).attr('name'), 1);
} else {
set($(this).attr('name'), 0);
}
});
$('#tabs').delegate('input[type=radio].criteres', 'click', function(e){
@ -94,19 +45,81 @@ $(document).ready(function()
set($(this).attr('name'), $(this).val());
});
$('#tabs').delegate('input[type=text].criteres', 'blur', function(e){
$('input[type=text].autocomplete')
.bind( "keydown", function( event ) {
if ( event.keyCode === $.ui.keyCode.TAB &&
$( this ).data( "autocomplete" ).menu.active ) {
event.preventDefault();
}
})
.autocomplete({
minLength:4,
source: function(request, response) {
var val = extractLast( request.term );
var regex = /[a-z]/i;
if ( regex.test(val[0]) ){
switch ( this.element.attr('name') ) {
case 'ape_etab':
case 'ape_entrep':
var href = '/economique/completed';
break;
case 'cj':
var href = '/juridique/completed';
break;
case 'geo':
var href = '/geographique/completed';
break;
}
if (href) {
$.getJSON( href, { q: val }, function(data) {
response(data);
} );
}
}
},
focus: function() {
// prevent value inserted on focus
return false;
},
select: function( event, ui ) {
if ( this.name == 'geo') {
this.value = ui.item.value;
} else {
var terms = split( this.value );
terms.pop();
terms.push( ui.item.value );
terms.push( "" );
this.value = terms.join( ", " );
}
return false;
},
});
$('#tabs').delegate('a.autocomplete', 'click', function(e){
e.stopPropagation();
set($(this).attr('name'), $(this).val());
var obj = $(this).parent().find('input.criteres');
set(obj.attr('name'), obj.val());
});
$('#tabs').delegate('a.autocomplet', 'click', function(e){
e.preventDefault();
var key = $(this).attr('textarea');
var values = $('#textarea_'+$(this).attr('textarea')).val();
set(key, values);
return false;
$('#tabs').delegate('a.autocompleteEx', 'click', function(e){
e.stopPropagation();
var obj = $(this).parent().find('input.criteres');
set(obj.attr('name'), obj.val());
});
$('#tabs').delegate('a.selectMultiple', 'click', function(e){
e.stopPropagation();
var obj = $(this).parent().find('select.criteres');
set(obj.attr('name'), obj.val());
});
$('#tabs').delegate('a.selectMultipleEx', 'click', function(e){
e.stopPropagation();
var obj = $(this).parent().find('select.criteres');
set(obj.attr('name'), obj.val(), 1);
});
$('#tabs').delegate('a.interval', 'click', function(e){
e.preventDefault();
var key = $(this).attr('id');
@ -156,11 +169,11 @@ $(document).ready(function()
},
buttons: {
Valider: function() {
var key = $('div.jstree').attr('id');
var elements = [];
$('#'+key).jstree("get_checked").each(function(){
var key = $('div.jstree').attr('id');
var elements = [];
$('div.jstree').jstree("get_checked").each(function(){
elements.push(this.id);
});
});
set(key, elements.join(","));
$(this).dialog('close');
},
@ -172,176 +185,35 @@ $(document).ready(function()
return false;
});
$('.resetFamille').click(function(){
var famille = $(this).attr('id');
$.ajax({
type : "GET",
cache : false,
url : famille+'/reset',
data : $(this).serializeArray(),
success: function(data) {
set(null, null);
}
});
window.location.replace('/');
});
$('.checkbox_ex').click(function(){
if($(this).is(':checked')) {
$('#'+$(this).attr('name')+'_in').css('display', 'none');
$('#'+$(this).attr('name')+'_ex').css('display', 'block');
$('#tabs').delegate('a.text', 'click', function(e) {
e.preventDefault();
var id = $(this).attr('id');
if ($('div#field_'+id).css('display') == 'none') {
$('div#field_'+id).show('blind');
} else {
$('#'+$(this).attr('name')+'_in').css('display', 'block');
$('#'+$(this).attr('name')+'_ex').css('display', 'none');
$('div#field_'+id).hide('blind');
}
});
$('.ex_prede').click(function(){
if($(this).is(':checked')) {
set($(this).attr('name'), 1);
} else {
set($(this).attr('name'), 0);
}
});
$('textarea.complitedCj').autocomplete({
delay:600,
source: function(request, response) {
$.getJSON('/juridique/completed', { q: extractLast( request.term ) },
function(data) { response(data); }
);
},
select: function(event, ui){
var terms = split( this.value );
terms.pop();
terms.push( ui.item.value );
terms.push( "" );
this.value = terms.join( ", " );
return false;
}
});
$('textarea.complitedCj_ex').autocomplete({
delay:300,
source: function(request, response) {
$.getJSON('/juridique/completed', { q: extractLast( request.term ) },
function(data) { response(data); }
);
},
select: function(event, ui){
var terms = split( this.value );
terms.pop();
terms.push( ui.item.value );
terms.push( "" );
this.value = terms.join( ", " );
return false;
}
});
$('textarea.complitedNaf').autocomplete({
delay:600,
source: function(request, response) {
$.getJSON('/economique/completed', { q: extractLast( request.term ) },
function(data) { response(data); }
);
},
select: function(event, ui){
var terms = split( this.value );
terms.pop();
terms.push( ui.item.value );
terms.push( "" );
this.value = terms.join( ", " );
return false;
}
});
$('#textarea_adr_dept').autocomplete({
delay:600,
source: function(request, response) {
$.getJSON('/geographique/completed/dep/1', { q: extractLast( request.term ) },
function(data) { response(data); }
);
},
select: function(event, ui){
var terms = split( this.value );
terms.pop();
terms.push( ui.item.value );
terms.push( "" );
this.value = terms.join( ", " );
return false;
}
});
$('#textarea_adr_reg').autocomplete({
delay:600,
source: function(request, response) {
$.getJSON('/geographique/completed/reg/1', { q: extractLast( request.term ) },
function(data) { response(data); }
);
},
select: function(event, ui){
var terms = split( this.value );
terms.pop();
terms.push( ui.item.value );
terms.push( "" );
$('#textarea_adr_dept').val(terms.join( "," )+$('#textarea_adr_dept').val());
$(this).val('');
return false;
}
});
$('textarea.complitedadr_com').autocomplete({
delay:600,
source: function(request, response) {
$.getJSON('/geographique/completed/adr_com/1', { q: extractLast( request.term ) },
function(data) { response(data); }
);
},
select: function(event, ui){
var terms = split( this.value );
terms.pop();
terms.push( ui.item.value );
terms.push( "" );
this.value = terms.join( ", " );
return false;
}
});
$('textarea.complitedadr_com_ex').autocomplete({
delay:600,
source: function(request, response) {
$.getJSON('/geographique/completed/adr_com_ex/1', { q: extractLast( request.term ) },
function(data) { response(data); }
);
},
select: function(event, ui){
var terms = split( this.value );
terms.pop();
terms.push( ui.item.value );
terms.push( "" );
this.value = terms.join( ", " );
return false;
}
});
});
function set(key, value)
function set(key, value, ex)
{
ex = typeof ex !== 'undefined' ? ex : 0;
$('#comptage').css('display', 'none');
$('#attente').css('display', 'block');
$('#panel').html('<img src="/themes/default/images/ajax.gif" />');
$.post('/comptage', { cle:key, valeur:value }, function(data, status) {
$.post('/comptage/index', { cle:key, valeur:value, exlcude:ex }, function(data, status) {
var html = 'Nombre sélectionnées : <span class="valeur">' +
data.count + '</span> (dont <span class="valeur">' +
data.insee +'</span> unité(s) insee)';
$('#attente').css('display', 'none');
$('#comptage').html(html).css('display','block');
$.ajax({
type : "GET",
cache : false,
@ -351,9 +223,7 @@ function set(key, value)
$('#panel').html(data);
}
});
}, 'json')
.error(function(){ alert('error'); });
}

View File

@ -68,14 +68,6 @@ $(document).ready(function(){
return false;
});
$('.manuel').click( function(){
var id = $(this).attr('ref');
if($('.'+id).css('display') == 'none')
$('.'+id).show('blind');
else
$('.'+id).hide('blind');
});
$('.mode').click(function(){
var id = $(this).attr('id');
if($('#'+id).css('display') == 'none') {

View File

@ -88,3 +88,73 @@ 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

@ -144,49 +144,6 @@ body {
min-width: 0px;
}
.range
{
margin-left:10px;
margin-top:3px;
float:left;
border:0;
color:black;
font-weight:bold;
}
.mySlider
{
margin:0px;
padding:10px;
}
.critereSelection li
{
list-style: none;
}
label {
font-weight:800;
}
li.liHover {
border:1px solid silver;
padding:5px;
margin:1px;
background-repeat: no-repeat;
background-position:2px;
cursor:move;
font-size: 0.9em;
}
li.liHover a {
text-decoration:none;
}
li.liHover:hover {
cursor:pointer;
}
table#client { width:100%; }
table#client td {
border:1px solid #000;
@ -198,7 +155,6 @@ table#client tr:hover {
background-color: #88ccff;
}
.paragraph {
margin:5px;
padding:5px;
@ -235,14 +191,6 @@ h3 {
padding:2px;
}
#accordion {
}
#rappel {
}
.ui-accordion .ui-accordion-content {
padding:0;
}
@ -264,9 +212,6 @@ h3 {
height:200px;
}
ul#fieldsblock li { list-style-type: none; }
table.ciblage {
width:100%;
}
@ -281,34 +226,54 @@ table.ciblage td {
padding:2px;
}
.fieldgrp {
clear: both;
width: 100%;
overflow: hidden;
ul#fieldsblock li {
list-style-type: none;
padding:5px;
border:1px solid silver;
margin-top:2px;
background-color:#D4D4D4;
border:1px solid silver;
margin:1px;
font-size: 0.9em;
}
.fieldgrp:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
ul#fieldsblock li a {
text-decoration:none;
}
.fieldgrp label {
ul#fieldsblock li:hover {
background-color:#9EC5FF;
}
ul#fieldsblock li div.fieldgrp {
clear: both;
width: 100%;
overflow: hidden;
}
ul#fieldsblock li div.fieldgrp:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
ul#fieldsblock li div.fieldgrp:first-child label {
font-weight: bold;
/*width: 320px;*/
}
ul#fieldsblock li div.fieldgrp label {
clear: both;
line-height: 22px;
_padding-top: 3px;
float: right;
display: block;
font-size:0.9em;
float:left;
}
.field {
ul#fieldsblock li div.fieldgrp div.field {
width: 350px;
float: right;
padding: 0 10px 0 0;
@ -317,115 +282,77 @@ table.ciblage td {
text-align: right;
}
.field a
{
ul#fieldsblock li div.fieldgrp div.field a {
font-size:10px;
color:blue;
}
.field .longfield {
ul#fieldsblock li div.fieldgrp div.field .longfield {
width: 215px;
}
.field .longfield-select {
ul#fieldsblock li div.fieldgrp div.field .longfield-select {
width: 220px;
}
.field .smallfield {
ul#fieldsblock li div.fieldgrp div.field .smallfield {
width: 95px;
}
.field .medfield {
ul#fieldsblock li div.fieldgrp div.field .medfield {
width: 110px;
}
.field input, .field textarea {
ul#fieldsblock li div.fieldgrp div.field input, .field textarea {
font-size: 0.9em;
margin: 2px 0;
border:1px solid #000000;
width:100%;
}
.field input[type="radio"] {
ul#fieldsblock li div.fieldgrp div.field input[type="radio"] {
margin: 0 5px 0 5px;
}
.slider-range
{
width:100%;
ul#fieldsblock li div.fieldgrp div.field input[type="checkbox"] {
width:auto;
}
.range {background-color:transparent;}
ul#fieldsblock li div.fieldgrp div.field select {
width:265px;
}
#helper
{
ul#fieldsblock li div.fieldgrp div.field select.intervalSelect {
width:102px;
}
ul#fieldsblock li div.fieldgrp div.field .interval input[type=text] {
width:100px;
}
#helper {
border:2px solid silver;
background-color: #CBD3D2;
padding:10px;
}
.Valide
{
.Valide {
padding:5px;
border:1px solid black;
background-color:#182838;
}
.Valide a
{
.Valide a {
color:white;
text-decoration: none;
}
#economique
{
font-size:13px;
text-shadow: 1px 1px 1px white;
}
#economique select {
width:80px;
}
#economique li {
height:20px;
padding:5px;
border:1px solid silver;
margin-top:2px;
background-color:#D4D4D4;
}
#economique li:hover {
background-color:#9EC5FF;
}
#link
{
#link {
text-align:right;
margin-top:20px;
font-size:13px;
}
#economique .interval input[type=text]
{
width:100px;
}
#economique select.intervalSelect
{
width:102px;
}
#economique select
{
width:265px;
}
.error {
display:block;
border:1px solid red;
@ -438,159 +365,11 @@ table.ciblage td {
margin-top:12px;
margin-left:5px;
color:red;
text-shadow: 1px 1px white;
}
#entreprise
{
font-size:13px;
text-shadow: 1px 1px 1px white;
}
#entreprise select {
width:70%;
}
#entreprise li {
height:20px;
padding:5px;
border:1px solid silver;
margin-top:2px;
background-color:#D4D4D4;
}
#entreprise li:hover {
background-color:#9EC5FF;
}
#entreprise li input {
width:125px;
}
#entreprise .interval input[type=text]
{
width:100px;
}
#entreprise select.intervalSelect
{
width:102px;
}
#entreprise select
{
width:265px;
border:1px solid silver;
}
.resetFamille
{
.resetFamille {
cursor:pointer;
text-decoration: underline;
}
#financiere
{
font-size:13px;
text-shadow: 1px 1px 1px white;
}
#financiere select {
width:80px;
}
#financiere li {
height:20px;
padding:5px;
border:1px solid silver;
margin-top:2px;
background-color:#D4D4D4;
}
#financiere li:hover {
background-color:#9EC5FF;
}
#financiere select
{
width:100%;
}
#financiere .interval input[type=text]
{
width:100px;
}
#financiere select.intervalSelect
{
width:102px;
}
#financiere select
{
width:265px;
}
#geographique
{
font-size:13px;
text-shadow: 1px 1px 1px white;
}
#geographique select {
width:70%;
}
#geographique li {
height:20px;
padding:5px;
border:1px solid silver;
margin-top:2px;
background-color:#D4D4D4;
}
#geographique li:hover {
background-color:#9EC5FF;
}
#geographique .interval input[type=text]
{
width:100px;
}
#juridique
{
font-size:13px;
text-shadow: 1px 1px 1px white;
}
#juridique select {
width:80px;
}
#juridique li {
height:20px;
padding:5px;
border:1px solid silver;
margin-top:2px;
background-color:#D4D4D4;
}
#juridique li:hover {
background-color:#9EC5FF;
}
#juridique .interval input[type=text]
{
width:100px;
}
#juridique select.intervalSelect
{
width:102px;
}
#juridique select
{
width:265px;
}
.ui-autocomplete-loading { background: white url('/themes/jqueryui/smoothness/ui-anim_basic_16x16.gif') right center no-repeat; }