Compare commits
303 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
4bf2ca7a4b | ||
|
8c4fb83566 | ||
|
6889d5294a | ||
|
57aa0bc875 | ||
|
77368058b1 | ||
|
286ad446cf | ||
|
676e15833e | ||
|
d9ac13d453 | ||
|
2d6c9545c8 | ||
|
4adddfb061 | ||
|
b0c5b83115 | ||
|
8bc286bdab | ||
|
5a47a6a24a | ||
|
4fd7614f58 | ||
|
85ed70bdb0 | ||
|
fcafbe31f8 | ||
|
70e6ac262a | ||
|
1f29e9f4d8 | ||
|
5f86ae58b6 | ||
|
0f81a66b90 | ||
|
f0285eb499 | ||
|
0eab5291e9 | ||
|
511e2af345 | ||
|
2180eb9f3a | ||
|
adaaa66dd1 | ||
|
0db3c8907c | ||
|
95a57d9446 | ||
|
fdd3dddbe1 | ||
|
8932eb138a | ||
|
619da73aae | ||
|
3a78d2bb5c | ||
|
d8d52662f4 | ||
|
605e963695 | ||
|
a153844832 | ||
|
51cab1e5d2 | ||
|
42710f7528 | ||
|
0610903073 | ||
|
b62d3189e9 | ||
|
4526fe80f0 | ||
|
a65a9fc2a2 | ||
|
75c0391a19 | ||
|
d2cd06d96b | ||
|
2931f21cc4 | ||
|
d99f974c7c | ||
|
046db3272d | ||
|
d68cf89d21 | ||
|
e097a2074d | ||
|
d4a3ca4360 | ||
|
f7fd60c9a0 | ||
|
5399c57010 | ||
|
d0a0857987 | ||
|
35e837af81 | ||
|
fbb019c7d4 | ||
|
7ca32d69e4 | ||
|
088dd975a6 | ||
|
6487cb4532 | ||
|
83d3cb5f4a | ||
|
e96ce7127b | ||
|
b06cd50d82 | ||
|
6a22104b36 | ||
|
3e48103956 | ||
|
4ad4c24221 | ||
|
62fc0c17d5 | ||
|
401dfa0cf3 | ||
|
d2996c69f7 | ||
|
2ab8d3e583 | ||
|
55e05fbe63 | ||
|
512abb9d38 | ||
|
e6e169fbe7 | ||
|
349dde60de | ||
|
f6a9e222c1 | ||
|
1bdce6771c | ||
|
4197ad76cb | ||
|
da28d19390 | ||
|
38922b0fd0 | ||
|
9fc24e0ab1 | ||
|
697c7ebb5d | ||
|
82a99a4efa | ||
|
bb82175e59 | ||
|
b0207bf239 | ||
|
9510505afd | ||
|
a346cf5505 | ||
|
7c18e4a4b1 | ||
|
17e152ce0b | ||
|
0233d4b34f | ||
|
b0962b753c | ||
|
5ad2717112 | ||
|
2f26c2409d | ||
|
42c9f843e3 | ||
|
7cf0b68865 | ||
|
0d1a39b237 | ||
|
e18f1b3b40 | ||
|
3d867a8c7f | ||
|
9db6f449a1 | ||
|
7f3954d470 | ||
|
e2bc5393a7 | ||
|
b3bc52e460 | ||
|
57c1766c60 | ||
|
003681a91d | ||
|
f83053458e | ||
|
cbe5f56cc4 | ||
|
26fdd036c4 | ||
|
e2c64172fb | ||
|
a638ebf87f | ||
|
bbd9d47187 | ||
|
572eaf92c9 | ||
|
875025e507 | ||
|
4686cbc8d5 | ||
|
838c0aeb4a | ||
|
26d4ad4ae0 | ||
|
18bd65b991 | ||
|
3993257e59 | ||
|
27438be586 | ||
|
b0ba3c25ba | ||
|
82fd8a3fae | ||
|
943eb22c7c | ||
|
ee95e69664 | ||
|
bfe9a89091 | ||
|
8cd4fe17d0 | ||
|
fe9747f9e4 | ||
|
976e10b434 | ||
|
6025314471 | ||
|
9983e9c1eb | ||
|
d6bcd86464 | ||
|
b9cec9515b | ||
|
af1730d2e6 | ||
|
fa03081e67 | ||
|
d9253f962e | ||
|
a2568e417b | ||
|
21ddf64775 | ||
|
7135be80d3 | ||
|
d668dbc2d1 | ||
|
9581c825db | ||
|
1da719624c | ||
|
791e5c14ad | ||
|
80e214a19b | ||
|
ecc492c1ce | ||
|
189a519597 | ||
|
58b1e456f7 | ||
|
eb58f69819 | ||
|
23166356d4 | ||
|
28f7d52e43 | ||
|
75e6913ccf | ||
|
78c4d98eee | ||
|
4b4608f306 | ||
|
edf7b7e028 | ||
|
0e43da9d1c | ||
|
3c89575003 | ||
|
e5929d53c4 | ||
|
d6b00d4063 | ||
|
a4391f3886 | ||
|
c1c8449c72 | ||
|
d3684f6835 | ||
|
05b829d0d7 | ||
|
2bb37b2e11 | ||
|
71b6864bcc | ||
|
90031051ee | ||
|
d6532f955a | ||
|
efa137c644 | ||
|
2c816731ed | ||
|
ffc27e0766 | ||
|
59df244e79 | ||
|
85dd71c9fa | ||
|
4a3f20b578 | ||
|
74187e5e35 | ||
|
ad3c39fcfc | ||
|
9c860a1f1f | ||
|
42c7be5e22 | ||
|
fe9a39bd82 | ||
|
9a0853c2ea | ||
|
e579d3a90a | ||
|
06c50d0d36 | ||
|
aaf95f0b35 | ||
|
3d8bdbba8b | ||
|
cee2fe1bd3 | ||
|
a76be3aae3 | ||
|
aade0196ae | ||
|
b8933aa09a | ||
|
d8d87f04f2 | ||
|
23fae60167 | ||
|
398171e813 | ||
|
1b7965fbd2 | ||
|
4b99c809fc | ||
|
b790b950f1 | ||
|
878b621a08 | ||
|
24eb5def51 | ||
|
bb5b0b707a | ||
|
26869a2fd8 | ||
|
41a7d74bfd | ||
|
db04d8c77e | ||
|
6ec41300d2 | ||
|
79dd70b755 | ||
|
0ea33fb71b | ||
|
87e98e8848 | ||
|
3038e83be4 | ||
|
504d74b63e | ||
|
eb097d1535 | ||
|
b530470273 | ||
|
ba61d4c817 | ||
|
f4f050dadd | ||
|
a79970de29 | ||
|
b33b364f32 | ||
|
843bb1fb5b | ||
|
c1c655d84b | ||
|
537340d274 | ||
|
54c828c7ff | ||
|
219f23f227 | ||
|
cc1f7de75c | ||
|
1568c4ad72 | ||
|
21f4d8824c | ||
|
f5f3711cbf | ||
|
2966e158cd | ||
|
d2ff25fc12 | ||
|
f6e540eb64 | ||
|
626795a877 | ||
|
6bdf5bfa6e | ||
|
1e678a2311 | ||
|
f3805d0982 | ||
|
eb6586aaac | ||
|
a66664c166 | ||
|
9a97455d5b | ||
|
94503708a4 | ||
|
b28cf0c144 | ||
|
a7d3ac6158 | ||
|
c88eb0c2fb | ||
|
9a8d4b6967 | ||
|
8cb021d031 | ||
|
6e6d0e7eae | ||
|
d9bb3e8a74 | ||
|
d10344ae41 | ||
|
faf22f9755 | ||
|
5bcee45652 | ||
|
915d54a719 | ||
|
57c6565b86 | ||
|
2155ccfc3d | ||
|
bc1a47cc5c | ||
|
ef01f0d618 | ||
|
32d7023345 | ||
|
c81c3a6b29 | ||
|
8881b8f576 | ||
|
57c2bfa9a1 | ||
|
9fb82f87a1 | ||
|
9a70310c6a | ||
|
af568d45d2 | ||
|
38bb1176ee | ||
|
e235c8545b | ||
|
fb2d7b2c4e | ||
|
c5cdaa3e8c | ||
|
52aecfd2e2 | ||
|
792c243f3a | ||
|
80e12eda14 | ||
|
fe2e2dfb74 | ||
|
71f591e16a | ||
|
2100693b79 | ||
|
a3fe0d3af0 | ||
|
abe6ad158e | ||
|
04c7bb6f02 | ||
|
3d54b21d08 | ||
|
a48e8eeaaf | ||
|
d2a574d49e | ||
|
9312fee50b | ||
|
2bf6e1bb6d | ||
|
c49a520bf5 | ||
|
f600df4cd6 | ||
|
e3e2587a08 | ||
|
55845ab56e | ||
|
df51ce2355 | ||
|
25147d0665 | ||
|
fed721dff2 | ||
|
833dd45596 | ||
|
9592b189b5 | ||
|
cceb47deaf | ||
|
31667cac6c | ||
|
8677f04e5a | ||
|
8d7fb98111 | ||
|
6762b15a00 | ||
|
60b733b8b6 | ||
|
e12080b214 | ||
|
5fdd0a9e0a | ||
|
bed36082ae | ||
|
2677c972bf | ||
|
6baa4f4edd | ||
|
8f72a9e539 | ||
|
68126b1576 | ||
|
f7f2574321 | ||
|
6c3fa57080 | ||
|
3f7061b48d | ||
|
99ba700276 | ||
|
6adc157fc9 | ||
|
b906fc56ea | ||
|
e6f1065c19 | ||
|
8e6c107fe2 | ||
|
65cc5b272b | ||
|
dee2273c53 | ||
|
f7a0c0d33a | ||
|
b888f2b128 | ||
|
d0cac19a26 | ||
|
3f4e689a90 | ||
|
9619043e94 | ||
|
cbbc35290c | ||
|
ccfc6ac497 | ||
|
f9175c5e8b | ||
|
a72755c3a1 |
90
application/Bootstrap.php
Normal file
90
application/Bootstrap.php
Normal file
@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||
{
|
||||
protected function _initViewSettings()
|
||||
{
|
||||
$this->bootstrap('view');
|
||||
$view = $this->getResource('view');
|
||||
$pathStyle = '/themes/default/styles';
|
||||
$pathScript = '/themes/default/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.'/jquery.qtip.css', 'all')
|
||||
->appendStylesheet('/themes/jstree/default/style.css')
|
||||
->appendStylesheet('/themes/jqueryui/jquery-ui.css', 'all')
|
||||
->appendStylesheet($pathStyle.'/main.css', 'all');
|
||||
//->appendStylesheet('/themes/multiselect/css/ui.multiselect.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.'/upload.js', 'text/javascript')
|
||||
->appendFile($pathScript.'/scripts.js', 'text/javascript');
|
||||
//->appendFile($pathScript.'/ui.multiselect.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);
|
||||
}
|
||||
|
||||
protected function _initAutoload()
|
||||
{
|
||||
require_once APPLICATION_PATH . '/../library/Zend/Loader/Autoloader.php';
|
||||
|
||||
$appPath = realpath(dirname(__FILE__));
|
||||
$rootPath = dirname($appPath);
|
||||
$autoload = Zend_Loader_Autoloader::getInstance();
|
||||
|
||||
$application = new Zend_Loader_Autoloader_Resource(array(
|
||||
'basePath' => $appPath . '/modules/frontend/models/',
|
||||
'namespace' => '',
|
||||
'resourceTypes' => array('tables'=>array('path'=>'Tables/','namespace'=>'Table'),
|
||||
'objects'=>array('path'=>'Objects/', 'namespace'=>'Object'),
|
||||
'forms'=>array('path'=>'Forms/', 'namespace'=>'Form')
|
||||
)));
|
||||
|
||||
$libs = new Zend_Loader_Autoloader_Resource(array(
|
||||
'basePath' => $rootPath . '/library',
|
||||
'namespace' => 'library',
|
||||
'resourceTypes' => array('libs'=>array('path'=>'libs/','namespace'=>'Libs'),
|
||||
)));
|
||||
|
||||
$loader = new Zend_Application_Module_Autoloader(array(
|
||||
'namespace' => '',
|
||||
'basePath' => APPLICATION_PATH));
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
|
47
application/configs/application.ini
Normal file
47
application/configs/application.ini
Normal file
@ -0,0 +1,47 @@
|
||||
[production]
|
||||
phpSettings.date.timezone = "Europe/Paris"
|
||||
phpSettings.display_startup_errors = 0
|
||||
phpSettings.display_errors = 0
|
||||
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
|
||||
bootstrap.class = "Bootstrap"
|
||||
resources.session.save_path = APPLICATION_PATH "/../cache/sessions"
|
||||
resources.session.gc_maxlifetime = 86400
|
||||
resources.session.cookie_lifetime = 86400
|
||||
resources.session.remember_me_seconds = 86400
|
||||
|
||||
; so auto-loading will find our classes in library/App
|
||||
autoloaderNamespaces[] = "Structure_" ;Les structures de données
|
||||
autoloaderNamespaces[] = "Libs_" ;Librairies de l'application
|
||||
resources.view[] = ""
|
||||
|
||||
; initialize front controller resource
|
||||
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
|
||||
resources.frontController.defaultControllerName = "index"
|
||||
resources.frontController.defaultAction = "index"
|
||||
resources.frontController.defaultModule = "frontend"
|
||||
|
||||
autoloaderNamespaces[] = "Scores_"
|
||||
autoloaderNamespaces[] = "Application_"
|
||||
resources.frontController.plugins.Auth = "Application_Controller_Plugin_Auth"
|
||||
resources.frontController.plugins.Comptage = "Application_Controller_Plugin_Comptage"
|
||||
|
||||
|
||||
;Resource router Backend
|
||||
;resources.router.routes.admin.type = Zend_Controller_Router_Route
|
||||
;resources.router.routes.admin.route = "/backend/*"
|
||||
;resources.router.routes.admin.defaults.module = backend
|
||||
;resources.router.routes.admin.defaults.controller = index
|
||||
;resources.router.routes.admin.defaults.action = index
|
||||
|
||||
; initialize layout resource
|
||||
resources.layout.layoutPath = APPLICATION_PATH "/layouts"
|
||||
|
||||
[staging : production]
|
||||
phpSettings.display_startup_errors = 1
|
||||
phpSettings.display_errors = 1
|
||||
resources.frontController.params.displayExceptions = 1
|
||||
|
||||
[development : production]
|
||||
phpSettings.display_startup_errors = 1
|
||||
phpSettings.display_errors = 1
|
||||
resources.frontController.params.displayExceptions = 1
|
1
application/layouts/footer.phtml
Normal file
1
application/layouts/footer.phtml
Normal file
@ -0,0 +1 @@
|
||||
<?php
|
35
application/layouts/header.phtml
Normal file
35
application/layouts/header.phtml
Normal file
@ -0,0 +1,35 @@
|
||||
<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>
|
||||
<?php if ( $this->admin ) {?>
|
||||
<li><a href="<?=$this->url(array('controller'=>'gestion', 'action'=>'index'), null, true)?>">Gestion</a></li>
|
||||
<?php }?>
|
||||
<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'=>'comptage', 'action'=> 'reset'))?>">Initialiser les critères</a>],
|
||||
[<a class="saveciblage" href="<?=$this->url(array('controller'=>'comptage', 'action'=>'savedialog'))?>">Sauvegarder le profil du ciblage</a>]
|
||||
</div>
|
||||
<?php }?>
|
||||
</div>
|
23
application/layouts/layout.phtml
Normal file
23
application/layouts/layout.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>
|
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
class AideController extends Zend_Controller_Action
|
||||
{
|
||||
|
||||
public function indexAction(){}
|
||||
|
||||
public function aproposdeAction(){}
|
||||
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
class ArborescenceController extends Libs_Controller
|
||||
{
|
||||
/* Nafs */
|
||||
public function nafAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$request = $this->getRequest();
|
||||
$key = $request->getParam('key');
|
||||
$object = new Object_Naf();
|
||||
|
||||
$this->view->key = $key;
|
||||
$this->view->naf = $object->naf($request->getParam('niveau', 1), $key);
|
||||
}
|
||||
|
||||
public function nafajaxAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
|
||||
$request = $this->getRequest();
|
||||
$key = $request->getParam('key');
|
||||
$object = new Object_Naf();
|
||||
|
||||
echo $object->ajax($request->getParam('parent', ''),
|
||||
$request->getParam('niveau', 1),
|
||||
$request->getParam('key')
|
||||
);
|
||||
}
|
||||
|
||||
/* Geographiques */
|
||||
public function geographiqueAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
||||
$object = new Object_Codepostaux();
|
||||
$key = $this->getRequest()->getParam('key');
|
||||
|
||||
$this->view->key = $key;
|
||||
$this->view->regions = $object->_getRegions();
|
||||
}
|
||||
|
||||
public function geographiqueajaxAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
|
||||
$request = $this->getRequest();
|
||||
$id = $request->getParam('id');
|
||||
$niveau = $request->getParam('niveau');
|
||||
$object = new Object_Codepostaux();
|
||||
|
||||
if($niveau == 0) {
|
||||
echo ($object->_getDepartements($id));
|
||||
} else if ($niveau == 1) {
|
||||
echo ($object->_getCommunes($id));
|
||||
}
|
||||
}
|
||||
|
||||
/* Forme Juridique */
|
||||
public function juridiqueAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
||||
$object = new Object_Formejuridique();
|
||||
$key = $this->getRequest()->getParam('key');
|
||||
|
||||
$this->view->key = $key;
|
||||
$this->view->formejuridiques = $object->_getParents();
|
||||
}
|
||||
|
||||
public function juridiqueajaxAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
$object = new Object_Formejuridique();
|
||||
$request = $this->getRequest();
|
||||
$id = $request->getParam('id');
|
||||
|
||||
echo ($object->_getFils($id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
137
application/modules/frontend/controllers/ComptageController.php
Normal file
137
application/modules/frontend/controllers/ComptageController.php
Normal file
@ -0,0 +1,137 @@
|
||||
<?php
|
||||
class ComptageController extends Zend_Controller_Action
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
/* Initialize action controller here */
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$request = $this->getRequest();
|
||||
|
||||
$object = new Object_Comptage();
|
||||
echo $object->count($request->getParam('cle'), $request->getParam('valeur'));
|
||||
}
|
||||
|
||||
public function resetAction()
|
||||
{
|
||||
require_once 'Scores/SessionCiblage.php';
|
||||
$erreurs = new Zend_Session_Namespace('erreurs');
|
||||
$session = new SessionCiblage();
|
||||
$session->clearCiblage();
|
||||
unset($erreurs->erreurs);
|
||||
$this->_redirect('./');
|
||||
}
|
||||
|
||||
public function savedialogAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
//Récupération de la session pour le profil et les valeurs du comptage
|
||||
require_once 'Scores/SessionCiblage.php';
|
||||
$session = new SessionCiblage();
|
||||
$criteres = $session->getCriteres();
|
||||
$this->view->criteres = $criteres;
|
||||
|
||||
if (count($criteres) == 0) {
|
||||
$this->view->noSelection = true;
|
||||
}
|
||||
}
|
||||
|
||||
public function saveAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
$request = $this->getRequest();
|
||||
$object = new Object_Comptage();
|
||||
$object->saveComptage($request->getParam('ref', ''));
|
||||
}
|
||||
|
||||
public function updateAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$request = $this->getRequest();
|
||||
$idCriteres = $request->getParam('id');
|
||||
|
||||
//Récupération des critères du ciblage
|
||||
$criteresM = new Table_Criteres();
|
||||
$criteresRow = $criteresM->find($idCriteres);
|
||||
$criteres = $criteresRow->current();
|
||||
$structure = json_decode($criteres->criteres, true);
|
||||
|
||||
require_once 'Scores/Field.php';
|
||||
$field = new Fields();
|
||||
$values = $field->getValues($structure);
|
||||
|
||||
//Comptage
|
||||
require_once 'Scores/Ciblage.php';
|
||||
$ciblage = new Ciblage($values);
|
||||
|
||||
$data = array(
|
||||
'idDefinition' => $idCriteres,
|
||||
'resultat' => $ciblage->execute(),
|
||||
'uniteInsee' => $ciblage->calculRedevanceInsee(),
|
||||
'dateAjout' => date('YmdHis'),
|
||||
);
|
||||
//Enregistrement
|
||||
$comptageM = new Table_Comptages();
|
||||
$comptageM->insert($data);
|
||||
//Retour comptage, unité Insee
|
||||
$result = array(
|
||||
'resultat' => number_format($data['resultat'], 0, '', ' '),
|
||||
'uniteInsee' => number_format($data['uniteInsee'], 0, '', ' '),
|
||||
'dateAjout' => substr($data['dateAjout'],6,2).'/'.substr($data['dateAjout'],4,2).'/'.substr($data['dateAjout'],6,2)
|
||||
.' '.substr($data['dateAjout'],8,2).':'.substr($data['dateAjout'],10,2).':'.substr($data['dateAjout'],12,2),
|
||||
);
|
||||
$this->view->result = $result;
|
||||
}
|
||||
|
||||
public function previsualisationAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
||||
$request = $this->getRequest();
|
||||
$object = new Object_Comptage();
|
||||
$sirets = $object->count(null, null, true);
|
||||
$dbConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'databases');
|
||||
try {
|
||||
$dbMetier = Zend_Db::factory($dbConfig->jo);
|
||||
} catch ( Exception $e ) {
|
||||
exit ( $e->getMessage() );
|
||||
}
|
||||
$i = 0;
|
||||
foreach($sirets as $siret) {
|
||||
if($i>10)
|
||||
break;
|
||||
$sql = $dbMetier->select()->from('etablissements_act')->where('siren = ?', substr($siret, 0, 9))
|
||||
->where('nic = ?', substr($siret, 9, strlen($siret)));
|
||||
$result = $dbMetier->fetchRow($sql);
|
||||
/*Provisoir...*/
|
||||
$result['tel'] = str_pad($result['tel'], 10, 0, STR_PAD_LEFT);
|
||||
$result['fax'] = str_pad($result['fax'], 10, 0, STR_PAD_LEFT);
|
||||
$previ[] = $result;
|
||||
$i++;
|
||||
}
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
//$object->getProfil($user->username, $user->idClient);
|
||||
$table = new Table_EnrichissementProfils();
|
||||
$sql = $table->select()
|
||||
->where('login = ?', $user->username)
|
||||
->where('idClient = ?', $user->idClient);
|
||||
$result = $table->fetchRow($sql);
|
||||
if(!empty($result)) {
|
||||
$result = $result->toArray();
|
||||
$champs = json_decode($result['criteres']);
|
||||
require_once('Scores/Enrichissement.php');
|
||||
$fields = new Enrichissement();
|
||||
$this->view->reference = $fields->getFields();
|
||||
}
|
||||
$this->view->champs = $champs;
|
||||
$this->view->liste = $previ;
|
||||
}
|
||||
}
|
||||
|
152
application/modules/frontend/controllers/DashboardController.php
Normal file
152
application/modules/frontend/controllers/DashboardController.php
Normal file
@ -0,0 +1,152 @@
|
||||
<?php
|
||||
class DashboardController extends Libs_Controller
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
$this->view->headLink()->appendStylesheet('/themes/default/styles/dashboard.css', 'all');
|
||||
$this->view->headScript()->appendFile('/themes/default/scripts/dashboard.js', 'text/javascript');
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
$object = new Object_Dashboard();
|
||||
|
||||
$this->view->comptages = $object->index();
|
||||
$this->view->enrichissements = $object->enrichissements();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function ciblagesAction()
|
||||
{
|
||||
$object = new Object_Dashboard();
|
||||
$request = $this->getRequest();
|
||||
$assigns = $object->ciblage($request->getParam('page', 1));
|
||||
|
||||
$this->view->ciblages = $assigns['ciblages'];
|
||||
$this->view->nbCiblage = $assigns['nbCiblage'];
|
||||
}
|
||||
|
||||
public function ciblageAction()
|
||||
{
|
||||
require_once('Scores/Field.php');
|
||||
$config = new Zend_Config_Ini(APPLICATION_PATH.'/configs/configuration.ini');
|
||||
$object = new Object_Dashboard();
|
||||
$request = $this->getRequest();
|
||||
$comptage = $object->ciblagedetail($request->getParam('id'));
|
||||
$enrichissement = $object->enrichissement($request->getParam('id'));
|
||||
|
||||
$this->view->comptageId = $request->getParam('id');
|
||||
$this->view->label = new Fields();
|
||||
$this->view->criteres = $comptage['criteres'];
|
||||
$this->view->comptages = $comptage['comptages'];
|
||||
$this->view->enrichissements = $enrichissement;
|
||||
$this->view->pathfile = $config->path->data;
|
||||
}
|
||||
|
||||
public function rcomptageAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$request = $this->getRequest();
|
||||
$q = $request->getParam('q');
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
$criteresM = new Table_Criteres();
|
||||
$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'=>'ciblage', 'id'=>$item->id)),
|
||||
);
|
||||
}
|
||||
}
|
||||
echo json_encode($output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Liste des enrichissements
|
||||
*/
|
||||
public function enrichissementsAction()
|
||||
{
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
$config = new Zend_Config_Ini(APPLICATION_PATH.'/configs/configuration.ini');
|
||||
//Criteres => Comptages (last) => enrichissement_identifiants => enrichissement_commandes
|
||||
$enrichissementsM = new Table_EnrichissementIdentifiants();
|
||||
|
||||
$sql = $enrichissementsM->select()
|
||||
->setIntegrityCheck(false)
|
||||
->from(
|
||||
array('i' => 'enrichissement_identifiants'),
|
||||
array('id', 'reference', 'fichier', 'nbLigneTotales', 'nbLigneTraites', 'error', 'dateAdded', 'dateStart', 'dateStop')
|
||||
)
|
||||
->join(
|
||||
array('c' => 'comptages'), 'i.idComptage = c.id',
|
||||
array('')
|
||||
)
|
||||
->join(
|
||||
array('criteres' => 'criteres'), 'i.idCriteres = criteres.id',
|
||||
array('')
|
||||
);
|
||||
$sql->where('i.dateStop = ?', 0)
|
||||
->where('criteres.idClient = ?', $user->idClient)
|
||||
->where('criteres.login = ?', $user->username);
|
||||
$encours = $enrichissementsM->fetchAll($sql);
|
||||
$this->view->encours = $encours;
|
||||
|
||||
// Impossible de copie la varible issu d'un select car sinon elle conserve les meme propriété que sont parent
|
||||
// donc les selects... donc obliger de faire deux requetes pour le moment.
|
||||
$sql = $enrichissementsM->select()
|
||||
->setIntegrityCheck(false)
|
||||
->from(
|
||||
array('i' => 'enrichissement_identifiants'),
|
||||
array('id', 'reference', 'fichier', 'nbLigneTotales', 'nbLigneTraites', 'error', 'dateAdded', 'dateStart', 'dateStop')
|
||||
)
|
||||
->join(
|
||||
array('c' => 'comptages'), 'i.idComptage = c.id',
|
||||
array('')
|
||||
)
|
||||
->join(
|
||||
array('criteres' => 'criteres'), 'i.idCriteres = criteres.id',
|
||||
array('')
|
||||
);
|
||||
$sql->where('criteres.idClient = ?', $user->idClient)
|
||||
->where('criteres.login = ?', $user->username)
|
||||
->where('i.dateStart != ?', '0000-00-00 00:00:00');
|
||||
$fini = $enrichissementsM->fetchAll($sql)->toArray();
|
||||
$this->view->fini = $fini;
|
||||
$this->view->pathfile = $config->path->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Détail d'un enrichissment
|
||||
*/
|
||||
public function enrichissementAction()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
class EconomiqueController extends Libs_Controller
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
/* Initialize action controller here */
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
require_once('Scores/Field.php');
|
||||
$this->view->headLink()->appendStylesheet('/themes/default/styles/'.$this->getRequest()->getControllerName().'.css', 'all');
|
||||
$field = new Fields();
|
||||
$this->view->fields = $field;
|
||||
}
|
||||
|
||||
public function resetAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
require_once('Scores/SessionCiblage.php');
|
||||
$session = new SessionCiblage();
|
||||
$session->resetFamille('economique');
|
||||
}
|
||||
|
||||
public function completedAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
$request = $this->getRequest();
|
||||
$table = new Table_Nafs();
|
||||
|
||||
$sql = $table->select()
|
||||
->where('lib LIKE "%'.$this->getRequest()->getParam('q').'%"');
|
||||
$result = $table->fetchAll($sql);
|
||||
foreach ($result as $item) {
|
||||
$output[] = array(
|
||||
'label' => $item->lib . $separator . $item->code,
|
||||
'value' => $item->code
|
||||
);
|
||||
}
|
||||
echo json_encode($output);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,253 @@
|
||||
<?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 = Zend_Registrey::get('configuration');
|
||||
$path = realpath($config->path->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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enregistrement de la commande pour l'ennrichissement
|
||||
*/
|
||||
public function commandeAction()
|
||||
{
|
||||
set_time_limit(60);
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
||||
$request = $this->getRequest();
|
||||
$idCriteres = $request->getParam('id', null);
|
||||
$idProfil = $request->getParam('profil', null);
|
||||
|
||||
//Vérifier les profils du client
|
||||
if ( $idProfil===null ){
|
||||
|
||||
//Selection du profil du client
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
$profilsM = new Table_EnrichissementProfils();
|
||||
$sql = $profilsM->select()
|
||||
->from($profilsM, array('id'))
|
||||
->where('idClient=?', $user->idClient)
|
||||
->where('login=?', $user->username)
|
||||
->where('actif=?', 1);
|
||||
$profil = $profilsM->fetchRow($sql);
|
||||
$idProfil = $profil->id;
|
||||
}
|
||||
|
||||
$comptage = new Table_Comptages();
|
||||
$sql = $comptage->select()->where('idDefinition = ?', $idCriteres);
|
||||
$result = $comptage->fetchRow($sql);
|
||||
$idComptage = $result['id'];
|
||||
|
||||
//Récupération des critères du ciblage
|
||||
$criteresM = new Table_Criteres();
|
||||
$criteresRow = $criteresM->find($idCriteres);
|
||||
$criteres = $criteresRow->current();
|
||||
|
||||
$structure = json_decode($criteres->criteres, true);
|
||||
require_once 'Scores/Field.php';
|
||||
$field = new Fields();
|
||||
$values = $field->getValues($structure);
|
||||
|
||||
//Récupération des SIRET
|
||||
require_once 'Scores/Ciblage.php';
|
||||
$ciblage = new Ciblage($values, true);
|
||||
$infosExtraction = $ciblage->execute(true);
|
||||
|
||||
//Attention calcul uniteInsee réelle
|
||||
//car si donnée insee alors toutes les lignes doivent être comptés en unité insee
|
||||
$data = array(
|
||||
'idComptage' => $idComptage,
|
||||
'reference' => $this->getRequest()->getParam('ref'),
|
||||
'idCriteres' => $criteres->id,
|
||||
'idProfil' => $idProfil,
|
||||
'identifiants' => json_encode($infosExtraction),
|
||||
'idProfil' => $idProfil,
|
||||
'fichier' => '',
|
||||
'nbLigneTotales' => count($infosExtraction),
|
||||
'nbLigneTraites' => 0,
|
||||
'uniteInsee' => $ciblage->calculRedevanceInsee(),
|
||||
'error' => '',
|
||||
'dateAdded' => date('YmdHms'),
|
||||
);
|
||||
$identifiantsM = new Table_EnrichissementIdentifiants();
|
||||
$idIdentifiant = $identifiantsM->insert($data);
|
||||
exec('php '.APPLICATION_PATH.'/../batch/enrichissement.php --id '.$idIdentifiant);
|
||||
}
|
||||
|
||||
/**
|
||||
* Demande de référence pour l'enrichissement
|
||||
*/
|
||||
public function referenceAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$request = $this->getRequest();
|
||||
|
||||
//Récupération du profil de l'utilisateur
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
$profilsM = new Table_EnrichissementProfils();
|
||||
$sql = $profilsM->select()
|
||||
->from($profilsM, array('id', 'reference', 'tarifLigne', 'dataInsee'))
|
||||
->where('idClient=?', $user->idClient)
|
||||
->where('login=?', $user->username)
|
||||
->where('actif=?', 1);
|
||||
$profil = $profilsM->fetchRow($sql);
|
||||
//
|
||||
if ($profil!==null)
|
||||
{
|
||||
$this->view->assign('profil', true);
|
||||
$idCritere = $request->getParam('id', null);
|
||||
$comptagesM = new Table_Comptages();
|
||||
$sql = $comptagesM->select()
|
||||
->where('idDefinition = ?', $idCritere)
|
||||
->order('dateAjout DESC')
|
||||
->limit(1);
|
||||
$comptages = $comptagesM->fetchAll($sql);
|
||||
$old = $comptages;
|
||||
$oldResultat = $old[0]->resultat;
|
||||
$oldResultatInsee = $old[0]->uniteInsee;
|
||||
if ( $comptages->count()>0 ) {
|
||||
$item = $comptages[0];
|
||||
$date = explode(' ', $item->dateAjout);
|
||||
$date = $date[0];
|
||||
if($date != '0000-00-00') {
|
||||
if($date != date('Y-m-d')) {
|
||||
$criteres = new Table_Criteres();
|
||||
$sql = $criteres->select()->where('id = ?', $idCritere);
|
||||
$result = $criteres->fetchRow($sql)->toArray();
|
||||
$criteres = json_decode($result['criteres'], true);
|
||||
require_once('Scores/Field.php');
|
||||
require_once('Scores/Ciblage.php');
|
||||
$field = new Fields();
|
||||
$count = new Ciblage($field->getValues($criteres));
|
||||
$item['resultat'] = $count->execute();
|
||||
$item['uniteInsee'] = $count->calculRedevanceInsee();
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->assign('resultat', $item['resultat']);
|
||||
$this->view->assign('uniteInsee', $item['uniteInsee']);
|
||||
|
||||
//Calcul du prix
|
||||
$redevanceInsee = 3.295/100; //Seuil de facturation 52 734 euros
|
||||
$prixInsee = $item['uniteInsee']*$redevanceInsee;
|
||||
$infoInsee = '';
|
||||
if ($profil->dataInsee){
|
||||
$prixInsee = $item['resultat']*$redevanceInsee;
|
||||
$infoInsee = "Votre profil inclus au moins une donnée Insee, la redevance sera applicable sur chaque ligne.";
|
||||
}
|
||||
$prix = $item['resultat'] * $profil->tarifLigne + $prixInsee;
|
||||
|
||||
$this->view->prix = round($prix, 2);
|
||||
$this->view->prixInsee = round($prixInsee, 2);
|
||||
$this->view->infoInsee = $infoInsee;
|
||||
$this->view->id = $item['id'];
|
||||
|
||||
/*$this->view->oldDate = $date;
|
||||
$this->view->oldResult = $oldResultat;
|
||||
$this->view->oldResultInsee = $oldResultatInsee;
|
||||
$this->view->oldPrice = round(($oldResultat* $profil->tarifLigne)+ $oldResultatInsee);
|
||||
$this->view->oldPriceInsee = round($oldResultatInsee*$redevanceInsee, 2);*/
|
||||
|
||||
$this->view->criteres = $criteres;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function downloadAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$id = $this->getRequest()->getParam('id');
|
||||
$table = new Table_EnrichissementIdentifiants();
|
||||
$sql = $table->select()
|
||||
->where('id = ?', $id);
|
||||
$result = $table->fetchRow($sql);
|
||||
if(!empty($result)) {
|
||||
$config = new Zend_Config_Ini(APPLICATION_PATH.'/configs/configuration.ini');
|
||||
$result = $result->toArray();
|
||||
$date = explode(' ', $result['dateAdded']);
|
||||
$path = $config->path->data.'/'.substr($date[0], 0, 7).'/';
|
||||
$file = $result['fichier'];
|
||||
}
|
||||
$content_type = 'application/csv-tab-delimited-table';
|
||||
//Envoi du fichier sur la sortie standard
|
||||
if ( file_exists($path.$file) ) {
|
||||
header('Content-Transfer-Encoding: none');
|
||||
header('Content-type: ' . $content_type.'');
|
||||
header('Content-Length: ' . filesize($path.$file));
|
||||
header('Content-MD5: ' . base64_encode(md5_file($path.$file)));
|
||||
header('Content-Disposition: filename="' . basename($path.$file) . '"');
|
||||
header('Cache-Control: private, max-age=0, must-revalidate');
|
||||
header('Pragma: public');
|
||||
ini_set('zlib.output_compression', '0');
|
||||
echo file_get_contents($path.$file);
|
||||
} else {
|
||||
echo 'Impossible de charger le fichier.';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
class EntrepriseController extends Libs_Controller
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
/* Initialize action controller here */
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
require_once('Scores/Field.php');
|
||||
$this->view->headLink()->appendStylesheet('/themes/default/styles/'.$this->getRequest()->getControllerName().'.css', 'all');
|
||||
$field = new Fields();
|
||||
$this->view->fields = $field;
|
||||
}
|
||||
|
||||
public function resetAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
require_once('Scores/SessionCiblage.php');
|
||||
$session = new SessionCiblage();
|
||||
$session->resetFamille('entreprise');
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
class ErreurController extends Libs_Controller
|
||||
{
|
||||
protected $correlation = array(
|
||||
'siege' => array('fax', 'tel'),
|
||||
'fax'=> array('siege'))
|
||||
;
|
||||
|
||||
public function getAction()
|
||||
{
|
||||
$session = new Zend_Session_Namespace('erreurs');
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
||||
$request = $this->getRequest();
|
||||
$key = $request->getParam('key');
|
||||
$valeur = $request->getParam('valeur');
|
||||
|
||||
$this->correlation($key, $valeur);
|
||||
$this->view->erreurs = $session->erreurs;
|
||||
}
|
||||
|
||||
protected function correlation($key, $valeurs)
|
||||
{
|
||||
$session = new Zend_Session_Namespace('erreurs');
|
||||
$session->erreurs[$key] = array('erreur' => false, 'valeur' => $valeurs);
|
||||
|
||||
foreach($session->erreurs as $erreur => $valeurs)
|
||||
{
|
||||
if(in_array($erreur, $this->correlation[$key]))
|
||||
{
|
||||
if($session->erreurs[$key]['valeur'] != 'tous')
|
||||
$session->erreurs[$key]['erreur'] = true;
|
||||
else
|
||||
unset($session->erreurs[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
48
application/modules/frontend/controllers/ErrorController.php
Normal file
48
application/modules/frontend/controllers/ErrorController.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
Class ExtractController extends Zend_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
require_once 'Scores/Ciblage.php';
|
||||
require_once 'Scores/Field.php';
|
||||
|
||||
$field = new Fields();
|
||||
$ciblage = new Ciblage($field->getValues());
|
||||
|
||||
$ciblage->extract();
|
||||
}
|
||||
|
||||
public function batchAction()
|
||||
{
|
||||
$action = $this->getRequest();
|
||||
$request = $action->getParam('reference');
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
class FinancierController extends Libs_Controller
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
/* Initialize action controller here */
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
require_once('Scores/Field.php');
|
||||
$this->view->headLink()->appendStylesheet('/themes/default/styles/'.$this->getRequest()->getControllerName().'.css', 'all');
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
$field = new Fields();
|
||||
$this->view->fields = $field;
|
||||
}
|
||||
|
||||
public function resetAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
require_once('Scores/SessionCiblage.php');
|
||||
$session = new SessionCiblage();
|
||||
$session->resetFamille('financier');
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,113 @@
|
||||
<?php
|
||||
|
||||
class GeographiqueController extends Libs_Controller
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
/* Initialize action controller here */
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
require_once('Scores/Field.php');
|
||||
$this->view->headLink()->appendStylesheet('/themes/default/styles/'.$this->getRequest()->getControllerName().'.css', 'all');
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
$field = new Fields();
|
||||
$this->view->fields = $field;
|
||||
}
|
||||
|
||||
public function resetAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
require_once('Scores/SessionCiblage.php');
|
||||
$session = new SessionCiblage();
|
||||
$session->resetFamille('geographique');
|
||||
}
|
||||
|
||||
public function completedAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
$request = $this->getRequest();
|
||||
|
||||
if($request->getParam('dep')) {
|
||||
$output = $this->completedDep($request->getParam('q'));
|
||||
} else if ($request->getParam('reg')) {
|
||||
$output = $this->completedReg($request->getParam('q'));
|
||||
} else if($request->getParam('vil')) {
|
||||
$output = $this->completedVil($request->getParam('q'));
|
||||
}else if($request->getParam('adr_com')) {
|
||||
$output = $this->completedVil($request->getParam('q'));
|
||||
}else if($request->getParam('adr_com_ex')) {
|
||||
$output = $this->completedVil($request->getParam('q'));
|
||||
}
|
||||
|
||||
echo json_encode($output);
|
||||
}
|
||||
|
||||
protected function completedDep($q)
|
||||
{
|
||||
$table = new Table_Departements();
|
||||
$sql = $table->select()
|
||||
->where('libdep LIKE "'.$q.'%"');
|
||||
$result = $table->fetchAll($sql);
|
||||
foreach ($result as $item) {
|
||||
$output[] = array(
|
||||
'label' => $item->libdep . $separator . $item->numdep,
|
||||
'value' => $item->numdep
|
||||
);
|
||||
}
|
||||
return ($output);
|
||||
}
|
||||
|
||||
protected function completedVil($q)
|
||||
{
|
||||
$table = new Table_Codepostauxs();
|
||||
$separator = ' ';
|
||||
|
||||
$sql = $table->select()->where('Commune LIKE "'.$q.'%"');
|
||||
$result = $table->fetchAll($sql);
|
||||
foreach ($result as $item) {
|
||||
$output[] = array(
|
||||
'label' => $item->Commune . $separator . $item->Codepos,
|
||||
'value' => $item->INSEE
|
||||
);
|
||||
}
|
||||
return ($output);
|
||||
}
|
||||
|
||||
protected function getDeptFromReg($dep)
|
||||
{
|
||||
$table = new Table_Departements();
|
||||
$sql = $table->select()
|
||||
->where('codeRegionInsee = '.$dep);
|
||||
$result = $table->fetchAll($sql)->toArray();
|
||||
$string = '';
|
||||
foreach ($result as $res) {
|
||||
$string .= $res['numdep'].',';
|
||||
}
|
||||
$string = substr($string, 0, strlen($string)-1);
|
||||
return ($string);
|
||||
}
|
||||
|
||||
protected function completedReg($q)
|
||||
{
|
||||
$table = new Table_Regions();
|
||||
$separator = ' ';
|
||||
|
||||
$sql = $table->select()
|
||||
->where('NCCENR LIKE "%'.$q.'%" OR REGION LIKE "%'.$q.'%"');
|
||||
$result = $table->fetchAll($sql);
|
||||
foreach ($result as $item) {
|
||||
$output[] = array(
|
||||
'label' => $item->REGION .' '.$item->NCCENR . $separator . $item->REGION,
|
||||
'value' => $this->getDeptFromReg($item->REGION)
|
||||
);
|
||||
}
|
||||
return ($output);
|
||||
}
|
||||
}
|
||||
|
127
application/modules/frontend/controllers/GestionController.php
Normal file
127
application/modules/frontend/controllers/GestionController.php
Normal file
@ -0,0 +1,127 @@
|
||||
<?php
|
||||
class GestionController extends Zend_Controller_Action
|
||||
{
|
||||
public function preDispatch()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->view->headLink()->appendStylesheet('/themes/default/styles/dashboard.css', 'all');
|
||||
$this->view->headScript()->appendFile('/themes/default/scripts/dashboard.js', 'text/javascript');
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function profilsAction()
|
||||
{
|
||||
$profilsM = new Table_EnrichissementProfils();
|
||||
$sql = $profilsM->select()
|
||||
->from($profilsM, array('id', 'idClient', 'login', 'reference', 'tarifLigne', 'dateAjout', 'dateSuppr', 'actif'));
|
||||
$profils = $profilsM->fetchAll($sql);
|
||||
|
||||
$this->view->assign('profils', $profils);
|
||||
}
|
||||
|
||||
public function profilAction(){}
|
||||
|
||||
public function profiladdAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
//Sauvegarde du formulaire
|
||||
if ( $request->isPost() && $request->getParam('submit')=='Enregistrer' ){
|
||||
$params = $request->getParams();
|
||||
|
||||
//Vérifier le formulaire
|
||||
$errForm = 0;
|
||||
foreach ( $params as $key => $value ) {
|
||||
if (empty($value)) {
|
||||
$errForm++;
|
||||
}
|
||||
}
|
||||
if (!$errForm) {
|
||||
|
||||
$dataInsee = 0;
|
||||
// Est ce qu'il existe une donnée insee
|
||||
require_once 'Scores/Enrichissement.php';
|
||||
$fieldsM = new Enrichissement();
|
||||
$fields = $fieldsM->getFields();
|
||||
foreach ( $fields as $key => $val) {
|
||||
if ( array_key_exists('insee', $val) && $val['insee']===true) {
|
||||
$dateInsee = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'idClient' => $params['idClient'],
|
||||
'login' => $params['login'],
|
||||
'reference' => $params['reference'],
|
||||
'criteres' => json_encode($params['criteres']),
|
||||
'tarifLigne' => $params['tarifLigne'],
|
||||
'dataInsee' => $dataInsee,
|
||||
'dateAjout' => date('Y-m-d H:i:s'),
|
||||
'actif' => 1,
|
||||
);
|
||||
$profilM = new Table_EnrichissementProfils();
|
||||
if ( $profilM->insert($data) ){
|
||||
$this->view->assign('message', "Profil enregistré");
|
||||
} else {
|
||||
$this->view->assign('message', "Erreur lors de la sauvegarde");
|
||||
}
|
||||
} else {
|
||||
$this->view->assign('message', "Erreur lors de la saisie");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Affichage du formulaire
|
||||
require_once 'Scores/Enrichissement.php';
|
||||
$fieldsM = new Enrichissement();
|
||||
$allFields = $fieldsM->getFields();
|
||||
$this->view->assign('fields', $allFields);
|
||||
}
|
||||
|
||||
public function profildelAction(){}
|
||||
|
||||
public function comptagesAction()
|
||||
{
|
||||
$table = new Table_Comptages();
|
||||
$sql = $table->select()
|
||||
->order('dateAjout DESC');
|
||||
$this->view->comptages = $table->fetchAll($sql)->toArray();
|
||||
}
|
||||
|
||||
public function enrichissementsAction()
|
||||
{
|
||||
$table = new Table_EnrichissementIdentifiants();
|
||||
$sql = $table->select()
|
||||
->order('dateAdded DESC');
|
||||
$this->view->enrichissements = $table->fetchAll($sql)->toArray();
|
||||
}
|
||||
|
||||
public function extractAction()
|
||||
{
|
||||
$id = $this->getRequest()->getParam('id');
|
||||
$table = new Table_EnrichissementIdentifiants();
|
||||
$sql = $table->select()
|
||||
->where('idComptage = ?', $id);
|
||||
$result = $table->fetchRow($sql);
|
||||
if(!empty($result)) {
|
||||
$result = $result->toArray();
|
||||
$sirets = json_decode($result['identifiants']);
|
||||
foreach($sirets as $siret) {
|
||||
echo $siret."\n";
|
||||
}
|
||||
}else {
|
||||
echo 'Aucune commande d\'enrichissement sur ce comptage';
|
||||
}
|
||||
exit;
|
||||
}
|
||||
}
|
47
application/modules/frontend/controllers/IndexController.php
Normal file
47
application/modules/frontend/controllers/IndexController.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
Class IndexController extends Libs_Controller
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->view->headScript()
|
||||
->appendFile('/themes/default/scripts/jquery.jstree.js', 'text/javascript')
|
||||
->appendFile('/themes/default/scripts/fields.js', 'text/javascript')
|
||||
->appendFile('/themes/default/scripts/autocompleted.js', 'text/javascript');
|
||||
/* Initialize action controller here */
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
if ($user->customisation) {
|
||||
$this->view->assign('preferences', $user->customisation);
|
||||
}
|
||||
}
|
||||
|
||||
public function criteresAction()
|
||||
{
|
||||
$ajax = $this->getRequest()->getParam('ajax');
|
||||
if($ajax)
|
||||
$this->_helper->layout()->disableLayout();
|
||||
require_once 'Scores/SessionCiblage.php';
|
||||
require_once 'Scores/Field.php';
|
||||
$session = new SessionCiblage();
|
||||
|
||||
$this->view->field = new Fields();
|
||||
$this->view->criteres = $session->getCriteres();
|
||||
}
|
||||
|
||||
public function removeAction()
|
||||
{
|
||||
require_once('Scores/SessionCiblage.php');
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$session = new SessionCiblage();
|
||||
$session->unsetCritere($this->getRequest()->getParam('critere'));
|
||||
$objet = new Object_Comptage();
|
||||
$objet->count(null, null);
|
||||
$this->_redirect('/');
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
class JuridiqueController extends Libs_Controller
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
/* Initialize action controller here */
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
require_once('Scores/Field.php');
|
||||
$this->view->headLink()->appendStylesheet('/themes/default/styles/'.$this->getRequest()->getControllerName().'.css', 'all');
|
||||
$field = new Fields();
|
||||
$this->view->fields = $field;
|
||||
}
|
||||
|
||||
public function resetAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
require_once('Scores/SessionCiblage.php');
|
||||
$session = new SessionCiblage();
|
||||
$session->resetFamille('juridique');
|
||||
}
|
||||
|
||||
public function completedAction()
|
||||
{
|
||||
$table = new Table_Formejuridiques();
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
$request = $this->getRequest();
|
||||
|
||||
$sql = $table->select()
|
||||
->where('fjLibelle LIKE "'.$request->getParam('q').'%"');
|
||||
$result = $table->fetchAll($sql);
|
||||
foreach ($result as $item) {
|
||||
$output[] = array(
|
||||
'label' => $item->fjLibelle . $separator . $item->fjCode,
|
||||
'value' => $item->fjCode
|
||||
);
|
||||
}
|
||||
echo json_encode($output);
|
||||
}
|
||||
}
|
||||
|
18
application/modules/frontend/controllers/LoginController.php
Normal file
18
application/modules/frontend/controllers/LoginController.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
class LoginController extends Libs_Controller
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
/* Initialize action controller here */
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
// action body
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
Class UploadController extends Zend_Controller_Action
|
||||
{
|
||||
protected $path;
|
||||
protected $extensions;
|
||||
|
||||
public function init()
|
||||
{
|
||||
/*$config = Zend_Registrey::get('configuration');
|
||||
$path = realpath($config->path->data).'/clients';
|
||||
$this->path = $path;
|
||||
$this->extensions = array('.csv');
|
||||
|
||||
if(!file_exists($path)) mkdir($path);*/
|
||||
}
|
||||
|
||||
public function upload()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
if(!empty($_FILES) and count($_FILES) == 1)
|
||||
{
|
||||
$tmp_name = $_FILES['fichier']['tmp_name'];
|
||||
$extension = strrchr($_FILES['fichier']['name'], '.');
|
||||
if(in_array($extension, $this->extensions)) {
|
||||
if (move_uploaded_file($tmp_name, $path.'/'.$tmp_name.'.'.$extension))
|
||||
return ($tmp_name);
|
||||
}
|
||||
}
|
||||
return (false);
|
||||
}
|
||||
|
||||
public function arborescanceAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
$url = implode('/', $this->getRequest()->getParams());
|
||||
echo $url;
|
||||
//$file = $this->upload();
|
||||
/*if($file)
|
||||
{
|
||||
$csv = fgetcsv($file);
|
||||
$csv = str_replace(';', ',', $csv);
|
||||
echo $csv;
|
||||
}*/
|
||||
}
|
||||
}
|
78
application/modules/frontend/controllers/UserController.php
Normal file
78
application/modules/frontend/controllers/UserController.php
Normal file
@ -0,0 +1,78 @@
|
||||
<?php
|
||||
class UserController extends Libs_Controller
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
require_once APPLICATION_PATH.'/modules/frontend/models/Forms/Login.php';
|
||||
require_once 'Scores/WsScores.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gestion de l'authentification
|
||||
*/
|
||||
public function loginAction()
|
||||
{
|
||||
//@todo : gestion des affichages particuliers pour les clients
|
||||
$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 Scores_AuthAdapter($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 {
|
||||
$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()
|
||||
{
|
||||
Zend_Auth::getInstance()->clearIdentity();
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
||||
$request = $this->getRequest();
|
||||
$message = $request->getParam('message');
|
||||
$this->view->assign('message', $message);
|
||||
|
||||
$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');
|
||||
}
|
||||
|
||||
}
|
||||
|
28
application/modules/frontend/models/Forms/Login.php
Normal file
28
application/modules/frontend/models/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,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
152
application/modules/frontend/models/Objects/Codepostaux.php
Normal file
152
application/modules/frontend/models/Objects/Codepostaux.php
Normal file
@ -0,0 +1,152 @@
|
||||
<?php
|
||||
class Object_Codepostaux extends Libs_Row
|
||||
{
|
||||
/* Selection des classes statut pour jstree */
|
||||
public function _jstree_checked($type)
|
||||
{
|
||||
require_once('Scores/SessionCiblage.php');
|
||||
$session = new SessionCiblage();
|
||||
$valeurs = $session->getCritere($type);
|
||||
return (substr($valeurs, 0, strlen($valeurs)-1));
|
||||
}
|
||||
|
||||
public function _jstree_undetermined($niveau, $type)
|
||||
{
|
||||
require_once('Scores/SessionCiblage.php');
|
||||
$session = new SessionCiblage();
|
||||
$table = new Table_Departements();
|
||||
$valeurs = explode(',', $session->getCritere($type));
|
||||
//print_r($valeurs);
|
||||
/*$valeurs = array_merge($valeurs, explode(',', $session->getCritere('adr_com')));*/
|
||||
$in = array();
|
||||
|
||||
foreach($valeurs as $valeur) {
|
||||
if($niveau == 0) {
|
||||
if ($type == 'adr_dept'){
|
||||
$insee = $table->fetchAll($table->select('departements', array('codeRegionInsee'))
|
||||
->where('numdep = ?', substr($valeur, 0, 2)))->toArray();
|
||||
foreach ($insee as $code)
|
||||
$in[] = 'adr_reg:'.$code['codeRegionInsee'];
|
||||
} else{
|
||||
$insee = $table->fetchAll($table->select('departements', array('codeRegionInsee'))
|
||||
->where('numdep = ?', substr($valeur, 0, 2)))->toArray();
|
||||
foreach ($insee as $code)
|
||||
$in[] = 'adr_reg:'.$code['codeRegionInsee'];
|
||||
}
|
||||
} else if ($niveau == 1) {
|
||||
$insee = $table->fetchAll($table->select('departements', array('codeRegionInsee'))
|
||||
->where('numdep = ?', substr($valeur, 0, 2)))->toArray();
|
||||
foreach ($insee as $code)
|
||||
$in[] = 'adr_dept:'.$code['numdep'];
|
||||
}
|
||||
}
|
||||
return ($in);
|
||||
}
|
||||
|
||||
public function _getClass($valeur, $niveau)
|
||||
{
|
||||
require_once('Scores/SessionCiblage.php');
|
||||
$session = new SessionCiblage();
|
||||
$valeurs = explode(',', $valeur);
|
||||
$key = ((strlen($valeur) < 5)?'adr_dept':'adr_com');
|
||||
$session = explode(',', $session->getCritere('adr_dept'));
|
||||
$row = 0;
|
||||
foreach ($session as $dept) {
|
||||
if(in_array($dept, $valeurs))
|
||||
$row++;
|
||||
}
|
||||
if($row == count($valeurs) and $row != 1) {
|
||||
return ('jstree-checked');
|
||||
}
|
||||
else if($row > 1)
|
||||
return ('jstree-undetermined');
|
||||
|
||||
/*$type = explode(':', $valeur);
|
||||
if($type[1] == $this->_jstree_checked($type[0]))
|
||||
return ('jstree-checked');
|
||||
else if (in_array($valeur, $this->_jstree_undetermined($niveau, $type[0])))
|
||||
return ('jstree-undetermined');*/
|
||||
}
|
||||
|
||||
protected function getDepartement($region)
|
||||
{
|
||||
$table = new Table_Departements();
|
||||
$sql = $table->select()
|
||||
->where('codeRegionInsee = '.$region);
|
||||
$result = $table->fetchAll($sql)->toArray();
|
||||
$depts = array();
|
||||
foreach($result as $departement) {
|
||||
$depts[] = $departement['numdep'];
|
||||
}
|
||||
return (implode(',', $depts));
|
||||
}
|
||||
|
||||
/* Fonctions de construction de jstree */
|
||||
public function _getRegions()
|
||||
{
|
||||
$region = new Table_Regions();
|
||||
$regions = $region->fetchAll($region->select()->order('NCCENR ASC'))->toArray();
|
||||
$structure = array();
|
||||
|
||||
foreach($regions as $nom) {
|
||||
$structure[] = array(
|
||||
'data' => $nom['NCCENR'],
|
||||
'attr' => array('id' => $this->getDepartement($nom['REGION']),
|
||||
'niveau' => 0,
|
||||
'class' => $this->_getClass($this->getDepartement($nom['REGION']), 0)
|
||||
),
|
||||
'state' => 'closed',
|
||||
'children' => array()
|
||||
);
|
||||
}
|
||||
return (json_encode($structure));
|
||||
}
|
||||
|
||||
public function _getDepartements($codeRegionInsee)
|
||||
{
|
||||
//$code = explode(':', $codeRegionInsee);
|
||||
$departement = new Table_Departements();
|
||||
foreach(explode(',', $codeRegionInsee) as $dept) {
|
||||
$departements[] = $departement->fetchAll($departement->select()
|
||||
->where('numdep ='.$dept))->toArray();
|
||||
}
|
||||
$structure = array();
|
||||
|
||||
foreach($departements as $nom) {
|
||||
$structure[] = array(
|
||||
'data' => $nom[0]['numdep'].' '.$nom[0]['libdep'],
|
||||
'attr' => array('id' => $nom[0]['numdep'],
|
||||
'niveau' => 1,
|
||||
'class' => $this->_getClass($nom[0]['numdep'], 1)
|
||||
),
|
||||
'state' => 'closed',
|
||||
'children' => array()
|
||||
);
|
||||
}
|
||||
|
||||
return (json_encode($structure));
|
||||
}
|
||||
|
||||
public function _getCommunes($numdep)
|
||||
{
|
||||
|
||||
//$numdep = explode(':', $numdep);
|
||||
$codepostau = new Table_Codepostauxs();
|
||||
$codepostaux = $codepostau->fetchAll($codepostau->select()->where('codepos LIKE "'.$numdep.'%"'))->toArray();
|
||||
$structure = array();
|
||||
|
||||
foreach($codepostaux as $nom) {
|
||||
$structure[] = array(
|
||||
'data' => $nom['Codepos'].' '.$nom['Commune'],
|
||||
'attr' => array('id'=> $nom['INSEE'],
|
||||
'niveau' => 2,
|
||||
'class' => $this->_getClass($nom['INSEE'], 2)
|
||||
),
|
||||
'state' => 'closed',
|
||||
'children' => array()
|
||||
);
|
||||
}
|
||||
|
||||
return (json_encode($structure));
|
||||
}
|
||||
}
|
156
application/modules/frontend/models/Objects/Comptage.php
Normal file
156
application/modules/frontend/models/Objects/Comptage.php
Normal file
@ -0,0 +1,156 @@
|
||||
<?php
|
||||
class Object_Comptage extends Libs_Row
|
||||
{
|
||||
public function saveComptage($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();
|
||||
|
||||
//Enregistrement des critères
|
||||
$criteresM = new Table_Criteres();
|
||||
$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 Table_Comptages();
|
||||
$data = array(
|
||||
'idDefinition' => $id,
|
||||
'resultat' => $resultat,
|
||||
'uniteInsee' => $nbInsee,
|
||||
'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",
|
||||
'id' => $id));
|
||||
} 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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function count($key, $valeur, $need = false)
|
||||
{
|
||||
require_once 'Scores/SessionCiblage.php';
|
||||
$session = new SessionCiblage();
|
||||
|
||||
if(in_array($key, array('adr_dept', 'adr_com', 'adr_reg', 'adr_com_ex', 'adr_dept_ex')))
|
||||
{
|
||||
$valeurs = explode(',', $valeur);
|
||||
if($key == 'adr_dept') {
|
||||
$reg_ = $session->getCritere('adr_reg');
|
||||
if(!empty($reg_)) {
|
||||
$reg_ = explode(',', $reg_);
|
||||
$table = new Table_Departements();
|
||||
$result = array();
|
||||
foreach($reg_ as $item) {
|
||||
$sql = $table->select()->where('codeRegionInsee = ?', $item);
|
||||
$donner = $table->fetchAll($sql)->toArray();
|
||||
foreach ($donner as $don) {
|
||||
$result[] = $don['numdep'];
|
||||
}
|
||||
foreach($result as $dep) {
|
||||
if(in_array($dep, $valeurs)) {
|
||||
$diff[] = $dep;
|
||||
}
|
||||
}
|
||||
$session->unsetCritereValue('adr_reg', $item);
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach($valeurs as $valeur)
|
||||
{
|
||||
$type = explode(':', $valeur);
|
||||
if(count($type) == 2) {
|
||||
$key = $type[0];
|
||||
$valeur = $type[1];
|
||||
}
|
||||
switch($key) {
|
||||
case 'adr_dept':
|
||||
case 'adr_reg':
|
||||
$dept .= trim($valeur).',';
|
||||
break;
|
||||
case 'adr_com':
|
||||
case 'vil':
|
||||
default:
|
||||
$vil .= trim($valeur).',';
|
||||
break;
|
||||
case 'adr_com_ex':
|
||||
$adr_com_ex .= trim($valeur).',';
|
||||
break;
|
||||
case 'adr_dept_ex':
|
||||
$adr_dept_ex .= trim($valeur).',';
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(strlen($dept)>0) {
|
||||
$dept = substr($dept, 0, strlen($dept)-1);
|
||||
$session->setCritere('adr_dept', $dept);
|
||||
}
|
||||
if(strlen($vil)>0) {
|
||||
$vil = substr($vil, 0, strlen($vil)-1);
|
||||
$session->setCritere('adr_com', $vil);
|
||||
}
|
||||
if(strlen($adr_com_ex)>0) {
|
||||
$adr_com_ex = substr($adr_com_ex, 0, strlen($adr_com_ex)-1);
|
||||
$session->setCritere('adr_com_ex', $adr_com_ex);
|
||||
}
|
||||
if(strlen($adr_dept_ex)>0) {
|
||||
$adr_dept_ex = substr($adr_dept_ex, 0, strlen($adr_dept_ex)-1);
|
||||
$session->setCritere('adr_dept_ex', $adr_dept_ex);
|
||||
}
|
||||
} else
|
||||
$session->setCritere($key, $valeur);
|
||||
|
||||
require_once 'Scores/Field.php';
|
||||
$field = new Fields();
|
||||
|
||||
//Comptage
|
||||
require_once 'Scores/Ciblage.php';
|
||||
$ciblage = new Ciblage($field->getValues());
|
||||
if($need) {
|
||||
return $ciblage->execute(true, 10);
|
||||
}
|
||||
$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, '', ' ')
|
||||
);
|
||||
return (json_encode($result));
|
||||
}
|
||||
}
|
5
application/modules/frontend/models/Objects/Critere.php
Normal file
5
application/modules/frontend/models/Objects/Critere.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Object_Critere extends Libs_Row
|
||||
{
|
||||
|
||||
}
|
196
application/modules/frontend/models/Objects/Dashboard.php
Normal file
196
application/modules/frontend/models/Objects/Dashboard.php
Normal file
@ -0,0 +1,196 @@
|
||||
<?php
|
||||
Class Object_Dashboard
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
$criteresM = new Table_Criteres();
|
||||
$sql = $criteresM->select()
|
||||
->from($criteresM, 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 Table_Comptages();
|
||||
foreach($rows->toArray() as $item)
|
||||
{
|
||||
$info = array(
|
||||
'id' => $item['id'],
|
||||
'reference' => $item['reference'],
|
||||
'dateCriteres' => $item['dateAjout'],
|
||||
);
|
||||
//Recherche des comptages
|
||||
$sql = $comptagesM->select()
|
||||
->from($comptagesM, array('resultat', 'uniteInsee', "DATE_FORMAT(dateAjout, '%Y/%m/%d %H:%i:%s') as 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;
|
||||
}
|
||||
return ($results);
|
||||
}
|
||||
|
||||
public function enrichissement($idComptage)
|
||||
{
|
||||
$enrichissements = new Table_EnrichissementIdentifiants();
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
$sql = $enrichissements->select()
|
||||
->setIntegrityCheck(false)
|
||||
->from(
|
||||
array('i' => 'enrichissement_identifiants'),
|
||||
array('id', 'reference', 'fichier', 'nbLigneTotales', 'nbLigneTraites', 'error', 'dateAdded', 'dateStart', 'dateStop')
|
||||
)
|
||||
->join(
|
||||
array('criteres' => 'criteres'), 'i.idCriteres = criteres.id',
|
||||
array('')
|
||||
)
|
||||
->where('criteres.idClient = ?', $user->idClient)
|
||||
->where('criteres.login = ?', $user->username)
|
||||
->where('i.idCriteres = ?', $idComptage);
|
||||
return ($enrichissements->fetchAll($sql));
|
||||
}
|
||||
|
||||
public function enrichissements()
|
||||
{
|
||||
$enrichissementsM = new Table_EnrichissementIdentifiants();
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
$sql = $enrichissementsM->select()
|
||||
->setIntegrityCheck(false)
|
||||
->from(
|
||||
array('i' => 'enrichissement_identifiants'),
|
||||
array('id', 'reference', 'fichier', 'nbLigneTotales', 'nbLigneTraites', 'error', 'dateAdded', 'dateStart', 'dateStop')
|
||||
)
|
||||
->join(
|
||||
array('c' => 'comptages'), 'i.idComptage = c.id',
|
||||
array('')
|
||||
)
|
||||
->join(
|
||||
array('criteres' => 'criteres'), 'i.idCriteres = criteres.id',
|
||||
array('')
|
||||
)
|
||||
->where('criteres.idClient = ?', $user->idClient)
|
||||
->where('criteres.login = ?', $user->username)
|
||||
->order('dateAdded DESC');
|
||||
return ($enrichissementsM->fetchAll($sql));
|
||||
}
|
||||
|
||||
public function menu()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function ciblage($page)
|
||||
{
|
||||
$offset = 20;
|
||||
//Liste des ciblages par paquet de n
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
$criteresM = new Table_Criteres();
|
||||
|
||||
//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 Table_Comptages();
|
||||
foreach($rows->toArray() as $item)
|
||||
{
|
||||
$info = array(
|
||||
'id' => $item['id'],
|
||||
'reference' => $item['reference'],
|
||||
'dateCriteres' => $item['dateAjout'],
|
||||
);
|
||||
//Recherche des comptages
|
||||
$sql = $comptagesM->select()
|
||||
->from($comptagesM, array('resultat', 'uniteInsee', "DATE_FORMAT(dateAjout, '%d/%m/%Y %H:%i:%s') as 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;
|
||||
}
|
||||
|
||||
return (array('ciblages' => $results, 'nbCiblage' => $nbCiblage));
|
||||
}
|
||||
|
||||
public function ciblagedetail($id)
|
||||
{
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
$table = new Table_Criteres();
|
||||
$sql = $table->select()
|
||||
->where('idClient = ?', $user->idClient)
|
||||
->where('login = ?', $user->username)
|
||||
->where('id = ?', $id);
|
||||
|
||||
$criteres = $table->fetchRow($sql)->toArray();
|
||||
if ($criteres != null){
|
||||
$comptage = new Table_Comptages();
|
||||
$sql = $comptage->select()
|
||||
->where('idDefinition = ?', $id)->order('dateAjout DESC');
|
||||
$comptages = $comptage->fetchAll($sql)->toArray();
|
||||
}
|
||||
return (array_merge(array('comptages' => $comptages), array('criteres' => $criteres)));
|
||||
}
|
||||
|
||||
public function rcomptage($q)
|
||||
{
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
$criteresM = new Table_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'=>'ciblage', 'id'=>$item->id)),
|
||||
);
|
||||
}
|
||||
}
|
||||
return (json_encode($output));
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Object_Departement extends Libs_Row
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
class Object_Formejuridique extends Libs_Row
|
||||
{
|
||||
protected function _jstree_checked()
|
||||
{
|
||||
require_once('Scores/SessionCiblage.php');
|
||||
$session = new SessionCiblage();
|
||||
$valeurs = explode(',', $session->getCritere('cj'));
|
||||
|
||||
foreach($valeurs as $valeur) {
|
||||
if($valeur != '')
|
||||
$return[] = $valeur;
|
||||
}
|
||||
if(is_array($return))
|
||||
return ($return);
|
||||
return (array($valeurs));
|
||||
}
|
||||
|
||||
protected function _jstree_undetermined()
|
||||
{
|
||||
return (array());
|
||||
}
|
||||
|
||||
public function _getClass($valeur)
|
||||
{
|
||||
if(in_array($valeur, $this->_jstree_checked()))
|
||||
return ('jstree-checked');
|
||||
else if (in_array($valeur, $this->_jstree_undetermined()))
|
||||
return ('jstree-undetermined');
|
||||
}
|
||||
|
||||
public function _getParents()
|
||||
{
|
||||
$formes = new Table_Formejuridiques();
|
||||
$formes = $formes->fetchAll($formes->select()->where('LENGTH(fjCode) = 1'))->toArray();
|
||||
$structure = array();
|
||||
|
||||
foreach($formes as $forme) {
|
||||
$structure[] = array(
|
||||
'data' => $forme['fjCode'].' : '.$forme['fjLibelle'],
|
||||
'attr' => array('id' => $forme['fjCode'],
|
||||
'class' => $this->_getClass($forme['fjCode'])),
|
||||
'state' => 'closed',
|
||||
'children' => array($this->_getFils($forme['fjCode'])),
|
||||
);
|
||||
}
|
||||
return (json_encode($structure));
|
||||
}
|
||||
|
||||
public function _getFils($fjcode)
|
||||
{
|
||||
$lenth = ((strlen($fjcode) == 2)?4:2);
|
||||
$formes = new Table_Formejuridiques();
|
||||
$sql = $formes->select()->from('formejuridique', array(
|
||||
'size' => new Zend_Db_Expr('LENGTH(fjCode)'),
|
||||
'fjCode',
|
||||
'fjLibelle'))
|
||||
->where('fjCode LIKE "'.$fjcode.'%"')
|
||||
->having('size = ?', $lenth);
|
||||
$formes = $formes->fetchAll($sql)->toArray();
|
||||
$structure = array();
|
||||
foreach($formes as $forme) {
|
||||
$structure = array(
|
||||
'data' => $forme['fjCode'].' : '.$forme['fjLibelle'],
|
||||
'attr' => array('id' => $forme['fjCode'],
|
||||
'class' => $this->_getClass($forme['fjCode'])),
|
||||
'state' => 'close',
|
||||
'children' => (($lenth < 6)?$this->_getFils($forme['fjCode']):array())
|
||||
);
|
||||
$tabfj[] = $structure;
|
||||
}
|
||||
|
||||
return ($tabfj);
|
||||
}
|
||||
}
|
5
application/modules/frontend/models/Objects/Minmax.php
Normal file
5
application/modules/frontend/models/Objects/Minmax.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Object_Minmax extends Libs_Row
|
||||
{
|
||||
|
||||
}
|
107
application/modules/frontend/models/Objects/Naf.php
Normal file
107
application/modules/frontend/models/Objects/Naf.php
Normal file
@ -0,0 +1,107 @@
|
||||
<?php
|
||||
class Object_Naf extends Libs_Row
|
||||
{
|
||||
public function naf($niveau, $key)
|
||||
{
|
||||
require_once 'Scores/SessionCiblage.php';
|
||||
$sessionCiblage = new SessionCiblage();
|
||||
$val = $sessionCiblage->getCritere($key);
|
||||
$valuesChecked = array();
|
||||
$valuesUndetermined = array();
|
||||
|
||||
if ($val != null){
|
||||
$valuesChecked = explode(',',$val);
|
||||
foreach($valuesChecked as $value){
|
||||
$valuesUndetermined = array_merge($valuesUndetermined, $this->getNafParent($value, true));
|
||||
}
|
||||
}
|
||||
$nafM = new Table_Nafs();
|
||||
$sql = $nafM->select()->where('niveau = ?', $niveau)->order('code ASC');
|
||||
|
||||
$result = $nafM->fetchAll($sql)->toArray();
|
||||
$tabNaf = array();
|
||||
foreach($result as $item)
|
||||
{
|
||||
$structure = array(
|
||||
'data' => $item['code'].' - '.$item['lib'],
|
||||
'attr' => array('id' => $item['code'], 'niveau' => $item['niveau']),
|
||||
'state' => 'closed',
|
||||
'children' => array(),
|
||||
);
|
||||
if (in_array($item['code'], $valuesChecked)){
|
||||
$structure['attr']['class'] = 'jstree-checked';
|
||||
}
|
||||
if (in_array($item['code'], $valuesUndetermined)){
|
||||
$structure['attr']['class'] = 'jstree-undetermined';
|
||||
}
|
||||
$tabNaf[] = $structure;
|
||||
}
|
||||
return json_encode($tabNaf);
|
||||
}
|
||||
|
||||
protected function getNafParent($value, $niveau1 = false)
|
||||
{
|
||||
$out = array();
|
||||
if (strlen($value)>2) {
|
||||
$niveau = strlen($value)-1;
|
||||
$new = substr($value,0,$niveau);
|
||||
$out = array_merge($out, array($new), $this->getNafParent($new, $niveau1));
|
||||
} elseif (strlen($value)==2 && $niveau1 === true) {
|
||||
$nafM = new Table_Nafs();
|
||||
$sql = $nafM->select()
|
||||
->from($nafM, array('parent'))
|
||||
->where('code = ?', $value);
|
||||
$result = $nafM->fetchRow($sql);
|
||||
$out[] = $result->parent;
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
public function ajax($parent, $niveau, $key)
|
||||
{
|
||||
//Récupération des valeurs enregistrées en session
|
||||
require_once 'Scores/SessionCiblage.php';
|
||||
$sessionCiblage = new SessionCiblage();
|
||||
$val = $sessionCiblage->getCritere($key);
|
||||
$valuesChecked = array();
|
||||
|
||||
$valuesUndetermined = array();
|
||||
if ($val != null){
|
||||
$valuesChecked = explode(',',$val);
|
||||
foreach($valuesChecked as $value){
|
||||
$valuesUndetermined = array_merge($valuesUndetermined, $this->getNafParent($value));
|
||||
}
|
||||
}
|
||||
|
||||
$niveau++;
|
||||
$nafM = new Table_Nafs();
|
||||
$sql = $nafM->select();
|
||||
if (!empty($parent) && $niveau==2) {
|
||||
$sql->where('parent = ?', $parent);
|
||||
} elseif (!empty($parent) && $niveau>2) {
|
||||
$sql->where("code LIKE '".$parent."%'");
|
||||
}
|
||||
$sql->where('niveau = ?', $niveau)->order('code ASC');
|
||||
|
||||
$result = $nafM->fetchAll($sql)->toArray();
|
||||
$tabNaf = array();
|
||||
foreach($result as $item){
|
||||
$structure = array(
|
||||
'data' => $item['code'].' - '.$item['lib'],
|
||||
'attr' => array('id' => $item['code'], 'niveau' => $item['niveau']),
|
||||
);
|
||||
if (in_array($item['code'], $valuesChecked)){
|
||||
$structure['attr']['class'] = 'jstree-checked';
|
||||
}
|
||||
if (in_array($item['code'], $valuesUndetermined)){
|
||||
$structure['attr']['class'] = 'jstree-undetermined';
|
||||
}
|
||||
if ($niveau<5){
|
||||
$structure['state'] = 'closed';
|
||||
$structure['children'] = array();
|
||||
}
|
||||
$tabNaf[] = $structure;
|
||||
}
|
||||
return json_encode($tabNaf);
|
||||
}
|
||||
}
|
5
application/modules/frontend/models/Objects/Pref.php
Normal file
5
application/modules/frontend/models/Objects/Pref.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Object_Prefs extends Libs_Row
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Object_ProfilExtraction extends Libs_Row
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Object_RefExport extends Libs_Row
|
||||
{
|
||||
|
||||
}
|
6
application/modules/frontend/models/Objects/Region.php
Normal file
6
application/modules/frontend/models/Objects/Region.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
class Object_Region extends Libs_Row
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Table_Codepostauxs extends Libs_Table
|
||||
{
|
||||
protected $_name = 'codepostaux';
|
||||
}
|
5
application/modules/frontend/models/Tables/Comptages.php
Normal file
5
application/modules/frontend/models/Tables/Comptages.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Table_Comptages extends Libs_Table
|
||||
{
|
||||
protected $_name = 'comptages';
|
||||
}
|
5
application/modules/frontend/models/Tables/Criteres.php
Normal file
5
application/modules/frontend/models/Tables/Criteres.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Table_Criteres extends Libs_Table
|
||||
{
|
||||
protected $_name = 'criteres';
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Table_Departements extends Libs_Table
|
||||
{
|
||||
public $_name = 'departements';
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Table_EnrichissementIdentifiants extends Zend_Db_Table_Abstract
|
||||
{
|
||||
public $_name = 'enrichissement_identifiants';
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Table_EnrichissementProfils extends Zend_Db_Table_Abstract
|
||||
{
|
||||
public $_name = 'enrichissement_profils';
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
class Table_Formejuridique extends Libs_Table
|
||||
{
|
||||
protected $_name = 'formejuridique';
|
||||
protected $_primary = 'fjCode';
|
||||
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
class Table_Formejuridiques extends Libs_Table
|
||||
{
|
||||
protected $_name = 'formejuridique';
|
||||
protected $_primary = 'fjCode';
|
||||
|
||||
}
|
5
application/modules/frontend/models/Tables/Minmaxs.php
Normal file
5
application/modules/frontend/models/Tables/Minmaxs.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Table_Minmaxs extends Libs_Table
|
||||
{
|
||||
protected $_name = 'minmax';
|
||||
}
|
5
application/modules/frontend/models/Tables/Nafs.php
Normal file
5
application/modules/frontend/models/Tables/Nafs.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Table_Nafs extends Libs_Table
|
||||
{
|
||||
protected $_name = 'naf';
|
||||
}
|
5
application/modules/frontend/models/Tables/Prefs.php
Normal file
5
application/modules/frontend/models/Tables/Prefs.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Table_Prefs extends Libs_Table
|
||||
{
|
||||
protected $_name = 'prefs';
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Table_ProfilExtraction extends Libs_Table
|
||||
{
|
||||
protected $_name = 'profilExtraction';
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Table_ProfilExtractions extends Libs_Table
|
||||
{
|
||||
protected $_name = 'profileExtraction';
|
||||
}
|
5
application/modules/frontend/models/Tables/RefExport.php
Normal file
5
application/modules/frontend/models/Tables/RefExport.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Table_RefExport extends Libs_Table
|
||||
{
|
||||
protected $_name = 'refexport';
|
||||
}
|
6
application/modules/frontend/models/Tables/Regions.php
Normal file
6
application/modules/frontend/models/Tables/Regions.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
class Table_Regions extends Libs_Table
|
||||
{
|
||||
protected $_name = 'regions';
|
||||
}
|
||||
|
262
application/modules/frontend/views/helpers/Field.php
Normal file
262
application/modules/frontend/views/helpers/Field.php
Normal file
@ -0,0 +1,262 @@
|
||||
<?php
|
||||
Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
|
||||
{
|
||||
public function Field($name, $field, $type = null)
|
||||
{
|
||||
$html = '';
|
||||
if($field != null) {
|
||||
$html.= '<div class="fieldgrp">';
|
||||
if($type == null)
|
||||
$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':
|
||||
switch($name) {
|
||||
case 'reg':
|
||||
$label = 'Localisation Régions';
|
||||
break;
|
||||
case 'vil':
|
||||
case 'adr_com':
|
||||
$label = 'Localisation Villes';
|
||||
break;
|
||||
case 'dep':
|
||||
$label = 'Localisation Départements';
|
||||
break;
|
||||
default:
|
||||
$label = $field['label'];
|
||||
}
|
||||
$html.= $this->structureHTML(
|
||||
$label,
|
||||
$this->textHTML($name, $field, $name), $field['help'][ucfirst($name)]);
|
||||
break;
|
||||
case 'textarea':
|
||||
$html.= $this->structureHTML(
|
||||
$field['label'],
|
||||
$this->textareaHTML($name, $field));
|
||||
break;
|
||||
case 'radio':
|
||||
$html.= $this->structureHTML(
|
||||
$field['label'],
|
||||
$this->radioHTML($name, $field));
|
||||
break;
|
||||
case 'file':
|
||||
$html.= $this->structureHTML(
|
||||
$field['label'],
|
||||
$this->fileuploadHtml($name, $field));
|
||||
break;
|
||||
}
|
||||
$html.= '</div>';
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
private function structureHTML($label, $html, $help = null)
|
||||
{
|
||||
$out = '';
|
||||
$out.= $this->structureLabel($label, $help);
|
||||
$out.= '<div class="field">'.$html.'</div>';
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Définition du label
|
||||
* @param unknown_type $label
|
||||
*/
|
||||
private function structureLabel($label, $help)
|
||||
{
|
||||
$return = '<label>'.$label.'</label>';
|
||||
if($help)
|
||||
$return .= '<p style="font-size:9px;">'.$help.'</p>';
|
||||
|
||||
|
||||
return ($return);
|
||||
}
|
||||
|
||||
protected function getMinMax($name, $valeur)
|
||||
{
|
||||
if(!empty($name)) {
|
||||
$default = Fields::getMinMax($name);
|
||||
if(empty($valeur[0])){$valeur[0] = $default[0]['min'];}
|
||||
if(empty($valeur[1])){$valeur[1] = $default[0]['max'];}
|
||||
}
|
||||
return ($valeur);
|
||||
}
|
||||
|
||||
private function intervalSelectHTML($name, $field)
|
||||
{
|
||||
$session = new SessionCiblage();
|
||||
$sessionValeur = explode(',', $session->getCritere($name));
|
||||
$minMax = $this->getMinMax($name, array(0,0));
|
||||
$return = '<select class="intervalSelect" name="'.$name.'1" id="'.$name.'" number="1">';
|
||||
foreach($field['fields'][$field['type']]['value'] as $elements) {
|
||||
if($elements[0] == 0)
|
||||
$return .= '<option value="'.$minMax[0].'">Min</option>';
|
||||
else
|
||||
$return .= '<option '.(($sessionValeur[0] == $elements[0])?'selected':'').' value="'. $elements[0].'">'.number_format($elements[0], 0,'', ' ').'</option>';
|
||||
}
|
||||
|
||||
$return .= '</select> à ';
|
||||
$return .= '<select class="intervalSelect" name="'.$name.'2" id="'.$name.'" number="2">';
|
||||
foreach($field['fields'][$field['type']]['value'] as $elements) {
|
||||
if($elements[1] == 0)
|
||||
$return .= '<option value="'.$minMax[1].'">Max</option>';
|
||||
else
|
||||
$return .= '<option '.(($sessionValeur[1] == $elements[1])?'selected':'').' value="'. $elements[1].'">'.number_format($elements[1], 0,'', ' ').'</option>';
|
||||
}
|
||||
|
||||
$return .= '</select>';
|
||||
$return .= ' <span id="'.$name.'"><a href="" class="intervalSelect" id="'.$name.'">Valider</a></span>';
|
||||
return ($return);
|
||||
}
|
||||
|
||||
/* Select */
|
||||
private function selectMultipleHTML($name, $field)
|
||||
{
|
||||
$session = new SessionCiblage();
|
||||
|
||||
$sessionValeur = $session->getCritere($name);
|
||||
/*if(is_array($sessionValeur))
|
||||
$sessionValeur = implode(',', $sessionValeur);*/
|
||||
$return = '<select size="'.count($field['fields'][$field['type']]['value']).'" class="criteres '.$field['type']['class'].'" name="'.$name.'" multiple>';
|
||||
$return .= '<option '.(($sessionValeur == 'tous')?'selected':'').' value="tous">Tous</option>';
|
||||
foreach($field['fields'][$field['type']]['value'] as $value => $label) {
|
||||
$selected = "";
|
||||
if(($sessionValeur != null) and in_array($value, $sessionValeur) and $sessionValeur != "tous")
|
||||
$selected = " selected";
|
||||
$return .= '<option'.$selected.' value="'.$value.'">'.$label.'</option>';
|
||||
}
|
||||
$return .= '</select>';
|
||||
return ($return);
|
||||
}
|
||||
|
||||
/* Select 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 '.(($sessionValeur == 'tous')?'selected':'').' value="tous">Tous</option>';
|
||||
foreach($field['fields'][$field['type']]['value'] as $value => $label) {
|
||||
$selected = "";
|
||||
if(($sessionValeur != null) and $sessionValeur == $value and $sessionValeur != "tous")
|
||||
$selected = " selected";
|
||||
$return .= '<option'.$selected.' value="'.$value.'">'.$label.'</option>';
|
||||
}
|
||||
$return .= '</select>';
|
||||
return ($return);
|
||||
}
|
||||
|
||||
/* Interval */
|
||||
private function intervalHTML($name, $field)
|
||||
{
|
||||
$session = new SessionCiblage();
|
||||
$valeur = $session->getCritere($name);
|
||||
$valeur = explode(',', $valeur);
|
||||
|
||||
$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, $name)
|
||||
{
|
||||
$session = new SessionCiblage();
|
||||
switch($name) {
|
||||
case 'ape_entrep':
|
||||
case 'ape_etab':
|
||||
$type = 'Naf';
|
||||
break;
|
||||
case 'vil':
|
||||
$type= 'Vil';
|
||||
break;
|
||||
case 'adr_com':
|
||||
case 'adr_com_ex':
|
||||
$type= $name;
|
||||
break;
|
||||
case 'cj':
|
||||
$type = 'Cj';
|
||||
break;
|
||||
case 'cj_ex':
|
||||
$type = 'Cj_ex';
|
||||
break;
|
||||
case 'adr_dept':
|
||||
case 'adr_dept_ex':
|
||||
$type= $name;
|
||||
break;
|
||||
}
|
||||
/* Modifier les données */
|
||||
$return = '<textarea rows="5" style="border:1px inset silver;width:60%" class="criteres complited'.$type.'" id="textarea_'.$name.'" name="'.$name.'">'.$session->getCritere($name).'</textarea>';
|
||||
$return .= '<a href="" class="autocomplet" textarea="'.$name.'">Valider</a> <a href="">Aide</a>';
|
||||
return ($return);
|
||||
}
|
||||
|
||||
/* 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)).'">
|
||||
<img src="/themes/default/images/arborescence.gif" />
|
||||
</a> <img style="cursor:pointer" class="manuel" ref="'.$name.'" src="/themes/default/images/Textarea.gif" title="Champs texte"/>';
|
||||
if($name == 'adr_com')
|
||||
$return .= ' <img src="/themes/default/images/img_carte_fr.gif" title="Carte de france"/>';
|
||||
return ($return);
|
||||
}
|
||||
|
||||
private function fileuploadHtml($name, $field)
|
||||
{
|
||||
$return = '<input class="upload" type="file" name="fichier" id="'.$name.'" /> ';
|
||||
return ($return);
|
||||
}
|
||||
|
||||
/* Radios */
|
||||
private function radioHTML($name, $field, $item)
|
||||
{
|
||||
$return = '<input type="radio" name="'.$name.'" />';
|
||||
return ($return);
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
<?php
|
@ -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/classic/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>
|
@ -0,0 +1,4 @@
|
||||
<br /><br />
|
||||
<div id="view-content">
|
||||
<p>View script for controller <b>Arborescence</b> and script/action name <b>index</b></p>
|
||||
</div>
|
@ -0,0 +1,23 @@
|
||||
<div id="<?=$this->key?>" class="jstree jstree-default" style="overflow:auto;"></div>
|
||||
<script>
|
||||
$("#<?=$this->key?>").jstree({
|
||||
"themes" : {
|
||||
"theme" : "default",
|
||||
"url" : "/style.css",
|
||||
"dots" : true,
|
||||
"icons" : false,
|
||||
},
|
||||
"plugins" : ["themes", "json_data", "checkbox"],
|
||||
"json_data" : {
|
||||
"data" : <?=$this->formejuridiques?>,
|
||||
"ajax" : {
|
||||
"url" : '<?=$this->url(array('controller'=>'arborescence', 'action'=>'juridiqueajax', 'key'=> $this->key))?>',
|
||||
"data" : function(n)
|
||||
{
|
||||
return { id: n.attr ? n.attr("id") : 0 };
|
||||
},
|
||||
"cache" : true,
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
@ -0,0 +1,20 @@
|
||||
<div id="<?=$this->key?>" class="jstree jstree-default" style="overflow:auto;"></div>
|
||||
<script>
|
||||
$("#<?=$this->key?>").jstree({
|
||||
"themes" : {
|
||||
"theme" : "default",
|
||||
"url" : "/jstree/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>
|
@ -0,0 +1,4 @@
|
||||
<br /><br />
|
||||
<div id="view-content">
|
||||
<p>View script for controller <b>Comptage</b> and script/action name <b>index</b></p>
|
||||
</div>
|
@ -0,0 +1,29 @@
|
||||
<div style="width:100%;">
|
||||
<style>
|
||||
.color{
|
||||
background-color: #DCE3FC;
|
||||
}
|
||||
</style>
|
||||
<table width="100%" style="font-size:10px;">
|
||||
<tr>
|
||||
<?php foreach($this->champs as $champ): ?>
|
||||
<th style="border-left:1px solid black;padding:2px;"><b><?php echo $champ; ?></b></th>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php
|
||||
$i=0;
|
||||
if(count($this->liste) > 0) {
|
||||
foreach($this->liste as $societe) {
|
||||
echo '<tr '.((($i%2) == 0)?'class="color"':'').'>';
|
||||
foreach($this->champs as $champ) {
|
||||
echo '<td style="border-left:1px solid silver;padding:2px">'.$societe[$this->reference[$champ]['column']].'</td>';
|
||||
}
|
||||
echo '</tr>';
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
echo '<tr><td>Vous n\'avez selectionné aucuns critères</td></tr>';
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<div>
|
@ -0,0 +1,16 @@
|
||||
<?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'))?>">
|
||||
<center>
|
||||
<label>Votre référence</label><br />
|
||||
<input type="text" name="ref" value="<?=date('Y-m-d:H-i-m').'_'.uniqid()?>" />
|
||||
</form>
|
||||
<span class="message" style="color:#ff0000;"></span>
|
||||
</center>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="/themes/default/scripts/jquery.form.js"></script>
|
||||
<?php endif;?>
|
@ -0,0 +1 @@
|
||||
<?=json_encode($this->result)?>
|
@ -0,0 +1,81 @@
|
||||
<div id="dashboard" style="padding:10px">
|
||||
<a href="/dashboard/index">Tableau de bord</a> > Detail du ciblage<br /><br />
|
||||
<a class="update" href="<?=$this->url(array('controller'=> 'comptage','action'=>'update', 'id'=>$this->comptageId))?>">Actualiser</a> |
|
||||
<a href="<?=$this->url(array('controller'=> 'index','action'=>'index', 'id'=>$this->comptageId))?>">Recharger les critères de ciblage</a> |
|
||||
<a class="enrichissementref" href="<?=$this->url(array('controller'=> 'enrichissement','action'=>'reference', 'id'=>$this->comptageId))?>">Enrichissement</a>
|
||||
|
||||
<fieldset>
|
||||
<legend>Critères</legend>
|
||||
<?php foreach(json_decode($this->criteres['criteres'], true) as $critere => $valeur): ?>
|
||||
<?php if(!empty($valeur) and $valeur != ',' and !empty($critere)): ?>
|
||||
<?php $label = $this->label->get($critere); ?>
|
||||
<?php if(!is_array($valeur)): ?>
|
||||
<?php if($label['type'] != 'textarea' and $label['type'] != 'interval') :?>
|
||||
<?php echo '<b>'.$label['label'] . '</b> : '.$label['fields'][$label['type']]['value'][$valeur];?><br />
|
||||
<?php else: ?>
|
||||
<?php echo '<b>'.$label['label'] . '</b>:'.$valeur; ?><br />
|
||||
<?php endif; ?>
|
||||
<?php else:?>
|
||||
<?php echo '<b>'.$label['label'] .'</b> : '. implode(',', $valeur).'<br />'; ?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php endforeach;?>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Comptages</legend>
|
||||
<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>
|
||||
</fieldset>
|
||||
|
||||
|
||||
<fieldset>
|
||||
<legend>Enrichissements</legend>
|
||||
<?php if ( count($this->enrichissements)>0 ) {?>
|
||||
<table style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Reférence</th>
|
||||
<th>Nombre de lignes</th>
|
||||
<th>Fichier</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($this->enrichissements as $item):?>
|
||||
<tr>
|
||||
<th><?=$item['dateAdded']?></th>
|
||||
<th><?=$item['reference']?></th>
|
||||
<th><?=number_format($item['nbLigneTotales'], 0, '', ' ')?></th>
|
||||
<td>
|
||||
<?php if($item['dateStart']>0): ?>
|
||||
<a href="/enrichissement/download/id/<?php echo $item['id'];?>"><?php echo $item['fichier']; ?></a>
|
||||
<?php else: ?>
|
||||
En attente de traitement
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php }?>
|
||||
</fieldset>
|
||||
|
||||
|
||||
</div>
|
@ -0,0 +1,45 @@
|
||||
<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 colspan="4"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($this->ciblages as $item):?>
|
||||
<tr>
|
||||
<td class="reference"><?=$item['reference']?></td>
|
||||
<td class="update resultat"><?=number_format($item['resultat'], 0, ',', ' ')?></td>
|
||||
<td class="update insee"><?=number_format($item['uniteInsee'], 0, ',', ' ')?></td>
|
||||
<td class="update date"><?=$item['dateComptage']?></td>
|
||||
<td><a class="update" href="<?=$this->url(array('controller'=> 'comptage','action'=>'update', 'id'=>$item['id']))?>">Actualiser</a></td>
|
||||
<td><a href="<?=$this->url(array('controller'=> 'index','action'=>'index', 'id'=>$item['id']))?>">Recharger les critères de ciblage</a></td>
|
||||
<td><a href="<?=$this->url(array('controller'=> 'dashboard','action'=>'ciblage', 'id'=>$item['id']))?>">Detail</a></td>
|
||||
<td><a class="enrichissementref" href="<?=$this->url(array('controller'=> 'enrichissement','action'=>'reference', 'id'=>$item['id']))?>">Enrichissement</a></td>
|
||||
</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>
|
@ -0,0 +1 @@
|
||||
<?php
|
@ -0,0 +1,94 @@
|
||||
<div id="dashboard">
|
||||
|
||||
<div class="chemin">
|
||||
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>''))?>">Tableau de bord</a> >
|
||||
Enrichissement à partir d'un ciblage
|
||||
</div>
|
||||
|
||||
<h2>Fichiers en cours d'enrichissement</h2>
|
||||
|
||||
<?php if(count($this->encours) > 0):?>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Référence</th>
|
||||
<th>Nombre de lignes totales</th>
|
||||
<th>Nombre de lignes traitées</th>
|
||||
<th>Date</th>
|
||||
<th>Etat</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $i=0; foreach($this->encours as $item):?>
|
||||
<tr>
|
||||
<td><?=$item['reference']?></td>
|
||||
<td><?=number_format($item['nbLigneTotales'], 0, ',', ' ')?></td>
|
||||
<td><?=number_format($item['nbLigneTraites'], 0, ',', ' ')?></td>
|
||||
<td><?=$item['dateAdded']?></td>
|
||||
<td>
|
||||
<?php if ( $item['dateStart']!='0000-00-00 00:00:00' ) {?>
|
||||
En cours de traitement
|
||||
<?php } else {?>
|
||||
En attente de traitement
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php else:?>
|
||||
<p>Aucun enrichissement en cours.<p>
|
||||
<?php endif;?>
|
||||
|
||||
<h2>Fichiers enrichis</h2>
|
||||
|
||||
<?php if(count($this->fini) > 0):?>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Référence</th>
|
||||
<th>Nombre de lignes totales</th>
|
||||
<th>Date</th>
|
||||
<th>Fichier</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($this->fini as $item):?>
|
||||
<tr>
|
||||
<td><?=$item['reference']?></td>
|
||||
<td><?=number_format($item['nbLigneTotales'], 0, ',', ' ')?></td>
|
||||
<td><?=$item['dateAdded']?></td>
|
||||
<td><a href="/enrichissement/download/id/<?php echo $item['id'];?>"><?php echo $item['fichier']; ?></a></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php else:?>
|
||||
<p>Aucun enrichissement.<p>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function()
|
||||
{
|
||||
$(document).focusin(function(){
|
||||
timer = setInterval(updateInfo, 10000);
|
||||
});
|
||||
$(document).focusout(function(){
|
||||
clearInterval(timer);
|
||||
});
|
||||
timer = setInterval(updateInfo, 10000);
|
||||
});
|
||||
|
||||
var timer;
|
||||
function updateInfo()
|
||||
{
|
||||
$('tr.encours').each(function(){
|
||||
var objet = $(this);
|
||||
var id = $(this).attr('id');
|
||||
$.getJSON('/index/getinfo', {id: id}, function(data){
|
||||
if (data!=''){ objet.find('td.ligne').text(data.nbLigneT); }
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
@ -0,0 +1,89 @@
|
||||
<div id="dashboard">
|
||||
|
||||
<div class="chemin">
|
||||
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>''))?>">Tableau de bord</a>
|
||||
</div>
|
||||
|
||||
<div id="menu">
|
||||
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'ciblages'))?>">Liste de vos ciblages</a> -
|
||||
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'enrichissements'))?>">Liste de vos enrichissements</a> -
|
||||
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'configuration'))?>">Préférences de l'application</a> -
|
||||
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>''))?>">Enrichissement de 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">
|
||||
<h2>Vos derniers ciblages</h2>
|
||||
<?php if(count($this->comptages) > 0):?>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Référence</th>
|
||||
<th>Nombre d'entité</th>
|
||||
<th>Unité Insee</th>
|
||||
<th>Date</th>
|
||||
<th colspan="4"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($this->comptages as $name => $item):?>
|
||||
<tr>
|
||||
<td class="reference"><?=$item['reference']?></td>
|
||||
<td class="update resultat"><?=number_format($item['resultat'], 0, ',', ' ')?></td>
|
||||
<td class="update insee"><?=number_format($item['uniteInsee'], 0, ',', ' ')?></td>
|
||||
<td class="update date"><?=$item['dateComptage']?></td>
|
||||
<td><a class="update" href="<?=$this->url(array('controller'=> 'comptage','action'=>'update', 'id'=>$item['id']))?>">Actualiser</a></td>
|
||||
<td><a href="<?=$this->url(array('controller'=> 'index','action'=>'index', 'id'=>$item['id']))?>">Recharger les critères de ciblage</a></td>
|
||||
<td><a href="<?=$this->url(array('controller'=> 'dashboard','action'=>'ciblage', 'id'=>$item['id']))?>">Detail</a></td>
|
||||
<td><a class="enrichissementref" href="<?=$this->url(array('controller'=> 'enrichissement','action'=>'reference', 'id'=>$item['id']))?>">Enrichissement</a></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php else:?>
|
||||
<p>Aucun ciblage.<p>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="lastEnrichissement">
|
||||
<h2>Vos derniers enrichissements</h2>
|
||||
<?php if(count($this->enrichissements) > 0):?>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Référence</th>
|
||||
<th>Nombre de lignes totales</th>
|
||||
<th>Date</th>
|
||||
<th>Etat</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $i=0;foreach($this->enrichissements as $item):?>
|
||||
<?php if($i++ == 5)break;?>
|
||||
<tr>
|
||||
<td><?=$item['reference']?></td>
|
||||
<td><?=number_format($item['nbLigneTotales'], 0, ',', ' ')?></td>
|
||||
<td><?=$item['dateAdded']?></td>
|
||||
<td>
|
||||
<?php if ( $item['dateStop']!='0000-00-00 00:00:00' ) {?>
|
||||
<a href="/enrichissement/download/id/<?php echo $item['id'];?>"><?php echo $item['fichier']; ?></a>
|
||||
<?php }elseif ( $item['dateStart']!='0000-00-00 00:00:00' ) {?>
|
||||
En cours de traitement
|
||||
<?php } else {?>
|
||||
En attente de traitement
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php else:?>
|
||||
<p>Aucun enrichissement.<p>
|
||||
<?php endif;?>
|
||||
</div>
|
@ -0,0 +1 @@
|
||||
<?php
|
@ -0,0 +1,55 @@
|
||||
<div id="economique">
|
||||
<span style="color:red;text-align:right;padding:5px;margin-top:-5px;">
|
||||
*<sup>Il n'est pas nécessaire de remplire tous les champs.</sup>
|
||||
</span>
|
||||
<hr />
|
||||
<div id="s_economique">
|
||||
<ul id="fieldsblock">
|
||||
<li><?php echo $this->Field('capital', $this->fields->get('capital'));?></li>
|
||||
<li><?php echo $this->Field('ape_etab', $this->fields->get('ape_etab'));?></li>
|
||||
<li class="ape_etab" style="display:none;background-image:none;height:100px;">
|
||||
<div id="ape_etab_ex" class="exclusion" style="display:none">
|
||||
<?php echo $this->Field('ape_etab_ex', $this->fields->get('ape_etab_ex'), 'text');?>
|
||||
</div>
|
||||
<div id="ape_etab_in" class="inclusion">
|
||||
<?php echo $this->Field('ape_etab', $this->fields->get('ape_etab'), 'text');?>
|
||||
</div>
|
||||
Valeurs exclusions : <input value="1" type="checkbox" class="checkbox_ex" name="ape_etab" />
|
||||
</li>
|
||||
<li class="ape_etab" style="display:none;background-image:none;height:100px;">
|
||||
<div id="ape_entrep_ex" class="exclusion" style="display:none">
|
||||
<?php echo $this->Field('ape_entrep_ex', $this->fields->get('ape_entrep_ex'), 'text');?>
|
||||
</div>
|
||||
<div id="ape_entrep_in" class="inclusion">
|
||||
<?php echo $this->Field('ape_entrep', $this->fields->get('ape_entrep'), 'text');?>
|
||||
</div>
|
||||
Valeurs exclusions : <input value="1" type="checkbox" class="checkbox_ex" name="ape_entrep" />
|
||||
</li>
|
||||
<li><?php echo $this->Field('age_etab', $this->fields->get('age_etab'));?></li>
|
||||
<li><?php echo $this->Field('teff_etab', $this->fields->get('teff_etab'));?></li>
|
||||
<li><?php echo $this->Field('teff_etabM', $this->fields->get('teff_etabM'));?></li>
|
||||
<li><?php echo $this->Field('eff_etab', $this->fields->get('eff_etab'));?></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="a_economique" style="display:none">
|
||||
<fieldset style="border:1px solid silver;padding:2px;">
|
||||
<legend>Critères Avancés</legend>
|
||||
<ul id="fieldsblock">
|
||||
<li><?php echo $this->Field('age_entrep', $this->fields->get('age_entrep'));?></li>
|
||||
<li><?php echo $this->Field('teff_entrep', $this->fields->get('teff_entrep'));?></li>
|
||||
<li><?php echo $this->Field('teff_entrepM', $this->fields->get('teff_entrepM'));?></li>
|
||||
<li><?php echo $this->Field('eff_entrep', $this->fields->get('eff_entrep'));?></li>
|
||||
<li><?php echo $this->Field('nbEtab', $this->fields->get('nbEtab'));?></li>
|
||||
</ul>
|
||||
</fieldset>
|
||||
</div>
|
||||
<hr style="margin-top:5px;" />
|
||||
<p>
|
||||
<a class="mode" id="a_economique" style="cursor:pointer;margin-left:50%">
|
||||
<img src="/themes/default/images/fleche-bas.gif" />
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
<div style="text-align:right;margin-top:20px;">
|
||||
<a class="resetFamille" id="economique">Réinitialiser les critères economiques</a>
|
||||
</div>
|
@ -0,0 +1,9 @@
|
||||
Votre commande a bien été prise en compte sous la référence
|
||||
|
||||
|
||||
<script>
|
||||
$('#dialog').dialog({ buttons: [ {
|
||||
text: "Quitter",
|
||||
click: function() { $(this).dialog('close'); }
|
||||
} ] });
|
||||
</script>
|
@ -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>
|
@ -0,0 +1,100 @@
|
||||
<?php if ( !$this->profil ) {?>
|
||||
Aucun profil d'enrichissement, Merci de prendre contact avec le service commercial.
|
||||
<?php }elseif ( empty($this->id) ) {?>
|
||||
Erreur
|
||||
<?php } elseif ($this->resultat>50000) {?>
|
||||
<p>Le nombre de lignes à enrichir est trop important.
|
||||
Vous pouvez prendre contact avec le service commercial en cliquant ici.
|
||||
Vos critères seront enregistrées et une référence vous sera fourni.</p>
|
||||
<?php } else {?>
|
||||
<div id="update">
|
||||
<style>
|
||||
#enrichissement
|
||||
{
|
||||
width:100%;
|
||||
}
|
||||
|
||||
#enrichissement th
|
||||
{
|
||||
font-weight:800;
|
||||
}
|
||||
|
||||
#enrichissement td, th
|
||||
{
|
||||
padding:5px;
|
||||
border-left:1px solid black;
|
||||
}
|
||||
#enrichissement tr
|
||||
{
|
||||
font-size:10px;
|
||||
border:1px solid silver;
|
||||
}
|
||||
</style>
|
||||
<p style="text-align:center;color:green">Votre ciblage a été actualisé</p>
|
||||
<div style="font-size:10px;padding:5px; border:1px dashed green">
|
||||
Les tarifs sont données à titre indicatif et peuvent variées suivant les spécificités de votre compte.
|
||||
</div>
|
||||
<br/>
|
||||
<div style="font-size:10px;padding:5px; border:1px dashed green">
|
||||
Les informations permettant l'enrichissement seront enregistrées, après la saisie de votre référence.
|
||||
</div>
|
||||
<br />
|
||||
<table id="enrichissement">
|
||||
<tr>
|
||||
<th>Libellé</th>
|
||||
<th><?php echo date('Y-m-d');?></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Nombre d'unités</td>
|
||||
<td><?php echo $this->resultat;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Nombre d'unités Insee</td>
|
||||
<td><?php echo $this->uniteInsee;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Prix du fichier</td>
|
||||
<td><?php echo $this->prix;?> €</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Redevance Insee</td>
|
||||
<td><?php echo $this->prixInsee;?> €</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Tapez votre référence</b></td>
|
||||
<td colspan="2">
|
||||
<form name="commande" method="post" action="<?=$this->url(array('controller'=>'enrichissement', 'action'=>'commande'))?>">
|
||||
<input type="hidden" name="id" value="<?=$this->id?>" />
|
||||
<input id="cache" type="text" value="<?php echo 'enr_'.date('Y-m-d_').uniqid();?>" name="ref">
|
||||
<div id="progress"></div>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php if (!empty($this->infoInsee)) {?>
|
||||
<br/>
|
||||
<p><?=$this->infoInsee?></p>
|
||||
<?php }?>
|
||||
<br/>
|
||||
<script>
|
||||
$('#dialog').dialog({ buttons: [ {
|
||||
text: "Valider",
|
||||
click: function() {
|
||||
$('div#progress').html('<br /><center><img src="/themes/default/images/ajax_loader.gif" /></center>');
|
||||
$('#cache').css('display', 'none');
|
||||
$.post(
|
||||
$('form[name=commande]').attr('action'),
|
||||
$('form[name=commande]').serialize(),
|
||||
function(data){
|
||||
$('div#update').html(data);
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
text: "Quitter",
|
||||
click: function() { $(this).dialog("close"); }
|
||||
}
|
||||
] });
|
||||
</script>
|
||||
</div>
|
||||
<?php }?>
|
@ -0,0 +1,45 @@
|
||||
<!-- <div class="erreur" id="entreprise">
|
||||
|
||||
</div> -->
|
||||
<div id="entreprise">
|
||||
<span style="color:red;text-align:right;padding:5px;margin-top:-5px;">
|
||||
*<sup>Il n'est pas nécessaire de remplire tous les champs.</sup>
|
||||
</span>
|
||||
<hr />
|
||||
<div id="s_entreprise">
|
||||
<ul id="fieldsblock">
|
||||
<li id="siege"><?php echo $this->Field('siege', $this->fields->get('siege'));?></li>
|
||||
<li id="sirenGrp" ><?php echo $this->Field('sirenGrp', $this->fields->get('sirenGrp'));?></li>
|
||||
<li id="tel" ><?php echo $this->Field('tel', $this->fields->get('tel'));?></li>
|
||||
<li id="fax" ><?php echo $this->Field('fax', $this->fields->get('fax'));?></li>
|
||||
<li id="web" ><?php echo $this->Field('web', $this->fields->get('web'));?></li>
|
||||
<li id="mail" ><?php echo $this->Field('mail', $this->fields->get('mail'));?></li>
|
||||
<li id="presentRcs" ><?php echo $this->Field('present cs', $this->fields->get('presentRcs'));?></li>
|
||||
<li id="adrDom" ><?php echo $this->Field('adrDom', $this->fields->get('adrDom'));?></li>
|
||||
<li id="dirNom" ><?php echo $this->Field('dirNom', $this->fields->get('dirNom'));?></li>
|
||||
<li id="li_dateCrea_etab" ><?php echo $this->Field('dateCrea_etab', $this->fields->get('dateCrea_etab'));?></li>
|
||||
<li id="part" ><?php echo $this->Field('part', $this->fields->get('part'));?></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="a_entreprise" style="display:none">
|
||||
<fieldset style="border:1px solid silver;padding:5px;">
|
||||
<legend>Critères Avancés</legend>
|
||||
<ul id="fieldsblock">
|
||||
<li id="nbMPublic" ><?php echo $this->Field('nbMPubli', $this->fields->get('nbMPubli'));?></li>
|
||||
<li id="li_dateCrea_etab" ><?php echo $this->Field('dateCrea_ent',$this->fields->get('dateCrea_ent'));?></li>
|
||||
<li id="action" ><?php echo $this->Field('action', $this->fields->get('action'));?></li>
|
||||
<li id="nbActio" ><?php echo $this->Field('nbActio', $this->fields->get('nbActio'));?></li>
|
||||
<li id="nbPart" ><?php echo $this->Field('nbPart', $this->fields->get('nbPart'));?></li>
|
||||
</ul>
|
||||
</fieldset>
|
||||
</div>
|
||||
<hr style="margin-top:5px;" />
|
||||
<p>
|
||||
<a class="mode" id="a_entreprise" style="cursor:pointer;margin-left:50%">
|
||||
<img src="/themes/default/images/fleche-bas.gif" />
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
<div id="link">
|
||||
<a class="resetFamille" id="entreprise">Réinitialiser les critères entreprises</a>
|
||||
</div>
|
28
application/modules/frontend/views/scripts/error/error.phtml
Normal file
28
application/modules/frontend/views/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>
|
12
application/modules/frontend/views/scripts/error/get.phtml
Normal file
12
application/modules/frontend/views/scripts/error/get.phtml
Normal file
@ -0,0 +1,12 @@
|
||||
<table style="width:100%">
|
||||
<?php if(!empty($this->erreurs)): ?>
|
||||
<?php foreach($this->erreurs as $erreur => $valeur):?>
|
||||
<?php if($valeur['erreur'] and $valeur['valeur'] != 'tous'): ?>
|
||||
<tr style="border:1px solid red;">
|
||||
<td style="padding:10px"><?php echo $erreur; ?></td>
|
||||
<td style="padding:10px"><?php echo $valeur['valeur']; ?></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php endforeach;?>
|
||||
<?php endif; ?>
|
||||
</table>
|
@ -0,0 +1,69 @@
|
||||
<div id="financiere">
|
||||
<span style="color:red;text-align:right;padding:5px;margin-top:-5px;">
|
||||
*<sup>Il n'est pas nécessaire de remplire tous les champs.</sup>
|
||||
</span>
|
||||
<hr />
|
||||
<div id="s_financier">
|
||||
<ul id="fieldsblock" style="width:100%;height:100%;">
|
||||
<li style="background: none; height:80px;">
|
||||
<div id="bilType_ex" class="exclusion" style="display:none">
|
||||
<?php echo $this->Field('bilType_ex', $this->fields->get('bilType_ex'));?>
|
||||
</div>
|
||||
<div id="bilType_in" class="inclusion">
|
||||
<?php echo $this->Field('bilType', $this->fields->get('bilType'));?>
|
||||
</div>
|
||||
Valeurs exclusions : <input value="1" type="checkbox" class="checkbox_ex" name="bilType" />
|
||||
</li>
|
||||
<li style="background: none; height:150px;">
|
||||
<div id="avisCs_ex" class="exclusion" style="display:none">
|
||||
<?php echo $this->Field('avisCs_ex', $this->fields->get('avisCs_ex'));?>
|
||||
</div>
|
||||
<div id="avisCs_in" class="inclusion">
|
||||
<?php echo $this->Field('avisCs', $this->fields->get('avisCs'));?>
|
||||
</div>
|
||||
Valeurs exclusions : <input value="1" type="checkbox" class="checkbox_ex" name="avisCs" />
|
||||
</li>
|
||||
<li><?php echo $this->Field('bilAnnee', $this->fields->get('bilAnnee'));?></li>
|
||||
<li><?php echo $this->Field('bilCloture', $this->fields->get('bilCloture'));?></li>
|
||||
<li><?php echo $this->Field('bilDuree', $this->fields->get('bilDuree'));?></li>
|
||||
<li style="background: none; height:190px;">
|
||||
<div id="bilTca_ex" class="exclusion" style="display:none">
|
||||
<?php echo $this->Field('bilTca_ex', $this->fields->get('bilTca_ex'));?>
|
||||
</div>
|
||||
<div id="bilTca_in" class="inclusion">
|
||||
<?php echo $this->Field('bilTca', $this->fields->get('bilTca'));?>
|
||||
</div>
|
||||
Valeurs exclusions : <input value="1" type="checkbox" class="checkbox_ex" name="bilTca" />
|
||||
</li>
|
||||
<li><?php echo $this->Field('bilFL', $this->fields->get('bilFL'));?></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="a_financiere" style="display:none">
|
||||
<fieldset style="border:1px solid silver;padding:2px;">
|
||||
<legend>Critères Avancés</legend>
|
||||
<ul id="fieldsblock">
|
||||
<li><?php echo $this->Field('bilEE', $this->fields->get('bilEE'));?></li>
|
||||
<li><?php echo $this->Field('bilFK', $this->fields->get('bilFK'));?></li>
|
||||
<li><?php echo $this->Field('bilFR', $this->fields->get('bilFR'));?></li>
|
||||
<li><?php echo $this->Field('bilGF', $this->fields->get('bilGF'));?></li>
|
||||
<li><?php echo $this->Field('bilGP', $this->fields->get('bilGP'));?></li>
|
||||
<li><?php echo $this->Field('bilGW', $this->fields->get('bilGW'));?></li>
|
||||
<li><?php echo $this->Field('bilHD', $this->fields->get('bilHD'));?></li>
|
||||
<li><?php echo $this->Field('bilHH', $this->fields->get('bilHH'));?></li>
|
||||
<li><?php echo $this->Field('bilHL', $this->fields->get('bilHL'));?></li>
|
||||
<li><?php echo $this->Field('bilHM', $this->fields->get('bilHM'));?></li>
|
||||
<li><?php echo $this->Field('bilHN', $this->fields->get('bilHN'));?></li>
|
||||
<li><?php echo $this->Field('bilYP', $this->fields->get('bilYP'));?></li>
|
||||
</ul>
|
||||
</fieldset>
|
||||
</div>
|
||||
<hr style="margin-top:5px;" />
|
||||
<p>
|
||||
<a class="mode" id="a_financiere" style="cursor:pointer;margin-left:50%">
|
||||
<img src="/themes/default/images/fleche-bas.gif" />
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
<div style="text-align:right;margin-top:20px;">
|
||||
<a class="resetFamille" id="financier">Réinitialiser les critères financiers</a>
|
||||
</div>
|
@ -0,0 +1,42 @@
|
||||
<div id="geographique">
|
||||
<span style="color:red;text-align:right;padding:5px;margin-top:-5px;">
|
||||
*<sup>Il n'est pas nécessaire de remplire tous les champs.</sup>
|
||||
</span>
|
||||
<hr />
|
||||
<ul id="fieldsblock">
|
||||
<li><?php echo $this->Field('adr_com', $this->fields->get('adr_com'));?></li>
|
||||
<li class="adr_com" style="display:none;background-image:none;height:100px;">
|
||||
<div id="adr_com_ex" class="exclusion" style="display:none">
|
||||
<?php echo $this->Field('adr_com_ex', $this->fields->get('adr_com_ex'), 'text');?>
|
||||
</div>
|
||||
<div id="adr_com_in" class="inclusion">
|
||||
<?php echo $this->Field('adr_com', $this->fields->get('adr_com'), 'text');?>
|
||||
</div>
|
||||
Valeurs exclusions : <input value="1" type="checkbox" class="checkbox_ex" name="adr_com" />
|
||||
</li>
|
||||
<li class="adr_com" style="display:none;background-image:none;height:150px;">
|
||||
<div id="adr_dept_ex" class="exclusion" style="display:none">
|
||||
<?php echo $this->Field('adr_dept_ex', $this->fields->get('adr_dept_ex'), 'text');?>
|
||||
</div>
|
||||
<div id="adr_dept_in" class="inclusion">
|
||||
<?php echo $this->Field('adr_dept', $this->fields->get('adr_dept'), 'text');?>
|
||||
</div><br />
|
||||
Recherche régions : <input type="text" name="" id="textarea_adr_reg" /><br />
|
||||
Valeurs exclusions : <input value="1" type="checkbox" class="checkbox_ex" name="adr_dept" />
|
||||
</li>
|
||||
<li style="height:50px;background-image:none">
|
||||
Exclure DOM-TOM <input style="float:right" value="1" type="checkbox" class="ex_prede" name="ex_domtom" /><br />
|
||||
Exclure Etranger <input style="float:right" value="1" type="checkbox" class="ex_prede" name="ex_entr" /><br />
|
||||
Exclure Corse <input style="float:right" value="1" type="checkbox" class="ex_prede" name="ex_corse" /><br />
|
||||
</li>
|
||||
<li><?php echo $this->Field('zus', $this->fields->get('zus'), 'select');?></li>
|
||||
<li><?php echo $this->Field('zru', $this->fields->get('zru'), 'select');?></li>
|
||||
<li><?php echo $this->Field('zfu', $this->fields->get('zfu'), 'select');?></li>
|
||||
<li><?php echo $this->Field('cucs', $this->fields->get('cucs'), 'select');?></li>
|
||||
<li><?php echo $this->Field('zrr', $this->fields->get('zrr'), 'select');?></li>
|
||||
<li><?php echo $this->Field('zafr', $this->fields->get('zafr'), 'select');?></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div style="text-align:right;margin-top:20px;">
|
||||
<a class="resetFamille" id="econmique">Réinitialiser les critères geographiques</a>
|
||||
</div>
|
@ -0,0 +1,30 @@
|
||||
<div id="dashboard">
|
||||
<h2>Liste des comptages</h2>
|
||||
<div>
|
||||
<table>
|
||||
<tr>
|
||||
<th><b>Id</b></th>
|
||||
<th><b>Date de création</b></th>
|
||||
<th><b>Référence</b></th>
|
||||
<th><b>Résultat</b></th>
|
||||
<th><b>Insee</b></th>
|
||||
<th><b>Actions</b></th>
|
||||
</tr>
|
||||
<?php foreach($this->comptages as $comptage): ?>
|
||||
<tr>
|
||||
<td><?php echo $comptage['id']; ?></td>
|
||||
<td><?php echo $comptage['dateAjout']; ?></td>
|
||||
<td></td>
|
||||
<td><?php echo $comptage['resultat']; ?></td>
|
||||
<td><?php echo $comptage['uniteInsee']; ?></td>
|
||||
<td>
|
||||
<a href="">Actualiser</a>
|
||||
<a class="enrichissementref" href="<?=$this->url(array('controller'=> 'enrichissement','action'=>'reference', 'id'=>$comptage['idDefinition']))?>">Enrichissement</a>
|
||||
<a href="<?=$this->url(array('controller'=> 'gestion','action'=>'extract', 'id'=>$comptage['idDefinition']))?>">Extraire les sirets</a>
|
||||
<a href="">Supprimer</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,31 @@
|
||||
<div id="dashboard">
|
||||
<h2>Liste des comptages</h2>
|
||||
<div>
|
||||
<table>
|
||||
<tr>
|
||||
<th><b>Id comptage</b></th>
|
||||
<th><b>Reference</b></th>
|
||||
<th><b>NB Ligne Totales</b></th>
|
||||
<th><b>NB Ligne Traites</b></th>
|
||||
<th><b>Unitee INSEE</b></th>
|
||||
<th><b>Date création</b></th>
|
||||
<th><b>Date début</b></th>
|
||||
<th><b>Date d'arret</b></th>
|
||||
<th><b>Fichier</b></th>
|
||||
</tr>
|
||||
<?php foreach($this->enrichissements as $enrichissement): ?>
|
||||
<tr>
|
||||
<td><?php echo $enrichissement['idComptage']; ?></td>
|
||||
<td><?php echo $enrichissement['reference']; ?></td>
|
||||
<td><?php echo $enrichissement['nbLigneTotales']; ?></td>
|
||||
<td><?php echo $enrichissement['nbLigneTraites']; ?></td>
|
||||
<td><?php echo $enrichissement['uniteInsee']; ?></td>
|
||||
<td><?php echo $enrichissement['dateAdded']; ?></td>
|
||||
<td><?php echo $enrichissement['dateStart']; ?></td>
|
||||
<td><?php echo $enrichissement['dateStop']; ?></td>
|
||||
<td><a href="/enrichissement/download/id/<?php echo $enrichissement['id'];?>"><?php echo $enrichissement['fichier']; ?></a></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,12 @@
|
||||
<div id="dashboard">
|
||||
|
||||
<h2>Gestion des profils</h2>
|
||||
<a href="<?=$this->url(array('controller'=>'gestion', 'action'=>'profils'))?>">Lister les profils</a><br/>
|
||||
<a href="<?=$this->url(array('controller'=>'gestion', 'action'=>'profiladd'))?>">Créer un profil d'enrichissement pour un client (idClient, login)</a>
|
||||
|
||||
<h2>Gestion des commandes</h2>
|
||||
<a href="<?php echo $this->url(array('controller' => 'gestion', 'action' => 'comptages'));?>">Liste des comptages</a><br />
|
||||
<a href="<?php echo $this->url(array('controller' => 'gestion', 'action' => 'enrichissements'));?>">Liste des enrichissements</a>
|
||||
<h2>Facturation</h2>
|
||||
|
||||
</div>
|
@ -0,0 +1 @@
|
||||
<?php
|
@ -0,0 +1,37 @@
|
||||
<div id="dashboard">
|
||||
|
||||
<?=$this->message?>
|
||||
|
||||
<form name="profil" method="post" action="<?=$this->url(array('controller'=>'gestion', 'action'=>'profiladd'))?>">
|
||||
<label>idClient</label>
|
||||
<input type="text" name="idClient" />
|
||||
<br/>
|
||||
<label>login</label>
|
||||
<input type="text" name="login" />
|
||||
<br/>
|
||||
<label>Reference</label>
|
||||
<input type="text" name="reference" />
|
||||
<br/>
|
||||
|
||||
<label>tarifLigne</label>
|
||||
<input type="text" name="tarifLigne" /> €
|
||||
<br/>
|
||||
|
||||
<div>
|
||||
<label>Selection des données pour l'enrichissement</label>
|
||||
<select style="padding:5px;" name="criteres[]" multiple size="20">
|
||||
<?php if ( count($this->fields)>0 ) {?>
|
||||
<?php foreach ( $this->fields as $value => $item ) {?>
|
||||
<option value="<?=$value?>"><?=$item['label']?></option>
|
||||
<?php }?>
|
||||
<?php }?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<input type="submit" name="submit" value="Enregistrer"/>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
@ -0,0 +1 @@
|
||||
<?php
|
@ -0,0 +1,33 @@
|
||||
<div id="dashboard">
|
||||
|
||||
<h2>Liste des profils</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>idClient</th>
|
||||
<th>login</th>
|
||||
<th>reference</th>
|
||||
<th>tarifLigne</th>
|
||||
<th>dateAjout</th>
|
||||
<th>dateSuppr</th>
|
||||
<th>actif</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ( $this->profils as $profil ) {?>
|
||||
<tr>
|
||||
<td><?=$profil['idClient']?></td>
|
||||
<td><?=$profil['login']?></td>
|
||||
<td><?=$profil['reference']?></td>
|
||||
<td><?=$profil['tarifLigne']?></td>
|
||||
<td><?=$profil['dateAjout']?></td>
|
||||
<td><?=$profil['dateSuppr']?></td>
|
||||
<td><?=$profil['actif']?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<?php }?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
@ -0,0 +1 @@
|
||||
<?php
|
@ -0,0 +1,70 @@
|
||||
<style>
|
||||
.color {
|
||||
background-color:#DEDEDE;
|
||||
}
|
||||
a
|
||||
{
|
||||
text-decoration: none;
|
||||
}
|
||||
#criteres_ra
|
||||
{
|
||||
width:93%;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
#criteres_ra tr td {
|
||||
border-left: 1px solid black;
|
||||
border-right: 1px solid black;
|
||||
padding-left:5px;
|
||||
}
|
||||
</style>
|
||||
<table id="criteres_ra" style="margin:10px">
|
||||
<tr>
|
||||
<td class="Valide" style="text-align: center" colspan="3">
|
||||
<a class="previsualisation" href="/comptage/previsualisation">Prévisualisation</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php $color = 0;foreach($this->criteres as $critere => $valeur):?>
|
||||
<?php $label = $this->field->get($critere); ?>
|
||||
<?php if($valeur != 'tous' and $valeur != null and $valeur != 'null' and $valeur != ',' and !empty($valeur)):?>
|
||||
<?php if(!is_array($valeur)) {$valeur = explode(',', $valeur);} ?>
|
||||
<tr <?php echo ((($color%2) == 0)?'class="color"':''); $color++;?>>
|
||||
<td valign="top" style="padding:5px;width:150px">
|
||||
<?php echo $label['label'];?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if(is_array($valeur)):?>
|
||||
<?php $i=0; foreach ($valeur as $val):?>
|
||||
<?php if($i>5)break; ?>
|
||||
<?php if($label['type'] != 'textarea' and $label['type'] != 'interval' and $label['type'] != 'intervalSelect') :?>
|
||||
<?php echo $label['fields'][$label['type']]['value'][$val];?> <?php (($i%3 == 0)?'<br />':''); $i++;?>
|
||||
<?php else :?>
|
||||
<?php
|
||||
if($label['type'] == 'interval') {
|
||||
if(empty($val)) {
|
||||
echo '-';
|
||||
} else
|
||||
echo $val;
|
||||
} else
|
||||
echo $val.', ';
|
||||
?>
|
||||
<?php $i++; endif;?>
|
||||
<?php endforeach;?>
|
||||
<?php else: ?>
|
||||
<?php echo $val;?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td style="text-align: center">
|
||||
<a class="remove" href="index/remove/critere/<?php echo $critere;?>">
|
||||
<img width="14px;" src="/themes/default/images/cross.png" />
|
||||
</a>
|
||||
<img src="/themes/default/images/help.png" />
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<?php endforeach;?>
|
||||
<tr>
|
||||
<td class="Valide" style="text-align: center" colspan="3">
|
||||
<a class="saveciblage" href="/comptage/savedialog">Valider mon comptage</a></td>
|
||||
</tr>
|
||||
</table>
|
28
application/modules/frontend/views/scripts/index/index.phtml
Normal file
28
application/modules/frontend/views/scripts/index/index.phtml
Normal file
@ -0,0 +1,28 @@
|
||||
<div id="panel">
|
||||
<?php echo $this->action('criteres', 'index');?>
|
||||
<div id="helper"></div>
|
||||
</div>
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
<li class="overHelp" div="_entreprise"><a href="#tabs-1">Critères Entreprise</a></li>
|
||||
<li class="overHelp" div="_economique"><a href="#tabs-2">Situation économique</a></li>
|
||||
<li class="overHelp" div="_geographique"><a href="#tabs-3">Secteur géographique</a></li>
|
||||
<li class="overHelp" div="_juridique"><a href="#tabs-4">Situation juridique</a></li>
|
||||
<li class="overHelp" div="_financiere"><a href="#tabs-5">Situation financière</a></li>
|
||||
</ul>
|
||||
<div id="tabs-1">
|
||||
<?php echo $this->action('index', 'entreprise')?>
|
||||
</div>
|
||||
<div id="tabs-2">
|
||||
<?php echo $this->action('index', 'economique')?>
|
||||
</div>
|
||||
<div id="tabs-3">
|
||||
<?php echo $this->action('index', 'geographique')?>
|
||||
</div>
|
||||
<div id="tabs-4">
|
||||
<?php echo $this->action('index', 'juridique')?>
|
||||
</div>
|
||||
<div id="tabs-5">
|
||||
<?php echo $this->action('index', 'financier')?>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,40 @@
|
||||
<div id="juridique">
|
||||
<span style="color:red;text-align:right;padding:5px;margin-top:-5px;">
|
||||
*<sup>Il n'est pas nécessaire de remplire tous les champs.</sup>
|
||||
</span>
|
||||
<hr />
|
||||
<div id="s_juridique">
|
||||
<ul id="fieldsblock">
|
||||
<li><?php echo $this->Field('cj', $this->fields->get('cj'));?></li>
|
||||
<li class="cj" style="display:none;background-image:none;height:100px;">
|
||||
<div id="cj_text_ex" class="exclusion" style="display:none">
|
||||
<?php echo $this->Field('cj_ex', $this->fields->get('cj_ex'), 'text');?>
|
||||
</div>
|
||||
<div id="cj_text_in" class="inclusion">
|
||||
<?php echo $this->Field('cj', $this->fields->get('cj'), 'text');?>
|
||||
</div>
|
||||
Valeurs exclusions : <input value="1" type="checkbox" class="checkbox_ex" name="cj_text" />
|
||||
</li>
|
||||
<li><?php echo $this->Field('actifEco', $this->fields->get('actifEco'));?></li>
|
||||
<li><?php echo $this->Field('procolHisto', $this->fields->get('procolHisto'));?></li>
|
||||
<li><?php echo $this->Field('dateImmat', $this->fields->get('dateImmat'));?></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="a_juridique" style="display:none">
|
||||
<fieldset style="border:1px solid silver;padding:2px;">
|
||||
<legend>Critères Avancés</legend>
|
||||
<ul id="fieldsblock">
|
||||
<li><?php echo $this->Field('tvaIntraValide', $this->fields->get('tvaIntraValide'));?></li>
|
||||
</ul>
|
||||
</fieldset>
|
||||
</div>
|
||||
<hr style="margin-top:5px;" />
|
||||
<p>
|
||||
<a class="mode" id="a_juridique" style="cursor:pointer;margin-left:50%">
|
||||
<img src="/themes/default/images/fleche-bas.gif" />
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
<div style="text-align:right;margin-top:20px;">
|
||||
<a class="resetFamille" id="econmique">Réinitialiser les critères juridique</a>
|
||||
</div>
|
@ -0,0 +1,4 @@
|
||||
<br /><br />
|
||||
<div id="view-content">
|
||||
<p>View script for controller <b>Login</b> and script/action name <b>index</b></p>
|
||||
</div>
|
@ -0,0 +1,4 @@
|
||||
<br /><br />
|
||||
<div id="view-content">
|
||||
<p>View script for controller <b>User</b> and script/action name <b>index</b></p>
|
||||
</div>
|
13
application/modules/frontend/views/scripts/user/login.phtml
Normal file
13
application/modules/frontend/views/scripts/user/login.phtml
Normal file
@ -0,0 +1,13 @@
|
||||
<?=$this->doctype();?>
|
||||
<html>
|
||||
<head>
|
||||
<?=$this->headMeta();?>
|
||||
<?=$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/modules/frontend/views/scripts/user/logout.phtml
Normal file
16
application/modules/frontend/views/scripts/user/logout.phtml
Normal file
@ -0,0 +1,16 @@
|
||||
<?=$this->doctype();?>
|
||||
<html>
|
||||
<head>
|
||||
<?=$this->headMeta();?>
|
||||
<?=$this->headTitle();?>
|
||||
</head>
|
||||
<body>
|
||||
<h4 class="logout">Vous avez été déconnecté.</h4>
|
||||
<p><?=$this->message?></p>
|
||||
<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>
|
70
batch/cron.php
Normal file
70
batch/cron.php
Normal file
@ -0,0 +1,70 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
// Define path to application directory
|
||||
defined('APPLICATION_PATH')
|
||||
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
|
||||
|
||||
// Define application environment
|
||||
define('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|?' => "Aide.",
|
||||
)
|
||||
);
|
||||
$opts->parse();
|
||||
} catch (Zend_Console_Getopt_Exception $e) {
|
||||
echo $e->getUsageMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
//Usage
|
||||
if(isset($opts->help))
|
||||
{
|
||||
echo $opts->getUsageMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
$dbConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'databases');
|
||||
$db = Zend_Db::factory($dbConfig->db);
|
||||
|
||||
$commandesM = new Table_EnrichissementCommandes($db);
|
||||
|
||||
$sql = $commandesM->select()
|
||||
->where('idProfil != ?', 0)
|
||||
->where("dateStart != '0000-00-00 00:00:00'")
|
||||
->where("dateStop = '0000-00-00 00:00:00'");
|
||||
$result = $commandesM->fetchAll($sql);
|
||||
if (count($result)>0){
|
||||
exit;
|
||||
}
|
||||
|
||||
//Si pas de traitement en cours alors on lance
|
||||
$sql = $commandesM->select()
|
||||
->where('idProfil != ?', 0)
|
||||
->where("dateStart = '0000-00-00 00:00:00'")
|
||||
->where("dateStop = '0000-00-00 00:00:00'")
|
||||
->order('dateAdded ASC')->limit(1);
|
||||
$result = $commandesM->fetchAll($sql);
|
||||
if (count($result)>0) {
|
||||
$info = $result->current();
|
||||
echo "Lancement enrichissement $info->id\n";
|
||||
exec(realpath(dirname(__FILE__))."/enrichissement.php --id ".$info->id." &");
|
||||
}
|
248
batch/enrichissement.php
Normal file
248
batch/enrichissement.php
Normal file
@ -0,0 +1,248 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);
|
||||
|
||||
// Define path to application directory
|
||||
defined('APPLICATION_PATH')
|
||||
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
|
||||
|
||||
// Define application environment
|
||||
define('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|?' => "Aide.",
|
||||
'id=s' => "Identifiant du traitement",
|
||||
'file=s' => "Identifiant pour les traitements par fichier"
|
||||
)
|
||||
);
|
||||
$opts->parse();
|
||||
} catch (Zend_Console_Getopt_Exception $e) {
|
||||
echo $e->getUsageMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
//Usage
|
||||
if(isset($opts->help) || !isset($opts->id) && !isset($opts->file) )
|
||||
{
|
||||
echo $opts->getUsageMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
//Définition bdd
|
||||
$dbConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'databases');
|
||||
try {
|
||||
$db = Zend_Db::factory($dbConfig->db);
|
||||
} catch ( Exception $e ) {
|
||||
exit ( $e->getMessage() );
|
||||
}
|
||||
//Définition bdd metier
|
||||
try {
|
||||
$dbMetier = Zend_Db::factory($dbConfig->jo);
|
||||
} catch ( Exception $e ) {
|
||||
exit ( $e->getMessage() );
|
||||
}
|
||||
|
||||
$liste = array();
|
||||
|
||||
if ($opts->id)
|
||||
{
|
||||
$sql = $db->select()
|
||||
->from('enrichissement_identifiants')
|
||||
->where('id = ?', intval($opts->id));
|
||||
$commande = $db->fetchRow($sql);
|
||||
$identifiants = json_decode($commande['identifiants'], true);
|
||||
|
||||
$sql = $db->select()
|
||||
->from('enrichissement_profils')
|
||||
->where('id = ?', $commande['idProfil']);
|
||||
$profil = $db->fetchRow($sql);
|
||||
$dataProfil = json_decode($profil['criteres'], true);
|
||||
} else if ($opts->file)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if ( count($identifiants)>0 && count($dataProfil)>0 )
|
||||
{
|
||||
$config = new Zend_Config_Ini(APPLICATION_PATH.'/configs/configuration.ini');
|
||||
$mois = date('Y-m');
|
||||
if(!file_exists($config->path->data.'/'.$mois))
|
||||
mkdir($config->path->data.'/'.$mois);
|
||||
$path = $config->path->data.'/'.$mois;
|
||||
$outFile = $opts->id.'_'.$profil['login'].'_'.date('YmdHis').'.csv';
|
||||
require_once 'Scores/Enrichissement.php';
|
||||
$dico = new Enrichissement();
|
||||
$fields = $dico->getFields();
|
||||
|
||||
//Entete, Valeur de remplacement et Requete SQL
|
||||
$tabEntete = array('siren', 'nic');
|
||||
$tabEnteteLabel = array('SIREN', 'NIC');
|
||||
$sql = 'SELECT LPAD(siren, 9, 000000000) AS siren, LPAD(nic,5,00000) AS nic,';
|
||||
foreach ( $dataProfil as $item ) {
|
||||
//Définition de l'entete
|
||||
$tabEnteteLabel[] = $fields[$item]['label'];
|
||||
$tabEntete[] = $item;
|
||||
|
||||
//Construction de la requete SQL
|
||||
if ( array_key_exists('sql', $fields[$item]) ) {
|
||||
$sql.= ' '.$fields[$item]['sql'].', ';
|
||||
} else {
|
||||
$sql.= ' '.$fields[$item]['column'].' AS '.$item.',';
|
||||
}
|
||||
|
||||
}
|
||||
//Ajouter le champ presentRcs
|
||||
$tabEntete[] = 'presentRcs';
|
||||
$tabEnteteLabel[] = 'RCS';
|
||||
$sql .= ' presentRcs';
|
||||
|
||||
//Pour chaque identifiant traiter les données
|
||||
$row = 0;
|
||||
$fp = fopen($path.'/'.$outFile, 'w');
|
||||
//Ecrire l'entete
|
||||
if (count($tabEnteteLabel)>0){
|
||||
fputcsv($fp, $tabEnteteLabel, ',', '"');
|
||||
}
|
||||
$model = $sql;
|
||||
$traite = 0;
|
||||
//Date de debut de traitement.
|
||||
$dateStart = date('YmdHms');
|
||||
foreach ($identifiants as $siret )
|
||||
{
|
||||
$sql = $model.' FROM etablissements_act WHERE siren='.substr($siret,0,9).' AND nic='.substr($siret,9,5);
|
||||
try {
|
||||
$result = $dbMetier->fetchAll($sql);
|
||||
$traite++;
|
||||
} catch(Exception $e) {
|
||||
echo $sql;
|
||||
}
|
||||
$tabData = $result[0];
|
||||
//Trier pour la sortie
|
||||
$tabSortie = array();
|
||||
foreach($tabEntete as $key){
|
||||
$tabSortie[] = isset($tabData[$key]) ? $tabData[$key] : '';
|
||||
}
|
||||
fputcsv($fp, $tabSortie, ',', '"');
|
||||
|
||||
$row++;
|
||||
}
|
||||
//Gestion de l'erreur
|
||||
$error = 0;
|
||||
if($traite < $commande['nbLigneTotales'])
|
||||
$error = 1;
|
||||
//date de fin de traitement.
|
||||
$dateStop = date('YmdHms');
|
||||
//Update de la ligne dans la base de donnée.
|
||||
$datas = array(
|
||||
'nbLigneTraites' => $traite,
|
||||
'dateStart' => $dateStart,
|
||||
'dateStop' => $dateStop,
|
||||
'error' => $error,
|
||||
'fichier' => $outFile
|
||||
);
|
||||
$db->update('enrichissement_identifiants', $datas, 'id = '.$opts->id);
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
|
||||
/* == FUNCTION == */
|
||||
|
||||
/**
|
||||
* Verifie si un SIREN est valide
|
||||
* @param Le code SIREN dont on veut vérifier la validité.
|
||||
* @return Un booléen qui vaut 'true' si le code SIREN passé en
|
||||
* paramètre est valide, false sinon.
|
||||
*/
|
||||
function sirenValide($siren) {
|
||||
if ( (strlen($siren) != 9) || (is_nan($siren)) )
|
||||
$estValide = false;
|
||||
else {
|
||||
// Donc le SIREN est un numérique à 9 chiffres
|
||||
$somme = 0;
|
||||
$tmp = 0;
|
||||
for ($cpt = 0; $cpt<strlen($siren); $cpt++) {
|
||||
if (($cpt % 2) == 1) { // Les positions paires : 2ème, 4ème, 6ème et 8ème chiffre
|
||||
$tmp = substr($siren, $cpt, 1) * 2; // On le multiplie par 2
|
||||
if ($tmp > 9)
|
||||
$tmp-= 9; // Si le résultat est supérieur à 9, on lui soustrait 9
|
||||
}
|
||||
else
|
||||
$tmp = substr($siren, $cpt, 1);
|
||||
$somme+= intval($tmp);
|
||||
}
|
||||
if (($somme % 10) == 0)
|
||||
$estValide = true; // Si la somme est un multiple de 10 alors le SIREN est valide
|
||||
else
|
||||
$estValide = false;
|
||||
}
|
||||
return $estValide;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifie si un SIRET est valide
|
||||
* @param Le code SIRET dont on veut vérifier la validité.
|
||||
* @return Un booléen qui vaut 'true' si le code SIRET passé en
|
||||
* paramètre est valide, false sinon.
|
||||
*/
|
||||
function siretValide($siret) {
|
||||
if ( (strlen($siret) != 14) || (is_nan($siret)) )
|
||||
$estValide = false;
|
||||
else {
|
||||
// Donc le SIRET est un numérique à 14 chiffres
|
||||
// Les 9 premiers chiffres sont ceux du SIREN (ou RCS), les 4 suivants
|
||||
// correspondent au numéro d'établissement
|
||||
// et enfin le dernier chiffre est une clef de LUHN.
|
||||
$somme = 0;
|
||||
$tmp = 0;
|
||||
for ($cpt = 0; $cpt<strlen($siret); $cpt++) {
|
||||
if (($cpt % 2) == 0) { // Les positions impaires : 1er, 3è, 5è, etc...
|
||||
$tmp = substr($siret, $cpt, 1) * 2; // On le multiplie par 2
|
||||
if ($tmp > 9)
|
||||
$tmp-= 9; // Si le résultat est supérieur à 9, on lui soustrait 9
|
||||
}
|
||||
else
|
||||
$tmp = substr($siret, $cpt, 1);
|
||||
$somme+= intval($tmp);
|
||||
}
|
||||
if (($somme % 10) == 0)
|
||||
$estValide = true; // Si la somme est un multiple de 10 alors le SIRET est valide
|
||||
else
|
||||
$estValide = false;
|
||||
}
|
||||
return $estValide;
|
||||
}
|
||||
|
||||
/**
|
||||
* writeCSV
|
||||
* @param array $list
|
||||
* @param array $entete
|
||||
* @param string $filename
|
||||
*/
|
||||
function writeCSV($list, $entete, $filename)
|
||||
{
|
||||
$fp = fopen($filename, 'w');
|
||||
if (count($entete)>0){
|
||||
fputcsv($fp, $entete, ',', '"');
|
||||
}
|
||||
foreach ($list as $fields) {
|
||||
fputcsv($fp, $fields, ',', '"');
|
||||
}
|
||||
fclose($fp);
|
||||
}
|
230
batch/extract.php
Normal file
230
batch/extract.php
Normal file
@ -0,0 +1,230 @@
|
||||
<?php
|
||||
// Define path to application directory
|
||||
defined('APPLICATION_PATH')
|
||||
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
|
||||
|
||||
// Define application environment
|
||||
define('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'
|
||||
);
|
||||
require_once APPLICATION_PATH . '/../library/Zend/Loader/Autoloader.php';
|
||||
|
||||
Class extract
|
||||
{
|
||||
protected $db;
|
||||
protected $dbMetier;
|
||||
protected $reference;
|
||||
|
||||
public function __construct($reference)
|
||||
{
|
||||
$this->reference = $reference;
|
||||
$dbConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'databases');
|
||||
try {
|
||||
$this->db = Zend_Db::factory($dbConfig->db);
|
||||
} catch ( Exception $e ) {
|
||||
exit ( $e->getMessage() );
|
||||
}
|
||||
}
|
||||
|
||||
public function getHttp()
|
||||
{
|
||||
/* Depuis le navigateur */
|
||||
}
|
||||
|
||||
protected function getCj($liste)
|
||||
{
|
||||
foreach($liste as $valeur)
|
||||
{
|
||||
if(strlen($valeur) < 5) {
|
||||
$sql = $this->db->select('formejuridique', array('fjCode'))
|
||||
->from('formejuridique')
|
||||
->where('fjCode LIKE "'.$valeur.'%"');
|
||||
} else {
|
||||
$sql = $this->db->select('formejuridique', array('fjCode'))
|
||||
->from('formejuridique')
|
||||
->where('fjCode = "'.$valeur.'"');
|
||||
}
|
||||
$result = $this->db->fetchAll($sql);
|
||||
foreach ($result as $code) {
|
||||
if(strlen($code['fjCode']) > 2) {
|
||||
$return[] = $code['fjCode'];
|
||||
}
|
||||
}
|
||||
}
|
||||
return ($return);
|
||||
}
|
||||
|
||||
protected function localisationArbo($name, $valeur)
|
||||
{
|
||||
if(strlen($valeur) == 2) {
|
||||
switch($name) {
|
||||
case 'adr_reg':
|
||||
$return = array();
|
||||
$sql = $this->db->select()
|
||||
->from('departements')
|
||||
->join(array('cp' => 'codepostaux'), 'cp.codepos LIKE CONCAT(departements.numdep, "%")', array('INSEE'))
|
||||
->where('codeRegionInsee ='.$valeur);
|
||||
$result = $this->db->fetchAll($sql);
|
||||
foreach ($result as $res) {
|
||||
$return[] = trim($res['INSEE']);
|
||||
}
|
||||
break;
|
||||
case 'adr_dept':
|
||||
$return = array();
|
||||
$sql = $this->db->select()
|
||||
->from('departements')
|
||||
->join(array('cp' => 'codepostaux'), 'cp.codepos LIKE CONCAT(departements.numdep, "%")', array('INSEE'))
|
||||
->where('numdep ='.$valeur);
|
||||
$result = $this->db->fetchAll($sql);
|
||||
foreach ($result as $res) {
|
||||
$return[] = trim($res['INSEE']);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ($return);
|
||||
}
|
||||
|
||||
public function getMinMax($name, $valeur)
|
||||
{
|
||||
$valeur = explode(',', $valeur);
|
||||
if(count($valeur) > 1)
|
||||
{
|
||||
$sql = 'SELECT min, max FROM minmax WHERE cle ="'.$name.'"';
|
||||
$result = $this->db->query($sql);
|
||||
$result = $result->fetchAll();
|
||||
if(empty($valeur[0])){
|
||||
echo $name;
|
||||
$valeur[0] = $result[0]['min'];
|
||||
}
|
||||
if(empty($valeur[1])){
|
||||
$valeur[1] = $result[0]['max'];
|
||||
}
|
||||
}
|
||||
return ($valeur);
|
||||
}
|
||||
|
||||
protected function nafArbo($key, $valeur)
|
||||
{
|
||||
$value = array();
|
||||
//$table = new Table_Nafs();
|
||||
$valeur = trim($valeur);
|
||||
|
||||
if(strlen($valeur) == 1)
|
||||
{
|
||||
//$sql = $table->select()->where('parent = ?', $valeur);
|
||||
$sql = 'SELECT * FROM naf WHERE parent ='.$valeur;
|
||||
$result =$this->db->query($sql);
|
||||
$result = $result->fetchAll();
|
||||
foreach($result as $code) $where .= " code LIKE '".trim($code['code'])."%' and niveau = 5 or ";
|
||||
$where = substr($where, 0, (strlen($where)) - 3);
|
||||
$sql = 'SELECT * FROM naf '.$where;
|
||||
$result = $this->db->query($sql);
|
||||
$result = $result->fetchAll();
|
||||
foreach($result as $code) $value[] = $code['code'];
|
||||
} else if(strlen($valeur) < 5){
|
||||
//$sql = $table->select()->where('code LIKE "'.trim($valeur).'%" and niveau = 5');
|
||||
$sql = 'SELECT * FROM naf WHERE code LIKE "'.trim($valeur).'%" and niveau = 5';
|
||||
$result = $this->db->query($sql);
|
||||
$result = $result->fetchAll();
|
||||
foreach($result as $code) $value[] = $code['code'];
|
||||
} else if(strlen($valeur) == 5) {
|
||||
$value[] = $valeur;
|
||||
}
|
||||
return ($value);
|
||||
}
|
||||
|
||||
public function getCli()
|
||||
{
|
||||
require_once('Scores/Ciblage.php');
|
||||
//require_once('Scores/Field.php');
|
||||
|
||||
$sql = 'SELECT id, idDefinition, uniteInsee FROM comptages WHERE id = '.$this->reference;
|
||||
$fetch = $this->db->query($sql);
|
||||
$result = $fetch->fetchAll();
|
||||
$idComptage = $result[0]['id'];
|
||||
$uniteInsee = $result[0]['uniteInsee'];
|
||||
|
||||
$sql = 'SELECT id, criteres.criteres FROM criteres WHERE id ='.$result[0]['idDefinition'];
|
||||
$fetch = $this->db->query($sql);
|
||||
$result = $fetch->fetchAll();
|
||||
$idCriteres = $result[0]['id'];
|
||||
|
||||
$structure = json_decode($result[0]['criteres']);
|
||||
$element = array();
|
||||
foreach ($structure as $name => $valeur){
|
||||
if($name == 'adr_com') {
|
||||
$liste = explode(',', $valeur);
|
||||
$codes = array();
|
||||
foreach ($liste as $element) {
|
||||
$val = explode(':', $element);
|
||||
if(!empty($val[1]))
|
||||
$codes = array_merge($this->localisationArbo($val[0], $val[1]), $codes);
|
||||
}
|
||||
$array['adr_com'] = $codes;
|
||||
}
|
||||
else if($name == 'cj') {
|
||||
$array['cj'] = $this->getCj(explode(',', $valeur));
|
||||
}
|
||||
else if($name == 'ape_etab') {
|
||||
$values = array();
|
||||
$nafs = explode(',', $structure->ape_etab);
|
||||
foreach($nafs as $naf) {
|
||||
if($naf != ' ') {
|
||||
$values = array_merge($values, $this->nafArbo('ape_etab', $naf));
|
||||
}
|
||||
}
|
||||
$array['ape_etab'] = $values;
|
||||
}else {
|
||||
$valeur = $this->getMinMax($name, $valeur);
|
||||
$array[$name] = $valeur;
|
||||
}
|
||||
}
|
||||
unset($array['vil']);
|
||||
unset($array['adr_com']);
|
||||
unset($array['adr_dept']);
|
||||
$array['bilTca'] = array(4, 5, 6);
|
||||
$ciblage = new Ciblage($array, true);
|
||||
$res = $ciblage->execute(true);
|
||||
|
||||
$data = array(
|
||||
'idComptage' => $idComptage,
|
||||
'idCriteres' => $idCriteres,
|
||||
'idProfil' => 1,
|
||||
'reference' => 'batch',
|
||||
'identifiants' => json_encode($res),
|
||||
'nbLigneTotales' => count($res),
|
||||
'nbLigneTraites' => count($res),
|
||||
'uniteInsee' => $uniteInsee,
|
||||
'error' => 0
|
||||
);
|
||||
$this->db->insert('enrichissement_identifiants',$data);
|
||||
$fd = fopen($idComptage.'_batch'.date('Y-m-d-hms').'.csv', 'x+');
|
||||
try {
|
||||
$array = array();
|
||||
foreach($res as $field) {
|
||||
fputcsv($fd, array($field), ';');
|
||||
}
|
||||
} catch(Exception $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
fclose($fd);
|
||||
echo count($res).' Success !';
|
||||
}
|
||||
}
|
||||
|
||||
$a = new extract('38');
|
||||
$a->getCli();
|
88
batch/setMinMax.php
Normal file
88
batch/setMinMax.php
Normal file
@ -0,0 +1,88 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
// Define path to application directory
|
||||
defined('APPLICATION_PATH')
|
||||
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
|
||||
|
||||
// Define application environment
|
||||
define('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|?' => "Aide.",
|
||||
'cron' => "Mode automatique",
|
||||
'manuel' => "Mode manuel",
|
||||
)
|
||||
);
|
||||
$opts->parse();
|
||||
} catch (Zend_Console_Getopt_Exception $e) {
|
||||
echo $e->getUsageMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
//Usage
|
||||
if(isset($opts->help))
|
||||
{
|
||||
echo $opts->getUsageMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
$dbConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'databases');
|
||||
try {
|
||||
$db = Zend_Db::factory($dbConfig->db);
|
||||
} catch ( Exception $e ) {
|
||||
exit ( $e->getMessage() );
|
||||
}
|
||||
//Définition bdd metier
|
||||
try {
|
||||
$dbMetier = Zend_Db::factory($dbConfig->jo);
|
||||
} catch ( Exception $e ) {
|
||||
exit ( $e->getMessage() );
|
||||
}
|
||||
|
||||
$keys = array(
|
||||
'nbActio','nbPart', 'teff_entrep', 'teff_etab', 'nbEtab',
|
||||
'eff_entrep', 'eff_etab', 'capital', 'bilEE', 'bilFL', 'bilFK', 'bilFR', 'bilGF',
|
||||
'bilGP', 'bilGW', 'bilHD', 'bilHH', 'bilHL', 'bilHM', 'bilHN', 'bilYP', 'dateCrea_etab', 'dateCrea_ent',
|
||||
'dateImmat'
|
||||
);
|
||||
|
||||
$sql = 'TRUNCATE TABLE minmax';
|
||||
if ( !$db->query($sql) ) {
|
||||
die ('Impossible de vider la table minmax');
|
||||
}
|
||||
|
||||
foreach($keys as $key) {
|
||||
|
||||
//Lecture
|
||||
$sql = 'SELECT MIN('.$key.') AS min, MAX('.$key.') AS max FROM etablissements_act';
|
||||
$stmt = $dbMetier->query($sql);
|
||||
$result = $stmt->fetchObject();
|
||||
|
||||
//Insertion
|
||||
$data = array(
|
||||
'cle' => $key,
|
||||
'min' => $result->min,
|
||||
'max' => $result->max,
|
||||
);
|
||||
$db->insert('minmax', $data);
|
||||
if ($opts->manuel) echo $key.' -> min:'.$result->min.' max:'.$result->max."\n";
|
||||
}
|
||||
if ($opts->manuel) print('Terminé');
|
16
config/_sql/EnrichissementFichiers.sql
Normal file
16
config/_sql/EnrichissementFichiers.sql
Normal file
@ -0,0 +1,16 @@
|
||||
CREATE TABLE IF NOT EXISTS `enrichissement_fichiers` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`idProfil` int(11) NOT NULL,
|
||||
`reference` varchar(50) NOT NULL,
|
||||
`identifiants` longtext NOT NULL,
|
||||
`nbLigneTotales` int(11) NOT NULL,
|
||||
`nbLigneTraites` int(11) NOT NULL,
|
||||
`uniteInsee` int(11) NOT NULL DEFAULT '0',
|
||||
`error` varchar(100) NOT NULL,
|
||||
`dateAdded` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`dateStart` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`dateStop` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`fichierIn` varchar(100) NOT NULL,
|
||||
`fichierOut` varchar(100) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARSET=utf8;
|
17
config/_sql/EnrichissementIdentifiants.sql
Normal file
17
config/_sql/EnrichissementIdentifiants.sql
Normal file
@ -0,0 +1,17 @@
|
||||
CREATE TABLE IF NOT EXISTS `enrichissement_identifiants` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`idComptage` int(11) NOT NULL,
|
||||
`idCriteres` int(11) NOT NULL DEFAULT '0',
|
||||
`idProfil` int(11) NOT NULL,
|
||||
`reference` varchar(50) NOT NULL,
|
||||
`identifiants` longtext NOT NULL,
|
||||
`nbLigneTotales` int(11) NOT NULL,
|
||||
`nbLigneTraites` int(11) NOT NULL,
|
||||
`uniteInsee` int(11) NOT NULL DEFAULT '0',
|
||||
`error` varchar(100) NOT NULL,
|
||||
`dateAdded` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`dateStart` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`dateStop` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
`fichier` varchar(100) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARSET=utf8;
|
14
config/_sql/EnrichissementProfils.sql
Normal file
14
config/_sql/EnrichissementProfils.sql
Normal file
@ -0,0 +1,14 @@
|
||||
CREATE TABLE IF NOT EXISTS `enrichissement_profils` (
|
||||
`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,
|
||||
`dataInsee` tinyint(4) NOT NULL,
|
||||
`dateAjout` 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';
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user