issue #0001797 : Bootstrap Design

This commit is contained in:
Michael RICOIS 2014-07-01 13:53:58 +00:00
parent ab7e869ca8
commit c0a378c276
27 changed files with 2266 additions and 799 deletions

View File

@ -25,12 +25,15 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$view->headLink()
->appendStylesheet('/libs/bootstrap-3.1.1/css/bootstrap.min.css', 'all')
->appendStylesheet('/libs/ui-1.10.3/themes/smoothness/jquery-ui.min.css', 'all')
->appendStylesheet($pathStyle.'/main.css', 'all');
$view->headScript()
->appendFile('/libs/html5shiv.js', 'text/javascript', array('conditional' => 'lt IE 9'))
->appendFile('/libs/respond.min.js', 'text/javascript', array('conditional' => 'lt IE 9'))
->appendFile('/libs/jquery-2.1.1.min.js', 'text/javascript')
->appendFile('/libs/ui-1.10.3/jquery-ui.min.js', 'text/javascript')
->appendFile('/libs/ui-1.10.3/jquery-ui-i18n.min.js', 'text/javascript')
->appendFile('/libs/bootstrap-3.1.1/js/bootstrap.min.js', 'text/javascript');
$view->headTitle()->setSeparator(' - ');

View File

@ -26,8 +26,10 @@ class ComptageController extends Zend_Controller_Action
$ex = true;
}
$fields = new Scores_Fields();
$insert = $fields->setCritere($cle, $valeur, $ex);
$fields = new Scores_Ciblage_FieldList();
$sessionValue = new Scores_Ciblage_Session($fields);
$insert = $sessionValue->setSelected($cle, $valeur, $ex);
if ($insert) {
//Informations utilisateur
@ -35,25 +37,23 @@ class ComptageController extends Zend_Controller_Action
$user = $auth->getIdentity();
//Comptage
require_once 'Scores/Ciblage.php';
$ciblage = new Ciblage($fields->getValues(), $user->globalRNCS);
$ciblage = new Scores_Ciblage_Engine($sessionValue->getSelectedValues(), $user->globalRNCS);
//@todo : if $total = false then an error occured ?
// et si nous avons une erreur alors faut-il retirer les critères de la session
$total = $ciblage->execute();
//Define value return after counting
$fields->setNb('total', $total);
//Define value return after counting
$sessionValue->setCountTotal($total);
if ( $user->preferences['interface']['insee'] == 1 ) {
$insee = $ciblage->calculRedevanceInsee();
} else {
$insee = null;
}
$fields->setNb('insee', $insee);
$sessionValue->setCountInsee($insee);
if ( $total !== false ) {
//All is ok, save criteres and result to session
$fields->setCritereSession();
$sessionValue->setCritereSession();
} else {
$error = 1;
}
@ -75,8 +75,8 @@ class ComptageController extends Zend_Controller_Action
{
$erreurs = new Zend_Session_Namespace('erreurs');
$fields = new Scores_Fields();
$fields->clearCiblage();
$sessionValue = new Scores_Ciblage_Session();
$sessionValue->clearCiblage();
unset($erreurs->erreurs);
$this->_redirect('/');
@ -90,8 +90,10 @@ class ComptageController extends Zend_Controller_Action
$user = $auth->getIdentity();
//Récupération de la session pour le profil et les valeurs du comptage
$fields = new Scores_Fields();
$criteres = $fields->getCriteres();
$fields = new Scores_Ciblage_FieldList();
$sessionValue = new Scores_Ciblage_Session($fields);
$criteres = $sessionValue->getSelectedValues();
if (count($criteres) == 0) {
$this->view->noSelection = true;
}
@ -120,11 +122,12 @@ class ComptageController extends Zend_Controller_Action
'error'=>1,
'msg'=> "Référence non définie !"));
} else {
//Session
$fields = new Scores_Fields();
$criteres = $fields->getCriteres();
$resultat = $fields->getNb('total');
$nbInsee = $fields->getNb('insee');
//Session
$fields = new Scores_Ciblage_FieldList();
$sessionValue = new Scores_Ciblage_Session($fields);
$criteres = $sessionValue->getSelectedValues();
$resultat = $sessionValue->getCountTotal();
$nbInsee = $sessionValue->getCountInsee();
//Informations utilisateur
$auth = Zend_Auth::getInstance();
@ -145,8 +148,7 @@ class ComptageController extends Zend_Controller_Action
if ($id) {
//If nbInsee == null, need to count again
if ($nbInsee===null) {
require_once 'Scores/Ciblage.php';
$ciblage = new Ciblage($criteres, $user->globalRNCS);
$ciblage = new Scores_Ciblage_Engine($criteres, $user->globalRNCS);
$nbInsee = $ciblage->calculRedevanceInsee();
}
@ -189,15 +191,12 @@ class ComptageController extends Zend_Controller_Action
$criteres = $criteresRow->current();
$structure = json_decode($criteres->criteres, true);
$field = new Scores_Fields();
$values = $field->getValues($structure);
//Utilisateur
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
//Comptage
require_once 'Scores/Ciblage.php';
$ciblage = new Ciblage($values, $user->globalRNCS);
$ciblage = new Scores_Ciblage_Engine($structure, $user->globalRNCS);
$data = array(
'idDefinition' => $idCriteres,
@ -228,11 +227,11 @@ class ComptageController extends Zend_Controller_Action
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$fields = new Scores_Fields();
$sessionValue = new Scores_Ciblage_Session(null);
$valueSelected = $sessionValue->getSelectedValues();
//Comptage
require_once 'Scores/Ciblage.php';
$ciblage = new Ciblage($fields->getValues(), $user->globalRNCS);
//Comptage
$ciblage = new Scores_Ciblage_Engine($values, $user->globalRNCS);
$sirets = $ciblage->execute(true, 10);
/**
@ -253,8 +252,7 @@ class ComptageController extends Zend_Controller_Action
}
$tabEntete = $tabEnteteLabel = array();
require_once 'Scores/Enrichissement.php';
$enrichissement = new Enrichissement();
$enrichissement = new Scores_Ciblage_Extract();
$fields = $enrichissement->getFields();
$columns = array();
@ -290,8 +288,8 @@ class ComptageController extends Zend_Controller_Action
$joins[] = $join;
}
}
}
$db = Zend_Db_Table::getDefaultAdapter();

View File

@ -71,7 +71,7 @@ class DashboardController extends Zend_Controller_Action
->order('i.dateAdded DESC');
$this->view->enrichissements = $enrichissements->fetchAll($sql);
}
public function ciblagesAction()
@ -145,8 +145,6 @@ class DashboardController extends Zend_Controller_Action
$comptageId = $request->getParam('id');
$fields = new Scores_Fields();
//Lecture des paramètres du ciblage
$criteresM = new Application_Model_CiblageCriteres();
$sql = $criteresM->select()
@ -161,19 +159,44 @@ class DashboardController extends Zend_Controller_Action
$decodeCriteres = json_decode($criteres['criteres'], true);
//Construction affichage des critères
foreach ( $decodeCriteres as $key => $item ) {
$fields = new Scores_Ciblage_FieldList();
$sessionValue = new Scores_Ciblage_Session($fields);
$sessionValue->setSelectedValues($decodeCriteres, false);
$inValue = $fields->getValueLabel($key, $item['in']);
$exValue = $fields->getValueLabel($key, $item['ex']);
//Construction affichage des critères
$infosCriteres = array();
$allFields = $fields->getItems(true);
foreach ( $allFields as $key => $params ) {
$valueSelected = $sessionValue->getSelectedValue($key);
if ( $valueSelected !== false ) {
$inValue = $valueSelected['in'];
$exValue = $valueSelected['ex'];
//Add label to struct for display
$infosCriteres[] = array(
'label' => $fields->getLabel($key),
'in' => $inValue,
'ex' => $exValue,
);
}
$inLabel = array();
if ( count($inValue)>0 ) {
foreach ( $inValue as $value ) {
if ( array_key_exists($value, $params['values']) ) {
$inLabel[] = $params['values'][$value];
}
}
}
$exLabel = array();
if ( count($exValue)>0 ) {
foreach ( $exValue as $value ) {
if ( array_key_exists($value, $params['values']) ) {
$exLabel[] = $params['values'][$value];
}
}
}
$infosCriteres[$key] = array(
'label' => $params['label'],
'in' => $inLabel,
'ex' => $exLabel,
);
}
}
//Lecture des comptages
$comptageM = new Application_Model_CiblageComptages();

View File

@ -6,28 +6,31 @@ class FieldsController extends Zend_Controller_Action
*/
public function indexAction()
{
$this->view->headLink()
->appendStylesheet('/libs/slider/css/bootstrap-slider.min.css', 'all')
->appendStylesheet('/libs/daterangepicker/daterangepicker-bs3.css', 'all');
$this->view->headScript()
->appendFile('/libs/moment.min.js', 'text/javascript')
->appendFile('/libs/tree/jquery.jstree.js', 'text/javascript')
->appendFile('/libs/slider/bootstrap-slider.min.js')
->appendFile('/libs/daterangepicker/daterangepicker.js')
->appendFile('/themes/default/scripts/fields.js', 'text/javascript');
$field = new Scores_Fields();
$this->view->fields = $field;
}
$families = array(
'entreprise',
'economique',
'geographique',
'juridique',
'financier',
);
/**
* Reset criteres by family
*/
public function resetAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$fields = array();
$request = $this->getRequest();
$family = $request->getParam('family');
if ( !empty($family) )
{
$fields = new Scores_Fields();
$fields->resetFamille($family);
$scoresFields = new Scores_Ciblage_FieldList();
foreach ( $families as $family ) {
$fields = $scoresFields->getItemsByFamily($family);
$this->view->{'Fields'.ucfirst($family)} = $fields;
}
}

View File

@ -293,23 +293,47 @@ class GestionController extends Zend_Controller_Action
$decodeCriteres = json_decode($criteres['criteres'], true);
$fields = new Scores_Fields();
$fields = new Scores_Ciblage_FieldList();
$sessionValue = new Scores_Ciblage_Session($fields);
$sessionValue->setSelectedValues($decodeCriteres);
//Construction affichage des critères
foreach ( $decodeCriteres as $key => $item ) {
$infosCriteres = array();
$allFields = $fields->getItems(true);
foreach ( $allFields as $key => $params ) {
$valueSelected = $sessionValue->getSelectedValue($key);
if ( $valueSelected !== false ) {
$inValue = $valueSelected['in'];
$exValue = $valueSelected['ex'];
$inValue = $fields->getValueLabel($key, $item['in']);
$exValue = $fields->getValueLabel($key, $item['ex']);
$inLabel = array();
if ( count($inValue)>0 ) {
foreach ( $inValue as $value ) {
if ( array_key_exists($value, $params['values']) ) {
$inLabel[] = $params['values'][$value];
}
}
}
//Add label to struct for display
$infosCriteres[] = array(
'label' => $fields->getLabel($key),
'in' => $inValue,
'ex' => $exValue,
);
$exLabel = array();
if ( count($exValue)>0 ) {
foreach ( $exValue as $value ) {
if ( array_key_exists($value, $params['values']) ) {
$exLabel[] = $params['values'][$value];
}
}
}
$infosCriteres[$key] = array(
'label' => $params['label'],
'in' => $inLabel,
'ex' => $exLabel,
);
}
}
$this->view->criteres = $infosCriteres;
$this->view->infos = $infosCriteres;
}
/**

View File

@ -11,6 +11,9 @@ class IndexController extends Zend_Controller_Action
}
}
/**
* Affichage des éléments de sélection avec leur valeurs
*/
public function criteresAction()
{
$request = $this->getRequest();
@ -22,13 +25,16 @@ class IndexController extends Zend_Controller_Action
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$fields = new Scores_Fields();
$fields = new Scores_Ciblage_FieldList();
$sessionValue = new Scores_Ciblage_Session($fields);
//Nombre d'unités
$total = $request->getParam('total');
if ( $total !== null ) {
$this->view->dataCount = number_format($total, 0, '', ' ');
} else {
$this->view->dataCount = number_format($fields->getNb('total'), 0, '', ' ');
//@todo : total quand aucune sélection
$this->view->dataCount = number_format($sessionValue->getCountTotal(), 0, '', ' ');
}
$insee = $request->getParam('insee');
@ -36,28 +42,47 @@ class IndexController extends Zend_Controller_Action
$this->view->dataInsee = number_format($insee, 0, '', ' ');
} else {
if ( $user->preferences['interface']['insee'] == 1 ) {
$insee = number_format($fields->getNb('insee'), 0, '', ' ');
$insee = number_format($sessionValue->getCountInsee(), 0, '', ' ');
} else {
$insee = null;
}
}
$decodeCriteres = $fields->getCriteres();
//Construction affichage des critères
$infosCriteres = array();
foreach ( $decodeCriteres as $key => $item ) {
$inValue = $fields->getValueLabel($key, $item['in']);
$exValue = $fields->getValueLabel($key, $item['ex']);
$infosCriteres[$key] = array(
'label' => $fields->getLabel($key),
'in' => $inValue,
'ex' => $exValue,
);
}
$infosCriteres = array();
$allFields = $fields->getItems(true);
foreach ( $allFields as $key => $params ) {
$valueSelected = $sessionValue->getSelectedValue($key);
if ( $valueSelected !== false ) {
$inValue = $valueSelected['in'];
$exValue = $valueSelected['ex'];
$inLabel = array();
if ( count($inValue)>0 ) {
foreach ( $inValue as $value ) {
if ( array_key_exists($value, $params['values']) ) {
$inLabel[] = $params['values'][$value];
}
}
}
$exLabel = array();
if ( count($exValue)>0 ) {
foreach ( $exValue as $value ) {
if ( array_key_exists($value, $params['values']) ) {
$exLabel[] = $params['values'][$value];
}
}
}
$infosCriteres[$key] = array(
'label' => $params['label'],
'in' => $inLabel,
'ex' => $exLabel,
);
}
}
Zend_Registry::get('firebug')->info($infosCriteres);
$this->view->infos = $infosCriteres;
}
@ -68,26 +93,41 @@ class IndexController extends Zend_Controller_Action
$request = $this->getRequest();
$critere = $request->getParam('key');
$fields = new Scores_Fields();
$values = $fields->getCritere($critere);
$fields = new Scores_Ciblage_FieldList();
$sessionValue = new Scores_Ciblage_Session($fields);
$values = $sessionValue->getSelectedValue($key);
$this->view->assign('critereName', $critere);
//Inclusion
if (count($values['in'])>0) {
$inLabels = $fields->getValueLabel($critere, $values['in']);
$inValues = array_values($values['in']);
$this->view->assign('inLabels', $inLabels);
$this->view->assign('inValues', $inValues);
if ( $valueSelected !== false ) {
$inValue = $valueSelected['in'];
$exValue = $valueSelected['ex'];
$inLabel = array();
if ( count($inValue)>0 ) {
foreach ( $inValue as $value ) {
if ( array_key_exists($value, $params['values']) ) {
$inLabel[] = $params['values'][$value];
}
}
$this->view->assign('inLabels', $inLabel);
$this->view->assign('inValues', $inValue);
}
$exLabel = array();
if ( count($exValue)>0 ) {
foreach ( $exValue as $value ) {
if ( array_key_exists($value, $params['values']) ) {
$exLabel[] = $params['values'][$value];
}
}
$this->view->assign('exLabels', $exLabel);
$this->view->assign('exValues', $exValue);
}
}
//Exclusion
if (count($values['ex'])>0) {
$exLabels = $fields->getValueLabel($critere, $values['ex']);
$exValues = array_values($values['ex']);
$this->view->assign('exLabels', $exLabels);
$this->view->assign('exValues', $exValues);
}
}
@ -101,33 +141,30 @@ class IndexController extends Zend_Controller_Action
$posInList = $request->getParam('in', false);
$posExList = $request->getParam('ex', false);
$fields = new Scores_Fields();
$sessionValue = new Scores_Ciblage_Session();
if ($posInList!==false) {
$fields->unsetCritereValue($nameCritereToDelete, $posInList);
$sessionValue->unsetSelectedValue($nameCritereToDelete, $posInList);
} elseif ($posExList!==false) {
$fields->unsetCritereValue($nameCritereToDelete, $posExList, true);
$sessionValue->unsetSelectedValue($nameCritereToDelete, $posInList, true);
} else {
$fields->unsetCritere($nameCritereToDelete);
$sessionValue->unsetSelected($nameCritereToDelete);
}
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
//Comptage
require_once 'Scores/Ciblage.php';
$ciblage = new Ciblage($fields->getValues(), $user->globalRNCS);
$total = $ciblage->execute();
$fields->setNb('total', $total);
$ciblage = new Scores_Ciblage_Engine($sessionValue->getSelectedValues(), $user->globalRNCS);
$total = $ciblage->execute();
$sessionValue->setCountTotal($total);
if ($user->preferences['interface']['insee']==1) {
$insee = $ciblage->calculRedevanceInsee();
$insee = $ciblage->calculRedevanceInsee();
} else {
$insee = null;
}
$fields->setNb('insee', $insee);
$fields->setCritereSession();
}
$sessionValue->setCountInsee($insee);
$sessionValue->setCritereSession();
$this->_redirect('/');
}

View File

@ -1,376 +1,18 @@
<?php
class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
{
protected $display = true;
protected $name = '';
public function Field($name)
{
$this->name = $name;
$field = new Scores_Ciblage_FieldList();
//Read the dico
$fields = new Scores_Fields();
$params = $fields->get($name);
//@todo : Get valueSeclected from session
$html = '';
$html = $field->getItemHtml($name);
$label = $labelG = $fields->getLabel($name);
if ($html) {
return $html;
}
$title = '';
if ( array_key_exists('title', $params) && !empty($params['title']) ) {
$title = $this->view->translate($params['title']);
}
//How many type of fields is defined
$nbFields = count($params['fields']);
$display = true;
$out = '';
//If more than one field exist we need to make a special display
if ( $nbFields > 1) {
$out.= '<div class="fieldgrp clearfix">';
$out.= $this->structureLabel($label);
$out.= '<div class="field">';
foreach ( $params['fields'] as $type => $options )
{
switch ($type) {
case 'tree':
$href = $this->view->url(array('controller' => 'arborescence', 'action' => $options['action'], 'key' => $name));
$out.= '<a class="arborescence" title="'.$options['title'].'" href="'.$href.'">';
$out.= 'Arborescence';
$out.= '</a>';
break;
case 'text':
$out.= '<a class="text" title="'.$options['title'].'" href="#" id="'.$name.'" >';
$out.= 'Recherche';
$out.= '</a>';
break;
case 'list':
$out.= '<a class="dlist" title="'.$options['title'].'" href="#" id="'.$name.'" >';
$out.= 'Liste';
$out.= '</a>';
break;
}
$out.= '&nbsp;';
}
$out.= '</div>';
$out.= '</div>';
//Masquer les champs
$display = false;
}
//Draw fields
foreach ( $params['fields'] as $type => $options )
{
switch($type)
{
case 'select':
$html = $this->selectHTML($name, $options);
break;
case 'selectMultiple':
$html = $this->selectMultipleHTML($name, $options);
break;
case 'intervalSelect':
$html = $this->intervalSelectHTML($name, $options);
break;
case 'checkbox':
$html = $this->checkboxHTML($name, $options);
break;
case 'intervalDate':
$html = $this->intervalDateHTML($name, $options);
break;
case 'interval':
$html = $this->intervalHTML($name, $options);
break;
case 'date':
$html = $this->dateHTML($name, $options);
break;
case 'text':
$html = $this->textHTML($name, $options);
break;
case 'textarea':
$html = $this->textareaHTML($name, $options);
break;
case 'radio':
$html = $this->radioHTML($name, $options);
break;
case 'file':
$html = $this->fileuploadHtml($name, $options);
break;
case 'tree':
//Do nothing
break;
case 'list':
$html = $this->textareaHTML($name, $options);
break;
default:
$html = $this->structureHTML($name, '');
break;
}
$label = $labelG;
if ( array_key_exists('label', $options) ) {
$label = $options['label'];
}
$style = '';
$class = ' class="panel panel-info fieldgrp"';
if ( $display===false ) {
$style = ' style="display:none;"';
}
if ( !empty($title) ) {
$title = ' title="'.$title.'"';
}
$out.= '<div id="field_'.$type.'_'.$this->name.'" '.$class.''.$style.''.$title.'>';
$out.= $this->structureLabel($this->view->translate($label));
$out.= '<div class="field panel-body">'.$html.'</div>';
$out.= '</div>';
}
return $out;
}
/**
* Définition du label
* @param unknown_type $label
*/
private function structureLabel($label)
{
$return = '<div class="panel-heading">'.$label.'</div>';
return $return;
}
protected function getMinMax($name, $valeur)
{
if(!empty($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, $options)
{
$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($options['value'] as $elements) {
if($elements[0] == 0)
$return .= '<option value="'.$minMax[0].'">Min</option>';
else
$return .= '<option '.(($sessionValeur[0] == $elements[0])?'selected':'').' value="'. $elements[0].'">'.number_format($elements[0], 0,'', ' ').'</option>';
}
$return .= '</select> '.$this->view->translate('à').' ';
$return .= '<select class="intervalSelect" name="'.$name.'2" id="'.$name.'" number="2">';
foreach($options['value'] as $elements) {
if($elements[1] == 0)
$return .= '<option value="'.$minMax[1].'">Max</option>';
else
$return .= '<option '.(($sessionValeur[1] == $elements[1])?'selected':'').' value="'. $elements[1].'">'.number_format($elements[1], 0,'', ' ').'</option>';
}
$return .= '</select>';
$return .= ' <span id="'.$name.'"><a href="" class="intervalSelect" id="'.$name.'">'.$this->view->translate('Valider').'</a></span>';
return ($return);
}
/**
*
* @param unknown_type $name
* @param unknown_type $options
*/
protected function checkboxHTML($name, $options)
{
$session = new Scores_Fields();
$sessionValeur = $session->getCritere($name);
$select = '';
if ($sessionValeur==1) $select = ' checked';
$return = '<input type="checkbox" class="criteres" name="'.$name.'" value="'.$options['value'].'"'.$select.'>';
return $return;
}
/**
*
* @param unknown_type $name
* @param unknown_type $options
* @return string
*/
protected function selectMultipleHTML($name, $options)
{
$session = new Scores_Fields();
$sessionValeur = $session->getCritere($name);
$return = '<div class="btn-group criteres" size="'.count($options['value']).'" name="'.$name.'" data-toggle="buttons">';
foreach($options['value'] as $value => $label) {
$selected = "";
if( !empty($sessionValeur) ) {
if ( is_array($sessionValeur) && in_array($value, $sessionValeur) ) {
$selected = "active";
}
}
$return .= '<label class="btn btn-default '.$selected.'">
<input type="checkbox" name="'.$name.'" value="'.$value.'" id="option1">'.$label.'
</label>';
}
$return .= '</div>';
$return .= '<button type="button" class="btn btn-primary btn-block selectMultiple">Sélectionner</button>';
$return .= '<button type="button" class="btn btn-primary btn-block selectMultipleEx">Exclure</button>';
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 = '<div style="float:right" class="btn-group criteres" data-toggle="buttons" name="'.$name.'">';
foreach($options['value'] as $value => $label) {
$selected = "";
if( $sessionValeur!==null && $sessionValeur != "-" && $sessionValeur==$value )
$selected = "active";
$return .= '<label class="btn btn-primary '.$selected.'">
<input type="radio" name="options" id="option1" value="'.$value.'">'.$this->view->translate($label).'</label>';
}
$return .= '</div>';
return $return;
}
protected function intervalDateHTML($name, $options)
{
$session = new Scores_Fields();
$sessionValeur = $session->getCritere($name);
$return = '';
$return.= '<select name="'.$name.'1_j" style="width:45px;">';
for ($i=1;$i<=31;$i++) {
$return.= '<option>'.str_pad($i,2,'0',STR_PAD_LEFT).'</option>';
}
$return.= '</select>';
$return.= '<select name="'.$name.'1_m" style="width:45px;">';
for ($i=1;$i<=12;$i++) {
$return.= '<option>'.str_pad($i,2,'0',STR_PAD_LEFT).'</option>';
}
$return.= '</select>';
$return.= '<select name="'.$name.'1_a" style="width:60px;">';
for ($i=1900;$i<=date('Y');$i++) {
$return.= '<option>'.$i.'</option>';
}
$return.= '</select>';
$return.= ' '.$this->view->translate('au').' ';
$return.= '<select name="'.$name.'2_j" style="width:45px;">';
for ($i=1;$i<=31;$i++) {
$select = '';
if ($i==date('d')) {
$select = ' selected';
}
$return.= '<option'.$select.'>'.str_pad($i,2,'0',STR_PAD_LEFT).'</option>';
}
$return.= '</select>';
$return.= '<select name="'.$name.'2_m" style="width:45px;">';
for ($i=1;$i<=12;$i++) {
$select = '';
if ($i==date('m')) {
$select = ' selected';
}
$return.= '<option'.$select.'>'.str_pad($i,2,'0',STR_PAD_LEFT).'</option>';
}
$return.= '</select>';
$return.= '<select name="'.$name.'2_a" style="width:60px;">';
$lastYear = date('Y');
for ($i=1900;$i<=$lastYear;$i++) {
$select = '';
if ($i==$lastYear) {
$select = ' selected';
}
$return.= '<option'.$select.'>'.$i.'</option>';
}
$return.= '</select>';
$return .= '<br/><a href="#" id="'.$name.'" class="intervalDate">'.$this->view->translate('Valider').'</a>';
return $return;
}
/* Interval */
private function intervalHTML($name, $field)
{
$session = new Scores_Fields();
$valeur = $session->getCritere($name);
$return = '<div class="interval" >';
$return .= '<input class="'.$field['class'].'" type="text" name="'.$name.'1" value="'.$valeur[0].'" /> '.$this->view->translate('à').' ';
$return .= '<input class="'.$field['class'].'" type="text" name="'.$name.'2" value="'.$valeur[1].'" />';
$return .= ' <a href="" class="interval" id="'.$name.'">'.$this->view->translate('Valider').'</a>';
$return .= '</div>';
return $return;
}
/* Dates */
private function dateHTML($name, $field)
{
$session = new Scores_Fields();
$return = '<div class="date" >';
$return .= '<input value="'.$session->getCritere($name).'" type="text" class="datepicker" name="'.$name.'1" /> a ';
$return .= '<input type="text" class="datepicker" name="'.$name.'2" />';
$return .= '</div>';
return ($return);
}
/* Textes */
protected function textHTML($name, $options)
{
$return = '<input type="text" class="criteres autocomplete" name="'.$name.'" />';
$return.= '<ul id="'.$name.'" class="selectqueries"></ul>';
$return.= '<a href="#" class="autocomplete">Sélectionner</a>';
$return.= '&nbsp;<a href="#" class="autocompleteEx">Exclure</a>';
return $return;
}
/* Textarea */
protected function textareaHTML($name, $field)
{
$return = '<textarea class="criteres" name="'.$name.'" ></textarea>';
$return.= '<a href="#" class="list">Sélectionner</a>';
$return.= '&nbsp;<a href="#" class="listEx">Exclure</a>';
return $return;
}
private function fileuploadHtml($name, $field)
{
$return = '<input class="upload" type="file" name="fichier" id="'.$name.'" /> ';
return ($return);
}
/* Radios */
private function radioHTML($name, $field, $item)
{
$return = '<input type="radio" name="'.$name.'" />';
return ($return);
return "<div>Impossible d'afficher ".$name."</div>";
}
}

View File

@ -1,29 +1,27 @@
<style>
.color{
background-color: #DCE3FC;
}
.color{ background-color: #DCE3FC; }
</style>
<div style="width:100%;">
<table width="100%" style="font-size:10px;">
<tr>
<?php foreach($this->label as $label): ?>
<th style="border-left:1px solid black;padding:2px;"><b><?=$label?></b></th>
<?php endforeach; ?>
</tr>
<?php
$i=0;
if(count($this->liste) > 0) {
foreach($this->liste as $line) {
echo '<tr '.((($i%2) == 0)?'class="color"':'').'>';
foreach($line as $col) {
echo '<td style="border-left:1px solid silver;padding:2px">'.$col.'</td>';
}
echo '</tr>';
$i++;
}
} else {
echo '<tr><td>Vous n\'avez selectionné aucuns critères</td></tr>';
<table width="100%" style="font-size:10px;">
<tr>
<?php foreach($this->label as $label): ?>
<th style="border-left:1px solid black;padding:2px;"><b><?=$label?></b></th>
<?php endforeach; ?>
</tr>
<?php
$i=0;
if(count($this->liste) > 0) {
foreach($this->liste as $line) {
echo '<tr '.((($i%2) == 0)?'class="color"':'').'>';
foreach($line as $col) {
echo '<td style="border-left:1px solid silver;padding:2px">'.$col.'</td>';
}
echo '</tr>';
$i++;
}
?>
</table>
} else {
echo '<tr><td>Vous n\'avez selectionné aucuns critères</td></tr>';
}
?>
</table>
<div>

View File

@ -11,25 +11,11 @@
<div class="panel-body">
<div id="entreprise">
<?=$this->Field('siege')?>
<?=$this->Field('groupe')?>
<?=$this->Field('tel')?>
<?=$this->Field('fax')?>
<?=$this->Field('web')?>
<?=$this->Field('mail')?>
<?=$this->Field('presentRcs')?>
<?=$this->Field('adrDom')?>
<?=$this->Field('dirNom')?>
<?=$this->Field('dateCrea_etab')?>
<?=$this->Field('participation')?>
<?=$this->Field('nbMPubli')?>
<?=$this->Field('dateCrea_ent')?>
<?=$this->Field('action')?>
<?=$this->Field('nbActio')?>
<?=$this->Field('nbPart')?>
</div>
<div id="link">
<a class="resetFamille" id="entreprise">Réinitialiser les critères entreprises</a>
<?php if ( count($this->FieldsEntreprise)>0 ) {?>
<?php foreach ( $this->FieldsEntreprise as $key => $params ) {?>
<?=$this->Field($key)?>
<?php }?>
<?php }?>
</div>
</div>
@ -48,21 +34,11 @@
<div class="panel-body">
<div id="economique">
<ul id="fieldsblock">
<li><?=$this->Field('capital')?></li>
<li><?=$this->Field('ape_entrep')?></li>
<li class="advanced"><?=$this->Field('ape_etab')?></li>
<li><?=$this->Field('age_entrep')?></li>
<li class="advanced"><?=$this->Field('age_etab')?></li>
<li><?=$this->Field('teff_entrep')?></li>
<li class="advanced"><?=$this->Field('teff_etab')?></li>
<li><?=$this->Field('eff_entrep')?></li>
<li class="advanced"><?=$this->Field('eff_etab')?></li>
<li class="advanced"><?=$this->Field('nbEtab')?></li>
</ul>
</div>
<div style="text-align:right;margin-top:20px;">
<a class="resetFamille" id="economique">Réinitialiser les critères economiques</a>
<?php if ( count($this->FieldsEconomique)>0 ) {?>
<?php foreach ( $this->FieldsEconomique as $key => $params ) {?>
<?=$this->Field($key)?>
<?php }?>
<?php }?>
</div>
</div>
@ -81,26 +57,11 @@
<div class="panel-body">
<div id="geographique">
<ul id="fieldsblock">
<li>
<?=$this->Field('geo')?>
<?=$this->Field('geo_domtom')?>
<?=$this->Field('geo_etranger')?>
<?=$this->Field('geo_corse')?>
</li>
<li class="advanced"><?=$this->Field('codesdepts')?></li>
<li class="advanced"><?=$this->Field('codespostaux')?></li>
<li class="advanced"><?=$this->Field('codesinsee')?></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;">
<a class="resetFamille" id="econmique">Réinitialiser les critères geographiques</a>
<?php if ( count($this->FieldsGeographique)>0 ) {?>
<?php foreach ( $this->FieldsGeographique as $key => $params ) {?>
<?=$this->Field($key)?>
<?php }?>
<?php }?>
</div>
</div>
@ -119,17 +80,11 @@
<div class="panel-body">
<div id="juridique">
<ul id="fieldsblock">
<li><?=$this->Field('cj')?></li>
<li class="advanced"><?=$this->Field('cjlist')?></li>
<li><?=$this->Field('actifEco')?></li>
<li><?=$this->Field('procolHisto')?></li>
<li><?=$this->Field('dateImmat')?></li>
<li class="advanced"><?=$this->Field('tvaIntraValide')?></li>
</ul>
</div>
<div style="text-align:right;margin-top:20px;">
<a class="resetFamille" id="econmique">Réinitialiser les critères juridique</a>
<?php if ( count($this->FieldsJuridique)>0 ) {?>
<?php foreach ( $this->FieldsJuridique as $key => $params ) {?>
<?=$this->Field($key)?>
<?php }?>
<?php }?>
</div>
</div>
@ -148,30 +103,11 @@
<div class="panel-body">
<div id="financiere">
<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>
<li class="advanced"><?=$this->Field('bilEE')?></li>
<li class="advanced"><?=$this->Field('bilFK')?></li>
<li class="advanced"><?=$this->Field('bilFR')?></li>
<li class="advanced"><?=$this->Field('bilGF')?></li>
<li class="advanced"><?=$this->Field('bilGP')?></li>
<li class="advanced"><?=$this->Field('bilGW')?></li>
<li class="advanced"><?=$this->Field('bilHD')?></li>
<li class="advanced"><?=$this->Field('bilHH')?></li>
<li class="advanced"><?=$this->Field('bilHL')?></li>
<li class="advanced"><?=$this->Field('bilHM')?></li>
<li class="advanced"><?=$this->Field('bilHN')?></li>
<li class="advanced"><?=$this->Field('bilYP')?></li>
</ul>
</div>
<div style="text-align:right;margin-top:20px;">
<a class="resetFamille" id="financier">Réinitialiser les critères financiers</a>
<?php if ( count($this->FieldsFinancier)>0 ) {?>
<?php foreach ( $this->FieldsFinancier as $key => $params ) {?>
<?=$this->Field($key)?>
<?php }?>
<?php }?>
</div>
</div>

View File

@ -8,7 +8,7 @@
<?php echo $this->headScript(); ?>
</head>
<body>
<div id="wrap">
<div id="wrap" class="clearfix">
<?php echo $this->render('header.phtml') ?>
<div class="container col-lg-12">

View File

@ -139,7 +139,7 @@ class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
$view->admin = true;
}
Zend_Registry::get('firebug')->info($identity);
//Zend_Registry::get('firebug')->info($identity);
if (Zend_Session::namespaceIsset('login')){
Zend_Session::namespaceUnset('login');

View File

@ -17,18 +17,17 @@ class Application_Controller_Plugin_Comptage extends Zend_Controller_Plugin_Abst
$user = $auth->getIdentity();
//Load ciblage to get status of sphinxsearch
require_once 'Scores/Ciblage.php';
$ciblage = new Ciblage();
$ciblage = new Scores_Ciblage_Engine();
$status = $ciblage->Status();
if ($status===false) {
if ( $status === false ) {
$view->CiblageError = true;
} else {
//Load def and session values
$session = new Scores_Fields();
$sessionValue = new Scores_Ciblage_Session();
// Chargement des critères de ciblage à partir de l'enregistrement en bdd
$id = $request->getParam('id', 0);
@ -40,25 +39,28 @@ class Application_Controller_Plugin_Comptage extends Zend_Controller_Plugin_Abst
->where('id = ?', $id);
$row = $criteresM->fetchRow($sql);
if ($row != null) {
//On charge les critères
$session->setCriteres(json_decode($row->criteres, 'true'));
$sessionValue->setSelectedValues(json_decode($row->criteres, true));
//Réalise le comptage
$fields = new Scores_Fields();
$ciblage = new Ciblage($fields->getValues(), $user->globalRNCS);
$ciblage = new Scores_Ciblage_Engine($sessionValue->getSelectedValues(), $user->globalRNCS);
$total = $ciblage->execute();
$session->setNb('total', $total);
$sessionValue->setCountTotal($total);
if ($user->preferences['interface']['insee']==1) {
$insee = $ciblage->calculRedevanceInsee();
} else {
$insee = null;
}
$session->setNb('insee', $insee);
$session->setCritereSession();
$sessionValue->setCountInsee($insee);
$sessionValue->setCritereSession();
}
}
$view->total = $session->getNb('total');
$view->insee = $session->getNb('insee');
$view->total = $sessionValue->getCountTotal();
$view->insee = $sessionValue->getCountInsee();
$view->msgComptage = true;
}
}

View File

@ -59,7 +59,7 @@ class Scores_Ciblage_Engine
//Follow each elements
if ( $structure!==null && count($structure)>0 ) {
foreach($structure as $key => $valeur) {
if ($key!= 'NB' && method_exists($this, $key)) {
if ( method_exists($this, $key) ) {
$this->{$key}($valeur);
} else {
Zend_Registry::get('firebug')->info('Method non exist KEY:'.$key);

View File

@ -18,7 +18,7 @@ class Scores_Ciblage_Field_List
public function getHTML($valueSelected = array())
{
$html = '<div class="row">' .
'<div class="col-md-6">' .
'<div class="col-md-10">' .
'<div class="btn-group criteres" name="'.$this->name.'">';
$valueTxt = '';
@ -34,8 +34,8 @@ class Scores_Ciblage_Field_List
$html.= '<textarea class="form-control" rows="3" name="'.$this->name.'">';
$html.= $valueTxt;
$html.= '</textarea>';
$html.= '<div class="col-md-6">' .
'<button class="btn btn-primary btn-sm" type="button">Sélectionner</button>' .
$html.= '<div class="col-md-2">' .
'<button class="btn btn-primary btn-sm pull-right" type="button">Sélectionner</button>' .
'</div>'.
'</div>'.
'</div>';

View File

@ -18,24 +18,22 @@ class Scores_Ciblage_Field_Many
public function getHTML($valueSelected = array())
{
$html = '<div class="row">' .
'<div class="col-md-6">' .
'<div name="'.$this->name.'">';
'<div class="col-md-10">';
if ( count($this->data)>0 ) {
$html.= '<select multiple class="form-control" name="'.$this->name.'">';
foreach ( $this->data as $value => $label ) {
$selected = "";
$selected = '';
if( in_array($value, $valueSelected) ) {
$selected = " selected";
$selected = ' selected';
}
$html.= '<option value="'.$value.'"'.$selected.'>'.$label.'</option>';
}
$html.= '</select>';
}
$html.= '</div>'.
'<div class="col-md-6">' .
'<div class="col-md-2">' .
'<button class="btn btn-primary btn-sm" type="button">Sélectionner</button>' .
'</div>'.
'</div>'.
'</div>';
return $html;
}

View File

@ -17,14 +17,15 @@ class Scores_Ciblage_Field_One
public function getHTML($valueSelected = '')
{
$html = '<div class="btn-group criteres pull-right" data-toggle="buttons" name="'.$this->name.'">';
$html = '<div class="btn-group critere-one pull-right" data-toggle="buttons" name="'.$this->name.'">';
if ( count($this->data)>0 ) {
foreach ( $this->data as $value => $label ) {
$selected = "";
$active = '';
if( $valueSelected === $value ) {
$selected = "active";
$active = ' active';
}
$html.= '<label class="btn btn-primary btn-sm '.$selected.'">'.
$html.= '<label class="btn btn-primary btn-sm'.$active.'">'.
'<input type="radio" name="'.$this->name.'" value="'.$value.'">'.$label.
'</label>';
}

View File

@ -17,23 +17,24 @@ class Scores_Ciblage_Field_Range
public function getHTML($valueSelected = array())
{
$html = '<div class="row">' .
'<div class="col-md-6">' .
'<div class="criteres" name="'.$this->name.'">';
$html = '<div class="col-md-10">';
if ( count($this->data)>0 ) {
$html.= '<b>'.number_format($this->data['min'], 0, ' ', ',').'</b>'.
if ( count($valueSelected)==0 ) {
$valueSelected = $this->data;
}
$html.= '<b style="margin:0 15px">'.number_format($this->data['min'], 0, ',', ' ').'</b>'.
'<input id="slider_'.$this->name.'" type="text" class="span2" value=""
data-slider-min="10"
data-slider-max="1000"
data-slider-step="5"
data-slider-min="'.$this->data['min'].'"
data-slider-max="'.$this->data['max'].'"
data-slider-step="1"
data-slider-value="['.$valueSelected['min'].','.$valueSelected['max'].']"/>'.
'<b>'.number_format($this->data['max'], 0, ' ', ',').'</b>';
'<b style="margin:0 15px">'.number_format($this->data['max'], 0, ',', ' ').'</b>';
}
$html.= '</div>'.
'<div class="col-md-6">' .
'<button class="btn btn-primary btn-sm" type="button">Sélectionner</button>' .
'</div>'.
'</div>'.
'<div class="col-md-2">' .
'<button class="btn btn-primary btn-sm pull-right" type="button">Sélectionner</button>' .
'</div>';
return $html;
}

View File

@ -3,6 +3,8 @@ class Scores_Ciblage_Field_RangeDate
{
protected $name = null;
protected $data = null;
protected $minDate = null;
protected $maxDate = null;
/**
*
@ -13,39 +15,46 @@ class Scores_Ciblage_Field_RangeDate
{
$this->name = $name;
$this->data = $data;
//Min Date
$date = new Zend_Date($this->data['min'], 'yyyyMMdd');
$this->minDate = $date->toString('dd/MM/yyyy');
//Max Date
$date = new Zend_Date($this->data['max'], 'yyyyMMdd');
$this->maxDate = $date->toString('dd/MM/yyyy');
}
public function getHTML($valueSelected = array())
{
$html = '<div class="row">' .
'<div class="col-md-6">' .
'<div class="criteres" name="'.$this->name.'">';
if ( count($this->data)>0 ) {
$html.= '<div class="well" style="overflow: auto">' .
'<div id="rangedate_'.$this->name.'" class="pull-left" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc">' .
$html.= '<div class="col-md-10">' .
'<div class="clearfix">' .
'<div id="rangedate_'.$this->name.'" class="pull-right" style="background:#fff;cursor:pointer; padding:5px 10px; border:1px solid #ccc;">' .
'<i class="glyphicon glyphicon-calendar icon-calendar icon-large"></i>' .
'<span></span> <b class="caret"></b>' .
'</div>'.
'</div>' .
'</div>' .
'</div>' .
'<div class="col-md-2">' .
'<button class="btn btn-primary btn-sm pull-right" type="button">Sélectionner</button>' .
'</div>';
} else {
$html.= '<p>Affichage impossible de l\'interface.</p>';
}
$html.= '</div>'.
'<div class="col-md-6">' .
'<button class="btn btn-primary btn-sm" type="button">Sélectionner</button>' .
'</div>'.
'</div>'.
'</div>';
return $html;
}
public function getJS()
{
return "
$('#reportrange').daterangepicker(
$('#rangedate_".$this->name."').daterangepicker(
{
startDate: moment().subtract('days', 29),
endDate: moment(),
minDate: '".$this->data['min']."',
maxDate: moment,
startDate: '".$this->minDate."',
endDate: '".$this->maxDate."',
minDate: '".$this->minDate."',
maxDate: '".$this->maxDate."',
/*dateLimit: { days: 60 },*/
showDropdowns: true,
showWeekNumbers: false,
@ -75,12 +84,12 @@ class Scores_Ciblage_Field_RangeDate
}
},
function(start, end) {
$('#reportrange span').html(start.format('DD/MM/YYYY') + ' - ' + end.format('DD/MM/YYYY'));
$('#rangedate_".$this->name." span').html(start.format('DD/MM/YYYY') + ' - ' + end.format('DD/MM/YYYY'));
}
);
//Set the initial state of the picker label
$('#reportrange span').html(moment().startOf('month').format('DD/MM/YYYY') + ' - ' + moment().format('DD/MM/YYYY'));
$('#rangedate_".$this->name." span').html('".$this->minDate."' + ' - ' + '".$this->maxDate."');
";
}

View File

@ -60,28 +60,188 @@ class Scores_Ciblage_FieldList
'values' => array('1' => 'Oui', '0' => 'Non'),
'activated' => true,
),
'presentRcs' => array(),
'adrDom' => array(),
'dirNom' => array(),
'nbMPubli' => array(),
'dateCrea_ent' => array(),
'dateCrea_etab' => array(),
'action' => array(),
'nbActio' => array(),
'participation' => array(),
'nbPart' => array(),
'presentRcs' => array(
'label' => "Etablissement présent au RNCS",
'desc' => "Restreindre la sélection aux établissements présents au Registre National du Commerce et des Sociétés",
'family' => 'entreprise',
'type' => 'one',
'values' => array('1' => 'Oui', '0' => 'Non'),
'activated' => true,
),
'adrDom' => array(
'label' => "Adresse de domiciliation",
'desc' => "Restreindre la sélection aux établissements situés à une adresse de domiciliation suspectée ou avérée",
'family' => 'entreprise',
'type' => 'one',
'values' => array('1' => 'Oui', '0' => 'Non'),
'activated' => true,
),
'dirNom' => array(
'label' => "Nom du principal dirigeant",
'desc' => "Restreindre la sélection aux entreprises ayant un principal dirigeant renseigné",
'family' => 'entreprise',
'type' => 'one',
'values' => array('1' => 'Oui', '0' => 'Non'),
'activated' => true,
),
'nbMPubli' => array(
'label' => "Marchés publiques remportés",
'desc' => "Restreindre la sélection aux entreprises ayant remportés des marchés publics. Une entreprise remportant des marchés publics est à jour de ses obligations fiscales et sociales, affirme sa capacité structurelle à répondre à la commande publique (capacité financière, personnel, encadrement, ...), dispose d'une assurance pour les risques professionnels, a communiqué ses éléments financiers au pouvoir adjudicateur",
'family' => 'entreprise',
'type' => 'one',
'values' => array('1' => 'Oui', '0' => 'Non'),
'activated' => true,
),
'dateCrea_ent' => array(
'label' => "Date de création de l'entreprise",
'desc' => "Restreindre la sélection suivant la date de création de l'entreprise.",
'family' => 'entreprise',
'type' => 'rangedate',
'minmax' => 'date',
'activated' => true,
),
'dateCrea_etab' => array(
'label' => "Date de création de l'établissement",
'desc' => "Restreindre la sélection suivant la date de création de l'établissement.",
'family' => 'entreprise',
'type' => 'rangedate',
'minmax' => 'date',
'activated' => true,
),
'action' => array(
'label' => "Présence d'actionnaires",
'desc' => "Restreindre la sélection aux entreprises ayant au moins un actionnaire de renseigné.",
'family' => 'entreprise',
'type' => 'one',
'values' => array('1' => 'Oui', '0' => 'Non'),
'activated' => true,
),
'nbActio' => array(
'label' => "Nombre d'actionnaires connus",
'desc' => "Restreindre la sélection aux entreprises ayant de 1 à N actionnaire(s) renseignée(s).",
'family' => 'entreprise',
'type' => 'range',
'minmax' => 'number',
'activated' => true,
),
'participation' => array(
'label' => "Présence de participations",
'desc' => "Restreindre la sélection aux entreprises ayant au moins une participation de renseigné.",
'family' => 'entreprise',
'type' => 'one',
'values' => array('1' => 'Oui', '0' => 'Non'),
'activated' => true,
),
'nbPart' => array(
'label' => "Nombre de participation connus",
'desc' => "Restreindre la sélection aux entreprises ayant de 1 à N participation(s) renseignée(s).",
'family' => 'entreprise',
'type' => 'range',
'minmax' => 'number',
'activated' => true,
),
'ape_etab' => array(),
'ape_entrep' => array(),
'NaceEtab' => array(),
'NaceEntrep' => array(),
'age_etab' => array(),
'age_entrep' => array(),
'teff_entrep' => array(),
'teff_etab' => array(),
'nbEtab' => array(),
'eff_entrep' => array(),
'eff_etab' => array(),
'capital' => array(),
'age_etab' => array(
'label' => "Age de l'établissement",
'desc' => "Restreindre la sélection suivant l'age des établissements.",
'family' => 'economique',
'type' => 'range',
'minmax' => 'number',
'activated' => true,
),
'age_entrep' => array(
'label' => "Age de l'entreprise",
'desc' => "Restreindre la sélection suivant l'age de l'entreprise.",
'family' => 'economique',
'type' => 'range',
'minmax' => 'number',
'activated' => true,
),
'teff_entrep' => array(
'label' => "Tranche d'effectif de l'entreprise",
'desc' => "Limiter la sélection aux entreprises ayant certaines tranches de salariés. Attention, pour les unités non employeuses il n'y a pas de salarié au cours de l'année de référence et pas d'effectif au 31/12 ; cette tranche peut contenir quelques effectifs inconnus. A contrario, pour la tranche 0 salarié il n'y a pas d'effectifs au 31/12 mais l'unité a employé des salariés au cours de l'année de référence",
'family' => 'economique',
'type' => 'many',
'values' => array(
'99' => "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",
),
'activated' => true,
),
'teff_etab' => array(
'label' => "Tranche d'effectif de l'établissement",
'desc' => "Limiter la sélection aux établissements ayant certaines tranches de salariés. Attention, pour les unités non employeuses il n'y a pas de salarié au cours de l'année de référence et pas d'effectif au 31/12 ; cette tranche peut contenir quelques effectifs inconnus. A contrario, pour la tranche 0 salarié il n'y a pas d'effectifs au 31/12 mais l'unité a employé des salariés au cours de l'année de référence",
'family' => 'economique',
'type' => 'many',
'values' => array(
'99' => "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",
),
'activated' => true,
),
'nbEtab' => array(
'label' => "Nombre d'établissements",
'desc' => "Limiter la sélection aux entreprises ayant de 1 à N établissements.",
'family' => 'economique',
'type' => 'range',
'minmax' => 'number',
'activated' => true,
),
'eff_entrep' => array(
'label' => "Effectif réel de l'entreprise",
'desc' => "Limiter la sélection aux entreprises ayant de X à Y salariés.",
'family' => 'economique',
'type' => 'range',
'minmax' => 'number',
'activated' => true,
),
'eff_etab' => array(
'label' => "Effectif réel de l'établissements",
'desc' => "Limiter la sélection aux établissements ayant de X à Y salariés.",
'family' => 'economique',
'type' => 'range',
'minmax' => 'number',
'activated' => true,
),
'capital' => array(
'label' => "Capital de l'entreprise",
'desc' => "Limiter la sélection aux entreprises disposant d'un capital donné",
'family' => 'economique',
'type' => 'range',
'minmax' => 'number',
'activated' => true,
),
'geo' => array(),
'geo_domtom' => array(),
'geo_etranger' => array(),
@ -90,36 +250,287 @@ class Scores_Ciblage_FieldList
'codespostaux' => array(),
'codesdepts' => array(),
'adr_reg' => array(),
'zus' => array(),
'zru' => array(),
'zfu' => array(),
'cucs' => array(),
'zrr' => array(),
'zafr' => array(),
'zus' => array(
'label' => "Zones Urbaines Sensibles",
'desc' => "Restreindre la sélection aux établissements situés en Zone Urbaine Sensible (ou ZUS). Les ZUS sont des territoire infra-urbain défini par les pouvoirs publics français bénéficiant d'aides spécifiques sous forme d'exonérations fiscales et sociales.",
'family' => 'geographique',
'type' => 'one',
'values' => array('1' => 'Oui', '0' => 'Non'),
'activated' => true,
),
'zru' => array(
'label' => "Zones de Redynamisation Urbaine",
'desc' => "Restreindre la sélection aux établissements situés en Zone de Redynamisation Urbaine (ou ZRU). Les ZRU sont un sous-ensemble des Zones Urbaines Sensibles et bénéficient d'aides spécifiques sous forme d'exonérations fiscales et sociales.",
'family' => 'geographique',
'type' => 'one',
'values' => array('1' => 'Oui', '0' => 'Non'),
'activated' => true,
),
'zfu' => array(
'label' => "Zones Urbaines Sensibles",
'desc' => "Restreindre la sélection aux établissements établissements situés en Zone Franche Urbaine (ou ZFU). Les ZFU sont un sous-ensemble des Zones Urbaines Sensibles et bénéficient d'aides spécifiques sous forme d'exonérations fiscales et sociales.",
'family' => 'geographique',
'type' => 'one',
'values' => array('1' => 'Oui', '0' => 'Non'),
'activated' => true,
),
'cucs' => array(
'label' => "Contrats Urbains de Cohésion Sociale",
'desc' => "Restreindre la sélection aux établissements situés en Contrats Urbains de Cohésion Sociale (ou CUCS).",
'family' => 'geographique',
'type' => 'one',
'values' => array('1' => 'Oui', '0' => 'Non'),
'activated' => true,
),
'zrr' => array(
'label' => "Zones de Revitalisation Rurale",
'desc' => "Restreindre la sélection aux établissements situés en Zone de Revitalisation Rurale (ou ZRR).",
'family' => 'geographique',
'type' => 'one',
'values' => array('1' => 'Oui', '0' => 'Non'),
'activated' => true,
),
'zafr' => array(
'label' => "Zones d'Aides à Finalités Régionales",
'desc' => "Restreindre la sélection aux établissements situés en Zone d'Aide à Finalité Régionale (ou ZAFR).",
'family' => 'geographique',
'type' => 'one',
'values' => array('1' => 'Oui', '0' => 'Non'),
'activated' => true,
),
'cj' => array(),
'actifEco' => array(),
'procolHisto' => array(),
'tvaIntraValide' => array(),
'dateImmat' => array(),
'bilType' => array(),
'avisCs' => array(),
'bilDuree' => array(),
'bilTca' => array(),
'bilAnnee' => array(),
'bilCloture' => array(),
'bilEE' => array(),
'bilFL' => array(),
'bilFK' => array(),
'bilFR' => array(),
'bilGF' => array(),
'bilGP' => array(),
'bilGW' => array(),
'bilHD' => array(),
'bilHH' => array(),
'bilHL' => array(),
'bilHM' => array(),
'bilHN' => array(),
'bilYP' => array(),
'actifEco' => array(
'label' => "Établissement économiquement actif",
'desc' => "Restreindre la sélection aux établissements économiquement actif/inactifs : Etablissements présumés fermés (vendus sans formalités), Pli Non Distribué (NPAI).",
'family' => 'juridique',
'type' => 'one',
'values' => array('1' => 'Oui', '0' => 'Non'),
'activated' => true,
),
'procolHisto' => array(
'label' => "Présence d'une procédure dans l'historique",
'desc' => "Restreindre la sélection aux entreprises ayant déjà été en procédure collective.",
'family' => 'juridique',
'type' => 'one',
'values' => array('1' => 'Oui', '0' => 'Non'),
'activated' => true,
),
'tvaIntraValide' => array(
'label' => "Numéro de TVA intracommunautaire valide",
'desc' => "Restreindre la sélection aux entreprises entreprises dont le numéro de TVA intracommunautaire est valide (si non, exclusion d'office des micro-entreprises fiscales type Auto-entrepreneur).",
'family' => 'juridique',
'type' => 'one',
'values' => array('1' => 'Oui', '0' => 'Non'),
'activated' => true,
),
'dateImmat' => array(
'label' => "Date d'immatriculation de l'entreprise",
'desc' => "Limiter aux entreprises dont la date de création est comprise entre A et B.",
'family' => 'juridique',
'type' => 'rangedate',
'minmax' => 'date',
'activated' => true,
),
'bilType' => array(
'label' => "Derniers éléments financiers",
'desc' => "Limiter aux entreprises dont les derniers éléments financiers sont Réels, Estimés ou Inconnus.",
'family' => 'financier',
'type' => 'many',
'values' => array(
'1' => 'Inconnus', // I
'2' => 'Réels', // R
'3' => 'Estimés', //E
),
'activated' => true,
),
'avisCs' => array(
'label' => "Informations de paiements",
'desc' => "",
'family' => 'financier',
'type' => 'many',
'values' => array(
'0' => 'Risque indéterminé',
'1' => 'Aucun risque resencé',
'2' => 'Présence d\'impayé(s)',
'3' => 'Présence de privilèges',
'4' => 'Risque moyen',
'5' => 'Risque important',
'6' => 'Risque très important',
'7' => 'Risque dans le groupe'
),
'activated' => true,
),
'bilDuree' => array(
'label' => "Durée du dernier bilan en mois",
'title' => "Limiter aux entreprises dont la durée du dernier bilan est précisée",
'family' => 'financier',
'type' => 'many',
'values' => array(
'1' => '1 mois',
'2' => '2 mois',
'3' => '3 mois',
'4' => '4 mois',
'5' => '5 mois',
'6' => '6 mois',
'7' => '7 mois',
'8' => '8 mois',
'9' => '9 mois',
'10' => '10 mois',
'11' => '11 mois',
'12' => '12 mois',
'13' => '13 mois',
'14' => '14 mois',
'15' => '15 mois',
'16' => '16 mois',
'17' => '17 mois',
'18' => '18 mois',
'19' => '19 mois',
'20' => '20 mois',
'21' => '21 mois',
'22' => '22 mois',
'23' => '23 mois',
),
'activated' => true,
),
'bilTca' => array(
'label' => "Tranche de CA issue du bilan",
'title' => "Limitation aux entreprises dont la dernière tranche de Chiffre d'Affaires est précisée (Réel ou Estimé)",
'family' => 'financier',
'type' => 'many',
'values' => 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'
),
'activated' => true,
),
'bilAnnee' => array(
'label' => "Dernière année de bilan",
'desc' => "Limitation aux entreprises dont la dernière année de bilan est précisée.",
'family' => 'financier',
'type' => 'range',
'minmax' => 'number',
'activated' => true,
),
'bilCloture' => array(
'label' => "Dernière date de clôture du bilan",
'desc' => "Limitation aux entreprises dont le dernier exercice comptable est situé entre 2 dates précises.",
'family' => 'financier',
'type' => 'range',
'minmax' => 'number',
'activated' => true,
),
'bilEE' => array(
'label' => "Total bilan (EE)",
'desc' => "Limitation aux entreprises dont le poste EE (Montant du poste Total Bilan en Euros) est connu (Chiffres Réels uniquement)",
'family' => 'financier',
'type' => 'range',
'minmax' => 'number',
'activated' => true,
),
'bilFL' => array(
'label' => "CA total (FL)",
'desc' => "Limitation aux entreprises dont le poste FL (Montant du Chiffre d'Affaires en Euros) est connu (Chiffres Réels et Estimés)",
'family' => 'financier',
'type' => 'range',
'minmax' => 'number',
'activated' => true,
),
'bilFK' => array(
'label' => "'Chiffre d'affaires Export (FK)",
'desc' => "Limitation aux entreprises dont le poste FK (Montant du Chiffre d'Affaires Export en Euros) est connu (Chiffres Réels uniquement)",
'family' => 'financier',
'type' => 'range',
'minmax' => 'number',
'activated' => true,
),
'bilFR' => array(
'label' => "Produits d'Exploitation (FR)",
'desc' => "Limitation aux entreprises dont le poste FR (Montant des Produits d'Exploitation en Euros) est connu (Chiffres Réels uniquement)",
'family' => 'financier',
'type' => 'range',
'minmax' => 'number',
'activated' => true,
),
'bilGF' => array(
'label' => "Charges d'Exploitation (GF)",
'desc' => "Limitation aux entreprises dont le poste GF (Montant des Charges d'Exploitation en Euros) est connu (Chiffres Réels uniquement)",
'family' => 'financier',
'type' => 'range',
'minmax' => 'number',
'activated' => true,
),
'bilGP' => array(
'label' => "Charges Financières (GP)",
'desc' => "Limitation aux entreprises dont le poste GP (Montant des Charges Financières en Euros) est connu (Chiffres Réels uniquement)",
'family' => 'financier',
'type' => 'range',
'minmax' => 'number',
'activated' => true,
),
'bilGW' => array(
'label' => "R.C.A.I - Résultat courant av. impôt (GW)",
'desc' => "Limitation aux entreprises dont le poste GW (Montant du Résultat Courant Avant Impôt en Euros) est connu (Chiffres Réels uniquement)",
'family' => 'financier',
'type' => 'range',
'minmax' => 'number',
'activated' => true,
),
'bilHD' => array(
'label' => "Produits Exceptionnels (HD)",
'desc' => "Limitation aux entreprises dont le poste HD (Montant des Produits Exceptionnels en Euros) est connu (Chiffres Réels uniquement)",
'family' => 'financier',
'type' => 'range',
'minmax' => 'number',
'activated' => true,
),
'bilHH' => array(
'label' => "Charges Exceptionnels (HH)",
'desc' => "Limitation aux entreprises dont le poste HH (Montant des Charges Exceptionnels en Euros) est connu (Chiffres Réels uniquement)",
'family' => 'financier',
'type' => 'range',
'minmax' => 'number',
'activated' => true,
),
'bilHL' => array(
'label' => "Total des Produits (HL)",
'desc' => "Limitation aux entreprises dont le poste HL (Montant du Total des Produits en Euros) est connu (Chiffres Réels uniquement)",
'family' => 'financier',
'type' => 'range',
'minmax' => 'number',
'activated' => true,
),
'bilHM' => array(
'label' => "Total des Charges (HM)",
'desc' => "Limitation aux entreprises dont le poste HM (Montant du Total des Charges en Euros) est connu (Chiffres Réels uniquement)",
'family' => 'financier',
'type' => 'range',
'minmax' => 'number',
'activated' => true,
),
'bilHN' => array(
'label' => "Résultat (HN)",
'desc' => "Limitation aux entreprises dont le poste HN (Montant du Résultat Net en Euros) est connu (Chiffres Réels uniquement)",
'family' => 'financier',
'type' => 'range',
'minmax' => 'number',
'activated' => true,
),
'bilYP' => array(
'label' => "Effectif salarié (YP)",
'desc' => "Limitation aux entreprises dont le poste YP (Effectif salarié de l'entreprise) est connu (Chiffres Réels uniquement)",
'family' => 'financier',
'type' => 'range',
'minmax' => 'number',
'activated' => true,
),
);
public function __construct(){}
@ -164,11 +575,18 @@ class Scores_Ciblage_FieldList
}
$htmlfield = $field->getHTML($valueSelected);
$html.= '<div class="panel-body">'.$htmlfield.'</div>';
$html.= '<div class="panel-body">' . $htmlfield . '</div>';
if ( method_exists($field, 'getJS') ) {
$html.= '<script>'.$field->getJS().'</script>';
}
//Bloc footer
$html.= '<div class="panel-footer"><small class="text-justify">' . $this->items[$name]['desc'] . '</small></div>';
$html.= '</div>';
return $html;
}
@ -194,6 +612,10 @@ class Scores_Ciblage_FieldList
foreach ( $this->items as $key => $info ) {
if ( $info['activated'] === true ) {
if ($family !== null && $family != $info['family']) {
continue;
}
$item['label'] = $info['label'];
$item['desc'] = $info['desc'];
@ -225,6 +647,7 @@ class Scores_Ciblage_FieldList
//Override info with values from getMinMax
if ( array_key_exists('minmax', $info) ) {
Zend_Registry::get('firebug')->info('minmax');
$values = $this->getMinMax($key);
}
@ -236,8 +659,35 @@ class Scores_Ciblage_FieldList
return $values;
}
/**
* Get Minimum and Maximum to display in fields
* @param string $key
* @return array
*/
protected function getMinMax($key)
{
$info = $this->items[$key];
$minmaxType = $info['minmax'];
if ( is_array($minmaxType) ) {
return $minmaxType;
} else {
//@todo : Faire fichier de cache des minmax
$valuesM = new Application_Model_CiblageMinMax();
$sql = $valuesM->select()->where('cle=?', $key);
try {
$result = $valuesM->fetchRow($sql);
if ($result !== null) {
return array(
'min' => $result->min,
'max' => $result->max,
);
}
} catch(Zend_Db_Exception $e) {
}
}
return array();
}

View File

@ -24,11 +24,14 @@ class Scores_Ciblage_Session
* @param Scores_Ciblage_FieldList $fields
* @param boolean $batch
*/
public function __construct($fields, $batch = false)
public function __construct($fields = null, $batch = false)
{
$this->fields = $fields;
$this->setSession();
if ( Zend_Session::namespaceIsset('ciblage')) {
$session = new Zend_Session_Namespace('ciblage');
$this->ciblage = $session->ciblage;
}
}
/**
@ -62,6 +65,8 @@ class Scores_Ciblage_Session
*/
public function setSelected($key, $value, $ex = false)
{
$fields = $this->fields->getItems();
//Check if the key exist
if ( !array_key_exists($key, $fields) ) {
Zend_Registry::get('firebug')->info('CLE INCORRECT');
@ -92,7 +97,7 @@ class Scores_Ciblage_Session
}
//Save data in session
//Prepare to save date in session
if ( $valueToSave !== null ) {
//Save the value
@ -106,8 +111,6 @@ class Scores_Ciblage_Session
$this->ciblage->select[$key]['in'] = $value;
}
$this->setSession();
return true;
}
@ -213,8 +216,6 @@ class Scores_Ciblage_Session
public function setCountTotal($value)
{
$this->ciblage->count->total = $value;
$this->setSession();
}
/**
@ -235,8 +236,6 @@ class Scores_Ciblage_Session
public function setCountInsee($value)
{
$this->ciblage->count->insee = $value;
$this->setSession();
}
/**

View File

@ -0,0 +1,267 @@
/*!
* Stylesheet for the Date Range Picker, for use with Bootstrap 3.x
*
* Copyright 2013 Dan Grossman ( http://www.dangrossman.info )
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Built for http://www.improvely.com
*/
.daterangepicker.dropdown-menu {
max-width: none;
z-index: 3000;
}
.daterangepicker.opensleft .ranges, .daterangepicker.opensleft .calendar {
float: left;
margin: 4px;
}
.daterangepicker.opensright .ranges, .daterangepicker.opensright .calendar {
float: right;
margin: 4px;
}
.daterangepicker .ranges {
width: 160px;
text-align: left;
}
.daterangepicker .ranges .range_inputs>div {
float: left;
}
.daterangepicker .ranges .range_inputs>div:nth-child(2) {
padding-left: 11px;
}
.daterangepicker .calendar {
display: none;
max-width: 270px;
}
.daterangepicker.show-calendar .calendar {
display: block;
}
.daterangepicker .calendar.single .calendar-date {
border: none;
}
.daterangepicker .calendar th, .daterangepicker .calendar td {
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
white-space: nowrap;
text-align: center;
min-width: 32px;
}
.daterangepicker .daterangepicker_start_input label,
.daterangepicker .daterangepicker_end_input label {
color: #333;
display: block;
font-size: 11px;
font-weight: normal;
height: 20px;
line-height: 20px;
margin-bottom: 2px;
text-shadow: #fff 1px 1px 0px;
text-transform: uppercase;
width: 74px;
}
.daterangepicker .ranges input {
font-size: 11px;
}
.daterangepicker .ranges .input-mini {
background-color: #eee;
border: 1px solid #ccc;
border-radius: 4px;
color: #555;
display: block;
font-size: 11px;
height: 30px;
line-height: 30px;
vertical-align: middle;
margin: 0 0 10px 0;
padding: 0 6px;
width: 74px;
}
.daterangepicker .ranges ul {
list-style: none;
margin: 0;
padding: 0;
}
.daterangepicker .ranges li {
font-size: 13px;
background: #f5f5f5;
border: 1px solid #f5f5f5;
color: #08c;
padding: 3px 12px;
margin-bottom: 8px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
cursor: pointer;
}
.daterangepicker .ranges li.active, .daterangepicker .ranges li:hover {
background: #08c;
border: 1px solid #08c;
color: #fff;
}
.daterangepicker .calendar-date {
border: 1px solid #ddd;
padding: 4px;
border-radius: 4px;
background: #fff;
}
.daterangepicker .calendar-time {
text-align: center;
margin: 8px auto 0 auto;
line-height: 30px;
}
.daterangepicker {
position: absolute;
background: #fff;
top: 100px;
left: 20px;
padding: 4px;
margin-top: 1px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.daterangepicker.opensleft:before {
position: absolute;
top: -7px;
right: 9px;
display: inline-block;
border-right: 7px solid transparent;
border-bottom: 7px solid #ccc;
border-left: 7px solid transparent;
border-bottom-color: rgba(0, 0, 0, 0.2);
content: '';
}
.daterangepicker.opensleft:after {
position: absolute;
top: -6px;
right: 10px;
display: inline-block;
border-right: 6px solid transparent;
border-bottom: 6px solid #fff;
border-left: 6px solid transparent;
content: '';
}
.daterangepicker.opensright:before {
position: absolute;
top: -7px;
left: 9px;
display: inline-block;
border-right: 7px solid transparent;
border-bottom: 7px solid #ccc;
border-left: 7px solid transparent;
border-bottom-color: rgba(0, 0, 0, 0.2);
content: '';
}
.daterangepicker.opensright:after {
position: absolute;
top: -6px;
left: 10px;
display: inline-block;
border-right: 6px solid transparent;
border-bottom: 6px solid #fff;
border-left: 6px solid transparent;
content: '';
}
.daterangepicker table {
width: 100%;
margin: 0;
}
.daterangepicker td, .daterangepicker th {
text-align: center;
width: 20px;
height: 20px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
cursor: pointer;
white-space: nowrap;
}
.daterangepicker td.off {
color: #999;
}
.daterangepicker td.disabled {
color: #999;
}
.daterangepicker td.available:hover, .daterangepicker th.available:hover {
background: #eee;
}
.daterangepicker td.in-range {
background: #ebf4f8;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
}
.daterangepicker td.active, .daterangepicker td.active:hover {
background-color: #357ebd;
border-color: #3071a9;
color: #fff;
}
.daterangepicker td.week, .daterangepicker th.week {
font-size: 80%;
color: #ccc;
}
.daterangepicker select.monthselect, .daterangepicker select.yearselect {
font-size: 12px;
padding: 1px;
height: auto;
margin: 0;
cursor: default;
}
.daterangepicker select.monthselect {
margin-right: 2%;
width: 56%;
}
.daterangepicker select.yearselect {
width: 40%;
}
.daterangepicker select.hourselect, .daterangepicker select.minuteselect, .daterangepicker select.ampmselect {
width: 50px;
margin-bottom: 0;
}
.daterangepicker_start_input {
float: left;
}
.daterangepicker_end_input {
float: left;
padding-left: 11px
}
.daterangepicker th.month {
width: auto;
}

File diff suppressed because it is too large Load Diff

9
public/libs/moment.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,6 @@
/*!
* Slider for Bootstrap
*
* Licensed under the Apache License v2.0
*
*/.slider{display:inline-block;vertical-align:middle;position:relative}.slider.slider-horizontal{width:210px;height:20px}.slider.slider-horizontal .slider-track{height:10px;width:100%;margin-top:-5px;top:50%;left:0}.slider.slider-horizontal .slider-selection{height:100%;top:0;bottom:0}.slider.slider-horizontal .slider-handle{margin-left:-10px;margin-top:-5px}.slider.slider-horizontal .slider-handle.triangle{border-width:0 10px 10px 10px;width:0;height:0;border-bottom-color:#0480be;margin-top:0}.slider.slider-vertical{height:210px;width:20px}.slider.slider-vertical .slider-track{width:10px;height:100%;margin-left:-5px;left:50%;top:0}.slider.slider-vertical .slider-selection{width:100%;left:0;top:0;bottom:0}.slider.slider-vertical .slider-handle{margin-left:-5px;margin-top:-10px}.slider.slider-vertical .slider-handle.triangle{border-width:10px 0 10px 10px;width:1px;height:1px;border-left-color:#0480be;margin-left:0}.slider.slider-disabled .slider-handle{background-image:-webkit-linear-gradient(top,#dfdfdf 0,#bebebe 100%);background-image:linear-gradient(to bottom,#dfdfdf 0,#bebebe 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdfdfdf',endColorstr='#ffbebebe',GradientType=0)}.slider.slider-disabled .slider-track{background-image:-webkit-linear-gradient(top,#e5e5e5 0,#e9e9e9 100%);background-image:linear-gradient(to bottom,#e5e5e5 0,#e9e9e9 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe5e5e5',endColorstr='#ffe9e9e9',GradientType=0);cursor:not-allowed}.slider input{display:none}.slider .tooltip-inner{white-space:nowrap}.slider-track{position:absolute;cursor:pointer;background-image:-webkit-linear-gradient(top,#f5f5f5 0,#f9f9f9 100%);background-image:linear-gradient(to bottom,#f5f5f5 0,#f9f9f9 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5',endColorstr='#fff9f9f9',GradientType=0);-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);border-radius:4px}.slider-selection{position:absolute;background-image:-webkit-linear-gradient(top,#f9f9f9 0,#f5f5f5 100%);background-image:linear-gradient(to bottom,#f9f9f9 0,#f5f5f5 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff9f9f9',endColorstr='#fff5f5f5',GradientType=0);-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;border-radius:4px}.slider-handle{position:absolute;width:20px;height:20px;background-color:#3a94a5;background-image:-webkit-linear-gradient(top,#149bdf 0,#0480be 100%);background-image:linear-gradient(to bottom,#149bdf 0,#0480be 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff149bdf',endColorstr='#ff0480be',GradientType=0);filter:none;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.2),0 1px 2px rgba(0,0,0,.05);opacity:.8;border:0 solid transparent}.slider-handle.round{border-radius:50%}.slider-handle.triangle{background:transparent none}

View File

@ -1,6 +1,6 @@
$(document).ready(function()
{
$('div#panel').delegate('div#criteres a.criterelist', 'click', function(e){
/*$('div#criteres a.criterelist').click(function(e){
e.preventDefault();
var title = $(this).attr('title');
var href = $(this).attr('href');
@ -21,32 +21,36 @@ $(document).ready(function()
};
$('<div id="dialogcritere"></div>').dialog(dialogOpts);
return false;
});
});*/
$('.panel-group').delegate('div.criteres label', 'change', function(e){
$('div.critere-one input[type=radio]').change(function(e){
e.preventDefault();
var btn = $(this);
var result = set(btn.attr('name'), btn.val());
if (!result) {
alert('error');
$('div.critere-one[name='+btn.attr('name')+']').button('reset');
}
});
/*$('.panel-group').delegate('div.criteres label', 'change', function(e){
e.stopPropagation();
if ( !$(this).parent('div').attr('size') ){
var valeur = $(this).find('input').val();
set($(this).parent('div').attr('name'), valeur);
}
});
});*/
$('.panel-group').delegate('input[type=checkbox].criteres', 'click', function(e){
/*$('.panel-group').delegate('input[type=checkbox].criteres', 'click', function(e){
e.stopPropagation();
if($(this).is(':checked')) {
set($(this).attr('name'), 1);
} else {
set($(this).attr('name'), 0);
}
});
$('.panel-group').delegate('input[type=radio].criteres', 'click', function(e){
e.stopPropagation();
set($(this).attr('name'), $(this).val());
});
});*/
$('input[type=text].autocomplete')
/*$('input[type=text].autocomplete')
.bind( "keydown", function( event ) {
if ( event.keyCode === $.ui.keyCode.TAB && $(this).data("autocomplete").menu.active ) {
event.preventDefault();
@ -75,9 +79,9 @@ $(document).ready(function()
return false;
},
close: function ( event, ui) { this.value = ''; },
});
});*/
$('.panel-group').delegate('a.autocomplete', 'click', function(e){
/*$('.panel-group').delegate('a.autocomplete', 'click', function(e){
e.stopPropagation();
var name = $(this).parent().find('input.criteres').attr('name');
var ul = $(this).parent().find('ul.selectqueries');
@ -89,9 +93,9 @@ $(document).ready(function()
set(name, values.join(','));
}
ul.empty();
});
});*/
$('.panel-group').delegate('a.autocompleteEx', 'click', function(e){
/*$('.panel-group').delegate('a.autocompleteEx', 'click', function(e){
e.stopPropagation();
var name = $(this).parent().find('input.criteres').attr('name');
var ul = $(this).parent().find('ul.selectqueries');
@ -103,21 +107,21 @@ $(document).ready(function()
set(name, values.join(','), 1);
}
ul.empty();
});
});*/
$('.panel-group').delegate('a.selectMultiple', 'click', function(e){
/*$('.panel-group').delegate('a.selectMultiple', 'click', function(e){
e.stopPropagation();
var obj = $(this).parent().find('label.active input');
set(obj.attr('name'), obj.val());
});
});*/
$('.panel-group').delegate('a.selectMultipleEx', 'click', function(e){
/*$('.panel-group').delegate('a.selectMultipleEx', 'click', function(e){
e.stopPropagation();
var obj = $(this).parent().find('select.criteres');
set(obj.attr('name'), obj.val(), 1);
});
});*/
$('.panel-group').delegate('a.intervalDate', 'click', function(e){
/*$('.panel-group').delegate('a.intervalDate', 'click', function(e){
e.preventDefault();
var key = $(this).attr('id');
var val1 = $('select[name='+key+'1_a]').val() + $('select[name='+key+'1_m]').val() + $('select[name='+key+'1_j]').val();
@ -127,9 +131,9 @@ $(document).ready(function()
var values = val1 + ',' + val2;
set(key, values);
return false;
});
});*/
$('.panel-group').delegate('a.interval', 'click', function(e){
/*$('.panel-group').delegate('a.interval', 'click', function(e){
e.preventDefault();
var key = $(this).attr('id');
var val1 = $('input[name='+key+'1]').val();
@ -139,17 +143,17 @@ $(document).ready(function()
var values = val1 + ',' + val2;
set(key, values);
return false;
});
});*/
$('.panel-group').delegate('a.intervalSelect', 'click', function(e){
/*$('.panel-group').delegate('a.intervalSelect', 'click', function(e){
e.preventDefault();
var key = $(this).attr('id');
var values = $('select[name='+key+'1] option:selected').val()+','+$('select[name='+key+'2] option:selected').val();
set(key, values);
return false;
});
});*/
$('.panel-group').delegate('a.arborescence', 'click', function(e) {
/*$('.panel-group').delegate('a.arborescence', 'click', function(e) {
e.preventDefault();
var title = $(this).attr('title');
var href = $(this).attr('href');
@ -179,9 +183,9 @@ $(document).ready(function()
};
$('<div id="dialogtree"></div>').dialog(dialogOpts);
return false;
});
});*/
$('.panel-group').delegate('a.text', 'click', function(e) {
/*$('.panel-group').delegate('a.text', 'click', function(e) {
e.preventDefault();
var id = $(this).attr('id');
if ($('div#field_text_'+id).css('display') == 'none') {
@ -189,9 +193,9 @@ $(document).ready(function()
} else {
$('div#field_text_'+id).hide('blind');
}
});
});*/
$('.panel-group').delegate('a.dlist', 'click', function(e) {
/*$('.panel-group').delegate('a.dlist', 'click', function(e) {
e.preventDefault();
var id = $(this).attr('id');
if ($('div#field_list_'+id).css('display') == 'none') {
@ -199,23 +203,23 @@ $(document).ready(function()
} else {
$('div#field_list_'+id).hide('blind');
}
});
});*/
$('.panel-group').delegate('a.list', 'click', function(e){
/*$('.panel-group').delegate('a.list', 'click', function(e){
e.stopPropagation();
var obj = $(this).parent().find('textarea.criteres');
//regexp
set(obj.attr('name'), obj.val());
});
});*/
$('.panel-group').delegate('a.listEx', 'click', function(e){
/*$('.panel-group').delegate('a.listEx', 'click', function(e){
e.stopPropagation();
var obj = $(this).parent().find('textarea.criteres');
//regexp
set(obj.attr('name'), obj.val(), 1);
});
});*/
});
@ -223,19 +227,21 @@ function set(key, value, ex) {
ex = typeof ex !== 'undefined' ? ex : 0;
$('#panel').html('<span class="glyphicon glyphicon-refresh img-rounded"></span>');
$.post('/comptage/index', { cle:key, valeur:value, exclude:ex }, function(data, status) {
//Resume criteres content
$.post('/index/criteres', { total:data.count, insee:data.insee }, function(data) { $('#panel').html(data); });
if (data.error==1) {
$('div#actionMessage').html('<div class="alert alert-danger"><strong>Erreur !</strong> Un problème technique est survenu.</div>');
}
return false;
}
if (data.error==2) {
$('div#actionMessage').html('<div class="alert alert-warning"><strong>Information !</strong> Valeur saisi incorrecte.</div>');
}
//Resume criteres content
$.post('/index/criteres', { total:data.count, insee:data.insee }, function(data) { $('#panel').html(data); });
}, 'json').error(function(){ alert('Erreur inconnue'); });
$('div#actionMessage').html('<div class="alert alert-warning"><strong>Information !</strong> Valeur saisi incorrecte.</div>');
return false;
}
return true;
}, 'json').error(function(){
$('div#actionMessage').html('<div class="alert alert-danger"><strong>Erreur !</strong> Un problème inconnu est survenu.</div>');
return false;
});
}
function split( val ) {

View File

@ -51,32 +51,41 @@ try {
}
$keys = array(
'dateCrea_ent',
'dateCrea_etab',
'nbActio',
'nbPart',
'age_etab',
'age_entrep',
'nbEtab',
'eff_entrep',
'eff_etab',
'capital',
'dateImmat',
'bilAnnee',
'bilCloture',
'bilEE',
'bilFL',
'bilFK',
'bilFR',
'bilGF',
'bilGP',
'bilGW',
'bilHD',
'bilHH',
'bilHL',
'bilHM',
'bilHN',
'bilYP',
'dateCrea_ent' => array(
'dateCrea_ent>17000101',
'dateCrea_ent<DATE_FORMAT(NOW() + INTERVAL 5 YEAR, "%Y%m%d")',
),
'dateCrea_etab' => array(
'dateCrea_etab>17000101',
'dateCrea_etab<DATE_FORMAT(NOW() + INTERVAL 5 YEAR, "%Y%m%d")',
),
'nbActio' => array(),
'nbPart' => array(),
'age_etab' => array(),
'age_entrep' => array(),
'nbEtab' => array(),
'eff_entrep' => array(),
'eff_etab' => array(),
'capital' => array(),
'dateImmat' => array(
'dateImmat>17000101',
'dateImmat<DATE_FORMAT(NOW() + INTERVAL 5 YEAR, "%Y%m%d")',
),
'bilAnnee' => array(),
'bilCloture' => array(),
'bilEE' => array(),
'bilFL' => array(),
'bilFK' => array(),
'bilFR' => array(),
'bilGF' => array(),
'bilGP' => array(),
'bilGW' => array(),
'bilHD' => array(),
'bilHH' => array(),
'bilHL' => array(),
'bilHM' => array(),
'bilHN' => array(),
'bilYP' => array(),
);
$sql = 'TRUNCATE TABLE ciblage.fields_minmax';
@ -84,20 +93,39 @@ if ( !$db->query($sql) ) {
die ('Impossible de vider la table fields_minmax');
}
foreach($keys as $key) {
foreach($keys as $key => $where) {
if ($opts->manuel) echo $key.PHP_EOL;
//Lecture
$sql = 'SELECT MIN('.$key.') AS min, MAX('.$key.') AS max FROM jo.etablissements_act';
$stmt = $db->query($sql);
$result = $stmt->fetchObject();
if ( count($where)>0 ) {
$sql.= ' WHERE ';
$i = 0;
foreach ( $where as $w ) {
if ( $i>0 ) {
$sql.= ' AND ';
}
$sql.= $w;
$i++;
}
}
if ($opts->manuel) echo $sql.PHP_EOL;
try {
$stmt = $db->query($sql);
$result = $stmt->fetchObject();
//Insertion
$data = array(
'cle' => $key,
'min' => $result->min,
'max' => $result->max,
);
$db->insert('ciblage.fields_minmax', $data);
if ($opts->manuel) echo $key.' => min:'.$result->min.' max:'.$result->max."\n";
} catch ( Zend_Db_Exception $e ) {
if ($opts->manuel) echo $key." => Erreur\n";
}
//Insertion
$data = array(
'cle' => $key,
'min' => $result->min,
'max' => $result->max,
);
$db->insert('ciblage.fields_minmax', $data);
if ($opts->manuel) echo $key.' -> min:'.$result->min.' max:'.$result->max."\n";
}
if ($opts->manuel) print("Terminé\n");
if ($opts->manuel) echo "Fin\n";