Création de la structure de donnée des fields + mise a jours de la structure des préférences avec l'interfacage des deux dans un helper, les prefs sont chargés au predispatche de Zend pour chaque page.

This commit is contained in:
Damien LASSERRE 2012-01-04 11:29:07 +00:00
parent 391f48672e
commit a22421825d
13 changed files with 708 additions and 273 deletions

View File

@ -62,5 +62,4 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
}
Zend_Registry::set('db', $db);
}
}

View File

@ -10,6 +10,7 @@ resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
autoloaderNamespaces[] = "Application_"
resources.frontController.plugins.Auth = "Application_Controller_Plugin_Auth"
resources.frontController.plugins.Auth = "Application_Controller_Plugin_Prefs"
resources.frontController.plugins.Comptage = "Application_Controller_Plugin_Comptage"
resources.layout.layout = "main"
resources.layout.layoutPath = APPLICATION_PATH "/views/default"

View File

@ -1,12 +1,6 @@
<?php
class CriteresController extends Zend_Controller_Action
{
protected $entreprise = array('siege', 'sirenGrp', 'tel', 'fax', 'web', 'mail', 'presentRcs', 'adrDom', 'dirNom', 'lieuAct', 'nbMPubli', 'dateCrea_ent', 'dateCrea_etab', 'nbActio', 'nbPart');
protected $economique = array('ape_etab', 'ape_entrep', 'NaceEtab', 'NaceEntrep', 'age_etab', 'age_entrep', 'teff_entrep', 'teff_etab', 'nbEtab', 'eff_entrep', 'eff_etab', 'capital');
protected $geographique = array('adr_cp', 'adr_dep', 'adr_com');
protected $juridique = array('cj', 'actifEco', 'procolHisto', 'tvaIntraValide', 'dateImmat');
protected $financier = array('bilType', 'avisCs', 'bilDuree', 'bilTca', 'bilAnnee', 'bilCloture', 'bilEE', 'bilFL', 'bilFK', 'bilFR', 'bilGF', 'bilGP', 'bilGU', 'bilGW', 'bilHD', 'bilHH', 'bilHL', 'bilHM', 'bilHN', 'bilYP');
protected function createSelectProvisoir($nb)
{
$array = array();
@ -20,105 +14,32 @@ class CriteresController extends Zend_Controller_Action
public function entrepriseAction()
{
$champs = array(array('name' => 'siege', 'libelle' => 'Siège', 'type' => 'select', 'parametres' => array('Etablissement' => '0', 'Siege' => '1')),
array('name' => 'sirenGrp', 'libelle' => 'Siren de groupe', 'type' => 'select', 'parametres' => array('Oui' => '1', 'Non' => '0')),
array('name' => 'tel', 'libelle' => 'Téléphone', 'type' => 'select', 'parametres' => array('Oui' => 1, 'Non' => '0')),
array('name' => 'fax', 'libelle' => 'Télécopie', 'type' => 'select', 'parametres' => array('Oui' => 1, 'Non' => '0')),
array('name' => 'web', 'libelle' => 'Site Internet', 'type' => 'select', 'parametres' => array('Oui' => '1', 'Non' => '0')),
array('name' => 'mail', 'libelle' => 'Email', 'type' => 'select', 'parametres' => array('Oui' => '1', 'Non' => '0')),
array('name' => 'presentRcs', 'libelle' => 'Etablissement présent au RNCS', 'type' => 'select', 'parametres' => array('Oui' => '1', 'Non' => '0')),
array('name' => 'adrDom', 'libelle' => 'Adresse de domiciliation', 'type' => 'select', 'parametres' => array('Oui' => '1', 'Non' => '0')),
array('name' => 'dirNom', 'libelle' => 'Nom du principal dirigeant', 'type' => 'select', 'parametres' => array('Oui' => '1', 'Non' => '0')),
array('name' => 'lieuAct', 'libelle' => 'Lieu d\'activté', 'type' => 'select', 'parametres' => array('0' => '0', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '91' => '91', '92' => '92', '93' => '93', '99' => '99')),
array('name' => 'nbMPubli', 'libelle' => 'Nombre de marchés publiques remportés', 'type' => 'interval:regle'),
array('name' => 'dateCrea_ent', 'libelle' => 'Date de création de l\'entreprose', 'type' => 'interval:date'),
array('name' => 'dateCrea_etab', 'libelle' => 'Date de création de l\'etablissement', 'type' => 'interval:date'),
array('name' => 'nbActio', 'libelle' => 'Nombre d\'actionnaires connus', 'type' => 'interval:regle'),
array('name' => 'nbPart', 'libelle' => 'Nombre de participations connues', 'type' => 'interval:regle')
);
$select['entreprise'] = $this->entreprise;
$this->view->selectRow = $select;
/*$champs = Zend_Registry::get('entreprise');*/
$this->view->champs = $champs;
}
public function economiqueAction()
{
$champs = array(array('name' => 'ape_etab', 'libelle' => 'Code NAF Etablissement', 'type' => 'text'),
array('name' => 'ou'),
array('name' => 'ape_etab', 'libelle' => 'Liste Code NAF Etablissement', 'type' => 'textarea'),
array('name' => 'ape_entrep', 'libelle' => 'Code NAF Entreprise', 'type' => 'text'),
array('name' => 'ou'),
array('name' => 'ape_entrep', 'libelle' => 'Liste Code NAF Entreprise', 'type' => 'textarea'),
array('name' => 'NaceEtab', 'libelle' => 'Code NACE de l\'établissement', 'type' => 'text'),
array('name' => 'ou'),
array('name' => 'NaceEtab', 'libelle' => 'Liste Code NACE de l\'établissement', 'type' => 'textarea'),
array('name' => 'NaceEntrep', 'libelle' => 'Code NACE de l\'entreprise', 'type' => 'text'),
array('name' => 'ou'),
array('name' => 'NaceEntrep', 'libelle' => 'Liste Code NACE de l\'entreprise', 'type' => 'textarea'),
array('name' => 'age_etab', 'libelle' => 'Code AGE Etablissement', 'type' => 'text'),
array('name' => 'age_entrep', 'libelle' => 'Code AGE Entreprise', 'type' => 'text'),
array('name' => 'teff_entrep', 'libelle' => 'Tranche d\'effectif de l\'entreprise', 'type' => 'interval:regle'),
array('name' => 'teff_etab', 'libelle' => 'Tranche d\'effectif de l\'etablissement', 'type' => 'interval:regle'),
array('name' => 'nbEtab', 'libelle' => 'Nombre d\'établissements', 'type' => 'interval'),
array('name' => 'eff_entrep', 'libelle' => 'Effectif réel de l\'entreprise', 'type' => 'interval'),
array('name' => 'eff_etab', 'libelle' => 'Effectif réel de l\'établissement', 'type' => 'interval'),
array('name' => 'capital', 'libelle' => 'Capital de l\'entreprise', 'type' => 'interval:regle'),
);
/*$champs = Zend_Registry::get('economique');*/
$this->view->champs = $champs;
}
public function geographiqueAction()
{
//$this->_helper->layout()->disableLayout();
$this->view->inlineScript()->appendFile('/themes/default/scripts/jquery.jstree.js');
$champs = array(array('name' => 'adr_cp', 'libelle' => 'Code postal', 'type' => 'text'),
array('name' => 'ou'),
array('name' => 'adr_cp', 'libelle' => 'Liste Code postal', 'type' => 'textarea'),
array('name' => 'adr_dep', 'libelle' => 'Département', 'type' => 'text'),
array('name' => 'ou'),
array('name' => 'adr_dep', 'libelle' => 'Liste Département', 'type' => 'textarea'),
array('name' => 'adr_com', 'libelle' => 'Code commune Insee', 'type' => 'text'),
array('name' => 'ou'),
array('name' => 'adr_com', 'libelle' => 'Liste Code commune Insee', 'type' => 'textarea'),
);
/*$champs = Zend_Registry::get('geographique');*/
$this->view->champs = $champs;
}
public function juridiqueAction()
{
$champs = array(array('name' => 'cj', 'libelle' => 'Forme Juridique', 'type' => 'select', 'parametres' => array('1' => '1', '2' => '2', '3' => '3')),
array('name' => 'actifEco', 'libelle' => 'Établissement économiquement actif', 'type' => 'select', 'parametres' => array('Oui' => '1', 'Non' => '0')),
array('name' => 'procolHisto', 'libelle' => 'Présence d\'une procédure collective dans l\'histo.', 'type' => 'select', 'parametres' => array('Oui' => '1', 'Non' => '0')),
array('name' => 'tvaIntraValide', 'libelle' => 'Numéro de TVA Valide', 'type' => 'select', 'parametres' => array('Oui' => '1', 'Non' => '0')),
array('name' => 'dateImmat', 'libelle' => 'Date d\'immatriculation de l\'entreprise', 'type' => 'interval:date')
);
/*$champs = Zend_Registry::get('juridique');*/
$this->view->champs = $champs;
}
public function financiereAction()
{
$champs = array(array('name' => 'bilType', 'libelle' => 'Type du dernier bilan', 'type' => 'select', 'parametres' => array('Inconnue' => 'I', 'Estimé' => 'E', 'Réel' => 'R')),
array('name' => 'avisCs', 'libelle' => 'Informations de paiements', 'type' => 'select', 'parametres' => $this->createSelectProvisoir(50)),
array('name' => 'bilDuree', 'libelle' => 'Durée du dernier bilan en mois', 'type' => 'select', 'parametres' => $this->createSelectProvisoir(9)),
array('name' => 'bilTca', 'libelle' => 'Tranche de CA issue du bilan', 'type' => 'select', 'parametres' => $this->createSelectProvisoir(23)),
array('name' => 'bilAnnee', 'libelle' => 'Dernière année de bilan', 'type' => 'interval'),
array('name' => 'bilCloture', 'libelle' => 'Dernière date de clôture du bilan', 'type' => 'interval'),
array('name' => 'bilEE', 'libelle' => 'Total bilan', 'type' => 'interval'),
array('name' => 'bilFL', 'libelle' => 'CA total', 'type' => 'interval'),
array('name' => 'bilFK', 'libelle' => 'Chiffre d\'affaires Export', 'type' => 'interval'),
array('name' => 'bilFR', 'libelle' => 'Produits d\'Exploitation', 'type' => 'interval'),
array('name' => 'bilGF', 'libelle' => 'Charges d\'Exploitation', 'type' => 'interval'),
array('name' => 'bilGP', 'libelle' => 'Produits Financiers', 'type' => 'interval'),
array('name' => 'bilGU', 'libelle' => 'Charges Financières', 'type' => 'interval'),
array('name' => 'bilGW', 'libelle' => 'RCAI (résultat courant avant impôt)', 'type' => 'interval'),
array('name' => 'bilHD', 'libelle' => 'Produits Exceptionnels', 'type' => 'interval'),
array('name' => 'bilHH', 'libelle' => 'Charges Exceptionnels', 'type' => 'interval'),
array('name' => 'bilHL', 'libelle' => 'Total des Produits', 'type' => 'interval'),
array('name' => 'bilHM', 'libelle' => 'Total des Charges', 'type' => 'interval'),
array('name' => 'bilHN', 'libelle' => 'Résultat', 'type' => 'interval'),
array('name' => 'bilYP', 'libelle' => 'Effectif de l\'entreprise au dernier bilan (poste YP)', 'type' => 'interval')
);
/*$champs = Zend_Registry::get('financier');*/
$this->view->champs = $champs;
}

View File

@ -0,0 +1,98 @@
<?php
class CriteresController extends Zend_Controller_Action
{
protected $prefs;
public function addAction($registre, $name)
{
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$this->db = Zend_Registry::get('db');
$this->prefs = Zend_Registry::get($registre);
$this->prefs->$name = true;
$this->update();
}
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
}
public function removeAction($registre, $name)
{
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$this->db = Zend_Registry::get('db');
$this->prefs = Zend_Registry::get($registre);
$this->prefs->$name = false;
$this->update();
}
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
}
public function checkAction($registre, $name)
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$this->prefs = Zend_Registry::get($registre);
if($this->prefs->$name)
return (true);
}
return (false);
}
public function save()
{
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
$registre = array('login' => $user->username,
'entreprise' => Zend_Registry::get('entreprise'),
'economique' => Zend_Registry::get('economique'),
'geographique' => Zend_Registry::get('geographique'),
'juridique' => Zend_Registry::get('juridique'),
'financier' => Zend_Registry::get('juridique')
);
$this->db = Zend_Registry::get('db');
$db->insert('prefs',$registre);
}
}
public function update($registre)
{
$auth = Zend_Auth::getInstance();
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
$this->db = Zend_Registry::get('db');
$db->update('prefs', array($registre => json_encode(Zend_Registry::get($registre))), 'login = "'.$user->username.'"');
}
}
public function getFormulaire($registre, $prefs) {
$formulaire = array();
foreach($prefs as $pref) {
foreach($this->champs[$registre] as $champ) {
if($champ['name'] == $pref and $pref) {
$formulaire[] = $champ;
}
}
}
return ($formulaire);
}
}

View File

@ -83,11 +83,9 @@ class UserController extends Zend_Controller_Action
'action' => 'login',
));
}
$this->view->assign('url', $url);
$this->view->headMeta()->appendHttpEquiv('refresh', '5; url='.$url);
$this->render('logout');
}
}

View File

@ -1,42 +1,102 @@
<?php
require_once 'Scores/SessionCiblage.php';
/**
- Définition paramètres d'un champ
array( key => array(
'label' =>
'fields' => array(
0 => array(
type => {select, text, slider, autocomplete},
value =>
)
... multiple champs possible, 0 est le primaire ...
)
))
- Défintion de la structure HTML
<div class="fieldgrp">
<label>Votre E-mail</label>
<div class="field">
<input class="_" type="_" name="_" value=""/>
<span>Texte, bouton de validation, lien pour afficher, switcher vers un autre formulaire</span>
</div>
</div>
*/
Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
{
/**
* Affiche la structure d'un champ en fonction de sa définition
* @param string $name
*/
public function field($name)
public function Field($name)
{
$prefs = Zend_Registry::get('prefs');
if($prefs[$name]['activated'])
{
require_once 'Scores/SessionCiblage.php';
require_once 'Scores/Field.php';
$session = new SessionCiblage();
$field = new Fields();
$field = $field->get($name);
foreach($field['fields'] as $item) {
if($item['type'] == $prefs[$name]['type'])
{
switch($item['type'])
{
case 'select':
return ($this->selectHTML($name, $field, $item));
case 'interval':
return ($this->intervalHTML($name, $field, $item));
case 'date':
return ($this->dateHTML($name, $field, $item));
case 'text':
return ($this->textHTML($name, $field, $item));
case 'textarea':
return ($this->textareaHTML($name, $field, $item));
case 'radio':
return ($this->radioHTML($name, $field, $item));
}
}
}
}
return (false);
}
private function selectHTML($name, $field, $item)
{
$return .= '<div class="'.$name.'padding:5px;">';
$return .= '<div style="float:left;text-align:left;"><label>'.$field['label'].'</label></div>';
$return .= '<div style="text-align:right;"><select class="criteres" name="'.$name.'">';
$return .= '<option value="tous">Tous</option>';
foreach($item['value'] as $option) {
$return .= '<option value="'.$option.'">'.$option.'</option>';
}
$return .= '</select></div></div>';
return ($return);
}
private function intervalHTML($name, $field, $item)
{
$return = '<div style="margin-top:5px;padding:5px;">';
$return .= '<div style="margin-top:3px;float:left;text-align:left;"><label for="amount">'.$field['label'].'</label></div>';
$return .= '<div style="text-align:right;height:17px;">';
$return .= '<input name="'.$name.'" class="range slider_Text" type="text" id="'.$name.'" min="'.$item['value'][0].'" max="'.$item['value'][1].'" style="margin-left:10px;margin-top:3px;float:left;border:0; color:black; font-weight:bold;" />';
$return .= '<div input="'.$name.'" class="slider-range"></div></div></div>';
return ($return);
}
private function dateHTML($name, $field, $item)
{
$return = '<div class="'.$name.'" style="margin-top:5px;padding:5px;'.';">';
$return .= '<div style="margin-top:3px;float:left;text-align:left;"><label for="amount">'.$field['label'] .': </label></div>';
$return .= '<div style="text-align:right;height:17px;"><input type="text" class="from" name="'.$name.'1" /> a ';
$return .= '<input type="text" class="to" name="'.$name.'2" /></div>';
$return .= '</div>';
return ($return);
}
private function textHTML($name, $field, $item)
{
$return .= '<div><div style="float:left;text-align:left;"><label>'.$field['label'].'</label></div>';
$return .= '<div style="text-align:right;padding-bottom:5px;margin-right:5px;">';
$return .= '<input style="border:1px inset silver;width:60%" class="criteres" type="text" name="'.$name.'" value="" /></div>';
$return .= '<div style="margin-top:5px;margin-bottom:5px"></div></div>';
return ($return);
}
private function textareaHTML($name, $field, $item)
{
$return .= '<div><div style="float:left;text-align:left;"><label>'.$field['label'].'</label></div>';
$return .= '<div style="text-align:right;"><textarea style="border:1px inset silver;width:60%;height:40px;" name="'.$name.'"></textarea>';
$return .= '<br /><a class="interval" id="'.$name.'" href=""><img width="10%" src="/themes/default/images/valider.png" /></a></div>';
$return .= '<div style="margin-top:5px;margin-bottom:5px"><hr /></div>';
$return .= '</div>';
return ($return);
}
private function radioHTML($name, $field, $item)
{
// en cours.
}
}

View File

@ -1,32 +0,0 @@
<?php
require_once 'commons/dates.php';
require_once 'Scores/SessionCiblage.php';
Class Zend_View_Helper_Interval extends Zend_View_Helper_Abstract
{
protected function getMinMax($name)
{
$session = new SessionCiblage();
$values = $session->getCritere($name);
if (is_array($values)){
return $values;
}
return array(0,0);
}
public function Interval($name, $libelle, $date = false)
{
$minMax = $this->getMinMax($name);
$champ = '<div style="margin-top:5px;padding:5px;'/*.((empty($session->ciblage[$name]))?'display:none':null)*/.';">';
$champ .= '<div style="margin-top:3px;float:left;text-align:left;">
<label for="amount">'.$libelle .': </label>
</div>';
$champ .= '<div style="text-align:right;height:17px;">
<input name="'.$name.'" class="range slider_Text" type="text" id="'.$name.'" min="'.$minMax[0].'" max="'.$minMax[1].'" style="margin-left:10px;margin-top:3px;float:left;border:0; color:black; font-weight:bold;" />
<div input="'.$name.'" class="slider-range"></div>
</div>';
$champ .= '</div>';
return ($champ);
}
}

View File

@ -1,32 +0,0 @@
<?php
Class Zend_View_Helper_Select extends Zend_View_Helper_Abstract
{
public function Select($name, $libelle, $liste, $color = false)
{
require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage();
$value = $session->getCritere($name);
$champ .= '<div class="'.$name.' '.((!is_string($value) or $value == 'tous')?null:'background-color:#CCF8D2;').'padding:5px;">';
$champ .= '<div style="float:left;text-align:left;">
<label>'.$libelle.'</label>
</div>';
$champ .= '<div style="text-align:right;">
<select class="criteres" name="'.$name.'">';
$select = '';
if ($value == 'tous') { $select = ' selected'; }
$champ .= '<option value="tous">Tous</option>';
foreach($liste as $item => $v) {
if ($v == $value){ $select = ' selected'; }
$champ .= '<option value="'.$v.'"'.$select.'>'.$item.'</option>';
}
$champ .= '</select>
</div>';
$champ .= '</div>';
return ($champ);
}
}

View File

@ -1,33 +0,0 @@
<?php
Class Zend_View_Helper_Text extends Zend_View_Helper_Abstract
{
public function printHistorique($val)
{
if(is_array($val)) {
return (implode(',', $val));
}
return ($val);
}
public function Text($name, $libelle)
{
require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage();
$value = $session->getCritere($name);
$val = !empty($value) ? $this->printHistorique($value) : null;
$champ = '<div>';
$champ .= '<div style="float:left;text-align:left;">
<label>'.$libelle.'</label>
</div>';
$champ .= '<div style="text-align:right;padding-bottom:5px;margin-right:5px;">
<input style="border:1px inset silver;width:60%" class="criteres" type="text" name="'.$name.'" value="'.$val.'" />
</div>';
$champ .= '<div style="margin-top:5px;margin-bottom:5px">
</div>';
$champ .= '</div>';
return ($champ);
}
}

View File

@ -1,34 +0,0 @@
<?php
Class Zend_View_Helper_Textarea extends Zend_View_Helper_Abstract
{
public function printHistorique($val)
{
if(is_array($val)) {
return (implode(',', $val));
}
return ($val);
}
public function Textarea($name, $libelle)
{
require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage();
$value = $session->getCritere($name);
$val = !empty($value) ? $this->printHistorique($value) : 'Code séparé par des virgules...';
$champ = '<div>';
$champ .= '<div style="float:left;text-align:left;">
<label>'.$libelle.'</label>
</div>';
$champ .= '<div style="text-align:right;">
<textarea style="border:1px inset silver;width:60%;height:40px;" name="'.$name.'">'.$val.'</textarea>
<br /><a class="interval" id="'.$name.'" href=""><img width="10%" src="/themes/default/images/valider.png" /></a>
</div>';
$champ .= '<div style="margin-top:5px;margin-bottom:5px">
<hr />
</div>';
$champ .= '</div>';
return ($champ);
}
}

View File

@ -11,29 +11,21 @@
</style>
<div>
<ul id="fieldsblock">
<?php
$i=0;
foreach($this->champs as $champ) {
$valeur = explode(':', $champ['type']);
switch ($valeur[0]) {
case 'select':
echo '<li>'.$this->Select($champ['name'], $champ['libelle'], $champ['parametres']).'</li>';
$i++;
break;
case 'interval':
echo '<li>'.$this->Interval($champ['name'], $champ['libelle'], (isset($valeur[1])?$valeur[1]:false)).'</li>';
break;/*
case 'text':
echo $this->Text($champ['name'], $champ['libelle']);
break;
case 'textarea':
echo $this->Textarea($champ['name'], $champ['libelle']);
break;
default:
echo $champ['name'].'<br />';*/
}
}
?>
<?php echo '<li>'.$this->Field('siege').'</li>';?>
<?php echo '<li>'.$this->Field('sirenGrp').'</li>';?>
<?php echo '<li>'.$this->Field('tel').'</li>';?>
<?php echo '<li>'.$this->Field('fax').'</li>';?>
<?php echo '<li>'.$this->Field('web').'</li>';?>
<?php echo '<li>'.$this->Field('mail').'</li>';?>
<?php echo '<li>'.$this->Field('presentRcs').'</li>';?>
<?php echo '<li>'.$this->Field('adrDom').'</li>';?>
<?php echo '<li>'.$this->Field('dirNom').'</li>';?>
<?php echo '<li>'.$this->Field('lieuAct').'</li>';?>
<?php echo '<li>'.$this->Field('nbMPubli').'</li>';?>
<?php echo '<li>'.$this->Field('dateCrea_ent').'</li>';?>
<?php echo '<li>'.$this->Field('dateCrea_etab').'</li>';?>
<?php echo '<li>'.$this->Field('nbActio').'</li>';?>
<?php echo '<li>'.$this->Field('nbPart').'</li>';?>
</ul>
</div>

View File

@ -0,0 +1,87 @@
<?php
class Application_Controller_Plugin_Prefs extends Zend_Controller_Plugin_Abstract
{
protected $preferences = array(
'siege' => array('activated' => true, 'type' => 'select'),
'sirenGrp' => array('activated' => true, 'type' => 'select'),
'tel' => array('activated' => true, 'type' => 'select'),
'fax' => array('activated' => true, 'type' => 'select'),
'web' => array('activated' => true, 'type' => 'select'),
'mail' => array('activated' => true, 'type' => 'select'),
'presentRcs' => array('activated' => true, 'type' => 'select'),
'adrDom' => array('activated' => true, 'type' => 'select'),
'dirNom' => array('activated' => true, 'type' => 'select'),
'lieuAct' => array('activated' => true, 'type' => 'select'),
'nbMPubli' => array('activated' => true, 'type' => 'interval'),
'dateCrea_ent' => array('activated' => true, 'type' => 'date'),
'dateCrea_etab' => array('activated' => true, 'type' => 'date'),
'nbActio' => array('activated' => true, 'type' => 'interval'),
'nbPart' => array('activated' => true, 'type' => 'interval'),
'ape_etab' => array('activated' => true, 'type' => 'text'),
'ape_etab' => array('activated' => true, 'type' => 'text'),
'ape_entrep' => array('activated' => true, 'type' => 'text'),
'ape_entrep' => array('activated' => true, 'type' => 'text'),
'NaceEtab' => array('activated' => true, 'type' => 'text'),
'NaceEntrep' => array('activated' => true, 'type' => 'text'),
'age_etab' => array('activated' => true, 'type' => 'text'),
'age_entrep' => array('activated' => true, 'type' => 'text'),
'teff_entrep' => array('activated' => true, 'type' => 'interval'),
'teff_etab' => array('activated' => true, 'type' => 'interval'),
'nbEtab' => array('activated' => true, 'type' => 'interval'),
'eff_entrep' => array('activated' => true, 'type' => 'interval'),
'eff_etab' => array('activated' => true, 'type' => 'interval'),
'capital' => array('activated' => true, 'type' => 'interval'),
'adr_cp' => array('activated' => true, 'type' => 'text'),
'adr_dep' => array('activated' => true, 'type' => 'text'),
'adr_com' => array('activated' => true, 'type' => 'text'),
'cj' => array('activated' => true, 'type' => 'select'),
'actifEco' => array('activated' => true, 'type' => 'select'),
'procolHisto' => array('activated' => true, 'type' => 'select'),
'tvaIntraValide'=> array('activated' => true, 'type' => 'select'),
'dateImmat' => array('activated' => true, 'type' => 'date'),
'bilType' => array('activated' => true, 'type' => 'select'),
'avisCs' => array('activated' => true, 'type' => 'select'),
'bilDuree' => array('activated' => true, 'type' => 'date'),
'bilTca' => array('activated' => true, 'type' => 'interval'),
'bilAnnee' => array('activated' => true, 'type' => 'interval'),
'bilCloture' => array('activated' => true, 'type' => 'interval'),
'bilEE' => array('activated' => true, 'type' => 'interval'),
'bilFL' => array('activated' => true, 'type' => 'interval'),
'bilFK' => array('activated' => true, 'type' => 'interval'),
'bilFR' => array('activated' => true, 'type' => 'interval'),
'bilGF' => array('activated' => true, 'type' => 'interval'),
'bilGP' => array('activated' => true, 'type' => 'interval'),
'bilGU' => array('activated' => true, 'type' => 'interval'),
'bilGW' => array('activated' => true, 'type' => 'interval'),
'bilHD' => array('activated' => true, 'type' => 'interval'),
'bilHH' => array('activated' => true, 'type' => 'interval'),
'bilHL' => array('activated' => true, 'type' => 'interval'),
'bilHM' => array('activated' => true, 'type' => 'interval'),
'bilHN' => array('activated' => true, 'type' => 'interval'),
'bilYP' => array('activated' => true, 'type' => 'interval'),
);
//Pre dispatch pour recuperer les préférence de l'utilisateur avant chaque page.
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$auth = Zend_Auth::getInstance();
$this->db = Zend_Registry::get('db');
if($auth->hasIdentity())
{
$user = $auth->getIdentity();
$this->login = $user->username;
$database = Zend_Registry::get('db');
$select = $database->select()
->from('prefs')
->where('login = ?', $user->username);
$result = $this->db->query($select);
$json = $result->fetchAll();
if(!empty($json))
$prefs = json_decode($json[0]['prefs']);
else
$prefs = $this->preferences;
Zend_Registry::set('prefs', $prefs);
}
}
}

410
library/Scores/Field.php Normal file
View File

@ -0,0 +1,410 @@
<?php
Class Fields
{
protected $fields = array
(
'siege' => array(
'label' => 'Siege',
'fields' => array(
array('type' => 'select', 'value' => array('Oui', 'Non'))
),
'famille' => 'entreprise'
),
'sirenGrp' => array(
'label' => 'Siren de groupe',
'fields' => array(
array('type' => 'select', 'value' => array('Oui', 'Non'))
),
'famille' => 'entreprise'
),
'tel' => array(
'label' => 'Telephone',
'fields' => array(
array('type' => 'select', 'value' => array('Oui', 'Non'))
),
'famille' => 'entreprise'
),
'fax' => array(
'label' => 'Telecopie',
'fields' => array(
array('type' => 'select', 'value' => array('Oui', 'Non'))
),
'famille' => 'entreprise'
),
'web' => array(
'label' => 'Site Internet',
'fields' => array(
array('type' => 'select', 'value' => array('Oui', 'Non'))
),
'famille' => 'entreprise'
),
'mail' => array(
'label' => 'Email',
'fields' => array(
array('type' => 'select', 'value' => array('Oui', 'Non'))
),
'famille' => 'entreprise'
),
'presentRcs' => array(
'label' => 'Etablissement présent au RNCS',
'fields' => array(
array('type' => 'select', 'value' => array('Oui', 'Non'))
),
'famille' => 'entreprise'
),
'adrDom' => array(
'label' => 'Adresse de domiciliation',
'fields' => array(
array('type' => 'select', 'value' => array('Oui', 'Non'))
),
'famille' => 'entreprise'
),
'dirNom' => array(
'label' => 'Nom du principal dirigeant',
'fields' => array(
array('type' => 'select', 'value' => array('Oui', 'Non'))
),
'famille' => 'entreprise'
),
'lieuAct' => array(
'label' => 'Lieu d\'activté',
'fields' => array(
array('type' => 'interval', 'value' => array('0', '1000'))
),
'famille' => 'entreprise'
),
'nbMPubli' => array(
'label' => 'Nombre de marches publiques remportes',
'fields' => array(
array('type' => 'interval', 'value' => array('0', '1000'))
),
'famille' => 'entreprise'
),
'dateCrea_ent' => array(
'label' => 'Date de création de l\'entreprose',
'fields' => array(
array('type' => 'date')
),
'famille' => 'entreprise'
),
'dateCrea_etab' => array(
'label' => 'Date de création de l\'etablissement',
'fields' => array(
array('type' => 'date')
),
'famille' => 'entreprise'
),
'nbActio' => array(
'label' => 'Nombre d\'actionnaires connus',
'fields' => array(
array('type' => 'interval', 'value' => array('0', '1000'))
),
'famille' => 'entreprise'
),
'nbPart' => array(
'label' => 'Nombre de participations connues',
'fields' => array(
array('type' => 'interval', 'value' => array('0', '1000'))
),
'famille' => 'entreprise'
),
// economique
'ape_etab' => array(
'label' => 'Code NAF Etablissement',
'fields' => array(
array('type' => 'text', 'value' => null),
array('type' => 'textarea', 'value' => null)
),
'famille' => 'economique'
),
'ape_entrep' => array(
'label' => 'Code NAF Entreprise',
'fields' => array(
array('type' => 'text', 'value' => null),
array('type' => 'textarea', 'value' => null)
),
'famille' => 'economique'
),
'NaceEtab' => array(
'label' => 'Code NACE de l\'établissement',
'fields' => array(
array('type' => 'text', 'value' => null),
array('type' => 'textarea', 'value' => null)
),
'famille' => 'economique'
),
'NaceEntrep' => array(
'label' => 'Code NACE de l\'entreprise',
'fields' => array(
array('type' => 'text', 'value' => null),
array('type' => 'textarea', 'value' => null)
),
'famille' => 'economique'
),
'age_etab' => array(
'label' => 'Code AGE Etablissement',
'fields' => array(
array('type' => 'text', 'value' => null),
array('type' => 'textarea', 'value' => null)
),
'famille' => 'economique'
),
'age_entrep' => array(
'label' => 'Code AGE Entreprise',
'fields' => array(
array('type' => 'text', 'value' => null),
array('type' => 'textarea', 'value' => null)
),
'famille' => 'economique'
),
'teff_entrep' => array(
'label' => 'Tranche d\'effectif de l\'Entreprise',
'fields' => array(
array('type' => 'interval', 'value' => array('0', '1000'))
),
'famille' => 'economique'
),
'teff_etab' => array(
'label' => 'Tranche d\'effectif de l\'etablissement',
'fields' => array(
array('type' => 'interval', 'value' => array('0', '1000'))
),
'famille' => 'economique'
),
'nbEtab' => array(
'label' => 'Tranche d\'effectif de l\'etablissement',
'fields' => array(
array('type' => 'interval', 'value' => array('0', '100000'))
),
'famille' => 'economique'
),
'eff_entrep' => array(
'label' => 'Effectif réel de l\'entreprise',
'fields' => array(
array('type' => 'interval', 'value' => array('0', '1000'))
),
'famille' => 'economique'
),
'eff_etab' => array(
'label' => 'Effectif réel de l\'établissement',
'fields' => array(
array('type' => 'interval', 'value' => array('0', '1000'))
),
'famille' => 'economique'
),
'capital' => array(
'label' => 'Capital de l\'entreprise',
'fields' => array(
array('type' => 'interval', 'value' => array('0', '10000000'))
),
'famille' => 'economique'
),
//geographique
'adr_cp' => array(
'label' => 'Code postal',
'fields' => array(
array('type' => 'text', 'value' => null),
array('type' => 'textarea', 'value' => null)
),
'famille' => 'geographique'
),
'adr_dep' => array(
'label' => 'Département',
'fields' => array(
array('type' => 'text', 'value' => null),
array('type' => 'textarea', 'value' => null)
),
'famille' => 'geographique'
),
'adr_com' => array(
'label' => 'Code commune Insee',
'fields' => array(
array('type' => 'text', 'value' => null),
array('type' => 'textarea', 'value' => null)
),
'famille' => 'geographique'
),
//juridique
'cj' => array(
'label' => 'Forme Juridique',
'fields' => array(
array('type' => 'select', 'value' => array('1' => '1', '2' => '2', '3' => '3')),
),
'famille' => 'geographique'
),
'actifEco' => array(
'label' => 'Établissement économiquement actif',
'fields' => array(
array('type' => 'select', 'value' => array('Oui' => '1', 'Non' => '0')),
),
'famille' => 'geographique'
),
'procolHisto' => array(
'label' => 'Présence d\'une procédure collective dans l\'histo.',
'fields' => array(
array('type' => 'select', 'value' => array('Oui' => '1', 'Non' => '0')),
),
'famille' => 'geographique'
),
'tvaIntraValide' => array(
'label' => 'Numéro de TVA Valide',
'fields' => array(
array('type' => 'select', 'value' => array('Oui' => '1', 'Non' => '0')),
),
'famille' => 'geographique'
),
'dateImmat' => array(
'label' => 'Numéro de TVA Valide',
'fields' => array(
array('type' => 'date', 'value' => null),
),
'famille' => 'geographique'
),
//financier
'bilType' => array(
'label' => 'Type du dernier bilan',
'fields' => array(
array('type' => 'select', 'value' => array('Inconnue' => 'I', 'Estimé' => 'E', 'Réel' => 'R')),
),
'famille' => 'financier'
),
'avisCs' => array(
'label' => 'Informations de paiements',
'fields' => array(
array('type' => 'select', 'value' => array('Oui' => '1', 'Non' => '0')),
),
'famille' => 'financier'
),
'bilDuree' => array(
'label' => 'Durée du dernier bilan en mois',
'fields' => array(
array('type' => 'select', 'value' => array('Oui' => '1', 'Non' => '0')),
),
'famille' => 'financier'
),
'bilTca' => array(
'label' => 'Tranche de CA issue du bilan',
'fields' => array(
array('type' => 'select', 'value' => array('Oui' => '1', 'Non' => '0')),
),
'famille' => 'financier'
),
'bilAnnee' => array(
'label' => 'Dernière année de bilan',
'fields' => array(
array('type' => 'date', 'value' => null),
),
'famille' => 'financier'
),
'bilCloture' => array(
'label' => 'Dernière date de clôture du bilan',
'fields' => array(
array('type' => 'date', 'value' => null),
),
'famille' => 'financier'
),
'bilEE' => array(
'label' => 'Total bilan',
'fields' => array(
array('type' => 'interval', 'value' => array('0', '10000000'))
),
'famille' => 'financier'
),
'bilFL' => array(
'label' => 'CA total',
'fields' => array(
array('type' => 'interval', 'value' => array('0', '10000000'))
),
'famille' => 'financier'
),
'bilFK' => array(
'label' => 'Chiffre d\'affaires Export',
'fields' => array(
array('type' => 'interval', 'value' => array('0', '10000000'))
),
'famille' => 'financier'
),
'bilFR' => array(
'label' => 'Produits d\'Exploitation',
'fields' => array(
array('type' => 'interval', 'value' => array('0', '10000000'))
),
'famille' => 'financier'
),
'bilGF' => array(
'label' => 'Charges d\'Exploitation',
'fields' => array(
array('type' => 'interval', 'value' => array('0', '10000000'))
),
'famille' => 'financier'
),
'bilGP' => array(
'label' => 'Produits Financiers',
'fields' => array(
array('type' => 'interval', 'value' => array('0', '10000000'))
),
'famille' => 'financier'
),
'bilGP' => array(
'label' => 'Charges Financières',
'fields' => array(
array('type' => 'interval', 'value' => array('0', '10000000'))
),
'famille' => 'financier'
),
'bilGW' => array(
'label' => 'RCAI (résultat courant avant impôt)',
'fields' => array(
array('type' => 'interval', 'value' => array('0', '10000000'))
),
'famille' => 'financier'
),
'bilHD' => array(
'label' => 'Produits Exceptionnels',
'fields' => array(
array('type' => 'interval', 'value' => array('0', '10000000'))
),
'famille' => 'financier'
),
'bilHH' => array(
'label' => 'Charges Exceptionnels',
'fields' => array(
array('type' => 'interval', 'value' => array('0', '10000000'))
),
'famille' => 'financier'
),
'bilHL' => array(
'label' => 'Total des Produits',
'fields' => array(
array('type' => 'interval', 'value' => array('0', '10000000'))
),
'famille' => 'financier'
),
'bilHM' => array(
'label' => 'Total des Charges',
'fields' => array(
array('type' => 'interval', 'value' => array('0', '10000000'))
),
'famille' => 'financier'
),
'bilHN' => array(
'label' => 'Résultat',
'fields' => array(
array('type' => 'interval', 'value' => array('0', '10000000'))
),
'famille' => 'financier'
),
'bilYP' => array(
'label' => 'Effectif de l\'entreprise au dernier bilan (poste YP)',
'fields' => array(
array('type' => 'interval', 'value' => array('0', '10000000'))
),
'famille' => 'financier'
)
);
public function get($name)
{
return ($this->fields[$name]);
}
}