Compare commits
282 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
59aa264c85 | ||
|
f2ed37059f | ||
|
cce06787de | ||
|
d6c77dc742 | ||
|
4765dc5d8b | ||
|
731947589c | ||
|
1c4eda048c | ||
|
4505717013 | ||
|
e14b13234a | ||
|
46b0acd401 | ||
|
82b4019f8b | ||
|
569150e763 | ||
|
46c7f5a8ee | ||
|
6989f98b89 | ||
|
ec45090d9d | ||
|
d1366241bc | ||
|
11205a310b | ||
|
80522ddb4d | ||
|
3bfc072fb2 | ||
|
b3d5967058 | ||
|
9fc3a33522 | ||
|
6e0a6de368 | ||
|
2ac050c61f | ||
|
35103184a1 | ||
|
1de0e48e07 | ||
|
00a88d96fc | ||
|
a0f6203538 | ||
|
a8e6bbdd4c | ||
|
a6ed77b121 | ||
|
0ca5924bce | ||
|
9d9670ead4 | ||
|
c91a605aff | ||
|
69d0520e62 | ||
|
d7ebbaf04b | ||
|
20b2acf8ab | ||
|
8ccae142da | ||
|
e60e38af74 | ||
|
c8e30a3df8 | ||
|
a835703206 | ||
|
1a7e1a113b | ||
|
f01ba975c7 | ||
|
cf50bc0374 | ||
|
16127bd775 | ||
|
2a45c760b2 | ||
|
f4204399cf | ||
|
af41c36d47 | ||
|
1593854833 | ||
|
d2bf9eb01c | ||
|
724ced9da1 | ||
|
15a396bb3f | ||
|
d81a4df56f | ||
|
73b0249a5a | ||
|
07b769bfc6 | ||
|
6b4547a0c8 | ||
|
59ace9293e | ||
|
dbf77a9e33 | ||
|
4f09096385 | ||
|
2df7ad11d1 | ||
|
14c68377fe | ||
|
324864b4e8 | ||
|
8c26cfe43b | ||
|
fe60ac7d33 | ||
|
7eb075299b | ||
|
6f28a0f459 | ||
|
0115d5f674 | ||
|
52c25ccf80 | ||
|
f1db8eed91 | ||
|
ed0a2d2f3a | ||
|
8a27029e42 | ||
|
7e53de8c28 | ||
|
c992950c33 | ||
|
1580e634a3 | ||
|
a594376bbd | ||
|
8341e41e99 | ||
|
2e68ca6881 | ||
|
54eab39cb6 | ||
|
8bc908a4da | ||
|
b8a78b3b20 | ||
|
6d4ff6fe65 | ||
|
bd0903538e | ||
|
d7459aee6e | ||
|
686e80814f | ||
|
aabe4c6306 | ||
|
887933a0b4 | ||
|
61b3a4a18a | ||
|
a7e895a366 | ||
|
e66d0f8739 | ||
|
ae2f25924a | ||
|
fb4d165568 | ||
|
e6070fa8f2 | ||
|
6bf029fca1 | ||
|
0353cec146 | ||
|
824a3f7183 | ||
|
9b8b74d776 | ||
|
516b2c2b66 | ||
|
d6e168a305 | ||
|
7b15b7bba7 | ||
|
b0a6f73fd0 | ||
|
510155bdb6 | ||
|
e0c17dd076 | ||
|
0241fc787a | ||
|
0412b58420 | ||
|
ecdd442a46 | ||
|
76995c59cc | ||
|
6176601532 | ||
|
ea7f205545 | ||
|
74f98623f2 | ||
|
47daf380d2 | ||
|
86366eada4 | ||
|
01b0543a8f | ||
|
0d7257d63d | ||
|
0c95160798 | ||
|
e0c2095539 | ||
|
29adac9f62 | ||
|
fdbce4b486 | ||
|
478cd03c3d | ||
|
312eba9fce | ||
|
3cfa449dcc | ||
|
b0c6b77808 | ||
|
0bf2669e18 | ||
|
64102a3b52 | ||
|
b1386c5498 | ||
|
89976798dd | ||
|
b6fd35c20d | ||
|
048274b4da | ||
|
465269d60d | ||
|
e1529c549e | ||
|
24007c2ac2 | ||
|
c57e11ef0a | ||
|
49c749e0c9 | ||
|
191f872acc | ||
|
6c9931bc5c | ||
|
8f9a4ce91d | ||
|
87cdc96f2a | ||
|
e663ed73a5 | ||
|
85899d2711 | ||
|
908ccd0337 | ||
|
a37f917fac | ||
|
2bbd3f66cd | ||
|
c48243d49c | ||
|
5e88c47e88 | ||
|
f3908a3888 | ||
|
44782c7991 | ||
|
a4c26c886e | ||
|
ff65ecee21 | ||
|
985ffe31bb | ||
|
f6544e64de | ||
|
00f1adb3d6 | ||
|
fa43a754c7 | ||
|
ef82747590 | ||
|
6190ffc77d | ||
|
bfd23a4a11 | ||
|
dbf289f202 | ||
|
aaf0f079d0 | ||
|
41dbce8818 | ||
|
7d81944cb8 | ||
|
34c3e028cd | ||
|
b30e19af3d | ||
|
493d232677 | ||
|
a22421825d | ||
|
391f48672e | ||
|
f40de036cc | ||
|
15b6fb860e | ||
|
0515237d30 | ||
|
bfca86274e | ||
|
7e80ace6f8 | ||
|
60c4238f3c | ||
|
0c9c0315aa | ||
|
b73d2a946d | ||
|
5d93818bae | ||
|
91d84eb92d | ||
|
6e4d558e38 | ||
|
03ab0939b2 | ||
|
a3ba4ad0fa | ||
|
1dba6f6ca6 | ||
|
c40222d5fe | ||
|
30e2a2943a | ||
|
c34efc45f8 | ||
|
a9838cd5a5 | ||
|
dc2a686e0e | ||
|
01cf1a8848 | ||
|
848c16640c | ||
|
c988e5eb04 | ||
|
cced951470 | ||
|
6da7e8235c | ||
|
5e87ef6e60 | ||
|
77665320d7 | ||
|
30578cd087 | ||
|
05c9aa875c | ||
|
ab2e0c289a | ||
|
3794151424 | ||
|
d96925e2eb | ||
|
e9f38ccb3d | ||
|
f3a9723ad2 | ||
|
5299e87217 | ||
|
fe83f3a99c | ||
|
f8db91c45a | ||
|
07925a4db6 | ||
|
f045a7e8cb | ||
|
1b03c11921 | ||
|
fe955f5c23 | ||
|
cfe9e69002 | ||
|
47e153e4d5 | ||
|
68f688ee55 | ||
|
d3b06d3485 | ||
|
b265300d7a | ||
|
4bf8336ace | ||
|
fefcff02b3 | ||
|
7184d2ce35 | ||
|
34c6644970 | ||
|
893c79a2ca | ||
|
604daa6afd | ||
|
ac99182df0 | ||
|
0a4bbdb986 | ||
|
3f7f1cb8b2 | ||
|
eb2fafd134 | ||
|
6a34fa7c35 | ||
|
78ae585306 | ||
|
90cda842ec | ||
|
024950d275 | ||
|
a433b02c7e | ||
|
f1b683d07e | ||
|
1773462af9 | ||
|
386149eed1 | ||
|
c34837ca37 | ||
|
f80ef59eba | ||
|
48a54afe3b | ||
|
dfee76ae12 | ||
|
8601d47c49 | ||
|
1196b6e978 | ||
|
a89079f0a6 | ||
|
e5297f917d | ||
|
32a3d78961 | ||
|
fb39bdb20a | ||
|
907955099a | ||
|
953e655f7d | ||
|
7e64f46535 | ||
|
be27e8849f | ||
|
cb08c519e1 | ||
|
2790771a97 | ||
|
88b18df8a5 | ||
|
ba076c96f7 | ||
|
54937ac2ca | ||
|
8ea261e303 | ||
|
7be7901cd0 | ||
|
aa33f2dd7f | ||
|
eb366feca2 | ||
|
3cd22f4e02 | ||
|
493701a774 | ||
|
b4c9e13c13 | ||
|
c68f72fcb2 | ||
|
b735a072e5 | ||
|
cbab6d281e | ||
|
ed43e17b9b | ||
|
243a9f33aa | ||
|
743c34edd9 | ||
|
5c7eee63ba | ||
|
1189b958b2 | ||
|
bdeb3fb91d | ||
|
f8b9a6d019 | ||
|
22bc884407 | ||
|
e31d2aefd5 | ||
|
bf4ad53075 | ||
|
44225fc4b4 | ||
|
56a63c5c9b | ||
|
b4a401bee4 | ||
|
09f4e8444d | ||
|
649fca191d | ||
|
2b880adbf4 | ||
|
9921a576aa | ||
|
d9450446fc | ||
|
85f5c6508e | ||
|
00edae6028 | ||
|
a8c58dd397 | ||
|
95ef798797 | ||
|
d0bacf1c12 | ||
|
b0c69d802e | ||
|
548c9ee9ee | ||
|
0aed29fff3 | ||
|
56444ac654 | ||
|
2c8e271a68 | ||
|
c88fd90168 |
65
application/Bootstrap.php
Normal file
65
application/Bootstrap.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||
{
|
||||
//Initialisation global des paramètres de vue
|
||||
protected function _initViewSettings()
|
||||
{
|
||||
$this->bootstrap('view');
|
||||
$view = $this->getResource('view');
|
||||
/*
|
||||
* Si on détecte un périphérique mobile alors on charge
|
||||
* les bons scripts
|
||||
$theme = 'mobile';
|
||||
$path = realpath(APPLICATION_PATH.'/views/'.$theme);
|
||||
$view = new Zend_View();
|
||||
$view->addBasePath($path);
|
||||
*/
|
||||
$theme = 'default';
|
||||
$pathStyle = '/themes/'.$theme.'/styles';
|
||||
$pathScript = '/themes/'.$theme.'/scripts';
|
||||
$view->setEncoding('UTF-8');
|
||||
$view->doctype('XHTML1_STRICT');
|
||||
$view->headMeta()
|
||||
->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8')
|
||||
->appendHttpEquiv('Content-Language', 'fr-FR');
|
||||
|
||||
$view->headLink()
|
||||
->appendStylesheet($pathStyle.'/reset.css', 'all')
|
||||
->appendStylesheet($pathStyle.'/jquery.qtip.css', 'all')
|
||||
->appendStylesheet('/themes/jstree/default/style.css')
|
||||
->appendStylesheet('/themes/jqueryui/jquery-ui.css', 'all')
|
||||
->appendStylesheet($pathStyle.'/main.css', 'all');
|
||||
|
||||
$view->headScript()
|
||||
->appendFile($pathScript.'/jquery.js', 'text/javascript')
|
||||
->appendFile($pathScript.'/jquery.bgiframe.js', 'text/javascript')
|
||||
->appendFile($pathScript.'/jquery.cookie.js', 'text/javascript')
|
||||
->appendFile($pathScript.'/jquery-ui.js', 'text/javascript')
|
||||
->appendFile($pathScript.'/jquery.qtip.js', 'text/javascript')
|
||||
->appendFile($pathScript.'/scripts.js', 'text/javascript');
|
||||
|
||||
$view->headTitle()->setSeparator(' - ');
|
||||
$view->headTitle('Odea');
|
||||
}
|
||||
|
||||
protected function _initLogging()
|
||||
{
|
||||
//Logger de développement
|
||||
$writer = new Zend_Log_Writer_Firebug();
|
||||
if(APPLICATION_ENV=='production') $writer->setEnabled(false);
|
||||
$logger = new Zend_Log($writer);
|
||||
Zend_Registry::set('firebug', $logger);
|
||||
}
|
||||
|
||||
protected function _initDb()
|
||||
{
|
||||
$dbConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'databases');
|
||||
try {
|
||||
$db = Zend_Db::factory($dbConfig->db);
|
||||
Zend_Db_Table::setDefaultAdapter ($db);
|
||||
} catch ( Exception $e ) {
|
||||
exit ( $e->getMessage() );
|
||||
}
|
||||
Zend_Registry::set('db', $db);
|
||||
}
|
||||
}
|
34
application/README
Normal file
34
application/README
Normal file
@ -0,0 +1,34 @@
|
||||
- Critères
|
||||
Etablissements : Tous / Seulement les actifs / Seulement les inactifs
|
||||
Type Etablissements : Tous / Uniquement les sièges / Uniquement les secondaires
|
||||
Entreprises appartenant à un groupe français
|
||||
Entreprise appartenant à un groupe étranger
|
||||
Téléphone renseigné / non renseigné
|
||||
|
||||
- Secteur Géographique
|
||||
Régions (insee.regions)
|
||||
Départements (insee.departements)
|
||||
Code Postal - Communes (insee.codepostaux)
|
||||
+ Recherche textuel sur ville (code postal, commune) pour affichage liste code postal
|
||||
Codes Communes Insee (insee.codepostaux)
|
||||
|
||||
- Forme juridique (insee.tabFJ)
|
||||
Arbre de selection avec déploiement des groupes
|
||||
|
||||
- Activité (naf) - Entreprise, Etablissements (insee.tabNAF)
|
||||
Arbre de sélection avec déploiement des groupes
|
||||
|
||||
- Chiffre clés
|
||||
Date de création - Ancienneté (Moins d'un an, de 1 à 2, 3 à 5, 6 à 9, 10 et plus )
|
||||
Nombre d'établissements (inférieur, égal, supérieur, intervalle)
|
||||
Intervalle Effectif (Tranches ou Réel) - Entreprise, Etablissement
|
||||
|
||||
- Critères bilantiel
|
||||
Date de clôture de l'exercice
|
||||
Intervalle CA - Selection (Moins de 15000 euros, de 15000 à 30000, de 30000 à 75000, de 75000 à 150000, de 150000 à 750000, Plus de 750000)
|
||||
Intervalle Résultat net
|
||||
Intervalle CA à l'export
|
||||
ACTIF - PASSIF - COMPTE DE RESULTAT - ANNEXES
|
||||
Ratios
|
||||
Scores (Risques de défaillance)
|
||||
|
84
application/TODO
Normal file
84
application/TODO
Normal file
@ -0,0 +1,84 @@
|
||||
Placer les critères en session
|
||||
Enregistrer régulièrement en session (SessionCriteres)
|
||||
On sauvegarde, seulement si le client à mis une référence, et cliquer sur le bouton sauvegarder
|
||||
Exploser les critères pour des sous comptage
|
||||
Enregistrement d'un fichier login-idDefinition-timestamp
|
||||
|
||||
Définir la structure d'envoi des critères
|
||||
Formulaire
|
||||
Voir avec API Ciblage Sphinx
|
||||
|
||||
Voir pour l'enrichissement
|
||||
Pour simplifer, l'enrichissement devra se faire à partir de la table etablissements_act
|
||||
+ quelques autres tables pour des données supplémentaires
|
||||
|
||||
Générer un fichier avec la liste des SIREN+NIC ou SIRET + les entêtes nécessaires à l'enrichissement
|
||||
Voir si le fichier doit être généré sur la plateforme de ciblage, ou par le webservice
|
||||
|
||||
Réplication des tables sur la plateforme ciblage
|
||||
|
||||
Gestion d'une queue, voir todo dans webservice
|
||||
|
||||
Table naf
|
||||
Table régions
|
||||
Table departements
|
||||
Table codepostaux
|
||||
Table formejuridique (tabFJ)
|
||||
|
||||
|
||||
- Table pour la sauvegarde des critères (criteres)
|
||||
id int primary key autoincrement
|
||||
idClient int
|
||||
login varchar
|
||||
reference varchar obligatoire ?
|
||||
criteres text
|
||||
parent int identifiant comptage parent pour les explode default 0
|
||||
dateAjout
|
||||
|
||||
- Table pour la sauvegarde des comptages (comptages)
|
||||
id
|
||||
idDefinition
|
||||
resultat
|
||||
uniteInsee
|
||||
tarif
|
||||
dateComptage
|
||||
|
||||
- Tables pour la sauvegarde des exports de siren (refexport)
|
||||
id
|
||||
idDefinition
|
||||
fichier
|
||||
dateExport
|
||||
|
||||
- profilExtraction
|
||||
id
|
||||
idClient
|
||||
reference
|
||||
criteres
|
||||
tarifLigne
|
||||
dateAjout
|
||||
dateModif
|
||||
dateSuppr
|
||||
actif
|
||||
|
||||
|
||||
- tarifsInsee
|
||||
id
|
||||
tarifLigne
|
||||
montantMax
|
||||
dateEffet
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
30
application/configs/application.ini
Normal file
30
application/configs/application.ini
Normal file
@ -0,0 +1,30 @@
|
||||
[production]
|
||||
phpSettings.date.timezone = "Europe/Paris"
|
||||
phpSettings.display_startup_errors = 0
|
||||
phpSettings.display_errors = 0
|
||||
includePaths.library = APPLICATION_PATH "/../library"
|
||||
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
|
||||
bootstrap.class = "Bootstrap"
|
||||
appnamespace = "Application"
|
||||
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
|
||||
resources.frontController.params.displayExceptions = 0
|
||||
autoloaderNamespaces[] = "Application_"
|
||||
resources.frontController.plugins.Auth = "Application_Controller_Plugin_Auth"
|
||||
resources.frontController.plugins.Comptage = "Application_Controller_Plugin_Comptage"
|
||||
resources.layout.layout = "main"
|
||||
resources.layout.layoutPath = APPLICATION_PATH "/views/default"
|
||||
resources.view.basePath = APPLICATION_PATH "/views/default"
|
||||
|
||||
[staging : production]
|
||||
resources.frontController.params.displayExceptions = 0
|
||||
phpSettings.soap.wsdl_cache_enabled = 0
|
||||
|
||||
[development : production]
|
||||
phpSettings.display_startup_errors = 1
|
||||
phpSettings.display_errors = 1
|
||||
phpSettings.soap.wsdl_cache_enabled = 0
|
||||
resources.frontController.params.displayExceptions = 1
|
||||
|
||||
[testing : production]
|
||||
phpSettings.display_startup_errors = 1
|
||||
phpSettings.display_errors = 1
|
9
application/controllers/AideController.php
Normal file
9
application/controllers/AideController.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
class AideController extends Zend_Controller_Action
|
||||
{
|
||||
|
||||
public function indexAction(){}
|
||||
|
||||
public function aproposdeAction(){}
|
||||
|
||||
}
|
331
application/controllers/ArborescenceController.php
Normal file
331
application/controllers/ArborescenceController.php
Normal file
@ -0,0 +1,331 @@
|
||||
<?php
|
||||
class ArborescenceController extends Zend_Controller_Action
|
||||
{
|
||||
/**
|
||||
* Affiche l'arborescence des NAFs de premier niveau
|
||||
*/
|
||||
public function nafAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
||||
$request = $this->getRequest();
|
||||
$key = $request->getParam('key');
|
||||
$this->view->assign('key', $key);
|
||||
|
||||
//Récupération des valeurs enregistrées en session
|
||||
require_once 'Scores/SessionCiblage.php';
|
||||
$sessionCiblage = new SessionCiblage();
|
||||
$val = $sessionCiblage->getCritere($key);
|
||||
$valuesChecked = array();
|
||||
$valuesUndetermined = array();
|
||||
if ($val != null){
|
||||
$valuesChecked = explode(',',$val);
|
||||
foreach($valuesChecked as $value){
|
||||
$valuesUndetermined = array_merge($valuesUndetermined, $this->getNafParent($value, true));
|
||||
}
|
||||
}
|
||||
|
||||
$niveau = $request->getParam('niveau', 1);
|
||||
$nafM = new Application_Model_Naf();
|
||||
$sql = $nafM->select()->where('niveau = ?', $niveau)->order('code ASC');
|
||||
$result = $nafM->fetchAll($sql)->toArray();
|
||||
$tabNaf = array();
|
||||
foreach($result as $item)
|
||||
{
|
||||
$structure = array(
|
||||
'data' => $item['code'].' - '.$item['lib'],
|
||||
'attr' => array('id' => $item['code'], 'niveau' => $item['niveau']),
|
||||
'state' => 'closed',
|
||||
'children' => array(),
|
||||
);
|
||||
if (in_array($item['code'], $valuesChecked)){
|
||||
$structure['attr']['class'] = 'jstree-checked';
|
||||
}
|
||||
if (in_array($item['code'], $valuesUndetermined)){
|
||||
$structure['attr']['class'] = 'jstree-undetermined';
|
||||
}
|
||||
$tabNaf[] = $structure;
|
||||
}
|
||||
$this->view->assign('naf', json_encode($tabNaf));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne l'arborecence des NAFs de niveau supérieur à 1
|
||||
*/
|
||||
public function nafajaxAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
|
||||
$request = $this->getRequest();
|
||||
$key = $request->getParam('key');
|
||||
|
||||
//Récupération des valeurs enregistrées en session
|
||||
require_once 'Scores/SessionCiblage.php';
|
||||
$sessionCiblage = new SessionCiblage();
|
||||
$val = $sessionCiblage->getCritere($key);
|
||||
$valuesChecked = array();
|
||||
|
||||
$valuesUndetermined = array();
|
||||
if ($val != null){
|
||||
$valuesChecked = explode(',',$val);
|
||||
foreach($valuesChecked as $value){
|
||||
$valuesUndetermined = array_merge($valuesUndetermined, $this->getNafParent($value));
|
||||
}
|
||||
}
|
||||
|
||||
$request = $this->getRequest();
|
||||
$niveau = $request->getParam('niveau', 1);
|
||||
$niveau++;
|
||||
$parent = $request->getParam('parent', '');
|
||||
$nafM = new Application_Model_Naf();
|
||||
$sql = $nafM->select();
|
||||
if (!empty($parent) && $niveau==2) {
|
||||
$sql->where('parent = ?', $parent);
|
||||
} elseif (!empty($parent) && $niveau>2) {
|
||||
$sql->where("code LIKE '".$parent."%'");
|
||||
}
|
||||
$sql->where('niveau = ?', $niveau)->order('code ASC');
|
||||
|
||||
$result = $nafM->fetchAll($sql)->toArray();
|
||||
$tabNaf = array();
|
||||
foreach($result as $item){
|
||||
$structure = array(
|
||||
'data' => $item['code'].' - '.$item['lib'],
|
||||
'attr' => array('id' => $item['code'], 'niveau' => $item['niveau']),
|
||||
);
|
||||
if (in_array($item['code'], $valuesChecked)){
|
||||
$structure['attr']['class'] = 'jstree-checked';
|
||||
}
|
||||
if (in_array($item['code'], $valuesUndetermined)){
|
||||
$structure['attr']['class'] = 'jstree-undetermined';
|
||||
}
|
||||
if ($niveau<5){
|
||||
$structure['state'] = 'closed';
|
||||
$structure['children'] = array();
|
||||
}
|
||||
$tabNaf[] = $structure;
|
||||
}
|
||||
echo json_encode($tabNaf);
|
||||
}
|
||||
|
||||
protected function getNafParent($value, $niveau1 = false)
|
||||
{
|
||||
$out = array();
|
||||
if (strlen($value)>2) {
|
||||
$niveau = strlen($value)-1;
|
||||
$new = substr($value,0,$niveau);
|
||||
$out = array_merge($out, array($new), $this->getNafParent($new, $niveau1));
|
||||
} elseif (strlen($value)==2 && $niveau1 === true) {
|
||||
$nafM = new Application_Model_Naf();
|
||||
$sql = $nafM->select()
|
||||
->from($nafM, array('parent'))
|
||||
->where('code = ?', $value);
|
||||
$result = $nafM->fetchRow($sql);
|
||||
$out[] = $result->parent;
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
*/
|
||||
public function geographiqueAction()
|
||||
{
|
||||
require_once 'Scores/SessionCiblage.php';
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->view->inlineScript()->appendFile('/themes/default/scripts/jquery.jstree.js');
|
||||
|
||||
require_once 'Scores/SessionCiblage.php';
|
||||
$session = new SessionCiblage();
|
||||
$val = $session->getCritere('adr_cp');
|
||||
|
||||
$valuesCheckeds = explode(',', $val);
|
||||
if(count($valuesCheckeds) > 0) {
|
||||
for($i=0;count($valuesCheckeds) > $i;$i++) {
|
||||
$valuesCheckeds[$i] = substr($valuesCheckeds[$i], 1);
|
||||
}
|
||||
}
|
||||
$valuesUndetermined = array();
|
||||
if($val != null)
|
||||
{
|
||||
$values = explode(',', $val);
|
||||
foreach($values as $valuesChecked) {
|
||||
if(strlen($valuesChecked) == 5) {
|
||||
$dept = substr($valuesChecked, 0, 2);
|
||||
$table = new Application_Model_Departements();
|
||||
$sql = $table->select()->from('departements', array('codeRegionInsee'))->where('numdep = ?',$dept);
|
||||
$results = $table->fetchAll($sql)->toArray();
|
||||
foreach($results as $result) {
|
||||
$valuesUndetermined[] = $result['codeRegionInsee'];
|
||||
}
|
||||
}
|
||||
if(substr($valuesChecked, 0, 1) == 'R') {
|
||||
$valuesCheckeds[] = substr($valuesChecked, 1);
|
||||
} else if (substr($valuesChecked, 0, 1) == 'D') {
|
||||
$table = new Application_Model_Departements();
|
||||
$sql = $table->select()->from('departements', array('codeRegionInsee'))->where('numdep = ?', substr($valuesChecked, 1));
|
||||
$result = $table->fetchAll($sql)->toArray();
|
||||
foreach($result as $item) {
|
||||
$valuesUndetermined[] = $item['codeRegionInsee'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$key = $this->getRequest()->getParam('key');
|
||||
$this->view->assign('key', $key);
|
||||
|
||||
$regionsM = new Application_Model_Regions();
|
||||
$sql = $regionsM->select()->from('regions');
|
||||
$regions = $regionsM->fetchAll()->toArray();
|
||||
|
||||
$structure = array();
|
||||
foreach($regions as $region) {
|
||||
$structure = array(
|
||||
'data' => $region['NCCENR'],
|
||||
'attr' => array('id' => 'R'.$region['REGION'], 'niveau' => 0),
|
||||
'state' => 'closed',
|
||||
'children' => array()
|
||||
);
|
||||
if(in_array($region['REGION'], $valuesCheckeds)) {
|
||||
$structure['attr']['class'] = 'jstree-checked';
|
||||
}
|
||||
if(in_array($region['REGION'], $valuesUndetermined)) {
|
||||
$structure['attr']['class'] = 'jstree-undetermined';
|
||||
}
|
||||
$tabAdrDep[] = $structure;
|
||||
}
|
||||
$this->view->regions = json_encode($tabAdrDep);
|
||||
}
|
||||
|
||||
public function geographiqueajaxAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
|
||||
$request = $this->getRequest();
|
||||
$key = $request->getParam('key');
|
||||
$id = $request->getParam('id');
|
||||
|
||||
if($id[0] == 'R') {
|
||||
require_once 'Scores/SessionCiblage.php';
|
||||
$session = new SessionCiblage();
|
||||
$val = $session->getCritere('adr_cp');
|
||||
$valuesCheckeds = array();
|
||||
$valuesUndetermined = array();
|
||||
|
||||
if($val != null)
|
||||
{
|
||||
$values = explode(',', $val);
|
||||
foreach($values as $valuesChecked) {
|
||||
if(strlen($valuesChecked) == 5) {
|
||||
$valuesUndetermined[] = substr($valuesChecked, 0, 2);
|
||||
}
|
||||
if(substr($valuesChecked, 0, 1) == 'D') {
|
||||
$valuesCheckeds[] = substr($valuesChecked, 1);
|
||||
} else if (substr($valuesChecked, 0, 1) == 'R') {
|
||||
$table = new Application_Model_Departements();
|
||||
$sql = $table->select()->from('departements', array('numdep'))->where('codeRegionInsee = ?', substr($valuesChecked, 1));
|
||||
$result = $table->fetchAll($sql)->toArray();
|
||||
foreach($result as $item) {
|
||||
$valuesCheckeds[] = $item['numdep'];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
$region = substr($request->getParam('id'), 1);
|
||||
$deps = new Application_Model_Departements();
|
||||
$sql = $deps->select()
|
||||
->from('departements')
|
||||
->where('codeRegionInsee = ?', $region);
|
||||
$departements = $deps->fetchAll($sql)->toArray();
|
||||
foreach($departements as $departement) {
|
||||
$structure = array(
|
||||
'data' => $departement['libdep'],
|
||||
'attr' => array('id' => 'D'.$departement['numdep'], 'niveau' => 1),
|
||||
'state' => 'closed',
|
||||
'children' => array()
|
||||
);
|
||||
if(in_array($departement['numdep'], $valuesCheckeds)) {
|
||||
$structure['attr']['class'] = 'jstree-checked';
|
||||
}
|
||||
if(in_array($departement['numdep'], $valuesUndetermined)) {
|
||||
$structure['attr']['class'] = 'jstree-undetermined';
|
||||
}
|
||||
$departementTab[] = $structure;
|
||||
}
|
||||
echo json_encode($departementTab);
|
||||
} else if ($id[0] == 'D')
|
||||
{
|
||||
require_once 'Scores/SessionCiblage.php';
|
||||
$session = new SessionCiblage();
|
||||
$val = $session->getCritere('adr_cp');
|
||||
$valuesCheckeds = array();
|
||||
if($val != null)
|
||||
{
|
||||
$values = explode(',', $val);
|
||||
foreach($values as $valuesChecked) {
|
||||
if(strlen($valuesChecked) == 5) {
|
||||
$valuesCheckeds[] = $valuesChecked;
|
||||
}
|
||||
else if(substr($valuesChecked, 0, 1) == 'D') {
|
||||
$table = new Application_Model_Codepostaux();
|
||||
$sql = $table->select()->from('codepostaux', array('Codepos'))->where('Codepos LIKE "'.substr($valuesChecked, 1).'%"');
|
||||
$results = $table->fetchAll($sql)->toArray();
|
||||
foreach($results as $result) {
|
||||
if(!in_array($result['Codepos'], $values))
|
||||
$valuesCheckeds[] = $result['Codepos'];
|
||||
}
|
||||
} else if (substr($valuesChecked, 0, 1) == 'R') {
|
||||
$Departements = new Application_Model_Departements();
|
||||
$sql = $Departements->select()->from('departements', array('numdep'))->where('codeRegionInsee = ?', substr($valuesChecked, 1));
|
||||
$results = $Departements->fetchAll($sql)->toArray();
|
||||
foreach($results as $result) {
|
||||
$table = new Application_Model_Codepostaux();
|
||||
$sql = $table->select()->from('codepostaux', array('Codepos'))->where('Codepos LIKE "'.$result['numdep'].'%"');
|
||||
$codes = $table->fetchAll($sql)->toArray();
|
||||
foreach($codes as $code) {
|
||||
if(!in_array($result['Codepos'], $values))
|
||||
$valuesCheckeds[] = $code['Codepos'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$numdep = substr($request->getParam('id'), 1);
|
||||
$code = new Application_Model_Codepostaux();
|
||||
$sql = $code->select()
|
||||
->from('codepostaux')
|
||||
->where('Codepos LIKE "'.$numdep.'%"');
|
||||
$codePostaux = $code->fetchAll($sql)->toArray();
|
||||
|
||||
foreach($codePostaux as $codePostau) {
|
||||
$structure = array(
|
||||
'data' => '[ '.$codePostau['Codepos'].' ]'.ucfirst(strtolower($codePostau['Commune'])),
|
||||
'attr' => array('id' => $codePostau['Codepos'], 'niveau' => 2)
|
||||
);
|
||||
if(in_array($codePostau['Codepos'], $valuesCheckeds)) {
|
||||
$structure['attr']['class'] = 'jstree-checked';
|
||||
}
|
||||
$CodePostauxTab[] = $structure;
|
||||
}
|
||||
echo json_encode($CodePostauxTab);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
*/
|
||||
public function juridqueAction()
|
||||
{
|
||||
$valeurs = $this>getRequest()->getParam('');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
132
application/controllers/ComptageController.php
Normal file
132
application/controllers/ComptageController.php
Normal file
@ -0,0 +1,132 @@
|
||||
<?php
|
||||
class ComptageController extends Zend_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
//Session
|
||||
require_once 'Scores/SessionCiblage.php';
|
||||
$session = new SessionCiblage();
|
||||
|
||||
$request = $this->getRequest();
|
||||
$key = $request->getParam('cle');
|
||||
$valeur = $request->getParam('valeur');
|
||||
|
||||
$sessionValeur = $session->getCritere($key);
|
||||
if($sessionValeur == "" && empty($valeur)) {
|
||||
$session->unsetCritere($key);
|
||||
} else {
|
||||
$session->setCritere($key, $valeur);
|
||||
}
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
require_once 'Scores/Field.php';
|
||||
$field = new Fields($user->username);
|
||||
|
||||
//Comptage
|
||||
require_once 'Scores/Ciblage.php';
|
||||
$ciblage = new Ciblage($field->getValues());
|
||||
$total = $ciblage->execute();
|
||||
$insee = $ciblage->calculRedevanceInsee();
|
||||
|
||||
$session->setNb('total', $total);
|
||||
$session->setNb('insee', $insee);
|
||||
|
||||
//Retour comptage, unité Insee
|
||||
$result = array(
|
||||
'count' => number_format($total, 0, '', ' '),
|
||||
'insee' => number_format($insee, 0, '', ' ')
|
||||
);
|
||||
echo json_encode($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Affichage formulaire de sauvegarde
|
||||
*/
|
||||
public function savedialogAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
||||
//Récupération de la session pour le profil et les valeurs du comptage
|
||||
require_once 'Scores/SessionCiblage.php';
|
||||
$session = new SessionCiblage();
|
||||
$criteres = $session->getCriteres();
|
||||
$this->view->assign('criteres', $criteres);
|
||||
if (count($criteres)==0) {
|
||||
$this->view->assign('noSelection', true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sauvegarde du profil de ciblage et de son comptage
|
||||
*/
|
||||
public function saveAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$request = $this->getRequest();
|
||||
$ref = $request->getParam('ref', '');
|
||||
|
||||
if (empty($ref)) {
|
||||
echo json_encode(array(
|
||||
'error'=>1,
|
||||
'msg'=> "Référence non définie !"));
|
||||
} else {
|
||||
//Session
|
||||
require_once 'Scores/SessionCiblage.php';
|
||||
$session = new SessionCiblage();
|
||||
$criteres = $session->getCriteres();
|
||||
$resultat = $session->getNb('total');
|
||||
$nbInsee = $session->getNb('insee');
|
||||
|
||||
//Informations utilisateur
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
$db = Zend_Registry::get('db');
|
||||
|
||||
//Enregistrement des critères
|
||||
$criteresM = new Application_Model_Criteres($db);
|
||||
$data = array(
|
||||
'idClient' => $user->idClient,
|
||||
'login' => $user->username,
|
||||
'reference' => $ref,
|
||||
'criteres' => json_encode($criteres),
|
||||
'parent' => 0,
|
||||
'dateAjout' => date('Y-m-d H:i:s'),
|
||||
);
|
||||
$id = $criteresM->insert($data);
|
||||
|
||||
if ($id){
|
||||
//Enregistrement des valeurs du comptage
|
||||
$comptageM = new Application_Model_Comptages($db);
|
||||
$data = array(
|
||||
'idDefinition' => $id,
|
||||
'resultat' => $resultat,
|
||||
'uniteInsee' => $nbInsee,
|
||||
'tarif' => '',
|
||||
'dateAjout' => date('Y-m-d H:i:s'),
|
||||
);
|
||||
if ($comptageM->insert($data)) {
|
||||
echo json_encode(array(
|
||||
'error'=>0,
|
||||
'msg'=> "Vos critères ont été sauvegardés sous la référence $ref"));
|
||||
} else {
|
||||
echo json_encode(array(
|
||||
'error'=>1,
|
||||
'msg'=> "Erreur lors de l'enregistrement"));
|
||||
}
|
||||
} else {
|
||||
echo json_encode(array(
|
||||
'error'=>1,
|
||||
'msg'=> "Erreur lors de l'enregistrement"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
42
application/controllers/CriteresController.php
Normal file
42
application/controllers/CriteresController.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
class CriteresController extends Zend_Controller_Action
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
$field = new Fields($user->username);
|
||||
$this->view->fields = $field;
|
||||
$this->view->headScript()->appendFile('/themes/default/scripts/jquery.jstree.js', 'text/javascript');
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
if ($user->customisation) {
|
||||
$this->view->assign('preferences', $user->customisation);
|
||||
}
|
||||
}
|
||||
|
||||
public function entrepriseAction(){
|
||||
$this->view->headLink()->appendStylesheet('/themes/default/styles/criteres/'.$this->getRequest()->getActionName().'.css', 'all');
|
||||
}
|
||||
|
||||
public function economiqueAction(){
|
||||
$this->view->headLink()->appendStylesheet('/themes/default/styles/criteres/'.$this->getRequest()->getActionName().'.css', 'all');
|
||||
}
|
||||
|
||||
public function geographiqueAction(){
|
||||
$this->view->headLink()->appendStylesheet('/themes/default/styles/criteres/'.$this->getRequest()->getActionName().'.css', 'all');
|
||||
}
|
||||
|
||||
public function juridiqueAction(){
|
||||
$this->view->headLink()->appendStylesheet('/themes/default/styles/criteres/'.$this->getRequest()->getActionName().'.css', 'all');
|
||||
}
|
||||
|
||||
public function financiereAction(){
|
||||
$this->view->headLink()->appendStylesheet('/themes/default/styles/criteres/'.$this->getRequest()->getActionName().'.css', 'all');
|
||||
}
|
||||
|
||||
}
|
227
application/controllers/DashboardController.php
Normal file
227
application/controllers/DashboardController.php
Normal file
@ -0,0 +1,227 @@
|
||||
<?php
|
||||
/**
|
||||
* Tableau de bord de gestion pour le client
|
||||
* Permet de retrouver ces différents comptages et export
|
||||
*
|
||||
*/
|
||||
class DashboardController extends Zend_Controller_Action
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
$this->view->headScript()->appendFile('/themes/default/scripts/dashboard.js', 'text/javascript');
|
||||
$this->view->headLink()->appendStylesheet('/themes/default/styles/dashboard.css');
|
||||
}
|
||||
|
||||
/**
|
||||
* Affiche le tableau de bord
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
//Liste des derniers comptages
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
$db = Zend_Registry::get('db');
|
||||
|
||||
$criteresM = new Application_Model_Criteres($db);
|
||||
$sql = $criteresM->select(true)
|
||||
->columns(array('id', 'reference', 'dateAjout'))
|
||||
->where("idClient = ?", $user->idClient)
|
||||
->where("login = ?", $user->username)
|
||||
->order('dateAjout DESC')
|
||||
->limit(5);
|
||||
|
||||
$rows = $criteresM->fetchAll($sql);
|
||||
|
||||
$results = array();
|
||||
$comptagesM = new Application_Model_Comptages($db);
|
||||
foreach($rows->toArray() as $item)
|
||||
{
|
||||
$info = array(
|
||||
'id' => $item['id'],
|
||||
'reference' => $item['reference'],
|
||||
'dateCriteres' => $item['dateAjout'],
|
||||
);
|
||||
//Recherche des comptages
|
||||
$sql = $comptagesM->select(true)
|
||||
->columns(array('resultat', 'uniteInsee', 'dateAjout'))
|
||||
->where('idDefinition = ?', $item['id'])
|
||||
->order('dateAjout DESC')->limit(1);
|
||||
$comptage = $comptagesM->fetchAll($sql)->toArray();
|
||||
|
||||
if (count($comptage)>0){
|
||||
$info['resultat'] = $comptage[0]['resultat'];
|
||||
$info['uniteInsee'] = $comptage[0]['uniteInsee'];
|
||||
$info['dateComptage'] = $comptage[0]['dateAjout'];
|
||||
}
|
||||
|
||||
$results[] = $info;
|
||||
}
|
||||
$this->view->assign('comptages', $results);
|
||||
|
||||
//Rechercher un comptage
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function menuAction()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Affiche la liste des ciblages avec pagination
|
||||
*/
|
||||
public function ciblagesAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$page = $request->getParam('page', 1);
|
||||
$offset = 20;
|
||||
|
||||
//Liste des ciblages par paquet de n
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
$db = Zend_Registry::get('db');
|
||||
|
||||
$criteresM = new Application_Model_Criteres($db);
|
||||
|
||||
//Compter le nombre de page
|
||||
$sql = $criteresM->select()
|
||||
->from($criteresM, array('nb' => 'COUNT(*)'))
|
||||
->where("idClient = ?", $user->idClient)
|
||||
->where("login = ?", $user->username);
|
||||
$count = $criteresM->fetchRow($sql);
|
||||
$nbCiblage = $count->nb;
|
||||
|
||||
//Récupérer les informations
|
||||
$position = ($page-1)*$offset+1;
|
||||
$sql = $criteresM->select()
|
||||
->from($criteresM, array('id', 'reference', 'dateAjout'))
|
||||
->where("idClient = ?", $user->idClient)
|
||||
->where("login = ?", $user->username)
|
||||
->order('dateAjout DESC')
|
||||
->limitPage($position, $offset);
|
||||
|
||||
$rows = $criteresM->fetchAll($sql);
|
||||
$results = array();
|
||||
$comptagesM = new Application_Model_Comptages($db);
|
||||
foreach($rows->toArray() as $item)
|
||||
{
|
||||
$info = array(
|
||||
'id' => $item['id'],
|
||||
'reference' => $item['reference'],
|
||||
'dateCriteres' => $item['dateAjout'],
|
||||
);
|
||||
//Recherche des comptages
|
||||
$sql = $comptagesM->select(true)
|
||||
->columns(array('resultat', 'uniteInsee', 'dateAjout'))
|
||||
->where('idDefinition = ?', $item['id'])
|
||||
->order('dateAjout DESC')->limit(1);
|
||||
$comptage = $comptagesM->fetchAll($sql)->toArray();
|
||||
|
||||
if (count($comptage)>0){
|
||||
$info['resultat'] = $comptage[0]['resultat'];
|
||||
$info['uniteInsee'] = $comptage[0]['uniteInsee'];
|
||||
$info['dateComptage'] = $comptage[0]['dateAjout'];
|
||||
}
|
||||
|
||||
$results[] = $info;
|
||||
}
|
||||
$this->view->assign('ciblages', $results);
|
||||
$this->view->assign('nbCiblage', $nbCiblage);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Affiche le détail du comptage
|
||||
* comptage multiple, fichier, etc....
|
||||
*/
|
||||
public function ciblagedetailAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$id = $request->getParam('id');
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
$db = Zend_Registry::get('db');
|
||||
|
||||
$criteresM = new Application_Model_Criteres($db);
|
||||
$sql = $criteresM->select()
|
||||
->where("idClient = ?", $user->idClient)
|
||||
->where("login = ?", $user->username)
|
||||
->where("id = ?", $id);
|
||||
$criteres = $criteresM->fetchRow($sql);
|
||||
$this->view->assign('criteres', $criteres->toArray());
|
||||
|
||||
if ($criteres != null){
|
||||
$comptagesM = new Application_Model_Comptages($db);
|
||||
$sql = $comptagesM->select()
|
||||
->where('idDefinition = ?', $id);
|
||||
$comptages = $comptagesM->fetchAll($sql);
|
||||
|
||||
$this->view->assign('comptages', $comptages->toArray());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Recherche un comptage avec la référence ou la date
|
||||
*/
|
||||
public function rcomptageAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$request = $this->getRequest();
|
||||
$q = strtolower($this->getRequest()->getParam('q', ''));
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
$db = Zend_Registry::get('db');
|
||||
|
||||
$criteresM = new Application_Model_Criteres($db);
|
||||
$sql = $criteresM->select()
|
||||
->from($criteresM, array('id', 'reference', "DATE_FORMAT(dateAjout, '%d/%m/%Y') as date"))
|
||||
->where("idClient = ?", $user->idClient)
|
||||
->where("login = ?", $user->username)
|
||||
->where("reference LIKE ?", $q.'%');
|
||||
$rows = $criteresM->fetchAll($sql);
|
||||
if (count($rows)>0){
|
||||
$separator = " , ";
|
||||
foreach ($rows as $item) {
|
||||
$output[] = array(
|
||||
'label' => $item->reference . $separator . $item->date,
|
||||
'value' => $item->reference,
|
||||
'url' => $this->view->url(array('controller'=>'dashboard', 'action'=>'ciblagedetail', 'id'=>$item->id)),
|
||||
);
|
||||
}
|
||||
}
|
||||
echo json_encode($output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gestion de la configuration de l'application
|
||||
*/
|
||||
public function configurationAction()
|
||||
{
|
||||
//Préférences
|
||||
//Profil extraction
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Liste des exportations simple non lié à un ciblage
|
||||
*/
|
||||
public function exportsAction()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
68
application/controllers/EnrichissementController.php
Normal file
68
application/controllers/EnrichissementController.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
class EnrichissementController extends Zend_Controller_Action
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
$this->view->headScript()->appendFile('/themes/default/scripts/enrichissement.js', 'text/javascript');
|
||||
$this->view->headLink()->appendStylesheet('/themes/default/styles/enrichissement.css');
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here ...
|
||||
*/
|
||||
public function indexAction(){}
|
||||
|
||||
public function fileformAction()
|
||||
{
|
||||
$this->view->headScript()->appendFile('/themes/default/scripts/jquery.form.js', 'text/javascript');
|
||||
$this->view->headScript()->appendFile('/themes/default/scripts/jqueryprogressbar.js', 'text/javascript');
|
||||
$this->view->assign('filesize', ini_get('upload_max_filesize'));
|
||||
}
|
||||
|
||||
public function fileuploadAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'path');
|
||||
$path = realpath($config->data).'/clients';
|
||||
if(!file_exists($path)) mkdir($path);
|
||||
|
||||
if ( isset($_FILES) && count($_FILES)==1 ){
|
||||
$n = $_FILES['fichier']['name'];
|
||||
$s = $_FILES['fichier']['size'];
|
||||
$tmp_name = $_FILES['fichier']['tmp_name'];
|
||||
$name = $_REQUEST['ref'];
|
||||
|
||||
$extValide = array('csv');
|
||||
$extension = strrchr($n,'.');
|
||||
$extension = substr($extension,1);
|
||||
//@todo : vérifier l'extension du fichier
|
||||
|
||||
if (move_uploaded_file($tmp_name, $path.'/'.$name.'.'.$extension)){
|
||||
echo "Uploadé !";
|
||||
} else {
|
||||
echo "Erreur : ".$_FILES['fichier']['error'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Etat de progression de l'upload du fichier
|
||||
*/
|
||||
public function fileprogressAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$request = $this->getRequest();
|
||||
$key = $request->getParam('key', '');
|
||||
if (!empty($key)) {
|
||||
//$rep sera égal à false si la clef n'existe pas dans le cache apc
|
||||
$rep = apc_fetch('upload_'.$key);
|
||||
echo json_encode($rep);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
47
application/controllers/ErrorController.php
Normal file
47
application/controllers/ErrorController.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
class ErrorController extends Zend_Controller_Action
|
||||
{
|
||||
public function errorAction()
|
||||
{
|
||||
$errors = $this->_getParam('error_handler');
|
||||
|
||||
switch ($errors->type) {
|
||||
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
|
||||
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
|
||||
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
|
||||
|
||||
// 404 error -- controller or action not found
|
||||
$this->getResponse()->setHttpResponseCode(404);
|
||||
$this->view->message = 'Page not found';
|
||||
break;
|
||||
default:
|
||||
// application error
|
||||
$this->getResponse()->setHttpResponseCode(500);
|
||||
$this->view->message = 'Application error';
|
||||
break;
|
||||
}
|
||||
|
||||
// Log exception, if logger available
|
||||
if ($log = $this->getLog()) {
|
||||
$log->crit($this->view->message, $errors->exception);
|
||||
}
|
||||
|
||||
// conditionally display exceptions
|
||||
if ($this->getInvokeArg('displayExceptions') == true) {
|
||||
$this->view->exception = $errors->exception;
|
||||
}
|
||||
|
||||
$this->view->request = $errors->request;
|
||||
}
|
||||
|
||||
public function getLog()
|
||||
{
|
||||
$bootstrap = $this->getInvokeArg('bootstrap');
|
||||
if (!$bootstrap->hasPluginResource('Log')) {
|
||||
return false;
|
||||
}
|
||||
$log = $bootstrap->getResource('Log');
|
||||
return $log;
|
||||
}
|
||||
}
|
||||
|
7
application/controllers/ExtractionController.php
Normal file
7
application/controllers/ExtractionController.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
class ExtractionController extends Zend_Controller_Action
|
||||
{
|
||||
public function indexAction(){
|
||||
}
|
||||
}
|
||||
|
72
application/controllers/IndexController.php
Normal file
72
application/controllers/IndexController.php
Normal file
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
class IndexController extends Zend_Controller_Action
|
||||
{
|
||||
public function init(){}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
if ($user->customisation) {
|
||||
$this->view->assign('preferences', $user->customisation);
|
||||
}
|
||||
}
|
||||
|
||||
public function selectionAction(){}
|
||||
|
||||
public function historiqueAction(){}
|
||||
|
||||
public function criteresAction()
|
||||
{
|
||||
$this->view->headScript()->appendFile('/themes/default/scripts/fields.js', 'text/javascript');
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
$session = new SessionCiblage();
|
||||
//Chargement de la structure des champs et des préférences utilisateurs
|
||||
require_once 'Scores/Field.php';
|
||||
$fields = new Fields($user->username);
|
||||
$this->view->fields = $fields;
|
||||
$this->view->criteres = $session->getCriteres();
|
||||
}
|
||||
|
||||
public function resetAction()
|
||||
{
|
||||
require_once 'Scores/SessionCiblage.php';
|
||||
$session = new SessionCiblage();
|
||||
$session->clearCiblage();
|
||||
$this->_redirect('./');
|
||||
}
|
||||
|
||||
public function saveAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
|
||||
$field = $this->getRequest()->getParam('name');
|
||||
$fields = $this->fields->getFields();
|
||||
$fields[$field]['activated'] = (($fields[$field]['activated'] == false)?true:false);
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
$db = Zend_Registry::get('db');
|
||||
|
||||
$prefsModel = new Application_Model_Prefs($db);
|
||||
$data = array(
|
||||
'login' => $user->username,
|
||||
'json' => $this->fields->getNotActivated($fields),
|
||||
);
|
||||
|
||||
$prefsModel->select()->where('login = "?"', $user->username);
|
||||
$rows =$prefsModel->fetchRow();
|
||||
$rows = $rows->toArray();
|
||||
if (count($rows) > 0) {
|
||||
$prefsModel->update($data, 'login = "'.$user->unsername.'"');
|
||||
} else {
|
||||
$prefsModel->insert($data);
|
||||
}
|
||||
$this->_redirect('./');
|
||||
}
|
||||
|
||||
}
|
||||
|
57
application/controllers/PreferencesController.php
Normal file
57
application/controllers/PreferencesController.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
class PreferencesController extends Zend_Controller_Action
|
||||
{
|
||||
public function saveAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
|
||||
$fields = $this->getRequest()->getParam('fields');
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
$db = Zend_Registry::get('db');
|
||||
|
||||
$prefsModel = new Application_Model_Prefs($db);
|
||||
$data = array(
|
||||
'login' => $user->username,
|
||||
'json' => json_encode($this->getNotActivated(json_decode($fields))),
|
||||
);
|
||||
$sql = $prefsModel->select()->where('login = ?', $user->username);
|
||||
$rows = $prefsModel->fetchAll($sql);
|
||||
if (count($rows)>0) {
|
||||
$prefsModel->update($data, 'login = '.$user->unsername);
|
||||
} else {
|
||||
$prefsModel->insert($data);
|
||||
}
|
||||
$this->_redirect('./');
|
||||
}
|
||||
|
||||
public function getNotActivated($fields)
|
||||
{
|
||||
foreach($fields as $name => $field)
|
||||
{
|
||||
if(!$field['activated']) {
|
||||
$desactivated[] = array($name => "");
|
||||
}
|
||||
}
|
||||
return ($desactivated);
|
||||
}
|
||||
|
||||
/**
|
||||
* Place un marqueur d'activation du mode de personnalisation dans la session Utilisateur
|
||||
* On retourne ensuite dans index/index pour permettre le choix des préférences d'affichage
|
||||
*/
|
||||
public function activeAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
//@todo : Vérifier que l'utilisateur à le droit de customiser
|
||||
$user->customisation = true;
|
||||
$auth->getStorage()->write($user);
|
||||
$this->_redirect('./');
|
||||
}
|
||||
|
||||
}
|
16
application/controllers/PrefsController.php
Normal file
16
application/controllers/PrefsController.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
class PrefsController extends Zend_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
$db = Zend_Registry::get('db');
|
||||
|
||||
$prefs = new Application_Model_Prefs($db);
|
||||
$sql = $prefs->select()->where('login = ?', $user->username);
|
||||
|
||||
$this->view->entries = $prefs->fetchAll($sql);
|
||||
}
|
||||
}
|
30
application/controllers/RechercheController.php
Normal file
30
application/controllers/RechercheController.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
class RechercheController extends Zend_Controller_Action
|
||||
{
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
*/
|
||||
public function nafAction()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
*/
|
||||
public function geographiqueAction()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
*/
|
||||
public function juridiqueAction()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
91
application/controllers/UserController.php
Normal file
91
application/controllers/UserController.php
Normal file
@ -0,0 +1,91 @@
|
||||
<?php
|
||||
class UserController extends Zend_Controller_Action
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
require_once 'Forms/Login.php';
|
||||
require_once 'Scores/WebAuthAdapter.php';
|
||||
require_once 'Scores/WsScores.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gestion de l'authentification
|
||||
*/
|
||||
public function loginAction()
|
||||
{
|
||||
$this->view->headTitle()->append('Connexion');
|
||||
$form = new Form_Login();
|
||||
$this->view->form = $form;
|
||||
$request = $this->getRequest();
|
||||
if ($request->isPost()) {
|
||||
$formData = $request->getPost();
|
||||
if ($form->isValid($formData)) {
|
||||
$login = $form->getValue('login');
|
||||
$pass = $form->getValue('pass');
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$authAdapter = new WebAuthAdapter($login, md5($login.'|'.$pass));
|
||||
$result = $auth->authenticate($authAdapter);
|
||||
if (!$result->isValid()){
|
||||
$this->view->message = '';
|
||||
Zend_Registry::get('firebug')->info($result);
|
||||
foreach ($result->getMessages() as $message) {
|
||||
$this->view->message.= $message."<br/>";
|
||||
}
|
||||
} else {
|
||||
$timeout = $auth->getIdentity()->timeout;
|
||||
|
||||
//Ecrit un cookie persistant valide pendant le temps definit
|
||||
Zend_Session::rememberMe($timeout);
|
||||
|
||||
$storage = new Zend_Auth_Storage_Session();
|
||||
$sessionNamespace = new Zend_Session_Namespace($storage->getNamespace());
|
||||
$sessionNamespace->setExpirationSeconds($timeout);
|
||||
$auth->setStorage($storage);
|
||||
$url = '';
|
||||
if (Zend_Session::namespaceIsset('login')){
|
||||
$session = new Zend_Session_Namespace('login');
|
||||
if (isset($session->url)) {
|
||||
$url = $session->url;
|
||||
}
|
||||
}
|
||||
if (!empty($url) && $url!='/user/login' && $url!='/localauth'){
|
||||
$this->_redirect($url);
|
||||
}
|
||||
$this->_redirect('/');
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->render('login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gestion de la déconnexion
|
||||
*/
|
||||
public function logoutAction()
|
||||
{
|
||||
//Suppression des critères de comptage en session
|
||||
require_once 'Scores/SessionCiblage.php';
|
||||
$session = new SessionCiblage();
|
||||
$session->clearCiblage();
|
||||
|
||||
//Suppression de l'identité
|
||||
Zend_Auth::getInstance()->clearIdentity();
|
||||
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
||||
$url = 'http://www.scores-decisions.com/';
|
||||
$refresh = 5;
|
||||
|
||||
if (APPLICATION_ENV != 'production'){
|
||||
$url = 'http://'.$_SERVER['SERVER_NAME'].$this->view->url(array(
|
||||
'controller' => 'user',
|
||||
'action' => 'login',
|
||||
));
|
||||
}
|
||||
|
||||
$this->view->assign('url', $url);
|
||||
$this->view->headMeta()->appendHttpEquiv('refresh', '5; url='.$url);
|
||||
$this->render('logout');
|
||||
}
|
||||
}
|
5
application/models/Codepostaux.php
Normal file
5
application/models/Codepostaux.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Application_Model_Codepostaux extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'codepostaux';
|
||||
}
|
5
application/models/Comptages.php
Normal file
5
application/models/Comptages.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Application_Model_Comptages extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'comptages';
|
||||
}
|
5
application/models/Criteres.php
Normal file
5
application/models/Criteres.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Application_Model_Criteres extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'criteres';
|
||||
}
|
5
application/models/Departements.php
Normal file
5
application/models/Departements.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Application_Model_Departements extends Zend_Db_Table_Abstract
|
||||
{
|
||||
public $_name = 'departements';
|
||||
}
|
7
application/models/Formejuridique.php
Normal file
7
application/models/Formejuridique.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
class Application_Model_Formejuridique extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'formejuridique';
|
||||
protected $_primary = 'fjCode';
|
||||
|
||||
}
|
5
application/models/Naf.php
Normal file
5
application/models/Naf.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Application_Model_Naf extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'naf';
|
||||
}
|
5
application/models/Prefs.php
Normal file
5
application/models/Prefs.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Application_Model_Prefs extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'prefs';
|
||||
}
|
5
application/models/ProfilExtraction.php
Normal file
5
application/models/ProfilExtraction.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Application_Model_ProfilExtraction extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'profilExtraction';
|
||||
}
|
5
application/models/RefExport.php
Normal file
5
application/models/RefExport.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Application_Model_RefExport extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'refexport';
|
||||
}
|
6
application/models/Regions.php
Normal file
6
application/models/Regions.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
class Application_Model_Regions extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'regions';
|
||||
}
|
||||
|
202
application/views/default/helpers/Field.php
Normal file
202
application/views/default/helpers/Field.php
Normal file
@ -0,0 +1,202 @@
|
||||
<?php
|
||||
Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
|
||||
{
|
||||
public function Field($name, $field)
|
||||
{
|
||||
$html = '';
|
||||
if($field != null) {
|
||||
$html.= '<div class="fieldgrp">';
|
||||
$type = $field['type'];
|
||||
switch($type)
|
||||
{
|
||||
case 'select':
|
||||
$html.= $this->structureHTML(
|
||||
$field['label'],
|
||||
$this->selectHTML($name, $field));
|
||||
break;
|
||||
case 'selectMultiple':
|
||||
$html.= $this->structureHTML(
|
||||
$field['label'],
|
||||
$this->selectMultipleHTML($name, $field));
|
||||
break;
|
||||
case 'intervalSelect':
|
||||
$html.= $this->structureHTML(
|
||||
$field['label'],
|
||||
$this->intervalSelectHTML($name, $field));
|
||||
break;
|
||||
case 'interval':
|
||||
$html.= $this->structureHTML(
|
||||
$field['label'],
|
||||
$this->intervalHTML($name, $field));
|
||||
break;
|
||||
case 'date':
|
||||
$html.= $this->structureHTML(
|
||||
$field['label'],
|
||||
$this->dateHTML($name, $field));
|
||||
break;
|
||||
case 'text':
|
||||
$html.= $this->structureHTML(
|
||||
$field['label'],
|
||||
$this->textHTML($name, $field));
|
||||
break;
|
||||
case 'textarea':
|
||||
$html.= $this->structureHTML(
|
||||
$field['label'],
|
||||
$this->textareaHTML($name, $field));
|
||||
break;
|
||||
case 'radio':
|
||||
$html.= $this->structureHTML(
|
||||
$field['label'],
|
||||
$this->radioHTML($name, $field));
|
||||
break;
|
||||
}
|
||||
$html.= '</div>';
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
private function structureHTML($label, $html, $liens = array())
|
||||
{
|
||||
$out = '';
|
||||
$out.= $this->structureLabel($label);
|
||||
$out.= '<div class="field">'.$html.$this->structureLink($liens).'</div>';
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Définition du label
|
||||
* @param unknown_type $label
|
||||
*/
|
||||
private function structureLabel($label)
|
||||
{
|
||||
return '<label>'.$label.'</label>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Définition des liens
|
||||
*/
|
||||
private function structureLink($liens = array())
|
||||
{
|
||||
$html = '';
|
||||
if (count($liens)>0) {
|
||||
foreach($liens as $lien){
|
||||
$html.= '<a href="'.$lien['url'].'">'.$lien['lib'].'</a>';
|
||||
}
|
||||
}
|
||||
if (!empty($html)) {
|
||||
return '<span>'.$html.'</span>';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
private function intervalSelectHTML($name, $field)
|
||||
{
|
||||
$session = new SessionCiblage();
|
||||
|
||||
$return = '<select class="intervalSelect" name="'.$name.'1" id="'.$name.'" number="1">';
|
||||
foreach($field['fields'][$field['type']]['value'] as $elements) {
|
||||
$return .= '<option value="'. $elements[0].'">'.number_format($elements[0], 0,'', ' ').'</option>';
|
||||
}
|
||||
|
||||
$return .= '</select> à ';
|
||||
$return .= '<select class="intervalSelect" name="'.$name.'2" id="'.$name.'" number="2">';
|
||||
foreach($field['fields'][$field['type']]['value'] as $elements) {
|
||||
$return .= '<option value="'. $elements[1].'">'.number_format($elements[1], 0,'', ' ').'</option>';
|
||||
}
|
||||
|
||||
$return .= '</select>';
|
||||
$return .= ' <span id="'.$name.'"><a href="" class="intervalSelect" id="'.$name.'">Valider</a></span>';
|
||||
return ($return);
|
||||
}
|
||||
|
||||
/* Select */
|
||||
private function selectMultipleHTML($name, $field)
|
||||
{
|
||||
$session = new SessionCiblage();
|
||||
|
||||
$return = '<select class="criteres" name="'.$name.'">';
|
||||
$return .= '<option value="tous">Tous</option>';
|
||||
foreach($field['fields'][$field['type']]['value'] as $value => $label) {
|
||||
$selected = "";
|
||||
if(($session->getCritere($name) != null) and $session->getCritere($name) == $value)
|
||||
$selected = " selected";
|
||||
$return .= '<option'.((!empty($selected))?$selected:null).' value="'.$value.'">'.$label.'</option>';
|
||||
}
|
||||
$return .= '</select>';
|
||||
return ($return);
|
||||
}
|
||||
|
||||
/* Select Multiple */
|
||||
private function selectHTML($name, $field)
|
||||
{
|
||||
$session = new SessionCiblage();
|
||||
|
||||
$sessionValeur = $session->getCritere($name);
|
||||
if(is_array($sessionValeur))
|
||||
$sessionValeur = implode(',', $sessionValeur);
|
||||
$return = '<select class="criteres '.$field['type']['class'].'" name="'.$name.'">';
|
||||
$return .= '<option value="tous">Tous</option>';
|
||||
foreach($field['fields'][$field['type']]['value'] as $value => $label) {
|
||||
$selected = "";
|
||||
if(($sessionValeur != null) and $sessionValeur == $value)
|
||||
$selected = " selected";
|
||||
$return .= '<option'.((!empty($selected))?$selected:null).' value="'.$value.'">'.$label.'</option>';
|
||||
}
|
||||
$return .= '</select>';
|
||||
return ($return);
|
||||
}
|
||||
|
||||
/* Interval */
|
||||
private function intervalHTML($name, $field)
|
||||
{
|
||||
$session = new SessionCiblage();
|
||||
$valeur = $session->getCritere($name);
|
||||
|
||||
$return = '<div class="interval" >';
|
||||
$return .= '<input class="'.$field['class'].'" type="text" name="'.$name.'1" value="'.$valeur[0].'" /> à ';
|
||||
$return .= '<input class="'.$field['class'].'" type="text" name="'.$name.'2" value="'.$valeur[1].'" />';
|
||||
$return .= ' <a href="" class="interval" id="'.$name.'">Valider</a>';
|
||||
$return .= '</div>';
|
||||
|
||||
return ($return);
|
||||
}
|
||||
|
||||
/* Dates */
|
||||
private function dateHTML($name, $field)
|
||||
{
|
||||
$session = new SessionCiblage();
|
||||
|
||||
$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 */
|
||||
private function textHTML($name, $field)
|
||||
{
|
||||
$session = new SessionCiblage();
|
||||
|
||||
$return = '<input style="border:1px inset silver;width:60%" class="criteres" type="text" name="'.$name.'" value="'.$session->getCritere($name).'" />';
|
||||
|
||||
return ($return);
|
||||
}
|
||||
|
||||
/* Textarea */
|
||||
private function textareaHTML($name, $field)
|
||||
{
|
||||
$return = '<a class="arborescence" title="'.$field['title'].'" href="'.$this->view->url(array('controller' => 'arborescence', 'action' => $field['action'], 'key' => $name)).'">
|
||||
Selection dans une arborescence
|
||||
</a>';
|
||||
return ($return);
|
||||
}
|
||||
|
||||
/* Radios */
|
||||
private function radioHTML($name, $field, $item)
|
||||
{
|
||||
$return = '<input type="radio" name="'.$name.'" />';
|
||||
return ($return);
|
||||
}
|
||||
}
|
22
application/views/default/helpers/Radio.php
Normal file
22
application/views/default/helpers/Radio.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
Class Zend_View_Helper_Radio extends Zend_View_Helper_Abstract
|
||||
{
|
||||
public function Radio($name, $libelle)
|
||||
{
|
||||
$champ = '<div>';
|
||||
$champ .= '<div style="float:left;text-align:left;">
|
||||
<label>'.$libelle.'</label>
|
||||
</div>';
|
||||
$champ .= '<div style="text-align:right;">
|
||||
<input type="radio" name="'.$name.'" value="" />
|
||||
<input type="radio" name="'.$name.'" value="0" />
|
||||
<input type="radio" name="'.$name.'" value="1" />
|
||||
</div>';
|
||||
$champ .= '<div>
|
||||
<hr />
|
||||
</div>';
|
||||
$champ .= '</div>';
|
||||
|
||||
return ($champ);
|
||||
}
|
||||
}
|
1
application/views/default/scripts/aide/aproposde.phtml
Normal file
1
application/views/default/scripts/aide/aproposde.phtml
Normal file
@ -0,0 +1 @@
|
||||
<?php
|
1
application/views/default/scripts/aide/index.phtml
Normal file
1
application/views/default/scripts/aide/index.phtml
Normal file
@ -0,0 +1 @@
|
||||
<?php
|
@ -0,0 +1,20 @@
|
||||
<div id="<?=$this->key?>" class="jstree jstree-default" style="overflow:auto;"></div>
|
||||
<script>
|
||||
$("#<?=$this->key?>").jstree({
|
||||
"themes" : {
|
||||
"theme" : "default",
|
||||
"url" : "/themes/jstree/default/style.css",
|
||||
"dots" : true,
|
||||
"icons" : false,
|
||||
},
|
||||
"plugins" : ["themes", "json_data", "checkbox"],
|
||||
"json_data" : {
|
||||
"data" : <?=$this->regions?>,
|
||||
"ajax" : {
|
||||
"url" : '<?=$this->url(array('controller'=>'arborescence', 'action'=>'geographiqueajax', 'key'=> $this->key))?>',
|
||||
"data" : function(n) { return { id: n.attr ? n.attr("id") : '' , niveau : n.attr ? n.attr("niveau") : 1 }; },
|
||||
"cache" : true,
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
20
application/views/default/scripts/arborescence/naf.phtml
Normal file
20
application/views/default/scripts/arborescence/naf.phtml
Normal file
@ -0,0 +1,20 @@
|
||||
<div id="<?=$this->key?>" class="jstree jstree-default" style="overflow:auto;"></div>
|
||||
<script>
|
||||
$("#<?=$this->key?>").jstree({
|
||||
"themes" : {
|
||||
"theme" : "default",
|
||||
"url" : "/themes/jstree/default/style.css",
|
||||
"dots" : true,
|
||||
"icons" : false,
|
||||
},
|
||||
"plugins" : ["themes", "json_data", "checkbox"],
|
||||
"json_data" : {
|
||||
"data" : <?=$this->naf?>,
|
||||
"ajax" : {
|
||||
"url" : '<?=$this->url(array('controller'=>'arborescence', 'action'=>'nafajax', 'key'=> $this->key))?>',
|
||||
"data" : function(n) { return { parent: n.attr ? n.attr("id") : '' , niveau : n.attr ? n.attr("niveau") : 1 }; },
|
||||
"cache" : true,
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
37
application/views/default/scripts/comptage/savedialog.phtml
Normal file
37
application/views/default/scripts/comptage/savedialog.phtml
Normal file
@ -0,0 +1,37 @@
|
||||
<?php if ($this->noSelection): ?>
|
||||
Vous n'avez pas sélectionné de critères !
|
||||
<?php else:?>
|
||||
|
||||
<div id="result">
|
||||
<form method="post" id="save" name="save" action="<?=$this->url(array('controller'=>'comptage', 'action'=>'save'))?>">
|
||||
<label>Votre référence</label>
|
||||
<input type="text" name="ref" value="" />
|
||||
<input type="submit" name="submit" value="Enregistrer">
|
||||
</form>
|
||||
<span class="message" style="color:#ff0000;"></span>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="/themes/default/scripts/jquery.form.js"></script>
|
||||
<script>
|
||||
$('form#save').bind('submit', function(){
|
||||
var options = {
|
||||
target: '#result',
|
||||
dataType: 'json',
|
||||
beforeSubmit: function(){},
|
||||
success: function(data){
|
||||
if (data.error == 0){
|
||||
$('#result').html(data.msg);
|
||||
} else {
|
||||
$('#result span.message').html(data.msg);
|
||||
}
|
||||
}
|
||||
};
|
||||
$(this).ajaxSubmit(options);
|
||||
return false;
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php endif;?>
|
||||
<pre>
|
||||
<?php print_r($this->criteres)?>
|
||||
</pre>
|
20
application/views/default/scripts/criteres/economique.phtml
Normal file
20
application/views/default/scripts/criteres/economique.phtml
Normal file
@ -0,0 +1,20 @@
|
||||
<div id="economique">
|
||||
<div style="display:none" class="error">
|
||||
<div>Erreur :</div>
|
||||
</div>
|
||||
<ul id="fieldsblock">
|
||||
<li><?php echo $this->Field('capital', $this->fields->get('capital'));?></li>
|
||||
<li><?php echo $this->Field('ape_etab', $this->fields->get('ape_etab'));?></li>
|
||||
<li><?php echo $this->Field('ape_entrep', $this->fields->get('ape_entrep'));?></li>
|
||||
<li><?php echo $this->Field('age_entrep', $this->fields->get('age_entrep'));?></li>
|
||||
<li><?php echo $this->Field('age_etab', $this->fields->get('age_etab'));?></li>
|
||||
<li><?php echo $this->Field('teff_entrep', $this->fields->get('teff_entrep'));?></li>
|
||||
<li><?php echo $this->Field('teff_etab', $this->fields->get('teff_etab'));?></li>
|
||||
<li><?php echo $this->Field('eff_entrep', $this->fields->get('eff_entrep'));?></li>
|
||||
<li><?php echo $this->Field('eff_etab', $this->fields->get('eff_etab'));?></li>
|
||||
<li><?php echo $this->Field('nbEtab', $this->fields->get('nbEtab'));?></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div style="text-align:right;margin-top:20px;">
|
||||
<a href="">Réinitialiser les critères entreprises</a>
|
||||
</div>
|
21
application/views/default/scripts/criteres/entreprise.phtml
Normal file
21
application/views/default/scripts/criteres/entreprise.phtml
Normal file
@ -0,0 +1,21 @@
|
||||
<div id="entreprise">
|
||||
<ul id="fieldsblock">
|
||||
<li><?php echo $this->Field('siege', $this->fields->get('siege'));?></li>
|
||||
<li><?php echo $this->Field('sirenGrp', $this->fields->get('sirenGrp'));?></li>
|
||||
<li><?php echo $this->Field('tel', $this->fields->get('tel'));?></li>
|
||||
<li><?php echo $this->Field('fax', $this->fields->get('fax'));?></li>
|
||||
<li><?php echo $this->Field('web', $this->fields->get('web'));?></li>
|
||||
<li><?php echo $this->Field('mail', $this->fields->get('mail'));?></li>
|
||||
<li><?php echo $this->Field('presentRcs', $this->fields->get('presentRcs'));?></li>
|
||||
<li><?php echo $this->Field('adrDom', $this->fields->get('adrDom'));?></li>
|
||||
<li><?php echo $this->Field('dirNom', $this->fields->get('dirNom'));?></li>
|
||||
<li><?php echo $this->Field('nbMPubli', $this->fields->get('nbMPubli'));?></li>
|
||||
<li><?php echo $this->Field('dateCrea_ent',$this->fields->get('dateCrea_ent'));?></li>
|
||||
<li><?php echo $this->Field('dateCrea_etab', $this->fields->get('dateCrea_etab'));?></li>
|
||||
<li><?php echo $this->Field('nbActio', $this->fields->get('nbActio'));?></li>
|
||||
<li><?php echo $this->Field('nbPart', $this->fields->get('nbPart'));?></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="link">
|
||||
<a href="">Réinitialiser les critères entreprises</a>
|
||||
</div>
|
24
application/views/default/scripts/criteres/financiere.phtml
Normal file
24
application/views/default/scripts/criteres/financiere.phtml
Normal file
@ -0,0 +1,24 @@
|
||||
<div id="financiere">
|
||||
<ul id="fieldsblock">
|
||||
<li><?php echo $this->Field('bilType', $this->fields->get('bilType'));?></li>
|
||||
<li><?php echo $this->Field('avisCs', $this->fields->get('avisCs'));?></li>
|
||||
<li><?php echo $this->Field('bilAnnee', $this->fields->get('bilAnnee'));?></li>
|
||||
<li><?php echo $this->Field('bilCloture', $this->fields->get('bilCloture'));?></li>
|
||||
<li><?php echo $this->Field('bilDuree', $this->fields->get('bilDuree'));?></li>
|
||||
<li><?php echo $this->Field('bilTca', $this->fields->get('bilTca'));?></li>
|
||||
<li><?php echo $this->Field('bilEE', $this->fields->get('bilEE'));?></li>
|
||||
<li><?php echo $this->Field('bilFL', $this->fields->get('bilFL'));?></li>
|
||||
<li><?php echo $this->Field('bilFK', $this->fields->get('bilFK'));?></li>
|
||||
<li><?php echo $this->Field('bilFR', $this->fields->get('bilFR'));?></li>
|
||||
<li><?php echo $this->Field('bilGF', $this->fields->get('bilGF'));?></li>
|
||||
<li><?php echo $this->Field('bilGP', $this->fields->get('bilGP'));?></li>
|
||||
<li><?php echo $this->Field('bilGW', $this->fields->get('bilGW'));?></li>
|
||||
<li><?php echo $this->Field('bilHD', $this->fields->get('bilHD'));?></li>
|
||||
<li><?php echo $this->Field('bilHH', $this->fields->get('bilHH'));?></li>
|
||||
<li><?php echo $this->Field('bilHL', $this->fields->get('bilHL'));?></li>
|
||||
<li><?php echo $this->Field('bilHM', $this->fields->get('bilHM'));?></li>
|
||||
<li><?php echo $this->Field('bilHN', $this->fields->get('bilHN'));?></li>
|
||||
<li><?php echo $this->Field('bilYP', $this->fields->get('bilYP'));?></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
@ -0,0 +1,9 @@
|
||||
<div id="geographique">
|
||||
<ul id="fieldsblock">
|
||||
<li><?php echo $this->Field('adr_cp', $this->fields->get('adr_cp'));?></li>
|
||||
<li><?php echo $this->Field('adr_com', $this->fields->get('adr_com'));?></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div style="text-align:right;margin-top:20px;">
|
||||
<a href="">Réinitialiser les critères entreprises</a>
|
||||
</div>
|
12
application/views/default/scripts/criteres/juridique.phtml
Normal file
12
application/views/default/scripts/criteres/juridique.phtml
Normal file
@ -0,0 +1,12 @@
|
||||
<div id="juridique">
|
||||
<ul id="fieldsblock">
|
||||
<li><?php echo $this->Field('cj', $this->fields->get('cj'));?></li>
|
||||
<li><?php echo $this->Field('actifEco', $this->fields->get('actifEco'));?></li>
|
||||
<li><?php echo $this->Field('procolHisto', $this->fields->get('procolHisto'));?></li>
|
||||
<li><?php echo $this->Field('tvaIntraValide', $this->fields->get('tvaIntraValide'));?></li>
|
||||
<li><?php echo $this->Field('dateImmat', $this->fields->get('dateImmat'));?></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div style="text-align:right;margin-top:20px;">
|
||||
<a href="">Réinitialiser les critères entreprises</a>
|
||||
</div>
|
@ -0,0 +1,45 @@
|
||||
<div id="dashboard">
|
||||
|
||||
<div class="chemin">
|
||||
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>''))?>">Tableau de bord</a> >
|
||||
Détail du ciblage
|
||||
</div>
|
||||
|
||||
|
||||
<?php if (empty($this->criteres)){?>
|
||||
|
||||
<p>Aucun ciblage n'a été trouvé avec ces paramètres.</p>
|
||||
|
||||
<?php } else {?>
|
||||
|
||||
<h1>Ciblage <?=$this->criteres['reference']?> (<?=$this->criteres['dateAjout']?>)</h1>
|
||||
|
||||
<h2>Critères</h2>
|
||||
<pre>
|
||||
<?=print_r(json_decode($this->criteres['criteres'], true))?>
|
||||
</pre>
|
||||
|
||||
<h2>Comptages</h2>
|
||||
|
||||
<table style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Resultat</th>
|
||||
<th>Nombre d'unité Insee</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($this->comptages as $comptage):?>
|
||||
<tr>
|
||||
<th><?=$comptage['dateAjout']?></th>
|
||||
<th><?=number_format($comptage['resultat'], 0, '', ' ')?></th>
|
||||
<th><?=number_format($comptage['uniteInsee'], 0, '', ' ')?></th>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php }?>
|
||||
|
||||
</div>
|
47
application/views/default/scripts/dashboard/ciblages.phtml
Normal file
47
application/views/default/scripts/dashboard/ciblages.phtml
Normal file
@ -0,0 +1,47 @@
|
||||
<div id="dashboard">
|
||||
|
||||
<div class="chemin">
|
||||
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>''))?>">Tableau de bord</a> >
|
||||
Liste de vos ciblages
|
||||
</div>
|
||||
|
||||
<div style="margin:5px 0;">
|
||||
<h2>Liste de vos ciblages</h2>
|
||||
|
||||
<?php if(count($this->ciblages)>0):?>
|
||||
|
||||
<table class="ciblage">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Référence</th>
|
||||
<th>Nombre d'entité</th>
|
||||
<th>Unité Insee</th>
|
||||
<th>Date</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($this->ciblages as $item):?>
|
||||
<tr>
|
||||
<td><?=$item['reference']?></td>
|
||||
<td><?=number_format($item['resultat'], 0, ',', ' ')?></td>
|
||||
<td><?=number_format($item['uniteInsee'], 0, ',', ' ')?></td>
|
||||
<td><?=$item['dateComptage']?></td>
|
||||
<td>
|
||||
[<a href="<?=$this->url(array('controller'=> 'dashboard','action'=>'ciblagedetail', 'id'=>$item['id']))?>">Détails</a>] -
|
||||
[<a href="<?=$this->url(array('controller'=> 'index','action'=>'index', 'id'=>$item['id']))?>">Recharger les critères de ciblage</a>] -
|
||||
[<a href="<?=$this->url(array('controller'=> 'comptage','action'=>'update', 'id'=>$item['id']))?>">Actualiser le comptage</a>] -
|
||||
[<a href="<?=$this->url(array('controller'=> 'comptage','action'=>'update', 'id'=>$item['id']))?>">Enrichissement</a>]
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php else:?>
|
||||
<p>Aucun ciblage.<p>
|
||||
<?php endif;?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
@ -0,0 +1,47 @@
|
||||
<div id="dashboard">
|
||||
|
||||
<div class="chemin">
|
||||
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>''))?>">Tableau de bord</a> >
|
||||
Préférences
|
||||
</div>
|
||||
|
||||
<h2>Gestion des profils d'enrichissement</h2>
|
||||
<p>
|
||||
Afin de vous permettre un enrichissement de données à partir d'une liste de SIREN/SIRET,
|
||||
Suivant la configuration de votre compte, vous avez la possibilité de sélectionner les données
|
||||
disponible.
|
||||
</p>
|
||||
<br/>
|
||||
|
||||
<p>Cas profil défini pas S&D</p>
|
||||
<p>- Aucun profil d'enrichissement (Contacter le support)</p>
|
||||
<p>- Liste des profils avec référence, tarifs à la ligne</p>
|
||||
|
||||
<p>Si droits création profil d'enrichissement</p>
|
||||
<p>- Aucun profil d'enrichissement (Sans profil d'enrichissement, vous ne pourrez pas extraire de données)</p>
|
||||
<p>- Liste des profils avec référence, tarifs à la ligne</p>
|
||||
<p> - Créer un profil d'enrichissement (avoir donc un tarifs à la colonne, pour créer le tarif à la ligne)</p>
|
||||
|
||||
<p>Lister les colonnes disponibles (Association SQL/Libellé) pour la configuration<p>
|
||||
|
||||
|
||||
<h2>Gestion des préférences d'affichage</h2>
|
||||
<p>
|
||||
L'application permet la modification de l'affichage des critères de ciblage afin de permettre une
|
||||
utilisation correspondant à vos besoins.
|
||||
</p>
|
||||
<br/>
|
||||
<p>Vous n'avez pas les droits nécessaires pour créer/modifier les préférences d'affichage.</p>
|
||||
<p>Des préférences d'affichage ont été définies pour votre profil client.</p>
|
||||
<br/>
|
||||
<p>Aucune préférences d'affichage définies pour votre profil utilisateur.</p>
|
||||
<p>Des préférences d'affichage ont été définies pour votre profil utilisateur.</p>
|
||||
<br/>
|
||||
<p>
|
||||
<a href="<?=$this->url(array('controller'=>'preferences', 'action'=>'active'))?>"
|
||||
title="Activer le mode personnalisation afin de créer/modifier les préférences d'affichage">
|
||||
Activer le mode personnalisation
|
||||
</a>
|
||||
</p>
|
||||
|
||||
</div>
|
17
application/views/default/scripts/dashboard/exports.phtml
Normal file
17
application/views/default/scripts/dashboard/exports.phtml
Normal file
@ -0,0 +1,17 @@
|
||||
<div id="dashboard">
|
||||
|
||||
<div class="chemin">
|
||||
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>''))?>">Tableau de bord</a> >
|
||||
Enrichissement fichier
|
||||
</div>
|
||||
|
||||
<a href="<?=$this->url(array('controller'=>'enrichissement', 'action'=>'fileform'))?>">Envoyer votre fichier pour enrichissement</a>
|
||||
|
||||
<h2>Fichiers en cours d'enrichissement</h2>
|
||||
|
||||
|
||||
<h2>Fichiers enrichis</h2>
|
||||
|
||||
|
||||
|
||||
</div>
|
56
application/views/default/scripts/dashboard/index.phtml
Normal file
56
application/views/default/scripts/dashboard/index.phtml
Normal file
@ -0,0 +1,56 @@
|
||||
<div id="dashboard">
|
||||
|
||||
<div class="chemin">
|
||||
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>''))?>">Tableau de bord</a>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'ciblages'))?>">Historique de vos ciblages</a> -
|
||||
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'configuration'))?>">Préférences de l'application</a> -
|
||||
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'exports'))?>">Enrichissement fichier</a>
|
||||
</div>
|
||||
|
||||
<div id="rechercheCiblage">
|
||||
<h2>Rechercher dans vos ciblages</h2>
|
||||
<input type="text" name="searchCiblage" class="searchCiblage" />
|
||||
<input type="submit" value="Rechercher" class="submit"/>
|
||||
</div>
|
||||
|
||||
<div id="lastCiblage" style="">
|
||||
<h2>Vos derniers ciblages</h2>
|
||||
<?php if(count($this->comptages)>0):?>
|
||||
|
||||
<table class="ciblage">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Référence</th>
|
||||
<th>Nombre d'entité</th>
|
||||
<th>Unité Insee</th>
|
||||
<th>Date</th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($this->comptages as $item):?>
|
||||
<tr>
|
||||
<td><?=$item['reference']?></td>
|
||||
<td><?=number_format($item['resultat'], 0, ',', ' ')?></td>
|
||||
<td><?=number_format($item['uniteInsee'], 0, ',', ' ')?></td>
|
||||
<td><?=$item['dateComptage']?></td>
|
||||
<td>
|
||||
[<a href="<?=$this->url(array('controller'=> 'index','action'=>'index', 'id'=>$item['id']))?>">Recharger les critères de ciblage</a>] -
|
||||
[<a href="<?=$this->url(array('controller'=> 'comptage','action'=>'update', 'id'=>$item['id']))?>">Actualiser le comptage</a>] -
|
||||
[<a href="<?=$this->url(array('controller'=> 'comptage','action'=>'update', 'id'=>$item['id']))?>">Enrichissement</a>]
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php else:?>
|
||||
<p>Aucun ciblage.<p>
|
||||
<?php endif;?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
@ -0,0 +1 @@
|
||||
<?php
|
@ -0,0 +1,59 @@
|
||||
<div id="enrichissement">
|
||||
|
||||
<div class="chemin">
|
||||
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>''))?>">Tableau de bord</a> >
|
||||
Enrichissement fichier > Envoi d'un fichier
|
||||
</div>
|
||||
|
||||
<h2>Intégration d'un fichier</h2>
|
||||
|
||||
<p>Taille maximale d'un fichier : <?=$this->filesize?></p>
|
||||
|
||||
<form enctype="multipart/form-data" name="sendfile" action="<?=$this->url(array('controller'=>'enrichissement','action'=>'fileupload'))?>" method="post">
|
||||
<input type="hidden" name="APC_UPLOAD_PROGRESS" id="key" value="<?=uniqid()?>"/>
|
||||
|
||||
<div class="fieldgrp">
|
||||
<label>Référence</label>
|
||||
<div class="field"><input type="text" name="ref" /></div>
|
||||
</div>
|
||||
|
||||
<div class="fieldgrp">
|
||||
<label>Fichier</label>
|
||||
<div class="field">
|
||||
<input type="file" id="fichier" name="fichier"/>
|
||||
<input type="submit" value="Envoi"/>
|
||||
|
||||
<div id="progressbar"></div>
|
||||
<div id="output"></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var timer;
|
||||
|
||||
$('form[name=sendfile]').ajaxForm({
|
||||
beforeSubmit: function() {
|
||||
timer = setInterval(checkProgress,200);
|
||||
$('#progressbar').reportprogress(0);
|
||||
$('#output').html('Envoi en cours...');
|
||||
},
|
||||
success: function(data) {
|
||||
clearInterval(timer);
|
||||
$('#progressbar').remove();
|
||||
$('#output').html('<strong>' + data + '</strong>');
|
||||
}
|
||||
});
|
||||
|
||||
function checkProgress() {
|
||||
$.get('<?=$this->url(array('controller'=>'enrichissement', 'action'=>'fileprogress'))?>',
|
||||
{key: $('#key').val()}, function(data) {
|
||||
var percent = data.current/data.total*100;
|
||||
$('#progressbar').reportprogress(percent);
|
||||
}, 'json');
|
||||
}
|
||||
</script>
|
28
application/views/default/scripts/error/error.phtml
Normal file
28
application/views/default/scripts/error/error.phtml
Normal file
@ -0,0 +1,28 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Zend Framework Default Application</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>An error occurred</h1>
|
||||
<h2><?php echo $this->message ?></h2>
|
||||
|
||||
<?php if (isset($this->exception)): ?>
|
||||
|
||||
<h3>Exception information:</h3>
|
||||
<p>
|
||||
<b>Message:</b> <?php echo $this->exception->getMessage() ?>
|
||||
</p>
|
||||
|
||||
<h3>Stack trace:</h3>
|
||||
<pre><?php echo $this->exception->getTraceAsString() ?>
|
||||
</pre>
|
||||
|
||||
<h3>Request Parameters:</h3>
|
||||
<pre><?php echo var_export($this->request->getParams(), true) ?>
|
||||
</pre>
|
||||
<?php endif ?>
|
||||
|
||||
</body>
|
||||
</html>
|
0
application/views/default/scripts/footer.phtml
Normal file
0
application/views/default/scripts/footer.phtml
Normal file
34
application/views/default/scripts/header.phtml
Normal file
34
application/views/default/scripts/header.phtml
Normal file
@ -0,0 +1,34 @@
|
||||
<div id="primaryNavigation" class="clearfix">
|
||||
<ul>
|
||||
<li><a href="<?=$this->url(array('controller'=>'index', 'action'=>'index'), null, true)?>">Accueil</a></li>
|
||||
<li><a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'index'), null, true)?>">Tableau de bord</a></li>
|
||||
<li><a href="<?=$this->url(array('controller'=>'aide', 'action'=>'index'), null, true)?>">Aide</a></li>
|
||||
<li><a href="<?=$this->url(array('controller'=>'aide', 'action'=>'aproposde'), null, true)?>">A propos de</a></li>
|
||||
<li><a href="<?=$this->url(array('controller'=>'user', 'action'=>'logout'), null, true)?>">Déconnexion</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="logo">
|
||||
<h1>Odea</h1>
|
||||
</div>
|
||||
|
||||
<div id="message">
|
||||
<?php if ($this->msgComptage){?>
|
||||
<div id="comptage" >
|
||||
<?php if (!empty($this->total)) {?>
|
||||
Nombre sélectionnées :
|
||||
<span class="valeur"><?=$this->total?></span>
|
||||
(dont <span class="valeur"><?=$this->insee?></span> unité(s) insee)
|
||||
<?php } else {?>
|
||||
Aucune sélection.
|
||||
<?php }?>
|
||||
</div>
|
||||
<div id="attente" style="display:none;">
|
||||
<img src="/themes/default/images/ajax.gif" />
|
||||
</div>
|
||||
<div id="control">
|
||||
[<a href="<?=$this->url(array('controller'=>'index', 'action'=> 'reset'))?>">Initialiser les critères</a>],
|
||||
[<a id="saveciblage" href="<?=$this->url(array('controller'=>'comptage', 'action'=>'savedialog'))?>">Sauvegarder le profil du ciblage</a>]
|
||||
</div>
|
||||
<?php }?>
|
||||
</div>
|
79
application/views/default/scripts/index/criteres.phtml
Normal file
79
application/views/default/scripts/index/criteres.phtml
Normal file
@ -0,0 +1,79 @@
|
||||
<?php if ($this->preferences) {?>
|
||||
|
||||
<h3><a href="#">Entreprise</a></h3>
|
||||
<div>
|
||||
<ul class="critereSelection">
|
||||
<?php foreach($this->fields->getByFamille('entreprise') as $name => $label): ?>
|
||||
<li class="liHover printCritere tooltip" name="<?=$name?>">
|
||||
<a title="<?=$label['label']?>" href="<?=$this->url(array('controller' => 'index', 'action' => 'save', 'name' => $name))?>">
|
||||
<?=$label['label']?>
|
||||
<img src="/themes/default/images/<?=(($label['activated'])?'moins':'ajouter')?>.png" style="float:right"/>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<h3><a href="#">Situation economique</a></h3>
|
||||
<div>
|
||||
<ul class="critereSelection">
|
||||
<?php foreach($this->fields->getByFamille('economique') as $name => $label): ?>
|
||||
<li class="liHover printCritere tooltip" name="<?=$name?>">
|
||||
<a title="<?=$label['label']?>">
|
||||
<?=$label['label']?>
|
||||
<img src="/themes/default/images/<?=(($label['activated'])?'moins':'ajouter')?>.png" style="float:right"/>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<h3><a href="#">Secteur géographique</a></h3>
|
||||
<div>
|
||||
<ul class="critereSelection">
|
||||
<?php foreach($this->fields->getByFamille('geographique') as $name => $label): ?>
|
||||
<li class="liHover printCritere tooltip" name="<?=$name?>">
|
||||
<a title="<?=$label['label']?>">
|
||||
<?=$label['label']?>
|
||||
<img src="/themes/default/images/<?=(($label['activated'])?'moins':'ajouter')?>.png" style="float:right"/>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<h3><a href="#">Situation juridique</a></h3>
|
||||
<div>
|
||||
<ul class="critereSelection">
|
||||
<?php foreach($this->fields->getByFamille('juridique') as $name => $label): ?>
|
||||
<li class="liHover printCritere tooltip" name="<?=$name?>">
|
||||
<a title="<?=$label['label']?>">
|
||||
<?=$label['label']?>
|
||||
<img src="/themes/default/images/<?=(($label['activated'])?'moins':'ajouter')?>.png" style="float:right"/>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<h3><a href="#">Situation financiére</a></h3>
|
||||
<div>
|
||||
<ul class="critereSelection">
|
||||
<?php foreach($this->fields->getByFamille('financier') as $name => $label): ?>
|
||||
<li class="liHover printCritere tooltip" name="<?=$name?>">
|
||||
<a class="tooltip" title="<?=$label['label']?>">
|
||||
<?=$label['label']?>
|
||||
<img src="/themes/default/images/<?=(($label['activated'])?'moins':'ajouter')?>.png" style="float:right"/>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php } else {?>
|
||||
|
||||
<div>
|
||||
<h2>Vos critères</h2>
|
||||
<ul style="padding:5px;">
|
||||
<?php foreach($this->criteres as $critere => $valeur):?>
|
||||
<li><?php echo $critere.':'.$valeur;?></li>
|
||||
<?php endforeach;?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php }?>
|
27
application/views/default/scripts/index/index.phtml
Normal file
27
application/views/default/scripts/index/index.phtml
Normal file
@ -0,0 +1,27 @@
|
||||
<div id="panel">
|
||||
<?=$this->action('criteres', 'index');?>
|
||||
</div>
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
<li><a href="#tabs-1">Critères Entreprise</a></li>
|
||||
<li><a href="#tabs-2">Situation économique</a></li>
|
||||
<li><a href="#tabs-3">Secteur géographique</a></li>
|
||||
<li><a href="#tabs-4">Situation juridique</a></li>
|
||||
<li><a href="#tabs-5">Situation financière</a></li>
|
||||
</ul>
|
||||
<div id="tabs-1">
|
||||
<?=$this->action('entreprise', 'criteres')?>
|
||||
</div>
|
||||
<div id="tabs-2">
|
||||
<?=$this->action('economique', 'criteres')?>
|
||||
</div>
|
||||
<div id="tabs-3">
|
||||
<?=$this->action('geographique', 'criteres')?>
|
||||
</div>
|
||||
<div id="tabs-4">
|
||||
<?=$this->action('juridique', 'criteres')?>
|
||||
</div>
|
||||
<div id="tabs-5">
|
||||
<?=$this->action('financiere', 'criteres')?>
|
||||
</div>
|
||||
</div>
|
23
application/views/default/scripts/main.phtml
Normal file
23
application/views/default/scripts/main.phtml
Normal file
@ -0,0 +1,23 @@
|
||||
<?php echo $this->doctype(); ?>
|
||||
<html>
|
||||
<head>
|
||||
<?php echo $this->headMeta(); ?>
|
||||
<?php echo $this->headTitle(); ?>
|
||||
<?php echo $this->headStyle(); ?>
|
||||
<?php echo $this->headLink(); ?>
|
||||
<?php echo $this->headScript(); ?>
|
||||
</head>
|
||||
<body>
|
||||
<div id="global">
|
||||
<div id="header" class="clearfix">
|
||||
<?php echo $this->render('header.phtml') ?>
|
||||
</div>
|
||||
<div id="content" class="clearfix">
|
||||
<?php echo $this->layout()->content; ?>
|
||||
</div>
|
||||
<div id="footer">
|
||||
<?php echo $this->render('footer.phtml'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
13
application/views/default/scripts/user/login.phtml
Normal file
13
application/views/default/scripts/user/login.phtml
Normal file
@ -0,0 +1,13 @@
|
||||
<?php echo $this->doctype();?>
|
||||
<html>
|
||||
<head>
|
||||
<?php echo $this->headMeta();?>
|
||||
<?php echo $this->headTitle();?>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="<?='http://'.$_SERVER['SERVER_NAME']?>/favicon.ico" />
|
||||
</head>
|
||||
<body>
|
||||
<h2>CONNEXION ODEA</h2>
|
||||
<?=$this->message?>
|
||||
<?=$this->form?>
|
||||
</body>
|
||||
</html>
|
16
application/views/default/scripts/user/logout.phtml
Normal file
16
application/views/default/scripts/user/logout.phtml
Normal file
@ -0,0 +1,16 @@
|
||||
<?php echo $this->doctype();?>
|
||||
<html>
|
||||
<head>
|
||||
<?php echo $this->headMeta();?>
|
||||
<?php echo $this->headTitle();?>
|
||||
</head>
|
||||
<body>
|
||||
<h4 class="logout">Vous avez été déconnecté.</h4>
|
||||
<h5 class="logout">
|
||||
Si cette page ne disparait pas au bout de <?=$this->refresh?> seconde(s),
|
||||
veuillez cliquer <a href="<?=$this->url?>">ici</a>
|
||||
</h5>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
39778
batch/codepostaux.csv
Normal file
39778
batch/codepostaux.csv
Normal file
File diff suppressed because it is too large
Load Diff
110
batch/departements.csv
Normal file
110
batch/departements.csv
Normal file
@ -0,0 +1,110 @@
|
||||
num,libelle,numRegion,codeRegionInsee
|
||||
03,Allier,3,83
|
||||
04,Alpes-de-Haute-Provence,21,93
|
||||
02,Aisne,19,26
|
||||
01,Ain,22,82
|
||||
05,Hautes-Alpes,21,93
|
||||
06,Alpes-Maritimes,21,93
|
||||
07,Ardèche,22,82
|
||||
08,Ardennes,7,21
|
||||
09,Ariège,15,73
|
||||
10,Aube,7,21
|
||||
11,Aude,11,91
|
||||
12,Aveyron,15,73
|
||||
13,Bouches-du-Rhône,21,93
|
||||
14,Calvados,18,25
|
||||
15,Cantal,3,83
|
||||
16,Charente,20,54
|
||||
17,Charente-Maritime,20,54
|
||||
18,Cher,6,24
|
||||
19,Corrèze,12,74
|
||||
2A,Corse-du-Sud,8,94
|
||||
20,Corse,8,94
|
||||
21,Côte-d'Or,4,26
|
||||
22,Côtes-d'Armor,5,53
|
||||
23,Creuse,12,74
|
||||
24,Dordogne,2,72
|
||||
25,Doubs,9,43
|
||||
26,Drôme,22,82
|
||||
27,Eure,17,23
|
||||
28,Eure-et-Loir,6,24
|
||||
29,Finistère,5,53
|
||||
30,Gard,11,91
|
||||
33,Gironde,2,72
|
||||
32,Gers,15,73
|
||||
34,Hérault,11,91
|
||||
31,Haute-Garonne,15,73
|
||||
36,Indre,6,24
|
||||
37,Indre-et-Loire,6,24
|
||||
35,Ille-et-Vilaine,5,53
|
||||
39,Jura,9,43
|
||||
38,Isère,22,82
|
||||
40,Landes,2,72
|
||||
41,Loir-et-Cher,6,24
|
||||
42,Loire,22,82
|
||||
43,Haute-Loire,3,83
|
||||
44,Loire-Atlantique,13,52
|
||||
45,Loiret,6,24
|
||||
46,Lot,15,73
|
||||
47,Lot-et-Garonne,2,72
|
||||
48,Lozère,11,91
|
||||
49,Maine-et-Loire,13,52
|
||||
53,Mayenne,13,52
|
||||
51,Marne,7,21
|
||||
50,Manche,18,25
|
||||
52,Haute-Marne,7,21
|
||||
54,Meurthe-et-Moselle,14,41
|
||||
56,Morbihan,5,53
|
||||
55,Meuse,14,41
|
||||
57,Moselle,14,41
|
||||
58,Nièvre,4,26
|
||||
59,Nord,16,31
|
||||
60,Oise,19,26
|
||||
62,Pas-de-Calais,16,31
|
||||
61,Orne,18,25
|
||||
63,Puy-de-Dôme,3,83
|
||||
67,Bas-Rhin,1,42
|
||||
68,Haut-Rhin,1,42
|
||||
69,Rhône,22,82
|
||||
64,Pyrénées-Atlantiques,2,72
|
||||
65,Hautes-Pyrénées,15,73
|
||||
66,Pyrénées-Orientales,11,91
|
||||
70,Haute-Saône,9,43
|
||||
71,Saône-et-Loire,4,26
|
||||
72,Sarthe,13,52
|
||||
73,Savoie,22,82
|
||||
74,Haute-Savoie,22,82
|
||||
75,Paris,10,11
|
||||
76,Seine-Maritime,17,23
|
||||
77,Seine-et-Marne,10,11
|
||||
78,Yvelines,10,11
|
||||
79,Deux-Sèvres,20,54
|
||||
80,Somme,19,26
|
||||
81,Tarn,15,73
|
||||
82,Tarn-et-Garonne,15,73
|
||||
83,Var,21,93
|
||||
84,Vaucluse,21,93
|
||||
85,Vendée,13,52
|
||||
86,Vienne,20,54
|
||||
87,Haute-Vienne,12,74
|
||||
88,Vosges,14,41
|
||||
89,Yonne,4,26
|
||||
90,"Territoire de Belfort",9,43
|
||||
91,Essonne,10,11
|
||||
92,Hauts-de-Seine,10,11
|
||||
93,Seine-Saint-Denis,10,11
|
||||
94,Val-de-Marne,10,11
|
||||
95,Val-d'Oise,10,11
|
||||
971,Guadeloupe,23,1
|
||||
972,Martinique,23,2
|
||||
973,Guyane,23,3
|
||||
974,Réunion,24,4
|
||||
200,Corse-du-Sud,8,94
|
||||
201,Corse-du-Sud,8,94
|
||||
202,Haute-Corse,8,94
|
||||
976,Mayotte,0,0
|
||||
988,Nouvelle-Calédonie,0,0
|
||||
987,Polynésie-Française,0,0
|
||||
975,Saint-Pierre-et-Miquelon,0,0
|
||||
986,Wallis-et-Futuna,0,0
|
||||
2B,Haute-Corse,8,94
|
|
323
batch/formejuridique.csv
Normal file
323
batch/formejuridique.csv
Normal file
@ -0,0 +1,323 @@
|
||||
fjCode,fjLibelle,fjInsee
|
||||
0,Indéterminée,0
|
||||
1,"Personne physique",1
|
||||
2,"Groupement de droit privé non doté de la personnalité morale",1
|
||||
3,"Personne morale de droit étranger",1
|
||||
4,"Personne morale de droit public soumise au droit commercial",1
|
||||
5,"Société commerciale",1
|
||||
6,"Autre personne morale immatriculée au RCS",1
|
||||
7,"Personne morale et organisme soumis au droit administratif",1
|
||||
8,"Organisme privé spécialisé",1
|
||||
9,"Groupement de droit privé",1
|
||||
11,"Artisan Commerçant",1
|
||||
12,Commerçant,1
|
||||
13,Artisan,1
|
||||
14,"Officier public ou ministériel",1
|
||||
15,"Profession libérale",1
|
||||
16,"Exploitant agricole",1
|
||||
17,"Agent commercial",1
|
||||
18,"Associé Gérant de société",1
|
||||
19,"(Autre) personne physique",1
|
||||
21,Indivision,1
|
||||
22,"Société créée de fait",1
|
||||
23,"Société en participation",1
|
||||
27,"Paroisse hors zone concordataire",1
|
||||
29,"Autre groupement de droit privé non doté de la personnalité morale",1
|
||||
31,"Personne morale de droit étranger, immatriculée au RCS (registre du commerce et des sociétés)",1
|
||||
32,"Personne morale de droit étranger, non immatriculée au RCS",1
|
||||
41,"Établissement public ou régie à caractère industriel ou commercial",1
|
||||
51,"Société coopérative commerciale particulière",1
|
||||
52,"Société en nom collectif",1
|
||||
53,"Société en commandite",1
|
||||
54,"Société à responsabilité limité",1
|
||||
55,"Société anonyme à conseil d'administration",1
|
||||
56,"Société anonyme à directoire",1
|
||||
57,"Société par actions simplifiée",1
|
||||
61,"Caisse d'épargne et de prévoyance",1
|
||||
62,"Groupement d'intérêt économique",1
|
||||
63,"Société coopérative agricole",1
|
||||
64,"Société d'assurance mutuelle",1
|
||||
65,"Société civile",1
|
||||
69,"Autre personne morale de droit privé inscrite au registre du commerce et des sociétés",1
|
||||
71,"Administration de l'état",1
|
||||
72,"Collectivité territoriale",1
|
||||
73,"Établissement public administratif",1
|
||||
74,"Autre personne morale de droit public administratif",1
|
||||
81,"Organisme gérant un régime de protection sociale à adhésion obligatoire",1
|
||||
82,"Organisme mutualiste",1
|
||||
83,"Comité d'entreprise",1
|
||||
84,"Organisme professionnel",1
|
||||
91,"Syndicat de propriétaires",1
|
||||
92,"Association loi 1901 ou assimilé",1
|
||||
93,Fondation,1
|
||||
99,"Autre personne morale de droit privé",1
|
||||
1000,"Entrepreneur Individuel à Responsabilité Limité",0
|
||||
1100,"Artisan Commerçant",1
|
||||
1200,Commerçant,1
|
||||
1300,Artisan,1
|
||||
1400,"Officier public ou ministériel",1
|
||||
1500,"Profession libérale",1
|
||||
1600,"Exploitant agricole",1
|
||||
1700,"Agent commercial",1
|
||||
1800,"Associé Gérant de société",1
|
||||
1900,"(Autre) personne physique",1
|
||||
2100,Indivision,0
|
||||
2110,"Indivision entre personnes physiques",1
|
||||
2120,"Indivision avec personne morale",1
|
||||
2200,"Société créée de fait",0
|
||||
2210,"Société créée de fait entre personnes physiques",1
|
||||
2220,"Société créée de fait avec personne morale",1
|
||||
2300,"Société en participation",0
|
||||
2310,"Société en participation entre personnes physiques",1
|
||||
2320,"Société en participation avec personne morale",1
|
||||
2385,"Société en participation de professions libérales",1
|
||||
2400,Fiducie,1
|
||||
2700,"Paroisse hors zone concordataire",1
|
||||
2900,"Autre groupement de droit privé non doté de la personnalité morale",1
|
||||
3110,"Représentation ou agence commerciale d'état ou organisme public étranger immatriculé au RCS",1
|
||||
3120,"Société étrangère immatriculée au RCS",1
|
||||
3205,"Organisation internationale",1
|
||||
3210,"État collectivité ou établissement public étranger",1
|
||||
3220,"Société étrangère non immatriculée au RCS",1
|
||||
3290,"(Autre) personne morale de droit étranger",1
|
||||
4110,"Établissement public national à caractère industriel ou commercial doté d'un comptable public",1
|
||||
4120,"Établissement public national à caractère industriel ou commercial non doté d'un comptable public",1
|
||||
4130,"Exploitant public",1
|
||||
4140,"Établissement public local à caractère industriel ou commercial",1
|
||||
4150,"Régie d'une collectivité locale à caractère industriel ou commercial",1
|
||||
4160,"Institution Banque de France",1
|
||||
5191,"Société de caution mutuelle",1
|
||||
5192,"Société coopérative de banque populaire",1
|
||||
5193,"Caisse de crédit maritime mutuel",1
|
||||
5194,"Caisse (fédérale) de crédit mutuel",1
|
||||
5195,"Association coopérative inscrite ( droit local Alsace Moselle )",1
|
||||
5196,"Caisse d'épargne et de prévoyance à forme coopérative",1
|
||||
5202,"Société en nom collectif",1
|
||||
5203,"Société en nom collectif coopérative",1
|
||||
5306,"Société en commandite simple",1
|
||||
5307,"Société en commandite simple coopérative",1
|
||||
5308,"Société en commandite par actions",1
|
||||
5309,"Société en commandite par actions coopérative",1
|
||||
5385,"Société d'exercice libéral en commandite par action",1
|
||||
5410,"SARL nationale",1
|
||||
5415,"SARL d'économie mixte",1
|
||||
5422,"SARL immobilière pour le commerce et l'industrie (SICOMI)",1
|
||||
5426,"Société immobilière de gestion",1
|
||||
5430,"Safer en SARL",1
|
||||
5431,"SARL mixte d'intérêt agricole",1
|
||||
5432,"SARL d'intérêt collectif agricole",1
|
||||
5442,"SARL d'attribution",1
|
||||
5443,"SARL coopérative de construction",1
|
||||
5451,"SARL coopérative de consommation",1
|
||||
5453,"SARL coopérative artisanale",1
|
||||
5454,"SARL coopérative d'intérêt maritime",1
|
||||
5455,"SARL coopérative de transports",1
|
||||
5458,"SARL coopérative ouvrière de production et de crédit",1
|
||||
5459,"SARL union de sociétés coopératives",1
|
||||
5460,"Autre SARL coopérative",1
|
||||
5485,"Société d'exercice libéral à responsabilité limitée",1
|
||||
5488,"Entreprise Unipersonnelle à Responsabilité Limitée",1
|
||||
5498,"SARL unipersonnelle",1
|
||||
5499,"Autre société à responsabilité limitée",1
|
||||
5505,"SA à participation ouvrière à conseil d'administration",1
|
||||
5510,"SA nationale à conseil d'administration",1
|
||||
5515,"SA d'économie mixte à conseil d'administration",1
|
||||
5520,"Société d'investissement à capital variable (SICAV) à conseil d'administration",1
|
||||
5522,"Société anonyme immobilière pour le commerce et l'industrie (SICOMI) à conseil d'administration",1
|
||||
5525,"Société anonyme immobilière d'investissement à conseil d'administration",1
|
||||
5530,"Safer anonyme à conseil d'administration",1
|
||||
5531,"Société anonyme mixte d'intérêt agricole (SMIA) à conseil d'administration",1
|
||||
5532,"Société anonyme mixte d'intérêt collectif agricole (SICA) à conseil d'administration",1
|
||||
5542,"Société anonyme d'attribution à conseil d'administration",1
|
||||
5543,"Société anonyme coopérative de construction à conseil d'administration",1
|
||||
5546,"SA de HLM à conseil d'administration",1
|
||||
5547,"SA coopérative de production de HLM à conseil d'administration",1
|
||||
5548,"SA de crédit immobilier à conseil d'administration",1
|
||||
5551,"SA coopérative de consommation à conseil d'administration",1
|
||||
5552,"SA coopérative de commerçants détaillants à conseil d'administration",1
|
||||
5553,"SA coopérative artisanale à conseil d'administration",1
|
||||
5554,"SA coopérative (d'intérêt) maritime à conseil d'administration",1
|
||||
5555,"SA coopérative de transports à conseil d'administration",1
|
||||
5558,"SA coopérative ouvrière de production et de crédit (SCOP) à conseil d'administration",1
|
||||
5559,"SA union de sociétés coopératives à conseil d'administration",1
|
||||
5560,"Autre SA coopérative à conseil d'administration",1
|
||||
5585,"Société d'exercice libéral à forme anonyme à conseil d'administration",1
|
||||
5599,"Autre SA à conseil d'administration",1
|
||||
5605,"SA à participation ouvrière à directoire",1
|
||||
5610,"SA nationale à directoire",1
|
||||
5615,"SA d'économie mixte à directoire",1
|
||||
5620,"Société d'investissement à capital variable (SICAV) à directoire",1
|
||||
5622,"Société immobilière pour le commerce et l'industrie (SICOMI) anonyme à directoire",1
|
||||
5625,"Société immobilière d'investissement anonyme à directoire",1
|
||||
5630,"Safer anonyme à directoire",1
|
||||
5631,"Société anonyme mixte d'intérêt agricole",1
|
||||
5632,"Société anonyme d'intérêt collectif agricole",1
|
||||
5642,"Société anonyme d'attribution à directoire",1
|
||||
5643,"Société anonyme coopérative de construction à directoire",1
|
||||
5646,"Société anonyme de HLM à directoire",1
|
||||
5647,"Société coopérative de production de HLM anonyme à directoire",1
|
||||
5648,"SA de crédit immobilier à directoire",1
|
||||
5651,"SA coopérative de consommation à directoire",1
|
||||
5652,"SA coopérative de commerçants détaillants à directoire",1
|
||||
5653,"SA coopérative artisanale à directoire",1
|
||||
5654,"SA coopérative (d'intérêt) maritime à directoire",1
|
||||
5655,"SA coopérative de transport à directoire",1
|
||||
5658,"SA coopérative ouvrière de production et de crédit (SCOP) à directoire",1
|
||||
5659,"SA union de sociétés coopératives à directoire",1
|
||||
5660,"(Autre) SA coopérative à directoire",1
|
||||
5685,"Société d'exercice libéral à forme anonyme à directoire",1
|
||||
5699,"Autre SA à directoire",1
|
||||
5710,"Société par actions simplifiée",1
|
||||
5720,"Société par actions simplifiée à associé unique ou société par actions simplifiée unipersonnelle",1
|
||||
5785,"Société d’exercice libéral par action simplifiée",1
|
||||
5800,"Société européenne",1
|
||||
6100,"Caisse d’épargne et de prévoyance",1
|
||||
6200,"Groupement d'intérêt économique",0
|
||||
6210,"Groupement européen d’intérêt économique",1
|
||||
6220,"Groupement d’intérêt économique",1
|
||||
6316,"Coopérative d’utilisation de matériel agricole en commun",1
|
||||
6317,"Société coopérative agricole",1
|
||||
6318,"Union de sociétés coopératives agricoles",1
|
||||
6411,"Société d’assurance mutuelle",1
|
||||
6412,"Société mutuelle d'assurance",1
|
||||
6413,"Union de sociétés mutuelles d'assurances",1
|
||||
6414,"Autre société non commerciale d'assurance",1
|
||||
6521,"Société civile de placement collectif immobilier",1
|
||||
6532,"Société civile d’intérêt collectif agricole",1
|
||||
6533,"Groupement agricole d’exploitation en commun",1
|
||||
6534,"Groupement foncier agricole",1
|
||||
6535,"Groupement agricole foncier",1
|
||||
6536,"Groupement forestier",1
|
||||
6537,"Groupement pastoral",1
|
||||
6538,"Groupement foncier rural",1
|
||||
6539,"Société civile foncière",1
|
||||
6540,"Société civile immobilière",1
|
||||
6541,"Société civile immobilière de construction vente",1
|
||||
6542,"Société civile d’attribution",1
|
||||
6543,"Société civile coopérative de construction",1
|
||||
6544,"Société immobilière d'accession progressive à la propriété",1
|
||||
6551,"Société civile coopérative de consommation",1
|
||||
6554,"Société civile coopérative (d’intérêt) maritime",1
|
||||
6558,"Société civile coopérative entre médecins",1
|
||||
6560,"Autre société civile coopérative",1
|
||||
6561,"SCP d’avocats",1
|
||||
6562,"SCP d’avocats aux conseil",1
|
||||
6563,"SCP d’avoués d’appel",1
|
||||
6564,"SCP d’huissiers",1
|
||||
6565,"SCP de notaires",1
|
||||
6566,"SCP de commissaires-priseurs",1
|
||||
6567,"SCP de greffiers de tribunal de commerce",1
|
||||
6568,"SCP de conseils juridiques",1
|
||||
6569,"SCP de commissaires aux comptes",1
|
||||
6571,"SCP de médecins",1
|
||||
6572,"SCP de dentistes",1
|
||||
6573,"SCP d’infirmiers",1
|
||||
6574,"SCP de masseurs kinésithérapeutes",1
|
||||
6575,"SCP de directeurs de laboratoire d’analyse médicale",1
|
||||
6576,"SCP de vétérinaires",1
|
||||
6577,"SCP de géomètres-experts",1
|
||||
6578,"SCP d’architectes",1
|
||||
6585,"(Autres) Société Civile professionnelle",1
|
||||
6588,"Société civile laitière",0
|
||||
6589,"Société civile de moyens",1
|
||||
6595,"Caisse (locale) de crédit mutuel",1
|
||||
6596,"Caisse de crédit agricole mutuel",1
|
||||
6597,"Société civile d’exploitation agricole",1
|
||||
6598,"Exploitation agricole à responsabilité limitée",1
|
||||
6599,"Autre société civile",1
|
||||
6901,"Autres personnes de droit privé inscrites au registre du commerce et des sociétés",1
|
||||
7111,"Autorité constitutionnelle",1
|
||||
7112,"Autorité administrative indépendante",1
|
||||
7113,Ministère,1
|
||||
7120,"Service central d’un ministère",1
|
||||
7130,"Service du ministère des Postes et Télécommunications",1
|
||||
7150,"Service du ministère de la Défense",1
|
||||
7160,"Service déconcentré à compétence nation. D’un ministère (hors Défense)",1
|
||||
7171,"Service déconcentré de l’État à compétence (inter) régionale",1
|
||||
7172,"Service déconcentré de l’État à compétence (inter) départementale",1
|
||||
7179,"(Autre) Service déconcentré de l’État à compétence territoriale",1
|
||||
7190,"Ecole nationale non dotée de la personnalité morale",1
|
||||
7210,Commune,1
|
||||
7220,Département,1
|
||||
7225,"Territoire d’Outre-mer",1
|
||||
7229,"(Autre) Collectivité territoriale",1
|
||||
7230,Région,1
|
||||
7312,"Commune associée",1
|
||||
7313,"Section de commune",1
|
||||
7314,"Ensemble urbain",1
|
||||
7321,"Association syndicale autorisée",1
|
||||
7322,"Association foncière urbaine",1
|
||||
7323,"Association foncière de remembrement",1
|
||||
7331,"Établissement public local d’enseignement",1
|
||||
7341,"Secteur de commune",1
|
||||
7342,"District urbain",1
|
||||
7343,"Communauté urbaine",1
|
||||
7345,"Syndicat intercommunal à vocation multiple",1
|
||||
7346,"Communauté de communes",1
|
||||
7347,"Communauté de villes",1
|
||||
7348,"Communauté d'agglomération",1
|
||||
7349,"Autre établissement public local de coopération non spécialisé ou entente",1
|
||||
7351,"Institution interdépartemental ou entente",1
|
||||
7352,"Institution interrégionale ou entente",1
|
||||
7353,"Syndicat intercommunal à vocation unique",1
|
||||
7354,"Syndicat mixte communal",1
|
||||
7355,"Autre syndicat mixte",1
|
||||
7356,"Commission syndicale pour la gestion des biens indivis des communes",1
|
||||
7361,"Centre communal d'action sociale",1
|
||||
7362,"Caisse des écoles",1
|
||||
7363,"Caisse de crédit municipal",1
|
||||
7364,"Établissement d'hospitalisation",1
|
||||
7365,"Syndicat inter hospitalier",1
|
||||
7366,"Établissement public local social et médico-social",1
|
||||
7371,"Office public d'habitation à loyer modéré",1
|
||||
7372,"Service départemental d'incendie",1
|
||||
7373,"Établissement public local culturel",1
|
||||
7378,"Régie d'une collectivité locale à caractère administratif",1
|
||||
7379,"(Autre) Établissement public administratif local",1
|
||||
7381,"Organisme consulaire",1
|
||||
7382,"Établissement public national ayant fonction d'administration centrale",1
|
||||
7383,"Établissement public national à caractère scientifique culturel et professionnel",1
|
||||
7384,"Autre établissement public national d'enseignement",1
|
||||
7385,"Autre établissement public national administratif à compétence territoriale limitée",1
|
||||
7389,"Établissement public national à caractère administratif",1
|
||||
7410,"Groupement d'intérêt public",1
|
||||
7430,"Établissement public des cultes d'Alsace-Lorraine",1
|
||||
7450,"Etablissement public administratif, cercle et foyer dans les armées",1
|
||||
7470,"Groupement de coopération sanitaire à gestion publique",1
|
||||
7490,"Autre personne morale de droit administratif",1
|
||||
7510,"Service d'une collectivité locale à comptabilité distincte",1
|
||||
7520,"Régie d'une collectivité locale non dotée de la personnalité morale",1
|
||||
8110,"Régime général de la sécurité sociale",1
|
||||
8120,"Régime spécial de sécurité sociale",1
|
||||
8130,"Institution de retraite complémentaire",1
|
||||
8140,"Mutualité sociale agricole",1
|
||||
8150,"Régime maladie des non-salariés non agricoles",1
|
||||
8160,"Régime vieillesse ne dépendant pas du régime général de la sécurité sociale",1
|
||||
8170,"Régime d'assurance chômage",1
|
||||
8190,"Autre régime de prévoyance sociale",1
|
||||
8210,Mutuelle,1
|
||||
8250,"Assurance mutuelle agricole",1
|
||||
8290,"Autre organisme mutualiste",1
|
||||
8310,"Comité central d'entreprise",1
|
||||
8311,"Comité d'établissement",1
|
||||
8410,"Syndicat de salariés",1
|
||||
8420,"Syndicat patronal",1
|
||||
8450,"Ordre professionnel ou assimilé",1
|
||||
8470,"Centre technique industriel ou comité professionnel du développement économique",1
|
||||
8490,"Autre organisme professionnel",1
|
||||
8510,"Institution de prévoyance",1
|
||||
8520,"Institution de retraite supplémentaire ",1
|
||||
9110,"Syndicat de copropriété",1
|
||||
9150,"Association syndicale libre",1
|
||||
9210,"Association non déclarée",1
|
||||
9220,"Association déclarée",1
|
||||
9221,"Association déclarée ""entreprises d'insertion par l'économique""",1
|
||||
9222,"Association intermédiaire",1
|
||||
9223,"Groupement d'employeurs",1
|
||||
9224,"Association d'avocats à responsabilité professionnelle individuelle",1
|
||||
9230,"Association déclarée reconnue d'utilité publique",1
|
||||
9240,Congrégation,1
|
||||
9260,"Association de droit local",1
|
||||
9300,Fondation,1
|
||||
9900,"Autre personne morale de droit privé",1
|
||||
9970,"Groupement de coopération sanitaire à gestion privée",1
|
|
110
batch/getDataCSV.php
Normal file
110
batch/getDataCSV.php
Normal file
@ -0,0 +1,110 @@
|
||||
#!/usr/bin/php -q
|
||||
<?php
|
||||
// Define path to application directory
|
||||
defined('APPLICATION_PATH')
|
||||
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
|
||||
|
||||
// Define application environment
|
||||
defined('APPLICATION_ENV')
|
||||
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
|
||||
|
||||
// Ensure library/ is on include_path
|
||||
set_include_path(implode(PATH_SEPARATOR, array(
|
||||
realpath(APPLICATION_PATH . '/../library'),
|
||||
get_include_path(),
|
||||
)));
|
||||
|
||||
/** Zend_Application */
|
||||
require_once 'Zend/Application.php';
|
||||
|
||||
// Create application, bootstrap, and run
|
||||
$application = new Zend_Application(
|
||||
APPLICATION_ENV,
|
||||
APPLICATION_PATH . '/configs/application.ini'
|
||||
);
|
||||
|
||||
$configuration = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini');
|
||||
Zend_Registry::set('configuration', $configuration);
|
||||
|
||||
try {
|
||||
$opts = new Zend_Console_Getopt(
|
||||
//Options
|
||||
array(
|
||||
'help|?' => "Affiche l'aide.",
|
||||
'all' => "Charge tout les éléments",
|
||||
'one' => "Charge un élément",
|
||||
)
|
||||
);
|
||||
$opts->parse();
|
||||
} catch (Zend_Console_Getopt_Exception $e) {
|
||||
echo $e->getUsageMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
//Usage
|
||||
if(count($opts->getOptions())==0 || isset($opts->help))
|
||||
{
|
||||
echo "Charge les données nécessaire à l'applicatioon à partir du webservice.";
|
||||
echo "\n\n";
|
||||
echo $opts->getUsageMessage();
|
||||
echo "\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
//Utilisateur webservice
|
||||
define('LOGIN', '');
|
||||
define('PASSWORD', '');
|
||||
|
||||
$args = $opts->getRemainingArgs();
|
||||
$elements = array('naf');
|
||||
|
||||
if ($opts->all || $opts->one){
|
||||
require_once 'Scores/WsScores.php';
|
||||
$ws = new WsScores(LOGIN, PASSWORD);
|
||||
}
|
||||
|
||||
if ($opts->all)
|
||||
{
|
||||
foreach($elements as $element)
|
||||
{
|
||||
$reponse = $ws->getDataCSV($element);
|
||||
}
|
||||
|
||||
} elseif ($opts->one) {
|
||||
//Vérification
|
||||
$element = $args[0];
|
||||
if (!in_array($args[0], $elements)){
|
||||
echo 'Element inconnu !';
|
||||
}
|
||||
$reponse = $ws->getDataCSV($element);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Méthodes interne
|
||||
|
||||
function getFichier($url)
|
||||
{
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
|
||||
curl_setopt($ch, CURLOPT_COOKIEFILE,TRUE);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
|
||||
$output = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
return $output;
|
||||
}
|
||||
|
||||
function saveToDatabase($key, $filename)
|
||||
{
|
||||
//Vider la table
|
||||
$sql = "TRUNCATE $key";
|
||||
|
||||
//Sauvegarder toutes les lignes
|
||||
$cmd = "mysqlimport --ignore-lines=1 --fields-enclosed-by=\\\" --fields-terminated-by=, --user=USERNAME --password=PASSWORD ciblage $filename";
|
||||
exec($command);
|
||||
}
|
||||
|
||||
|
||||
?>
|
1478
batch/naf.csv
Normal file
1478
batch/naf.csv
Normal file
File diff suppressed because it is too large
Load Diff
29
batch/regions.csv
Normal file
29
batch/regions.csv
Normal file
@ -0,0 +1,29 @@
|
||||
code,libelle
|
||||
01,GUADELOUPE
|
||||
02,MARTINIQUE
|
||||
03,GUYANE
|
||||
04,"LA REUNION"
|
||||
11,ILE-DE-FRANCE
|
||||
21,CHAMPAGNE-ARDENNE
|
||||
22,PICARDIE
|
||||
23,HAUTE-NORMANDIE
|
||||
24,CENTRE
|
||||
25,BASSE-NORMANDIE
|
||||
26,BOURGOGNE
|
||||
31,NORD-PAS-DE-CALAIS
|
||||
41,LORRAINE
|
||||
42,ALSACE
|
||||
43,FRANCHE-COMTE
|
||||
52,"PAYS DE LA LOIRE"
|
||||
53,BRETAGNE
|
||||
54,POITOU-CHARENTES
|
||||
72,AQUITAINE
|
||||
73,MIDI-PYRENEES
|
||||
74,LIMOUSIN
|
||||
82,RHONE-ALPES
|
||||
83,AUVERGNE
|
||||
91,LANGUEDOC-ROUSSILLON
|
||||
93,"PROVENCE-ALPES-COTE D'AZUR"
|
||||
94,CORSE
|
||||
98,"TERRITOIRES D'OUTRE-MER"
|
||||
99,ETRANGER
|
|
39830
config/_sql/codepostaux.sql
Normal file
39830
config/_sql/codepostaux.sql
Normal file
File diff suppressed because it is too large
Load Diff
9
config/_sql/comptages.sql
Normal file
9
config/_sql/comptages.sql
Normal file
@ -0,0 +1,9 @@
|
||||
CREATE TABLE IF NOT EXISTS `comptages` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`idDefinition` int(11) NOT NULL,
|
||||
`resultat` int(11) NOT NULL,
|
||||
`uniteInsee` int(11) NOT NULL,
|
||||
`tarif` varchar(20) NOT NULL,
|
||||
`dateAjout` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARSET=utf8 COMMENT='Résultat des comptages' AUTO_INCREMENT=1 ;
|
12
config/_sql/criteres.sql
Normal file
12
config/_sql/criteres.sql
Normal file
@ -0,0 +1,12 @@
|
||||
CREATE TABLE IF NOT EXISTS `criteres` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`idClient` int(11) NOT NULL,
|
||||
`login` varchar(20) NOT NULL,
|
||||
`reference` varchar(50) NOT NULL,
|
||||
`criteres` longtext NOT NULL,
|
||||
`parent` int(11) NOT NULL,
|
||||
`dateAjout` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `reference` (`reference`),
|
||||
KEY `login` (`login`)
|
||||
) DEFAULT CHARSET=utf8 COMMENT='Sauvegarde des critères pour les comptages' AUTO_INCREMENT=1 ;
|
126
config/_sql/departements.sql
Normal file
126
config/_sql/departements.sql
Normal file
@ -0,0 +1,126 @@
|
||||
--
|
||||
-- Structure de la table `departements`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `departements` (
|
||||
`numdep` char(3) NOT NULL DEFAULT '0',
|
||||
`libdep` varchar(30) NOT NULL DEFAULT '',
|
||||
`numreg` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`codeRegionInsee` tinyint(2) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`numdep`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- Contenu de la table `departements`
|
||||
--
|
||||
|
||||
INSERT INTO `departements` (`numdep`, `libdep`, `numreg`, `codeRegionInsee`) VALUES
|
||||
('03', 'Allier', 3, 83),
|
||||
('04', 'Alpes-de-Haute-Provence', 21, 93),
|
||||
('02', 'Aisne', 19, 26),
|
||||
('01', 'Ain', 22, 82),
|
||||
('05', 'Hautes-Alpes', 21, 93),
|
||||
('06', 'Alpes-Maritimes', 21, 93),
|
||||
('07', 'Ardèche', 22, 82),
|
||||
('08', 'Ardennes', 7, 21),
|
||||
('09', 'Ariège', 15, 73),
|
||||
('10', 'Aube', 7, 21),
|
||||
('11', 'Aude', 11, 91),
|
||||
('12', 'Aveyron', 15, 73),
|
||||
('13', 'Bouches-du-Rhône', 21, 93),
|
||||
('14', 'Calvados', 18, 25),
|
||||
('15', 'Cantal', 3, 83),
|
||||
('16', 'Charente', 20, 54),
|
||||
('17', 'Charente-Maritime', 20, 54),
|
||||
('18', 'Cher', 6, 24),
|
||||
('19', 'Corrèze', 12, 74),
|
||||
('2A', 'Corse-du-Sud', 8, 94),
|
||||
('20', 'Corse', 8, 94),
|
||||
('21', 'Côte-d''Or', 4, 26),
|
||||
('22', 'Côtes-d''Armor', 5, 53),
|
||||
('23', 'Creuse', 12, 74),
|
||||
('24', 'Dordogne', 2, 72),
|
||||
('25', 'Doubs', 9, 43),
|
||||
('26', 'Drôme', 22, 82),
|
||||
('27', 'Eure', 17, 23),
|
||||
('28', 'Eure-et-Loir', 6, 24),
|
||||
('29', 'Finistère', 5, 53),
|
||||
('30', 'Gard', 11, 91),
|
||||
('33', 'Gironde', 2, 72),
|
||||
('32', 'Gers', 15, 73),
|
||||
('34', 'Hérault', 11, 91),
|
||||
('31', 'Haute-Garonne', 15, 73),
|
||||
('36', 'Indre', 6, 24),
|
||||
('37', 'Indre-et-Loire', 6, 24),
|
||||
('35', 'Ille-et-Vilaine', 5, 53),
|
||||
('39', 'Jura', 9, 43),
|
||||
('38', 'Isère', 22, 82),
|
||||
('40', 'Landes', 2, 72),
|
||||
('41', 'Loir-et-Cher', 6, 24),
|
||||
('42', 'Loire', 22, 82),
|
||||
('43', 'Haute-Loire', 3, 83),
|
||||
('44', 'Loire-Atlantique', 13, 52),
|
||||
('45', 'Loiret', 6, 24),
|
||||
('46', 'Lot', 15, 73),
|
||||
('47', 'Lot-et-Garonne', 2, 72),
|
||||
('48', 'Lozère', 11, 91),
|
||||
('49', 'Maine-et-Loire', 13, 52),
|
||||
('53', 'Mayenne', 13, 52),
|
||||
('51', 'Marne', 7, 21),
|
||||
('50', 'Manche', 18, 25),
|
||||
('52', 'Haute-Marne', 7, 21),
|
||||
('54', 'Meurthe-et-Moselle', 14, 41),
|
||||
('56', 'Morbihan', 5, 53),
|
||||
('55', 'Meuse', 14, 41),
|
||||
('57', 'Moselle', 14, 41),
|
||||
('58', 'Nièvre', 4, 26),
|
||||
('59', 'Nord', 16, 31),
|
||||
('60', 'Oise', 19, 26),
|
||||
('62', 'Pas-de-Calais', 16, 31),
|
||||
('61', 'Orne', 18, 25),
|
||||
('63', 'Puy-de-Dôme', 3, 83),
|
||||
('67', 'Bas-Rhin', 1, 42),
|
||||
('68', 'Haut-Rhin', 1, 42),
|
||||
('69', 'Rhône', 22, 82),
|
||||
('64', 'Pyrénées-Atlantiques', 2, 72),
|
||||
('65', 'Hautes-Pyrénées', 15, 73),
|
||||
('66', 'Pyrénées-Orientales', 11, 91),
|
||||
('70', 'Haute-Saône', 9, 43),
|
||||
('71', 'Saône-et-Loire', 4, 26),
|
||||
('72', 'Sarthe', 13, 52),
|
||||
('73', 'Savoie', 22, 82),
|
||||
('74', 'Haute-Savoie', 22, 82),
|
||||
('75', 'Paris', 10, 11),
|
||||
('76', 'Seine-Maritime', 17, 23),
|
||||
('77', 'Seine-et-Marne', 10, 11),
|
||||
('78', 'Yvelines', 10, 11),
|
||||
('79', 'Deux-Sèvres', 20, 54),
|
||||
('80', 'Somme', 19, 26),
|
||||
('81', 'Tarn', 15, 73),
|
||||
('82', 'Tarn-et-Garonne', 15, 73),
|
||||
('83', 'Var', 21, 93),
|
||||
('84', 'Vaucluse', 21, 93),
|
||||
('85', 'Vendée', 13, 52),
|
||||
('86', 'Vienne', 20, 54),
|
||||
('87', 'Haute-Vienne', 12, 74),
|
||||
('88', 'Vosges', 14, 41),
|
||||
('89', 'Yonne', 4, 26),
|
||||
('90', 'Territoire de Belfort', 9, 43),
|
||||
('91', 'Essonne', 10, 11),
|
||||
('92', 'Hauts-de-Seine', 10, 11),
|
||||
('93', 'Seine-Saint-Denis', 10, 11),
|
||||
('94', 'Val-de-Marne', 10, 11),
|
||||
('95', 'Val-d''Oise', 10, 11),
|
||||
('971', 'Guadeloupe', 23, 1),
|
||||
('972', 'Martinique', 23, 2),
|
||||
('973', 'Guyane', 23, 3),
|
||||
('974', 'Réunion', 24, 4),
|
||||
('200', 'Corse-du-Sud', 8, 94),
|
||||
('201', 'Corse-du-Sud', 8, 94),
|
||||
('202', 'Haute-Corse', 8, 94),
|
||||
('976', 'Mayotte', 0, 0),
|
||||
('988', 'Nouvelle-Calédonie', 0, 0),
|
||||
('987', 'Polynésie-Française', 0, 0),
|
||||
('975', 'Saint-Pierre-et-Miquelon', 0, 0),
|
||||
('986', 'Wallis-et-Futuna', 0, 0),
|
||||
('2B', 'Haute-Corse', 8, 94);
|
344
config/_sql/formejuridique.sql
Normal file
344
config/_sql/formejuridique.sql
Normal file
@ -0,0 +1,344 @@
|
||||
--
|
||||
-- Base de données: `ciblage`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Structure de la table `formejuridique`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `formejuridique` (
|
||||
`fjCode` int(4) NOT NULL,
|
||||
`fjLibelle` varchar(100) NOT NULL,
|
||||
`fjInsee` tinyint(1) NOT NULL,
|
||||
KEY `fjCode` (`fjCode`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- Contenu de la table `formejuridique`
|
||||
--
|
||||
|
||||
INSERT INTO `formejuridique` (`fjCode`, `fjLibelle`, `fjInsee`) VALUES
|
||||
(0, 'Indéterminée', 0),
|
||||
(1, 'Personne physique', 1),
|
||||
(2, 'Groupement de droit privé non doté de la personnalité morale', 1),
|
||||
(3, 'Personne morale de droit étranger', 1),
|
||||
(4, 'Personne morale de droit public soumise au droit commercial', 1),
|
||||
(5, 'Société commerciale', 1),
|
||||
(6, 'Autre personne morale immatriculée au RCS', 1),
|
||||
(7, 'Personne morale et organisme soumis au droit administratif', 1),
|
||||
(8, 'Organisme privé spécialisé', 1),
|
||||
(9, 'Groupement de droit privé', 1),
|
||||
(11, 'Artisan Commerçant', 1),
|
||||
(12, 'Commerçant', 1),
|
||||
(13, 'Artisan', 1),
|
||||
(14, 'Officier public ou ministériel', 1),
|
||||
(15, 'Profession libérale', 1),
|
||||
(16, 'Exploitant agricole', 1),
|
||||
(17, 'Agent commercial', 1),
|
||||
(18, 'Associé Gérant de société', 1),
|
||||
(19, '(Autre) personne physique', 1),
|
||||
(21, 'Indivision', 1),
|
||||
(22, 'Société créée de fait', 1),
|
||||
(23, 'Société en participation', 1),
|
||||
(27, 'Paroisse hors zone concordataire', 1),
|
||||
(29, 'Autre groupement de droit privé non doté de la personnalité morale', 1),
|
||||
(31, 'Personne morale de droit étranger, immatriculée au RCS (registre du commerce et des sociétés)', 1),
|
||||
(32, 'Personne morale de droit étranger, non immatriculée au RCS', 1),
|
||||
(41, 'Établissement public ou régie à caractère industriel ou commercial', 1),
|
||||
(51, 'Société coopérative commerciale particulière', 1),
|
||||
(52, 'Société en nom collectif', 1),
|
||||
(53, 'Société en commandite', 1),
|
||||
(54, 'Société à responsabilité limité', 1),
|
||||
(55, 'Société anonyme à conseil d''administration', 1),
|
||||
(56, 'Société anonyme à directoire', 1),
|
||||
(57, 'Société par actions simplifiée', 1),
|
||||
(61, 'Caisse d''épargne et de prévoyance', 1),
|
||||
(62, 'Groupement d''intérêt économique', 1),
|
||||
(63, 'Société coopérative agricole', 1),
|
||||
(64, 'Société d''assurance mutuelle', 1),
|
||||
(65, 'Société civile', 1),
|
||||
(69, 'Autre personne morale de droit privé inscrite au registre du commerce et des sociétés', 1),
|
||||
(71, 'Administration de l''état', 1),
|
||||
(72, 'Collectivité territoriale', 1),
|
||||
(73, 'Établissement public administratif', 1),
|
||||
(74, 'Autre personne morale de droit public administratif', 1),
|
||||
(81, 'Organisme gérant un régime de protection sociale à adhésion obligatoire', 1),
|
||||
(82, 'Organisme mutualiste', 1),
|
||||
(83, 'Comité d''entreprise', 1),
|
||||
(84, 'Organisme professionnel', 1),
|
||||
(91, 'Syndicat de propriétaires', 1),
|
||||
(92, 'Association loi 1901 ou assimilé', 1),
|
||||
(93, 'Fondation', 1),
|
||||
(99, 'Autre personne morale de droit privé', 1),
|
||||
(1000, 'Entrepreneur Individuel à Responsabilité Limité', 0),
|
||||
(1100, 'Artisan Commerçant', 1),
|
||||
(1200, 'Commerçant', 1),
|
||||
(1300, 'Artisan', 1),
|
||||
(1400, 'Officier public ou ministériel', 1),
|
||||
(1500, 'Profession libérale', 1),
|
||||
(1600, 'Exploitant agricole', 1),
|
||||
(1700, 'Agent commercial', 1),
|
||||
(1800, 'Associé Gérant de société', 1),
|
||||
(1900, '(Autre) personne physique', 1),
|
||||
(2100, 'Indivision', 0),
|
||||
(2110, 'Indivision entre personnes physiques', 1),
|
||||
(2120, 'Indivision avec personne morale', 1),
|
||||
(2200, 'Société créée de fait', 0),
|
||||
(2210, 'Société créée de fait entre personnes physiques', 1),
|
||||
(2220, 'Société créée de fait avec personne morale', 1),
|
||||
(2300, 'Société en participation', 0),
|
||||
(2310, 'Société en participation entre personnes physiques', 1),
|
||||
(2320, 'Société en participation avec personne morale', 1),
|
||||
(2385, 'Société en participation de professions libérales', 1),
|
||||
(2400, 'Fiducie', 1),
|
||||
(2700, 'Paroisse hors zone concordataire', 1),
|
||||
(2900, 'Autre groupement de droit privé non doté de la personnalité morale', 1),
|
||||
(3110, 'Représentation ou agence commerciale d''état ou organisme public étranger immatriculé au RCS', 1),
|
||||
(3120, 'Société étrangère immatriculée au RCS', 1),
|
||||
(3205, 'Organisation internationale', 1),
|
||||
(3210, 'État collectivité ou établissement public étranger', 1),
|
||||
(3220, 'Société étrangère non immatriculée au RCS', 1),
|
||||
(3290, '(Autre) personne morale de droit étranger', 1),
|
||||
(4110, 'Établissement public national à caractère industriel ou commercial doté d''un comptable public', 1),
|
||||
(4120, 'Établissement public national à caractère industriel ou commercial non doté d''un comptable public', 1),
|
||||
(4130, 'Exploitant public', 1),
|
||||
(4140, 'Établissement public local à caractère industriel ou commercial', 1),
|
||||
(4150, 'Régie d''une collectivité locale à caractère industriel ou commercial', 1),
|
||||
(4160, 'Institution Banque de France', 1),
|
||||
(5191, 'Société de caution mutuelle', 1),
|
||||
(5192, 'Société coopérative de banque populaire', 1),
|
||||
(5193, 'Caisse de crédit maritime mutuel', 1),
|
||||
(5194, 'Caisse (fédérale) de crédit mutuel', 1),
|
||||
(5195, 'Association coopérative inscrite ( droit local Alsace Moselle )', 1),
|
||||
(5196, 'Caisse d''épargne et de prévoyance à forme coopérative', 1),
|
||||
(5202, 'Société en nom collectif', 1),
|
||||
(5203, 'Société en nom collectif coopérative', 1),
|
||||
(5306, 'Société en commandite simple', 1),
|
||||
(5307, 'Société en commandite simple coopérative', 1),
|
||||
(5308, 'Société en commandite par actions', 1),
|
||||
(5309, 'Société en commandite par actions coopérative', 1),
|
||||
(5385, 'Société d''exercice libéral en commandite par action', 1),
|
||||
(5410, 'SARL nationale', 1),
|
||||
(5415, 'SARL d''économie mixte', 1),
|
||||
(5422, 'SARL immobilière pour le commerce et l''industrie (SICOMI)', 1),
|
||||
(5426, 'Société immobilière de gestion', 1),
|
||||
(5430, 'Safer en SARL', 1),
|
||||
(5431, 'SARL mixte d''intérêt agricole', 1),
|
||||
(5432, 'SARL d''intérêt collectif agricole', 1),
|
||||
(5442, 'SARL d''attribution', 1),
|
||||
(5443, 'SARL coopérative de construction', 1),
|
||||
(5451, 'SARL coopérative de consommation', 1),
|
||||
(5453, 'SARL coopérative artisanale', 1),
|
||||
(5454, 'SARL coopérative d''intérêt maritime', 1),
|
||||
(5455, 'SARL coopérative de transports', 1),
|
||||
(5458, 'SARL coopérative ouvrière de production et de crédit', 1),
|
||||
(5459, 'SARL union de sociétés coopératives', 1),
|
||||
(5460, 'Autre SARL coopérative', 1),
|
||||
(5485, 'Société d''exercice libéral à responsabilité limitée', 1),
|
||||
(5488, 'Entreprise Unipersonnelle à Responsabilité Limitée', 1),
|
||||
(5498, 'SARL unipersonnelle', 1),
|
||||
(5499, 'Autre société à responsabilité limitée', 1),
|
||||
(5505, 'SA à participation ouvrière à conseil d''administration', 1),
|
||||
(5510, 'SA nationale à conseil d''administration', 1),
|
||||
(5515, 'SA d''économie mixte à conseil d''administration', 1),
|
||||
(5520, 'Société d''investissement à capital variable (SICAV) à conseil d''administration', 1),
|
||||
(5522, 'Société anonyme immobilière pour le commerce et l''industrie (SICOMI) à conseil d''administration', 1),
|
||||
(5525, 'Société anonyme immobilière d''investissement à conseil d''administration', 1),
|
||||
(5530, 'Safer anonyme à conseil d''administration', 1),
|
||||
(5531, 'Société anonyme mixte d''intérêt agricole (SMIA) à conseil d''administration', 1),
|
||||
(5532, 'Société anonyme mixte d''intérêt collectif agricole (SICA) à conseil d''administration', 1),
|
||||
(5542, 'Société anonyme d''attribution à conseil d''administration', 1),
|
||||
(5543, 'Société anonyme coopérative de construction à conseil d''administration', 1),
|
||||
(5546, 'SA de HLM à conseil d''administration', 1),
|
||||
(5547, 'SA coopérative de production de HLM à conseil d''administration', 1),
|
||||
(5548, 'SA de crédit immobilier à conseil d''administration', 1),
|
||||
(5551, 'SA coopérative de consommation à conseil d''administration', 1),
|
||||
(5552, 'SA coopérative de commerçants détaillants à conseil d''administration', 1),
|
||||
(5553, 'SA coopérative artisanale à conseil d''administration', 1),
|
||||
(5554, 'SA coopérative (d''intérêt) maritime à conseil d''administration', 1),
|
||||
(5555, 'SA coopérative de transports à conseil d''administration', 1),
|
||||
(5558, 'SA coopérative ouvrière de production et de crédit (SCOP) à conseil d''administration', 1),
|
||||
(5559, 'SA union de sociétés coopératives à conseil d''administration', 1),
|
||||
(5560, 'Autre SA coopérative à conseil d''administration', 1),
|
||||
(5585, 'Société d''exercice libéral à forme anonyme à conseil d''administration', 1),
|
||||
(5599, 'Autre SA à conseil d''administration', 1),
|
||||
(5605, 'SA à participation ouvrière à directoire', 1),
|
||||
(5610, 'SA nationale à directoire', 1),
|
||||
(5615, 'SA d''économie mixte à directoire', 1),
|
||||
(5620, 'Société d''investissement à capital variable (SICAV) à directoire', 1),
|
||||
(5622, 'Société immobilière pour le commerce et l''industrie (SICOMI) anonyme à directoire', 1),
|
||||
(5625, 'Société immobilière d''investissement anonyme à directoire', 1),
|
||||
(5630, 'Safer anonyme à directoire', 1),
|
||||
(5631, 'Société anonyme mixte d''intérêt agricole', 1),
|
||||
(5632, 'Société anonyme d''intérêt collectif agricole', 1),
|
||||
(5642, 'Société anonyme d''attribution à directoire', 1),
|
||||
(5643, 'Société anonyme coopérative de construction à directoire', 1),
|
||||
(5646, 'Société anonyme de HLM à directoire', 1),
|
||||
(5647, 'Société coopérative de production de HLM anonyme à directoire', 1),
|
||||
(5648, 'SA de crédit immobilier à directoire', 1),
|
||||
(5651, 'SA coopérative de consommation à directoire', 1),
|
||||
(5652, 'SA coopérative de commerçants détaillants à directoire', 1),
|
||||
(5653, 'SA coopérative artisanale à directoire', 1),
|
||||
(5654, 'SA coopérative (d''intérêt) maritime à directoire', 1),
|
||||
(5655, 'SA coopérative de transport à directoire', 1),
|
||||
(5658, 'SA coopérative ouvrière de production et de crédit (SCOP) à directoire', 1),
|
||||
(5659, 'SA union de sociétés coopératives à directoire', 1),
|
||||
(5660, '(Autre) SA coopérative à directoire', 1),
|
||||
(5685, 'Société d''exercice libéral à forme anonyme à directoire', 1),
|
||||
(5699, 'Autre SA à directoire', 1),
|
||||
(5710, 'Société par actions simplifiée', 1),
|
||||
(5720, 'Société par actions simplifiée à associé unique ou société par actions simplifiée unipersonnelle', 1),
|
||||
(5785, 'Société d’exercice libéral par action simplifiée', 1),
|
||||
(5800, 'Société européenne', 1),
|
||||
(6100, 'Caisse d’épargne et de prévoyance', 1),
|
||||
(6200, 'Groupement d''intérêt économique', 0),
|
||||
(6210, 'Groupement européen d’intérêt économique', 1),
|
||||
(6220, 'Groupement d’intérêt économique', 1),
|
||||
(6316, 'Coopérative d’utilisation de matériel agricole en commun', 1),
|
||||
(6317, 'Société coopérative agricole', 1),
|
||||
(6318, 'Union de sociétés coopératives agricoles', 1),
|
||||
(6411, 'Société d’assurance mutuelle', 1),
|
||||
(6412, 'Société mutuelle d''assurance', 1),
|
||||
(6413, 'Union de sociétés mutuelles d''assurances', 1),
|
||||
(6414, 'Autre société non commerciale d''assurance', 1),
|
||||
(6521, 'Société civile de placement collectif immobilier', 1),
|
||||
(6532, 'Société civile d’intérêt collectif agricole', 1),
|
||||
(6533, 'Groupement agricole d’exploitation en commun', 1),
|
||||
(6534, 'Groupement foncier agricole', 1),
|
||||
(6535, 'Groupement agricole foncier', 1),
|
||||
(6536, 'Groupement forestier', 1),
|
||||
(6537, 'Groupement pastoral', 1),
|
||||
(6538, 'Groupement foncier rural', 1),
|
||||
(6539, 'Société civile foncière', 1),
|
||||
(6540, 'Société civile immobilière', 1),
|
||||
(6541, 'Société civile immobilière de construction vente', 1),
|
||||
(6542, 'Société civile d’attribution', 1),
|
||||
(6543, 'Société civile coopérative de construction', 1),
|
||||
(6544, 'Société immobilière d''accession progressive à la propriété', 1),
|
||||
(6551, 'Société civile coopérative de consommation', 1),
|
||||
(6554, 'Société civile coopérative (d’intérêt) maritime', 1),
|
||||
(6558, 'Société civile coopérative entre médecins', 1),
|
||||
(6560, 'Autre société civile coopérative', 1),
|
||||
(6561, 'SCP d’avocats', 1),
|
||||
(6562, 'SCP d’avocats aux conseil', 1),
|
||||
(6563, 'SCP d’avoués d’appel', 1),
|
||||
(6564, 'SCP d’huissiers', 1),
|
||||
(6565, 'SCP de notaires', 1),
|
||||
(6566, 'SCP de commissaires-priseurs', 1),
|
||||
(6567, 'SCP de greffiers de tribunal de commerce', 1),
|
||||
(6568, 'SCP de conseils juridiques', 1),
|
||||
(6569, 'SCP de commissaires aux comptes', 1),
|
||||
(6571, 'SCP de médecins', 1),
|
||||
(6572, 'SCP de dentistes', 1),
|
||||
(6573, 'SCP d’infirmiers', 1),
|
||||
(6574, 'SCP de masseurs kinésithérapeutes', 1),
|
||||
(6575, 'SCP de directeurs de laboratoire d’analyse médicale', 1),
|
||||
(6576, 'SCP de vétérinaires', 1),
|
||||
(6577, 'SCP de géomètres-experts', 1),
|
||||
(6578, 'SCP d’architectes', 1),
|
||||
(6585, '(Autres) Société Civile professionnelle', 1),
|
||||
(6588, 'Société civile laitière', 0),
|
||||
(6589, 'Société civile de moyens', 1),
|
||||
(6595, 'Caisse (locale) de crédit mutuel', 1),
|
||||
(6596, 'Caisse de crédit agricole mutuel', 1),
|
||||
(6597, 'Société civile d’exploitation agricole', 1),
|
||||
(6598, 'Exploitation agricole à responsabilité limitée', 1),
|
||||
(6599, 'Autre société civile', 1),
|
||||
(6901, 'Autres personnes de droit privé inscrites au registre du commerce et des sociétés', 1),
|
||||
(7111, 'Autorité constitutionnelle', 1),
|
||||
(7112, 'Autorité administrative indépendante', 1),
|
||||
(7113, 'Ministère', 1),
|
||||
(7120, 'Service central d’un ministère', 1),
|
||||
(7130, 'Service du ministère des Postes et Télécommunications', 1),
|
||||
(7150, 'Service du ministère de la Défense', 1),
|
||||
(7160, 'Service déconcentré à compétence nation. D’un ministère (hors Défense)', 1),
|
||||
(7171, 'Service déconcentré de l’État à compétence (inter) régionale', 1),
|
||||
(7172, 'Service déconcentré de l’État à compétence (inter) départementale', 1),
|
||||
(7179, '(Autre) Service déconcentré de l’État à compétence territoriale', 1),
|
||||
(7190, 'Ecole nationale non dotée de la personnalité morale', 1),
|
||||
(7210, 'Commune', 1),
|
||||
(7220, 'Département', 1),
|
||||
(7225, 'Territoire d’Outre-mer', 1),
|
||||
(7229, '(Autre) Collectivité territoriale', 1),
|
||||
(7230, 'Région', 1),
|
||||
(7312, 'Commune associée', 1),
|
||||
(7313, 'Section de commune', 1),
|
||||
(7314, 'Ensemble urbain', 1),
|
||||
(7321, 'Association syndicale autorisée', 1),
|
||||
(7322, 'Association foncière urbaine', 1),
|
||||
(7323, 'Association foncière de remembrement', 1),
|
||||
(7331, 'Établissement public local d’enseignement', 1),
|
||||
(7341, 'Secteur de commune', 1),
|
||||
(7342, 'District urbain', 1),
|
||||
(7343, 'Communauté urbaine', 1),
|
||||
(7345, 'Syndicat intercommunal à vocation multiple', 1),
|
||||
(7346, 'Communauté de communes', 1),
|
||||
(7347, 'Communauté de villes', 1),
|
||||
(7348, 'Communauté d''agglomération', 1),
|
||||
(7349, 'Autre établissement public local de coopération non spécialisé ou entente', 1),
|
||||
(7351, 'Institution interdépartemental ou entente', 1),
|
||||
(7352, 'Institution interrégionale ou entente', 1),
|
||||
(7353, 'Syndicat intercommunal à vocation unique', 1),
|
||||
(7354, 'Syndicat mixte communal', 1),
|
||||
(7355, 'Autre syndicat mixte', 1),
|
||||
(7356, 'Commission syndicale pour la gestion des biens indivis des communes', 1),
|
||||
(7361, 'Centre communal d''action sociale', 1),
|
||||
(7362, 'Caisse des écoles', 1),
|
||||
(7363, 'Caisse de crédit municipal', 1),
|
||||
(7364, 'Établissement d''hospitalisation', 1),
|
||||
(7365, 'Syndicat inter hospitalier', 1),
|
||||
(7366, 'Établissement public local social et médico-social', 1),
|
||||
(7371, 'Office public d''habitation à loyer modéré', 1),
|
||||
(7372, 'Service départemental d''incendie', 1),
|
||||
(7373, 'Établissement public local culturel', 1),
|
||||
(7378, 'Régie d''une collectivité locale à caractère administratif', 1),
|
||||
(7379, '(Autre) Établissement public administratif local', 1),
|
||||
(7381, 'Organisme consulaire', 1),
|
||||
(7382, 'Établissement public national ayant fonction d''administration centrale', 1),
|
||||
(7383, 'Établissement public national à caractère scientifique culturel et professionnel', 1),
|
||||
(7384, 'Autre établissement public national d''enseignement', 1),
|
||||
(7385, 'Autre établissement public national administratif à compétence territoriale limitée', 1),
|
||||
(7389, 'Établissement public national à caractère administratif', 1),
|
||||
(7410, 'Groupement d''intérêt public', 1),
|
||||
(7430, 'Établissement public des cultes d''Alsace-Lorraine', 1),
|
||||
(7450, 'Etablissement public administratif, cercle et foyer dans les armées', 1),
|
||||
(7470, 'Groupement de coopération sanitaire à gestion publique', 1),
|
||||
(7490, 'Autre personne morale de droit administratif', 1),
|
||||
(7510, 'Service d''une collectivité locale à comptabilité distincte', 1),
|
||||
(7520, 'Régie d''une collectivité locale non dotée de la personnalité morale', 1),
|
||||
(8110, 'Régime général de la sécurité sociale', 1),
|
||||
(8120, 'Régime spécial de sécurité sociale', 1),
|
||||
(8130, 'Institution de retraite complémentaire', 1),
|
||||
(8140, 'Mutualité sociale agricole', 1),
|
||||
(8150, 'Régime maladie des non-salariés non agricoles', 1),
|
||||
(8160, 'Régime vieillesse ne dépendant pas du régime général de la sécurité sociale', 1),
|
||||
(8170, 'Régime d''assurance chômage', 1),
|
||||
(8190, 'Autre régime de prévoyance sociale', 1),
|
||||
(8210, 'Mutuelle', 1),
|
||||
(8250, 'Assurance mutuelle agricole', 1),
|
||||
(8290, 'Autre organisme mutualiste', 1),
|
||||
(8310, 'Comité central d''entreprise', 1),
|
||||
(8311, 'Comité d''établissement', 1),
|
||||
(8410, 'Syndicat de salariés', 1),
|
||||
(8420, 'Syndicat patronal', 1),
|
||||
(8450, 'Ordre professionnel ou assimilé', 1),
|
||||
(8470, 'Centre technique industriel ou comité professionnel du développement économique', 1),
|
||||
(8490, 'Autre organisme professionnel', 1),
|
||||
(8510, 'Institution de prévoyance', 1),
|
||||
(8520, 'Institution de retraite supplémentaire ', 1),
|
||||
(9110, 'Syndicat de copropriété', 1),
|
||||
(9150, 'Association syndicale libre', 1),
|
||||
(9210, 'Association non déclarée', 1),
|
||||
(9220, 'Association déclarée', 1),
|
||||
(9221, 'Association déclarée "entreprises d''insertion par l''économique"', 1),
|
||||
(9222, 'Association intermédiaire', 1),
|
||||
(9223, 'Groupement d''employeurs', 1),
|
||||
(9224, 'Association d''avocats à responsabilité professionnelle individuelle', 1),
|
||||
(9230, 'Association déclarée reconnue d''utilité publique', 1),
|
||||
(9240, 'Congrégation', 1),
|
||||
(9260, 'Association de droit local', 1),
|
||||
(9300, 'Fondation', 1),
|
||||
(9900, 'Autre personne morale de droit privé', 1),
|
||||
(9970, 'Groupement de coopération sanitaire à gestion privée', 1);
|
1747
config/_sql/naf.sql
Normal file
1747
config/_sql/naf.sql
Normal file
File diff suppressed because it is too large
Load Diff
5
config/_sql/prefs.sql
Normal file
5
config/_sql/prefs.sql
Normal file
@ -0,0 +1,5 @@
|
||||
CREATE TABLE IF NOT EXISTS `prefs` (
|
||||
`login` varchar(255) NOT NULL,
|
||||
`json` text NOT NULL,
|
||||
PRIMARY KEY (`login`)
|
||||
) DEFAULT CHARSET=utf8;
|
14
config/_sql/profilExtraction.sql
Normal file
14
config/_sql/profilExtraction.sql
Normal file
@ -0,0 +1,14 @@
|
||||
CREATE TABLE IF NOT EXISTS `profilextraction` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`idClient` int(11) NOT NULL,
|
||||
`login` VARCHAR( 50 ) NOT NULL,
|
||||
`reference` varchar(50) NOT NULL,
|
||||
`criteres` text NOT NULL,
|
||||
`tarifLigne` float NOT NULL,
|
||||
`dateAjout` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`dateModif` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`dateSuppr` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`actif` tinyint(4) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idClient` (`idClient`)
|
||||
) DEFAULT CHARSET=utf8 COMMENT='Profil d''extraction' AUTO_INCREMENT=1 ;
|
7
config/_sql/refexport.sql
Normal file
7
config/_sql/refexport.sql
Normal file
@ -0,0 +1,7 @@
|
||||
CREATE TABLE IF NOT EXISTS `refexport` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`idComptage` int(11) NOT NULL,
|
||||
`fichier` varchar(100) NOT NULL,
|
||||
`dateExport` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARSET=utf8 COMMENT='Sauvegarde des noms de fichier pour chaque export' AUTO_INCREMENT=1 ;
|
46
config/_sql/regions.sql
Normal file
46
config/_sql/regions.sql
Normal file
@ -0,0 +1,46 @@
|
||||
--
|
||||
-- Structure de la table `regions`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `regions` (
|
||||
`REGION` tinyint(2) unsigned zerofill NOT NULL,
|
||||
`CHEFLIEU` char(5) NOT NULL,
|
||||
`TNCC` char(1) NOT NULL,
|
||||
`NC` char(30) NOT NULL,
|
||||
`NCCENR` char(30) NOT NULL,
|
||||
PRIMARY KEY (`REGION`)
|
||||
) DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- Contenu de la table `regions`
|
||||
--
|
||||
|
||||
INSERT INTO `regions` (`REGION`, `CHEFLIEU`, `TNCC`, `NC`, `NCCENR`) VALUES
|
||||
(01, '97105', '3', 'GUADELOUPE', 'Guadeloupe'),
|
||||
(02, '97209', '3', 'MARTINIQUE', 'Martinique'),
|
||||
(03, '97302', '3', 'GUYANE', 'Guyane'),
|
||||
(04, '97411', '0', 'LA REUNION', 'La Réunion'),
|
||||
(11, '75056', '1', 'ILE-DE-FRANCE', 'Île-de-France'),
|
||||
(21, '51108', '0', 'CHAMPAGNE-ARDENNE', 'Champagne-Ardenne'),
|
||||
(22, '80021', '0', 'PICARDIE', 'Picardie'),
|
||||
(23, '76540', '0', 'HAUTE-NORMANDIE', 'Haute-Normandie'),
|
||||
(24, '45234', '2', 'CENTRE', 'Centre'),
|
||||
(25, '14118', '0', 'BASSE-NORMANDIE', 'Basse-Normandie'),
|
||||
(26, '21231', '0', 'BOURGOGNE', 'Bourgogne'),
|
||||
(31, '59350', '2', 'NORD-PAS-DE-CALAIS', 'Nord-Pas-de-Calais'),
|
||||
(41, '57463', '0', 'LORRAINE', 'Lorraine'),
|
||||
(42, '67482', '1', 'ALSACE', 'Alsace'),
|
||||
(43, '25056', '0', 'FRANCHE-COMTE', 'Franche-Comté'),
|
||||
(52, '44109', '4', 'PAYS DE LA LOIRE', 'Pays de la Loire'),
|
||||
(53, '35238', '0', 'BRETAGNE', 'Bretagne'),
|
||||
(54, '86194', '2', 'POITOU-CHARENTES', 'Poitou-Charentes'),
|
||||
(72, '33063', '1', 'AQUITAINE', 'Aquitaine'),
|
||||
(73, '31555', '0', 'MIDI-PYRENEES', 'Midi-Pyrénées'),
|
||||
(74, '87085', '2', 'LIMOUSIN', 'Limousin'),
|
||||
(82, '69123', '2', 'RHONE-ALPES', 'Rhône-Alpes'),
|
||||
(83, '63113', '1', 'AUVERGNE', 'Auvergne'),
|
||||
(91, '34172', '2', 'LANGUEDOC-ROUSSILLON', 'Languedoc-Roussillon'),
|
||||
(93, '13055', '0', 'PROVENCE-ALPES-COTE D''AZUR', 'Provence-Alpes-Côte d''Azur'),
|
||||
(94, '2A004', '0', 'CORSE', 'Corse'),
|
||||
(98, '', '', 'TERRITOIRES D''OUTRE-MER', 'Territoires d''outre-mer'),
|
||||
(99, '', '', 'ETRANGER', 'Etranger');
|
67
config/configure.php
Normal file
67
config/configure.php
Normal file
@ -0,0 +1,67 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
//error_reporting(E_ALL & ~E_NOTICE);
|
||||
|
||||
// Define path to application directory
|
||||
defined('APPLICATION_PATH')
|
||||
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
|
||||
|
||||
// Define application environment
|
||||
defined('APPLICATION_ENV')
|
||||
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
|
||||
|
||||
// Ensure library/ is on include_path
|
||||
set_include_path(implode(PATH_SEPARATOR, array(
|
||||
realpath(APPLICATION_PATH . '/../library'),
|
||||
get_include_path(),
|
||||
)));
|
||||
|
||||
/** Zend_Application */
|
||||
require_once 'Zend/Application.php';
|
||||
|
||||
// Create application, bootstrap, and run
|
||||
$application = new Zend_Application(
|
||||
APPLICATION_ENV,
|
||||
APPLICATION_PATH . '/configs/application.ini'
|
||||
);
|
||||
|
||||
try {
|
||||
$opts = new Zend_Console_Getopt(
|
||||
//Options
|
||||
array(
|
||||
'help|?' => "Affiche les informations d'utilisation",
|
||||
'check' => "Vérifie la configuration suivant le fichier de config installé",
|
||||
'install' => "Installe et configure",
|
||||
)
|
||||
);
|
||||
$opts->parse();
|
||||
} catch (Zend_Console_Getopt_Exception $e) {
|
||||
echo $e->getUsageMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
//Usage
|
||||
if(isset($opts->help))
|
||||
{
|
||||
echo $opts->getUsageMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
$configDir = realpath(dirname(__FILE__));
|
||||
$appconfigDir = APPLICATION_PATH.'/configs';
|
||||
$hostname = exec('echo $(hostname)');
|
||||
|
||||
if(isset($opts->check))
|
||||
{
|
||||
|
||||
}
|
||||
elseif(isset($opts->install))
|
||||
{
|
||||
//Copie de la configuration
|
||||
passthru('cp -v '.
|
||||
$configDir.'/'.$hostname.'/configuration.ini' . ' ' .
|
||||
$appconfigDir.'/configuration.ini');
|
||||
|
||||
//Modification des permissions
|
||||
passthru('chown -R www-data: '.APPLICATION_PATH.'/');
|
||||
}
|
36
config/local/configuration.ini
Normal file
36
config/local/configuration.ini
Normal file
@ -0,0 +1,36 @@
|
||||
[server]
|
||||
name = sdsrvdev01
|
||||
|
||||
[webservice]
|
||||
location = local
|
||||
|
||||
[databases]
|
||||
db.adapter=mysqli
|
||||
db.params.host=127.0.0.1
|
||||
db.params.username=root
|
||||
db.params.password=password
|
||||
db.params.dbname=ciblage
|
||||
db.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
|
||||
|
||||
jo.adapter=mysqli
|
||||
jo.params.host=192.168.78.230
|
||||
jo.params.username=wsuser
|
||||
jo.params.password=scores
|
||||
jo.params.dbname=jo
|
||||
jo.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
|
||||
|
||||
[sphinx]
|
||||
host = 192.168.78.252
|
||||
port = 3312
|
||||
|
||||
[mail]
|
||||
method = smtp
|
||||
smpt_port =
|
||||
smtp_host = smtp.free.fr
|
||||
support = mricois@scores-decisions.com
|
||||
supportdev = mricois@scores-decisions.com
|
||||
contact = mricois@scores-decisions.com
|
||||
production = mricois@scores-decisions.com
|
||||
|
||||
[path]
|
||||
data = "d:\www\dataciblage"
|
36
config/sdsrvdev01/configuration.ini
Normal file
36
config/sdsrvdev01/configuration.ini
Normal file
@ -0,0 +1,36 @@
|
||||
[server]
|
||||
name = sdsrvdev01
|
||||
|
||||
[webservice]
|
||||
location = sdsrvdev01
|
||||
|
||||
[databases]
|
||||
db.adapter=mysqli
|
||||
db.params.host=127.0.0.1
|
||||
db.params.username=root
|
||||
db.params.password=bj10sx
|
||||
db.params.dbname=ciblage
|
||||
db.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
|
||||
|
||||
jo.adapter=mysqli
|
||||
jo.params.host=192.168.78.230
|
||||
jo.params.username=wsuser
|
||||
jo.params.password=scores
|
||||
jo.params.dbname=jo
|
||||
jo.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
|
||||
|
||||
[sphinx]
|
||||
host = 192.168.78.252
|
||||
port = 3312
|
||||
|
||||
[mail]
|
||||
method = smtp
|
||||
smpt_port =
|
||||
smtp_host = smtp.free.fr
|
||||
support = supportdev@scores-decisions.com
|
||||
supportdev = supportdev@scores-decisions.com
|
||||
contact = supportdev@scores-decisions.com
|
||||
production = supportdev@scores-decisions.com
|
||||
|
||||
[path]
|
||||
data = "/sites/dataciblage"
|
84
library/Application/Controller/Plugin/Auth.php
Normal file
84
library/Application/Controller/Plugin/Auth.php
Normal file
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
|
||||
{
|
||||
/**
|
||||
* Vérifie les autorisations
|
||||
* Utilise _request et _response hérités et injectés par le FC
|
||||
*
|
||||
* @param Zend_Controller_Request_Abstract $request : non utilisé, mais demandé par l'héritage
|
||||
*/
|
||||
public function preDispatch(Zend_Controller_Request_Abstract $request)
|
||||
{
|
||||
$checkAuth = true;
|
||||
if ($request->getControllerName()=='user' && $request->getActionName()=='login'){
|
||||
$checkAuth = false;
|
||||
}
|
||||
|
||||
if ($checkAuth)
|
||||
{
|
||||
$login = $request->getParam('login');
|
||||
$pass = $request->getParam('pass', '');
|
||||
$hach = $request->getParam('hach');
|
||||
$checkIp = $request->getParam('checkIp');
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
|
||||
//Est ce que l'on a checkIp=only lors de la requête
|
||||
$iponly = false;
|
||||
if ($checkIp=='only') {
|
||||
$hach = 'iponly:'.$_SERVER['REMOTE_ADDR'];
|
||||
$iponly = true;
|
||||
}
|
||||
|
||||
//On vérifie le tout lors d'une connexion par url
|
||||
if ( !empty($login) && !empty($hach) ) {
|
||||
|
||||
require_once 'Scores/WebAuthAdapter.php';
|
||||
|
||||
$authAdapter = new WebAuthAdapter($login, $hach, $iponly);
|
||||
$result = $auth->authenticate($authAdapter);
|
||||
if (!$result->isValid()) {
|
||||
$request->setModuleName('default')
|
||||
->setControllerName('user')
|
||||
->setActionName('logout');
|
||||
} else {
|
||||
$timeout = $auth->getIdentity()->timeout;
|
||||
Zend_Session::rememberMe($timeout);
|
||||
$storage = new Zend_Auth_Storage_Session();
|
||||
$sessionNamespace = new Zend_Session_Namespace($storage->getNamespace());
|
||||
$sessionNamespace->setExpirationSeconds($timeout);
|
||||
$auth->setStorage($storage);
|
||||
}
|
||||
|
||||
//Sinon on reste sur le standard
|
||||
} else {
|
||||
//Pas authentifié
|
||||
if (!$auth->hasIdentity()) {
|
||||
|
||||
$auth->clearIdentity();
|
||||
$session = new Zend_Session_Namespace('login');
|
||||
$session->url = $_SERVER['REQUEST_URI'];
|
||||
|
||||
$layout = Zend_Layout::getMVCInstance();
|
||||
if (!$layout->isEnabled()){
|
||||
$this->_response->setRedirect('/user/logout')->sendResponse();
|
||||
}
|
||||
$this->_response->setRedirect('/user/login')->sendResponse();
|
||||
//Authentifié => on met à jour la session
|
||||
} else {
|
||||
|
||||
$timeout = $auth->getIdentity()->timeout;
|
||||
$storage = new Zend_Auth_Storage_Session();
|
||||
$sessionNamespace = new Zend_Session_Namespace($storage->getNamespace());
|
||||
$sessionNamespace->setExpirationSeconds($timeout);
|
||||
$auth->setStorage($storage);
|
||||
|
||||
if (Zend_Session::namespaceIsset('login')){
|
||||
Zend_Session::namespaceUnset('login');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
47
library/Application/Controller/Plugin/Comptage.php
Normal file
47
library/Application/Controller/Plugin/Comptage.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
class Application_Controller_Plugin_Comptage extends Zend_Controller_Plugin_Abstract
|
||||
{
|
||||
public function preDispatch($request)
|
||||
{
|
||||
$layout = Zend_Layout::getMVCInstance();
|
||||
if ($layout->isEnabled()) {
|
||||
$controller = $request->getControllerName();
|
||||
$action = $request->getActionName();
|
||||
|
||||
if ($controller == 'index' && $action == 'index') {
|
||||
require_once 'Scores/SessionCiblage.php';
|
||||
$session = new SessionCiblage();
|
||||
$view = $layout->getView();
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
// Chargement des critères de ciblage à partir de l'enregistrement en bdd
|
||||
$id = $request->getParam('id', 0);
|
||||
if (!empty($id)) {
|
||||
$db = Zend_Registry::get('db');
|
||||
$criteresM = new Application_Model_Criteres();
|
||||
$sql = $criteresM->select()
|
||||
->from($criteresM, array('criteres'))
|
||||
->where('login = ?', $user->username)
|
||||
->where('id = ?', $id);
|
||||
$row = $criteresM->fetchRow($sql);
|
||||
if ($row != null) {
|
||||
//On charge les critères
|
||||
$session->setCriteres(json_decode($row->criteres, 'true'));
|
||||
//Réalise le comptage
|
||||
require_once 'Scores/Ciblage.php';
|
||||
$ciblage = new Ciblage($session->getCriteres());
|
||||
$total = $ciblage->execute();
|
||||
$insee = $ciblage->calculeRedevanceInsee();
|
||||
$session->setNb('total', $total);
|
||||
$session->setNb('insee', $insee);
|
||||
}
|
||||
}
|
||||
$view->total = number_format($session->getNb('total'), 0, '', ' ');
|
||||
$view->insee = number_format($session->getNb('insee'), 0, '', ' ');
|
||||
$view->msgComptage = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
28
library/Forms/Login.php
Normal file
28
library/Forms/Login.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
class Form_Login extends Zend_Form {
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->setName('login');
|
||||
$this->setAction('/user/login');
|
||||
$this->setMethod('post');
|
||||
$this->addElement('text', 'login', array(
|
||||
'filters' => array('StringTrim'),
|
||||
'label' => 'Identifiant : ',
|
||||
'required' => 'true',
|
||||
)
|
||||
);
|
||||
$this->addElement('password', 'pass',
|
||||
array(
|
||||
'label' => 'Mot de passe : ',
|
||||
'required' => 'true',
|
||||
)
|
||||
);
|
||||
$this->addElement('submit', 'submit',
|
||||
array(
|
||||
'label' => 'Identification',
|
||||
'ignore' => true,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
414
library/Scores/Ciblage.php
Normal file
414
library/Scores/Ciblage.php
Normal file
@ -0,0 +1,414 @@
|
||||
<?php
|
||||
require_once 'sphinxapi/sphinxapi-2.0.2.php';
|
||||
|
||||
Class Ciblage
|
||||
{
|
||||
private $sphinx;
|
||||
private $alpha = '';
|
||||
private $presentRcs = 0;
|
||||
|
||||
public $index = 'ciblage';
|
||||
|
||||
public $nb_results = 5000;
|
||||
public $max_results = 500000;
|
||||
|
||||
public $mysql_host = '192.168.78.230';
|
||||
public $mysql_user = 'sphinx';
|
||||
public $mysql_password = 'indexer';
|
||||
public $mysql_database = 'jo';
|
||||
|
||||
public $sphinx_host = '192.168.78.252';
|
||||
public $sphinx_port = 3312;
|
||||
public $sphinx_match = SPH_MATCH_EXTENDED2;
|
||||
public $sphinx_sort = SPH_SORT_EXTENDED;
|
||||
|
||||
public function __construct($structure, $need = false)
|
||||
{
|
||||
$this->sphinx = new SphinxClient();
|
||||
$this->sphinx->SetServer($this->sphinx_host, $this->sphinx_port);
|
||||
$this->sphinx->SetMatchMode(SPH_MATCH_EXTENDED2);
|
||||
$this->sphinx->ResetFilters();
|
||||
foreach($structure as $key => $valeur)
|
||||
{
|
||||
if (method_exists($this, $key)) {
|
||||
if(is_array($valeur)) {
|
||||
if($valeur[0] != "" and $valeur[0] != 'tous'){
|
||||
$this->$key($valeur);
|
||||
}
|
||||
} else {
|
||||
if($valeur != 'tous' and $valeur != "")
|
||||
$this->$key($valeur);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function calculRedevanceInsee()
|
||||
{
|
||||
$this->sphinx->SetFilter('presentrcs', array(0));
|
||||
$resSphinx = $this->sphinx->Query($this->alpha, $this->index);
|
||||
return ($resSphinx['total_found']);
|
||||
}
|
||||
|
||||
public function execute($need = false)
|
||||
{
|
||||
if($need) {
|
||||
$i = 0;
|
||||
$siret = array();
|
||||
|
||||
do {
|
||||
$this->sphinx->SetLimits($i, $this->nb_results, $this->max_results);
|
||||
$resSphinx = $this->sphinx->Query($this->alpha, $this->index);
|
||||
if($resSphinx['total'] > 0) {
|
||||
foreach($resSphinx['matches'] as $matches) {
|
||||
if($matches['attrs']['presentrcs'] == 0)
|
||||
$siret[] = $matches['attrs']['siren'];
|
||||
}
|
||||
$i += $this->nb_results;
|
||||
}else
|
||||
break;
|
||||
} while($i < $resSphinx['total_found']);
|
||||
return ($resSphinx['total_found']);
|
||||
} else {
|
||||
$resSphinx = $this->sphinx->Query($this->alpha, $this->index);
|
||||
}
|
||||
return ($resSphinx['total_found']);
|
||||
}
|
||||
|
||||
protected function setFilter($name, $valeur) {
|
||||
if(!is_array($valeur)) {
|
||||
$this->sphinx->SetFilter($name, array(intval($valeur)));
|
||||
}else {
|
||||
$this->sphinx->SetFilter($name, $this->transformIntval($valeur));
|
||||
}
|
||||
}
|
||||
|
||||
protected function setFilterRange($name, $valeur) {
|
||||
$this->sphinx->SetFilterRange($name, intval($valeur[0]), intval($valeur[1]));
|
||||
}
|
||||
|
||||
protected function writeRequest($name, $valeur, $or = false) {
|
||||
if(!is_array($valeur)) {
|
||||
if($or and !empty($this->alpha))
|
||||
$this->alpha .= ' | ';
|
||||
$this->alpha .= '@'.$name.' '.$valeur.' ';
|
||||
} else {
|
||||
$i = 0;
|
||||
if($or and !empty($this->alpha))
|
||||
$this->alpha .= ' | ';
|
||||
foreach($valeur as $item) {
|
||||
if($i != 0)
|
||||
$this->alpha .= ' | ';
|
||||
$this->alpha .= '@'.$name.' '.$item.' ';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function setAlpha($name, $valeur)
|
||||
{
|
||||
$or = array('bilType');
|
||||
$and = array('ape_entrep', 'ape_etab', 'age_entrep', 'age_etab', 'NaceEntrep', 'NaceEtab');
|
||||
|
||||
if(in_array($name, $or)) {
|
||||
if(!empty($valeur))
|
||||
$this->writeRequest($name, $valeur, true);
|
||||
} else if (in_array($name, $and)) {
|
||||
if(!empty($valeur))
|
||||
$this->writeRequest($name, $valeur);
|
||||
}
|
||||
}
|
||||
|
||||
protected function transformIntval($array) {
|
||||
$copy = array();
|
||||
foreach($array as $item => $valeur) {
|
||||
$copy[$item] = intval($valeur);
|
||||
}
|
||||
return ($copy);
|
||||
}
|
||||
|
||||
protected function dirNom($valeur) {
|
||||
$this->setFilter('dirNom', $valeur);
|
||||
}
|
||||
|
||||
protected function siege($valeur) {
|
||||
$this->setFilter('siege', $valeur);
|
||||
}
|
||||
|
||||
protected function adr_cp($valeur) {
|
||||
$this->setFilter('adr_cp', $valeur);
|
||||
}
|
||||
|
||||
protected function adr_dep($valeur) {
|
||||
$this->setAlpha('adr_dep', $valeur);
|
||||
}
|
||||
|
||||
protected function adr_com($valeur) {
|
||||
$this->setFilter('adr_com', $valeur);
|
||||
}
|
||||
|
||||
protected function tel($valeur) {
|
||||
$this->setFilter('tel', $valeur);
|
||||
}
|
||||
|
||||
protected function fax($valeur) {
|
||||
$this->setFilter('fax', $valeur);
|
||||
}
|
||||
|
||||
protected function cj($valeur) {
|
||||
$this->setFilter('cj', $valeur);
|
||||
}
|
||||
|
||||
protected function capital($valeur) {
|
||||
if($valeur[0] != 0 or $valeur[1] != 0)
|
||||
$this->setFilterRange('capital', $valeur);
|
||||
}
|
||||
|
||||
protected function ape_etab($valeur) {
|
||||
$this->setAlpha('ape_etab', $valeur);
|
||||
}
|
||||
|
||||
protected function ape_entrep($valeur) {
|
||||
$this->setAlpha('ape_entrep', $valeur);
|
||||
}
|
||||
|
||||
protected function age_entrep($valeur) {
|
||||
$this->setAlpha('age_entrep', $valeur);
|
||||
}
|
||||
|
||||
protected function age_etab($valeur) {
|
||||
$this->setAlpha('age_etab', $valeur);
|
||||
}
|
||||
|
||||
protected function tcaexp($valeur) {
|
||||
$this->setFilterRange('tcaexp', $valeur);
|
||||
}
|
||||
|
||||
protected function teff_entrep($valeur) {
|
||||
if($valeur[0] != 0 or $valeur[1] != 0)
|
||||
$this->setFilterRange('teff_entrep', $valeur);
|
||||
}
|
||||
|
||||
protected function teff_etab($valeur) {
|
||||
if($valeur[0] != 0 or $valeur[1] != 0)
|
||||
$this->setFilterRange('teff_etab', $valeur);
|
||||
}
|
||||
|
||||
protected function rang($valeur) {
|
||||
$this->setFilterRange('rang', $valeur);
|
||||
}
|
||||
|
||||
protected function actifEco($valeur) {
|
||||
$this->setFilter('actifEco', $valeur);
|
||||
}
|
||||
|
||||
protected function presentRcs($valeur) {
|
||||
$this->setFilter('presentRcs', $valeur);
|
||||
}
|
||||
|
||||
protected function procolHisto($valeur) {
|
||||
$this->setFilter('procolHisto', $valeur);
|
||||
}
|
||||
|
||||
protected function tvaIntraValide($valeur) {
|
||||
$this->setFilter('tvaIntraValide', $valeur);
|
||||
}
|
||||
|
||||
protected function NaceEtab($valeur) {
|
||||
$this->setAlpha('NaceEtab', $valeur);
|
||||
}
|
||||
|
||||
protected function NaceEntrep($valeur) {
|
||||
$this->setAlpha('NaceEntrep', $valeur);
|
||||
}
|
||||
|
||||
protected function dateCrea_etab($valeur) {
|
||||
if(!is_array($valeur)) {
|
||||
$format = explode('/', $valeur);
|
||||
$valeur = $format[2].$format[1].$format[0];
|
||||
} else {
|
||||
$format1 = explode('/', $valeur[0]);
|
||||
$format2 = explode('/', $valeur[0]);
|
||||
|
||||
$valeur[0] = $format1[2].$format1[1].$format1[0];
|
||||
$valeur[1] = $format2[2].$format2[1].$format2[0];
|
||||
}
|
||||
$this->setFilterRange('dateCrea_etab', $valeur);
|
||||
|
||||
}
|
||||
|
||||
protected function dateCrea_ent($valeur) {
|
||||
if(!is_array($valeur)) {
|
||||
$format = explode('/', $valeur);
|
||||
$valeur = $format[2].$format[1].$format[0];
|
||||
} else {
|
||||
$format1 = explode('/', $valeur[0]);
|
||||
$format2 = explode('/', $valeur[0]);
|
||||
|
||||
$valeur[0] = $format1[2].$format1[1].$format1[0];
|
||||
$valeur[1] = $format2[2].$format2[1].$format2[0];
|
||||
}
|
||||
$this->setFilterRange('dateCrea_etab', $valeur);
|
||||
}
|
||||
|
||||
protected function dateImmat($valeur) {
|
||||
if(!is_array($valeur)) {
|
||||
$format = explode('/', $valeur);
|
||||
$valeur = $format[2].$format[1].$format[0];
|
||||
} else {
|
||||
$format1 = explode('/', $valeur[0]);
|
||||
$format2 = explode('/', $valeur[0]);
|
||||
|
||||
$valeur[0] = $format1[2].$format1[1].$format1[0];
|
||||
$valeur[1] = $format2[2].$format2[1].$format2[0];
|
||||
}
|
||||
$this->setFilterRange('dateImmat', $valeur);
|
||||
}
|
||||
|
||||
protected function eff_entrep($valeur) {
|
||||
$this->setFilter('eff_entrep', $valeur);
|
||||
}
|
||||
|
||||
protected function eff_etab($valeur) {
|
||||
$this->setFilter('eff_etab', $valeur);
|
||||
}
|
||||
|
||||
protected function rivoli($valeur) {
|
||||
$this->setFilter('rivoli', $valeur);
|
||||
}
|
||||
|
||||
protected function nbEtab($valeur) {
|
||||
$this->setFilterRange('nbEtab', $valeur);
|
||||
}
|
||||
|
||||
protected function sirenGrp($valeur) {
|
||||
$this->setFilter('sirenGrp', $valeur);
|
||||
}
|
||||
|
||||
protected function nbActio($valeur) {
|
||||
$this->setFilterRange('nbActio', $valeur);
|
||||
}
|
||||
|
||||
protected function nbMPubli($valeur) {
|
||||
$this->setFilterRange('nbMPubli', $valeur);
|
||||
}
|
||||
|
||||
protected function nbPart($valeur) {
|
||||
$this->setFilterRange('nbPart', $valeur);
|
||||
}
|
||||
|
||||
protected function bilType($valeur) {
|
||||
$this->setAlpha('bilType', $valeur);
|
||||
}
|
||||
|
||||
protected function bilAnnee($valeur) {
|
||||
$this->setFilter('bilAnnee', $valeur);
|
||||
}
|
||||
|
||||
protected function bilTca($valeur) {
|
||||
$this->setFilterRange('bilTca', $valeur);
|
||||
}
|
||||
|
||||
protected function bilEE($valeur) {
|
||||
$this->setFilterRange('bilEE', $valeur);
|
||||
}
|
||||
|
||||
protected function bilFL($valeur) {
|
||||
$this->setFilterRange('bilFL', $valeur);
|
||||
}
|
||||
|
||||
protected function bilFK($valeur) {
|
||||
$this->setFilterRange('bilFK', $valeur);
|
||||
}
|
||||
|
||||
protected function bilFR($valeur) {
|
||||
$this->setFilterRange('bilFR', $valeur);
|
||||
}
|
||||
|
||||
protected function bilGF($valeur) {
|
||||
$this->setFilterRange('bilGF', $valeur);
|
||||
}
|
||||
|
||||
protected function bilGP($valeur) {
|
||||
$this->setFilterRange('bilGP', $valeur);
|
||||
}
|
||||
|
||||
protected function bilGU($valeur) {
|
||||
$this->setFilterRange('bilGU', $valeur);
|
||||
}
|
||||
|
||||
protected function bilGW($valeur) {
|
||||
$this->setFilterRange('bilGW', $valeur);
|
||||
}
|
||||
|
||||
protected function bilHD($valeur) {
|
||||
$this->setFilterRange('bilHD', $valeur);
|
||||
}
|
||||
|
||||
protected function bilHL($valeur) {
|
||||
$this->setFilterRange('bilHL', $valeur);
|
||||
}
|
||||
|
||||
protected function bilHM($valeur) {
|
||||
$this->setFilterRange('bilHM', $valeur);
|
||||
}
|
||||
|
||||
protected function bilHN($valeur) {
|
||||
$this->setFilterRange('bilHN', $valeur);
|
||||
}
|
||||
|
||||
protected function bilYP($valeur) {
|
||||
$this->setFilterRange('bilYP', $valeur);
|
||||
}
|
||||
|
||||
protected function avisCs($valeur) {
|
||||
$this->setFilte('avisCs', $valeur);
|
||||
}
|
||||
|
||||
protected function bilFS($valeur) {
|
||||
$this->setFilterRange('bilFS', $valeur);
|
||||
}
|
||||
|
||||
protected function lieuAct($valeur) {
|
||||
$this->setFilter('lieuAct', $valeur);
|
||||
}
|
||||
|
||||
protected function bilGG($valeur) {
|
||||
$this->setFilterRange('bilGG', $valeur);
|
||||
}
|
||||
|
||||
protected function bilGV($valeur) {
|
||||
$this->setFilterRange('bilGV', $valeur);
|
||||
}
|
||||
|
||||
protected function bilHI($valeur) {
|
||||
$this->setFilterRange('bilHI', $valeur);
|
||||
}
|
||||
|
||||
protected function adrDom($valeur) {
|
||||
$this->setFilter('adrDom', $valeur);
|
||||
}
|
||||
|
||||
protected function web($valeur) {
|
||||
$this->setFilter('web', $valeur);
|
||||
}
|
||||
|
||||
protected function mail($valeur) {
|
||||
$this->setFilter('mail', $valeur);
|
||||
}
|
||||
|
||||
protected function bilCloture($valeur) {
|
||||
if(!is_array($valeur)) {
|
||||
$format = explode('/', $valeur);
|
||||
$valeur = $format[2].$format[1].$format[0];
|
||||
} else {
|
||||
$format1 = explode('/', $valeur[0]);
|
||||
$format2 = explode('/', $valeur[0]);
|
||||
|
||||
$valeur[0] = $format1[2].$format1[1].$format1[0];
|
||||
$valeur[1] = $format2[2].$format2[1].$format2[0];
|
||||
}
|
||||
//print_r($valeur);
|
||||
$this->setFilterRange('bilCloture', $valeur);
|
||||
}
|
||||
}
|
7
library/Scores/Enrichissement.php
Normal file
7
library/Scores/Enrichissement.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
class Enrichissement
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
784
library/Scores/Field.php
Normal file
784
library/Scores/Field.php
Normal file
@ -0,0 +1,784 @@
|
||||
<?php
|
||||
Class Fields
|
||||
{
|
||||
protected $fields = array
|
||||
(
|
||||
'siege' => array(
|
||||
'label' => 'Sociétés Sieges',
|
||||
'fields' => array(
|
||||
'select' => array('value' => array(1 => 'Oui', 0 => 'Non')),
|
||||
),
|
||||
'famille' => 'entreprise',
|
||||
'activated' => true,
|
||||
'type' => 'select'
|
||||
),
|
||||
'sirenGrp' => array(
|
||||
'label' => 'Société appartenant à un groupe',
|
||||
'fields' => array(
|
||||
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
|
||||
),
|
||||
'famille' => 'entreprise',
|
||||
'activated' => true,
|
||||
'type' => 'select'
|
||||
),
|
||||
'tel' => array(
|
||||
'label' => 'Contenant un Telephone',
|
||||
'fields' => array(
|
||||
'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
|
||||
),
|
||||
'famille' => 'entreprise',
|
||||
'activated' => true,
|
||||
'type' => 'select'
|
||||
),
|
||||
'fax' => array(
|
||||
'label' => 'Contenant un Fax',
|
||||
'fields' => array(
|
||||
'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
|
||||
),
|
||||
'famille' => 'entreprise',
|
||||
'activated' => true,
|
||||
'type' => 'select',
|
||||
'class' => null
|
||||
),
|
||||
'web' => array(
|
||||
'label' => 'Contenant un site internet',
|
||||
'fields' => array(
|
||||
'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
|
||||
),
|
||||
'famille' => 'entreprise',
|
||||
'activated' => true,
|
||||
'type' => 'select',
|
||||
'class' => null
|
||||
),
|
||||
'mail' => array(
|
||||
'label' => 'Contenant une adresse email',
|
||||
'fields' => array(
|
||||
'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
|
||||
),
|
||||
'famille' => 'entreprise',
|
||||
'activated' => true,
|
||||
'type' => 'select',
|
||||
'class' => null
|
||||
),
|
||||
'presentRcs' => array(
|
||||
'label' => 'Société présente au RNCS',
|
||||
'fields' => array(
|
||||
'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
|
||||
),
|
||||
'famille' => 'entreprise',
|
||||
'activated' => true,
|
||||
'type' => 'select',
|
||||
'class' => null
|
||||
),
|
||||
'adrDom' => array(
|
||||
'label' => 'A une adresse de domiciliation',
|
||||
'fields' => array(
|
||||
'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
|
||||
),
|
||||
'famille' => 'entreprise',
|
||||
'activated' => true,
|
||||
'type' => 'select',
|
||||
'class' => null
|
||||
),
|
||||
'dirNom' => array(
|
||||
'label' => 'Contenant le nom du principal dirigeant',
|
||||
'fields' => array(
|
||||
'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
|
||||
),
|
||||
'famille' => 'entreprise',
|
||||
'activated' => true,
|
||||
'type' => 'select',
|
||||
'class' => null
|
||||
),
|
||||
'lieuAct' => array(
|
||||
'label' => 'Lieu d\'activté',
|
||||
'fields' => array(
|
||||
'interval' => array('value' => array('0', '1000')),
|
||||
'textarea' => array('value' => null)
|
||||
),
|
||||
'famille' => 'entreprise',
|
||||
'activated' => true,
|
||||
'type' => 'textarea',
|
||||
'class' => null
|
||||
),
|
||||
'nbMPubli' => array(
|
||||
'label' => 'Nombre de marches publiques remportes',
|
||||
'fields' => array(
|
||||
'interval' => array('value' => array('0', '1000'))
|
||||
),
|
||||
'famille' => 'entreprise',
|
||||
'activated' => true,
|
||||
'type' => 'interval',
|
||||
'class' => null
|
||||
),
|
||||
'dateCrea_ent' => array(
|
||||
'label' => 'Date de création de l\'entreprise',
|
||||
'fields' => array(
|
||||
'interval' => array('value' => array('0', '1000'))
|
||||
),
|
||||
'famille' => 'entreprise',
|
||||
'activated' => true,
|
||||
'type' => 'interval',
|
||||
'class' => 'datepicker'
|
||||
),
|
||||
'dateCrea_etab' => array(
|
||||
'label' => 'Date de création de l\'etablissement',
|
||||
'fields' => array(
|
||||
'interval' => array('value' => array('0', '1000'))
|
||||
),
|
||||
'famille' => 'entreprise',
|
||||
'activated' => true,
|
||||
'type' => 'interval',
|
||||
'class' => 'datepicker'
|
||||
),
|
||||
'nbActio' => array(
|
||||
'label' => 'Nombre d\'actionnaires connus',
|
||||
'fields' => array(
|
||||
'interval' => array('value' => array('0', '1000'))
|
||||
),
|
||||
'famille' => 'entreprise',
|
||||
'activated' => true,
|
||||
'type' => 'interval',
|
||||
'class' => null
|
||||
),
|
||||
'nbPart' => array(
|
||||
'label' => 'Nombre de participations connues',
|
||||
'fields' => array(
|
||||
'interval' => array('value' => array('0', '1000'))
|
||||
),
|
||||
'famille' => 'entreprise',
|
||||
'activated' => true,
|
||||
'type' => 'interval',
|
||||
'class' => null
|
||||
),
|
||||
// economique
|
||||
'ape_etab' => array(
|
||||
'label' => 'Codes NAF Etablissement',
|
||||
'fields' => array(
|
||||
'text' => array('value' => null),
|
||||
'textarea' => array('value' => null)
|
||||
),
|
||||
'famille' => 'economique',
|
||||
'activated' => true,
|
||||
'type' => 'textarea',
|
||||
'class' => null,
|
||||
'action' => 'naf',
|
||||
'title' => 'Selection des codes NAF etablissement'
|
||||
),
|
||||
'ape_entrep' => array(
|
||||
'label' => 'Codes NAF Entreprise',
|
||||
'fields' => array(
|
||||
'text' => array('value' => null),
|
||||
'textarea' => array('value' => null)
|
||||
),
|
||||
'famille' => 'economique',
|
||||
'activated' => true,
|
||||
'type' => 'textarea',
|
||||
'class' => null,
|
||||
'action' => 'naf',
|
||||
'title' => 'Selection des codes NAF entreprise'
|
||||
),
|
||||
'NaceEtab' => array(
|
||||
'label' => 'Code NACE de l\'établissement',
|
||||
'fields' => array(
|
||||
'text' => array('value' => null),
|
||||
'textarea' => array('value' => null)
|
||||
),
|
||||
'famille' => 'economique',
|
||||
'activated' => true,
|
||||
'type' => 'textarea',
|
||||
'class' => null
|
||||
),
|
||||
'NaceEntrep' => array(
|
||||
'label' => 'Code NACE de l\'entreprise',
|
||||
'fields' => array(
|
||||
'text' => array('value' => null),
|
||||
'textarea' => array('value' => null)
|
||||
),
|
||||
'famille' => 'economique',
|
||||
'activated' => true,
|
||||
'type' => 'textarea',
|
||||
'class' => null
|
||||
),
|
||||
'age_etab' => array(
|
||||
'label' => 'L\'age de l\'etablissement',
|
||||
'fields' => array(
|
||||
'interval' => array('value' => null)
|
||||
),
|
||||
'famille' => 'economique',
|
||||
'activated' => true,
|
||||
'type' => 'interval',
|
||||
'class' => null
|
||||
),
|
||||
'age_entrep' => array(
|
||||
'label' => 'L\'age de l\'entreprise',
|
||||
'fields' => array(
|
||||
'interval' => array('value' => null)
|
||||
),
|
||||
'famille' => 'economique',
|
||||
'activated' => true,
|
||||
'type' => 'interval',
|
||||
'class' => null
|
||||
),
|
||||
'teff_entrep' => array(
|
||||
'label' => 'Tranche d\'effectif de l\'Entreprise',
|
||||
'fields' => array(
|
||||
'intervalSelect' => array('value' => array(
|
||||
array('0', '0'),
|
||||
array('0', '1'),
|
||||
array('1', '2'),
|
||||
array('2', '3'),
|
||||
array('3', '11'),
|
||||
array('11', '12'),
|
||||
array('12', '21'),
|
||||
array('21', '22'),
|
||||
array('22', '31'),
|
||||
array('31', '32'),
|
||||
array('32', '41'),
|
||||
array('41', '42'),
|
||||
array('42', '51'),
|
||||
array('51', '52'),
|
||||
array('52', '53')
|
||||
))
|
||||
),
|
||||
'famille' => 'economique',
|
||||
'activated' => true,
|
||||
'type' => 'intervalSelect',
|
||||
'class' => null,
|
||||
),
|
||||
'teff_etab' => array(
|
||||
'label' => 'Tranche d\'effectif de l\'etablissement',
|
||||
'fields' => array(
|
||||
'intervalSelect' => array(
|
||||
'value' => array(
|
||||
array('0', '0'),
|
||||
array('0', '1'),
|
||||
array('1', '2'),
|
||||
array('2', '3'),
|
||||
array('3', '11'),
|
||||
array('11', '12'),
|
||||
array('12', '21'),
|
||||
array('21', '22'),
|
||||
array('22', '31'),
|
||||
array('31', '32'),
|
||||
array('32', '41'),
|
||||
array('41', '42'),
|
||||
array('42', '51'),
|
||||
array('51', '52'),
|
||||
array('52', '53')
|
||||
)
|
||||
)
|
||||
),
|
||||
'famille' => 'economique',
|
||||
'activated' => true,
|
||||
'type' => 'intervalSelect',
|
||||
'class' => null
|
||||
),
|
||||
'nbEtab' => array(
|
||||
'label' => 'Nombre d\'établassiment',
|
||||
'fields' => array(
|
||||
'interval' => array('value' => array('0', '10000000'))
|
||||
),
|
||||
'famille' => 'economique',
|
||||
'activated' => true,
|
||||
'type' => 'interval',
|
||||
'class' => null
|
||||
),
|
||||
'eff_entrep' => array(
|
||||
'label' => 'Effectif réel de l\'entreprise',
|
||||
'fields' => array(
|
||||
'interval' => array('value' => array('0', '10000000'))
|
||||
),
|
||||
'famille' => 'economique',
|
||||
'activated' => true,
|
||||
'type' => 'interval',
|
||||
'class' => null
|
||||
),
|
||||
'eff_etab' => array(
|
||||
'label' => 'Effectif réel de l\'établissement',
|
||||
'fields' => array(
|
||||
'interval' => array('value' => array('0', '10000000'))
|
||||
),
|
||||
'famille' => 'economique',
|
||||
'activated' => true,
|
||||
'type' => 'interval',
|
||||
'class' => null
|
||||
),
|
||||
'capital' => array(
|
||||
'label' => 'Capital de l\'entreprise',
|
||||
'fields' => array(
|
||||
'intervalSelect' => array(
|
||||
'value' => array(
|
||||
array(0, 15000),
|
||||
array(15000, 30000),
|
||||
array(30000, 75000),
|
||||
array(75000, 150000),
|
||||
array(150000, 750000),
|
||||
array(750000, 0),
|
||||
)
|
||||
)
|
||||
),
|
||||
'famille' => 'economique',
|
||||
'activated' => true,
|
||||
'type' => 'intervalSelect',
|
||||
'class' => null
|
||||
),
|
||||
//geographique
|
||||
'adr_cp' => array(
|
||||
'label' => 'Codes postaux',
|
||||
'fields' => array(
|
||||
'text' => array('value' => null),
|
||||
'textarea' => array('value' => null)
|
||||
),
|
||||
'famille' => 'geographique',
|
||||
'activated' => true,
|
||||
'type' => 'textarea',
|
||||
'class' => null,
|
||||
'action' => 'geographique',
|
||||
'title' => 'Localisation'
|
||||
),
|
||||
'adr_com' => array(
|
||||
'label' => 'Code commune Insee',
|
||||
'fields' => array(
|
||||
'text' => array('value' => null),
|
||||
'textarea' => array('value' => null)
|
||||
),
|
||||
'famille' => 'geographique',
|
||||
'activated' => true,
|
||||
'type' => 'textarea',
|
||||
'class' => null
|
||||
),
|
||||
//juridique
|
||||
'cj' => array(
|
||||
'label' => 'Forme Juridique',
|
||||
'fields' => array(
|
||||
'select' => array('value' => array('1' => '1', '2' => '2', '3' => '3')),
|
||||
),
|
||||
'famille' => 'juridique',
|
||||
'activated' => true,
|
||||
'type' => 'select',
|
||||
'class' => null
|
||||
),
|
||||
'actifEco' => array(
|
||||
'label' => 'Établissement économiquement actif',
|
||||
'fields' => array(
|
||||
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
|
||||
),
|
||||
'famille' => 'juridique',
|
||||
'activated' => true,
|
||||
'type' => 'select',
|
||||
'class' => null
|
||||
),
|
||||
'procolHisto' => array(
|
||||
'label' => 'Procédure collective dans l\'historique.',
|
||||
'fields' => array(
|
||||
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
|
||||
),
|
||||
'famille' => 'juridique',
|
||||
'activated' => true,
|
||||
'type' => 'select',
|
||||
'class' => null
|
||||
),
|
||||
'tvaIntraValide' => array(
|
||||
'label' => 'Numéro de TVA Valide',
|
||||
'fields' => array(
|
||||
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
|
||||
),
|
||||
'famille' => 'juridique',
|
||||
'activated' => true,
|
||||
'type' => 'select',
|
||||
'class' => null
|
||||
),
|
||||
'dateImmat' => array(
|
||||
'label' => 'Date d\'immatriculation',
|
||||
'fields' => array(
|
||||
'interval' => array('value' => array('0', '1000'))
|
||||
),
|
||||
'famille' => 'juridique',
|
||||
'activated' => true,
|
||||
'type' => 'interval',
|
||||
'class' => 'datepicker'
|
||||
),
|
||||
//financier
|
||||
'bilType' => array(
|
||||
'label' => 'Type du dernier bilan',
|
||||
'fields' => array(
|
||||
'select' => array('value' => array('I' => 'Inconnue', 'E' => 'Estimé', 'R' => 'Réel')),
|
||||
),
|
||||
'famille' => 'financier',
|
||||
'activated' => true,
|
||||
'type' => 'select',
|
||||
'class' => null
|
||||
),
|
||||
'avisCs' => array(
|
||||
'label' => 'Informations de paiements',
|
||||
'fields' => array(
|
||||
'interval' => array('value' => null),
|
||||
),
|
||||
'famille' => 'financier',
|
||||
'activated' => true,
|
||||
'type' => 'interval',
|
||||
'class' => null
|
||||
),
|
||||
'bilDuree' => array(
|
||||
'label' => 'Durée du dernier bilan en mois',
|
||||
'fields' => array(
|
||||
'interval' => array('value'=> null),
|
||||
),
|
||||
'famille' => 'financier',
|
||||
'activated' => true,
|
||||
'type' => 'interval',
|
||||
'class' => null
|
||||
),
|
||||
'bilTca' => array(
|
||||
'label' => 'Tranche de CA issue du bilan',
|
||||
'fields' => array(
|
||||
'interval' => array('value' => null),
|
||||
),
|
||||
'famille' => 'financier',
|
||||
'activated' => true,
|
||||
'type' => 'interval',
|
||||
'class' => null
|
||||
),
|
||||
'bilAnnee' => array(
|
||||
'label' => 'Dernière année de bilan',
|
||||
'fields' => array(
|
||||
'interval' => array('value' => array('0', '1000'))
|
||||
),
|
||||
'famille' => 'financier',
|
||||
'activated' => true,
|
||||
'type' => 'interval',
|
||||
'class' => null
|
||||
),
|
||||
'bilCloture' => array(
|
||||
'label' => 'Dernière date de clôture du bilan',
|
||||
'fields' => array(
|
||||
'interval' => array('value' => array('0', '1000'))
|
||||
),
|
||||
'famille' => 'financier',
|
||||
'activated' => true,
|
||||
'type' => 'interval',
|
||||
'class' => 'datepicker'
|
||||
),
|
||||
'bilEE' => array(
|
||||
'label' => 'Total bilan',
|
||||
'fields' => array(
|
||||
'interval' => array('value' => array('0', '10000000'))
|
||||
),
|
||||
'famille' => 'financier',
|
||||
'activated' => true,
|
||||
'type' => 'interval',
|
||||
'class' => null
|
||||
),
|
||||
'bilFL' => array(
|
||||
'label' => 'CA total',
|
||||
'fields' => array(
|
||||
'interval' => array('value' => array('0', '10000000'))
|
||||
),
|
||||
'famille' => 'financier',
|
||||
'activated' => true,
|
||||
'type' => 'interval',
|
||||
'class' => null
|
||||
),
|
||||
'bilFK' => array(
|
||||
'label' => 'Chiffre d\'affaires Export',
|
||||
'fields' => array(
|
||||
'interval' => array('value' => array('0', '10000000'))
|
||||
),
|
||||
'famille' => 'financier',
|
||||
'activated' => true,
|
||||
'type' => 'interval',
|
||||
'class' => null
|
||||
),
|
||||
'bilFR' => array(
|
||||
'label' => 'Produits d\'Exploitation',
|
||||
'fields' => array(
|
||||
'interval' => array('value' => array('0', '10000000'))
|
||||
),
|
||||
'famille' => 'financier',
|
||||
'activated' => true,
|
||||
'type' => 'interval',
|
||||
'class' => null
|
||||
),
|
||||
'bilGF' => array(
|
||||
'label' => 'Charges d\'Exploitation',
|
||||
'fields' => array(
|
||||
'interval' => array('value' => array('0', '10000000'))
|
||||
),
|
||||
'famille' => 'financier',
|
||||
'activated' => true,
|
||||
'type' => 'interval',
|
||||
'class' => null
|
||||
),
|
||||
'bilGP' => array(
|
||||
'label' => 'Produits Financiers',
|
||||
'fields' => array(
|
||||
'interval' => array('value' => array('0', '10000000'))
|
||||
),
|
||||
'famille' => 'financier',
|
||||
'activated' => true,
|
||||
'type' => 'interval',
|
||||
'class' => null
|
||||
),
|
||||
'bilGP' => array(
|
||||
'label' => 'Charges Financières',
|
||||
'fields' => array(
|
||||
'interval' => array('value' => array('0', '10000000'))
|
||||
),
|
||||
'famille' => 'financier',
|
||||
'activated' => true,
|
||||
'type' => 'interval',
|
||||
'class' => null
|
||||
),
|
||||
'bilGW' => array(
|
||||
'label' => 'RCAI (résultat courant avant impôt)',
|
||||
'fields' => array(
|
||||
'interval' => array('value' => array('0', '10000000'))
|
||||
),
|
||||
'famille' => 'financier',
|
||||
'activated' => true,
|
||||
'type' => 'interval',
|
||||
'class' => null
|
||||
),
|
||||
'bilHD' => array(
|
||||
'label' => 'Produits Exceptionnels',
|
||||
'fields' => array(
|
||||
'interval' => array('value' => array('0', '10000000'))
|
||||
),
|
||||
'famille' => 'financier',
|
||||
'activated' => true,
|
||||
'type' => 'interval',
|
||||
'class' => null
|
||||
),
|
||||
'bilHH' => array(
|
||||
'label' => 'Charges Exceptionnels',
|
||||
'fields' => array(
|
||||
'interval' => array('value' => array('0', '10000000'))
|
||||
),
|
||||
'famille' => 'financier',
|
||||
'activated' => true,
|
||||
'type' => 'interval',
|
||||
'class' => null
|
||||
),
|
||||
'bilHL' => array(
|
||||
'label' => 'Total des Produits',
|
||||
'fields' => array(
|
||||
'interval' => array('value' => array('0', '10000000'))
|
||||
),
|
||||
'famille' => 'financier',
|
||||
'activated' => true,
|
||||
'type' => 'interval',
|
||||
'class' => null
|
||||
),
|
||||
'bilHM' => array(
|
||||
'label' => 'Total des Charges',
|
||||
'fields' => array(
|
||||
'interval' => array('value' => array('0', '10000000'))
|
||||
),
|
||||
'famille' => 'financier',
|
||||
'activated' => true,
|
||||
'type' => 'interval',
|
||||
'class' => null
|
||||
),
|
||||
'bilHN' => array(
|
||||
'label' => 'Résultat',
|
||||
'fields' => array(
|
||||
'interval' => array('value' => array('0', '10000000'))
|
||||
),
|
||||
'famille' => 'financier',
|
||||
'activated' => true,
|
||||
'type' => 'interval',
|
||||
'class' => null
|
||||
),
|
||||
'bilYP' => array(
|
||||
'label' => 'Effectif de l\'entreprise au dernier bilan (poste YP)',
|
||||
'fields' => array(
|
||||
'interval' => array('value' => array('0', '10000000'))
|
||||
),
|
||||
'famille' => 'financier',
|
||||
'activated' => true,
|
||||
'type' => 'interval',
|
||||
'class' => null
|
||||
)
|
||||
);
|
||||
protected $requeteSql = array('cj');
|
||||
|
||||
public function getValues()
|
||||
{
|
||||
require_once 'Scores/SessionCiblage.php';
|
||||
$session = new SessionCiblage();
|
||||
$values = array();
|
||||
|
||||
foreach($session->getCriteres() as $key => $item)
|
||||
{
|
||||
if($this->fields[$key]['type'] == 'interval' or
|
||||
$this->fields[$key]['type'] == 'intervalSelect' or
|
||||
$this->fields[$key]['type'] == 'textarea' and
|
||||
empty($this->fields[$key]['action']))
|
||||
{
|
||||
$values[$key] = explode(',', $item);
|
||||
} else if (!empty($this->fields[$key]['action'])) {
|
||||
$values[$key] = $this->selectArbo($key, $item);
|
||||
} else {
|
||||
$values[$key] = $item;
|
||||
}
|
||||
}
|
||||
return ($values);
|
||||
}
|
||||
|
||||
public function selectArbo($name, $valeur)
|
||||
{
|
||||
$values = array();
|
||||
switch($name)
|
||||
{
|
||||
case 'ape_etab' :
|
||||
case 'ape_entrep' :
|
||||
$nafs = explode(',', $valeur);
|
||||
foreach($nafs as $naf)
|
||||
$values = array_merge($values, $this->nafArbo($name, $naf));
|
||||
break;
|
||||
case 'adr_cp':
|
||||
$valeurs = explode(',', $valeur);
|
||||
foreach($valeurs as $element) {
|
||||
$array = $this->deptArbo($name, $element);
|
||||
if(!empty($array))
|
||||
$values = array_merge($values, $array);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return ($values);
|
||||
}
|
||||
|
||||
protected function deptArbo($name, $valeur)
|
||||
{
|
||||
if(strlen($valeur) < 5){
|
||||
if($valeur[0] == 'D') {
|
||||
$table = new Application_Model_Codepostaux();
|
||||
$sql = $table->select()->where('Codepos LIKE "'.substr($valeur, 1).'%"');
|
||||
$codes = $table->fetchAll($sql)->toArray();
|
||||
foreach($codes as $code) {
|
||||
$values[] = $code['Codepos'];
|
||||
}
|
||||
} else if($valeur[0] == 'R') {
|
||||
$table = new Application_Model_Departements();
|
||||
$sql = $table->select()->from('departements', array('numdep'))->where('codeRegionInsee = ?', substr($valeur, 1));
|
||||
$results = $table->fetchAll($sql)->toArray();
|
||||
foreach($results as $result) {
|
||||
$table = new Application_Model_Codepostaux();
|
||||
$sql = $table->select()->from('codepostaux', array('Codepos'))->where('Codepos LIKE "'.$result['numdep'].'%"');
|
||||
$codes = $table->fetchAll($sql)->toArray();
|
||||
foreach($codes as $code) {
|
||||
$values[] = $code['Codepos'];
|
||||
}
|
||||
}
|
||||
}
|
||||
return ($values);
|
||||
}
|
||||
return (array($valeur));
|
||||
}
|
||||
|
||||
protected function nafArbo($key, $valeur)
|
||||
{
|
||||
$value = array();
|
||||
$table = new Application_Model_Naf();
|
||||
|
||||
if(strlen($valeur) == 1)
|
||||
{
|
||||
$sql = $table->select()->where('parent = ?', $valeur);
|
||||
$result =$table->fetchAll($sql)->toArray();
|
||||
foreach($result as $code) $where .= " code LIKE '".$code['code']."%' and niveau = 5 or ";
|
||||
$where = substr($where, 0, (strlen($where)) - 3);
|
||||
$sql = $table->select()->where($where);
|
||||
$result = $table->fetchAll($sql)->toArray();
|
||||
foreach($result as $code) $value[] = $code['code'];
|
||||
} else if(strlen($valeur) < 5){
|
||||
$sql = $table->select()->where("code LIKE '".$valeur."%' and niveau = 5");
|
||||
$result = $table->fetchAll($sql)->toArray();
|
||||
foreach($result as $code) $value[] = $code['code'];
|
||||
} else if(strlen($valeur) == 5) {
|
||||
$value[] = $valeur;
|
||||
}
|
||||
return ($value);
|
||||
}
|
||||
|
||||
public function __construct($login)
|
||||
{
|
||||
require_once('Scores/SessionCiblage.php');
|
||||
$session = new SessionCiblage();
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
$db = Zend_Registry::get('db');
|
||||
$prefsModel = new Application_Model_Prefs($db);
|
||||
|
||||
$prefs = $prefsModel->find($login);
|
||||
$json = $prefs->json;
|
||||
|
||||
foreach($this->fields as $name => $valeur) {
|
||||
if(!empty($json))
|
||||
{
|
||||
$prefs = json_decode($json);
|
||||
if(!empty($prefs)) {
|
||||
if(array_key_exists($name, $prefs)) {
|
||||
$this->fields[$name]['activated'] = false;
|
||||
if(is_array($this->fields[$name]['type'])) {
|
||||
$this->fields[$name]['type'] = $prefs[$name];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(in_array($name, $this->requeteSql)) {
|
||||
$formeJuridiques = new Application_Model_Formejuridique();
|
||||
$sql = $formeJuridiques->select()->where('fjCode > 1000');
|
||||
$formeJuridiques = $formeJuridiques->fetchAll($sql)->toArray();
|
||||
$value = array();
|
||||
foreach($formeJuridiques as $form) {
|
||||
$value[$form['fjCode']] = $form['fjLibelle'].' ['.$form['fjCode'].']';
|
||||
}
|
||||
asort($value);
|
||||
$this->fields[$name]['fields']['select']['value'] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getFields() {
|
||||
return ($this->fields);
|
||||
}
|
||||
|
||||
public function get($name) {
|
||||
if($this->fields[$name]['activated'] == true)
|
||||
return ($this->fields[$name]);
|
||||
return (null);
|
||||
}
|
||||
|
||||
public function getByFamille($famille)
|
||||
{
|
||||
$section = array();
|
||||
|
||||
foreach($this->fields as $name => $item) {
|
||||
if($item['famille'] == $famille) {
|
||||
$section[$name] = $item;
|
||||
}
|
||||
}
|
||||
return ($section);
|
||||
}
|
||||
|
||||
public function getNotActivated($fields)
|
||||
{
|
||||
foreach($fields as $name => $field)
|
||||
{
|
||||
if(!$field['activated']) {
|
||||
$desactivated[$name] = "";
|
||||
} else if ($field['activated']){
|
||||
|
||||
}
|
||||
}
|
||||
return (json_encode($desactivated));
|
||||
}
|
||||
|
||||
public function getLibelle($name)
|
||||
{
|
||||
return ($this->fields[$name]['label']);
|
||||
}
|
||||
}
|
107
library/Scores/SessionCiblage.php
Normal file
107
library/Scores/SessionCiblage.php
Normal file
@ -0,0 +1,107 @@
|
||||
<?php
|
||||
class SessionCiblage
|
||||
{
|
||||
protected $valeur;
|
||||
protected $total = null;
|
||||
protected $insee = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$session = new Zend_Session_Namespace('ciblage');
|
||||
$this->valeur = empty($session->ciblage) ? array() : $session->ciblage;
|
||||
if (isset($this->valeur['NB']['total'])){ $this->total = $this->valeur['NB']['total']; }
|
||||
if (isset($this->valeur['NB']['insee'])){ $this->insee = $this->valeur['NB']['insee']; }
|
||||
if (isset($this->valeur['NB'])){ unset($this->valeur['NB']); }
|
||||
}
|
||||
|
||||
/**
|
||||
* Enregistre les informations dans la session
|
||||
*/
|
||||
protected function setSession()
|
||||
{
|
||||
$session = new Zend_Session_Namespace('ciblage');
|
||||
$this->valeur['NB']['total'] = $this->total;
|
||||
$this->valeur['NB']['insee'] = $this->insee;
|
||||
$session->ciblage = $this->valeur;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enregistre un critère et sa valeur
|
||||
* @param unknown_type $key
|
||||
* @param unknown_type $value
|
||||
*/
|
||||
public function setCritere($key, $value)
|
||||
{
|
||||
$this->valeur[$key] = $value;
|
||||
$this->setSession();
|
||||
}
|
||||
|
||||
/**
|
||||
* Définir les critères en une fois
|
||||
* @param array $criteres
|
||||
*/
|
||||
public function setCriteres($criteres)
|
||||
{
|
||||
$this->valeur = $criteres;
|
||||
$this->setSession();
|
||||
}
|
||||
|
||||
/**
|
||||
* Désactivation d'un critère
|
||||
* @param unknown_type $key
|
||||
*/
|
||||
public function unsetCritere($key)
|
||||
{
|
||||
if(key_exists($key, $this->valeur)) {
|
||||
unset($this->valeur[$key]);
|
||||
$this->setSession();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupération de la valeur d'un critère
|
||||
* @param unknown_type $key
|
||||
*/
|
||||
public function getCritere($key)
|
||||
{
|
||||
if(array_key_exists($key, $this->valeur)) {
|
||||
return $this->valeur[$key];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupération des critères et de leurs valeurs
|
||||
*/
|
||||
public function getCriteres()
|
||||
{
|
||||
return $this->valeur;
|
||||
}
|
||||
|
||||
/**
|
||||
* Définit un élément de comptage
|
||||
* @param unknown_type $element
|
||||
* @param unknown_type $nb
|
||||
*/
|
||||
public function setNb($element, $nb)
|
||||
{
|
||||
$this->{$element} = $nb;
|
||||
$this->setSession();
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupére la valeur d'un élément de comptage
|
||||
* @param unknown_type $element
|
||||
*/
|
||||
public function getNb($element)
|
||||
{
|
||||
return $this->{$element};
|
||||
}
|
||||
|
||||
|
||||
public function clearCiblage()
|
||||
{
|
||||
Zend_Session::namespaceUnset('ciblage');
|
||||
}
|
||||
|
||||
}
|
62
library/Scores/WebAuthAdapter.php
Normal file
62
library/Scores/WebAuthAdapter.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
class WebAuthAdapter implements Zend_Auth_Adapter_Interface
|
||||
{
|
||||
protected $_username;
|
||||
protected $_password;
|
||||
protected $_timeout = 1800;
|
||||
protected $_checkIp = false;
|
||||
|
||||
public function __construct($username, $password, $iponly = false)
|
||||
{
|
||||
$this->_username = $username;
|
||||
$this->_password = $password;
|
||||
if ($iponly){
|
||||
$this->_password = 'iponly:'.$_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
$this->_checkIp = $iponly;
|
||||
}
|
||||
|
||||
public function authenticate()
|
||||
{
|
||||
$adressIp = $_SERVER['REMOTE_ADDR'];
|
||||
require_once 'Scores/WsScores.php';
|
||||
$ws = new WsScores($this->_username, $this->_password);
|
||||
$InfosLogin = $ws->getInfosLogin($this->_username, $adressIp);
|
||||
$identity = new stdClass();
|
||||
$identity->username = $this->_username;
|
||||
$identity->password = $this->_password;
|
||||
$identity->email = $InfosLogin->result->email;
|
||||
$identity->profil = $InfosLogin->result->profil;
|
||||
$identity->pref = $InfosLogin->result->pref;
|
||||
$identity->droits = $InfosLogin->result->droits;
|
||||
$identity->droitsClients = $InfosLogin->result->droitsClients;
|
||||
$identity->nom = $InfosLogin->result->nom;
|
||||
$identity->prenom = $InfosLogin->result->prenom;
|
||||
$identity->tel = $InfosLogin->result->tel;
|
||||
$identity->fax = $InfosLogin->result->fax;
|
||||
$identity->mobile = $InfosLogin->result->mobile;
|
||||
$identity->id = $InfosLogin->result->id;
|
||||
$identity->idClient = $InfosLogin->result->idClient;
|
||||
$identity->reference = $InfosLogin->result->reference;
|
||||
$identity->nbReponses = $InfosLogin->result->nbReponses;
|
||||
$identity->typeScore = $InfosLogin->result->typeScore;
|
||||
$identity->timeout = (!empty($InfosLogin->result->timeout)) ?
|
||||
$InfosLogin->result->timeout : $this->_timeout;
|
||||
$identity->ip = $adressIp;
|
||||
$identity->modeEdition = false;
|
||||
|
||||
if ( (is_string($InfosLogin) && !empty($InfosLogin)) || $InfosLogin->error->errnum!=0){
|
||||
if (is_string($InfosLogin)){
|
||||
$message = $InfosLogin;
|
||||
} else {
|
||||
$message = 'Erreur lors de la connexion';
|
||||
}
|
||||
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $identity, array($message));
|
||||
} elseif ($this->_username == $InfosLogin->result->login) {
|
||||
return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $identity);
|
||||
} else {
|
||||
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_UNCATEGORIZED, $identity);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
146
library/Scores/WsScores.php
Normal file
146
library/Scores/WsScores.php
Normal file
@ -0,0 +1,146 @@
|
||||
<?php
|
||||
class WsScores
|
||||
{
|
||||
protected $webservices = array();
|
||||
protected $login = '';
|
||||
protected $password = '';
|
||||
protected $nbReponses = 20;
|
||||
protected $toNotCache = false;
|
||||
|
||||
public function __construct($login = '', $password = '')
|
||||
{
|
||||
$configuration = Zend_Registry::get('configuration');
|
||||
$config = new Zend_Config_Ini(realpath(dirname(__FILE__)) . '/webservices.ini', $configuration->webservice->location);
|
||||
$this->webservices = $config->webservices->toArray();
|
||||
if ( !empty($login) && !empty($password) ){
|
||||
$this->login = $login;
|
||||
$this->password = $password;
|
||||
} else {
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
$this->login = $user->getLogin();
|
||||
$this->password = $user->getPassword();
|
||||
$this->nbReponses = $user->getNbRep();
|
||||
if ( $user->checkModeEdition() ) {
|
||||
$this->toNotCache = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* setLog
|
||||
* @param string $page
|
||||
* @param string $siret
|
||||
* @param string $id
|
||||
* @param string $ref
|
||||
*/
|
||||
public function setLog ($page, $siret, $id=0, $ref = '')
|
||||
{
|
||||
$params = new stdClass();
|
||||
$params->page = $idClient;
|
||||
$params->siret = $siret;
|
||||
$params->id = $id;
|
||||
$params->ref = $ref;
|
||||
$client = $this->loadClient('interne');
|
||||
try {
|
||||
$reponse = $client->setLog($params);
|
||||
return true;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getDataCSV
|
||||
* @param string $key
|
||||
*/
|
||||
public function getDataCSV($key)
|
||||
{
|
||||
$params = new stdClass();
|
||||
$params->key = $key;
|
||||
try {
|
||||
$client = $this->loadClient('exporter');
|
||||
$reponse = $client->getDataCSV($params);
|
||||
return $reponse->getDataCSVResult;
|
||||
} catch (SoapFault $fault) {
|
||||
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getInfosLogin
|
||||
* @param string $login
|
||||
* @param string $ipUtilisateur
|
||||
*/
|
||||
public function getInfosLogin($login, $ipUtilisateur = '')
|
||||
{
|
||||
$params = new stdClass();
|
||||
$params->login = $login;
|
||||
$params->ipUtilisateur = $ipUtilisateur;
|
||||
try {
|
||||
$client = $this->loadClient('gestion');
|
||||
$reponse = $client->getInfosLogin($params);
|
||||
return $reponse->getInfosLoginResult;
|
||||
} catch (SoapFault $fault) {
|
||||
if ($fault->faultcode=='0900'){
|
||||
return $fault->faultstring;
|
||||
} else {
|
||||
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* soaperror
|
||||
* @param string $method
|
||||
* @param soapfault $fault
|
||||
* @param string $requete
|
||||
* @param string $reponse
|
||||
*/
|
||||
protected function soaperror($method, $fault, $requete, $reponse)
|
||||
{
|
||||
$message = '';
|
||||
$message.= 'Erreur SOAP - Code : '.$fault->faultcode.' - Message : '.$fault->faultstring;
|
||||
$message.= ' - Utilisateur : '.$this->login;
|
||||
$message.= "\n";
|
||||
$message.= "Method : ".$method.", File :".$fault->getFile().", Ligne : ".$fault->getLine();
|
||||
$message.= "\n";
|
||||
$message.= "Detail :\n".$fault->getTraceAsString();
|
||||
$message.= "\n\n";
|
||||
$message.= "Requete :\n ".$requete."\n";
|
||||
$message.= "Reponse :\n ".$reponse."\n";
|
||||
$configuration = Zend_Registry::get('configuration');
|
||||
require_once 'Scores/Mail.php';
|
||||
$mail = new Mail();
|
||||
$mail->setSubject('[ERREUR SOAP] - '.$configuration->server->name.' -'.date('Ymd'));
|
||||
$mail->setBodyTexte($message);
|
||||
$mail->setFrom('supportdev');
|
||||
$mail->addToKey('supportdev');
|
||||
$mail->send();
|
||||
}
|
||||
|
||||
/**
|
||||
* loadClient
|
||||
* @param unknown_type $webservice
|
||||
*/
|
||||
protected function loadClient($webservice)
|
||||
{
|
||||
$wsdl = $this->webservices[$webservice]['wsdl'];
|
||||
$options = $this->webservices[$webservice]['options'];
|
||||
$options['features'] = SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS;
|
||||
$options['compression'] = SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | SOAP_COMPRESSION_DEFLATE;
|
||||
$options['login'] = $this->login;
|
||||
$options['password'] = $this->password;
|
||||
if (APPLICATION_ENV != 'production'){
|
||||
$options['cache_wsdl'] = WSDL_CACHE_NONE;
|
||||
}
|
||||
$options['trace'] = true;
|
||||
$options['encoding'] = 'utf-8';
|
||||
$client = new SoapClient($wsdl, $options);
|
||||
return $client;
|
||||
}
|
||||
}
|
||||
|
33
library/Scores/configuration.php
Normal file
33
library/Scores/configuration.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
define('MYSQL_HOST', '192.168.78.230');
|
||||
define('MYSQL_USER', 'sphinx');
|
||||
define('MYSQL_PASS', 'indexer');
|
||||
define('MYSQL_DEFAULT_DB', 'jo');
|
||||
|
||||
Class ConfigurationGenerique
|
||||
{
|
||||
public static $debug = true;
|
||||
public static $redevance_insee = 3.295;
|
||||
public static $api = '2.0.2';
|
||||
public function __construct(){set_limit(0);}
|
||||
}
|
||||
|
||||
Class ConfigurationCiblage extends ConfigurationGenerique
|
||||
{
|
||||
public static $index = 'ciblage';
|
||||
|
||||
public static $nb_results = 5000;
|
||||
public static $max_results = 500000;
|
||||
|
||||
public static $mysql_host = MYSQL_HOST;
|
||||
public static $mysql_user = MYSQL_USER;
|
||||
public static $mysql_password = MYSQL_PASS;
|
||||
public static $mysql_database = MYSQL_DEFAULT_DB;
|
||||
|
||||
|
||||
public static $sphinx_host = '192.168.78.252';
|
||||
public static $sphinx_port = 3312;
|
||||
public static $sphinx_match = SPH_MATCH_EXTENDED2;
|
||||
public static $sphinx_sort = SPH_SORT_EXTENDED;
|
||||
}
|
16
library/Scores/fonctions_bd.php
Normal file
16
library/Scores/fonctions_bd.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
function Connexion_base()
|
||||
{
|
||||
$db = @mysql_connect('localhost','root','') or die('Erreur de connexion au MYSQL local');
|
||||
$select_base=@mysql_selectdb('geo', $db);
|
||||
}
|
||||
|
||||
function Deconnexion_base()
|
||||
{
|
||||
@mysql_close;
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
39
library/Scores/webservices.ini
Normal file
39
library/Scores/webservices.ini
Normal file
@ -0,0 +1,39 @@
|
||||
[local]
|
||||
webservices.interne.wsdl = "http://webservice-2.1.sd.dev/interne/v0.3?wsdl-auto"
|
||||
webservices.interne.options.soap_version = SOAP_1_2
|
||||
webservices.entreprise.wsdl = "http://webservice-2.1.sd.dev/entreprise/v0.4?wsdl-auto"
|
||||
webservices.entreprise.options.soap_version = SOAP_1_2
|
||||
webservices.gestion.wsdl = "http://webservice-2.1.sd.dev/gestion/v0.1?wsdl-auto"
|
||||
webservices.gestion.options.soap_version = SOAP_1_2
|
||||
webservices.exporter.wsdl = "http://webservice-2.1.sd.dev/exporter/v0.1?wsdl-auto"
|
||||
webservices.exporter.options.soap_version = SOAP_1_2
|
||||
|
||||
[sdsrvdev01]
|
||||
webservices.interne.wsdl = "http://webservice-2.1.sd.lan/interne/v0.3?wsdl-auto"
|
||||
webservices.interne.options.soap_version = SOAP_1_2
|
||||
webservices.entreprise.wsdl = "http://webservice-2.1.sd.lan/entreprise/v0.4?wsdl-auto"
|
||||
webservices.entreprise.options.soap_version = SOAP_1_2
|
||||
webservices.gestion.wsdl = "http://webservice-2.1.sd.lan/gestion/v0.1?wsdl-auto"
|
||||
webservices.gestion.options.soap_version = SOAP_1_2
|
||||
webservices.exporter.wsdl = "http://webservice-2.1.sd.lan/exporter/v0.1?wsdl-auto"
|
||||
webservices.exporter.options.soap_version = SOAP_1_2
|
||||
|
||||
[sd-25137]
|
||||
webservices.interne.wsdl = "http://wse.scores-decisions.com:8081/interne/v0.3?wsdl"
|
||||
webservices.interne.options.soap_version = SOAP_1_2
|
||||
webservices.entreprise.wsdl = "http://wse.scores-decisions.com:8081/entreprise/v0.4?wsdl"
|
||||
webservices.entreprise.options.soap_version = SOAP_1_2
|
||||
webservices.gestion.wsdl = "http://wse.scores-decisions.com:8081/gestion/v0.1?wsdl"
|
||||
webservices.gestion.options.soap_version = SOAP_1_2
|
||||
webservices.exporter.wsdl = "http://wse.scores-decisions.com:8081/exporter/v0.1?wsdl"
|
||||
webservices.exporter.options.soap_version = SOAP_1_2
|
||||
|
||||
[celeste]
|
||||
webservices.interne.wsdl = "http://wse.scores-decisions.com:8081/interne/v0.3?wsdl"
|
||||
webservices.interne.options.soap_version = SOAP_1_2
|
||||
webservices.entreprise.wsdl = "http://wse.scores-decisions.com:8081/entreprise/v0.4?wsdl"
|
||||
webservices.entreprise.options.soap_version = SOAP_1_2
|
||||
webservices.gestion.wsdl = "http://wse.scores-decisions.com:8081/gestion/v0.1?wsdl"
|
||||
webservices.gestion.options.soap_version = SOAP_1_2
|
||||
webservices.exporter.wsdl = "http://wse.scores-decisions.com:8081/exporter/v0.1?wsdl"
|
||||
webservices.exporter.options.soap_version = SOAP_1_2
|
1242
library/Zend/Acl.php
Normal file
1242
library/Zend/Acl.php
Normal file
File diff suppressed because it is too large
Load Diff
64
library/Zend/Acl/Assert/Interface.php
Normal file
64
library/Zend/Acl/Assert/Interface.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Acl
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Interface.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @see Zend_Acl
|
||||
*/
|
||||
require_once 'Zend/Acl.php';
|
||||
|
||||
|
||||
/**
|
||||
* @see Zend_Acl_Role_Interface
|
||||
*/
|
||||
require_once 'Zend/Acl/Role/Interface.php';
|
||||
|
||||
|
||||
/**
|
||||
* @see Zend_Acl_Resource_Interface
|
||||
*/
|
||||
require_once 'Zend/Acl/Resource/Interface.php';
|
||||
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Acl
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
interface Zend_Acl_Assert_Interface
|
||||
{
|
||||
/**
|
||||
* Returns true if and only if the assertion conditions are met
|
||||
*
|
||||
* This method is passed the ACL, Role, Resource, and privilege to which the authorization query applies. If the
|
||||
* $role, $resource, or $privilege parameters are null, it means that the query applies to all Roles, Resources, or
|
||||
* privileges, respectively.
|
||||
*
|
||||
* @param Zend_Acl $acl
|
||||
* @param Zend_Acl_Role_Interface $role
|
||||
* @param Zend_Acl_Resource_Interface $resource
|
||||
* @param string $privilege
|
||||
* @return boolean
|
||||
*/
|
||||
public function assert(Zend_Acl $acl, Zend_Acl_Role_Interface $role = null, Zend_Acl_Resource_Interface $resource = null,
|
||||
$privilege = null);
|
||||
}
|
36
library/Zend/Acl/Exception.php
Normal file
36
library/Zend/Acl/Exception.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Acl
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Exception.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @see Zend_Exception
|
||||
*/
|
||||
require_once 'Zend/Exception.php';
|
||||
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Acl
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Acl_Exception extends Zend_Exception
|
||||
{}
|
75
library/Zend/Acl/Resource.php
Normal file
75
library/Zend/Acl/Resource.php
Normal file
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Acl
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Resource.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @see Zend_Acl_Resource_Interface
|
||||
*/
|
||||
require_once 'Zend/Acl/Resource/Interface.php';
|
||||
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Acl
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Acl_Resource implements Zend_Acl_Resource_Interface
|
||||
{
|
||||
/**
|
||||
* Unique id of Resource
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_resourceId;
|
||||
|
||||
/**
|
||||
* Sets the Resource identifier
|
||||
*
|
||||
* @param string $resourceId
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($resourceId)
|
||||
{
|
||||
$this->_resourceId = (string) $resourceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Acl_Resource_Interface; returns the Resource identifier
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getResourceId()
|
||||
{
|
||||
return $this->_resourceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Acl_Resource_Interface; returns the Resource identifier
|
||||
* Proxies to getResourceId()
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getResourceId();
|
||||
}
|
||||
}
|
37
library/Zend/Acl/Resource/Interface.php
Normal file
37
library/Zend/Acl/Resource/Interface.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Acl
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Interface.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Acl
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
interface Zend_Acl_Resource_Interface
|
||||
{
|
||||
/**
|
||||
* Returns the string identifier of the Resource
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getResourceId();
|
||||
}
|
75
library/Zend/Acl/Role.php
Normal file
75
library/Zend/Acl/Role.php
Normal file
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Acl
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Role.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @see Zend_Acl_Role_Interface
|
||||
*/
|
||||
require_once 'Zend/Acl/Role/Interface.php';
|
||||
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Acl
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Acl_Role implements Zend_Acl_Role_Interface
|
||||
{
|
||||
/**
|
||||
* Unique id of Role
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_roleId;
|
||||
|
||||
/**
|
||||
* Sets the Role identifier
|
||||
*
|
||||
* @param string $roleId
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($roleId)
|
||||
{
|
||||
$this->_roleId = (string) $roleId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Acl_Role_Interface; returns the Role identifier
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRoleId()
|
||||
{
|
||||
return $this->_roleId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Acl_Role_Interface; returns the Role identifier
|
||||
* Proxies to getRoleId()
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getRoleId();
|
||||
}
|
||||
}
|
37
library/Zend/Acl/Role/Interface.php
Normal file
37
library/Zend/Acl/Role/Interface.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Acl
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Interface.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Acl
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
interface Zend_Acl_Role_Interface
|
||||
{
|
||||
/**
|
||||
* Returns the string identifier of the Role
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRoleId();
|
||||
}
|
271
library/Zend/Acl/Role/Registry.php
Normal file
271
library/Zend/Acl/Role/Registry.php
Normal file
@ -0,0 +1,271 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Acl
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Registry.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @see Zend_Acl_Role_Interface
|
||||
*/
|
||||
require_once 'Zend/Acl/Role/Interface.php';
|
||||
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Acl
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Acl_Role_Registry
|
||||
{
|
||||
/**
|
||||
* Internal Role registry data storage
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_roles = array();
|
||||
|
||||
/**
|
||||
* Adds a Role having an identifier unique to the registry
|
||||
*
|
||||
* The $parents parameter may be a reference to, or the string identifier for,
|
||||
* a Role existing in the registry, or $parents may be passed as an array of
|
||||
* these - mixing string identifiers and objects is ok - to indicate the Roles
|
||||
* from which the newly added Role will directly inherit.
|
||||
*
|
||||
* In order to resolve potential ambiguities with conflicting rules inherited
|
||||
* from different parents, the most recently added parent takes precedence over
|
||||
* parents that were previously added. In other words, the first parent added
|
||||
* will have the least priority, and the last parent added will have the
|
||||
* highest priority.
|
||||
*
|
||||
* @param Zend_Acl_Role_Interface $role
|
||||
* @param Zend_Acl_Role_Interface|string|array $parents
|
||||
* @throws Zend_Acl_Role_Registry_Exception
|
||||
* @return Zend_Acl_Role_Registry Provides a fluent interface
|
||||
*/
|
||||
public function add(Zend_Acl_Role_Interface $role, $parents = null)
|
||||
{
|
||||
$roleId = $role->getRoleId();
|
||||
|
||||
if ($this->has($roleId)) {
|
||||
/**
|
||||
* @see Zend_Acl_Role_Registry_Exception
|
||||
*/
|
||||
require_once 'Zend/Acl/Role/Registry/Exception.php';
|
||||
throw new Zend_Acl_Role_Registry_Exception("Role id '$roleId' already exists in the registry");
|
||||
}
|
||||
|
||||
$roleParents = array();
|
||||
|
||||
if (null !== $parents) {
|
||||
if (!is_array($parents)) {
|
||||
$parents = array($parents);
|
||||
}
|
||||
/**
|
||||
* @see Zend_Acl_Role_Registry_Exception
|
||||
*/
|
||||
require_once 'Zend/Acl/Role/Registry/Exception.php';
|
||||
foreach ($parents as $parent) {
|
||||
try {
|
||||
if ($parent instanceof Zend_Acl_Role_Interface) {
|
||||
$roleParentId = $parent->getRoleId();
|
||||
} else {
|
||||
$roleParentId = $parent;
|
||||
}
|
||||
$roleParent = $this->get($roleParentId);
|
||||
} catch (Zend_Acl_Role_Registry_Exception $e) {
|
||||
throw new Zend_Acl_Role_Registry_Exception("Parent Role id '$roleParentId' does not exist", 0, $e);
|
||||
}
|
||||
$roleParents[$roleParentId] = $roleParent;
|
||||
$this->_roles[$roleParentId]['children'][$roleId] = $role;
|
||||
}
|
||||
}
|
||||
|
||||
$this->_roles[$roleId] = array(
|
||||
'instance' => $role,
|
||||
'parents' => $roleParents,
|
||||
'children' => array()
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the identified Role
|
||||
*
|
||||
* The $role parameter can either be a Role or a Role identifier.
|
||||
*
|
||||
* @param Zend_Acl_Role_Interface|string $role
|
||||
* @throws Zend_Acl_Role_Registry_Exception
|
||||
* @return Zend_Acl_Role_Interface
|
||||
*/
|
||||
public function get($role)
|
||||
{
|
||||
if ($role instanceof Zend_Acl_Role_Interface) {
|
||||
$roleId = $role->getRoleId();
|
||||
} else {
|
||||
$roleId = (string) $role;
|
||||
}
|
||||
|
||||
if (!$this->has($role)) {
|
||||
/**
|
||||
* @see Zend_Acl_Role_Registry_Exception
|
||||
*/
|
||||
require_once 'Zend/Acl/Role/Registry/Exception.php';
|
||||
throw new Zend_Acl_Role_Registry_Exception("Role '$roleId' not found");
|
||||
}
|
||||
|
||||
return $this->_roles[$roleId]['instance'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if and only if the Role exists in the registry
|
||||
*
|
||||
* The $role parameter can either be a Role or a Role identifier.
|
||||
*
|
||||
* @param Zend_Acl_Role_Interface|string $role
|
||||
* @return boolean
|
||||
*/
|
||||
public function has($role)
|
||||
{
|
||||
if ($role instanceof Zend_Acl_Role_Interface) {
|
||||
$roleId = $role->getRoleId();
|
||||
} else {
|
||||
$roleId = (string) $role;
|
||||
}
|
||||
|
||||
return isset($this->_roles[$roleId]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of an existing Role's parents
|
||||
*
|
||||
* The array keys are the identifiers of the parent Roles, and the values are
|
||||
* the parent Role instances. The parent Roles are ordered in this array by
|
||||
* ascending priority. The highest priority parent Role, last in the array,
|
||||
* corresponds with the parent Role most recently added.
|
||||
*
|
||||
* If the Role does not have any parents, then an empty array is returned.
|
||||
*
|
||||
* @param Zend_Acl_Role_Interface|string $role
|
||||
* @uses Zend_Acl_Role_Registry::get()
|
||||
* @return array
|
||||
*/
|
||||
public function getParents($role)
|
||||
{
|
||||
$roleId = $this->get($role)->getRoleId();
|
||||
|
||||
return $this->_roles[$roleId]['parents'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if and only if $role inherits from $inherit
|
||||
*
|
||||
* Both parameters may be either a Role or a Role identifier. If
|
||||
* $onlyParents is true, then $role must inherit directly from
|
||||
* $inherit in order to return true. By default, this method looks
|
||||
* through the entire inheritance DAG to determine whether $role
|
||||
* inherits from $inherit through its ancestor Roles.
|
||||
*
|
||||
* @param Zend_Acl_Role_Interface|string $role
|
||||
* @param Zend_Acl_Role_Interface|string $inherit
|
||||
* @param boolean $onlyParents
|
||||
* @throws Zend_Acl_Role_Registry_Exception
|
||||
* @return boolean
|
||||
*/
|
||||
public function inherits($role, $inherit, $onlyParents = false)
|
||||
{
|
||||
/**
|
||||
* @see Zend_Acl_Role_Registry_Exception
|
||||
*/
|
||||
require_once 'Zend/Acl/Role/Registry/Exception.php';
|
||||
try {
|
||||
$roleId = $this->get($role)->getRoleId();
|
||||
$inheritId = $this->get($inherit)->getRoleId();
|
||||
} catch (Zend_Acl_Role_Registry_Exception $e) {
|
||||
throw new Zend_Acl_Role_Registry_Exception($e->getMessage(), $e->getCode(), $e);
|
||||
}
|
||||
|
||||
$inherits = isset($this->_roles[$roleId]['parents'][$inheritId]);
|
||||
|
||||
if ($inherits || $onlyParents) {
|
||||
return $inherits;
|
||||
}
|
||||
|
||||
foreach ($this->_roles[$roleId]['parents'] as $parentId => $parent) {
|
||||
if ($this->inherits($parentId, $inheritId)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the Role from the registry
|
||||
*
|
||||
* The $role parameter can either be a Role or a Role identifier.
|
||||
*
|
||||
* @param Zend_Acl_Role_Interface|string $role
|
||||
* @throws Zend_Acl_Role_Registry_Exception
|
||||
* @return Zend_Acl_Role_Registry Provides a fluent interface
|
||||
*/
|
||||
public function remove($role)
|
||||
{
|
||||
/**
|
||||
* @see Zend_Acl_Role_Registry_Exception
|
||||
*/
|
||||
require_once 'Zend/Acl/Role/Registry/Exception.php';
|
||||
try {
|
||||
$roleId = $this->get($role)->getRoleId();
|
||||
} catch (Zend_Acl_Role_Registry_Exception $e) {
|
||||
throw new Zend_Acl_Role_Registry_Exception($e->getMessage(), $e->getCode(), $e);
|
||||
}
|
||||
|
||||
foreach ($this->_roles[$roleId]['children'] as $childId => $child) {
|
||||
unset($this->_roles[$childId]['parents'][$roleId]);
|
||||
}
|
||||
foreach ($this->_roles[$roleId]['parents'] as $parentId => $parent) {
|
||||
unset($this->_roles[$parentId]['children'][$roleId]);
|
||||
}
|
||||
|
||||
unset($this->_roles[$roleId]);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all Roles from the registry
|
||||
*
|
||||
* @return Zend_Acl_Role_Registry Provides a fluent interface
|
||||
*/
|
||||
public function removeAll()
|
||||
{
|
||||
$this->_roles = array();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRoles()
|
||||
{
|
||||
return $this->_roles;
|
||||
}
|
||||
|
||||
}
|
36
library/Zend/Acl/Role/Registry/Exception.php
Normal file
36
library/Zend/Acl/Role/Registry/Exception.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Acl
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Exception.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @see Zend_Acl_Exception
|
||||
*/
|
||||
require_once 'Zend/Acl/Exception.php';
|
||||
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Acl
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Acl_Role_Registry_Exception extends Zend_Acl_Exception
|
||||
{}
|
133
library/Zend/Amf/Adobe/Auth.php
Normal file
133
library/Zend/Amf/Adobe/Auth.php
Normal file
@ -0,0 +1,133 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Amf
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Auth.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** @see Zend_Amf_Auth_Abstract */
|
||||
require_once 'Zend/Amf/Auth/Abstract.php';
|
||||
|
||||
/** @see Zend_Acl */
|
||||
require_once 'Zend/Acl.php';
|
||||
|
||||
/** @see Zend_Auth_Result */
|
||||
require_once 'Zend/Auth/Result.php';
|
||||
|
||||
/**
|
||||
* This class implements authentication against XML file with roles for Flex Builder.
|
||||
*
|
||||
* @package Zend_Amf
|
||||
* @subpackage Adobe
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Amf_Adobe_Auth extends Zend_Amf_Auth_Abstract
|
||||
{
|
||||
|
||||
/**
|
||||
* ACL for authorization
|
||||
*
|
||||
* @var Zend_Acl
|
||||
*/
|
||||
protected $_acl;
|
||||
|
||||
/**
|
||||
* Username/password array
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_users = array();
|
||||
|
||||
/**
|
||||
* Create auth adapter
|
||||
*
|
||||
* @param string $rolefile File containing XML with users and roles
|
||||
*/
|
||||
public function __construct($rolefile)
|
||||
{
|
||||
$this->_acl = new Zend_Acl();
|
||||
$xml = simplexml_load_file($rolefile);
|
||||
/*
|
||||
Roles file format:
|
||||
<roles>
|
||||
<role id=”admin”>
|
||||
<user name=”user1” password=”pwd”/>
|
||||
</role>
|
||||
<role id=”hr”>
|
||||
<user name=”user2” password=”pwd2”/>
|
||||
</role>
|
||||
</roles>
|
||||
*/
|
||||
foreach($xml->role as $role) {
|
||||
$this->_acl->addRole(new Zend_Acl_Role((string)$role["id"]));
|
||||
foreach($role->user as $user) {
|
||||
$this->_users[(string)$user["name"]] = array("password" => (string)$user["password"],
|
||||
"role" => (string)$role["id"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ACL with roles from XML file
|
||||
*
|
||||
* @return Zend_Acl
|
||||
*/
|
||||
public function getAcl()
|
||||
{
|
||||
return $this->_acl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform authentication
|
||||
*
|
||||
* @throws Zend_Auth_Adapter_Exception
|
||||
* @return Zend_Auth_Result
|
||||
* @see Zend_Auth_Adapter_Interface#authenticate()
|
||||
*/
|
||||
public function authenticate()
|
||||
{
|
||||
if (empty($this->_username) ||
|
||||
empty($this->_password)) {
|
||||
/**
|
||||
* @see Zend_Auth_Adapter_Exception
|
||||
*/
|
||||
require_once 'Zend/Auth/Adapter/Exception.php';
|
||||
throw new Zend_Auth_Adapter_Exception('Username/password should be set');
|
||||
}
|
||||
|
||||
if(!isset($this->_users[$this->_username])) {
|
||||
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND,
|
||||
null,
|
||||
array('Username not found')
|
||||
);
|
||||
}
|
||||
|
||||
$user = $this->_users[$this->_username];
|
||||
if($user["password"] != $this->_password) {
|
||||
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID,
|
||||
null,
|
||||
array('Authentication failed')
|
||||
);
|
||||
}
|
||||
|
||||
$id = new stdClass();
|
||||
$id->role = $user["role"];
|
||||
$id->name = $this->_username;
|
||||
return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $id);
|
||||
}
|
||||
}
|
103
library/Zend/Amf/Adobe/DbInspector.php
Normal file
103
library/Zend/Amf/Adobe/DbInspector.php
Normal file
@ -0,0 +1,103 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Amf
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: DbInspector.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/**
|
||||
* This class implements authentication against XML file with roles for Flex Builder.
|
||||
*
|
||||
* @package Zend_Amf
|
||||
* @subpackage Adobe
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Amf_Adobe_DbInspector
|
||||
{
|
||||
|
||||
/**
|
||||
* Connect to the database
|
||||
*
|
||||
* @param string $dbType Database adapter type for Zend_Db
|
||||
* @param array|object $dbDescription Adapter-specific connection settings
|
||||
* @return Zend_Db_Adapter_Abstract
|
||||
* @see Zend_Db::factory()
|
||||
*/
|
||||
protected function _connect($dbType, $dbDescription)
|
||||
{
|
||||
if(is_object($dbDescription)) {
|
||||
$dbDescription = get_object_vars($dbDescription);
|
||||
}
|
||||
return Zend_Db::factory($dbType, $dbDescription);
|
||||
}
|
||||
|
||||
/**
|
||||
* Describe database object.
|
||||
*
|
||||
* Usage example:
|
||||
* $inspector->describeTable('Pdo_Mysql',
|
||||
* array(
|
||||
* 'host' => '127.0.0.1',
|
||||
* 'username' => 'webuser',
|
||||
* 'password' => 'xxxxxxxx',
|
||||
* 'dbname' => 'test'
|
||||
* ),
|
||||
* 'mytable'
|
||||
* );
|
||||
*
|
||||
* @param string $dbType Database adapter type for Zend_Db
|
||||
* @param array|object $dbDescription Adapter-specific connection settings
|
||||
* @param string $tableName Table name
|
||||
* @return array Table description
|
||||
* @see Zend_Db::describeTable()
|
||||
* @see Zend_Db::factory()
|
||||
*/
|
||||
public function describeTable($dbType, $dbDescription, $tableName)
|
||||
{
|
||||
$db = $this->_connect($dbType, $dbDescription);
|
||||
return $db->describeTable($tableName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test database connection
|
||||
*
|
||||
* @param string $dbType Database adapter type for Zend_Db
|
||||
* @param array|object $dbDescription Adapter-specific connection settings
|
||||
* @return bool
|
||||
* @see Zend_Db::factory()
|
||||
*/
|
||||
public function connect($dbType, $dbDescription)
|
||||
{
|
||||
$db = $this->_connect($dbType, $dbDescription);
|
||||
$db->listTables();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of database tables
|
||||
*
|
||||
* @param string $dbType Database adapter type for Zend_Db
|
||||
* @param array|object $dbDescription Adapter-specific connection settings
|
||||
* @return array List of the tables
|
||||
*/
|
||||
public function getTables($dbType, $dbDescription)
|
||||
{
|
||||
$db = $this->_connect($dbType, $dbDescription);
|
||||
return $db->listTables();
|
||||
}
|
||||
}
|
318
library/Zend/Amf/Adobe/Introspector.php
Normal file
318
library/Zend/Amf/Adobe/Introspector.php
Normal file
@ -0,0 +1,318 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Amf
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Introspector.php 23953 2011-05-03 05:47:39Z ralph $
|
||||
*/
|
||||
|
||||
/** @see Zend_Amf_Parse_TypeLoader */
|
||||
require_once 'Zend/Amf/Parse/TypeLoader.php';
|
||||
|
||||
/** @see Zend_Reflection_Class */
|
||||
require_once 'Zend/Reflection/Class.php';
|
||||
|
||||
/** @see Zend_Server_Reflection */
|
||||
require_once 'Zend/Server/Reflection.php';
|
||||
|
||||
/**
|
||||
* This class implements a service for generating AMF service descriptions as XML.
|
||||
*
|
||||
* @package Zend_Amf
|
||||
* @subpackage Adobe
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Amf_Adobe_Introspector
|
||||
{
|
||||
/**
|
||||
* Options used:
|
||||
* - server: instance of Zend_Amf_Server to use
|
||||
* - directories: directories where class files may be looked up
|
||||
*
|
||||
* @var array Introspector options
|
||||
*/
|
||||
protected $_options;
|
||||
|
||||
/**
|
||||
* @var DOMElement DOM element to store types
|
||||
*/
|
||||
protected $_types;
|
||||
|
||||
/**
|
||||
* @var array Map of the known types
|
||||
*/
|
||||
protected $_typesMap = array();
|
||||
|
||||
/**
|
||||
* @var DOMDocument XML document to store data
|
||||
*/
|
||||
protected $_xml;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->_xml = new DOMDocument('1.0', 'utf-8');
|
||||
}
|
||||
|
||||
/**
|
||||
* Create XML definition on an AMF service class
|
||||
*
|
||||
* @param string $serviceClass Service class name
|
||||
* @param array $options invocation options
|
||||
* @return string XML with service class introspection
|
||||
*/
|
||||
public function introspect($serviceClass, $options = array())
|
||||
{
|
||||
$this->_options = $options;
|
||||
|
||||
if (strpbrk($serviceClass, '\\/<>')) {
|
||||
return $this->_returnError('Invalid service name');
|
||||
}
|
||||
|
||||
// Transform com.foo.Bar into com_foo_Bar
|
||||
$serviceClass = str_replace('.' , '_', $serviceClass);
|
||||
|
||||
// Introspect!
|
||||
if (!class_exists($serviceClass)) {
|
||||
require_once 'Zend/Loader.php';
|
||||
Zend_Loader::loadClass($serviceClass, $this->_getServicePath());
|
||||
}
|
||||
|
||||
$serv = $this->_xml->createElement('service-description');
|
||||
$serv->setAttribute('xmlns', 'http://ns.adobe.com/flex/service-description/2008');
|
||||
|
||||
$this->_types = $this->_xml->createElement('types');
|
||||
$this->_ops = $this->_xml->createElement('operations');
|
||||
|
||||
$r = Zend_Server_Reflection::reflectClass($serviceClass);
|
||||
$this->_addService($r, $this->_ops);
|
||||
|
||||
$serv->appendChild($this->_types);
|
||||
$serv->appendChild($this->_ops);
|
||||
$this->_xml->appendChild($serv);
|
||||
|
||||
return $this->_xml->saveXML();
|
||||
}
|
||||
|
||||
/**
|
||||
* Authentication handler
|
||||
*
|
||||
* @param Zend_Acl $acl
|
||||
* @return unknown_type
|
||||
*/
|
||||
public function initAcl(Zend_Acl $acl)
|
||||
{
|
||||
return false; // we do not need auth for this class
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate map of public class attributes
|
||||
*
|
||||
* @param string $typename type name
|
||||
* @param DOMElement $typexml target XML element
|
||||
* @return void
|
||||
*/
|
||||
protected function _addClassAttributes($typename, DOMElement $typexml)
|
||||
{
|
||||
// Do not try to autoload here because _phpTypeToAS should
|
||||
// have already attempted to load this class
|
||||
if (!class_exists($typename, false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$rc = new Zend_Reflection_Class($typename);
|
||||
foreach ($rc->getProperties() as $prop) {
|
||||
if (!$prop->isPublic()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$propxml = $this->_xml->createElement('property');
|
||||
$propxml->setAttribute('name', $prop->getName());
|
||||
|
||||
$type = $this->_registerType($this->_getPropertyType($prop));
|
||||
$propxml->setAttribute('type', $type);
|
||||
|
||||
$typexml->appendChild($propxml);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build XML service description from reflection class
|
||||
*
|
||||
* @param Zend_Server_Reflection_Class $refclass
|
||||
* @param DOMElement $target target XML element
|
||||
* @return void
|
||||
*/
|
||||
protected function _addService(Zend_Server_Reflection_Class $refclass, DOMElement $target)
|
||||
{
|
||||
foreach ($refclass->getMethods() as $method) {
|
||||
if (!$method->isPublic()
|
||||
|| $method->isConstructor()
|
||||
|| ('__' == substr($method->name, 0, 2))
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($method->getPrototypes() as $proto) {
|
||||
$op = $this->_xml->createElement('operation');
|
||||
$op->setAttribute('name', $method->getName());
|
||||
|
||||
$rettype = $this->_registerType($proto->getReturnType());
|
||||
$op->setAttribute('returnType', $rettype);
|
||||
|
||||
foreach ($proto->getParameters() as $param) {
|
||||
$arg = $this->_xml->createElement('argument');
|
||||
$arg->setAttribute('name', $param->getName());
|
||||
|
||||
$type = $param->getType();
|
||||
if ($type == 'mixed' && ($pclass = $param->getClass())) {
|
||||
$type = $pclass->getName();
|
||||
}
|
||||
|
||||
$ptype = $this->_registerType($type);
|
||||
$arg->setAttribute('type', $ptype);
|
||||
|
||||
if($param->isDefaultValueAvailable()) {
|
||||
$arg->setAttribute('defaultvalue', $param->getDefaultValue());
|
||||
}
|
||||
|
||||
$op->appendChild($arg);
|
||||
}
|
||||
|
||||
$target->appendChild($op);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract type of the property from DocBlock
|
||||
*
|
||||
* @param Zend_Reflection_Property $prop reflection property object
|
||||
* @return string Property type
|
||||
*/
|
||||
protected function _getPropertyType(Zend_Reflection_Property $prop)
|
||||
{
|
||||
$docBlock = $prop->getDocComment();
|
||||
|
||||
if (!$docBlock) {
|
||||
return 'Unknown';
|
||||
}
|
||||
|
||||
if (!$docBlock->hasTag('var')) {
|
||||
return 'Unknown';
|
||||
}
|
||||
|
||||
$tag = $docBlock->getTag('var');
|
||||
return trim($tag->getDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the array of service directories
|
||||
*
|
||||
* @return array Service class directories
|
||||
*/
|
||||
protected function _getServicePath()
|
||||
{
|
||||
if (isset($this->_options['server'])) {
|
||||
return $this->_options['server']->getDirectory();
|
||||
}
|
||||
|
||||
if (isset($this->_options['directories'])) {
|
||||
return $this->_options['directories'];
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Map from PHP type name to AS type name
|
||||
*
|
||||
* @param string $typename PHP type name
|
||||
* @return string AS type name
|
||||
*/
|
||||
protected function _phpTypeToAS($typename)
|
||||
{
|
||||
if (class_exists($typename)) {
|
||||
$vars = get_class_vars($typename);
|
||||
|
||||
if (isset($vars['_explicitType'])) {
|
||||
return $vars['_explicitType'];
|
||||
}
|
||||
}
|
||||
|
||||
if (false !== ($asname = Zend_Amf_Parse_TypeLoader::getMappedClassName($typename))) {
|
||||
return $asname;
|
||||
}
|
||||
|
||||
return $typename;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register new type on the system
|
||||
*
|
||||
* @param string $typename type name
|
||||
* @return string New type name
|
||||
*/
|
||||
protected function _registerType($typename)
|
||||
{
|
||||
// Known type - return its AS name
|
||||
if (isset($this->_typesMap[$typename])) {
|
||||
return $this->_typesMap[$typename];
|
||||
}
|
||||
|
||||
// Standard types
|
||||
if (in_array($typename, array('void', 'null', 'mixed', 'unknown_type'))) {
|
||||
return 'Unknown';
|
||||
}
|
||||
|
||||
// Arrays
|
||||
if ('array' == $typename) {
|
||||
return 'Unknown[]';
|
||||
}
|
||||
|
||||
if (in_array($typename, array('int', 'integer', 'bool', 'boolean', 'float', 'string', 'object', 'Unknown', 'stdClass'))) {
|
||||
return $typename;
|
||||
}
|
||||
|
||||
// Resolve and store AS name
|
||||
$asTypeName = $this->_phpTypeToAS($typename);
|
||||
$this->_typesMap[$typename] = $asTypeName;
|
||||
|
||||
// Create element for the name
|
||||
$typeEl = $this->_xml->createElement('type');
|
||||
$typeEl->setAttribute('name', $asTypeName);
|
||||
$this->_addClassAttributes($typename, $typeEl);
|
||||
$this->_types->appendChild($typeEl);
|
||||
|
||||
return $asTypeName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return error with error message
|
||||
*
|
||||
* @param string $msg Error message
|
||||
* @return string
|
||||
*/
|
||||
protected function _returnError($msg)
|
||||
{
|
||||
return 'ERROR: $msg';
|
||||
}
|
||||
}
|
42
library/Zend/Amf/Auth/Abstract.php
Normal file
42
library/Zend/Amf/Auth/Abstract.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Amf
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Abstract.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** @see Zend_Auth_Adapter_Interface */
|
||||
require_once 'Zend/Auth/Adapter/Interface.php';
|
||||
|
||||
/**
|
||||
* Base abstract class for AMF authentication implementation
|
||||
*
|
||||
* @package Zend_Amf
|
||||
* @subpackage Auth
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
abstract class Zend_Amf_Auth_Abstract implements Zend_Auth_Adapter_Interface
|
||||
{
|
||||
protected $_username;
|
||||
protected $_password;
|
||||
|
||||
public function setCredentials($username, $password) {
|
||||
$this->_username = $username;
|
||||
$this->_password = $password;
|
||||
}
|
||||
}
|
87
library/Zend/Amf/Constants.php
Normal file
87
library/Zend/Amf/Constants.php
Normal file
@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Amf
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Constants.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/**
|
||||
* The following constants are used throughout serialization and
|
||||
* deserialization to detect the AMF marker and encoding types.
|
||||
*
|
||||
* @package Zend_Amf
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
final class Zend_Amf_Constants
|
||||
{
|
||||
const AMF0_NUMBER = 0x00;
|
||||
const AMF0_BOOLEAN = 0x01;
|
||||
const AMF0_STRING = 0x02;
|
||||
const AMF0_OBJECT = 0x03;
|
||||
const AMF0_MOVIECLIP = 0x04;
|
||||
const AMF0_NULL = 0x05;
|
||||
const AMF0_UNDEFINED = 0x06;
|
||||
const AMF0_REFERENCE = 0x07;
|
||||
const AMF0_MIXEDARRAY = 0x08;
|
||||
const AMF0_OBJECTTERM = 0x09;
|
||||
const AMF0_ARRAY = 0x0a;
|
||||
const AMF0_DATE = 0x0b;
|
||||
const AMF0_LONGSTRING = 0x0c;
|
||||
const AMF0_UNSUPPORTED = 0x0e;
|
||||
const AMF0_XML = 0x0f;
|
||||
const AMF0_TYPEDOBJECT = 0x10;
|
||||
const AMF0_AMF3 = 0x11;
|
||||
const AMF0_OBJECT_ENCODING = 0x00;
|
||||
|
||||
const AMF3_UNDEFINED = 0x00;
|
||||
const AMF3_NULL = 0x01;
|
||||
const AMF3_BOOLEAN_FALSE = 0x02;
|
||||
const AMF3_BOOLEAN_TRUE = 0x03;
|
||||
const AMF3_INTEGER = 0x04;
|
||||
const AMF3_NUMBER = 0x05;
|
||||
const AMF3_STRING = 0x06;
|
||||
const AMF3_XML = 0x07;
|
||||
const AMF3_DATE = 0x08;
|
||||
const AMF3_ARRAY = 0x09;
|
||||
const AMF3_OBJECT = 0x0A;
|
||||
const AMF3_XMLSTRING = 0x0B;
|
||||
const AMF3_BYTEARRAY = 0x0C;
|
||||
const AMF3_OBJECT_ENCODING = 0x03;
|
||||
|
||||
// Object encodings for AMF3 object types
|
||||
const ET_PROPLIST = 0x00;
|
||||
const ET_EXTERNAL = 0x01;
|
||||
const ET_DYNAMIC = 0x02;
|
||||
const ET_PROXY = 0x03;
|
||||
|
||||
const FMS_OBJECT_ENCODING = 0x01;
|
||||
|
||||
/**
|
||||
* Special content length value that indicates "unknown" content length
|
||||
* per AMF Specification
|
||||
*/
|
||||
const UNKNOWN_CONTENT_LENGTH = -1;
|
||||
const URL_APPEND_HEADER = 'AppendToGatewayUrl';
|
||||
const RESULT_METHOD = '/onResult';
|
||||
const STATUS_METHOD = '/onStatus';
|
||||
const CREDENTIALS_HEADER = 'Credentials';
|
||||
const PERSISTENT_HEADER = 'RequestPersistentHeader';
|
||||
const DESCRIBE_HEADER = 'DescribeService';
|
||||
|
||||
const GUEST_ROLE = 'anonymous';
|
||||
}
|
34
library/Zend/Amf/Exception.php
Normal file
34
library/Zend/Amf/Exception.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Amf
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Exception.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Exception
|
||||
*/
|
||||
require_once 'Zend/Exception.php';
|
||||
|
||||
/**
|
||||
* @package Zend_Amf
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Amf_Exception extends Zend_Exception
|
||||
{
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user