Compare commits
487 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
35df1838e8 | ||
|
1771bd0554 | ||
|
ffdaecb9ac | ||
|
d809739961 | ||
|
ca6488677b | ||
|
7046c7a453 | ||
|
9284a04ec1 | ||
|
954dca6944 | ||
|
5d26f823fd | ||
|
aa0db85f31 | ||
|
ad1a877ef4 | ||
|
f66ea54a81 | ||
|
f804e4710a | ||
|
117dec028d | ||
|
f0bd4fc3dc | ||
|
3583fdd333 | ||
|
e5fcc48b05 | ||
|
e2608152a2 | ||
|
206c19e3e2 | ||
|
b53665953f | ||
|
7c574d164e | ||
|
b4ddca623b | ||
|
ffd7eb8c80 | ||
|
b9cad4af3f | ||
|
136f9623be | ||
|
67eb3dd084 | ||
|
a929f17e50 | ||
|
f22c5b06af | ||
|
06569d15f0 | ||
|
a1dd0324bf | ||
|
56babddc4b | ||
|
749fdffcc7 | ||
|
f710381f5d | ||
|
f74ecd6ad1 | ||
|
c6c53f90b5 | ||
|
070894f087 | ||
|
e59403cf84 | ||
|
a1ba1ac947 | ||
|
c2bd5bd412 | ||
|
bf0d109eaa | ||
|
e03047ee7d | ||
|
c0149839e0 | ||
|
e17b72819b | ||
|
029566c346 | ||
|
b12e852e68 | ||
|
923671261b | ||
|
88478b95f9 | ||
|
dc8246438f | ||
|
71011bd775 | ||
|
771dd362be | ||
|
fc74474639 | ||
|
c7535df8c5 | ||
|
ef9584e5e4 | ||
|
c4698d9a6e | ||
|
6f0d1af9f6 | ||
|
10d03aa74c | ||
|
c6725dd0af | ||
|
ae2178ec7a | ||
|
eb08f6dcdc | ||
|
2590f8d1ab | ||
|
61ea754b45 | ||
|
656e8a12b2 | ||
|
a3651c6ad7 | ||
|
1ffa5eebf1 | ||
|
e6cbf1a006 | ||
|
2d0eba0bde | ||
|
5dd639878c | ||
|
520f167aaa | ||
|
fced0a8da7 | ||
|
ef22877b66 | ||
|
1aeecef0c5 | ||
|
13b785873e | ||
|
45eba61cd9 | ||
|
967b1dd9d2 | ||
|
4d9951d9d4 | ||
|
27d8212a18 | ||
|
cdd951fd11 | ||
|
9d7c856846 | ||
|
2e6ef7b72f | ||
|
43dfab2b12 | ||
|
46a3115524 | ||
|
d567502e7d | ||
|
ef51dd969e | ||
|
e716181a4d | ||
|
e130cf3881 | ||
|
53421fba5c | ||
|
6de0dc1a0c | ||
|
1f7158d2b1 | ||
|
2254b415cf | ||
|
5e7a3e04a5 | ||
|
da3a701f47 | ||
|
da715c8465 | ||
|
81fd108a54 | ||
|
4961e1ee7f | ||
|
a523b6d772 | ||
|
1cd65fb0ab | ||
|
5ab91eb8c7 | ||
|
b1ab4180f1 | ||
|
439262b28a | ||
|
94c051b362 | ||
|
788c2210b1 | ||
|
87e1a3faac | ||
|
28baec0921 | ||
|
9a2175ed4a | ||
|
e079513039 | ||
|
934f1e621f | ||
|
0bee1619ab | ||
|
37151eb6c5 | ||
|
78c7fb02e2 | ||
|
a6f07c411e | ||
|
cb2c082d04 | ||
|
ec0110389c | ||
|
0141276b90 | ||
|
89428b43cf | ||
|
5c74b398f5 | ||
|
5f412b2315 | ||
|
42cf983eb5 | ||
|
a6f17922bd | ||
|
c343c5197a | ||
|
0f922f7d02 | ||
|
991423a077 | ||
|
389509d700 | ||
|
6e6647c4d8 | ||
|
220641782d | ||
|
53e751a9f3 | ||
|
8ad1bbf357 | ||
|
1d60e3a51a | ||
|
34624d7bbb | ||
|
7eaa286977 | ||
|
3b3df7a964 | ||
|
b09c5dfd97 | ||
|
37fe20d668 | ||
|
b557b7e757 | ||
|
d139dc886f | ||
|
ff681eaa64 | ||
|
23bcadcf02 | ||
|
fc600f3be2 | ||
|
95f1d2054d | ||
|
053d4d0b89 | ||
|
1444bd6283 | ||
|
5fb0a6c8a0 | ||
|
c0c6df3346 | ||
|
c188a96f09 | ||
|
12a1930b1c | ||
|
b939e9604e | ||
|
92d20339f7 | ||
|
8bfa2f6f2b | ||
|
81f4059371 | ||
|
cf528a531a | ||
|
5196da2329 | ||
|
be87fb8352 | ||
|
a4ac98b4e6 | ||
|
41f9ce83e3 | ||
|
66d8069d91 | ||
|
1d261f6c7f | ||
|
2c9d24dfb1 | ||
|
df5ebbdb7f | ||
|
2697e8933d | ||
|
daabfd826a | ||
|
075b6e9918 | ||
|
c69ebd101e | ||
|
fd1e1edc19 | ||
|
ec615a6e80 | ||
|
b6893999e3 | ||
|
0a046d046f | ||
|
ccd2641ab3 | ||
|
fb3ecd7321 | ||
|
639b476294 | ||
|
c9bba47a74 | ||
|
944d26d7b5 | ||
|
77174d28c0 | ||
|
69d2803b08 | ||
|
abfc928ee7 | ||
|
599380552d | ||
|
b403056e93 | ||
|
cec606ae72 | ||
|
10d5a73b4f | ||
|
c52157ea20 | ||
|
1d87d5af73 | ||
|
b80891b53d | ||
|
06c1bab20a | ||
|
4afd6106e6 | ||
|
bc400c658c | ||
|
26e2c2ee69 | ||
|
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 |
92
application/Bootstrap.php
Normal file
92
application/Bootstrap.php
Normal file
@ -0,0 +1,92 @@
|
||||
<?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('/libs/qtip/jquery.qtip.css', 'all')
|
||||
->appendStylesheet('/libs/tree/themes/default/style.css')
|
||||
->appendStylesheet('/libs/ui/themes/smoothness/jquery-ui.css', 'all')
|
||||
->appendStylesheet($pathStyle.'/main.css', 'all');
|
||||
|
||||
$view->headScript()
|
||||
->appendFile('/libs/jquery/jquery.js', 'text/javascript')
|
||||
->appendFile('/libs/jquery/jquery.bgiframe.js', 'text/javascript')
|
||||
->appendFile('/libs/jquery/jquery.cookie.js', 'text/javascript')
|
||||
->appendFile('/libs/ui/jquery-ui.js', 'text/javascript')
|
||||
->appendFile('/libs/qtip/jquery.qtip.js', 'text/javascript')
|
||||
->appendFile($pathScript.'/scripts.js', 'text/javascript');
|
||||
|
||||
$view->headTitle()->setSeparator(' - ');
|
||||
$view->headTitle('Odea');
|
||||
}
|
||||
|
||||
protected function _initLogging()
|
||||
{
|
||||
//Firebug
|
||||
$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 = Zend_Registry::get('configuration')->databases;
|
||||
try {
|
||||
$db = Zend_Db::factory($dbConfig->db);
|
||||
Zend_Db_Table::setDefaultAdapter ($db);
|
||||
} catch ( Exception $e ) {
|
||||
if (APPLICATION_ENV == 'development') {
|
||||
print_r($e);
|
||||
} else {
|
||||
echo "Le service rencontre actuellement un problème technique.";
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default adapter to use with all model
|
||||
*/
|
||||
Zend_Db_Table::setDefaultAdapter($db);
|
||||
|
||||
/**
|
||||
* Set Firebug Database profiler
|
||||
*/
|
||||
if (APPLICATION_ENV == 'development') {
|
||||
$profiler = new Zend_Db_Profiler_Firebug('All DB Queries');
|
||||
$profiler->setEnabled(true);
|
||||
$db->setProfiler($profiler);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function _initCache()
|
||||
{
|
||||
//MetadataCache pour la base de données
|
||||
$frontendOptions = array(
|
||||
'lifetime' => 14400,
|
||||
'automatic_serialization' => true
|
||||
);
|
||||
$backendOptions = array();
|
||||
$cache = Zend_Cache::factory('Core','Apc', $frontendOptions, $backendOptions);
|
||||
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
|
||||
|
||||
//Cache pour les données de la base à stocker
|
||||
}
|
||||
|
||||
}
|
33
application/configs/application.ini
Normal file
33
application/configs/application.ini
Normal file
@ -0,0 +1,33 @@
|
||||
[production]
|
||||
;phpSettings.session.gc_maxlifetime = 86400
|
||||
;phpSettings.session.cookie_lifetime = 86400
|
||||
phpSettings.date.timezone = "Europe/Paris"
|
||||
phpSettings.display_startup_errors = 0
|
||||
phpSettings.display_errors = 0
|
||||
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
|
||||
bootstrap.class = "Bootstrap"
|
||||
appnamespace = "Application"
|
||||
resources.session.save_path = APPLICATION_PATH "/../cache/sessions"
|
||||
resources.session.gc_maxlifetime = 86400
|
||||
resources.session.cookie_lifetime = 86400
|
||||
resources.session.remember_me_seconds = 86400
|
||||
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
|
||||
resources.frontController.plugins.Auth = "Application_Controller_Plugin_Auth"
|
||||
resources.frontController.plugins.Comptage = "Application_Controller_Plugin_Comptage"
|
||||
resources.frontController.params.displayExceptions = 0
|
||||
resources.layout.layout = "main"
|
||||
resources.layout.layoutPath = APPLICATION_PATH "/views/default"
|
||||
resources.view.basePath = APPLICATION_PATH "/views/default"
|
||||
autoloaderNamespaces[] = "Application_"
|
||||
autoloaderNamespaces[] = "Scores_"
|
||||
autoloaderNamespaces[] = "Form_"
|
||||
|
||||
[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
|
20
application/controllers/AideController.php
Normal file
20
application/controllers/AideController.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
class AideController extends Zend_Controller_Action
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
$this->view->headLink()->appendStylesheet('/themes/default/styles/aide.css');
|
||||
}
|
||||
|
||||
|
||||
public function indexAction(){}
|
||||
|
||||
public function aproposdeAction(){}
|
||||
|
||||
public function messageAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$this->view->assign('typeMsg', $request->getParam('typeMsg'));
|
||||
}
|
||||
|
||||
}
|
424
application/controllers/ArborescenceController.php
Normal file
424
application/controllers/ArborescenceController.php
Normal file
@ -0,0 +1,424 @@
|
||||
<?php
|
||||
class ArborescenceController extends Zend_Controller_Action
|
||||
{
|
||||
/* Nafs */
|
||||
public function nafAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$request = $this->getRequest();
|
||||
$key = $request->getParam('key');
|
||||
$niveau = $request->getParam('niveau', 1);
|
||||
|
||||
$fields = new Scores_Fields();
|
||||
$val = $fields->getCritere($key);
|
||||
$valuesChecked = array();
|
||||
$valuesUndetermined = array();
|
||||
|
||||
if ($val != null){
|
||||
$valuesChecked = $val['in'];
|
||||
if (count($valuesChecked)>0) {
|
||||
foreach($valuesChecked as $value){
|
||||
$valuesUndetermined = array_merge($valuesUndetermined, $this->getNafParent($value, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$nafM = new Application_Model_Naf();
|
||||
$sql = $nafM->select()->where('niveau = ?', $niveau)->order('code ASC');
|
||||
$result = $nafM->fetchAll($sql)->toArray();
|
||||
|
||||
$tabNaf = array();
|
||||
foreach($result as $item)
|
||||
{
|
||||
if ( $item['niveau']==1 ) {
|
||||
$data = $item['lib'];
|
||||
} else {
|
||||
$data = $item['lib'].' ('.$item['code'].')';
|
||||
}
|
||||
|
||||
$structure = array(
|
||||
'data' => $data,
|
||||
'attr' => array('id' => $item['code'], 'niveau' => $item['niveau']),
|
||||
'state' => 'closed',
|
||||
'children' => array(),
|
||||
);
|
||||
if (in_array($item['code'], $valuesChecked)){
|
||||
$structure['attr']['class'] = 'jstree-checked';
|
||||
}
|
||||
if (in_array($item['code'], $valuesUndetermined)){
|
||||
$structure['attr']['class'] = 'jstree-undetermined';
|
||||
}
|
||||
$tabNaf[] = $structure;
|
||||
}
|
||||
$this->view->key = $key;
|
||||
$this->view->naf = json_encode($tabNaf);
|
||||
}
|
||||
|
||||
public function nafajaxAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
|
||||
$request = $this->getRequest();
|
||||
$key = $request->getParam('key');
|
||||
$parent = $request->getParam('parent');
|
||||
$niveau = $request->getParam('niveau', 1);
|
||||
$niveau = $niveau + 1;
|
||||
|
||||
//Récupération des valeurs enregistrées en session
|
||||
$fields = new Scores_Fields();
|
||||
$val = $fields->getCritere($key);
|
||||
$valuesChecked = array();
|
||||
|
||||
$valuesUndetermined = array();
|
||||
|
||||
if ($val != null){
|
||||
$valuesChecked = $val['in'];
|
||||
if (count($valuesChecked)>0) {
|
||||
foreach($valuesChecked as $value){
|
||||
$valuesUndetermined = array_merge($valuesUndetermined, $this->getNafParent($value, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$nafM = new Application_Model_Naf();
|
||||
$sql = $nafM->select();
|
||||
|
||||
if (!empty($parent) && $niveau==2) {
|
||||
$sql->where('parent = ?', $parent);
|
||||
} elseif (!empty($parent) && $niveau>2) {
|
||||
$sql->where("code LIKE '".$parent."%'");
|
||||
}
|
||||
$sql->where('niveau = ?', $niveau)->order('code ASC');
|
||||
|
||||
$result = $nafM->fetchAll($sql)->toArray();
|
||||
$tabNaf = array();
|
||||
foreach($result as $item){
|
||||
$structure = array(
|
||||
'data' => $item['code'].' - '.$item['lib'],
|
||||
'attr' => array('id' => $item['code'], 'niveau' => $item['niveau']),
|
||||
);
|
||||
if (in_array($item['code'], $valuesChecked)){
|
||||
$structure['attr']['class'] = 'jstree-checked';
|
||||
}
|
||||
if (in_array($item['code'], $valuesUndetermined)){
|
||||
$structure['attr']['class'] = 'jstree-undetermined';
|
||||
}
|
||||
if ($niveau<5){
|
||||
$structure['state'] = 'closed';
|
||||
$structure['children'] = array();
|
||||
}
|
||||
$tabNaf[] = $structure;
|
||||
}
|
||||
echo json_encode($tabNaf);
|
||||
}
|
||||
|
||||
protected function getNafParent($value, $niveau1 = false)
|
||||
{
|
||||
$out = array();
|
||||
if (strlen($value)>2) {
|
||||
$niveau = strlen($value)-1;
|
||||
$new = substr($value,0,$niveau);
|
||||
$out = array_merge($out, array($new), $this->getNafParent($new, $niveau1));
|
||||
} elseif (strlen($value)==2 && $niveau1 === true) {
|
||||
$nafM = new Application_Model_Naf();
|
||||
$sql = $nafM->select()
|
||||
->from($nafM, array('parent'))
|
||||
->where('code = ?', $value);
|
||||
$result = $nafM->fetchRow($sql);
|
||||
$out[] = $result->parent;
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
||||
/* Geographiques */
|
||||
public function geographiqueAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$key = $this->getRequest()->getParam('key');
|
||||
|
||||
$fields = new Scores_Fields();
|
||||
$val = $fields->getCritere($key);
|
||||
$valuesChecked = array();
|
||||
$valuesUndetermined = array();
|
||||
|
||||
if ($val != null){
|
||||
$valuesChecked = $val['in'];
|
||||
if (count($valuesChecked)>0) {
|
||||
foreach($valuesChecked as $value) {
|
||||
if ( substr($value,0,1)!='R' ) {
|
||||
$valuesUndetermined = array_merge($valuesUndetermined, $this->getGeoParent($value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$regionsM = new Application_Model_Regions();
|
||||
$sql = $regionsM->select()->order('NCCENR ASC');
|
||||
$regions = $regionsM->fetchAll($sql)->toArray();
|
||||
|
||||
$tabRegions = array();
|
||||
foreach($regions as $item) {
|
||||
$structure = array(
|
||||
'data' => $item['NCCENR'],
|
||||
'attr' => array(
|
||||
'id' => 'R'.$item['REGION'],
|
||||
'niveau' => 0,
|
||||
),
|
||||
'state' => 'closed',
|
||||
'children' => array()
|
||||
);
|
||||
if (in_array('R'.$item['REGION'], $valuesChecked)){
|
||||
$structure['attr']['class'] = 'jstree-checked';
|
||||
}
|
||||
if (in_array('R'.$item['REGION'], $valuesUndetermined)){
|
||||
$structure['attr']['class'] = 'jstree-undetermined';
|
||||
}
|
||||
$tabRegions[] = $structure;
|
||||
}
|
||||
|
||||
$this->view->key = $key;
|
||||
$this->view->regions = json_encode($tabRegions);
|
||||
}
|
||||
|
||||
public function geographiqueajaxAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
|
||||
$request = $this->getRequest();
|
||||
$id = $request->getParam('id');
|
||||
$niveau = $request->getParam('niveau');
|
||||
|
||||
//Récupération des valeurs enregistrées en session
|
||||
$fields = new Scores_Fields();
|
||||
$val = $fields->getCritere('geo');
|
||||
$valuesChecked = array();
|
||||
|
||||
$valuesUndetermined = array();
|
||||
|
||||
if ($val != null){
|
||||
$valuesChecked = $val['in'];
|
||||
if (count($valuesChecked)>0) {
|
||||
foreach($valuesChecked as $value){
|
||||
$valuesUndetermined = array_merge($valuesUndetermined, $this->getGeoParent($value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// R[code] => Régions => recherche département
|
||||
if ( substr($id,0,1)=='R' ) {
|
||||
|
||||
$region = substr($id,1);
|
||||
|
||||
$departementsM = new Application_Model_Departements();
|
||||
$sql = $departementsM->select()->where('codeRegionInsee = ?', $region);
|
||||
$departements = $departementsM->fetchAll($sql)->toArray();
|
||||
|
||||
$tabDepartements = array();
|
||||
foreach($departements as $item) {
|
||||
$structure = array(
|
||||
'data' => $item['libdep'].' ('.$item['numdep'].')',
|
||||
'attr' => array(
|
||||
'id' => 'D'.$item['numdep'],
|
||||
'niveau' => 1,
|
||||
),
|
||||
'state' => 'closed',
|
||||
'children' => array()
|
||||
);
|
||||
if (in_array('D'.$item['numdep'], $valuesChecked)){
|
||||
$structure['attr']['class'] = 'jstree-checked';
|
||||
}
|
||||
if (in_array('D'.$item['numdep'], $valuesUndetermined)){
|
||||
$structure['attr']['class'] = 'jstree-undetermined';
|
||||
}
|
||||
$tabDepartements[] = $structure;
|
||||
}
|
||||
echo json_encode($tabDepartements);
|
||||
}
|
||||
// D[code] => Départements => recherche commune
|
||||
else if ( substr($id,0,1)=='D' ) {
|
||||
|
||||
$departement = substr($id,1);
|
||||
|
||||
$codePostauxM = new Application_Model_CodePostaux();
|
||||
$sql = $codePostauxM->select()
|
||||
->where('Codepos LIKE ?', $departement.'%')
|
||||
->order('Commune ASC');
|
||||
Zend_Registry::get('firebug')->info($sql->__toString());
|
||||
$communes = $codePostauxM->fetchAll($sql)->toArray();
|
||||
|
||||
$tabCommunes = array();
|
||||
foreach($communes as $item) {
|
||||
$structure = array(
|
||||
'data' => $item['Commune'],
|
||||
'attr' => array(
|
||||
'id' => 'C'.$item['INSEE'],
|
||||
'niveau' => 1,
|
||||
)
|
||||
);
|
||||
if (in_array('C'.$item['INSEE'], $valuesChecked)){
|
||||
$structure['attr']['class'] = 'jstree-checked';
|
||||
}
|
||||
$tabCommunes[] = $structure;
|
||||
}
|
||||
echo json_encode($tabCommunes);
|
||||
}
|
||||
}
|
||||
|
||||
protected function getGeoParent($code)
|
||||
{
|
||||
if (substr($code,0,1)=='D') {
|
||||
|
||||
$departementsM = new Application_Model_Departements();
|
||||
$sql = $departementsM->select()
|
||||
->from($departementsM, array('codeRegionInsee'))
|
||||
->where('numdep = ?', substr($code,1));
|
||||
$departement = $departementsM->fetchRow($sql);
|
||||
|
||||
return array('R'.$departement->codeRegionInsee);
|
||||
|
||||
} elseif ( substr($code,0,1)=='C' ) {
|
||||
|
||||
$codePostauxM = new Application_Model_CodePostaux();
|
||||
$sql = $codePostauxM->select()
|
||||
->from($codePostauxM, array('Codepos'))
|
||||
->where('INSEE = ?', substr($code,1));
|
||||
$commune = $codePostauxM->fetchRow($sql);
|
||||
|
||||
$departement = 'D'.substr($commune->Codepos,0,2);
|
||||
$region = $this->getGeoParent($departement);
|
||||
|
||||
return array_merge(array($departement), $region);
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
/* Forme Juridique */
|
||||
public function juridiqueAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
||||
$fields = new Scores_Fields();
|
||||
$val = $fields->getCritere('cj');
|
||||
|
||||
$valuesChecked = array();
|
||||
$valuesUndetermined = array();
|
||||
|
||||
if ($val != null){
|
||||
$valuesChecked = $val['in'];
|
||||
if (count($valuesChecked)>0) {
|
||||
foreach($valuesChecked as $value){
|
||||
if (strlen($value)>1) {
|
||||
$valuesUndetermined = array_merge($valuesUndetermined, array(substr($value,0,1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$FormeJuridiqueM = new Application_Model_FormeJuridique();
|
||||
$sql = $FormeJuridiqueM->select()
|
||||
->where('LENGTH(fjCode) = 1')
|
||||
->order('fjLibelle ASC');
|
||||
$formes = $FormeJuridiqueM->fetchAll($sql)->toArray();
|
||||
|
||||
$tabFJ = array();
|
||||
foreach($formes as $forme) {
|
||||
$structure = array(
|
||||
'data' => $forme['fjLibelle'],
|
||||
'attr' => array( 'id' => $forme['fjCode'] ),
|
||||
'state' => 'closed',
|
||||
'children' => array(),
|
||||
);
|
||||
if (in_array($forme['fjCode'], $valuesChecked)){
|
||||
$structure['attr']['class'] = 'jstree-checked';
|
||||
}
|
||||
if (in_array($forme['fjCode'], $valuesUndetermined)){
|
||||
$structure['attr']['class'] = 'jstree-undetermined';
|
||||
}
|
||||
$tabFJ[] = $structure;
|
||||
}
|
||||
|
||||
$key = $this->getRequest()->getParam('key');
|
||||
|
||||
$this->view->key = $key;
|
||||
$this->view->formejuridiques = json_encode($tabFJ);
|
||||
}
|
||||
|
||||
public function juridiqueajaxAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
|
||||
$request = $this->getRequest();
|
||||
$id = $request->getParam('id');
|
||||
|
||||
$length = strlen($id);
|
||||
|
||||
$followingLevel = 5;
|
||||
if ( $length==1 ) {
|
||||
$followingLevel = 2;
|
||||
} elseif ( $length==2 ) {
|
||||
$followingLevel = 4;
|
||||
}
|
||||
|
||||
$fields = new Scores_Fields();
|
||||
$val = $fields->getCritere('cj');
|
||||
|
||||
$valuesChecked = array();
|
||||
$valuesUndetermined = array();
|
||||
|
||||
if ($val != null){
|
||||
$valuesChecked = $val['in'];
|
||||
if (count($valuesChecked)>0) {
|
||||
foreach($valuesChecked as $value){
|
||||
if (strlen($value)>$followingLevel) {
|
||||
$valuesUndetermined = array_merge($valuesUndetermined, substr($value,0,$followingLevel));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Zend_Registry::get('firebug')->info($valuesChecked);
|
||||
|
||||
|
||||
if ($length<4) {
|
||||
$FormeJuridiqueM = new Application_Model_FormeJuridique();
|
||||
$sql = $FormeJuridiqueM->select()
|
||||
->where('fjCode LIKE "'.$id.'%"')
|
||||
->where('LENGTH(fjCode)=?', $followingLevel);
|
||||
$formes = $FormeJuridiqueM->fetchAll($sql)->toArray();
|
||||
|
||||
$tabFJ = array();
|
||||
foreach($formes as $forme) {
|
||||
|
||||
$data = $forme['fjLibelle'];
|
||||
if ( $followingLevel==4 ) {
|
||||
$data = $forme['fjLibelle'].' ('.$forme['fjCode'].')';
|
||||
}
|
||||
|
||||
$structure = array(
|
||||
'data' => $data,
|
||||
'attr' => array( 'id' => $forme['fjCode'] ),
|
||||
);
|
||||
|
||||
if ( $length<2 ) {
|
||||
$structure['state'] = 'closed';
|
||||
$structure['children'] = array();
|
||||
}
|
||||
|
||||
if (in_array($forme['fjCode'], $valuesChecked)){
|
||||
$structure['attr']['class'] = 'jstree-checked';
|
||||
}
|
||||
if (in_array($forme['fjCode'], $valuesUndetermined)){
|
||||
$structure['attr']['class'] = 'jstree-undetermined';
|
||||
}
|
||||
|
||||
$tabFJ[] = $structure;
|
||||
}
|
||||
echo json_encode($tabFJ);
|
||||
}
|
||||
}
|
||||
}
|
313
application/controllers/ComptageController.php
Normal file
313
application/controllers/ComptageController.php
Normal file
@ -0,0 +1,313 @@
|
||||
<?php
|
||||
class ComptageController extends Zend_Controller_Action
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
||||
$request = $this->getRequest();
|
||||
|
||||
$cle = $request->getParam('cle');
|
||||
$valeur = $request->getParam('valeur');
|
||||
|
||||
/**
|
||||
* Error code
|
||||
* 0 : OK
|
||||
* 1 : Error from sphinx
|
||||
* 2 : Error when insert critere
|
||||
* @var int
|
||||
*/
|
||||
$error = 0;
|
||||
|
||||
//Set the flag for exclusion
|
||||
$exclude = $request->getParam('exclude');
|
||||
$ex = false;
|
||||
if ( intval($exclude)==1 ) {
|
||||
$ex = true;
|
||||
}
|
||||
|
||||
$fields = new Scores_Fields();
|
||||
$insert = $fields->setCritere($cle, $valeur, $ex);
|
||||
|
||||
if ($insert) {
|
||||
//Informations utilisateur
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
//Comptage
|
||||
require_once 'Scores/Ciblage.php';
|
||||
$ciblage = new Ciblage($fields->getValues(), $user->globalRNCS);
|
||||
|
||||
//@todo : if $total = false then an error occured ?
|
||||
// et si nous avons une erreur alors faut-il retirer les critères de la session
|
||||
$total = $ciblage->execute();
|
||||
|
||||
//Define value return after counting
|
||||
$fields->setNb('total', $total);
|
||||
if ( $user->preferences['interface']['insee'] == 1 ) {
|
||||
$insee = $ciblage->calculRedevanceInsee();
|
||||
} else {
|
||||
$insee = null;
|
||||
}
|
||||
$fields->setNb('insee', $insee);
|
||||
|
||||
if ( $total !== false ) {
|
||||
//All is ok, save criteres and result to session
|
||||
$fields->setCritereSession();
|
||||
} else {
|
||||
$error = 1;
|
||||
}
|
||||
} else {
|
||||
$error = 2;
|
||||
}
|
||||
|
||||
//@todo : Ajouter les critères sous forme json_encode
|
||||
//Retour comptage, unité Insee
|
||||
$result = array(
|
||||
'count' => number_format($total, 0, '', ' '),
|
||||
'insee' => ($insee!==null) ? number_format($insee, 0, '', ' ') : null,
|
||||
'error' => $error,
|
||||
);
|
||||
|
||||
$this->view->assign('result', $result);
|
||||
}
|
||||
|
||||
public function resetAction()
|
||||
{
|
||||
$erreurs = new Zend_Session_Namespace('erreurs');
|
||||
|
||||
$fields = new Scores_Fields();
|
||||
$fields->clearCiblage();
|
||||
|
||||
unset($erreurs->erreurs);
|
||||
$this->_redirect('/');
|
||||
}
|
||||
|
||||
public function savedialogAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
//Récupération de la session pour le profil et les valeurs du comptage
|
||||
$fields = new Scores_Fields();
|
||||
$criteres = $fields->getCriteres();
|
||||
if (count($criteres) == 0) {
|
||||
$this->view->noSelection = true;
|
||||
}
|
||||
$this->view->reference = $user->username.'-'.date('YmdHis');
|
||||
}
|
||||
|
||||
public function saveAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$request = $this->getRequest();
|
||||
$ref = $request->getParam('ref', '');
|
||||
|
||||
/**
|
||||
* Take care of "ref", remove all special char, accent and replace space by _
|
||||
*/
|
||||
require_once 'i18n/cleanchar.php';
|
||||
$ref = str_replace(' ', '_', $ref);
|
||||
$ref = cleanutf8($ref);
|
||||
$pattern = '/[^a-zA-Z0-9_-]+/';
|
||||
$ref = preg_replace($pattern, '', $ref);
|
||||
|
||||
if (empty($ref)) {
|
||||
echo json_encode(array(
|
||||
'error'=>1,
|
||||
'msg'=> "Référence non définie !"));
|
||||
} else {
|
||||
//Session
|
||||
$fields = new Scores_Fields();
|
||||
$criteres = $fields->getCriteres();
|
||||
$resultat = $fields->getNb('total');
|
||||
$nbInsee = $fields->getNb('insee');
|
||||
|
||||
//Informations utilisateur
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
//Enregistrement des critères
|
||||
$criteresM = new Application_Model_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) {
|
||||
//If nbInsee == null, need to count again
|
||||
if ($nbInsee===null) {
|
||||
require_once 'Scores/Ciblage.php';
|
||||
$ciblage = new Ciblage($criteres, $user->globalRNCS);
|
||||
$nbInsee = $ciblage->calculRedevanceInsee();
|
||||
}
|
||||
|
||||
//Enregistrement des valeurs du comptage
|
||||
$comptageM = new Application_Model_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",
|
||||
'href' => $this->view->url(array('controller'=>'dashboard', 'action'=>'ciblage', '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 updateAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$request = $this->getRequest();
|
||||
$idCriteres = $request->getParam('id');
|
||||
|
||||
//Récupération des critères du ciblage
|
||||
$criteresM = new Application_Model_Criteres();
|
||||
$criteresRow = $criteresM->find($idCriteres);
|
||||
$criteres = $criteresRow->current();
|
||||
$structure = json_decode($criteres->criteres, true);
|
||||
|
||||
$field = new Scores_Fields();
|
||||
$values = $field->getValues($structure);
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
//Comptage
|
||||
require_once 'Scores/Ciblage.php';
|
||||
$ciblage = new Ciblage($values, $user->globalRNCS);
|
||||
|
||||
$data = array(
|
||||
'idDefinition' => $idCriteres,
|
||||
'resultat' => $ciblage->execute(),
|
||||
'uniteInsee' => $ciblage->calculRedevanceInsee(),
|
||||
'dateAjout' => date('YmdHis'),
|
||||
);
|
||||
//Enregistrement
|
||||
$comptageM = new Application_Model_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'],0,4)
|
||||
.' '.substr($data['dateAjout'],8,2).':'.substr($data['dateAjout'],10,2).':'.substr($data['dateAjout'],12,2),
|
||||
);
|
||||
$this->view->result = $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a preview of data to extract
|
||||
*/
|
||||
public function previsualisationAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
$fields = new Scores_Fields();
|
||||
|
||||
//Comptage
|
||||
require_once 'Scores/Ciblage.php';
|
||||
$ciblage = new Ciblage($fields->getValues(), $user->globalRNCS);
|
||||
$sirets = $ciblage->execute(true, 10);
|
||||
|
||||
$dbConfig = Zend_Registry::get('configuration')->databases;
|
||||
try {
|
||||
$dbMetier = Zend_Db::factory($dbConfig->jo);
|
||||
} catch ( Exception $e ) {
|
||||
exit ( $e->getMessage() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Make SQL request with the client profil for columns
|
||||
*/
|
||||
$profilsM = new Application_Model_EnrichissementProfils();
|
||||
$sql = $profilsM->select()
|
||||
->from($profilsM, array('criteres'))
|
||||
->where('reference=?','default')
|
||||
->where('login = ?', $user->username);
|
||||
$result = $profilsM->fetchRow($sql);
|
||||
|
||||
$profil = json_decode($result['criteres'], true);
|
||||
|
||||
//No profil, define it
|
||||
if (count($profil)==0) {
|
||||
$profil = array('raisonSociale');
|
||||
}
|
||||
|
||||
$extractSql = $extractLabel = array();
|
||||
//$extractSql[] = "CONCAT(LPAD(siren, 9, '000000000'), LPAD(nic, 5, '00000')) AS siret";
|
||||
//$extractLabel[] = 'SIRET';
|
||||
|
||||
require_once 'Scores/Enrichissement.php';
|
||||
$enrichissement = new Enrichissement();
|
||||
$data = $enrichissement->getFields();
|
||||
foreach ( $data as $key => $item ) {
|
||||
if (in_array($key, $profil)) {
|
||||
if ( array_key_exists('sql', $item) ) {
|
||||
$extractSql[] = $item['sql'];
|
||||
} else {
|
||||
$extractSql[] = $item['column'];
|
||||
}
|
||||
$extractLabel[] = $item['label'];
|
||||
}
|
||||
}
|
||||
|
||||
$sql = $dbMetier->select()->from('etablissements_act', $extractSql);
|
||||
|
||||
$i = 0;
|
||||
$where = '';
|
||||
foreach($sirets as $siret) {
|
||||
if ($i>0) {
|
||||
$where.=' OR ';
|
||||
}
|
||||
$where.= "(siren='".substr($siret,0,9)."' AND nic='".substr($siret,9,5)."')";
|
||||
$i++;
|
||||
}
|
||||
$sql->where($where);
|
||||
|
||||
$result = $dbMetier->fetchAll($sql);
|
||||
$liste = array();
|
||||
foreach ($result as $l => $line) {
|
||||
$tmp = array();
|
||||
foreach($line as $column => $data) {
|
||||
$valuesPredefine = $enrichissement->getColumnValue($column);
|
||||
if ($valuesPredefine!==false) {
|
||||
$tmp[] = $valuesPredefine[$data];
|
||||
} else {
|
||||
$tmp[] = $data;
|
||||
}
|
||||
}
|
||||
$liste[] = $tmp;
|
||||
}
|
||||
|
||||
$this->view->assign('label', $extractLabel);
|
||||
$this->view->assign('liste', $liste);
|
||||
}
|
||||
}
|
||||
|
399
application/controllers/DashboardController.php
Normal file
399
application/controllers/DashboardController.php
Normal file
@ -0,0 +1,399 @@
|
||||
<?php
|
||||
class DashboardController extends Zend_Controller_Action
|
||||
{
|
||||
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()
|
||||
{
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
$criteresM = new Application_Model_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 Application_Model_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;
|
||||
}
|
||||
|
||||
$this->view->comptages = $results;
|
||||
|
||||
//
|
||||
$enrichissements = new Application_Model_EnrichissementIdentifiants();
|
||||
$sql = $enrichissements->select()
|
||||
->setIntegrityCheck(false)
|
||||
->from(
|
||||
array('i' => 'enrichissement_identifiants'),
|
||||
array('id', 'reference', 'fichier', 'nbLigneTotales', 'nbLigneTraites', 'error', 'dateAdded', 'dateStart', 'dateStop')
|
||||
)
|
||||
->join(
|
||||
array('c' => 'ciblage_criteres'), 'i.idCriteres = c.id',
|
||||
array('')
|
||||
)
|
||||
->where('c.idClient = ?', $user->idClient)
|
||||
->where('c.login = ?', $user->username)
|
||||
->order('i.dateAdded DESC');
|
||||
|
||||
$this->view->enrichissements = $enrichissements->fetchAll($sql);
|
||||
|
||||
}
|
||||
|
||||
public function ciblagesAction()
|
||||
{
|
||||
|
||||
$request = $this->getRequest();
|
||||
$page = $request->getParam('page', 1);
|
||||
|
||||
|
||||
$offset = 20;
|
||||
//Liste des ciblages par paquet de n
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
$criteresM = new Application_Model_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 Application_Model_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;
|
||||
}
|
||||
$this->view->ciblages = $results;
|
||||
$this->view->nbCiblage = $nbCiblage;
|
||||
|
||||
}
|
||||
|
||||
public function ciblageAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
$comptageId = $request->getParam('id');
|
||||
|
||||
$fields = new Scores_Fields();
|
||||
|
||||
//Lecture des paramètres du ciblage
|
||||
$criteresM = new Application_Model_Criteres();
|
||||
$sql = $criteresM->select()
|
||||
->where('idClient = ?', $user->idClient)
|
||||
->where('login = ?', $user->username)
|
||||
->where('id = ?', $comptageId);
|
||||
$criteres = $criteresM->fetchRow($sql)->toArray();
|
||||
|
||||
$infosCriteres = array();
|
||||
if ($criteres != null) {
|
||||
$comptageRef = $criteres['reference'];
|
||||
|
||||
$decodeCriteres = json_decode($criteres['criteres'], true);
|
||||
|
||||
//Construction affichage des critères
|
||||
foreach ( $decodeCriteres as $key => $item ) {
|
||||
|
||||
$inValue = $fields->getValueLabel($key, $item['in']);
|
||||
$exValue = $fields->getValueLabel($key, $item['ex']);
|
||||
|
||||
//Add label to struct for display
|
||||
$infosCriteres[] = array(
|
||||
'label' => $fields->getLabel($key),
|
||||
'in' => $inValue,
|
||||
'ex' => $exValue,
|
||||
);
|
||||
}
|
||||
|
||||
//Lecture des comptages
|
||||
$comptageM = new Application_Model_Comptages();
|
||||
$sql = $comptageM->select()
|
||||
->where('idDefinition = ?', $comptageId)
|
||||
->order('dateAjout DESC');
|
||||
$comptages = $comptageM->fetchAll($sql)->toArray();
|
||||
|
||||
//Lecture enrichissement existe
|
||||
$enrichissementsM = new Application_Model_EnrichissementIdentifiants();
|
||||
$sql = $enrichissementsM->select()
|
||||
->where('idCriteres = ?', $comptageId);
|
||||
|
||||
$enrichissements = $enrichissementsM->fetchAll($sql);
|
||||
|
||||
//Affichage
|
||||
$this->view->comptageId = $comptageId;
|
||||
$this->view->comptageRef = $comptageRef;
|
||||
$this->view->criteres = $infosCriteres;
|
||||
$this->view->comptages = $comptages;
|
||||
$this->view->enrichissements = $enrichissements;
|
||||
}
|
||||
}
|
||||
|
||||
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 Application_Model_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();
|
||||
//Criteres => Comptages (last) => enrichissement_identifiants => enrichissement_commandes
|
||||
$enrichissementsM = new Application_Model_EnrichissementIdentifiants();
|
||||
|
||||
// Pending
|
||||
$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()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Display information about user's profil
|
||||
*/
|
||||
public function configurationAction()
|
||||
{
|
||||
|
||||
//User's params
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
if (array_key_exists('filter', $user->preferences) && count($user->preferences['filter'])>0) {
|
||||
$liste = $user->preferences['filter'];
|
||||
foreach ( $liste as $name => $value ){
|
||||
$this->view->assign('prefFilter'.ucfirst($name), $value);
|
||||
}
|
||||
}
|
||||
|
||||
if (array_key_exists('interface', $user->preferences) && count($user->preferences['interface'])>0) {
|
||||
$liste = $user->preferences['interface'];
|
||||
foreach ( $liste as $name => $value ){
|
||||
$this->view->assign('prefInterface'.ucfirst($name), $value);
|
||||
}
|
||||
}
|
||||
|
||||
//Customer params have an option on the RNCS filter
|
||||
$this->view->assign('filterRNCS', $user->filterRNCS);
|
||||
|
||||
//List of data to extract
|
||||
$profilsM = new Application_Model_EnrichissementProfils();
|
||||
$sql = $profilsM->select()
|
||||
->where('login = ?', $user->username)
|
||||
->where('idClient = ?', $user->idClient);
|
||||
$result = $profilsM->fetchRow($sql);
|
||||
if ($result) {
|
||||
$criteres = json_decode($result['criteres'], true);
|
||||
require_once 'Scores/Enrichissement.php';
|
||||
$enrichissement = new Enrichissement();
|
||||
$data = $enrichissement->getFields();
|
||||
$profilLabels = array();
|
||||
foreach ( $data as $key => $item ) {
|
||||
if (in_array($key, $criteres)) {
|
||||
$profilLabels[] = $item['label'];
|
||||
}
|
||||
}
|
||||
$profil = new stdClass();
|
||||
$profil->labels = $profilLabels;
|
||||
$profil->tarif = $result['tarifLigne'];
|
||||
$profil->reference = $result['reference'];
|
||||
$this->view->assign('profil', $profil);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set preferences
|
||||
*/
|
||||
public function prefAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
//Read prefs table to load actual config
|
||||
$prefsM = new Application_Model_Prefs();
|
||||
$userPrefs = $prefsM->find($user->username);
|
||||
|
||||
if ($userPrefs) {
|
||||
$data = json_decode($userPrefs->current()->json, true);
|
||||
} else {
|
||||
$data = array('interface'=>array(),'filter'=>array());
|
||||
$prefsM->insert(array('login'=>$user->username, 'json'=>json_encode($data)));
|
||||
}
|
||||
|
||||
$request = $this->getRequest();
|
||||
$sendParam = $request->getParams();
|
||||
|
||||
$prefsFilter = array('rncs');
|
||||
$prefsInterface = array('insee');
|
||||
|
||||
$filter = array();
|
||||
foreach ( $prefsFilter as $item ) {
|
||||
if (array_key_exists($item, $sendParam)) {
|
||||
$filter = array($item => $sendParam[$item]);
|
||||
}
|
||||
}
|
||||
if (array_key_exists('filter', $data)) {
|
||||
$filter = array_merge($data['filter'], $filter);
|
||||
}
|
||||
$data['filter'] = $filter;
|
||||
|
||||
$interface = array();
|
||||
foreach ( $prefsInterface as $item ) {
|
||||
if (array_key_exists($item, $sendParam)) {
|
||||
$interface = array($item => $sendParam[$item]);
|
||||
}
|
||||
}
|
||||
if (array_key_exists('interface', $data)) {
|
||||
$interface = array_merge($data['interface'], $interface);
|
||||
}
|
||||
$data['interface'] = $interface;
|
||||
$newjson = json_encode($data);
|
||||
|
||||
$nbRow = $prefsM->update(array('json'=>$newjson), "login='".$user->username."'");
|
||||
|
||||
//Don't forget to save new preferences in session
|
||||
|
||||
$this->view->assign('nbRow', $nbRow);
|
||||
}
|
||||
|
||||
|
||||
}
|
281
application/controllers/EnrichissementController.php
Normal file
281
application/controllers/EnrichissementController.php
Normal file
@ -0,0 +1,281 @@
|
||||
<?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('/libs/form/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()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
||||
$request = $this->getRequest();
|
||||
$idCriteres = $request->getParam('id', null);
|
||||
$idProfil = $request->getParam('profil', null);
|
||||
$ref = $request->getParam('ref');
|
||||
|
||||
//Si forfait check si le montant restant est suffisant
|
||||
|
||||
|
||||
//Identifiant comptage
|
||||
$comptage = new Application_Model_Comptages();
|
||||
$sql = $comptage->select()->where('idDefinition = ?', $idCriteres);
|
||||
$result = $comptage->fetchRow($sql);
|
||||
$idComptage = $result['id'];
|
||||
|
||||
//Récupération des critères du ciblage
|
||||
$criteresM = new Application_Model_Criteres();
|
||||
$criteresRow = $criteresM->find($idCriteres);
|
||||
$criteres = $criteresRow->current();
|
||||
|
||||
$structure = json_decode($criteres->criteres, true);
|
||||
|
||||
//Récupération des SIRET
|
||||
require_once 'Scores/Ciblage.php';
|
||||
$ciblage = new Ciblage($structure, $user->globalRNCS);
|
||||
$infosExtraction = $ciblage->execute(true);
|
||||
|
||||
|
||||
/*
|
||||
* @todo :
|
||||
* Vérifier le nombre d'éléments avec le nombre de ligne
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
//Attention calcul uniteInsee réelle
|
||||
//car si donnée insee alors toutes les lignes doivent être comptés en unité insee
|
||||
$data = array(
|
||||
'idComptage' => $idComptage,
|
||||
'reference' => $ref,
|
||||
'idCriteres' => $criteres->id,
|
||||
'idProfil' => $idProfil,
|
||||
'identifiants' => json_encode($infosExtraction),
|
||||
'idProfil' => $idProfil,
|
||||
'fichier' => '',
|
||||
'nbLigneTotales' => count($infosExtraction),
|
||||
'nbLigneTraites' => 0,
|
||||
'uniteInsee' => $result['uniteInsee'],
|
||||
'error' => '',
|
||||
'dateAdded' => date('YmdHis'),
|
||||
);
|
||||
$identifiantsM = new Application_Model_EnrichissementIdentifiants();
|
||||
$idIdentifiant = $identifiantsM->insert($data);
|
||||
|
||||
//@todo : ajouter la valeur (prix) du fichier au compteur global afin de décompter du forfait
|
||||
|
||||
$this->view->assign('ref', $ref);
|
||||
}
|
||||
|
||||
/**
|
||||
* Demande de référence pour l'enrichissement
|
||||
*/
|
||||
public function referenceAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$request = $this->getRequest();
|
||||
|
||||
$selectprofil = $request->getParam('profil', 'default');
|
||||
|
||||
//Récupération du profil de l'utilisateur
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
$priceLine = $user->priceLine;
|
||||
|
||||
//Other profil for this login ?
|
||||
$profilsM = new Application_Model_EnrichissementProfils();
|
||||
$sql = $profilsM->select()
|
||||
->from($profilsM, array('id', 'reference', 'criteres'))
|
||||
->where('actif=1')
|
||||
->where('login=?', $user->username);
|
||||
$profils = $profilsM->fetchAll($sql)->toArray();
|
||||
|
||||
$profilId = 0;
|
||||
foreach($profils as $item) {
|
||||
if ($selectprofil == $item['id']) {
|
||||
$profilId = $item['id'];
|
||||
}
|
||||
if ($item['reference']=='default') {
|
||||
$defaultProfilId = $item['id'];
|
||||
}
|
||||
}
|
||||
if ($profilId == 0) {
|
||||
$profilId = $defaultProfilId;
|
||||
}
|
||||
|
||||
Zend_Registry::get('firebug')->info($profilId);
|
||||
|
||||
if ( count($profils)>0 ) {
|
||||
|
||||
$this->view->assign('profil', $profilId);
|
||||
$idCritere = $request->getParam('id', null);
|
||||
|
||||
$comptagesM = new Application_Model_Comptages();
|
||||
$sql = $comptagesM->select()
|
||||
->where('idDefinition = ?', $idCritere)
|
||||
->order('dateAjout DESC')
|
||||
->limit(1);
|
||||
$comptages = $comptagesM->fetchAll($sql);
|
||||
|
||||
$criteresM = new Application_Model_Criteres();
|
||||
$criteres = $criteresM->find($idCritere)->current();
|
||||
$criteresValue = json_decode($criteres->criteres, true);
|
||||
|
||||
if ( $comptages->count()>0 ) {
|
||||
$item = $comptages[0];
|
||||
$date = explode(' ', $item->dateAjout);
|
||||
$date = $date[0];
|
||||
|
||||
if($date != '0000-00-00' && $date != date('Y-m-d')) {
|
||||
require_once 'Scores/Ciblage.php';
|
||||
$count = new Ciblage($criteresValue);
|
||||
$item['resultat'] = $count->execute();
|
||||
$item['uniteInsee'] = $count->calculRedevanceInsee();
|
||||
}
|
||||
|
||||
$this->view->assign('resultat', $item['resultat']);
|
||||
$this->view->assign('uniteInsee', $item['uniteInsee']);
|
||||
|
||||
//Calcul du prix
|
||||
//@todo : Put it somewhere we can modify it
|
||||
$redevanceInsee = 3.295/100; //Seuil de facturation 52 734 euros
|
||||
|
||||
//@todo : Si le client a déjà payé la redevance INSEE
|
||||
$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.";
|
||||
}
|
||||
$this->view->prixInsee = round($prixInsee, 2);
|
||||
$this->view->infoInsee = $infoInsee;
|
||||
|
||||
$prix = round($item['resultat'] * $priceLine + $prixInsee, 2);
|
||||
|
||||
//Forfait - Liste des commandes et calcul
|
||||
if ($user->forfait>0) {
|
||||
$dateBegin = $user->dateContrat;
|
||||
$dateEnd = date('YmdHis', mktime(0,0,0,substr($user->dateContrat,5,2)+$user->periodContrat, substr($user->dateContrat,8,2), substr($user->dateContrat,0,4)));
|
||||
|
||||
$commandesM = new Application_Model_EnrichissementIdentifiants();
|
||||
$sql = $commandesM->select()->setIntegrityCheck(false)
|
||||
->from( array('commande' => 'enrichissement_identifiants'), array('SUM(nbLigneTotales) as total', 'SUM(uniteInsee) as insee'))
|
||||
->join( array('critere' => 'ciblage_criteres'), 'critere.id = commande.idCriteres', array())
|
||||
->where("dateAdded BETWEEN '".$dateBegin."' AND '".$dateEnd."'")
|
||||
->where('idClient = ?', $user->idClient);
|
||||
|
||||
$result = $commandesM->fetchRow($sql);
|
||||
if ($result) {
|
||||
$total = $result['total'];
|
||||
$insee = $result['insee'];
|
||||
$conso = round($total * $priceLine + $insee * $redevanceInsee, 2);
|
||||
}
|
||||
|
||||
$this->view->forfaitRemain = $user->forfait - $conso - $prix;
|
||||
}
|
||||
|
||||
$this->view->prix = $prix;
|
||||
$this->view->id = $item['id'];
|
||||
$this->view->ref = $criteres->reference.'-'.uniqid();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function downloadAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$id = $this->getRequest()->getParam('id');
|
||||
$table = new Application_Model_EnrichissementIdentifiants();
|
||||
$sql = $table->select()
|
||||
->where('id = ?', $id);
|
||||
$result = $table->fetchRow($sql);
|
||||
if(!empty($result)) {
|
||||
$result = $result->toArray();
|
||||
$date = substr($result['dateAdded'],0,4).substr($result['dateAdded'],5,2);
|
||||
$config = Zend_Registry::get('configuration');
|
||||
$path = $config->path->data.'/'.$date.'/';
|
||||
$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.';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
42
application/controllers/ErreurController.php
Normal file
42
application/controllers/ErreurController.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
class ErreurController extends Zend_Controller_Action
|
||||
{
|
||||
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/controllers/ErrorController.php
Normal file
48
application/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;
|
||||
}
|
||||
}
|
||||
|
223
application/controllers/FieldsController.php
Normal file
223
application/controllers/FieldsController.php
Normal file
@ -0,0 +1,223 @@
|
||||
<?php
|
||||
class FieldsController extends Zend_Controller_Action
|
||||
{
|
||||
/**
|
||||
* Display fields
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
$this->view->headScript()
|
||||
->appendFile('/libs/tree/jquery.jstree.js', 'text/javascript')
|
||||
->appendFile('/themes/default/scripts/fields.js', 'text/javascript');
|
||||
|
||||
$field = new Scores_Fields();
|
||||
$this->view->fields = $field;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset criteres by family
|
||||
*/
|
||||
public function resetAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
|
||||
$request = $this->getRequest();
|
||||
$family = $request->getParam('family');
|
||||
if ( !empty($family) )
|
||||
{
|
||||
$fields = new Scores_Fields();
|
||||
$fields->resetFamille($family);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage autocomplete
|
||||
*/
|
||||
public function autocompleteAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$request = $this->getRequest();
|
||||
$name = $request->getParam('name');
|
||||
$q = strtolower($request->getParam('q'));
|
||||
|
||||
$output = array();
|
||||
|
||||
switch ($name) {
|
||||
case 'ape_etab':
|
||||
case 'ape_entrep':
|
||||
/**
|
||||
* @todo : Ajouter la recherche par code
|
||||
*/
|
||||
$queries = explode(' ', $q);
|
||||
$separator = ' , ';
|
||||
$table = new Application_Model_Naf();
|
||||
$sql = $table->select();
|
||||
if (count($queries)>0) {
|
||||
$where = '';
|
||||
$i = 0;
|
||||
foreach ($queries as $item) {
|
||||
if (strlen($item)>2) {
|
||||
$where = 'LIKE "%'.strtolower($item).'%"';
|
||||
}
|
||||
$i++;
|
||||
if (count($queries) < $i){
|
||||
$where.= ' OR ';
|
||||
}
|
||||
}
|
||||
$sql->where("LOWER(lib) ".$where);
|
||||
}
|
||||
$sql->where('niveau = 5');
|
||||
|
||||
$result = $table->fetchAll($sql);
|
||||
foreach ($result as $item) {
|
||||
$output[] = array(
|
||||
'label' => $item->lib . $separator . $item->code,
|
||||
'value' => $item->code
|
||||
);
|
||||
}
|
||||
break;
|
||||
case 'geo':
|
||||
|
||||
//Replace characters ' and - in space
|
||||
$q = preg_replace("/['-]/", ' ', $q);
|
||||
|
||||
//Remove characters
|
||||
$q = preg_replace("/^[a-z]\s/i", '', $q);
|
||||
|
||||
//Detect if we have string
|
||||
if ( preg_match("/[a-zA-Z]+/", $q) )
|
||||
{
|
||||
$queries = explode(' ', $q);
|
||||
Zend_Registry::get('firebug')->info($queries);
|
||||
//Région
|
||||
$table = new Application_Model_Regions();
|
||||
$sql = $table->select();
|
||||
if (count($queries)>0) {
|
||||
$where = '';
|
||||
$i = 0;
|
||||
foreach ($queries as $item) {
|
||||
if (strlen($item)>2) {
|
||||
$where.= 'LIKE "%'.strtolower($item).'%"';
|
||||
}
|
||||
$i++;
|
||||
if (count($queries) < $i){
|
||||
$where.= ' OR ';
|
||||
}
|
||||
}
|
||||
$sql->where("LOWER(NC) ".$where);
|
||||
}
|
||||
$result = $table->fetchAll($sql);
|
||||
foreach ($result as $item) {
|
||||
$output[] = array(
|
||||
'label' => $item->NCCENR . ' (Région)',
|
||||
'value' => 'R'.$item->REGION
|
||||
);
|
||||
}
|
||||
|
||||
//Département
|
||||
$table = new Application_Model_Departements();
|
||||
$sql = $table->select();
|
||||
if (count($queries)>0) {
|
||||
$where = '';
|
||||
$i = 0;
|
||||
foreach ($queries as $item) {
|
||||
if (strlen($item)>2) {
|
||||
$where.= 'LIKE "%'.strtolower($item).'%"';
|
||||
}
|
||||
$i++;
|
||||
if (count($queries) < $i){
|
||||
$where.= ' OR ';
|
||||
}
|
||||
}
|
||||
$sql->where("LOWER(libdep) ".$where);
|
||||
}
|
||||
$result = $table->fetchAll($sql);
|
||||
foreach ($result as $item) {
|
||||
$output[] = array(
|
||||
'label' => $item->libdep . ' (Dépatement)',
|
||||
'value' => 'D'.$item->numdep
|
||||
);
|
||||
}
|
||||
|
||||
//Ville
|
||||
$table = new Application_Model_CodePostaux();
|
||||
$sql = $table->select();
|
||||
if (count($queries)>0) {
|
||||
$where = '';
|
||||
$i = 0;
|
||||
foreach ($queries as $item) {
|
||||
if (strlen($item)>2) {
|
||||
$where.= 'LIKE "%'.strtolower($item).'%"';
|
||||
}
|
||||
$i++;
|
||||
if (count($queries) < $i){
|
||||
$where.= ' OR ';
|
||||
}
|
||||
}
|
||||
$sql->where("LOWER(Commune) ".$where);
|
||||
}
|
||||
$result = $table->fetchAll($sql);
|
||||
foreach ($result as $item) {
|
||||
$output[] = array(
|
||||
'label' => $item->Commune . ', '. $item->Codepos .' (Ville)',
|
||||
'value' => 'C'.$item->INSEE
|
||||
);
|
||||
}
|
||||
|
||||
} elseif ( preg_match('/[0-9]{1,5}/', $q) ) {
|
||||
|
||||
//Code Postal
|
||||
$table = new Application_Model_CodePostaux();
|
||||
$sql = $table->select()->where('Codepos LIKE "'.$q.'%"');
|
||||
$result = $table->fetchAll($sql);
|
||||
foreach ($result as $item) {
|
||||
$output[] = array(
|
||||
'label' => $item->Commune . ', '. $item->Codepos .' (Ville)',
|
||||
'value' => 'C'.$item->INSEE
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
case 'cj':
|
||||
$table = new Application_Model_FormeJuridique();
|
||||
$separator = ' , ';
|
||||
$sql = $table->select();
|
||||
|
||||
$queries = explode(' ', $q);
|
||||
if (count($queries)>0) {
|
||||
$where = '';
|
||||
$i = 0;
|
||||
foreach ($queries as $item) {
|
||||
if (strlen($item)>3) {
|
||||
$where = 'LIKE "%'.$item.'%"';
|
||||
}
|
||||
$i++;
|
||||
if (count($queries) < $i){
|
||||
$where.= ' OR ';
|
||||
}
|
||||
}
|
||||
$sql->where('LOWER(fjLibelle) '.$where);
|
||||
}
|
||||
$sql->where('LENGTH(fjCode) = 4');
|
||||
$result = $table->fetchAll($sql);
|
||||
foreach ($result as $item) {
|
||||
$output[] = array(
|
||||
'label' => $item->fjLibelle . $separator . $item->fjCode,
|
||||
'value' => $item->fjCode
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
//No results
|
||||
if (count($output) == 0) {
|
||||
$output[] = array('label' => 'Aucun résultat.', 'value' => '');
|
||||
}
|
||||
$this->view->assign('output', $output);
|
||||
}
|
||||
|
||||
public function checkvalue(){}
|
||||
|
||||
}
|
371
application/controllers/GestionController.php
Normal file
371
application/controllers/GestionController.php
Normal file
@ -0,0 +1,371 @@
|
||||
<?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');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display all links
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Display profils to get data
|
||||
* Filter with login and idClient
|
||||
*
|
||||
*/
|
||||
public function profilsAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$login = $request->getParam('login', '');
|
||||
$idClient = $request->getParam('idClient', null);
|
||||
|
||||
$profilsM = new Application_Model_EnrichissementProfils();
|
||||
|
||||
$sql = $profilsM->select()
|
||||
->from($profilsM, array('id', 'idClient', 'login', 'reference', 'tarifLigne', 'dateAjout', 'dateSuppr', 'actif'));
|
||||
|
||||
if ( !empty($login) ) {
|
||||
$sql->where('login = ?', $login.'%');
|
||||
}
|
||||
if ( $idClient!=null ) {
|
||||
$sql->where('idClient = ?', $idClient);
|
||||
}
|
||||
|
||||
$profils = $profilsM->fetchAll($sql);
|
||||
|
||||
$this->view->assign('profils', $profils);
|
||||
}
|
||||
|
||||
/**
|
||||
* Define fields for extraction to user
|
||||
*/
|
||||
public function profiladdAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
//Get default profil
|
||||
$profilClientM = new Application_Model_CustomerParams();
|
||||
$profilClient = $profilClientM->find($request->getParam('idClient'));
|
||||
|
||||
//Sauvegarde du formulaire
|
||||
if ( $request->isPost() ){
|
||||
$params = $request->getParams();
|
||||
|
||||
if ($params['reference']=='default') {
|
||||
$params['criteres'] = json_decode($profilClient->current()->criteres,true);
|
||||
}
|
||||
|
||||
$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'],
|
||||
'service' => $params['service'],
|
||||
'login' => $params['login'],
|
||||
'reference' => $params['reference'],
|
||||
'criteres' => json_encode($params['criteres']),
|
||||
'dataInsee' => $dataInsee,
|
||||
'dateAjout' => date('Y-m-d H:i:s'),
|
||||
'actif' => 1,
|
||||
);
|
||||
$profilM = new Application_Model_EnrichissementProfils();
|
||||
if ( $profilM->insert($data) ){
|
||||
$this->view->assign('message', "Profil enregistré");
|
||||
$this->view->assign('disableForm', true);
|
||||
} else {
|
||||
$this->view->assign('message', "Erreur lors de la sauvegarde");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Affichage du formulaire
|
||||
require_once 'Scores/Enrichissement.php';
|
||||
$fieldsM = new Enrichissement();
|
||||
$allFields = $fieldsM->getFields();
|
||||
$this->view->assign('fields', $allFields);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark profil as deleted
|
||||
*/
|
||||
public function profildelAction()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* List commands which must be done
|
||||
*/
|
||||
public function commandesAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
|
||||
$commandesM = new Application_Model_EnrichissementIdentifiants();
|
||||
$sql = $commandesM->select()->setIntegrityCheck(false)
|
||||
->from('enrichissement_identifiants AS e', array(
|
||||
'e.id',
|
||||
'e.reference AS commandeReference',
|
||||
'e.nbLigneTotales',
|
||||
'e.uniteInsee',
|
||||
"DATE_FORMAT(e.dateAdded, '%Y/%m/%d %H:%i:%s') AS dateAdded"
|
||||
))
|
||||
->join('ciblage_criteres', 'idCriteres = ciblage_criteres.id', array(
|
||||
'ciblage_criteres.reference AS critereReference',
|
||||
'ciblage_criteres.login',
|
||||
))
|
||||
->where('e.dateStart = ?', "0000-00-00 00:00:00")
|
||||
->where('fichier = ""')
|
||||
->order('e.dateAdded DESC');
|
||||
|
||||
$this->view->commandes = $commandesM->fetchAll($sql)->toArray();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* List commands with a file
|
||||
*/
|
||||
public function enrichissementsAction()
|
||||
{
|
||||
$commandesM = new Application_Model_EnrichissementIdentifiants();
|
||||
$sql = $commandesM->select()->setIntegrityCheck(false)
|
||||
->from('enrichissement_identifiants AS e', array(
|
||||
'e.id',
|
||||
'e.reference AS commandeReference',
|
||||
'e.nbLigneTotales',
|
||||
'e.uniteInsee',
|
||||
"DATE_FORMAT(e.dateAdded, '%Y/%m/%d %H:%i:%s') AS dateAdded",
|
||||
'e.fichier'
|
||||
))
|
||||
->join('ciblage_criteres', 'idCriteres = ciblage_criteres.id', array(
|
||||
'ciblage_criteres.reference AS critereReference',
|
||||
'ciblage_criteres.login',
|
||||
))
|
||||
->where('fichier != ""')
|
||||
->order('e.dateAdded DESC');
|
||||
|
||||
$this->view->commandes = $commandesM->fetchAll($sql)->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load enrichissement batch to complete data
|
||||
*/
|
||||
public function enrichitAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$id = $request->getParam('id');
|
||||
exec('php '.APPLICATION_PATH.'/../batch/enrichissement.php --id '.$id.' &');
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract only SIRETs from database
|
||||
* @todo : To csv file
|
||||
*/
|
||||
public function extractAction()
|
||||
{
|
||||
$id = $this->getRequest()->getParam('id');
|
||||
$table = new Application_Model_EnrichissementIdentifiants();
|
||||
$sql = $table->select()->where('idComptage = ?', $id);
|
||||
$result = $table->fetchRow($sql);
|
||||
if(!empty($result)) {
|
||||
$result = $result->toArray();
|
||||
$sirets = json_decode($result['identifiants'], true);
|
||||
$content = '';
|
||||
foreach($sirets as $siret) {
|
||||
$content.= $siret.",";
|
||||
}
|
||||
$this->view->assign('content', $content);
|
||||
|
||||
}else {
|
||||
$this->view->assign('message', 'Aucune commande d\'enrichissement sur ce comptage');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* List criteres and the last count
|
||||
*/
|
||||
public function ciblagesAction()
|
||||
{
|
||||
$comptagesM = new Application_Model_Comptages();
|
||||
|
||||
$sql = $comptagesM->select()->setIntegrityCheck(false)
|
||||
->from('ciblage_comptages', array(
|
||||
'ciblage_comptages.idDefinition',
|
||||
'ciblage_comptages.resultat',
|
||||
'ciblage_comptages.uniteInsee',
|
||||
"DATE_FORMAT(ciblage_comptages.dateAjout, '%Y/%m/%d %H:%i:%s') as dateAjout"
|
||||
))
|
||||
->join('ciblage_criteres', 'ciblage_comptages.idDefinition = ciblage_criteres.id', array('ciblage_criteres.reference'))
|
||||
->order('ciblage_comptages.dateAjout DESC')
|
||||
->group('ciblage_criteres.id');
|
||||
|
||||
$comptages = $comptagesM->fetchAll($sql)->toArray();
|
||||
Zend_Registry::get('firebug')->info($comptages);
|
||||
|
||||
$this->view->comptages = $comptages;
|
||||
}
|
||||
|
||||
/**
|
||||
* List customers
|
||||
*/
|
||||
public function customerparamsAction()
|
||||
{
|
||||
//@todo : what's in database
|
||||
$customersM = new Application_Model_CustomerParams();
|
||||
$sql = $customersM->select()
|
||||
->from($customersM,array('idClient', 'service' , 'dateContrat', 'periodContrat'))
|
||||
->order('dateAdded DESC')
|
||||
->group('idClient');
|
||||
$customers = $customersM->fetchAll($sql)->toArray();
|
||||
|
||||
//List login
|
||||
$customerlist = array();
|
||||
$profilsM = new Application_Model_EnrichissementProfils();
|
||||
foreach($customers as $item) {
|
||||
$sql = $profilsM->select()
|
||||
->from($profilsM, array('login'))
|
||||
->where('idClient=?',$item['idClient']);
|
||||
$result = $profilsM->fetchAll($sql)->toArray();
|
||||
|
||||
$logins = array();
|
||||
if (count($result)>0) {
|
||||
foreach($result as $login) {
|
||||
$logins[] = $login['login'];
|
||||
}
|
||||
}
|
||||
|
||||
$item['logins'] = $logins;
|
||||
$customerlist[] = $item;
|
||||
}
|
||||
$this->view->assign('customerlist', $customerlist);
|
||||
}
|
||||
|
||||
/**
|
||||
* List customer's params
|
||||
*/
|
||||
public function customerparamAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$idClient= $request->getParam('id', null);
|
||||
|
||||
if ($idClient !== null) {
|
||||
$paramsM = new Application_Model_CustomerParams();
|
||||
$params = $paramsM->find($idClient);
|
||||
$infos = null;
|
||||
if ($params->count()>0){
|
||||
$infos = $params->toArray();
|
||||
}
|
||||
$this->view->assign('infos',$infos[0]);
|
||||
|
||||
$loginsM = new Application_Model_EnrichissementProfils();
|
||||
$sql = $loginsM->select()->where('idClient = ?', $idClient);
|
||||
$logins = $loginsM->fetchAll($sql)->toArray();
|
||||
$this->view->assign('logins', $logins);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function customerparamaddAction()
|
||||
{
|
||||
//Fields
|
||||
require_once 'Scores/Enrichissement.php';
|
||||
$fieldsM = new Enrichissement();
|
||||
$allFields = $fieldsM->getFields();
|
||||
$this->view->assign('fields', $allFields);
|
||||
|
||||
$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 ($value=='' && $key!='service') {
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
||||
$checkValues = array(
|
||||
'filterRNCS' => 0,
|
||||
'licenceINSEE' => 0,
|
||||
'immediatExtract' => 0,
|
||||
);
|
||||
foreach ($checkValues as $key => $value) {
|
||||
if (!array_key_exists($key, $params)) {
|
||||
$params[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'idClient' => $params['idClient'],
|
||||
'service' => $params['service'],
|
||||
'filterRNCS' => $params['filterRNCS'],
|
||||
'licenceINSEE' => $params['licenceINSEE'],
|
||||
'immediatExtract' => $params['immediatExtract'],
|
||||
'dateContrat' => $params['dateContrat'],
|
||||
'periodContrat' => $params['periodContrat'],
|
||||
'periodPaiement' => $params['periodPaiement'],
|
||||
'priceLine' => $params['priceLine'],
|
||||
'forfait' => $params['forfait'],
|
||||
'limitLines' => $params['limitLines'],
|
||||
'limitFiles' => $params['limitFiles'],
|
||||
'criteres' => json_encode($params['criteres']),
|
||||
'dataInsee' => $dataInsee,
|
||||
'dateAdded' => date('Y-m-d H:i:s'),
|
||||
);
|
||||
$customerParamsM = new Application_Model_CustomerParams();
|
||||
if ( $customerParamsM->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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
112
application/controllers/IndexController.php
Normal file
112
application/controllers/IndexController.php
Normal file
@ -0,0 +1,112 @@
|
||||
<?php
|
||||
class IndexController extends Zend_Controller_Action
|
||||
{
|
||||
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();
|
||||
|
||||
$fields = new Scores_Fields();
|
||||
|
||||
$infosCriteres = array();
|
||||
|
||||
$decodeCriteres = $fields->getCriteres();
|
||||
|
||||
//Construction affichage des critères
|
||||
foreach ( $decodeCriteres as $key => $item ) {
|
||||
|
||||
$inValue = $fields->getValueLabel($key, $item['in']);
|
||||
$exValue = $fields->getValueLabel($key, $item['ex']);
|
||||
|
||||
$infosCriteres[$key] = array(
|
||||
'label' => $fields->getLabel($key),
|
||||
'in' => $inValue,
|
||||
'ex' => $exValue,
|
||||
);
|
||||
}
|
||||
|
||||
$this->view->infos = $infosCriteres;
|
||||
}
|
||||
|
||||
public function criterelistAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
||||
$request = $this->getRequest();
|
||||
$critere = $request->getParam('key');
|
||||
|
||||
$fields = new Scores_Fields();
|
||||
$values = $fields->getCritere($critere);
|
||||
|
||||
$this->view->assign('critereName', $critere);
|
||||
|
||||
//Inclusion
|
||||
if (count($values['in'])>0) {
|
||||
$inLabels = $fields->getValueLabel($critere, $values['in']);
|
||||
$inValues = array_values($values['in']);
|
||||
$this->view->assign('inLabels', $inLabels);
|
||||
$this->view->assign('inValues', $inValues);
|
||||
}
|
||||
|
||||
//Exclusion
|
||||
if (count($values['ex'])>0) {
|
||||
$exLabels = $fields->getValueLabel($critere, $values['ex']);
|
||||
$exValues = array_values($values['ex']);
|
||||
$this->view->assign('exLabels', $exLabels);
|
||||
$this->view->assign('exValues', $exValues);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function removeAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
||||
$request = $this->getRequest();
|
||||
|
||||
$nameCritereToDelete = $request->getParam('critere');
|
||||
$posInList = $request->getParam('in', false);
|
||||
$posExList = $request->getParam('ex', false);
|
||||
|
||||
$fields = new Scores_Fields();
|
||||
|
||||
if ($posInList!==false) {
|
||||
$fields->unsetCritereValue($nameCritereToDelete, $posInList);
|
||||
} elseif ($posExList!==false) {
|
||||
$fields->unsetCritereValue($nameCritereToDelete, $posExList, true);
|
||||
} else {
|
||||
$fields->unsetCritere($nameCritereToDelete);
|
||||
}
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
//Comptage
|
||||
require_once 'Scores/Ciblage.php';
|
||||
$ciblage = new Ciblage($fields->getValues(), $user->globalRNCS);
|
||||
|
||||
$total = $ciblage->execute();
|
||||
$fields->setNb('total', $total);
|
||||
|
||||
if ($user->preferences['interface']['insee']==1) {
|
||||
$insee = $ciblage->calculRedevanceInsee();
|
||||
} else {
|
||||
$insee = null;
|
||||
}
|
||||
$fields->setNb('insee', $insee);
|
||||
$fields->setCritereSession();
|
||||
|
||||
$this->_redirect('/');
|
||||
}
|
||||
}
|
48
application/controllers/UploadController.php
Normal file
48
application/controllers/UploadController.php
Normal file
@ -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;
|
||||
}*/
|
||||
}
|
||||
}
|
72
application/controllers/UserController.php
Normal file
72
application/controllers/UserController.php
Normal file
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
class UserController extends Zend_Controller_Action
|
||||
{
|
||||
|
||||
/**
|
||||
* Gestion de l'authentification
|
||||
*/
|
||||
public function loginAction()
|
||||
{
|
||||
$this->view->inlineScript()
|
||||
->appendFile('/libs/jquery/jquery.js')
|
||||
->appendFile('/libs/jquery/jquery.infieldlabel.min.js');
|
||||
|
||||
//@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 {
|
||||
$this->_redirect('/');
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->_helper->layout()->disableLayout();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
$refresh = 5;
|
||||
|
||||
$baseUrl = 'http://'.$_SERVER['SERVER_NAME'];
|
||||
if ($_SERVER['SERVER_PORT']!='80') {
|
||||
$baseUrl.= ':'.$_SERVER['SERVER_PORT'];
|
||||
}
|
||||
|
||||
$url = $baseUrl.$this->view->url(array(
|
||||
'controller' => 'user',
|
||||
'action' => 'login',
|
||||
));
|
||||
|
||||
$this->view->assign('url', $url);
|
||||
$this->view->assign('refresh', $refresh);
|
||||
$this->view->headMeta()->appendHttpEquiv('refresh', $refresh.'; url='.$url);
|
||||
$this->render('logout');
|
||||
}
|
||||
|
||||
}
|
||||
|
5
application/models/CodePostaux.php
Normal file
5
application/models/CodePostaux.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Application_Model_CodePostaux extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'fields_codepostaux';
|
||||
}
|
5
application/models/Comptages.php
Normal file
5
application/models/Comptages.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Application_Model_Comptages extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'ciblage_comptages';
|
||||
}
|
5
application/models/Criteres.php
Normal file
5
application/models/Criteres.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Application_Model_Criteres extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'ciblage_criteres';
|
||||
}
|
5
application/models/CustomerParams.php
Normal file
5
application/models/CustomerParams.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Application_Model_CustomerParams extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'customer_params';
|
||||
}
|
5
application/models/Departements.php
Normal file
5
application/models/Departements.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Application_Model_Departements extends Zend_Db_Table_Abstract
|
||||
{
|
||||
public $_name = 'fields_departements';
|
||||
}
|
5
application/models/EnrichissementIdentifiants.php
Normal file
5
application/models/EnrichissementIdentifiants.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Application_Model_EnrichissementIdentifiants extends Zend_Db_Table_Abstract
|
||||
{
|
||||
public $_name = 'enrichissement_identifiants';
|
||||
}
|
5
application/models/EnrichissementProfils.php
Normal file
5
application/models/EnrichissementProfils.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Application_Model_EnrichissementProfils extends Zend_Db_Table_Abstract
|
||||
{
|
||||
public $_name = 'enrichissement_profils';
|
||||
}
|
7
application/models/FormeJuridique.php
Normal file
7
application/models/FormeJuridique.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
class Application_Model_FormeJuridique extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'fields_formejuridique';
|
||||
protected $_primary = 'fjCode';
|
||||
|
||||
}
|
5
application/models/MinMax.php
Normal file
5
application/models/MinMax.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Application_Model_MinMax extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'fields_minmax';
|
||||
}
|
5
application/models/Naf.php
Normal file
5
application/models/Naf.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Application_Model_Naf extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'fields_naf';
|
||||
}
|
5
application/models/Prefs.php
Normal file
5
application/models/Prefs.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
class Application_Model_Prefs extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'customer_prefs';
|
||||
}
|
6
application/models/Regions.php
Normal file
6
application/models/Regions.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
class Application_Model_Regions extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'fields_regions';
|
||||
}
|
||||
|
375
application/views/default/helpers/Field.php
Normal file
375
application/views/default/helpers/Field.php
Normal file
@ -0,0 +1,375 @@
|
||||
<?php
|
||||
class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
|
||||
{
|
||||
protected $display = true;
|
||||
protected $name = '';
|
||||
|
||||
public function Field($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
//Read the dico
|
||||
$fields = new Scores_Fields();
|
||||
$params = $fields->get($name);
|
||||
|
||||
$html = '';
|
||||
|
||||
$label = $labelG = $fields->getLabel($name);
|
||||
|
||||
$title = '';
|
||||
if ( array_key_exists('title', $params) && !empty($params['title']) ) {
|
||||
$title = $params['title'];
|
||||
}
|
||||
|
||||
//How many type of fields is defined
|
||||
$nbFields = count($params['fields']);
|
||||
|
||||
$display = true;
|
||||
|
||||
//If more than one field exist we need to make a special display
|
||||
if ( $nbFields > 1) {
|
||||
$out.= '<div class="fieldgrp clearfix">';
|
||||
$out.= $this->structureLabel($label);
|
||||
$out.= '<div class="field">';
|
||||
foreach ( $params['fields'] as $type => $options )
|
||||
{
|
||||
switch ($type) {
|
||||
case 'tree':
|
||||
$href = $this->view->url(array('controller' => 'arborescence', 'action' => $options['action'], 'key' => $name));
|
||||
$out.= '<a class="arborescence" title="'.$options['title'].'" href="'.$href.'">';
|
||||
$out.= 'Arborescence';
|
||||
$out.= '</a>';
|
||||
break;
|
||||
case 'text':
|
||||
$out.= '<a class="text" title="'.$options['title'].'" href="#" id="'.$name.'" >';
|
||||
$out.= 'Recherche';
|
||||
$out.= '</a>';
|
||||
break;
|
||||
case 'list':
|
||||
$out.= '<a class="dlist" title="'.$options['title'].'" href="#" id="'.$name.'" >';
|
||||
$out.= 'Liste';
|
||||
$out.= '</a>';
|
||||
break;
|
||||
}
|
||||
$out.= ' ';
|
||||
}
|
||||
$out.= '</div>';
|
||||
$out.= '</div>';
|
||||
//Masquer les champs
|
||||
$display = false;
|
||||
}
|
||||
|
||||
//Draw fields
|
||||
foreach ( $params['fields'] as $type => $options )
|
||||
{
|
||||
switch($type)
|
||||
{
|
||||
case 'select':
|
||||
$html = $this->selectHTML($name, $options);
|
||||
break;
|
||||
case 'selectMultiple':
|
||||
$html = $this->selectMultipleHTML($name, $options);
|
||||
break;
|
||||
case 'intervalSelect':
|
||||
$html = $this->intervalSelectHTML($name, $options);
|
||||
break;
|
||||
case 'checkbox':
|
||||
$html = $this->checkboxHTML($name, $options);
|
||||
break;
|
||||
case 'intervalDate':
|
||||
$html = $this->intervalDateHTML($name, $options);
|
||||
break;
|
||||
case 'interval':
|
||||
$html = $this->intervalHTML($name, $field);
|
||||
break;
|
||||
case 'date':
|
||||
$html = $this->dateHTML($name, $field);
|
||||
break;
|
||||
case 'text':
|
||||
$html = $this->textHTML($name, $options);
|
||||
break;
|
||||
case 'textarea':
|
||||
$html = $this->textareaHTML($name, $field);
|
||||
break;
|
||||
case 'radio':
|
||||
$html = $this->radioHTML($name, $field);
|
||||
break;
|
||||
case 'file':
|
||||
$html = $this->fileuploadHtml($name, $field);
|
||||
break;
|
||||
case 'tree':
|
||||
//Do nothing
|
||||
break;
|
||||
case 'list':
|
||||
$html = $this->textareaHTML($name, $options);
|
||||
break;
|
||||
default:
|
||||
$html = $this->structureHTML($name, '');
|
||||
break;
|
||||
}
|
||||
|
||||
$label = $labelG;
|
||||
if ( array_key_exists('label', $options) ) {
|
||||
$label = $options['label'];
|
||||
}
|
||||
|
||||
$style = '';
|
||||
$class = ' class="fieldgrp"';
|
||||
if ( $display===false ) {
|
||||
$style = ' style="display:none;"';
|
||||
}
|
||||
if ( !empty($title) ) {
|
||||
$title = ' title="'.$title.'"';
|
||||
}
|
||||
|
||||
$out.= '<div id="field_'.$type.'_'.$this->name.'" '.$class.''.$style.''.$title.'>';
|
||||
$out.= $this->structureLabel($label);
|
||||
$out.= '<div class="field">'.$html.'</div>';
|
||||
$out.= '</div>';
|
||||
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Définition du label
|
||||
* @param unknown_type $label
|
||||
*/
|
||||
private function structureLabel($label)
|
||||
{
|
||||
$return = '<label>'.$label.'</label>';
|
||||
return $return;
|
||||
}
|
||||
|
||||
protected function getMinMax($name, $valeur)
|
||||
{
|
||||
if(!empty($name)) {
|
||||
//$fields = new Scores_Fields();
|
||||
//$default = $fields->getMinMax($name);
|
||||
if(empty($valeur[0])){$valeur[0] = $default[0]['min'];}
|
||||
if(empty($valeur[1])){$valeur[1] = $default[0]['max'];}
|
||||
}
|
||||
return ($valeur);
|
||||
}
|
||||
|
||||
private function intervalSelectHTML($name, $options)
|
||||
{
|
||||
$session = new Scores_Fields();
|
||||
$sessionValeur = explode(',', $session->getCritere($name));
|
||||
|
||||
$minMax = $this->getMinMax($name, array(0,0));
|
||||
|
||||
$return = '<select class="intervalSelect" name="'.$name.'1" id="'.$name.'" number="1">';
|
||||
foreach($options['value'] as $elements) {
|
||||
if($elements[0] == 0)
|
||||
$return .= '<option value="'.$minMax[0].'">Min</option>';
|
||||
else
|
||||
$return .= '<option '.(($sessionValeur[0] == $elements[0])?'selected':'').' value="'. $elements[0].'">'.number_format($elements[0], 0,'', ' ').'</option>';
|
||||
}
|
||||
|
||||
$return .= '</select> à ';
|
||||
$return .= '<select class="intervalSelect" name="'.$name.'2" id="'.$name.'" number="2">';
|
||||
foreach($options['value'] as $elements) {
|
||||
if($elements[1] == 0)
|
||||
$return .= '<option value="'.$minMax[1].'">Max</option>';
|
||||
else
|
||||
$return .= '<option '.(($sessionValeur[1] == $elements[1])?'selected':'').' value="'. $elements[1].'">'.number_format($elements[1], 0,'', ' ').'</option>';
|
||||
}
|
||||
|
||||
$return .= '</select>';
|
||||
$return .= ' <span id="'.$name.'"><a href="" class="intervalSelect" id="'.$name.'">Valider</a></span>';
|
||||
return ($return);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param unknown_type $name
|
||||
* @param unknown_type $options
|
||||
*/
|
||||
protected function checkboxHTML($name, $options)
|
||||
{
|
||||
$session = new Scores_Fields();
|
||||
$sessionValeur = $session->getCritere($name);
|
||||
|
||||
$select = '';
|
||||
if ($sessionValeur==1) $select = ' checked';
|
||||
$return = '<input type="checkbox" class="criteres" name="'.$name.'" value="'.$options['value'].'"'.$select.'>';
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param unknown_type $name
|
||||
* @param unknown_type $options
|
||||
* @return string
|
||||
*/
|
||||
protected function selectMultipleHTML($name, $options)
|
||||
{
|
||||
$session = new Scores_Fields();
|
||||
$sessionValeur = $session->getCritere($name);
|
||||
|
||||
$return = '<select size="'.count($options['value']).'" class="criteres " name="'.$name.'" multiple>';
|
||||
foreach($options['value'] as $value => $label) {
|
||||
$selected = "";
|
||||
if( !empty($sessionValeur) ) {
|
||||
if ( is_array($sessionValeur) && in_array($value, $sessionValeur) ) {
|
||||
$selected = " selected";
|
||||
}
|
||||
}
|
||||
$return .= '<option'.$selected.' value="'.$value.'">'.$label.'</option>';
|
||||
}
|
||||
$return .= '</select>';
|
||||
$return .= '<a href="#" class="selectMultiple">Sélectionner</a>';
|
||||
$return .= ' <a href="#" class="selectMultipleEx">Exclure</a>';
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param unknown_type $name
|
||||
* @param unknown_type $options
|
||||
* @return string
|
||||
*/
|
||||
protected function selectHTML($name, $options)
|
||||
{
|
||||
$session = new Scores_Fields();
|
||||
$sessionValeur = $session->getCritere($name);
|
||||
|
||||
if( is_array($sessionValeur) ) {
|
||||
$sessionValeur = implode(',', $sessionValeur);
|
||||
}
|
||||
|
||||
$return = '<select class="criteres" name="'.$name.'">';
|
||||
$return .= '<option '.(($sessionValeur == '-')?'selected':'').' value="-">-</option>';
|
||||
|
||||
foreach($options['value'] as $value => $label) {
|
||||
$selected = "";
|
||||
if( $sessionValeur!==null && $sessionValeur != "-" && $sessionValeur==$value )
|
||||
$selected = " selected";
|
||||
$return .= '<option'.$selected.' value="'.$value.'">'.$label.'</option>';
|
||||
}
|
||||
$return .= '</select>';
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
protected function intervalDateHTML($name, $options)
|
||||
{
|
||||
$session = new Scores_Fields();
|
||||
$sessionValeur = $session->getCritere($name);
|
||||
|
||||
$return = '';
|
||||
|
||||
$return.= '<select name="'.$name.'1_j" style="width:40px;">';
|
||||
for ($i=1;$i<=31;$i++) {
|
||||
$return.= '<option>'.str_pad($i,2,'0',STR_PAD_LEFT).'</option>';
|
||||
}
|
||||
$return.= '</select>';
|
||||
$return.= '<select name="'.$name.'1_m" style="width:40px;">';
|
||||
for ($i=1;$i<=12;$i++) {
|
||||
$return.= '<option>'.str_pad($i,2,'0',STR_PAD_LEFT).'</option>';
|
||||
}
|
||||
$return.= '</select>';
|
||||
$return.= '<select name="'.$name.'1_a" style="width:55px;">';
|
||||
for ($i=1900;$i<=date('Y');$i++) {
|
||||
$return.= '<option>'.$i.'</option>';
|
||||
}
|
||||
$return.= '</select>';
|
||||
|
||||
$return.= ' au ';
|
||||
|
||||
$return.= '<select name="'.$name.'2_j" style="width:40px;">';
|
||||
for ($i=1;$i<=31;$i++) {
|
||||
$select = '';
|
||||
if ($i==date('d')) {
|
||||
$select = ' selected';
|
||||
}
|
||||
$return.= '<option'.$select.'>'.str_pad($i,2,'0',STR_PAD_LEFT).'</option>';
|
||||
}
|
||||
$return.= '</select>';
|
||||
$return.= '<select name="'.$name.'2_m" style="width:40px;">';
|
||||
for ($i=1;$i<=12;$i++) {
|
||||
$select = '';
|
||||
if ($i==date('m')) {
|
||||
$select = ' selected';
|
||||
}
|
||||
$return.= '<option'.$select.'>'.str_pad($i,2,'0',STR_PAD_LEFT).'</option>';
|
||||
}
|
||||
$return.= '</select>';
|
||||
$return.= '<select name="'.$name.'2_a" style="width:55px;">';
|
||||
$lastYear = date('Y');
|
||||
for ($i=1900;$i<=$lastYear;$i++) {
|
||||
$select = '';
|
||||
if ($i==$lastYear) {
|
||||
$select = ' selected';
|
||||
}
|
||||
$return.= '<option'.$select.'>'.$i.'</option>';
|
||||
}
|
||||
$return.= '</select>';
|
||||
$return .= '<br/><a href="#" id="'.$name.'" class="intervalDate">Valider</a>';
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
||||
/* Interval */
|
||||
private function intervalHTML($name, $field)
|
||||
{
|
||||
$session = new Scores_Fields();
|
||||
$valeur = $session->getCritere($name);
|
||||
|
||||
$return = '<div class="interval" >';
|
||||
$return .= '<input class="'.$field['class'].'" type="text" name="'.$name.'1" value="'.$valeur[0].'" /> à ';
|
||||
$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 Scores_Fields();
|
||||
|
||||
$return = '<div class="date" >';
|
||||
$return .= '<input value="'.$session->getCritere($name).'" type="text" class="datepicker" name="'.$name.'1" /> a ';
|
||||
$return .= '<input type="text" class="datepicker" name="'.$name.'2" />';
|
||||
$return .= '</div>';
|
||||
|
||||
return ($return);
|
||||
}
|
||||
|
||||
/* Textes */
|
||||
protected function textHTML($name, $options)
|
||||
{
|
||||
$return = '<input type="text" class="criteres autocomplete" name="'.$name.'" />';
|
||||
$return.= '<ul id="selectqueries"></ul>';
|
||||
$return.= '<a href="#" class="autocomplete">Sélectionner</a>';
|
||||
$return.= ' <a href="#" class="autocompleteEx">Exclure</a>';
|
||||
return $return;
|
||||
}
|
||||
|
||||
/* Textarea */
|
||||
protected function textareaHTML($name, $field)
|
||||
{
|
||||
$return = '<textarea class="criteres" name="'.$name.'" ></textarea>';
|
||||
$return.= '<a href="#" class="list">Sélectionner</a>';
|
||||
$return.= ' <a href="#" class="listEx">Exclure</a>';
|
||||
return $return;
|
||||
}
|
||||
|
||||
private function fileuploadHtml($name, $field)
|
||||
{
|
||||
$return = '<input class="upload" type="file" name="fichier" id="'.$name.'" /> ';
|
||||
return ($return);
|
||||
}
|
||||
|
||||
/* Radios */
|
||||
private function radioHTML($name, $field, $item)
|
||||
{
|
||||
$return = '<input type="radio" name="'.$name.'" />';
|
||||
return ($return);
|
||||
}
|
||||
}
|
1
application/views/default/scripts/aide/aproposde.phtml
Normal file
1
application/views/default/scripts/aide/aproposde.phtml
Normal file
@ -0,0 +1 @@
|
||||
<?php
|
54
application/views/default/scripts/aide/index.phtml
Normal file
54
application/views/default/scripts/aide/index.phtml
Normal file
@ -0,0 +1,54 @@
|
||||
<div id="help">
|
||||
|
||||
<h2>Préambule</h2>
|
||||
<p>
|
||||
L'application se décompose en deux parties : <br/>
|
||||
- La partie ciblage<br/>
|
||||
|
||||
<br/><br/>
|
||||
- La partie enrichissement<br/>
|
||||
|
||||
<br/>
|
||||
</p>
|
||||
|
||||
<h2>Description de l'interface</h2>
|
||||
<p>
|
||||
Menu
|
||||
|
||||
Résumé des critères
|
||||
|
||||
</p>
|
||||
<br/>
|
||||
|
||||
|
||||
<h2>Fonctionnement des champs</h2>
|
||||
|
||||
<ul>
|
||||
<li>Champs de sélection simple
|
||||
image
|
||||
<p>Plusieurs choix sont proposés, une seul sélection possible ,à chaque changement le
|
||||
ciblage est actualisé</p>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
Champs de sélection multiple
|
||||
<p>Plusieurs choix et sélection multiple, maintenir la touche CTRL lors de chaque selection pour des
|
||||
critères multiples. Utiliser les liens "Sélectionner" pour inclure les filtres ou "Exclure".
|
||||
</p>
|
||||
</li>
|
||||
|
||||
<li>Arborescence
|
||||
<p>Les arborescences propose</p>
|
||||
</li>
|
||||
|
||||
<li>Intervalle
|
||||
<p>Les intervalles prédéfinies avec des valeurs,</p>
|
||||
<p>Les intervalles à remplir, permette de définir une tranche, seul le minimum ou le maximum peuvent
|
||||
être inscrit, les valeurs extrêmes sont automatiquement définies .</p>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
8
application/views/default/scripts/aide/message.phtml
Normal file
8
application/views/default/scripts/aide/message.phtml
Normal file
@ -0,0 +1,8 @@
|
||||
<div id="help">
|
||||
<?php if ($this->typeMsg == 'support') {?>
|
||||
Les paramètres de votre compte n'ont pas été définis. <br/>Veuillez contacter le <a href="mailto:support@scores-decisions.com">support</a>.
|
||||
<br/>Par mail : <a href="mailto:support@scores-decisions.com">support@scores-decisions.com</a>
|
||||
<br/>Par téléphone : 00 00 00 00 00
|
||||
<br/>Ou contactez votre commercial.
|
||||
<?php }?>
|
||||
</div>
|
@ -0,0 +1,20 @@
|
||||
<div id="<?=$this->key?>" class="jstree jstree-default" style="overflow:auto;"></div>
|
||||
<script>
|
||||
$("div#<?=$this->key?>").jstree({
|
||||
"themes" : {
|
||||
"theme" : "default",
|
||||
"url" : "/libs/tree/themes/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>
|
||||
$("div#<?=$this->key?>").jstree({
|
||||
"themes" : {
|
||||
"theme" : "default",
|
||||
"url" : "/libs/tree/themes/classic/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>
|
20
application/views/default/scripts/arborescence/naf.phtml
Normal file
20
application/views/default/scripts/arborescence/naf.phtml
Normal file
@ -0,0 +1,20 @@
|
||||
<div id="<?=$this->key?>" class="jstree jstree-default" style="overflow:auto;"></div>
|
||||
<script>
|
||||
$("div#<?=$this->key?>").jstree({
|
||||
"themes" : {
|
||||
"theme" : "default",
|
||||
"url" : "/libs/tree/themes/classic/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>
|
1
application/views/default/scripts/comptage/index.phtml
Normal file
1
application/views/default/scripts/comptage/index.phtml
Normal file
@ -0,0 +1 @@
|
||||
<?=json_encode($this->result)?>
|
@ -0,0 +1,29 @@
|
||||
<style>
|
||||
.color{
|
||||
background-color: #DCE3FC;
|
||||
}
|
||||
</style>
|
||||
<div style="width:100%;">
|
||||
<table width="100%" style="font-size:10px;">
|
||||
<tr>
|
||||
<?php foreach($this->label as $label): ?>
|
||||
<th style="border-left:1px solid black;padding:2px;"><b><?=$label?></b></th>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php
|
||||
$i=0;
|
||||
if(count($this->liste) > 0) {
|
||||
foreach($this->liste as $line) {
|
||||
echo '<tr '.((($i%2) == 0)?'class="color"':'').'>';
|
||||
foreach($line as $col) {
|
||||
echo '<td style="border-left:1px solid silver;padding:2px">'.$col.'</td>';
|
||||
}
|
||||
echo '</tr>';
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
echo '<tr><td>Vous n\'avez selectionné aucuns critères</td></tr>';
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<div>
|
48
application/views/default/scripts/comptage/savedialog.phtml
Normal file
48
application/views/default/scripts/comptage/savedialog.phtml
Normal file
@ -0,0 +1,48 @@
|
||||
<?php if ($this->noSelection) { ?>
|
||||
Vous n'avez pas sélectionné de critères !
|
||||
<?php } else {?>
|
||||
<style>
|
||||
span.message {
|
||||
font-size:0.7em;
|
||||
font-style: italic;
|
||||
}
|
||||
</style>
|
||||
<div id="result">
|
||||
<form method="post" id="save" name="save" action="<?=$this->url(array('controller'=>'comptage', 'action'=>'save'))?>">
|
||||
<label>Votre référence : </label><input type="text" name="ref" value="<?=$this->reference?>" />
|
||||
</form>
|
||||
<span class="message" style="color:#ff0000;"></span>
|
||||
<span class="message">
|
||||
La saisie d'une référence vous permettra de suivre vos ciblages et vos commandes.<br/>
|
||||
Les accents et les carractères spéciaux, seront remplacés automatiquement.<br/>
|
||||
Les espaces seront remplacés par "_"
|
||||
</span>
|
||||
|
||||
</div>
|
||||
<script type="text/javascript" src="/libs/form/jquery.form.js"></script>
|
||||
<script>
|
||||
$('#dialog').dialog({
|
||||
buttons: [ {
|
||||
text: "Enregistrer",
|
||||
click: function() {
|
||||
var options = {
|
||||
target: '#result',
|
||||
dataType: 'json',
|
||||
beforeSubmit: function(){},
|
||||
success: function(data){
|
||||
if (data.error == 0) {
|
||||
$('#result').html(data.msg);
|
||||
//@todo : Voir
|
||||
$(location).attr('href',data.href);
|
||||
} else {
|
||||
$('#result span.message').html(data.msg);
|
||||
}
|
||||
}
|
||||
};
|
||||
$('form#save').ajaxSubmit(options);
|
||||
}
|
||||
},
|
||||
{ text: "Annuler", click: function() { $(this).dialog("close"); } }
|
||||
] });
|
||||
</script>
|
||||
<?php }?>
|
1
application/views/default/scripts/comptage/update.phtml
Normal file
1
application/views/default/scripts/comptage/update.phtml
Normal file
@ -0,0 +1 @@
|
||||
<?=json_encode($this->result)?>
|
105
application/views/default/scripts/dashboard/ciblage.phtml
Normal file
105
application/views/default/scripts/dashboard/ciblage.phtml
Normal file
@ -0,0 +1,105 @@
|
||||
<ul class="chemin clearfix rounded_t">
|
||||
<li class="e0"><a class="lir" href="/">Accueil</a></li>
|
||||
<li><a href="/dashboard/index"><span>Tableau de bord</span></a></li>
|
||||
<li class="last"><span>Detail du ciblage (<?=$this->comptageRef?>)</span></li>
|
||||
</ul>
|
||||
|
||||
<div id="dashboard" style="padding:10px">
|
||||
|
||||
<a href="<?=$this->url(array('controller'=> 'index','action'=>'index', 'id'=>$this->comptageId))?>">Charger les critères de ciblage dans l'interface</a> |
|
||||
<a class="update" href="<?=$this->url(array('controller'=> 'comptage','action'=>'update', 'id'=>$this->comptageId))?>">Actualiser le comptage</a> |
|
||||
<a class="enrichissementref" href="<?=$this->url(array('controller'=> 'enrichissement','action'=>'reference', 'id'=>$this->comptageId))?>">Commander un enrichissement</a>
|
||||
|
||||
<fieldset>
|
||||
<legend>Critères</legend>
|
||||
|
||||
<?php foreach ( $this->criteres as $criteres ) { ?>
|
||||
<div>
|
||||
<h3><?=$criteres['label']?></h3>
|
||||
<?php if (is_string($criteres['in'])) {?>
|
||||
<div><?=$criteres['in']?></div>
|
||||
<?php } else {?>
|
||||
|
||||
<?php if ( is_array($criteres['in']) && count($criteres['in'])>0 ) { ?>
|
||||
<div>
|
||||
<p>Inclu :</p>
|
||||
<?php foreach( $criteres['in'] as $item ) {?>
|
||||
<p><?=$item?></p>
|
||||
<?php }?>
|
||||
</div>
|
||||
<?php }?>
|
||||
|
||||
<?php if ( is_array($criteres['ex']) && count($criteres['ex'])>0 ) { ?>
|
||||
<div>
|
||||
<p>Exclu :</p>
|
||||
<?php foreach( $criteres['ex'] as $item ) {?>
|
||||
<p><?=$item?></p>
|
||||
<?php }?>
|
||||
</div>
|
||||
<?php }?>
|
||||
|
||||
<?php }?>
|
||||
</div>
|
||||
<?php }?>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Comptages</legend>
|
||||
<table class="comptages" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Résultat</th>
|
||||
<th>Nombre d'unité Insee</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($this->comptages as $comptage):?>
|
||||
<tr>
|
||||
<th><?=substr($comptage['dateAjout'],8,2).'/'.substr($comptage['dateAjout'],5,2).'/'.substr($comptage['dateAjout'],0,4)
|
||||
.' '.substr($comptage['dateAjout'],11,2).':'.substr($comptage['dateAjout'],14,2).':'.substr($comptage['dateAjout'],17,2)?></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/<?=$item['id']?>"><?=$item['fichier']?></a>
|
||||
<?php else: ?>
|
||||
En attente de traitement
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php } else {?>
|
||||
<a class="enrichissementref" href="<?=$this->url(array('controller'=> 'enrichissement','action'=>'reference', 'id'=>$this->comptageId))?>">Commander un enrichissement</a>
|
||||
<?php }?>
|
||||
</fieldset>
|
||||
|
||||
|
||||
</div>
|
50
application/views/default/scripts/dashboard/ciblages.phtml
Normal file
50
application/views/default/scripts/dashboard/ciblages.phtml
Normal file
@ -0,0 +1,50 @@
|
||||
<ul class="chemin clearfix rounded_t">
|
||||
<li class="e0"><a class="lir" href="/">Accueil</a></li>
|
||||
<li>
|
||||
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'index'))?>">
|
||||
<span>Tableau de bord</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="last">
|
||||
<span>Liste de vos ciblages</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="dashboard">
|
||||
|
||||
<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 href="<?=$this->url(array('controller'=> 'dashboard','action'=>'ciblage', 'id'=>$item['id']))?>">Detail</a></td>
|
||||
<td><a href="<?=$this->url(array('controller'=> 'index','action'=>'index', 'id'=>$item['id']))?>">Charger les critères de ciblage dans l'interface</a></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php else:?>
|
||||
<p>Aucun ciblage.<p>
|
||||
<?php endif;?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
@ -0,0 +1,79 @@
|
||||
<ul class="chemin clearfix rounded_t">
|
||||
<li class="e0"><a class="lir" href="/">Accueil</a></li>
|
||||
<li>
|
||||
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'index'))?>">
|
||||
<span>Tableau de bord</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="last">
|
||||
<span>Préférences</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="dashboard">
|
||||
|
||||
<h2>Paramètres de votre compte</h2>
|
||||
<p>Licence INSEE : paiement à chaque extraction, non comptabilisé (déjà licencié)</p>
|
||||
<p>Filtre RNCS : actif, désactiver</p>
|
||||
<p>Extraction possible de xxx lignes, nombre de fichiers illimités sur la durée du contrat</p>
|
||||
<p>Extraction possible de xxx lignes par fichier, nombre de fichiers maximums x sur la durée du contrat</p>
|
||||
|
||||
<br/>
|
||||
<h2>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>
|
||||
<p>
|
||||
Afin de choisir les critères à masquer :
|
||||
<a href="#" title="Activer le mode personnalisation afin de créer/modifier les préférences d'affichage">
|
||||
Activer le mode personnalisation
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<br/>
|
||||
|
||||
<div>
|
||||
<label>Filtrer au seul périmètre RNCS </label><br/>
|
||||
<span>Les éléments soumis à redevance INSEE sont automatiquement retirer du ciblage</span><br/>
|
||||
<input type="checkbox" name="rncs" value="1" <?php if ($this->prefFilterRncs==1) echo ' checked="checked"';?>
|
||||
<?php if ($this->filterRNCS==1) echo ' disabled="disable"';?> />
|
||||
</div>
|
||||
<?php if ($this->filterRNCS==1) {?>
|
||||
<i>Votre compte est paramétré pour ne sélectionner que les entités provenant du RNCS</i>
|
||||
<?php }?>
|
||||
|
||||
<br/>
|
||||
<div>
|
||||
<label>Afficher le nombre d'unité INSEE</label><br/>
|
||||
<span><i>Pour permettre une estimation du cout de la redevance INSEE, en activant cette option,
|
||||
le nombre d'unité insee est affiché à chaque comptage</i></span><br/>
|
||||
<input type="checkbox" name="insee" value="1" <?php if ($this->prefInterfaceInsee==1) echo ' checked="checked"';?>
|
||||
<?php if ($this->filterRNCS==1) echo ' disabled="disable"';?>/>
|
||||
</div>
|
||||
<script>
|
||||
$('input[type=checkbox]').click(function(){
|
||||
if($(this).is(':checked')) {
|
||||
$.post('/dashboard/pref/'+$(this).attr('name')+'/1' , function(data, status) {});
|
||||
} else {
|
||||
$.post('/dashboard/pref/'+$(this).attr('name')+'/0' , function(data, status) {});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<br/>
|
||||
|
||||
|
||||
<h2>Profils d'enrichissement</h2>
|
||||
<?php if ($this->profil) {?>
|
||||
<p>Référence : <?=$this->profil->reference?></p>
|
||||
<p>Tarif à la ligne (redevance INSEE non inclus) : <?=$this->profil->tarif?> euros</p>
|
||||
<p>Liste des données extraites lors d'un enrichissement</p>
|
||||
<?php foreach($this->profil->labels as $label) {?>
|
||||
<?=$label?><br/>
|
||||
<?php }?>
|
||||
<?php } else {?>
|
||||
<p>Aucun profil d'enrichissement (Veuillez contacter le service commercial)</p>
|
||||
<?php }?>
|
||||
|
||||
</div>
|
@ -0,0 +1 @@
|
||||
<?php
|
@ -0,0 +1,101 @@
|
||||
<ul class="chemin clearfix rounded_t">
|
||||
<li class="e0"><a class="lir" href="/">Accueil</a></li>
|
||||
<li>
|
||||
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'index'))?>">
|
||||
<span>Tableau de bord</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="last">
|
||||
<span>Enrichissements</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="dashboard">
|
||||
|
||||
<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>
|
97
application/views/default/scripts/dashboard/index.phtml
Normal file
97
application/views/default/scripts/dashboard/index.phtml
Normal file
@ -0,0 +1,97 @@
|
||||
<ul class="chemin clearfix rounded_t">
|
||||
<li class="e0"><a class="lir" href="/">Accueil</a></li>
|
||||
<li>
|
||||
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'index'))?>">
|
||||
<span>Tableau de bord</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="last">
|
||||
<span></span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="dashboard">
|
||||
|
||||
<div 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 href="<?=$this->url(array('controller'=> 'dashboard','action'=>'ciblage', 'id'=>$item['id']))?>">Detail</a></td>
|
||||
<td><a href="<?=$this->url(array('controller'=> 'index','action'=>'index', 'id'=>$item['id']))?>">Charger les critères de ciblage dans l'interface</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>
|
||||
|
||||
</div>
|
5
application/views/default/scripts/dashboard/pref.phtml
Normal file
5
application/views/default/scripts/dashboard/pref.phtml
Normal file
@ -0,0 +1,5 @@
|
||||
<?php if ($this->nbRow>0) { ?>
|
||||
Préférence enregistrée.
|
||||
<?php } else {?>
|
||||
Erreur lors de l'enregistrement de la préférence.
|
||||
<?php } ?>
|
@ -0,0 +1 @@
|
||||
<?php
|
@ -0,0 +1,8 @@
|
||||
Votre commande a bien été prise en compte sous la référence <?=$this->ref?>
|
||||
|
||||
<script>
|
||||
$('#dialog').dialog({ buttons: [ {
|
||||
text: "Fermer",
|
||||
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,96 @@
|
||||
<?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 } elseif ($this->forfaitRemain<=0) { ?>
|
||||
<p>Le montant de votre forfait est insuffisant
|
||||
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/>
|
||||
|
||||
<table id="enrichissement">
|
||||
<tr>
|
||||
<th>Référence de commande</th><th><?=$this->ref?></th>
|
||||
</tr>
|
||||
<tr><td>Nombre d'unités</td><td><?=number_format($this->resultat, 0, ',', ' ')?></td></tr>
|
||||
<tr><td>Nombre d'unités Insee</td><td><?=number_format($this->uniteInsee, 0, ',', ' ')?></td></tr>
|
||||
<tr>
|
||||
<td>Redevance Insee</td>
|
||||
<td><?=number_format($this->prixInsee, 2, ',', ' ')?> €</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Prix du fichier</td><td><?=number_format($this->prix, 2, ',', ' ')?> €</td>
|
||||
</tr>
|
||||
<tr><td colspan="2"></td></tr>
|
||||
<?php if ($this->forfaitRemain) {?>
|
||||
<tr><td>Forfait Restant</td><td><?=number_format($this->forfaitRemain, 2, ',', ' ')?> €</td></tr>
|
||||
<?php }?>
|
||||
</table>
|
||||
<?php if (!empty($this->infoInsee)) {?>
|
||||
<br/>
|
||||
<p><?=$this->infoInsee?></p>
|
||||
<?php }?>
|
||||
<br/>
|
||||
|
||||
|
||||
<form name="commande" method="post" action="<?=$this->url(array('controller'=>'enrichissement', 'action'=>'commande'))?>">
|
||||
<input type="hidden" name="id" value="<?=$this->id?>" />
|
||||
<input type="hidden" type="text" value="<?=$this->ref?>" name="ref">
|
||||
<input type="hidden" type="text" value="<?=$this->profil?>" name="profil">
|
||||
</form>
|
||||
|
||||
<script>
|
||||
$('#dialog').dialog({ buttons: [ {
|
||||
text: "Commander",
|
||||
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 }?>
|
28
application/views/default/scripts/error/error.phtml
Normal file
28
application/views/default/scripts/error/error.phtml
Normal file
@ -0,0 +1,28 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Zend Framework Default Application</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>An error occurred</h1>
|
||||
<h2><?php echo $this->message ?></h2>
|
||||
|
||||
<?php if (isset($this->exception)): ?>
|
||||
|
||||
<h3>Exception information:</h3>
|
||||
<p>
|
||||
<b>Message:</b> <?php echo $this->exception->getMessage() ?>
|
||||
</p>
|
||||
|
||||
<h3>Stack trace:</h3>
|
||||
<pre><?php echo $this->exception->getTraceAsString() ?>
|
||||
</pre>
|
||||
|
||||
<h3>Request Parameters:</h3>
|
||||
<pre><?php echo var_export($this->request->getParams(), true) ?>
|
||||
</pre>
|
||||
<?php endif ?>
|
||||
|
||||
</body>
|
||||
</html>
|
12
application/views/default/scripts/error/get.phtml
Normal file
12
application/views/default/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 @@
|
||||
<?=json_encode($this->output)?>
|
122
application/views/default/scripts/fields/index.phtml
Normal file
122
application/views/default/scripts/fields/index.phtml
Normal file
@ -0,0 +1,122 @@
|
||||
<ul>
|
||||
<li><a href="#tabs-1">Critères Entreprise</a></li>
|
||||
<li><a href="#tabs-2">Situation économique</a></li>
|
||||
<li><a href="#tabs-3">Secteur géographique</a></li>
|
||||
<li><a href="#tabs-4">Situation juridique</a></li>
|
||||
<li><a href="#tabs-5">Situation financière</a></li>
|
||||
</ul>
|
||||
<div id="tabs-1">
|
||||
<div id="entreprise">
|
||||
<ul id="fieldsblock">
|
||||
<li><?=$this->Field('siege')?></li>
|
||||
<li><?=$this->Field('groupe')?></li>
|
||||
<li><?=$this->Field('tel')?></li>
|
||||
<li><?=$this->Field('fax')?></li>
|
||||
<li><?=$this->Field('web')?></li>
|
||||
<li><?=$this->Field('mail')?></li>
|
||||
<li><?=$this->Field('presentRcs')?></li>
|
||||
<li><?=$this->Field('adrDom')?></li>
|
||||
<li><?=$this->Field('dirNom')?></li>
|
||||
<li><?=$this->Field('dateCrea_etab')?></li>
|
||||
<li><?=$this->Field('participation')?></li>
|
||||
<li class="advanced"><?=$this->Field('nbMPubli')?></li>
|
||||
<li class="advanced"><?=$this->Field('dateCrea_ent')?></li>
|
||||
<li class="advanced"><?=$this->Field('action')?></li>
|
||||
<li class="advanced"><?=$this->Field('nbActio')?></li>
|
||||
<li class="advanced"><?=$this->Field('nbPart')?></li>
|
||||
<li class="mode"><img src="/themes/default/images/fleche-bas.gif" /></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="link">
|
||||
<a class="resetFamille" id="entreprise">Réinitialiser les critères entreprises</a>
|
||||
</div>
|
||||
</div>
|
||||
<div id="tabs-2">
|
||||
<div id="economique">
|
||||
<ul id="fieldsblock">
|
||||
<li><?=$this->Field('capital')?></li>
|
||||
<li><?=$this->Field('ape_entrep')?></li>
|
||||
<li class="advanced"><?=$this->Field('ape_etab')?></li>
|
||||
<li><?=$this->Field('age_entrep')?></li>
|
||||
<li class="advanced"><?=$this->Field('age_etab')?></li>
|
||||
<li><?=$this->Field('teff_entrep')?></li>
|
||||
<li class="advanced"><?=$this->Field('teff_etab')?></li>
|
||||
<li><?=$this->Field('eff_entrep')?></li>
|
||||
<li class="advanced"><?=$this->Field('eff_etab')?></li>
|
||||
<li class="advanced"><?=$this->Field('nbEtab')?></li>
|
||||
<li class="mode"><img src="/themes/default/images/fleche-bas.gif" /></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div style="text-align:right;margin-top:20px;">
|
||||
<a class="resetFamille" id="economique">Réinitialiser les critères economiques</a>
|
||||
</div>
|
||||
</div>
|
||||
<div id="tabs-3">
|
||||
<div id="geographique">
|
||||
<ul id="fieldsblock">
|
||||
<li>
|
||||
<?=$this->Field('geo')?>
|
||||
<?=$this->Field('geo_domtom')?>
|
||||
<?=$this->Field('geo_etranger')?>
|
||||
<?=$this->Field('geo_corse')?>
|
||||
</li>
|
||||
<li class="advanced"><?=$this->Field('codespostaux')?></li>
|
||||
<li class="advanced"><?=$this->Field('codesinsee')?></li>
|
||||
<li><?=$this->Field('zus')?></li>
|
||||
<li><?=$this->Field('zru')?></li>
|
||||
<li><?=$this->Field('zfu')?></li>
|
||||
<li><?=$this->Field('cucs')?></li>
|
||||
<li><?=$this->Field('zrr')?></li>
|
||||
<li><?=$this->Field('zafr')?></li>
|
||||
<li class="mode"><img src="/themes/default/images/fleche-bas.gif" /></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div style="text-align:right;margin-top:20px;">
|
||||
<a class="resetFamille" id="econmique">Réinitialiser les critères geographiques</a>
|
||||
</div>
|
||||
</div>
|
||||
<div id="tabs-4">
|
||||
<div id="juridique">
|
||||
<ul id="fieldsblock">
|
||||
<li><?=$this->Field('cj')?></li>
|
||||
<li class="advanced"><?=$this->Field('cjlist')?></li>
|
||||
<li><?=$this->Field('actifEco')?></li>
|
||||
<li><?=$this->Field('procolHisto')?></li>
|
||||
<li><?=$this->Field('dateImmat')?></li>
|
||||
<li class="advanced"><?=$this->Field('tvaIntraValide')?></li>
|
||||
<li class="mode"><img src="/themes/default/images/fleche-bas.gif" /></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div style="text-align:right;margin-top:20px;">
|
||||
<a class="resetFamille" id="econmique">Réinitialiser les critères juridique</a>
|
||||
</div>
|
||||
</div>
|
||||
<div id="tabs-5">
|
||||
<div id="financiere">
|
||||
<ul id="fieldsblock">
|
||||
<li><?=$this->Field('bilType')?></li>
|
||||
<li><?=$this->Field('avisCs')?></li>
|
||||
<li><?=$this->Field('bilAnnee')?></li>
|
||||
<li><?=$this->Field('bilCloture')?></li>
|
||||
<li><?=$this->Field('bilDuree')?></li>
|
||||
<li><?=$this->Field('bilTca')?></li>
|
||||
<li><?=$this->Field('bilFL')?></li>
|
||||
<li class="advanced"><?=$this->Field('bilEE')?></li>
|
||||
<li class="advanced"><?=$this->Field('bilFK')?></li>
|
||||
<li class="advanced"><?=$this->Field('bilFR')?></li>
|
||||
<li class="advanced"><?=$this->Field('bilGF')?></li>
|
||||
<li class="advanced"><?=$this->Field('bilGP')?></li>
|
||||
<li class="advanced"><?=$this->Field('bilGW')?></li>
|
||||
<li class="advanced"><?=$this->Field('bilHD')?></li>
|
||||
<li class="advanced"><?=$this->Field('bilHH')?></li>
|
||||
<li class="advanced"><?=$this->Field('bilHL')?></li>
|
||||
<li class="advanced"><?=$this->Field('bilHM')?></li>
|
||||
<li class="advanced"><?=$this->Field('bilHN')?></li>
|
||||
<li class="advanced"><?=$this->Field('bilYP')?></li>
|
||||
<li class="mode"><img src="/themes/default/images/fleche-bas.gif" /></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div style="text-align:right;margin-top:20px;">
|
||||
<a class="resetFamille" id="financier">Réinitialiser les critères financiers</a>
|
||||
</div>
|
||||
</div>
|
1
application/views/default/scripts/footer.phtml
Normal file
1
application/views/default/scripts/footer.phtml
Normal file
@ -0,0 +1 @@
|
||||
<?php
|
27
application/views/default/scripts/gestion/ciblages.phtml
Normal file
27
application/views/default/scripts/gestion/ciblages.phtml
Normal file
@ -0,0 +1,27 @@
|
||||
<div id="dashboard">
|
||||
<h2>Liste des ciblages</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><?=$comptage['idDefinition']?></td>
|
||||
<td><?=$comptage['dateAjout']?></td>
|
||||
<td><?=$comptage['reference']?></td>
|
||||
<td><?=$comptage['resultat']?></td>
|
||||
<td><?=$comptage['uniteInsee']?></td>
|
||||
<td>
|
||||
<a href="">Actualiser</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
30
application/views/default/scripts/gestion/commandes.phtml
Normal file
30
application/views/default/scripts/gestion/commandes.phtml
Normal file
@ -0,0 +1,30 @@
|
||||
<div id="dashboard">
|
||||
<h2>Liste des commandes</h2>
|
||||
<div>
|
||||
<table>
|
||||
<tr>
|
||||
<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>login</b></th>
|
||||
<th><b>Reférence ciblage</b></th>
|
||||
<th><b>Actions</b></th>
|
||||
</tr>
|
||||
<?php foreach($this->commandes as $item): ?>
|
||||
<tr>
|
||||
<td><?=$item['dateAdded']?></td>
|
||||
<td><?=$item['commandeReference']?></td>
|
||||
<td><?=$item['nbLigneTotales']?></td>
|
||||
<td><?=$item['uniteInsee']?></td>
|
||||
<td><?=$item['login']?></td>
|
||||
<td><?=$item['critereReference']?></td>
|
||||
<td>
|
||||
<a class="enrichissementref" href="<?=$this->url(array('controller'=> 'gestion','action'=>'enrichit', 'id'=>$item['id']))?>">Enrichissement</a>
|
||||
<a href="<?=$this->url(array('controller'=> 'gestion','action'=>'extract', 'id'=>$item['id']))?>">Extraire les sirets</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,53 @@
|
||||
<div id="dashboard">
|
||||
<h2>Paramètres client</h2>
|
||||
|
||||
<table>
|
||||
<tr><td>idClient</td><td><?=$this->infos['idClient']?></td></tr>
|
||||
<tr><td>service</td><td><?=$this->infos['service']?></td></tr>
|
||||
<tr><td>filterRNCS</td><td><?=$this->infos['filterRNCS']?></td></tr>
|
||||
<tr><td>licenceINSEE</td><td><?=$this->infos['licenceINSEE']?></td></tr>
|
||||
<tr><td>immediatExtract</td><td><?=$this->infos['immediatExtract']?></td></tr>
|
||||
<tr><td>dateContrat</td><td><?=$this->infos['dateContrat']?></td></tr>
|
||||
<tr><td>periodContrat</td><td><?=$this->infos['periodContrat']?></td></tr>
|
||||
<tr><td>periodPaiement</td><td><?=$this->infos['periodPaiement']?></td></tr>
|
||||
<tr><td>priceLine</td><td><?=$this->infos['priceLine']?></td></tr>
|
||||
<tr><td>forfait</td><td><?=$this->infos['forfait']?></td></tr>
|
||||
<tr><td>limitLines</td><td><?=$this->infos['limitLines']?></td></tr>
|
||||
<tr><td>limitFiles</td><td><?=$this->infos['limitFiles']?></td></tr>
|
||||
<tr><td>criteres</td><td><pre><?php print_r(json_decode($this->infos['criteres'],true))?></td></tr>
|
||||
<tr><td>dataInsee</td><td><?=$this->infos['dataInsee']?></td></tr>
|
||||
<tr><td>dateAdded</td><td><?=$this->infos['dateAdded']?></td></tr>
|
||||
</table>
|
||||
|
||||
<h2>Logins autorisés</h2>
|
||||
<div class="paragraph">
|
||||
<form method="post" action="<?=$this->url(array('controller'=>'gestion', 'action'=>'profiladd'), null, true)?>">
|
||||
<input type="hidden" name="idClient" value="<?=$this->infos['idClient']?>" />
|
||||
<input type="hidden" name="service" value="<?=$this->infos['service']?>" />
|
||||
<input type="hidden" name="reference" value="default" />
|
||||
<label>Login : </label><input type="text" name="login" value="" />
|
||||
<input type="submit" value="Ajouter un login avec le profil du client" />
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="paragraph">
|
||||
<table>
|
||||
<tr><td>Login</td><td>Service</td><td>Profil</td><td>Action</td></tr>
|
||||
<?php foreach ($this->logins as $login) {?>
|
||||
<tr>
|
||||
<td><?=$login['login']?></td>
|
||||
<td><?=$login['service']?></td>
|
||||
<td><?=$login['reference']?></td>
|
||||
<td>
|
||||
<?php if ($login['reference']=='default') {?>
|
||||
<a href="<?=$this->url(array('controller'=>'gestion', 'action'=>'profiladd'))?>">Ajouter un profil</a>
|
||||
<a href="">Désactiver</a>
|
||||
<?php }?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }?>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
@ -0,0 +1,78 @@
|
||||
<div id="dashboard">
|
||||
|
||||
<?=$this->message?>
|
||||
|
||||
<form name="profil" method="post" action="<?=$this->url(array('controller'=>'gestion', 'action'=>'customerparamadd'))?>">
|
||||
<label>idClient</label>
|
||||
<input type="text" name="idClient" />
|
||||
<br/>
|
||||
|
||||
<label>service</label>
|
||||
<input type="text" name="service" />
|
||||
<br/>
|
||||
|
||||
<label>filterRNCS</label>
|
||||
<input type="checkbox" name="filterRNCS" value="1" />
|
||||
Filtrer au RNCS
|
||||
<br/>
|
||||
|
||||
<label>licenceINSEE</label>
|
||||
<input type="checkbox" name="licenceINSEE" value="1" />
|
||||
Le client possède la licence INSEE
|
||||
<br/>
|
||||
|
||||
<label>immediatExtract</label>
|
||||
<input type="text" name="immediatExtract" value="0" />
|
||||
Nombre de ligne maximum pour une extraction immédiate
|
||||
<br/>
|
||||
|
||||
<label>dateContrat</label>
|
||||
<input type="text" name="dateContrat" />
|
||||
Date de début du contract (AAAA-MM-JJ)
|
||||
<br/>
|
||||
|
||||
<label>periodContrat</label>
|
||||
<input type="text" name="periodContrat" />
|
||||
Durée du contrat (1,3,6,12 mois)
|
||||
<br/>
|
||||
|
||||
<label>periodPaiement</label>
|
||||
<input type="text" name="periodPaiement" />
|
||||
Emission des factures (tous les 1,3,6,12 mois)
|
||||
<br/>
|
||||
|
||||
<label>priceLine</label>
|
||||
<input type="text" name="priceLine" /> €
|
||||
Prix à la ligne (obligatoire même en forfait pour pouvoir décompter)
|
||||
<br/>
|
||||
|
||||
<label>forfait</label>
|
||||
<input type="text" name="forfait" value="0" />
|
||||
Montant du forfait pour l'extraction de fichier
|
||||
<br/>
|
||||
|
||||
<label>limitLines</label>
|
||||
<input type="text" name="limitLines" value="50000" />
|
||||
Nombre maximal de lignes dans un fichier
|
||||
<br/>
|
||||
|
||||
<label>limitFiles</label>
|
||||
<input type="text" name="limitFiles" value="0" />
|
||||
Nombre maximal de fichier pouvant être extrait
|
||||
<br/>
|
||||
|
||||
<div>
|
||||
<label>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>
|
@ -0,0 +1,35 @@
|
||||
<div id="dashboard">
|
||||
|
||||
<h2>Liste des paramètres clients</h2>
|
||||
<div class="paragraph">
|
||||
<a href="<?=$this->url(array('controller'=>'gestion', 'action'=>'customerparamadd'))?>">Ajouter un client</a>
|
||||
</div>
|
||||
|
||||
<div class="paragraph">
|
||||
<table>
|
||||
<tr>
|
||||
<th>idClient</th>
|
||||
<th>Début du contrat</th>
|
||||
<th>Durée contrat</th>
|
||||
<th>Logins ouvert</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
<?php foreach($this->customerlist as $item) {?>
|
||||
<tr>
|
||||
<td><?=$item['idClient']?></td>
|
||||
<td><?=$item['dateContrat']?></td>
|
||||
<td><?=$item['periodContrat']?></td>
|
||||
<td>
|
||||
<?php foreach ($item['logins'] as $login) {?>
|
||||
<?=$login?><br/>
|
||||
<?php }?>
|
||||
</td>
|
||||
<td><a href="<?=$this->url(array('controller'=>'gestion', 'action'=>'customerparam', 'id'=>$item['idClient']))?>">Détail</a></td>
|
||||
</tr>
|
||||
<?php }?>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
@ -0,0 +1,27 @@
|
||||
<div id="dashboard">
|
||||
<h2>Liste des commandes</h2>
|
||||
<div>
|
||||
<table>
|
||||
<tr>
|
||||
<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>login</b></th>
|
||||
<th><b>Reférence ciblage</b></th>
|
||||
<th><b>Fichier</b></th>
|
||||
</tr>
|
||||
<?php foreach($this->commandes as $item): ?>
|
||||
<tr>
|
||||
<td><?=$item['dateAdded']?></td>
|
||||
<td><?=$item['commandeReference']?></td>
|
||||
<td><?=$item['nbLigneTotales']?></td>
|
||||
<td><?=$item['uniteInsee']?></td>
|
||||
<td><?=$item['login']?></td>
|
||||
<td><?=$item['critereReference']?></td>
|
||||
<td><?=$item['fichier']?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
12
application/views/default/scripts/gestion/extract.phtml
Normal file
12
application/views/default/scripts/gestion/extract.phtml
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
if ($this->content) {
|
||||
$content_type = 'application/csv-tab-delimited-table';
|
||||
header('Content-Transfer-Encoding: none');
|
||||
header('Content-type: ' . $content_type.'');
|
||||
header('Cache-Control: private, max-age=0, must-revalidate');
|
||||
header('Pragma: public');
|
||||
ini_set('zlib.output_compression', '0');
|
||||
echo $this->content;
|
||||
} else {
|
||||
echo $this->message;
|
||||
}
|
12
application/views/default/scripts/gestion/index.phtml
Normal file
12
application/views/default/scripts/gestion/index.phtml
Normal file
@ -0,0 +1,12 @@
|
||||
<div id="dashboard">
|
||||
|
||||
<h2>Gestion des commandes</h2>
|
||||
<a href="<?=$this->url(array('controller' => 'gestion', 'action' => 'commandes'))?>">Liste des commandes</a><br />
|
||||
<a href="<?=$this->url(array('controller' => 'gestion', 'action' => 'enrichissements'))?>">Liste des commandes terminées</a><br/>
|
||||
<a href="<?=$this->url(array('controller' => 'gestion', 'action' => 'ciblages'))?>">Liste des ciblages</a><br />
|
||||
|
||||
<h2>Facturation</h2>
|
||||
<a href="<?=$this->url(array('controller' => 'gestion', 'action' => 'customerparams'))?>">Gestion des paramètres clients</a><br/>
|
||||
<a href="#">Extraction Logs</a>
|
||||
|
||||
</div>
|
34
application/views/default/scripts/gestion/profiladd.phtml
Normal file
34
application/views/default/scripts/gestion/profiladd.phtml
Normal file
@ -0,0 +1,34 @@
|
||||
<div id="dashboard">
|
||||
|
||||
<?=$this->message?>
|
||||
|
||||
<?php if (!$this->disableForm) {?>
|
||||
<form name="profil" method="post" action="<?=$this->url(array('controller'=>'gestion', 'action'=>'profiladd'))?>">
|
||||
<input type="hidden" name="idClient" value="<?=$this->idClient?>"/>
|
||||
<label>login</label>
|
||||
<input type="text" name="login" />
|
||||
<br/>
|
||||
<label>service</label>
|
||||
<input type="text" name="service" />
|
||||
<br/>
|
||||
<label>Reference</label>
|
||||
<input type="text" name="reference" />
|
||||
(Pour appliquer les paramètres du client mettre "default")
|
||||
<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>
|
||||
<?php }?>
|
||||
|
||||
</div>
|
@ -0,0 +1 @@
|
||||
<?php
|
45
application/views/default/scripts/gestion/profils.phtml
Normal file
45
application/views/default/scripts/gestion/profils.phtml
Normal file
@ -0,0 +1,45 @@
|
||||
<div id="dashboard">
|
||||
|
||||
<div>
|
||||
<form method="post" action="<?=$this->url(array('controller'=>'gestion', 'action'=>'profils'), null, true)?>">
|
||||
IdClient : <input type="text" name="idClient" /> - Login : <input type="text" name="login" />
|
||||
<input type="submit" name="rechercher" value="Rechercher"/>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<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>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>
|
||||
<?php if ($profil['actif']==1) {?>
|
||||
<a href="<?=$this->url(array('controller'=>'gestion', 'action'=>'profildel', 'id'=>$profil['id']))?>">Désactiver</a>
|
||||
<?php } else {?>
|
||||
<a href="#">Activer</a>
|
||||
<?php }?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
37
application/views/default/scripts/header.phtml
Normal file
37
application/views/default/scripts/header.phtml
Normal file
@ -0,0 +1,37 @@
|
||||
<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 ( $this->total!==null ) {?>
|
||||
Nombre sélectionnées :
|
||||
<span class="valeur"><?=number_format($this->total, 0, '', ' ')?></span>
|
||||
<?php if ( $this->insee!==null ) {?>
|
||||
(dont <span class="valeur"><?=number_format($this->insee, 0, '', ' ')?></span> unité(s) insee)
|
||||
<?php }?>
|
||||
<?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>
|
30
application/views/default/scripts/index/criterelist.phtml
Normal file
30
application/views/default/scripts/index/criterelist.phtml
Normal file
@ -0,0 +1,30 @@
|
||||
<?php if (count($this->inValues)>0) {?>
|
||||
<ul>
|
||||
<?php foreach ($this->inValues as $i => $item) {?>
|
||||
<li><?=$this->inLabels[$i]?>
|
||||
<a class="remove" href="<?=$this->url(array(
|
||||
'controller'=>'index',
|
||||
'action'=>'remove',
|
||||
'critere'=>$this->critereName,
|
||||
'in'=>$i
|
||||
), null, true)?>">
|
||||
<img src="/themes/default/images/cross.png"></a>
|
||||
</li>
|
||||
<?php }?>
|
||||
</ul>
|
||||
<?php }?>
|
||||
|
||||
<?php if (count($this->exValues)>0) {?>
|
||||
<ul>
|
||||
<?php foreach ($this->exValues as $i => $item) {?>
|
||||
<li><?=$this->exLabels[$i]?><a class="remove" href="<?=$this->url(array(
|
||||
'controller'=>'index',
|
||||
'action'=>'remove',
|
||||
'critere'=>$this->critereName,
|
||||
'ex'=>$i
|
||||
), null, true)?>">
|
||||
<img src="/themes/default/images/cross.png"></a>
|
||||
</li>
|
||||
<?php }?>
|
||||
</ul>
|
||||
<?php }?>
|
56
application/views/default/scripts/index/criteres.phtml
Normal file
56
application/views/default/scripts/index/criteres.phtml
Normal file
@ -0,0 +1,56 @@
|
||||
<style>
|
||||
.color {
|
||||
background-color:#DEDEDE;
|
||||
}
|
||||
#criteres {
|
||||
border: 1px solid;
|
||||
padding:10px 0;
|
||||
margin: 0 1px;
|
||||
}
|
||||
|
||||
#criteres tr td {
|
||||
border-left: 1px solid black;
|
||||
border-right: 1px solid black;
|
||||
padding-left:5px;
|
||||
}
|
||||
</style>
|
||||
<h2 style="text-align:center; background-color:#182838; padding:5px; color:white;">Résumé de vos critères</h2>
|
||||
|
||||
<div id="criteres">
|
||||
|
||||
<?php if ( count($this->infos)>0 ) {?>
|
||||
<?php $color = 0;?>
|
||||
<?php foreach($this->infos as $critere => $item) {?>
|
||||
|
||||
<div style="width:100%;" class="clearfix<?php echo ((($color%2) == 0) ? ' color' : ''); $color++; ?>">
|
||||
|
||||
<div style="float:left; margin:2px 0;">
|
||||
<?=$item['label']?>
|
||||
<?php if ( is_string($item['in']) && !empty($item['in']) ) { ?>
|
||||
<br/> <?=$item['in']?>
|
||||
<?php } elseif ( is_array($item['in']) || is_array($item['ex']) ) {?>
|
||||
<br/> <a class="criterelist" href="<?=$this->url(array('controller'=>'index', 'action'=>'criterelist', 'key'=>$critere), null, true)?>">Liste</a>
|
||||
<?php }?>
|
||||
</div>
|
||||
|
||||
<div style="height:16px; width:16px; float:right;">
|
||||
<a class="remove" href="<?=$this->url(array('controller'=>'index', 'action'=>'remove', 'critere'=>$critere), null, true)?>">
|
||||
<img src="/themes/default/images/cross.png" />
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php }?>
|
||||
<?php }?>
|
||||
|
||||
</div>
|
||||
|
||||
<div style="text-align:center; border:1px solid #ffffff; background-color:#182838; padding:5px;">
|
||||
<a style="color:white; text-decoration:none;" href="/comptage/reset">Initialiser les critères</a>
|
||||
</div>
|
||||
<div style="text-align:center; border:1px solid #ffffff; background-color:#182838; padding:5px;">
|
||||
<a style="color:white; text-decoration:none;" class="previsualisation" href="/comptage/previsualisation">Prévisualisation</a>
|
||||
</div>
|
||||
<div style="text-align:center; border:1px solid #ffffff; background-color:#182838; padding:5px;">
|
||||
<a style="color:white; text-decoration:none;" class="saveciblage" href="/comptage/savedialog">Extraire</a>
|
||||
</div>
|
11
application/views/default/scripts/index/index.phtml
Normal file
11
application/views/default/scripts/index/index.phtml
Normal file
@ -0,0 +1,11 @@
|
||||
<?php if ($this->CiblageError) { ?>
|
||||
|
||||
<div id="CiblageError">
|
||||
Erreur ! Le moteur de ciblage n'est pas disponible !
|
||||
</div>
|
||||
|
||||
<?php } else {?>
|
||||
<div id="actionMessage"></div>
|
||||
<div id="panel"><?=$this->action('criteres', 'index')?></div>
|
||||
<div id="tabs"><?=$this->action('index', 'fields')?></div>
|
||||
<?php }?>
|
23
application/views/default/scripts/main.phtml
Normal file
23
application/views/default/scripts/main.phtml
Normal file
@ -0,0 +1,23 @@
|
||||
<?php echo $this->doctype(); ?>
|
||||
<html>
|
||||
<head>
|
||||
<?php echo $this->headMeta(); ?>
|
||||
<?php echo $this->headTitle(); ?>
|
||||
<?php echo $this->headStyle(); ?>
|
||||
<?php echo $this->headLink(); ?>
|
||||
<?php echo $this->headScript(); ?>
|
||||
</head>
|
||||
<body>
|
||||
<div id="global">
|
||||
<div id="header" class="clearfix">
|
||||
<?php echo $this->render('header.phtml') ?>
|
||||
</div>
|
||||
<div id="content" class="clearfix">
|
||||
<?php echo $this->layout()->content; ?>
|
||||
</div>
|
||||
<div id="footer">
|
||||
<?php echo $this->render('footer.phtml'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
4
application/views/default/scripts/user/index.phtml
Normal file
4
application/views/default/scripts/user/index.phtml
Normal file
@ -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>
|
619
application/views/default/scripts/user/login.phtml
Normal file
619
application/views/default/scripts/user/login.phtml
Normal file
@ -0,0 +1,619 @@
|
||||
<?=$this->doctype();?>
|
||||
<html>
|
||||
<head>
|
||||
<?=$this->headMeta();?>
|
||||
<?=$this->headTitle();?>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="<?='http://'.$_SERVER['SERVER_NAME']?>/favicon.ico" />
|
||||
<style>
|
||||
html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, em, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, dialog, figure, footer, header, hgroup, nav, section {
|
||||
border: 0 none;
|
||||
cursor: default;
|
||||
font-family: inherit;
|
||||
font-size: 100%;
|
||||
font-weight: inherit;
|
||||
margin: 0;
|
||||
outline: 0 none;
|
||||
padding: 0;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
html, body {
|
||||
height: 100%;
|
||||
}
|
||||
article, aside, dialog, figure, footer, header, hgroup, nav, section {
|
||||
display: block;
|
||||
}
|
||||
body {
|
||||
line-height: 1.5;
|
||||
}
|
||||
table {
|
||||
border-collapse: separate;
|
||||
border-spacing: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
caption, th, td {
|
||||
font-weight: normal;
|
||||
text-align: left;
|
||||
}
|
||||
table, td, th {
|
||||
vertical-align: middle;
|
||||
}
|
||||
a {
|
||||
border: 0 none;
|
||||
color: #000000;
|
||||
text-decoration: none;
|
||||
}
|
||||
a, a *, input, input *, select, .button span, li, label {
|
||||
cursor: pointer;
|
||||
}
|
||||
ul {
|
||||
list-style: none outside none;
|
||||
}
|
||||
body {
|
||||
background: none repeat scroll 0 0 #FEFEFE;
|
||||
color: #000000;
|
||||
font: 0.8em/1.6em "Lucida Grande",Arial,Verdana,sans-serif;
|
||||
}
|
||||
#body-user #header, #body-settings #header {
|
||||
background: none repeat scroll 0 0 #1D2D44;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5), 0 -2px 10px #222222 inset;
|
||||
height: 2.5em;
|
||||
padding: 0.5em;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
z-index: 100;
|
||||
}
|
||||
#body-login #header {
|
||||
margin: -2em auto 0;
|
||||
text-align: center;
|
||||
height: 10em;
|
||||
padding: 1em 0 .5em;
|
||||
-moz-box-shadow: 0 0 1em rgba(0, 0, 0, .5);
|
||||
-webkit-box-shadow: 0 0 1em rgba(0, 0, 0, .5);
|
||||
box-shadow: 0 0 1em rgba(0, 0, 0, .5);
|
||||
background: #1D2D44;
|
||||
background: -moz-linear-gradient(top, #35537A 0%, #1D2D42 100%);
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #35537A), color-stop(100%, #1D2D42));
|
||||
background: -webkit-linear-gradient(top, #35537A 0%, 1D2D42 100%);
|
||||
background: -o-linear-gradient(top, #35537A 0%, #1D2D42 100%);
|
||||
background: -ms-linear-gradient(top, #35537A 0%, #1D2D42 100%);
|
||||
background: linear-gradient(top, #35537A 0%, #1D2D42 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#35537a', endColorstr='#1d2d42',GradientType=0 );
|
||||
}
|
||||
|
||||
#body-login #header span {
|
||||
color:#FFFFFF;
|
||||
font-weight:bold;
|
||||
font-size:1.6em;
|
||||
line-height:5em;
|
||||
}
|
||||
input[type="text"], input[type="password"] {
|
||||
cursor: text;
|
||||
}
|
||||
input, textarea, select, button, .button, #quota, div.jp-progress, .pager li a {
|
||||
background: none repeat scroll 0 0 #FFFFFF;
|
||||
border: 1px solid #DDDDDD;
|
||||
border-radius: 0.5em 0.5em 0.5em 0.5em;
|
||||
box-shadow: 0 1px 1px #FFFFFF, 0 1px 0 #BBBBBB inset;
|
||||
color: #333333;
|
||||
font-size: 1em;
|
||||
margin: 0.3em;
|
||||
outline: medium none;
|
||||
padding: 0.6em 0.5em 0.4em;
|
||||
width: 10em;
|
||||
}
|
||||
input[type="text"], input[type="password"], input[type="search"] {
|
||||
background: none repeat scroll 0 0 #F8F8F8;
|
||||
color: #555555;
|
||||
cursor: text;
|
||||
}
|
||||
input[type="text"], input[type="password"], input[type="search"] {
|
||||
-moz-appearance: textfield;
|
||||
-moz-box-sizing: content-box;
|
||||
}
|
||||
input[type="text"]:hover, input[type="text"]:focus, input[type="text"]:active, input[type="password"]:hover, input[type="password"]:focus, input[type="password"]:active, .searchbox input[type="search"]:hover, .searchbox input[type="search"]:focus, .searchbox input[type="search"]:active {
|
||||
background-color: #FFFFFF;
|
||||
color: #333333;
|
||||
opacity: 1;
|
||||
}
|
||||
input[type="submit"], input[type="button"], button, .button, #quota, div.jp-progress, select, .pager li a {
|
||||
background: none repeat scroll 0 0 #F8F8F8;
|
||||
border: 1px solid #DDDDDD;
|
||||
border-radius: 0.5em 0.5em 0.5em 0.5em;
|
||||
color: #555555;
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
padding: 0.4em;
|
||||
text-shadow: 0 1px 0 #FFFFFF;
|
||||
width: auto;
|
||||
}
|
||||
input[type="submit"]:hover, input[type="submit"]:focus, input[type="button"]:hover, select:hover, select:focus, select:active, input[type="button"]:focus, .button:hover {
|
||||
background: none repeat scroll 0 0 #FFFFFF;
|
||||
color: #333333;
|
||||
}
|
||||
input[type="checkbox"] {
|
||||
width: auto;
|
||||
}
|
||||
#quota {
|
||||
cursor: default;
|
||||
}
|
||||
#body-login input {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
#body-login input[type="text"], #body-login input[type="password"] {
|
||||
width: 13em;
|
||||
}
|
||||
#body-login input.login {
|
||||
float: right;
|
||||
width: auto;
|
||||
}
|
||||
#remember_login {
|
||||
margin: 0.8em 0.2em 0 1em;
|
||||
}
|
||||
.searchbox input[type="search"] {
|
||||
-moz-transition: opacity 300ms ease 0s;
|
||||
background: url("../img/actions/search.svg") no-repeat scroll 0.5em center #FFFFFF;
|
||||
border: 0 none;
|
||||
border-radius: 1em 1em 1em 1em;
|
||||
font-size: 1.2em;
|
||||
opacity: 0.7;
|
||||
padding: 0.2em 0.5em 0.2em 1.5em;
|
||||
position: fixed;
|
||||
right: 3em;
|
||||
top: 0.4em;
|
||||
}
|
||||
input.enabled[type="submit"] {
|
||||
background: none repeat scroll 0 0 #66F866;
|
||||
border: 1px solid #55EE55;
|
||||
box-shadow: 0 1px 1px #F8F8F8, 0 1px 1px #CCFFCC inset;
|
||||
}
|
||||
input.highlight[type="submit"] {
|
||||
background: none repeat scroll 0 0 #FFC100;
|
||||
border: 1px solid #DDBB00;
|
||||
box-shadow: 0 1px 1px #F8F8F8, 0 1px 1px #FFEEDD inset;
|
||||
text-shadow: 0 1px 0 #FFEEDD;
|
||||
}
|
||||
#select_all {
|
||||
margin-top: 0.4em !important;
|
||||
}
|
||||
#controls {
|
||||
background: none repeat scroll 0 0 #F7F7F7;
|
||||
border-bottom: 1px solid #EEEEEE;
|
||||
box-shadow: 0 -3px 7px #000000;
|
||||
height: 2.8em;
|
||||
margin: 0;
|
||||
padding: 0 0.5em;
|
||||
position: fixed;
|
||||
top: 3.5em;
|
||||
width: 100%;
|
||||
z-index: 50;
|
||||
}
|
||||
#controls .button {
|
||||
display: inline-block;
|
||||
}
|
||||
#content {
|
||||
left: 12.5em;
|
||||
position: absolute;
|
||||
top: 3.5em;
|
||||
}
|
||||
#leftcontent, .leftcontent {
|
||||
background: none repeat scroll 0 0 #F8F8F8;
|
||||
border-right: 1px solid #DDDDDD;
|
||||
overflow: auto;
|
||||
position: fixed;
|
||||
top: 6.4em;
|
||||
width: 20em;
|
||||
}
|
||||
#leftcontent li, .leftcontent li {
|
||||
-moz-transition: background-color 200ms ease 0s;
|
||||
background: none repeat scroll 0 0 #F8F8F8;
|
||||
overflow: hidden;
|
||||
padding: 0.5em 0.8em;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
#leftcontent li:hover, #leftcontent li:active, #leftcontent li.active, .leftcontent li:hover, .leftcontent li:active, .leftcontent li.active {
|
||||
background: none repeat scroll 0 0 #EEEEEE;
|
||||
}
|
||||
#leftcontent li.active, .leftcontent li.active {
|
||||
font-weight: bold;
|
||||
}
|
||||
#leftcontent li:hover, .leftcontent li:hover {
|
||||
background: none repeat scroll 0 0 #DDDDDD;
|
||||
color: #333333;
|
||||
}
|
||||
#leftcontent a {
|
||||
display: block;
|
||||
float: left;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0 1em 0 0;
|
||||
}
|
||||
#rightcontent, .rightcontent {
|
||||
left: 32.5em;
|
||||
overflow: auto;
|
||||
position: fixed;
|
||||
top: 6.4em;
|
||||
}
|
||||
#body-login {
|
||||
background: none repeat scroll 0 0 #DDDDDD;
|
||||
}
|
||||
#body-login div.buttons {
|
||||
text-align: center;
|
||||
}
|
||||
#body-login p.info {
|
||||
color: #777777;
|
||||
margin: 2em auto;
|
||||
text-align: center;
|
||||
text-shadow: 0 1px 0 #FFFFFF;
|
||||
width: 22em;
|
||||
}
|
||||
#body-login p.info a {
|
||||
color: #777777;
|
||||
font-weight: bold;
|
||||
}
|
||||
#login {
|
||||
background: none repeat scroll 0 0 #EEEEEE;
|
||||
border-bottom: 1px solid #F8F8F8;
|
||||
margin: 2em auto 0;
|
||||
min-height: 30em;
|
||||
}
|
||||
#login form {
|
||||
margin: 2em auto;
|
||||
padding: 0;
|
||||
width: 22em;
|
||||
}
|
||||
#login form fieldset {
|
||||
background: none repeat scroll 0 center transparent;
|
||||
border: 0 none;
|
||||
margin-bottom: 2em;
|
||||
padding: 0;
|
||||
}
|
||||
#login form fieldset legend {
|
||||
font-weight: bold;
|
||||
}
|
||||
#login form label {
|
||||
color: #666666;
|
||||
margin: 0.95em 0 0 0.85em;
|
||||
}
|
||||
p.infield {
|
||||
position: relative;
|
||||
}
|
||||
label.infield {
|
||||
cursor: text !important;
|
||||
}
|
||||
#login form label.infield {
|
||||
color: #AAAAAA;
|
||||
font-size: 1.5em;
|
||||
position: absolute;
|
||||
}
|
||||
#login #dbhostlabel, #login #directorylabel {
|
||||
display: block;
|
||||
margin: 0.95em 0 0.8em -8em;
|
||||
}
|
||||
#login form input[type="checkbox"] + label {
|
||||
font-size: 1em;
|
||||
margin: 0;
|
||||
position: relative;
|
||||
text-shadow: 0 1px 0 #FFFFFF;
|
||||
}
|
||||
#login form .errors {
|
||||
background: none repeat scroll 0 0 #FED7D7;
|
||||
border: 1px solid #FF0000;
|
||||
margin: 0 0 2em;
|
||||
padding: 1em;
|
||||
}
|
||||
#login form #selectDbType {
|
||||
text-align: center;
|
||||
}
|
||||
#login form #selectDbType label {
|
||||
background: none repeat scroll 0 0 #F8F8F8;
|
||||
border: 1px solid #DDDDDD;
|
||||
color: #555555;
|
||||
cursor: pointer;
|
||||
font-size: 1em;
|
||||
font-weight: bold;
|
||||
margin: 0 -0.3em 1em;
|
||||
padding: 0.4em;
|
||||
position: static;
|
||||
text-shadow: 0 1px 0 #EEEEEE;
|
||||
}
|
||||
#login form #selectDbType label span {
|
||||
cursor: pointer;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
#login form #selectDbType label.ui-state-hover span, #login form #selectDbType label.ui-state-active span {
|
||||
color: #000000;
|
||||
}
|
||||
#login form #selectDbType label.ui-state-hover, #login form #selectDbType label.ui-state-active {
|
||||
background-color: #CCCCCC;
|
||||
color: #333333;
|
||||
}
|
||||
#navigation {
|
||||
background: none repeat scroll 0 0 #EEEEEE;
|
||||
border-right: 1px solid #CCCCCC;
|
||||
box-shadow: -3px 0 7px #000000;
|
||||
float: left;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
padding: 0;
|
||||
position: fixed;
|
||||
top: 3.5em;
|
||||
width: 12.5em;
|
||||
z-index: 75;
|
||||
}
|
||||
#navigation a {
|
||||
-moz-transition: background 300ms ease 0s;
|
||||
background: none no-repeat scroll 1em center #EEEEEE;
|
||||
border-bottom: 1px solid #DDDDDD;
|
||||
border-top: 1px solid #FFFFFF;
|
||||
color: #666666;
|
||||
display: block;
|
||||
font-size: 1.2em;
|
||||
padding: 0.6em 0.5em 0.4em 2.5em;
|
||||
text-decoration: none;
|
||||
text-shadow: 0 1px 0 #F8F8F8;
|
||||
}
|
||||
#navigation a.active, #navigation a:hover, #navigation a:focus {
|
||||
background-color: #DBDBDB;
|
||||
border-bottom: 1px solid #CCCCCC;
|
||||
border-top: 1px solid #D4D4D4;
|
||||
color: #333333;
|
||||
}
|
||||
#navigation a.active {
|
||||
background-color: #DDDDDD;
|
||||
}
|
||||
#navigation #settings {
|
||||
bottom: 3.5em;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
}
|
||||
#expand {
|
||||
cursor: pointer;
|
||||
margin-bottom: -0.5em;
|
||||
padding: 0.5em 10.1em 0.7em 1.2em;
|
||||
position: relative;
|
||||
z-index: 100;
|
||||
}
|
||||
#expand + span {
|
||||
-moz-transition: opacity 300ms ease 0s;
|
||||
color: #666666;
|
||||
font-size: 1.2em;
|
||||
margin: -1.7em 0 0 2.5em;
|
||||
opacity: 0;
|
||||
position: absolute;
|
||||
text-shadow: 0 1px 0 #F8F8F8;
|
||||
z-index: 99;
|
||||
}
|
||||
#expand:hover + span, #expand + span:hover {
|
||||
cursor: pointer;
|
||||
opacity: 1;
|
||||
}
|
||||
#logout {
|
||||
padding: 1.2em 2em 0.55em 1.2em;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
}
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
.bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
#notification {
|
||||
background-color: #FFCC44;
|
||||
border: 0 none;
|
||||
border-bottom-left-radius: 1em;
|
||||
border-bottom-right-radius: 1em;
|
||||
cursor: pointer;
|
||||
display: none;
|
||||
left: 50%;
|
||||
padding: 0 0.7em 0.3em;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
z-index: 101;
|
||||
}
|
||||
.action, .selectedActions a {
|
||||
-moz-transition: opacity 200ms ease 0s;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.action {
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
}
|
||||
#logout {
|
||||
opacity: 0.8;
|
||||
}
|
||||
.action:hover, .selectedActions a:hover, #logout:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
table:not(.nostyle) tr {
|
||||
-moz-transition: background-color 200ms ease 0s;
|
||||
}
|
||||
tbody tr:hover, tr:active {
|
||||
background-color: #F8F8F8;
|
||||
}
|
||||
#body-settings .personalblock, #body-settings .helpblock {
|
||||
background: none repeat scroll 0 0 #F8F8F8;
|
||||
border-radius: 0.5em 0.5em 0.5em 0.5em;
|
||||
color: #555555;
|
||||
margin: 1em;
|
||||
padding: 0.5em 1em;
|
||||
text-shadow: 0 1px 0 #FFFFFF;
|
||||
}
|
||||
#body-settings #quota.personalblock {
|
||||
padding: 0;
|
||||
position: relative;
|
||||
}
|
||||
#body-settings #controls + .helpblock {
|
||||
margin-top: 3em;
|
||||
position: relative;
|
||||
}
|
||||
.personalblock > legend {
|
||||
margin-top: 2em;
|
||||
}
|
||||
.personalblock > legend, th, dt, label {
|
||||
font-weight: bold;
|
||||
}
|
||||
code {
|
||||
font-family: "Lucida Console","Lucida Sans Typewriter","DejaVu Sans Mono",monospace;
|
||||
}
|
||||
#quota div, div.jp-play-bar, div.jp-seek-bar {
|
||||
background: none repeat scroll 0 0 #E6E6E6;
|
||||
border-bottom-left-radius: 0.4em;
|
||||
border-top-left-radius: 0.4em;
|
||||
font-weight: normal;
|
||||
padding: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
#quotatext {
|
||||
padding: 0.6em 1em;
|
||||
}
|
||||
div.jp-play-bar, div.jp-seek-bar {
|
||||
padding: 0;
|
||||
}
|
||||
.pager {
|
||||
display: inline;
|
||||
float: right;
|
||||
list-style: none outside none;
|
||||
margin: 0.7em 13em 0 0;
|
||||
}
|
||||
.pager li {
|
||||
display: inline-block;
|
||||
}
|
||||
li.error {
|
||||
background: none no-repeat scroll 0.8em 0.8em #FFFFEE;
|
||||
border: 1px solid #CCCCCC;
|
||||
border-radius: 10px 10px 10px 10px;
|
||||
color: #FF3B3B;
|
||||
margin: 4em auto;
|
||||
padding: 1em 1em 1em 4em;
|
||||
width: 640px;
|
||||
}
|
||||
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.hint {
|
||||
background-image: url("/core/img/actions/info.png");
|
||||
background-position: 0 0.3em;
|
||||
background-repeat: no-repeat;
|
||||
color: #777777;
|
||||
padding-left: 25px;
|
||||
}
|
||||
.separator {
|
||||
border-left: 1px solid #D3D3D3;
|
||||
border-right: 1px solid #FFFFFF;
|
||||
display: inline;
|
||||
height: 10px;
|
||||
margin: 4px;
|
||||
width: 0;
|
||||
}
|
||||
a.bookmarklet {
|
||||
background-color: #DDDDDD;
|
||||
border: 1px solid #CCCCCC;
|
||||
margin-top: 5px;
|
||||
padding: 0 5px 2px;
|
||||
text-decoration: none;
|
||||
}
|
||||
#dirtree {
|
||||
width: 100%;
|
||||
}
|
||||
#filelist {
|
||||
background-color: white;
|
||||
height: 270px;
|
||||
overflow: scroll;
|
||||
width: 100%;
|
||||
}
|
||||
.filepicker_element_selected {
|
||||
background-color: lightblue;
|
||||
}
|
||||
.filepicker_loader {
|
||||
background-color: #333333;
|
||||
height: 120px;
|
||||
left: 0;
|
||||
opacity: 0.3;
|
||||
padding-top: 150px;
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
top: 0;
|
||||
visibility: visible;
|
||||
width: 100%;
|
||||
}
|
||||
#categoryform .scrollarea {
|
||||
background: none repeat scroll 0 0 #F8F8F8;
|
||||
border: 1px solid #DDDDDD;
|
||||
bottom: 50px;
|
||||
left: 10px;
|
||||
overflow: auto;
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 10px;
|
||||
}
|
||||
#categoryform .bottombuttons {
|
||||
bottom: 10px;
|
||||
position: absolute;
|
||||
}
|
||||
#categoryform .bottombuttons * {
|
||||
float: left;
|
||||
}
|
||||
#categorylist li {
|
||||
-moz-transition: background-color 500ms ease 0s;
|
||||
background: none repeat scroll 0 0 #F8F8F8;
|
||||
overflow: hidden;
|
||||
padding: 0.3em 0.8em;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
#categorylist li:hover, li:active {
|
||||
background: none repeat scroll 0 0 #EEEEEE;
|
||||
}
|
||||
#category_addinput {
|
||||
width: 10em;
|
||||
}
|
||||
|
||||
</style>
|
||||
<!--[if IE 8]><style>input[type="checkbox"]{padding:0;}</style><![endif]-->
|
||||
|
||||
<?=$this->inlineScript()?>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$("label").inFieldLabels();
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body id="body-login">
|
||||
<div id="login">
|
||||
<header>
|
||||
<div id="header">
|
||||
<span>OUTIL D'EXTRACTION - SCORES & DECISIONS</span>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<form method="post" action="<?=$this->url(array('controller'=>'user', 'action'=>'login'),null, true)?>">
|
||||
<p style="text-align:center; color:red;"><span><?=$this->message?></span></p>
|
||||
<fieldset>
|
||||
<p class="infield">
|
||||
<label for="user" class="infield">Identifiant</label>
|
||||
<input type="text" name="login" id="user" value="" autofocus autocomplete="off" required />
|
||||
</p>
|
||||
<p class="infield">
|
||||
<label for="password" class="infield">Mot de passe</label>
|
||||
<input type="password" name="pass" id="password" value="" required />
|
||||
</p>
|
||||
<!-- <input type="checkbox" name="remember_login" value="1" id="remember_login" /><label for="remember_login">Remember</label> -->
|
||||
<input type="submit" id="submit" class="login" value="Connexion" />
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<p class="info">
|
||||
<a href="http://www.scores-decisions.com/">Scores & Décisions SAS</a>
|
||||
</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
16
application/views/default/scripts/user/logout.phtml
Normal file
16
application/views/default/scripts/user/logout.phtml
Normal file
@ -0,0 +1,16 @@
|
||||
<?=$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 Application_Model_EnrichissementIdentifiants($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." &");
|
||||
}
|
246
batch/enrichissement.php
Normal file
246
batch/enrichissement.php
Normal file
@ -0,0 +1,246 @@
|
||||
#!/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;
|
||||
}
|
||||
|
||||
$config = new Zend_Config_Ini(APPLICATION_PATH.'/configs/configuration.ini');
|
||||
|
||||
//MetadataCache pour la base de données
|
||||
$frontendOptions = array(
|
||||
'lifetime' => 14400,
|
||||
'automatic_serialization' => true
|
||||
);
|
||||
$backendOptions = array();
|
||||
$cache = Zend_Cache::factory('Core','Apc', $frontendOptions, $backendOptions);
|
||||
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
|
||||
|
||||
//Définition bdd
|
||||
try {
|
||||
$db = Zend_Db::factory($config->databases->db);
|
||||
} catch ( Exception $e ) {
|
||||
exit ( $e->getMessage() );
|
||||
}
|
||||
//Définition bdd metier
|
||||
try {
|
||||
$dbMetier = Zend_Db::factory($config->databases->jo);
|
||||
} catch ( Exception $e ) {
|
||||
exit ( $e->getMessage() );
|
||||
}
|
||||
|
||||
$liste = array();
|
||||
|
||||
if ($opts->id)
|
||||
{
|
||||
//Read SIRETs
|
||||
$commandesM = new Application_Model_EnrichissementIdentifiants($db);
|
||||
$commande = $commandesM->find(intval($opts->id))->current();
|
||||
$identifiants = json_decode($commande->identifiants, true);
|
||||
|
||||
//Read profil for data extract
|
||||
$profilM = new Application_Model_EnrichissementProfils($db);
|
||||
$profil = $profilM->find(intval($commande->idProfil))->current();
|
||||
$dataProfil = json_decode($profil->criteres, true);
|
||||
}
|
||||
else if ($opts->file)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//Something is needed
|
||||
if ( count($identifiants)==0 || count($dataProfil)==0 ) {
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
//Let's go
|
||||
$mois = substr($commande->dateAdded,0,4).substr($commande->dateAdded,5,2);
|
||||
|
||||
if(!file_exists($config->path->data.'/'.$mois))
|
||||
mkdir($config->path->data.'/'.$mois);
|
||||
|
||||
$path = $config->path->data.'/'.$mois;
|
||||
$outFile = $profil['login'].'_'.$opts->id.'_'.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, ',', '"');
|
||||
}
|
||||
//Mise à jour des éléments
|
||||
if ($opts->id) {
|
||||
$commandesM->update(array(
|
||||
'dateStart'=>date('Y-m-d H:i:s'),
|
||||
'fichier' => basename($outFile)
|
||||
),
|
||||
"id = ".$commande->id);
|
||||
}
|
||||
|
||||
$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, ',', '"');
|
||||
|
||||
//Mise à jour des lignes traitées dans la base
|
||||
if ($opts->id) {
|
||||
$commandesM->update(array('nbLigneTraites'=>$row), "id = ".$commande->id);
|
||||
}
|
||||
|
||||
$row++;
|
||||
}
|
||||
fclose($fp);
|
||||
if ($opts->id) {
|
||||
$commandesM->update( array('dateStop' => date('Y-m-d H:i:s')) , "id = ".$commande->id);
|
||||
}
|
||||
|
||||
|
||||
/* == 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;
|
||||
}
|
228
batch/extract.php
Normal file
228
batch/extract.php
Normal file
@ -0,0 +1,228 @@
|
||||
<?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();
|
||||
$valeur = trim($valeur);
|
||||
|
||||
if(strlen($valeur) == 1)
|
||||
{
|
||||
$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();
|
110
batch/setMinMax.php
Normal file
110
batch/setMinMax.php
Normal file
@ -0,0 +1,110 @@
|
||||
#!/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(
|
||||
'dateCrea_ent',
|
||||
'dateCrea_etab',
|
||||
'nbActio',
|
||||
'nbPart',
|
||||
'age_etab',
|
||||
'age_entrep',
|
||||
'nbEtab',
|
||||
'eff_entrep',
|
||||
'eff_etab',
|
||||
'capital',
|
||||
'dateImmat',
|
||||
'bilAnnee',
|
||||
'bilCloture',
|
||||
'bilEE',
|
||||
'bilFL',
|
||||
'bilFK',
|
||||
'bilFR',
|
||||
'bilGF',
|
||||
'bilGP',
|
||||
'bilGW',
|
||||
'bilHD',
|
||||
'bilHH',
|
||||
'bilHL',
|
||||
'bilHM',
|
||||
'bilHN',
|
||||
'bilYP',
|
||||
);
|
||||
|
||||
$sql = 'TRUNCATE TABLE fields_minmax';
|
||||
if ( !$db->query($sql) ) {
|
||||
die ('Impossible de vider la table fields_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('fields_minmax', $data);
|
||||
if ($opts->manuel) echo $key.' -> min:'.$result->min.' max:'.$result->max."\n";
|
||||
}
|
||||
if ($opts->manuel) print("Terminé\n");
|
37
config/Odea/configuration.ini
Normal file
37
config/Odea/configuration.ini
Normal file
@ -0,0 +1,37 @@
|
||||
[server]
|
||||
name = Odea
|
||||
|
||||
[webservice]
|
||||
location = celeste
|
||||
|
||||
[databases]
|
||||
db.adapter=mysqli
|
||||
db.params.host=127.0.0.1
|
||||
db.params.username=ciblage
|
||||
db.params.password=z7jq8AhvrwqQJ4Yb
|
||||
db.params.dbname=ciblage
|
||||
db.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
|
||||
|
||||
jo.adapter=mysqli
|
||||
jo.params.host=192.168.3.30
|
||||
jo.params.username=ciblage
|
||||
jo.params.password=z7jq8AhvrwqQJ4Yb
|
||||
jo.params.dbname=jo
|
||||
jo.params.persistent = true
|
||||
jo.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
|
||||
|
||||
[sphinx]
|
||||
host = 127.0.0.1
|
||||
port = 3312
|
||||
|
||||
[mail]
|
||||
method = smtp
|
||||
smpt_port =
|
||||
smtp_host = smtp.celeste.fr
|
||||
support = supportdev@scores-decisions.com
|
||||
supportdev = supportdev@scores-decisions.com
|
||||
contact = supportdev@scores-decisions.com
|
||||
production = supportdev@scores-decisions.com
|
||||
|
||||
[path]
|
||||
data = "/sites/dataciblage"
|
8
config/_sql/CiblageComptages.sql
Normal file
8
config/_sql/CiblageComptages.sql
Normal file
@ -0,0 +1,8 @@
|
||||
CREATE TABLE IF NOT EXISTS `ciblage_comptages` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`idDefinition` int(11) NOT NULL,
|
||||
`resultat` int(11) NOT NULL,
|
||||
`uniteInsee` int(11) NOT NULL,
|
||||
`dateAjout` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Résultat des comptages';
|
12
config/_sql/CiblageCriteres.sql
Normal file
12
config/_sql/CiblageCriteres.sql
Normal file
@ -0,0 +1,12 @@
|
||||
CREATE TABLE IF NOT EXISTS `ciblage_criteres` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`idClient` int(11) NOT NULL,
|
||||
`login` varchar(20) NOT NULL,
|
||||
`reference` varchar(50) NOT NULL,
|
||||
`criteres` longtext NOT NULL,
|
||||
`parent` int(11) NOT NULL,
|
||||
`dateAjout` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `reference` (`reference`),
|
||||
KEY `login` (`login`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Sauvegarde des critères pour les comptages' ;
|
18
config/_sql/CustomerParams.sql
Normal file
18
config/_sql/CustomerParams.sql
Normal file
@ -0,0 +1,18 @@
|
||||
CREATE TABLE `customer_params` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`idClient` int(11) NOT NULL,
|
||||
`service` varchar(100) NOT NULL,
|
||||
`filterRNCS` tinyint(1) NOT NULL COMMENT 'Filtrer sur le perimetre RNCS ',
|
||||
`licenceINSEE` tinyint(1) NOT NULL COMMENT 'Le client possède une licence INSEE',
|
||||
`immediatExtract` int(11) NOT NULL DEFAULT '0' COMMENT 'Nombre de ligne maximum pour une extraction immédiate',
|
||||
`dateContrat` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'Date de debut du contrat',
|
||||
`periodContrat` int(2) NOT NULL COMMENT 'Durée du contrat en mois',
|
||||
`periodPaiement` int(2) NOT NULL COMMENT 'Durée en mois pour l''emission de la facture (1,3,6,12)',
|
||||
`priceLine` float NOT NULL DEFAULT '0',
|
||||
`forfait` int(11) NOT NULL DEFAULT '0' COMMENT 'Montant du forfait pour décompte',
|
||||
`limitLines` int(11) NOT NULL DEFAULT '0' COMMENT 'Limiter à un nombre de ligne sur la période du contrat',
|
||||
`limitFiles` int(11) NOT NULL DEFAULT '0' COMMENT 'Limiter à un nombre de fichier sur la durée du contrat',
|
||||
`criteres` text NOT NULL,
|
||||
`dateAdded` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Paramètres de facturation';
|
5
config/_sql/CustomerPrefs.sql
Normal file
5
config/_sql/CustomerPrefs.sql
Normal file
@ -0,0 +1,5 @@
|
||||
CREATE TABLE IF NOT EXISTS `customer_prefs` (
|
||||
`login` varchar(255) NOT NULL,
|
||||
`json` text NOT NULL,
|
||||
PRIMARY KEY (`login`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
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`)
|
||||
) ENGINE=MyISAM 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`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
14
config/_sql/EnrichissementProfils.sql
Normal file
14
config/_sql/EnrichissementProfils.sql
Normal file
@ -0,0 +1,14 @@
|
||||
CREATE TABLE `enrichissement_profils` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`idClient` int(11) NOT NULL,
|
||||
`service` varchar(25) NOT NULL,
|
||||
`login` varchar(50) NOT NULL,
|
||||
`reference` varchar(50) NOT NULL,
|
||||
`criteres` text 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`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Profil d''extraction';
|
39794
config/_sql/FieldsCodepostaux.sql
Normal file
39794
config/_sql/FieldsCodepostaux.sql
Normal file
File diff suppressed because it is too large
Load Diff
126
config/_sql/FieldsDepartements.sql
Normal file
126
config/_sql/FieldsDepartements.sql
Normal file
@ -0,0 +1,126 @@
|
||||
--
|
||||
-- Structure de la table `departements`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `fields_departements` (
|
||||
`numdep` char(3) NOT NULL DEFAULT '0',
|
||||
`libdep` varchar(30) NOT NULL DEFAULT '',
|
||||
`numreg` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`codeRegionInsee` tinyint(2) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`numdep`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- Contenu de la table `departements`
|
||||
--
|
||||
|
||||
INSERT INTO `fields_departements` (`numdep`, `libdep`, `numreg`, `codeRegionInsee`) VALUES
|
||||
('03', 'Allier', 3, 83),
|
||||
('04', 'Alpes-de-Haute-Provence', 21, 93),
|
||||
('02', 'Aisne', 19, 26),
|
||||
('01', 'Ain', 22, 82),
|
||||
('05', 'Hautes-Alpes', 21, 93),
|
||||
('06', 'Alpes-Maritimes', 21, 93),
|
||||
('07', 'Ardèche', 22, 82),
|
||||
('08', 'Ardennes', 7, 21),
|
||||
('09', 'Ariège', 15, 73),
|
||||
('10', 'Aube', 7, 21),
|
||||
('11', 'Aude', 11, 91),
|
||||
('12', 'Aveyron', 15, 73),
|
||||
('13', 'Bouches-du-Rhône', 21, 93),
|
||||
('14', 'Calvados', 18, 25),
|
||||
('15', 'Cantal', 3, 83),
|
||||
('16', 'Charente', 20, 54),
|
||||
('17', 'Charente-Maritime', 20, 54),
|
||||
('18', 'Cher', 6, 24),
|
||||
('19', 'Corrèze', 12, 74),
|
||||
('2A', 'Corse-du-Sud', 8, 94),
|
||||
('20', 'Corse', 8, 94),
|
||||
('21', 'Côte-d''Or', 4, 26),
|
||||
('22', 'Côtes-d''Armor', 5, 53),
|
||||
('23', 'Creuse', 12, 74),
|
||||
('24', 'Dordogne', 2, 72),
|
||||
('25', 'Doubs', 9, 43),
|
||||
('26', 'Drôme', 22, 82),
|
||||
('27', 'Eure', 17, 23),
|
||||
('28', 'Eure-et-Loir', 6, 24),
|
||||
('29', 'Finistère', 5, 53),
|
||||
('30', 'Gard', 11, 91),
|
||||
('33', 'Gironde', 2, 72),
|
||||
('32', 'Gers', 15, 73),
|
||||
('34', 'Hérault', 11, 91),
|
||||
('31', 'Haute-Garonne', 15, 73),
|
||||
('36', 'Indre', 6, 24),
|
||||
('37', 'Indre-et-Loire', 6, 24),
|
||||
('35', 'Ille-et-Vilaine', 5, 53),
|
||||
('39', 'Jura', 9, 43),
|
||||
('38', 'Isère', 22, 82),
|
||||
('40', 'Landes', 2, 72),
|
||||
('41', 'Loir-et-Cher', 6, 24),
|
||||
('42', 'Loire', 22, 82),
|
||||
('43', 'Haute-Loire', 3, 83),
|
||||
('44', 'Loire-Atlantique', 13, 52),
|
||||
('45', 'Loiret', 6, 24),
|
||||
('46', 'Lot', 15, 73),
|
||||
('47', 'Lot-et-Garonne', 2, 72),
|
||||
('48', 'Lozère', 11, 91),
|
||||
('49', 'Maine-et-Loire', 13, 52),
|
||||
('53', 'Mayenne', 13, 52),
|
||||
('51', 'Marne', 7, 21),
|
||||
('50', 'Manche', 18, 25),
|
||||
('52', 'Haute-Marne', 7, 21),
|
||||
('54', 'Meurthe-et-Moselle', 14, 41),
|
||||
('56', 'Morbihan', 5, 53),
|
||||
('55', 'Meuse', 14, 41),
|
||||
('57', 'Moselle', 14, 41),
|
||||
('58', 'Nièvre', 4, 26),
|
||||
('59', 'Nord', 16, 31),
|
||||
('60', 'Oise', 19, 26),
|
||||
('62', 'Pas-de-Calais', 16, 31),
|
||||
('61', 'Orne', 18, 25),
|
||||
('63', 'Puy-de-Dôme', 3, 83),
|
||||
('67', 'Bas-Rhin', 1, 42),
|
||||
('68', 'Haut-Rhin', 1, 42),
|
||||
('69', 'Rhône', 22, 82),
|
||||
('64', 'Pyrénées-Atlantiques', 2, 72),
|
||||
('65', 'Hautes-Pyrénées', 15, 73),
|
||||
('66', 'Pyrénées-Orientales', 11, 91),
|
||||
('70', 'Haute-Saône', 9, 43),
|
||||
('71', 'Saône-et-Loire', 4, 26),
|
||||
('72', 'Sarthe', 13, 52),
|
||||
('73', 'Savoie', 22, 82),
|
||||
('74', 'Haute-Savoie', 22, 82),
|
||||
('75', 'Paris', 10, 11),
|
||||
('76', 'Seine-Maritime', 17, 23),
|
||||
('77', 'Seine-et-Marne', 10, 11),
|
||||
('78', 'Yvelines', 10, 11),
|
||||
('79', 'Deux-Sèvres', 20, 54),
|
||||
('80', 'Somme', 19, 26),
|
||||
('81', 'Tarn', 15, 73),
|
||||
('82', 'Tarn-et-Garonne', 15, 73),
|
||||
('83', 'Var', 21, 93),
|
||||
('84', 'Vaucluse', 21, 93),
|
||||
('85', 'Vendée', 13, 52),
|
||||
('86', 'Vienne', 20, 54),
|
||||
('87', 'Haute-Vienne', 12, 74),
|
||||
('88', 'Vosges', 14, 41),
|
||||
('89', 'Yonne', 4, 26),
|
||||
('90', 'Territoire de Belfort', 9, 43),
|
||||
('91', 'Essonne', 10, 11),
|
||||
('92', 'Hauts-de-Seine', 10, 11),
|
||||
('93', 'Seine-Saint-Denis', 10, 11),
|
||||
('94', 'Val-de-Marne', 10, 11),
|
||||
('95', 'Val-d''Oise', 10, 11),
|
||||
('971', 'Guadeloupe', 23, 1),
|
||||
('972', 'Martinique', 23, 2),
|
||||
('973', 'Guyane', 23, 3),
|
||||
('974', 'Réunion', 24, 4),
|
||||
('200', 'Corse-du-Sud', 8, 94),
|
||||
('201', 'Corse-du-Sud', 8, 94),
|
||||
('202', 'Haute-Corse', 8, 94),
|
||||
('976', 'Mayotte', 0, 0),
|
||||
('988', 'Nouvelle-Calédonie', 0, 0),
|
||||
('987', 'Polynésie-Française', 0, 0),
|
||||
('975', 'Saint-Pierre-et-Miquelon', 0, 0),
|
||||
('986', 'Wallis-et-Futuna', 0, 0),
|
||||
('2B', 'Haute-Corse', 8, 94);
|
338
config/_sql/FieldsFormejuridique.sql
Normal file
338
config/_sql/FieldsFormejuridique.sql
Normal file
@ -0,0 +1,338 @@
|
||||
--
|
||||
-- Structure de la table `fields_formejuridique`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `fields_formejuridique` (
|
||||
`fjCode` int(4) NOT NULL,
|
||||
`fjLibelle` varchar(100) NOT NULL,
|
||||
`fjInsee` tinyint(1) NOT NULL,
|
||||
KEY `fjCode` (`fjCode`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- Contenu de la table `formejuridique`
|
||||
--
|
||||
|
||||
INSERT INTO `fields_formejuridique` (`fjCode`, `fjLibelle`, `fjInsee`) VALUES
|
||||
(0, 'Indéterminée', 0),
|
||||
(1, 'Personne physique', 1),
|
||||
(2, 'Groupement de droit privé non doté de la personnalité morale', 1),
|
||||
(3, 'Personne morale de droit étranger', 1),
|
||||
(4, 'Personne morale de droit public soumise au droit commercial', 1),
|
||||
(5, 'Société commerciale', 1),
|
||||
(6, 'Autre personne morale immatriculée au RCS', 1),
|
||||
(7, 'Personne morale et organisme soumis au droit administratif', 1),
|
||||
(8, 'Organisme privé spécialisé', 1),
|
||||
(9, 'Groupement de droit privé', 1),
|
||||
(11, 'Artisan Commerçant', 1),
|
||||
(12, 'Commerçant', 1),
|
||||
(13, 'Artisan', 1),
|
||||
(14, 'Officier public ou ministériel', 1),
|
||||
(15, 'Profession libérale', 1),
|
||||
(16, 'Exploitant agricole', 1),
|
||||
(17, 'Agent commercial', 1),
|
||||
(18, 'Associé Gérant de société', 1),
|
||||
(19, '(Autre) personne physique', 1),
|
||||
(21, 'Indivision', 1),
|
||||
(22, 'Société créée de fait', 1),
|
||||
(23, 'Société en participation', 1),
|
||||
(27, 'Paroisse hors zone concordataire', 1),
|
||||
(29, 'Autre groupement de droit privé non doté de la personnalité morale', 1),
|
||||
(31, 'Personne morale de droit étranger, immatriculée au RCS (registre du commerce et des sociétés)', 1),
|
||||
(32, 'Personne morale de droit étranger, non immatriculée au RCS', 1),
|
||||
(41, 'Établissement public ou régie à caractère industriel ou commercial', 1),
|
||||
(51, 'Société coopérative commerciale particulière', 1),
|
||||
(52, 'Société en nom collectif', 1),
|
||||
(53, 'Société en commandite', 1),
|
||||
(54, 'Société à responsabilité limité', 1),
|
||||
(55, 'Société anonyme à conseil d''administration', 1),
|
||||
(56, 'Société anonyme à directoire', 1),
|
||||
(57, 'Société par actions simplifiée', 1),
|
||||
(61, 'Caisse d''épargne et de prévoyance', 1),
|
||||
(62, 'Groupement d''intérêt économique', 1),
|
||||
(63, 'Société coopérative agricole', 1),
|
||||
(64, 'Société d''assurance mutuelle', 1),
|
||||
(65, 'Société civile', 1),
|
||||
(69, 'Autre personne morale de droit privé inscrite au registre du commerce et des sociétés', 1),
|
||||
(71, 'Administration de l''état', 1),
|
||||
(72, 'Collectivité territoriale', 1),
|
||||
(73, 'Établissement public administratif', 1),
|
||||
(74, 'Autre personne morale de droit public administratif', 1),
|
||||
(81, 'Organisme gérant un régime de protection sociale à adhésion obligatoire', 1),
|
||||
(82, 'Organisme mutualiste', 1),
|
||||
(83, 'Comité d''entreprise', 1),
|
||||
(84, 'Organisme professionnel', 1),
|
||||
(91, 'Syndicat de propriétaires', 1),
|
||||
(92, 'Association loi 1901 ou assimilé', 1),
|
||||
(93, 'Fondation', 1),
|
||||
(99, 'Autre personne morale de droit privé', 1),
|
||||
(1000, 'Entrepreneur Individuel à Responsabilité Limité', 0),
|
||||
(1100, 'Artisan Commerçant', 1),
|
||||
(1200, 'Commerçant', 1),
|
||||
(1300, 'Artisan', 1),
|
||||
(1400, 'Officier public ou ministériel', 1),
|
||||
(1500, 'Profession libérale', 1),
|
||||
(1600, 'Exploitant agricole', 1),
|
||||
(1700, 'Agent commercial', 1),
|
||||
(1800, 'Associé Gérant de société', 1),
|
||||
(1900, '(Autre) personne physique', 1),
|
||||
(2100, 'Indivision', 0),
|
||||
(2110, 'Indivision entre personnes physiques', 1),
|
||||
(2120, 'Indivision avec personne morale', 1),
|
||||
(2200, 'Société créée de fait', 0),
|
||||
(2210, 'Société créée de fait entre personnes physiques', 1),
|
||||
(2220, 'Société créée de fait avec personne morale', 1),
|
||||
(2300, 'Société en participation', 0),
|
||||
(2310, 'Société en participation entre personnes physiques', 1),
|
||||
(2320, 'Société en participation avec personne morale', 1),
|
||||
(2385, 'Société en participation de professions libérales', 1),
|
||||
(2400, 'Fiducie', 1),
|
||||
(2700, 'Paroisse hors zone concordataire', 1),
|
||||
(2900, 'Autre groupement de droit privé non doté de la personnalité morale', 1),
|
||||
(3110, 'Représentation ou agence commerciale d''état ou organisme public étranger immatriculé au RCS', 1),
|
||||
(3120, 'Société étrangère immatriculée au RCS', 1),
|
||||
(3205, 'Organisation internationale', 1),
|
||||
(3210, 'État collectivité ou établissement public étranger', 1),
|
||||
(3220, 'Société étrangère non immatriculée au RCS', 1),
|
||||
(3290, '(Autre) personne morale de droit étranger', 1),
|
||||
(4110, 'Établissement public national à caractère industriel ou commercial doté d''un comptable public', 1),
|
||||
(4120, 'Établissement public national à caractère industriel ou commercial non doté d''un comptable public', 1),
|
||||
(4130, 'Exploitant public', 1),
|
||||
(4140, 'Établissement public local à caractère industriel ou commercial', 1),
|
||||
(4150, 'Régie d''une collectivité locale à caractère industriel ou commercial', 1),
|
||||
(4160, 'Institution Banque de France', 1),
|
||||
(5191, 'Société de caution mutuelle', 1),
|
||||
(5192, 'Société coopérative de banque populaire', 1),
|
||||
(5193, 'Caisse de crédit maritime mutuel', 1),
|
||||
(5194, 'Caisse (fédérale) de crédit mutuel', 1),
|
||||
(5195, 'Association coopérative inscrite ( droit local Alsace Moselle )', 1),
|
||||
(5196, 'Caisse d''épargne et de prévoyance à forme coopérative', 1),
|
||||
(5202, 'Société en nom collectif', 1),
|
||||
(5203, 'Société en nom collectif coopérative', 1),
|
||||
(5306, 'Société en commandite simple', 1),
|
||||
(5307, 'Société en commandite simple coopérative', 1),
|
||||
(5308, 'Société en commandite par actions', 1),
|
||||
(5309, 'Société en commandite par actions coopérative', 1),
|
||||
(5385, 'Société d''exercice libéral en commandite par action', 1),
|
||||
(5410, 'SARL nationale', 1),
|
||||
(5415, 'SARL d''économie mixte', 1),
|
||||
(5422, 'SARL immobilière pour le commerce et l''industrie (SICOMI)', 1),
|
||||
(5426, 'Société immobilière de gestion', 1),
|
||||
(5430, 'Safer en SARL', 1),
|
||||
(5431, 'SARL mixte d''intérêt agricole', 1),
|
||||
(5432, 'SARL d''intérêt collectif agricole', 1),
|
||||
(5442, 'SARL d''attribution', 1),
|
||||
(5443, 'SARL coopérative de construction', 1),
|
||||
(5451, 'SARL coopérative de consommation', 1),
|
||||
(5453, 'SARL coopérative artisanale', 1),
|
||||
(5454, 'SARL coopérative d''intérêt maritime', 1),
|
||||
(5455, 'SARL coopérative de transports', 1),
|
||||
(5458, 'SARL coopérative ouvrière de production et de crédit', 1),
|
||||
(5459, 'SARL union de sociétés coopératives', 1),
|
||||
(5460, 'Autre SARL coopérative', 1),
|
||||
(5485, 'Société d''exercice libéral à responsabilité limitée', 1),
|
||||
(5488, 'Entreprise Unipersonnelle à Responsabilité Limitée', 1),
|
||||
(5498, 'SARL unipersonnelle', 1),
|
||||
(5499, 'Autre société à responsabilité limitée', 1),
|
||||
(5505, 'SA à participation ouvrière à conseil d''administration', 1),
|
||||
(5510, 'SA nationale à conseil d''administration', 1),
|
||||
(5515, 'SA d''économie mixte à conseil d''administration', 1),
|
||||
(5520, 'Société d''investissement à capital variable (SICAV) à conseil d''administration', 1),
|
||||
(5522, 'Société anonyme immobilière pour le commerce et l''industrie (SICOMI) à conseil d''administration', 1),
|
||||
(5525, 'Société anonyme immobilière d''investissement à conseil d''administration', 1),
|
||||
(5530, 'Safer anonyme à conseil d''administration', 1),
|
||||
(5531, 'Société anonyme mixte d''intérêt agricole (SMIA) à conseil d''administration', 1),
|
||||
(5532, 'Société anonyme mixte d''intérêt collectif agricole (SICA) à conseil d''administration', 1),
|
||||
(5542, 'Société anonyme d''attribution à conseil d''administration', 1),
|
||||
(5543, 'Société anonyme coopérative de construction à conseil d''administration', 1),
|
||||
(5546, 'SA de HLM à conseil d''administration', 1),
|
||||
(5547, 'SA coopérative de production de HLM à conseil d''administration', 1),
|
||||
(5548, 'SA de crédit immobilier à conseil d''administration', 1),
|
||||
(5551, 'SA coopérative de consommation à conseil d''administration', 1),
|
||||
(5552, 'SA coopérative de commerçants détaillants à conseil d''administration', 1),
|
||||
(5553, 'SA coopérative artisanale à conseil d''administration', 1),
|
||||
(5554, 'SA coopérative (d''intérêt) maritime à conseil d''administration', 1),
|
||||
(5555, 'SA coopérative de transports à conseil d''administration', 1),
|
||||
(5558, 'SA coopérative ouvrière de production et de crédit (SCOP) à conseil d''administration', 1),
|
||||
(5559, 'SA union de sociétés coopératives à conseil d''administration', 1),
|
||||
(5560, 'Autre SA coopérative à conseil d''administration', 1),
|
||||
(5585, 'Société d''exercice libéral à forme anonyme à conseil d''administration', 1),
|
||||
(5599, 'Autre SA à conseil d''administration', 1),
|
||||
(5605, 'SA à participation ouvrière à directoire', 1),
|
||||
(5610, 'SA nationale à directoire', 1),
|
||||
(5615, 'SA d''économie mixte à directoire', 1),
|
||||
(5620, 'Société d''investissement à capital variable (SICAV) à directoire', 1),
|
||||
(5622, 'Société immobilière pour le commerce et l''industrie (SICOMI) anonyme à directoire', 1),
|
||||
(5625, 'Société immobilière d''investissement anonyme à directoire', 1),
|
||||
(5630, 'Safer anonyme à directoire', 1),
|
||||
(5631, 'Société anonyme mixte d''intérêt agricole', 1),
|
||||
(5632, 'Société anonyme d''intérêt collectif agricole', 1),
|
||||
(5642, 'Société anonyme d''attribution à directoire', 1),
|
||||
(5643, 'Société anonyme coopérative de construction à directoire', 1),
|
||||
(5646, 'Société anonyme de HLM à directoire', 1),
|
||||
(5647, 'Société coopérative de production de HLM anonyme à directoire', 1),
|
||||
(5648, 'SA de crédit immobilier à directoire', 1),
|
||||
(5651, 'SA coopérative de consommation à directoire', 1),
|
||||
(5652, 'SA coopérative de commerçants détaillants à directoire', 1),
|
||||
(5653, 'SA coopérative artisanale à directoire', 1),
|
||||
(5654, 'SA coopérative (d''intérêt) maritime à directoire', 1),
|
||||
(5655, 'SA coopérative de transport à directoire', 1),
|
||||
(5658, 'SA coopérative ouvrière de production et de crédit (SCOP) à directoire', 1),
|
||||
(5659, 'SA union de sociétés coopératives à directoire', 1),
|
||||
(5660, '(Autre) SA coopérative à directoire', 1),
|
||||
(5685, 'Société d''exercice libéral à forme anonyme à directoire', 1),
|
||||
(5699, 'Autre SA à directoire', 1),
|
||||
(5710, 'Société par actions simplifiée', 1),
|
||||
(5720, 'Société par actions simplifiée à associé unique ou société par actions simplifiée unipersonnelle', 1),
|
||||
(5785, 'Société d’exercice libéral par action simplifiée', 1),
|
||||
(5800, 'Société européenne', 1),
|
||||
(6100, 'Caisse d’épargne et de prévoyance', 1),
|
||||
(6200, 'Groupement d''intérêt économique', 0),
|
||||
(6210, 'Groupement européen d’intérêt économique', 1),
|
||||
(6220, 'Groupement d’intérêt économique', 1),
|
||||
(6316, 'Coopérative d’utilisation de matériel agricole en commun', 1),
|
||||
(6317, 'Société coopérative agricole', 1),
|
||||
(6318, 'Union de sociétés coopératives agricoles', 1),
|
||||
(6411, 'Société d’assurance mutuelle', 1),
|
||||
(6412, 'Société mutuelle d''assurance', 1),
|
||||
(6413, 'Union de sociétés mutuelles d''assurances', 1),
|
||||
(6414, 'Autre société non commerciale d''assurance', 1),
|
||||
(6521, 'Société civile de placement collectif immobilier', 1),
|
||||
(6532, 'Société civile d’intérêt collectif agricole', 1),
|
||||
(6533, 'Groupement agricole d’exploitation en commun', 1),
|
||||
(6534, 'Groupement foncier agricole', 1),
|
||||
(6535, 'Groupement agricole foncier', 1),
|
||||
(6536, 'Groupement forestier', 1),
|
||||
(6537, 'Groupement pastoral', 1),
|
||||
(6538, 'Groupement foncier rural', 1),
|
||||
(6539, 'Société civile foncière', 1),
|
||||
(6540, 'Société civile immobilière', 1),
|
||||
(6541, 'Société civile immobilière de construction vente', 1),
|
||||
(6542, 'Société civile d’attribution', 1),
|
||||
(6543, 'Société civile coopérative de construction', 1),
|
||||
(6544, 'Société immobilière d''accession progressive à la propriété', 1),
|
||||
(6551, 'Société civile coopérative de consommation', 1),
|
||||
(6554, 'Société civile coopérative (d’intérêt) maritime', 1),
|
||||
(6558, 'Société civile coopérative entre médecins', 1),
|
||||
(6560, 'Autre société civile coopérative', 1),
|
||||
(6561, 'SCP d’avocats', 1),
|
||||
(6562, 'SCP d’avocats aux conseil', 1),
|
||||
(6563, 'SCP d’avoués d’appel', 1),
|
||||
(6564, 'SCP d’huissiers', 1),
|
||||
(6565, 'SCP de notaires', 1),
|
||||
(6566, 'SCP de commissaires-priseurs', 1),
|
||||
(6567, 'SCP de greffiers de tribunal de commerce', 1),
|
||||
(6568, 'SCP de conseils juridiques', 1),
|
||||
(6569, 'SCP de commissaires aux comptes', 1),
|
||||
(6571, 'SCP de médecins', 1),
|
||||
(6572, 'SCP de dentistes', 1),
|
||||
(6573, 'SCP d’infirmiers', 1),
|
||||
(6574, 'SCP de masseurs kinésithérapeutes', 1),
|
||||
(6575, 'SCP de directeurs de laboratoire d’analyse médicale', 1),
|
||||
(6576, 'SCP de vétérinaires', 1),
|
||||
(6577, 'SCP de géomètres-experts', 1),
|
||||
(6578, 'SCP d’architectes', 1),
|
||||
(6585, '(Autres) Société Civile professionnelle', 1),
|
||||
(6588, 'Société civile laitière', 0),
|
||||
(6589, 'Société civile de moyens', 1),
|
||||
(6595, 'Caisse (locale) de crédit mutuel', 1),
|
||||
(6596, 'Caisse de crédit agricole mutuel', 1),
|
||||
(6597, 'Société civile d’exploitation agricole', 1),
|
||||
(6598, 'Exploitation agricole à responsabilité limitée', 1),
|
||||
(6599, 'Autre société civile', 1),
|
||||
(6901, 'Autres personnes de droit privé inscrites au registre du commerce et des sociétés', 1),
|
||||
(7111, 'Autorité constitutionnelle', 1),
|
||||
(7112, 'Autorité administrative indépendante', 1),
|
||||
(7113, 'Ministère', 1),
|
||||
(7120, 'Service central d’un ministère', 1),
|
||||
(7130, 'Service du ministère des Postes et Télécommunications', 1),
|
||||
(7150, 'Service du ministère de la Défense', 1),
|
||||
(7160, 'Service déconcentré à compétence nation. D’un ministère (hors Défense)', 1),
|
||||
(7171, 'Service déconcentré de l’État à compétence (inter) régionale', 1),
|
||||
(7172, 'Service déconcentré de l’État à compétence (inter) départementale', 1),
|
||||
(7179, '(Autre) Service déconcentré de l’État à compétence territoriale', 1),
|
||||
(7190, 'Ecole nationale non dotée de la personnalité morale', 1),
|
||||
(7210, 'Commune', 1),
|
||||
(7220, 'Département', 1),
|
||||
(7225, 'Territoire d’Outre-mer', 1),
|
||||
(7229, '(Autre) Collectivité territoriale', 1),
|
||||
(7230, 'Région', 1),
|
||||
(7312, 'Commune associée', 1),
|
||||
(7313, 'Section de commune', 1),
|
||||
(7314, 'Ensemble urbain', 1),
|
||||
(7321, 'Association syndicale autorisée', 1),
|
||||
(7322, 'Association foncière urbaine', 1),
|
||||
(7323, 'Association foncière de remembrement', 1),
|
||||
(7331, 'Établissement public local d’enseignement', 1),
|
||||
(7341, 'Secteur de commune', 1),
|
||||
(7342, 'District urbain', 1),
|
||||
(7343, 'Communauté urbaine', 1),
|
||||
(7345, 'Syndicat intercommunal à vocation multiple', 1),
|
||||
(7346, 'Communauté de communes', 1),
|
||||
(7347, 'Communauté de villes', 1),
|
||||
(7348, 'Communauté d''agglomération', 1),
|
||||
(7349, 'Autre établissement public local de coopération non spécialisé ou entente', 1),
|
||||
(7351, 'Institution interdépartemental ou entente', 1),
|
||||
(7352, 'Institution interrégionale ou entente', 1),
|
||||
(7353, 'Syndicat intercommunal à vocation unique', 1),
|
||||
(7354, 'Syndicat mixte communal', 1),
|
||||
(7355, 'Autre syndicat mixte', 1),
|
||||
(7356, 'Commission syndicale pour la gestion des biens indivis des communes', 1),
|
||||
(7361, 'Centre communal d''action sociale', 1),
|
||||
(7362, 'Caisse des écoles', 1),
|
||||
(7363, 'Caisse de crédit municipal', 1),
|
||||
(7364, 'Établissement d''hospitalisation', 1),
|
||||
(7365, 'Syndicat inter hospitalier', 1),
|
||||
(7366, 'Établissement public local social et médico-social', 1),
|
||||
(7371, 'Office public d''habitation à loyer modéré', 1),
|
||||
(7372, 'Service départemental d''incendie', 1),
|
||||
(7373, 'Établissement public local culturel', 1),
|
||||
(7378, 'Régie d''une collectivité locale à caractère administratif', 1),
|
||||
(7379, '(Autre) Établissement public administratif local', 1),
|
||||
(7381, 'Organisme consulaire', 1),
|
||||
(7382, 'Établissement public national ayant fonction d''administration centrale', 1),
|
||||
(7383, 'Établissement public national à caractère scientifique culturel et professionnel', 1),
|
||||
(7384, 'Autre établissement public national d''enseignement', 1),
|
||||
(7385, 'Autre établissement public national administratif à compétence territoriale limitée', 1),
|
||||
(7389, 'Établissement public national à caractère administratif', 1),
|
||||
(7410, 'Groupement d''intérêt public', 1),
|
||||
(7430, 'Établissement public des cultes d''Alsace-Lorraine', 1),
|
||||
(7450, 'Etablissement public administratif, cercle et foyer dans les armées', 1),
|
||||
(7470, 'Groupement de coopération sanitaire à gestion publique', 1),
|
||||
(7490, 'Autre personne morale de droit administratif', 1),
|
||||
(7510, 'Service d''une collectivité locale à comptabilité distincte', 1),
|
||||
(7520, 'Régie d''une collectivité locale non dotée de la personnalité morale', 1),
|
||||
(8110, 'Régime général de la sécurité sociale', 1),
|
||||
(8120, 'Régime spécial de sécurité sociale', 1),
|
||||
(8130, 'Institution de retraite complémentaire', 1),
|
||||
(8140, 'Mutualité sociale agricole', 1),
|
||||
(8150, 'Régime maladie des non-salariés non agricoles', 1),
|
||||
(8160, 'Régime vieillesse ne dépendant pas du régime général de la sécurité sociale', 1),
|
||||
(8170, 'Régime d''assurance chômage', 1),
|
||||
(8190, 'Autre régime de prévoyance sociale', 1),
|
||||
(8210, 'Mutuelle', 1),
|
||||
(8250, 'Assurance mutuelle agricole', 1),
|
||||
(8290, 'Autre organisme mutualiste', 1),
|
||||
(8310, 'Comité central d''entreprise', 1),
|
||||
(8311, 'Comité d''établissement', 1),
|
||||
(8410, 'Syndicat de salariés', 1),
|
||||
(8420, 'Syndicat patronal', 1),
|
||||
(8450, 'Ordre professionnel ou assimilé', 1),
|
||||
(8470, 'Centre technique industriel ou comité professionnel du développement économique', 1),
|
||||
(8490, 'Autre organisme professionnel', 1),
|
||||
(8510, 'Institution de prévoyance', 1),
|
||||
(8520, 'Institution de retraite supplémentaire ', 1),
|
||||
(9110, 'Syndicat de copropriété', 1),
|
||||
(9150, 'Association syndicale libre', 1),
|
||||
(9210, 'Association non déclarée', 1),
|
||||
(9220, 'Association déclarée', 1),
|
||||
(9221, 'Association déclarée "entreprises d''insertion par l''économique"', 1),
|
||||
(9222, 'Association intermédiaire', 1),
|
||||
(9223, 'Groupement d''employeurs', 1),
|
||||
(9224, 'Association d''avocats à responsabilité professionnelle individuelle', 1),
|
||||
(9230, 'Association déclarée reconnue d''utilité publique', 1),
|
||||
(9240, 'Congrégation', 1),
|
||||
(9260, 'Association de droit local', 1),
|
||||
(9300, 'Fondation', 1),
|
||||
(9900, 'Autre personne morale de droit privé', 1),
|
||||
(9970, 'Groupement de coopération sanitaire à gestion privée', 1);
|
5
config/_sql/FieldsMinmax.sql
Normal file
5
config/_sql/FieldsMinmax.sql
Normal file
@ -0,0 +1,5 @@
|
||||
CREATE TABLE `fields_minmax` (
|
||||
`cle` VARCHAR(20) PRIMARY KEY NOT NULL,
|
||||
`min` INTEGER NOT NULL,
|
||||
`max` BIGINT NOT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;;
|
1745
config/_sql/FieldsNaf.sql
Normal file
1745
config/_sql/FieldsNaf.sql
Normal file
File diff suppressed because it is too large
Load Diff
46
config/_sql/FieldsRegions.sql
Normal file
46
config/_sql/FieldsRegions.sql
Normal file
@ -0,0 +1,46 @@
|
||||
--
|
||||
-- Structure de la table `regions`
|
||||
--
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `fields_regions` (
|
||||
`REGION` tinyint(2) unsigned zerofill NOT NULL,
|
||||
`CHEFLIEU` char(5) NOT NULL,
|
||||
`TNCC` char(1) NOT NULL,
|
||||
`NC` char(30) NOT NULL,
|
||||
`NCCENR` char(30) NOT NULL,
|
||||
PRIMARY KEY (`REGION`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- Contenu de la table `regions`
|
||||
--
|
||||
|
||||
INSERT INTO `fields_regions` (`REGION`, `CHEFLIEU`, `TNCC`, `NC`, `NCCENR`) VALUES
|
||||
(01, '97105', '3', 'GUADELOUPE', 'Guadeloupe'),
|
||||
(02, '97209', '3', 'MARTINIQUE', 'Martinique'),
|
||||
(03, '97302', '3', 'GUYANE', 'Guyane'),
|
||||
(04, '97411', '0', 'LA REUNION', 'La Réunion'),
|
||||
(11, '75056', '1', 'ILE-DE-FRANCE', 'Île-de-France'),
|
||||
(21, '51108', '0', 'CHAMPAGNE-ARDENNE', 'Champagne-Ardenne'),
|
||||
(22, '80021', '0', 'PICARDIE', 'Picardie'),
|
||||
(23, '76540', '0', 'HAUTE-NORMANDIE', 'Haute-Normandie'),
|
||||
(24, '45234', '2', 'CENTRE', 'Centre'),
|
||||
(25, '14118', '0', 'BASSE-NORMANDIE', 'Basse-Normandie'),
|
||||
(26, '21231', '0', 'BOURGOGNE', 'Bourgogne'),
|
||||
(31, '59350', '2', 'NORD-PAS-DE-CALAIS', 'Nord-Pas-de-Calais'),
|
||||
(41, '57463', '0', 'LORRAINE', 'Lorraine'),
|
||||
(42, '67482', '1', 'ALSACE', 'Alsace'),
|
||||
(43, '25056', '0', 'FRANCHE-COMTE', 'Franche-Comté'),
|
||||
(52, '44109', '4', 'PAYS DE LA LOIRE', 'Pays de la Loire'),
|
||||
(53, '35238', '0', 'BRETAGNE', 'Bretagne'),
|
||||
(54, '86194', '2', 'POITOU-CHARENTES', 'Poitou-Charentes'),
|
||||
(72, '33063', '1', 'AQUITAINE', 'Aquitaine'),
|
||||
(73, '31555', '0', 'MIDI-PYRENEES', 'Midi-Pyrénées'),
|
||||
(74, '87085', '2', 'LIMOUSIN', 'Limousin'),
|
||||
(82, '69123', '2', 'RHONE-ALPES', 'Rhône-Alpes'),
|
||||
(83, '63113', '1', 'AUVERGNE', 'Auvergne'),
|
||||
(91, '34172', '2', 'LANGUEDOC-ROUSSILLON', 'Languedoc-Roussillon'),
|
||||
(93, '13055', '0', 'PROVENCE-ALPES-COTE D''AZUR', 'Provence-Alpes-Côte d''Azur'),
|
||||
(94, '2A004', '0', 'CORSE', 'Corse'),
|
||||
(98, '', '', 'TERRITOIRES D''OUTRE-MER', 'Territoires d''outre-mer'),
|
||||
(99, '', '', 'ETRANGER', 'Etranger');
|
71
config/configure.php
Normal file
71
config/configure.php
Normal file
@ -0,0 +1,71 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
//error_reporting(E_ALL & ~E_NOTICE);
|
||||
|
||||
// Define path to application directory
|
||||
defined('APPLICATION_PATH')
|
||||
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
|
||||
|
||||
// Define application environment
|
||||
defined('APPLICATION_ENV')
|
||||
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
|
||||
|
||||
// Ensure library/ is on include_path
|
||||
set_include_path(implode(PATH_SEPARATOR, array(
|
||||
realpath(APPLICATION_PATH . '/../library'),
|
||||
get_include_path(),
|
||||
)));
|
||||
|
||||
/** Zend_Application */
|
||||
require_once 'Zend/Application.php';
|
||||
|
||||
// Create application, bootstrap, and run
|
||||
$application = new Zend_Application(
|
||||
APPLICATION_ENV,
|
||||
APPLICATION_PATH . '/configs/application.ini'
|
||||
);
|
||||
|
||||
try {
|
||||
$opts = new Zend_Console_Getopt(
|
||||
//Options
|
||||
array(
|
||||
'help|?' => "Affiche les informations d'utilisation",
|
||||
'check' => "Vérifie la configuration suivant le fichier de config installé",
|
||||
'install' => "Installe et configure",
|
||||
)
|
||||
);
|
||||
$opts->parse();
|
||||
} catch (Zend_Console_Getopt_Exception $e) {
|
||||
echo $e->getUsageMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
//Usage
|
||||
if(isset($opts->help))
|
||||
{
|
||||
echo $opts->getUsageMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
$configDir = realpath(dirname(__FILE__));
|
||||
$appconfigDir = APPLICATION_PATH.'/configs';
|
||||
$hostname = exec('echo $(hostname)');
|
||||
|
||||
if(isset($opts->check))
|
||||
{
|
||||
|
||||
}
|
||||
elseif(isset($opts->install))
|
||||
{
|
||||
//Copie de la configuration
|
||||
passthru('cp -v '.
|
||||
$configDir.'/'.$hostname.'/configuration.ini' . ' ' .
|
||||
$appconfigDir.'/configuration.ini');
|
||||
|
||||
//Création du répertoire de stockage des sessions
|
||||
passthru('mkdir '.APPLICATION_PATH.'/../cache');
|
||||
passthru('mkdir '.APPLICATION_PATH.'/../cache/sessions');
|
||||
|
||||
//Modification des permissions
|
||||
passthru('chown -R www-data: '.APPLICATION_PATH.'/../');
|
||||
}
|
37
config/local/configuration.ini
Normal file
37
config/local/configuration.ini
Normal file
@ -0,0 +1,37 @@
|
||||
[server]
|
||||
name = sdsrvdev01
|
||||
|
||||
[webservice]
|
||||
location = local
|
||||
|
||||
[databases]
|
||||
db.adapter=mysqli
|
||||
db.params.host=127.0.0.1
|
||||
db.params.username=ciblage
|
||||
db.params.password=z7jq8AhvrwqQJ4Yb
|
||||
db.params.dbname=ciblage
|
||||
db.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
|
||||
|
||||
jo.adapter=mysqli
|
||||
jo.params.host=192.168.78.230
|
||||
jo.params.username=ciblage
|
||||
jo.params.password=z7jq8AhvrwqQJ4Yb
|
||||
jo.params.dbname=jo
|
||||
jo.params.persistent = true
|
||||
jo.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
|
||||
|
||||
[sphinx]
|
||||
host = 192.168.78.252
|
||||
port = 3312
|
||||
|
||||
[mail]
|
||||
method = smtp
|
||||
smpt_port =
|
||||
smtp_host = smtp.free.fr
|
||||
support = mricois@scores-decisions.com
|
||||
supportdev = mricois@scores-decisions.com
|
||||
contact = mricois@scores-decisions.com
|
||||
production = mricois@scores-decisions.com
|
||||
|
||||
[path]
|
||||
data = "d:\www\dataciblage"
|
37
config/sdsrvdev01/configuration.ini
Normal file
37
config/sdsrvdev01/configuration.ini
Normal file
@ -0,0 +1,37 @@
|
||||
[server]
|
||||
name = sdsrvdev01
|
||||
|
||||
[webservice]
|
||||
location = sdsrvdev01
|
||||
|
||||
[databases]
|
||||
db.adapter=mysqli
|
||||
db.params.host=127.0.0.1
|
||||
db.params.username=ciblage
|
||||
db.params.password=z7jq8AhvrwqQJ4Yb
|
||||
db.params.dbname=ciblage
|
||||
db.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
|
||||
|
||||
jo.adapter=mysqli
|
||||
jo.params.host=192.168.78.230
|
||||
jo.params.username=ciblage
|
||||
jo.params.password=z7jq8AhvrwqQJ4Yb
|
||||
jo.params.dbname=jo
|
||||
jo.params.persistent = true
|
||||
jo.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
|
||||
|
||||
[sphinx]
|
||||
host = 192.168.78.252
|
||||
port = 3312
|
||||
|
||||
[mail]
|
||||
method = smtp
|
||||
smpt_port =
|
||||
smtp_host = smtp.free.fr
|
||||
support = supportdev@scores-decisions.com
|
||||
supportdev = supportdev@scores-decisions.com
|
||||
contact = supportdev@scores-decisions.com
|
||||
production = supportdev@scores-decisions.com
|
||||
|
||||
[path]
|
||||
data = "/sites/dataciblage"
|
30
docs/README.txt
Normal file
30
docs/README.txt
Normal file
@ -0,0 +1,30 @@
|
||||
README
|
||||
======
|
||||
|
||||
This directory should be used to place project specfic documentation including
|
||||
but not limited to project notes, generated API/phpdoc documentation, or
|
||||
manual files generated or hand written. Ideally, this directory would remain
|
||||
in your development environment only and should not be deployed with your
|
||||
application to it's final production location.
|
||||
|
||||
|
||||
Setting Up Your VHOST
|
||||
=====================
|
||||
|
||||
The following is a sample VHOST you might want to consider for your project.
|
||||
|
||||
<VirtualHost *:80>
|
||||
DocumentRoot "C:/workspace/sdciblage2/public"
|
||||
ServerName .local
|
||||
|
||||
# This should be omitted in the production environment
|
||||
SetEnv APPLICATION_ENV development
|
||||
|
||||
<Directory "C:/workspace/sdciblage2/public">
|
||||
Options Indexes MultiViews FollowSymLinks
|
||||
AllowOverride All
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
</Directory>
|
||||
|
||||
</VirtualHost>
|
157
library/Application/Controller/Plugin/Auth.php
Normal file
157
library/Application/Controller/Plugin/Auth.php
Normal file
@ -0,0 +1,157 @@
|
||||
<?php
|
||||
class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
|
||||
{
|
||||
/**
|
||||
* Vérifie les autorisations
|
||||
* Utilise _request et _response hérités et injectés par le FC
|
||||
*
|
||||
* @param Zend_Controller_Request_Abstract $request : non utilisé, mais demandé par l'héritage
|
||||
*/
|
||||
public function preDispatch(Zend_Controller_Request_Abstract $request)
|
||||
{
|
||||
$checkAuth = true;
|
||||
if ($request->getControllerName()=='user' &&
|
||||
($request->getActionName()=='login' || $request->getActionName()=='logout') ) {
|
||||
$checkAuth = false;
|
||||
}
|
||||
|
||||
if ($checkAuth)
|
||||
{
|
||||
$login = $request->getParam('login');
|
||||
$pass = $request->getParam('pass', '');
|
||||
$hach = $request->getParam('hach');
|
||||
$checkIp = $request->getParam('checkIp');
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
|
||||
//Est ce que l'on a checkIp=only lors de la requête
|
||||
$iponly = false;
|
||||
if ($checkIp=='only') {
|
||||
$hach = 'iponly:'.$_SERVER['REMOTE_ADDR'];
|
||||
$iponly = true;
|
||||
}
|
||||
|
||||
//On vérifie le tout lors d'une connexion par url
|
||||
if ( !empty($login) && !empty($hach) ) {
|
||||
|
||||
$authAdapter = new Scores_AuthAdapter($login, $hach, $iponly);
|
||||
$result = $auth->authenticate($authAdapter);
|
||||
|
||||
if (!$result->isValid()) {
|
||||
$messageF = '';
|
||||
foreach ($result->getMessages() as $message) {
|
||||
$messageF.= $message."<br/>";
|
||||
}
|
||||
$request->setModuleName('default')
|
||||
->setControllerName('user')
|
||||
->setActionName('logout')
|
||||
->setParam('message', $messageF);
|
||||
} else {
|
||||
$storage = new Zend_Auth_Storage_Session();
|
||||
$session = new Zend_Session_Namespace($storage->getNamespace());
|
||||
$auth->setStorage($storage);
|
||||
}
|
||||
|
||||
//Sinon on reste sur le standard
|
||||
} else {
|
||||
|
||||
$layout = Zend_Layout::getMVCInstance();
|
||||
|
||||
//Pas authentifié
|
||||
if ( !$auth->hasIdentity() ) {
|
||||
|
||||
$request->setModuleName('default')
|
||||
->setControllerName('user')
|
||||
->setActionName('login');
|
||||
|
||||
} elseif (time() > $auth->getIdentity()->time ) {
|
||||
|
||||
$auth->clearIdentity();
|
||||
$storage = $auth->getStorage();
|
||||
Zend_Session::namespaceUnset($storage->getNamespace());
|
||||
|
||||
if ( $request->getControllerName()=='index' && $request->getActionName()=='index' ) {
|
||||
$request->setModuleName('default')
|
||||
->setControllerName('user')
|
||||
->setActionName('login');
|
||||
} else {
|
||||
$request->setModuleName('default')
|
||||
->setControllerName('user')
|
||||
->setActionName('logout');
|
||||
}
|
||||
|
||||
//Authentifié => on met à jour la session
|
||||
} else {
|
||||
|
||||
$identity = $auth->getIdentity();
|
||||
$identity->time = time() + $identity->timeout;
|
||||
|
||||
if ( !isset($identity->dateContrat) && $layout->isEnabled() )
|
||||
{
|
||||
//Get customer's params
|
||||
$paramsM = new Application_Model_CustomerParams();
|
||||
$sql = $paramsM->select()
|
||||
->where('idClient = ?', $identity->idClient)
|
||||
//@todo : add service from WebService
|
||||
->order('dateContrat DESC')->limit(1);
|
||||
|
||||
Zend_Registry::get('firebug')->info($sql->__toString());
|
||||
$params = $paramsM->fetchAll($sql)->toArray();
|
||||
if (count($params)>0) {
|
||||
$identity->filterRNCS = $params[0]['filterRNCS'];
|
||||
$identity->licenceINSEE = $params[0]['licenceINSEE'];
|
||||
$identity->limitLines = $params[0]['limitLines'];
|
||||
$identity->limitFiles = $params[0]['limitFiles'];
|
||||
$identity->immediatExtract = $params[0]['immediatExtract'];
|
||||
$identity->dateContrat = $params[0]['dateContrat'];
|
||||
$identity->periodContrat = $params[0]['periodContrat'];
|
||||
$identity->priceLine = $params[0]['priceLine'];
|
||||
$identity->forfait = $params[0]['forfait'];
|
||||
}
|
||||
|
||||
//Get user's preference
|
||||
$prefsM = new Application_Model_Prefs();
|
||||
$pref = $prefsM->find($identity->username)->current();
|
||||
if ($pref) {
|
||||
$identity->preferences = json_decode($pref->json, true);
|
||||
}
|
||||
|
||||
//Add a global value to join filterRNCS and preferences RNCS
|
||||
if ($identity->filterRNCS) {
|
||||
$identity->globalRNCS = 1;
|
||||
}
|
||||
|
||||
if (isset($identity->preferences['filter']['rncs']) && $identity->preferences['filter']['rncs']==1) {
|
||||
$identity->globalRNCS = 1;
|
||||
}
|
||||
}
|
||||
|
||||
Zend_Registry::get('firebug')->info($identity);
|
||||
|
||||
//No contrat define
|
||||
if ( $identity->dateContrat=='0000-00-00 00:00:00' ) {
|
||||
//If no params are detected, display a message to contact support
|
||||
$request->setModuleName('default')
|
||||
->setControllerName('aide')
|
||||
->setActionName('message')
|
||||
->setParam('typeMsg', 'support');
|
||||
}
|
||||
|
||||
//@todo : Check dateContrat and calculate end of contrat
|
||||
|
||||
$auth->getStorage()->write($identity);
|
||||
|
||||
if ( $identity->profil=="SuperAdministrateur" ) {
|
||||
$view = $layout->getView();
|
||||
$view->admin = true;
|
||||
}
|
||||
|
||||
if (Zend_Session::namespaceIsset('login')){
|
||||
Zend_Session::namespaceUnset('login');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
67
library/Application/Controller/Plugin/Comptage.php
Normal file
67
library/Application/Controller/Plugin/Comptage.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
class Application_Controller_Plugin_Comptage extends Zend_Controller_Plugin_Abstract
|
||||
{
|
||||
public function preDispatch($request)
|
||||
{
|
||||
$layout = Zend_Layout::getMVCInstance();
|
||||
if ($layout->isEnabled())
|
||||
{
|
||||
$controller = $request->getControllerName();
|
||||
$action = $request->getActionName();
|
||||
|
||||
if ($controller == 'index' && $action == 'index')
|
||||
{
|
||||
$view = $layout->getView();
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$user = $auth->getIdentity();
|
||||
|
||||
//Load ciblage to get status of sphinxsearch
|
||||
require_once 'Scores/Ciblage.php';
|
||||
$ciblage = new Ciblage();
|
||||
$status = $ciblage->Status();
|
||||
|
||||
if ($status===false) {
|
||||
|
||||
$view->CiblageError = true;
|
||||
|
||||
} else {
|
||||
|
||||
//Load def and session values
|
||||
$session = new Scores_Fields();
|
||||
|
||||
// Chargement des critères de ciblage à partir de l'enregistrement en bdd
|
||||
$id = $request->getParam('id', 0);
|
||||
if (!empty($id)) {
|
||||
$criteresM = new Application_Model_Criteres();
|
||||
$sql = $criteresM->select()
|
||||
->from($criteresM, array('criteres'))
|
||||
->where('login = ?', $user->username)
|
||||
->where('id = ?', $id);
|
||||
$row = $criteresM->fetchRow($sql);
|
||||
if ($row != null) {
|
||||
//On charge les critères
|
||||
$session->setCriteres(json_decode($row->criteres, 'true'));
|
||||
//Réalise le comptage
|
||||
$fields = new Scores_Fields();
|
||||
$ciblage = new Ciblage($fields->getValues(), $user->globalRNCS);
|
||||
$total = $ciblage->execute();
|
||||
$session->setNb('total', $total);
|
||||
if ($user->preferences['interface']['insee']==1) {
|
||||
$insee = $ciblage->calculRedevanceInsee();
|
||||
} else {
|
||||
$insee = null;
|
||||
}
|
||||
$session->setNb('insee', $insee);
|
||||
$session->setCritereSession();
|
||||
}
|
||||
}
|
||||
|
||||
$view->total = $session->getNb('total');
|
||||
$view->insee = $session->getNb('insee');
|
||||
$view->msgComptage = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
28
library/Form/Login.php
Normal file
28
library/Form/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,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
139
library/Scores/AuthAdapter.php
Normal file
139
library/Scores/AuthAdapter.php
Normal file
@ -0,0 +1,139 @@
|
||||
<?php
|
||||
class Scores_AuthAdapter implements Zend_Auth_Adapter_Interface
|
||||
{
|
||||
protected $_username;
|
||||
protected $_password;
|
||||
protected $_timeout = 1800;
|
||||
protected $_checkIp = false;
|
||||
|
||||
public function __construct($username, $password, $iponly = false)
|
||||
{
|
||||
$this->_username = $username;
|
||||
$this->_password = $password;
|
||||
if ($iponly){
|
||||
$this->_password = 'iponly:'.$_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
$this->_checkIp = $iponly;
|
||||
}
|
||||
|
||||
public function authenticate()
|
||||
{
|
||||
$adressIp = $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
$ws = new Scores_Ws($this->_username, $this->_password);
|
||||
$InfosLogin = $ws->getInfosLogin($this->_username, $adressIp);
|
||||
$identity = new stdClass();
|
||||
$identity->username = $this->_username;
|
||||
$identity->password = $this->_password;
|
||||
$identity->email = $InfosLogin->result->email;
|
||||
$identity->profil = $InfosLogin->result->profil;
|
||||
$identity->pref = $InfosLogin->result->pref;
|
||||
$identity->droits = $InfosLogin->result->droits;
|
||||
$identity->droitsClients = $InfosLogin->result->droitsClients;
|
||||
$identity->nom = $InfosLogin->result->nom;
|
||||
$identity->prenom = $InfosLogin->result->prenom;
|
||||
$identity->idClient = $InfosLogin->result->idClient;
|
||||
$identity->reference = $InfosLogin->result->reference;
|
||||
$identity->nbReponses = $InfosLogin->result->nbReponses;
|
||||
$identity->dateValidation = $InfosLogin->result->dateValidation;
|
||||
$identity->dateDerniereConnexion = $InfosLogin->result->dateDerniereConnexion;
|
||||
$identity->dateDebutCompte = $InfosLogin->result->dateDebutCompte;
|
||||
$identity->dateFinCompte = $InfosLogin->result->dateFinCompte;
|
||||
$identity->ip = $adressIp;
|
||||
$identity->modeEdition = false;
|
||||
|
||||
$timeout = (!empty($InfosLogin->result->timeout)) ? $InfosLogin->result->timeout : $this->_timeout;
|
||||
$identity->timeout = $timeout;
|
||||
|
||||
$identity->time = time() + $timeout;
|
||||
|
||||
/*
|
||||
* Adresse Ip interdites
|
||||
*/
|
||||
$ipInterdites =
|
||||
'81.252.88.0-81.252.88.7' // CTE D AGGLOMERATION DE SOPHIA
|
||||
. ';' . '195.200.187.163' // PacWan
|
||||
. ';' . '213.11.81.41' // Verizon France SAS
|
||||
. ';' . '83.206.171.252' // FR-BASE-D-INFORMATIONS-LEGALES-BI
|
||||
. ';' . '81.255.32.139'
|
||||
. ';' . '212.155.191.1*' // Satair A/S
|
||||
. ';' . '217.70.1*.17' // OJSC "Sibirtelecom"
|
||||
. ';' . '212.37.196.156' // GENERALE-MULTIMEDIA-SUD
|
||||
. ';' . '80.245.60.121' // Planete Marseille - Mailclub
|
||||
. ';' . '213.246.57.101' // IKOULA
|
||||
. ';' . '193.104.158.0-193.104.158.255' // Altares.fr
|
||||
. ';' . '195.6.3.0-195.6.3.255' // ORT
|
||||
. ';' . '217.144.112.0-217.144.116.63' // Coface
|
||||
;
|
||||
if ( $this->checkPlagesIp($ipInterdites, $adressIp) ) {
|
||||
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_UNCATEGORIZED, $identity);
|
||||
}
|
||||
|
||||
// Renvoi
|
||||
if ( is_string($InfosLogin) || $InfosLogin->error->errnum!=0){
|
||||
$message = $InfosLogin;
|
||||
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $identity, array($message));
|
||||
} elseif ($this->_username == $InfosLogin->result->login) {
|
||||
return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $identity);
|
||||
} else {
|
||||
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_UNCATEGORIZED, $identity);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Controle si une adresse IP est dans une liste des IP communiquées sous la forme 192.168.3.5-192.68.3.10;192.168.3.*;192.168.3.10
|
||||
* @param string $strPlageIP La plage d'adresses IP
|
||||
* @param string $adresseIP L'adresse IP à tester
|
||||
*/
|
||||
protected function checkPlagesIp($strPlageIP, $adresseIP)
|
||||
{
|
||||
$connected = false;
|
||||
$tabIpAllowed = explode(';', trim($strPlageIP));
|
||||
if (count($tabIpAllowed)==1 && $tabIpAllowed[0]=='') $tabIpAllowed = array();
|
||||
|
||||
foreach ($tabIpAllowed as $ip) {
|
||||
$tabPlages = explode('-', $ip);
|
||||
// C'est une plage d'adresse '-'
|
||||
if (isset($tabPlages[1]))
|
||||
$connected = $this->in_plage($tabPlages[0],$tabPlages[1],$adresseIP);
|
||||
else {
|
||||
// C'est une adresse avec ou sans masque '*'
|
||||
if (preg_match('/^'.str_replace('*','.*',str_replace('.','\.',$ip)).'$/', $adresseIP) )
|
||||
$connected=true;
|
||||
}
|
||||
if ($connected) break;
|
||||
}
|
||||
if (count($tabIpAllowed)==0) return false;
|
||||
elseif (!$connected) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here ...
|
||||
* @param unknown_type $plage_1
|
||||
* @param unknown_type $plage_2
|
||||
* @param unknown_type $ip
|
||||
* @return boolean
|
||||
*/
|
||||
protected function in_plage($plage_1,$plage_2,$ip)
|
||||
{
|
||||
$ip2 = $this->getIpNumber($ip);
|
||||
if ($ip2>=$this->getIpNumber($plage_1) && $ip2<=$this->getIpNumber($plage_2))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converti une IP en nombre
|
||||
* @param string $ip Adresse IP
|
||||
* @return integer
|
||||
*/
|
||||
protected function getIpNumber($ip) {
|
||||
$tab=explode('.', $ip);
|
||||
return (($tab[0]*256*256*256) + ($tab[1]*256*256) + ($tab[2]*256) + ($tab[3]));
|
||||
}
|
||||
|
||||
}
|
1145
library/Scores/Ciblage.php
Normal file
1145
library/Scores/Ciblage.php
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user