Compare commits

..

1 Commits
master ... 1.0

Author SHA1 Message Date
Damien LASSERRE
59aa264c85 Premiere version de ODEA
Peut stable...
2012-02-02 17:26:24 +00:00
3181 changed files with 757602 additions and 37717 deletions

3
.gitignore vendored
View File

@ -1,3 +0,0 @@
/.settings/
/.buildpath
/.project

View File

@ -1,98 +1,65 @@
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initConfig()
{
$config = new Zend_Config($this->getOptions());
Zend_Registry::set('config', $config);
return $config;
}
protected function _initViewSettings()
//Initialisation global des paramètres de vue
protected function _initViewSettings()
{
$this->bootstrap('view');
$view = $this->getResource('view');
$pathStyle = '/themes/default/styles';
$pathScript = '/themes/default/scripts';
$view = $this->getResource('view');
/*
* Si on détecte un périphérique mobile alors on charge
* les bons scripts
$theme = 'mobile';
$path = realpath(APPLICATION_PATH.'/views/'.$theme);
$view = new Zend_View();
$view->addBasePath($path);
*/
$theme = 'default';
$pathStyle = '/themes/'.$theme.'/styles';
$pathScript = '/themes/'.$theme.'/scripts';
$view->setEncoding('UTF-8');
$view->doctype('HTML5');
$view->doctype('XHTML1_STRICT');
$view->headMeta()
->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8')
->appendHttpEquiv('Content-Language', 'fr-FR');
->appendHttpEquiv('Content-Language', 'fr-FR');
$view->headLink()
->appendStylesheet('/libs/qtip/jquery.qtip.min.css', 'all')
->appendStylesheet('/libs/tree/themes/default/style.css')
->appendStylesheet('/libs/ui-1.10.3/themes/smoothness/jquery-ui.css', 'all')
->appendStylesheet($pathStyle.'/reset.css', 'all')
->appendStylesheet($pathStyle.'/jquery.qtip.css', 'all')
->appendStylesheet('/themes/jstree/default/style.css')
->appendStylesheet('/themes/jqueryui/jquery-ui.css', 'all')
->appendStylesheet($pathStyle.'/main.css', 'all');
$view->headScript()
->appendFile('/libs/jquery/jquery-1.11.3.min.js', 'text/javascript')
->appendFile('/libs/jquery/jquery.cookie.js', 'text/javascript')
->appendFile('/libs/ui-1.10.3/jquery-ui.min.js', 'text/javascript')
->appendFile('/libs/qtip/jquery.qtip.min.js', 'text/javascript')
->appendFile($pathScript.'/jquery.js', 'text/javascript')
->appendFile($pathScript.'/jquery.bgiframe.js', 'text/javascript')
->appendFile($pathScript.'/jquery.cookie.js', 'text/javascript')
->appendFile($pathScript.'/jquery-ui.js', 'text/javascript')
->appendFile($pathScript.'/jquery.qtip.js', 'text/javascript')
->appendFile($pathScript.'/scripts.js', 'text/javascript');
$view->headTitle()->setSeparator(' - ');
$view->headTitle('Odea');
$view->headTitle()->setSeparator(' - ');
$view->headTitle('Odea');
}
protected function _initLogging()
{
//Firebug
//Logger de développement
$writer = new Zend_Log_Writer_Firebug();
if(APPLICATION_ENV=='production') {
$writer->setEnabled(false);
}
if(APPLICATION_ENV=='production') $writer->setEnabled(false);
$logger = new Zend_Log($writer);
Zend_Registry::set('firebug', $logger);
}
protected function _initDb()
{
$c = new Zend_Config($this->getOptions());
try {
$db = Zend_Db::factory($c->profil->db->metier);
$dbConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'databases');
try {
$db = Zend_Db::factory($dbConfig->db);
Zend_Db_Table::setDefaultAdapter ($db);
} catch ( Exception $e ) {
if (APPLICATION_ENV == 'development') {
print_r($e);
} else {
echo "Le service est actuellement indisponible.";
}
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);
exit ( $e->getMessage() );
}
Zend_Registry::set('db', $db);
}
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
}
}

34
application/README Normal file
View File

@ -0,0 +1,34 @@
- Critères
Etablissements : Tous / Seulement les actifs / Seulement les inactifs
Type Etablissements : Tous / Uniquement les sièges / Uniquement les secondaires
Entreprises appartenant à un groupe français
Entreprise appartenant à un groupe étranger
Téléphone renseigné / non renseigné
- Secteur Géographique
Régions (insee.regions)
Départements (insee.departements)
Code Postal - Communes (insee.codepostaux)
+ Recherche textuel sur ville (code postal, commune) pour affichage liste code postal
Codes Communes Insee (insee.codepostaux)
- Forme juridique (insee.tabFJ)
Arbre de selection avec déploiement des groupes
- Activité (naf) - Entreprise, Etablissements (insee.tabNAF)
Arbre de sélection avec déploiement des groupes
- Chiffre clés
Date de création - Ancienneté (Moins d'un an, de 1 à 2, 3 à 5, 6 à 9, 10 et plus )
Nombre d'établissements (inférieur, égal, supérieur, intervalle)
Intervalle Effectif (Tranches ou Réel) - Entreprise, Etablissement
- Critères bilantiel
Date de clôture de l'exercice
Intervalle CA - Selection (Moins de 15000 euros, de 15000 à 30000, de 30000 à 75000, de 75000 à 150000, de 150000 à 750000, Plus de 750000)
Intervalle Résultat net
Intervalle CA à l'export
ACTIF - PASSIF - COMPTE DE RESULTAT - ANNEXES
Ratios
Scores (Risques de défaillance)

84
application/TODO Normal file
View File

@ -0,0 +1,84 @@
Placer les critères en session
Enregistrer régulièrement en session (SessionCriteres)
On sauvegarde, seulement si le client à mis une référence, et cliquer sur le bouton sauvegarder
Exploser les critères pour des sous comptage
Enregistrement d'un fichier login-idDefinition-timestamp
Définir la structure d'envoi des critères
Formulaire
Voir avec API Ciblage Sphinx
Voir pour l'enrichissement
Pour simplifer, l'enrichissement devra se faire à partir de la table etablissements_act
+ quelques autres tables pour des données supplémentaires
Générer un fichier avec la liste des SIREN+NIC ou SIRET + les entêtes nécessaires à l'enrichissement
Voir si le fichier doit être généré sur la plateforme de ciblage, ou par le webservice
Réplication des tables sur la plateforme ciblage
Gestion d'une queue, voir todo dans webservice
Table naf
Table régions
Table departements
Table codepostaux
Table formejuridique (tabFJ)
- Table pour la sauvegarde des critères (criteres)
id int primary key autoincrement
idClient int
login varchar
reference varchar obligatoire ?
criteres text
parent int identifiant comptage parent pour les explode default 0
dateAjout
- Table pour la sauvegarde des comptages (comptages)
id
idDefinition
resultat
uniteInsee
tarif
dateComptage
- Tables pour la sauvegarde des exports de siren (refexport)
id
idDefinition
fichier
dateExport
- profilExtraction
id
idClient
reference
criteres
tarifLigne
dateAjout
dateModif
dateSuppr
actif
- tarifsInsee
id
tarifLigne
montantMax
dateEffet

View File

@ -1 +0,0 @@
Place your config here

View File

@ -0,0 +1,30 @@
[production]
phpSettings.date.timezone = "Europe/Paris"
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
autoloaderNamespaces[] = "Application_"
resources.frontController.plugins.Auth = "Application_Controller_Plugin_Auth"
resources.frontController.plugins.Comptage = "Application_Controller_Plugin_Comptage"
resources.layout.layout = "main"
resources.layout.layoutPath = APPLICATION_PATH "/views/default"
resources.view.basePath = APPLICATION_PATH "/views/default"
[staging : production]
resources.frontController.params.displayExceptions = 0
phpSettings.soap.wsdl_cache_enabled = 0
[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
phpSettings.soap.wsdl_cache_enabled = 0
resources.frontController.params.displayExceptions = 1
[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

View File

@ -1,20 +1,9 @@
<?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'));
}
}

View File

@ -1,46 +1,42 @@
<?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);
/**
* Affiche l'arborescence des NAFs de premier niveau
*/
public function nafAction()
{
$this->_helper->layout()->disableLayout();
$fields = new Scores_Fields();
$val = $fields->getCritere($key);
$request = $this->getRequest();
$key = $request->getParam('key');
$this->view->assign('key', $key);
//Récupération des valeurs enregistrées en session
require_once 'Scores/SessionCiblage.php';
$sessionCiblage = new SessionCiblage();
$val = $sessionCiblage->getCritere($key);
$valuesChecked = array();
$valuesUndetermined = array();
if ($val != null){
$valuesChecked = $val['in'];
if (count($valuesChecked)>0) {
foreach($valuesChecked as $value){
$valuesUndetermined = array_merge($valuesUndetermined, $this->getNafParent($value, true));
}
$valuesChecked = explode(',',$val);
foreach($valuesChecked as $value){
$valuesUndetermined = array_merge($valuesUndetermined, $this->getNafParent($value, true));
}
}
$nafM = new Application_Model_CiblageNaf();
$sql = $nafM->select()->where('niveau = ?', $niveau)->order('code ASC');
$niveau = $request->getParam('niveau', 1);
$nafM = new Application_Model_Naf();
$sql = $nafM->select()->where('niveau = ?', $niveau)->order('code ASC');
$result = $nafM->fetchAll($sql)->toArray();
$tabNaf = array();
foreach($result as $item)
{
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(),
'data' => $item['code'].' - '.$item['lib'],
'attr' => array('id' => $item['code'], 'niveau' => $item['niveau']),
'state' => 'closed',
'children' => array(),
);
if (in_array($item['code'], $valuesChecked)){
$structure['attr']['class'] = 'jstree-checked';
@ -50,40 +46,40 @@ class ArborescenceController extends Zend_Controller_Action
}
$tabNaf[] = $structure;
}
$this->view->key = $key;
$this->view->naf = json_encode($tabNaf);
}
$this->view->assign('naf', json_encode($tabNaf));
}
public function nafajaxAction()
{
$this->_helper->layout()->disableLayout();
/**
* Retourne l'arborecence des NAFs de niveau supérieur à 1
*/
public function nafajaxAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$request = $this->getRequest();
$key = $request->getParam('key');
$parent = $request->getParam('parent');
$niveau = $request->getParam('niveau', 1);
$niveau = $niveau + 1;
$request = $this->getRequest();
$key = $request->getParam('key');
//Récupération des valeurs enregistrées en session
$fields = new Scores_Fields();
$val = $fields->getCritere($key);
require_once 'Scores/SessionCiblage.php';
$sessionCiblage = new SessionCiblage();
$val = $sessionCiblage->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));
}
$valuesChecked = explode(',',$val);
foreach($valuesChecked as $value){
$valuesUndetermined = array_merge($valuesUndetermined, $this->getNafParent($value));
}
}
$nafM = new Application_Model_CiblageNaf();
$sql = $nafM->select();
$request = $this->getRequest();
$niveau = $request->getParam('niveau', 1);
$niveau++;
$parent = $request->getParam('parent', '');
$nafM = new Application_Model_Naf();
$sql = $nafM->select();
if (!empty($parent) && $niveau==2) {
$sql->where('parent = ?', $parent);
} elseif (!empty($parent) && $niveau>2) {
@ -95,8 +91,8 @@ class ArborescenceController extends Zend_Controller_Action
$tabNaf = array();
foreach($result as $item){
$structure = array(
'data' => $item['code'].' - '.$item['lib'],
'attr' => array('id' => $item['code'], 'niveau' => $item['niveau']),
'data' => $item['code'].' - '.$item['lib'],
'attr' => array('id' => $item['code'], 'niveau' => $item['niveau']),
);
if (in_array($item['code'], $valuesChecked)){
$structure['attr']['class'] = 'jstree-checked';
@ -111,314 +107,225 @@ class ArborescenceController extends Zend_Controller_Action
$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_CiblageNaf();
$sql = $nafM->select()
->from($nafM, array('parent'))
->where('code = ?', $value);
$result = $nafM->fetchRow($sql);
$out[] = $result->parent;
}
return $out;
}
protected function getNafParent($value, $niveau1 = false)
{
$out = array();
if (strlen($value)>2) {
$niveau = strlen($value)-1;
$new = substr($value,0,$niveau);
$out = array_merge($out, array($new), $this->getNafParent($new, $niveau1));
} elseif (strlen($value)==2 && $niveau1 === true) {
$nafM = new Application_Model_Naf();
$sql = $nafM->select()
->from($nafM, array('parent'))
->where('code = ?', $value);
$result = $nafM->fetchRow($sql);
$out[] = $result->parent;
}
return $out;
}
/**
*
* Enter description here ...
*/
public function geographiqueAction()
{
require_once 'Scores/SessionCiblage.php';
$this->_helper->layout()->disableLayout();
$this->view->inlineScript()->appendFile('/themes/default/scripts/jquery.jstree.js');
require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage();
$val = $session->getCritere('adr_cp');
$valuesCheckeds = explode(',', $val);
if(count($valuesCheckeds) > 0) {
for($i=0;count($valuesCheckeds) > $i;$i++) {
$valuesCheckeds[$i] = substr($valuesCheckeds[$i], 1);
}
}
$valuesUndetermined = array();
if($val != null)
{
$values = explode(',', $val);
foreach($values as $valuesChecked) {
if(strlen($valuesChecked) == 5) {
$dept = substr($valuesChecked, 0, 2);
$table = new Application_Model_Departements();
$sql = $table->select()->from('departements', array('codeRegionInsee'))->where('numdep = ?',$dept);
$results = $table->fetchAll($sql)->toArray();
foreach($results as $result) {
$valuesUndetermined[] = $result['codeRegionInsee'];
}
}
if(substr($valuesChecked, 0, 1) == 'R') {
$valuesCheckeds[] = substr($valuesChecked, 1);
} else if (substr($valuesChecked, 0, 1) == 'D') {
$table = new Application_Model_Departements();
$sql = $table->select()->from('departements', array('codeRegionInsee'))->where('numdep = ?', substr($valuesChecked, 1));
$result = $table->fetchAll($sql)->toArray();
foreach($result as $item) {
$valuesUndetermined[] = $item['codeRegionInsee'];
}
}
}
}
$key = $this->getRequest()->getParam('key');
$this->view->assign('key', $key);
$regionsM = new Application_Model_Regions();
$sql = $regionsM->select()->from('regions');
$regions = $regionsM->fetchAll()->toArray();
$structure = array();
foreach($regions as $region) {
$structure = array(
'data' => $region['NCCENR'],
'attr' => array('id' => 'R'.$region['REGION'], 'niveau' => 0),
'state' => 'closed',
'children' => array()
);
if(in_array($region['REGION'], $valuesCheckeds)) {
$structure['attr']['class'] = 'jstree-checked';
}
if(in_array($region['REGION'], $valuesUndetermined)) {
$structure['attr']['class'] = 'jstree-undetermined';
}
$tabAdrDep[] = $structure;
}
$this->view->regions = json_encode($tabAdrDep);
}
public function geographiqueajaxAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$request = $this->getRequest();
$key = $request->getParam('key');
$id = $request->getParam('id');
if($id[0] == 'R') {
require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage();
$val = $session->getCritere('adr_cp');
$valuesCheckeds = array();
$valuesUndetermined = array();
if($val != null)
{
$values = explode(',', $val);
foreach($values as $valuesChecked) {
if(strlen($valuesChecked) == 5) {
$valuesUndetermined[] = substr($valuesChecked, 0, 2);
}
if(substr($valuesChecked, 0, 1) == 'D') {
$valuesCheckeds[] = substr($valuesChecked, 1);
} else if (substr($valuesChecked, 0, 1) == 'R') {
$table = new Application_Model_Departements();
$sql = $table->select()->from('departements', array('numdep'))->where('codeRegionInsee = ?', substr($valuesChecked, 1));
$result = $table->fetchAll($sql)->toArray();
foreach($result as $item) {
$valuesCheckeds[] = $item['numdep'];
}
}
}
}
$region = substr($request->getParam('id'), 1);
$deps = new Application_Model_Departements();
$sql = $deps->select()
->from('departements')
->where('codeRegionInsee = ?', $region);
$departements = $deps->fetchAll($sql)->toArray();
foreach($departements as $departement) {
$structure = array(
'data' => $departement['libdep'],
'attr' => array('id' => 'D'.$departement['numdep'], 'niveau' => 1),
'state' => 'closed',
'children' => array()
);
if(in_array($departement['numdep'], $valuesCheckeds)) {
$structure['attr']['class'] = 'jstree-checked';
}
if(in_array($departement['numdep'], $valuesUndetermined)) {
$structure['attr']['class'] = 'jstree-undetermined';
}
$departementTab[] = $structure;
}
echo json_encode($departementTab);
} else if ($id[0] == 'D')
{
require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage();
$val = $session->getCritere('adr_cp');
$valuesCheckeds = array();
if($val != null)
{
$values = explode(',', $val);
foreach($values as $valuesChecked) {
if(strlen($valuesChecked) == 5) {
$valuesCheckeds[] = $valuesChecked;
}
else if(substr($valuesChecked, 0, 1) == 'D') {
$table = new Application_Model_Codepostaux();
$sql = $table->select()->from('codepostaux', array('Codepos'))->where('Codepos LIKE "'.substr($valuesChecked, 1).'%"');
$results = $table->fetchAll($sql)->toArray();
foreach($results as $result) {
if(!in_array($result['Codepos'], $values))
$valuesCheckeds[] = $result['Codepos'];
}
} else if (substr($valuesChecked, 0, 1) == 'R') {
$Departements = new Application_Model_Departements();
$sql = $Departements->select()->from('departements', array('numdep'))->where('codeRegionInsee = ?', substr($valuesChecked, 1));
$results = $Departements->fetchAll($sql)->toArray();
foreach($results as $result) {
$table = new Application_Model_Codepostaux();
$sql = $table->select()->from('codepostaux', array('Codepos'))->where('Codepos LIKE "'.$result['numdep'].'%"');
$codes = $table->fetchAll($sql)->toArray();
foreach($codes as $code) {
if(!in_array($result['Codepos'], $values))
$valuesCheckeds[] = $code['Codepos'];
}
}
}
}
}
$numdep = substr($request->getParam('id'), 1);
$code = new Application_Model_Codepostaux();
$sql = $code->select()
->from('codepostaux')
->where('Codepos LIKE "'.$numdep.'%"');
$codePostaux = $code->fetchAll($sql)->toArray();
foreach($codePostaux as $codePostau) {
$structure = array(
'data' => '[ '.$codePostau['Codepos'].' ]'.ucfirst(strtolower($codePostau['Commune'])),
'attr' => array('id' => $codePostau['Codepos'], 'niveau' => 2)
);
if(in_array($codePostau['Codepos'], $valuesCheckeds)) {
$structure['attr']['class'] = 'jstree-checked';
}
$CodePostauxTab[] = $structure;
}
echo json_encode($CodePostauxTab);
}
}
/**
*
* Enter description here ...
*/
public function juridqueAction()
{
$valeurs = $this>getRequest()->getParam('');
}
/* 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_CiblageRegions();
$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_CiblageDepartements();
$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_CiblageCodePostaux();
$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_CiblageDepartements();
$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_CiblageCodePostaux();
$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_CiblageFormeJuridique();
$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_CiblageFormeJuridique();
$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);
}
}
}

View File

@ -1,124 +1,68 @@
<?php
class ComptageController extends Zend_Controller_Action
{
public function indexAction()
{
public function indexAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$request = $this->getRequest();
//Session
require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage();
$cle = $request->getParam('cle');
$valeur = $request->getParam('valeur');
$request = $this->getRequest();
$key = $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;
}
$sessionValeur = $session->getCritere($key);
if($sessionValeur == "" && empty($valeur)) {
$session->unsetCritere($key);
} else {
$error = 2;
$session->setCritere($key, $valeur);
}
//@todo : Ajouter les critères sous forme json_encode
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
require_once 'Scores/Field.php';
$field = new Fields($user->username);
//Comptage
require_once 'Scores/Ciblage.php';
$ciblage = new Ciblage($field->getValues());
$total = $ciblage->execute();
$insee = $ciblage->calculRedevanceInsee();
$session->setNb('total', $total);
$session->setNb('insee', $insee);
//Retour comptage, unité Insee
$result = array(
'count' => number_format($total, 0, '', ' '),
'insee' => ($insee!==null) ? number_format($insee, 0, '', ' ') : null,
'error' => $error,
'count' => number_format($total, 0, '', ' '),
'insee' => number_format($insee, 0, '', ' ')
);
echo json_encode($result);
}
$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('/');
}
/**
* Affichage formulaire de sauvegarde
*/
public function savedialogAction()
{
$this->_helper->layout()->disableLayout();
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
//No contrat define
if ( empty($user->dateContrat) || $user->dateContrat=='0000-00-00 00:00:00' ) {
//If no params are detected, display a message to contact support
$this->view->typeMsg = 'support';
}
//Check dateContrat and calculate end of contrat
else {
$hour = intval(substr($user->dateContrat,11,2));
$min = intval(substr($user->dateContrat,14,2));
$sec = intval(substr($user->dateContrat,17,2));
$month = intval(substr($user->dateContrat,5,2)) + $user->periodContrat;
$day = intval(substr($user->dateContrat,8,2));
$year = intval(substr($user->dateContrat,0,4));
$dateFinContrat = mktime($hour,$min,$sec,$month,$day,$year);
if ( time() > $dateFinContrat ) {
$this->view->typeMsg = 'contrat';
}
}
//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;
require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage();
$criteres = $session->getCriteres();
$this->view->assign('criteres', $criteres);
if (count($criteres)==0) {
$this->view->assign('noSelection', true);
}
$this->view->reference = $user->username.'-'.date('YmdHis');
}
/**
* Sauvegarde du profil de ciblage et de son comptage
*/
public function saveAction()
{
$this->_helper->layout()->disableLayout();
@ -127,32 +71,26 @@ class ComptageController extends Zend_Controller_Action
$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 !"));
'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');
require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage();
$criteres = $session->getCriteres();
$resultat = $session->getNb('total');
$nbInsee = $session->getNb('insee');
//Informations utilisateur
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$db = Zend_Registry::get('db');
//Enregistrement des critères
$criteresM = new Application_Model_CiblageCriteres();
$criteresM = new Application_Model_Criteres($db);
$data = array(
'idClient' => $user->idClient,
'login' => $user->username,
@ -163,212 +101,32 @@ class ComptageController extends Zend_Controller_Action
);
$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();
}
if ($id){
//Enregistrement des valeurs du comptage
$comptageM = new Application_Model_CiblageComptages();
$comptageM = new Application_Model_Comptages($db);
$data = array(
'idDefinition' => $id,
'resultat' => $resultat,
'uniteInsee' => $nbInsee,
'dateAjout' => date('Y-m-d H:i:s'),
'idDefinition' => $id,
'resultat' => $resultat,
'uniteInsee' => $nbInsee,
'tarif' => '',
'dateAjout' => date('Y-m-d H:i:s'),
);
if ($comptageM->insert($data)) {
echo json_encode(array(
'error'=>0,
'msg'=> "Vos critères ont été sauvegardés sous la référence $ref",
'href' => $this->view->url(array('controller'=>'dashboard', 'action'=>'ciblage', 'id'=>$id))
));
'msg'=> "Vos critères ont été sauvegardés sous la référence $ref"));
} else {
echo json_encode(array(
'error'=>1,
'msg'=> "Erreur lors de l'enregistrement"));
'error'=>1,
'msg'=> "Erreur lors de l'enregistrement"));
}
} else {
echo json_encode(array(
'error'=>1,
'msg'=> "Erreur lors de l'enregistrement"));
'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_CiblageCriteres();
$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_CiblageComptages();
$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);
/**
* Make SQL request with the client profil for columns
*/
$profilsM = new Application_Model_CiblageEnrichissementProfils();
$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');
}
$tabEntete = $tabEnteteLabel = array();
require_once 'Scores/Enrichissement.php';
$enrichissement = new Enrichissement();
$fields = $enrichissement->getFields();
$columns = array();
$joins = array();
foreach ( $profil as $item ) {
//Get item
if ( array_key_exists($item, $fields) ) {
$field = $fields[$item];
//Définition de l'entete
$tabEnteteLabel[] = $field['label'];
$tabEntete[] = $item;
//Construction de la requete SQL
if ( array_key_exists('sql', $field) ) {
$columns[] = new Zend_Db_Expr($field['sql']);
} else {
$columns[] = $field['column'].' AS '.$item;
}
//Pour les champs de type "code", ajouter le libellé
if ( array_key_exists('join', $field) ) {
$tabEnteteLabel[] = $field['join']['label'];
$joinColumn = $item.'Lib';
$tabEntete[] = $joinColumn;
//Sql
$tableAlias = $item.'L';
$join['name'] = $field['join']['table'].' AS '.$tableAlias;
$join['col'] = $field['join']['column'].' AS '.$joinColumn;
$join['cond'] = $field['join']['cond'];
$joins[] = $join;
}
}
}
$db = Zend_Db_Table::getDefaultAdapter();
$sql = $db->select()->from('jo.etablissements_act', $columns);
$i = 0;
foreach ( $sirets as $siret ) {
if ( $i > 0 ) {
$sql->orWhere("siren='".substr($siret,0,9)."' AND nic='".substr($siret,9,5)."'");
} else {
$sql->where("siren='".substr($siret,0,9)."' AND nic='".substr($siret,9,5)."'");
}
$i++;
}
if (count($joins)) {
foreach ( $joins as $join ) {
$sql->joinLeft($join['name'], $join['cond'], $join['col']);
}
}
try {
$result = $db->fetchAll($sql, null, Zend_Db::FETCH_ASSOC);
} catch(Zend_Db_Exception $e) {
if (APPLICATION_ENV=='development') {
echo $e->getMessage();
echo "<br/>";
echo $sql->__toString();
}
}
$liste = array();
foreach ($result as $i => $tabData) {
//Trier pour la sortie
$tabSortie = array();
foreach($tabEntete as $key) {
//Add static values
if ( array_key_exists($key, $fields) ) {
if ( array_key_exists('values', $fields[$key]) ) {
$values = $fields[$key]['values'];
//Remplace value if exist
if ( array_key_exists($tabData[$key], $values) ) {
$tabData[$key] = $values[$tabData[$key]];
}
}
}
//Order data for CSV file
$tabSortie[] = isset($tabData[$key]) ? $tabData[$key] : '';
}
$liste[] = $tabSortie;
}
Zend_Registry::get('firebug')->info($liste);
$this->view->assign('label', $tabEnteteLabel);
$this->view->assign('liste', $liste);
}
}

View File

@ -0,0 +1,42 @@
<?php
class CriteresController extends Zend_Controller_Action
{
public function init()
{
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$field = new Fields($user->username);
$this->view->fields = $field;
$this->view->headScript()->appendFile('/themes/default/scripts/jquery.jstree.js', 'text/javascript');
}
public function indexAction()
{
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
if ($user->customisation) {
$this->view->assign('preferences', $user->customisation);
}
}
public function entrepriseAction(){
$this->view->headLink()->appendStylesheet('/themes/default/styles/criteres/'.$this->getRequest()->getActionName().'.css', 'all');
}
public function economiqueAction(){
$this->view->headLink()->appendStylesheet('/themes/default/styles/criteres/'.$this->getRequest()->getActionName().'.css', 'all');
}
public function geographiqueAction(){
$this->view->headLink()->appendStylesheet('/themes/default/styles/criteres/'.$this->getRequest()->getActionName().'.css', 'all');
}
public function juridiqueAction(){
$this->view->headLink()->appendStylesheet('/themes/default/styles/criteres/'.$this->getRequest()->getActionName().'.css', 'all');
}
public function financiereAction(){
$this->view->headLink()->appendStylesheet('/themes/default/styles/criteres/'.$this->getRequest()->getActionName().'.css', 'all');
}
}

View File

@ -1,24 +1,31 @@
<?php
/**
* Tableau de bord de gestion pour le client
* Permet de retrouver ces différents comptages et export
*
*/
class DashboardController extends Zend_Controller_Action
{
public function init()
{
$this->view->headLink()
->appendStylesheet('/themes/default/styles/dashboard.css', 'all')
->appendStylesheet('/libs/jqpagination/jqpagination.css', 'all');
$this->view->headScript()
->appendFile('/libs/jqpagination/jquery.jqpagination.min.js', 'text/javascript')
->appendFile('/themes/default/scripts/dashboard.js', 'text/javascript');
}
public function init()
{
$this->view->headScript()->appendFile('/themes/default/scripts/dashboard.js', 'text/javascript');
$this->view->headLink()->appendStylesheet('/themes/default/styles/dashboard.css');
}
public function indexAction()
{
$auth = Zend_Auth::getInstance();
/**
* Affiche le tableau de bord
*/
public function indexAction()
{
//Liste des derniers comptages
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$criteresM = new Application_Model_CiblageCriteres();
$sql = $criteresM->select()
->from($criteresM, array('id', 'reference', 'dateAjout'))
$db = Zend_Registry::get('db');
$criteresM = new Application_Model_Criteres($db);
$sql = $criteresM->select(true)
->columns(array('id', 'reference', 'dateAjout'))
->where("idClient = ?", $user->idClient)
->where("login = ?", $user->username)
->order('dateAjout DESC')
@ -26,9 +33,8 @@ class DashboardController extends Zend_Controller_Action
$rows = $criteresM->fetchAll($sql);
//
$results = array();
$comptagesM = new Application_Model_CiblageComptages();
$comptagesM = new Application_Model_Comptages($db);
foreach($rows->toArray() as $item)
{
$info = array(
@ -37,8 +43,8 @@ class DashboardController extends Zend_Controller_Action
'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"))
$sql = $comptagesM->select(true)
->columns(array('resultat', 'uniteInsee', 'dateAjout'))
->where('idDefinition = ?', $item['id'])
->order('dateAjout DESC')->limit(1);
$comptage = $comptagesM->fetchAll($sql)->toArray();
@ -51,164 +57,133 @@ class DashboardController extends Zend_Controller_Action
$results[] = $info;
}
$this->view->assign('comptages', $results);
$this->view->comptages = $results;
//Rechercher un comptage
//
$enrichissements = new Application_Model_CiblageEnrichissementIdentifiants();
$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();
public function menuAction()
{
$criteresM = new Application_Model_CiblageCriteres();
}
//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);
/**
* Affiche la liste des ciblages avec pagination
*/
public function ciblagesAction()
{
$request = $this->getRequest();
$rows = $criteresM->fetchAll($sql);
$results = array();
$comptagesM = new Application_Model_CiblageComptages();
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();
$page = $request->getParam('page', 1);
$offset = 20;
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;
$this->view->page = $page;
$this->view->nbPages = ceil($nbCiblage/$offset);
}
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_CiblageCriteres();
$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_CiblageComptages();
$sql = $comptageM->select()
->where('idDefinition = ?', $comptageId)
->order('dateAjout DESC');
$comptages = $comptageM->fetchAll($sql)->toArray();
//Lecture enrichissement existe
$enrichissementsM = new Application_Model_CiblageEnrichissementIdentifiants();
$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');
//Liste des ciblages par paquet de n
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$criteresM = new Application_Model_CiblageCriteres();
$db = Zend_Registry::get('db');
$criteresM = new Application_Model_Criteres($db);
//Compter le nombre de page
$sql = $criteresM->select()
->from($criteresM, array('nb' => 'COUNT(*)'))
->where("idClient = ?", $user->idClient)
->where("login = ?", $user->username);
$count = $criteresM->fetchRow($sql);
$nbCiblage = $count->nb;
//Récupérer les informations
$position = ($page-1)*$offset+1;
$sql = $criteresM->select()
->from($criteresM, array('id', 'reference', 'dateAjout'))
->where("idClient = ?", $user->idClient)
->where("login = ?", $user->username)
->order('dateAjout DESC')
->limitPage($position, $offset);
$rows = $criteresM->fetchAll($sql);
$results = array();
$comptagesM = new Application_Model_Comptages($db);
foreach($rows->toArray() as $item)
{
$info = array(
'id' => $item['id'],
'reference' => $item['reference'],
'dateCriteres' => $item['dateAjout'],
);
//Recherche des comptages
$sql = $comptagesM->select(true)
->columns(array('resultat', 'uniteInsee', 'dateAjout'))
->where('idDefinition = ?', $item['id'])
->order('dateAjout DESC')->limit(1);
$comptage = $comptagesM->fetchAll($sql)->toArray();
if (count($comptage)>0){
$info['resultat'] = $comptage[0]['resultat'];
$info['uniteInsee'] = $comptage[0]['uniteInsee'];
$info['dateComptage'] = $comptage[0]['dateAjout'];
}
$results[] = $info;
}
$this->view->assign('ciblages', $results);
$this->view->assign('nbCiblage', $nbCiblage);
}
/**
* Affiche le détail du comptage
* comptage multiple, fichier, etc....
*/
public function ciblagedetailAction()
{
$request = $this->getRequest();
$id = $request->getParam('id');
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$db = Zend_Registry::get('db');
$criteresM = new Application_Model_Criteres($db);
$sql = $criteresM->select()
->where("idClient = ?", $user->idClient)
->where("login = ?", $user->username)
->where("id = ?", $id);
$criteres = $criteresM->fetchRow($sql);
$this->view->assign('criteres', $criteres->toArray());
if ($criteres != null){
$comptagesM = new Application_Model_Comptages($db);
$sql = $comptagesM->select()
->where('idDefinition = ?', $id);
$comptages = $comptagesM->fetchAll($sql);
$this->view->assign('comptages', $comptages->toArray());
}
}
/**
* Recherche un comptage avec la référence ou la date
*/
public function rcomptageAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$request = $this->getRequest();
$q = strtolower($this->getRequest()->getParam('q', ''));
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$db = Zend_Registry::get('db');
$criteresM = new Application_Model_Criteres($db);
$sql = $criteresM->select()
->from($criteresM, array('id', 'reference', "DATE_FORMAT(dateAjout, '%d/%m/%Y') as date"))
->where("idClient = ?", $user->idClient)
@ -220,212 +195,32 @@ class DashboardController extends Zend_Controller_Action
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)),
'value' => $item->reference,
'url' => $this->view->url(array('controller'=>'dashboard', 'action'=>'ciblagedetail', '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_CiblageEnrichissementIdentifiants();
// Pending
$sql = $enrichissementsM->select()
->setIntegrityCheck(false)
->from(
array('i' => 'enrichissement_identifiants'),
array('id', 'reference', 'fichier', 'nbLigneTotales', 'nbLigneTraites', 'error', 'dateAdded', 'dateStart', 'dateStop')
)
->join(
array('c' => 'ciblage_comptages'), 'i.idComptage = c.id',
array('')
)
->join(
array('criteres' => 'ciblage_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;
$sql = $enrichissementsM->select()
->setIntegrityCheck(false)
->from(
array('i' => 'enrichissement_identifiants'),
array('id', 'reference', 'fichier', 'nbLigneTotales', 'nbLigneTraites', 'error', 'dateAdded', 'dateStart', 'dateStop')
)
->join(
array('c' => 'ciblage_comptages'), 'i.idComptage = c.id',
array('')
)
->join(
array('criteres' => 'ciblage_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
* Gestion de la configuration de l'application
*/
public function configurationAction()
{
//Préférences
//Profil extraction
//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);
}
}
$timestamp = strtotime( $user->dateContrat );
$dateBegin = date( 'd/m/Y', $timestamp );
$timestamp = mktime(0,0,0,substr($dateBegin,3,2)+$user->periodContrat,substr($dateBegin,0,2), substr($dateBegin,6,4));
$dateEnd = date( 'd/m/Y', $timestamp );
$this->view->assign('dateBegin', $dateBegin);
$this->view->assign('dateEnd', $dateEnd);
//Customer params have an option on the RNCS filter
$this->view->assign('filterRNCS', $user->filterRNCS);
$this->view->assign('licenceINSEE', $user->licenceINSEE);
$this->view->assign('immediatExtract', $user->immediatExtract);
$tarifText = '';
//Tarifs
if ($user->forfait!=0) {
//Forfait de
$tarifText = 'Forfait de '.$user->forfait.' euros';
} else {
$tarifText = 'Tarif unitaire à la ligne de '.$user->priceLine.' euros';
}
//Paramètres
if ( $user->limitFiles!=0 && $user->limitLines!=0 ) {
$tarifText.= ' limité à '.$user->limitFiles.' fichiers et à '.$user->limitLines.' lignes par fichier.';
} elseif ( $user->limitFiles!=0 && $user->limitLines==0 ) {
$tarifText.= ' limité à '.$user->limitFiles.' fichiers';
} elseif ( $user->limitFiles==0 && $user->limitLines!=à ) {
$tarifText.= ' limité à '.$user->limitLines.' lignes par fichier.';
}
$this->view->assign('tarifText', $tarifText);
//List of data to extract
$profilsM = new Application_Model_CiblageEnrichissementProfils();
$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->reference = $result['reference'];
$this->view->assign('profil', $profil);
}
}
/**
* Set preferences
* Liste des exportations simple non lié à un ciblage
*/
public function prefAction()
public function exportsAction()
{
$this->_helper->layout()->disableLayout();
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
//Read prefs table to load actual config
$prefsM = new Application_Model_CiblagePrefs();
$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);
}

View File

@ -14,7 +14,7 @@ class EnrichissementController extends Zend_Controller_Action
public function fileformAction()
{
$this->view->headScript()->appendFile('/libs/form/jquery.form.min.js', 'text/javascript');
$this->view->headScript()->appendFile('/themes/default/scripts/jquery.form.js', 'text/javascript');
$this->view->headScript()->appendFile('/themes/default/scripts/jqueryprogressbar.js', 'text/javascript');
$this->view->assign('filesize', ini_get('upload_max_filesize'));
}
@ -24,8 +24,8 @@ class EnrichissementController extends Zend_Controller_Action
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$c = Zend_Registrey::get('config');
$path = realpath($c->profil->path->data).'/clients';
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'path');
$path = realpath($config->data).'/clients';
if(!file_exists($path)) mkdir($path);
if ( isset($_FILES) && count($_FILES)==1 ){
@ -57,303 +57,12 @@ class EnrichissementController extends Zend_Controller_Action
$request = $this->getRequest();
$key = $request->getParam('key', '');
if ( !empty($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_CiblageComptages();
$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_CiblageCriteres();
$criteresRow = $criteresM->find($idCriteres);
$criteres = $criteresRow->current();
$structure = json_decode($criteres->criteres, true);
//Informations utilisateur
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
//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_CiblageEnrichissementIdentifiants();
$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()
{
//Constantes
$resultatMax = 50000;
$redevanceInsee = 3.295/100;
$redevanceInseeMax = 52734; //Seuil de facturation 52 734 euros
$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();
//Other profil for this login ?
$profilsM = new Application_Model_CiblageEnrichissementProfils();
$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_CiblageComptages();
$sql = $comptagesM->select()
->where('idDefinition = ?', $idCritere)
->order('dateAjout DESC')
->limit(1);
$comptages = $comptagesM->fetchAll($sql);
$criteresM = new Application_Model_CiblageCriteres();
$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 : 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'] * $user->priceLine + $prixInsee, 2);
// --- Dépassement du nombre d'unité max à enrichir
if ( $item['resultat'] > $resultatMax ) {
$this->view->assign('resultatOver', true);
}
// --- Pas de forfait
elseif ( $user->forfait == 0 ) {
// --- Fichier illimité (avec nombre de lignes max définies)
if ( $user->limitFiles == 0 ) {
// --- Nombres de lignes dépassées
if ( $item['resultat'] > $user->limitLines ) {
$this->view->assign('resultatOver', 'lines');
}
}
// --- Fichier limité (avec nombre de lignes définies)
elseif ( $user->limitFiles > 0 ) {
// --- Nombres de lignes dépassées
if ( $user->limitLines != 0 && $item['resultat'] > $user->limitLines ) {
$this->view->assign('resultatOver', 'lines');
} else {
// --- Nombre de fichier dépassés
$dateBegin = $user->dateContrat;
$dateEnd = date('Y-m-d H:i:s', mktime(0,0,0,substr($user->dateContrat,5,2)+$user->periodContrat, substr($user->dateContrat,8,2), substr($user->dateContrat,0,4)));
try {
$commandesM = new Application_Model_CiblageEnrichissementIdentifiants();
$sql = $commandesM->select()->setIntegrityCheck(false)
->from( array('commande' => 'enrichissement_identifiants'), array('id'))
->join( array('critere' => 'ciblage_criteres'), 'critere.id = commande.idCriteres', array())
->where("dateAdded BETWEEN '".$dateBegin."' AND '".$dateEnd."'")
->where('idClient = ?', $user->idClient);
$result = $commandesM->fetchAll($sql);
} catch (Zend_Db_Exception $e) {
echo "Erreur."; /*echo $sql->__toString();*/ exit;
}
if ( count($result)+1 > $user->limitFiles) {
$this->view->assign('resultatOver', 'files');
}
$result = $commandesM->fetchAll($sql);
if ( $result->count()+1 > $user->limitFiles) {
$this->view->assign('resultatOver', 'files');
}
}
}
}
// --- Forfait - Liste des commandes et calcul
else {
if ( $user->priceLine != 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_CiblageEnrichissementIdentifiants();
$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 * $user->priceLine + $insee * $redevanceInsee, 2);
}
$this->view->forfaitRemain = $user->forfait - $conso - $prix;
$this->view->Paiement = 'LINE';
} else {
$this->view->Paiement = 'FORFAIT';
}
}
$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);
$auth = Zend_Auth::getInstance();
$identity = $auth->getIdentity();
$id = $this->getRequest()->getParam('id');
/*
* Do not download file that not own by the user
* List profil
*/
$profilM = new Application_Model_CiblageEnrichissementProfils();
$sql = $profilM->select()
->from($profilM, array('id'))
->where('login=?',$identity->username);
$profils = $profilM->fetchAll($sql);
if ( $profils->count()>0 ) {
$profilList = array();
foreach ( $profils->toArray() as $item ) {
$profilList[] = $item['id'];
}
}
/*
* List finish file
*/
$table = new Application_Model_CiblageEnrichissementIdentifiants();
$sql = $table->select()
->where('idProfil IN('.join(',', $profilList).')')
->where('id = ?', $id);
$result = $table->fetchRow($sql);
if(!empty($result)) {
$result = $result->toArray();
$date = substr($result['dateAdded'],0,4).substr($result['dateAdded'],5,2);
$c = Zend_Registry::get('config');
$path = $c->profil->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.';
}
}
}

View File

@ -1,42 +0,0 @@
<?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]);
}
}
}
}

View File

@ -6,7 +6,7 @@ class ErrorController extends Zend_Controller_Action
$errors = $this->_getParam('error_handler');
switch ($errors->type) {
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
@ -14,7 +14,6 @@ class ErrorController extends Zend_Controller_Action
$this->getResponse()->setHttpResponseCode(404);
$this->view->message = 'Page not found';
break;
default:
// application error
$this->getResponse()->setHttpResponseCode(500);
@ -22,34 +21,6 @@ class ErrorController extends Zend_Controller_Action
break;
}
$auth = Zend_Auth::getInstance();
$identity = $auth->getIdentity();
//Envoyer les erreurs par mail
$message = '';
$message.= 'Erreur Applicative : ';
$message.= "\n";
$message.= 'Message : '.$errors->exception->getMessage();
$message.= "\n";
$message.= 'Utilisateur : '.$identity->username;
$message.= "\n";
$message.= "File :".$errors->exception->getFile().", Ligne : ".$errors->exception->getLine();
$message.= "\n";
$message.= "Detail :\n".$errors->exception->getTraceAsString();
$message.= "\n\n";
$message.= "Request Parameters :\n ".print_r($this->getRequest()->getParams(), true)."\n";
$message.= "Referer : ".$_SERVER['HTTP_REFERER']."\n";
$c = Zend_Registry::get('config');
require_once 'Scores/Mail.php';
$mail = new Mail();
$mail->setSubject('[ERREUR APPLICATIVE] - '.$c->profil->server->name.' -'.date('Ymd'));
$mail->setBodyTexte($message);
$mail->setFrom('supportdev');
$mail->addToKey('supportdev');
$mail->send();
// Log exception, if logger available
if ($log = $this->getLog()) {
$log->crit($this->view->message, $errors->exception);

View File

@ -0,0 +1,7 @@
<?php
class ExtractionController extends Zend_Controller_Action
{
public function indexAction(){
}
}

View File

@ -1,246 +0,0 @@
<?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_CiblageNaf();
$sql = $table->select();
if (count($queries)>0) {
$where = '';
$i = 0;
foreach ($queries as $item) {
$i++;
if (empty($where)) {
$op = 'LIKE ';
} elseif ($i < count($queries)) {
$op = ' OR ';
}
if (strlen($item)>2) {
$where.= $op.'"%'.strtolower($item).'%"';
}
}
$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_CiblageRegions();
$sql = $table->select();
if (count($queries)>0) {
$where = '';
$i = 0;
foreach ($queries as $item) {
$i++;
if (empty($where)) {
$op = 'LIKE ';
} else {
$op = ' OR ';
}
if (strlen($item)>2) {
$where.= $op.'"%'.strtolower($item).'%"';
}
}
$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_CiblageDepartements();
$sql = $table->select();
if (count($queries)>0) {
$where = '';
$i = 0;
foreach ($queries as $item) {
$i++;
if (empty($where)) {
$op = 'LIKE ';
} else {
$op = ' OR ';
}
if (strlen($item)>2) {
$where.= $op.'"%'.strtolower($item).'%"';
}
}
$sql->where("LOWER(libdep) ".$where);
}
$result = $table->fetchAll($sql);
foreach ($result as $item) {
$output[] = array(
'label' => $item->libdep . ' (Département)',
'value' => 'D'.$item->numdep
);
}
//Ville
$table = new Application_Model_CiblageCodePostaux();
$sql = $table->select();
if (count($queries)>0) {
$where = '';
$i = 0;
foreach ($queries as $item) {
$i++;
if (empty($where)) {
$op = 'LIKE ';
} else {
$op = ' OR ';
}
if (strlen($item)>2) {
$where.= $op.'"%'.strtolower($item).'%"';
}
}
$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 Département
if (strlen($q)==2) {
$table = new Application_Model_CiblageDepartements();
$sql = $table->select()->where('numdep=?', $q);
$result = $table->fetchAll($sql);
foreach ($result as $item) {
$output[] = array(
'label' => $item->libdep . ' (Département)',
'value' => 'D'.$item->numdep
);
}
}
//Code Postal
$table = new Application_Model_CiblageCodePostaux();
$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_CiblageFormeJuridique();
$separator = ' , ';
$sql = $table->select();
$queries = explode(' ', $q);
if (count($queries)>0) {
$where = '';
$i = 0;
foreach ($queries as $item) {
$i++;
if (empty($where)) {
$op = 'LIKE ';
} else {
$op = ' OR ';
}
if (strlen($item)>3) {
$where.= $op.'"%'.strtolower($item).'%"';
}
}
$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(){}
}

View File

@ -1,591 +0,0 @@
<?php
class GestionController extends Zend_Controller_Action
{
protected $dbMetier;
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');
//Get Database
$c = Zend_Registry::get('config');
try {
$this->dbMetier = Zend_Db::factory($c->profil->db->jo);
} catch ( Exception $e ) {
}
}
/**
* 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_CiblageEnrichissementProfils();
$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);
if ( count($profils)>0 ) {
$clientM = new Application_Model_Sdv1Clients();
$i = 0;
foreach ($profils as $profil) {
$infoClient = $clientM->find($profil->idClient);
$profils[$i]->nom = $infoClient->nom;
$i++;
}
}
$this->view->assign('profils', $profils);
}
/**
* Define fields for extraction to user
*/
public function profiladdAction()
{
$request = $this->getRequest();
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
//Sauvegarde du formulaire
if ( $request->isPost() )
{
$params = $request->getParams();
if ($params['reference']=='default') {
//Get default profil
$profilClientM = new Application_Model_CiblageCustomerParams();
$sql = $profilClientM->select()->where('idClient=?',$request->getParam('idClient'));
$profilClient = $profilClientM->fetchRow($sql);
if ( null !== $profilClient ) {
$params['criteres'] = json_decode($profilClient->criteres,true);
}
}
if (empty($params['criteres'])) {
$this->view->assign('message', "Erreur profil vide");
} else {
$data = array(
'idClient' => $params['idClient'],
'service' => $params['service'],
'login' => $params['login'],
'reference' => $params['reference'],
'criteres' => json_encode($params['criteres']),
'dataInsee' => 0,
'dateAjout' => date('Y-m-d H:i:s'),
'actif' => 1,
);
$profilM = new Application_Model_CiblageEnrichissementProfils();
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();
$month = $request->getParam('month', date('m'));
$year = $request->getParam('year', date('Y'));
$this->view->assign('month', $month);
$this->view->assign('year', $year);
$commandesM = new Application_Model_CiblageEnrichissementIdentifiants();
$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 = ""')
->where("e.dateAdded LIKE '".$year."-".$month."%'")
->order('e.dateAdded DESC');
$this->view->commandes = $commandesM->fetchAll($sql)->toArray();
}
/**
* List commands with a file
*/
public function enrichissementsAction()
{
$request = $this->getRequest();
$month = $request->getParam('month', date('m'));
$year = $request->getParam('year', date('Y'));
$this->view->assign('month', $month);
$this->view->assign('year', $year);
$commandesM = new Application_Model_CiblageEnrichissementIdentifiants();
$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",
"DATE_FORMAT(e.dateStart, '%Y/%m/%d %H:%i:%s') AS dateStart",
'e.fichier'
))
->join('ciblage_criteres', 'idCriteres = ciblage_criteres.id', array(
'ciblage_criteres.reference AS critereReference',
'ciblage_criteres.login',
))
->where('fichier != ""')
->where("e.dateAdded LIKE '".$year."-".$month."%'")
->order('e.dateAdded DESC');
$this->view->commandes = $commandesM->fetchAll($sql)->toArray();
}
/**
* Téléchargement des fichiers créer par les clients pour analyse
*/
public function enrichissementdlAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$auth = Zend_Auth::getInstance();
$identity = $auth->getIdentity();
$id = $this->getRequest()->getParam('id');
$table = new Application_Model_CiblageEnrichissementIdentifiants();
$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);
$c = Zend_Registry::get('config');
$path = $c->profil->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.';
}
}
/**
* Load enrichissement batch to complete data
*/
public function enrichitAction()
{
$request = $this->getRequest();
$id = $request->getParam('id');
exec('php '.APPLICATION_PATH.'/../scripts/jobs/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_CiblageEnrichissementIdentifiants();
$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()
{
$request = $this->getRequest();
$month = $request->getParam('month', date('m'));
$year = $request->getParam('year', date('Y'));
$this->view->assign('month', $month);
$this->view->assign('year', $year);
$comptagesM = new Application_Model_CiblageComptages();
$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')
->where("ciblage_comptages.dateAjout LIKE '".$year."-".$month."%'")
->order('ciblage_comptages.dateAjout DESC');
$comptages = $comptagesM->fetchAll($sql)->toArray();
Zend_Registry::get('firebug')->info($comptages);
$this->view->comptages = $comptages;
}
/**
* Affichage des critères du ciblage
*/
public function ciblagecriteresAction()
{
$this->_helper->layout()->disableLayout();
$request = $this->getRequest();
$id = $request->getParam('id');
//Lecture des paramètres du ciblage
$criteresM = new Application_Model_CiblageCriteres();
$sql = $criteresM->select()
->where('id = ?', $id);
$criteres = $criteresM->fetchRow($sql)->toArray();
$decodeCriteres = json_decode($criteres['criteres'], true);
$fields = new Scores_Fields();
//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,
);
}
$this->view->criteres = $infosCriteres;
}
/**
* List customers
*/
public function customerparamsAction()
{
//@todo : what's in database
$customersM = new Application_Model_CiblageCustomerParams();
$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_CiblageEnrichissementProfils();
$clientM = new Application_Model_Sdv1Clients();
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;
$sql = $clientM->select()->where('id=?', $item['idClient']);
$result = $clientM->fetchRow($sql);
$item['nom'] = $result->nom;
$customerlist[] = $item;
}
$this->view->assign('customerlist', $customerlist);
}
/**
* List customer's params
*/
public function customerparamAction()
{
//Fields
require_once 'Scores/Enrichissement.php';
$fieldsM = new Enrichissement();
$allFields = $fieldsM->getFields();
$this->view->assign('fields', $allFields);
$request = $this->getRequest();
$idClient= $request->getParam('idClient', null);
$this->view->assign('idClient', $idClient);
if ($idClient !== null) {
$paramsM = new Application_Model_CiblageCustomerParams();
$sql = $paramsM->select()->where('idClient = ?', $idClient);
$params = $paramsM->fetchRow($sql);
$infos = null;
if ($params!==null){
$infos = $params->toArray();
$clientM = new Application_Model_Sdv1Clients();
$sql = $clientM->select()->where('id=?', $idClient);
$result = $clientM->fetchRow($sql);
$infos['nom'] = $result->nom;
$infos['criteres'] = json_decode($infos['criteres'], true);
}
$this->view->assign('infos',$infos);
$loginsM = new Application_Model_CiblageEnrichissementProfils();
$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() && in_array($request->getParam('submit'), array('Enregistrer','Modifier')) ) {
$params = $request->getParams();
//Vérifier le formulaire
$errForm = 0;
foreach ( $params as $key => $value ) {
if ($value=='' && $key!='service') {
$errForm++;
}
}
if (!$errForm) {
$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']),
'dateAdded' => date('Y-m-d H:i:s'),
);
if ($request->getParam('submit')=='Modifier') {
//Overwrite default profil for each login
try {
$profilM = new Application_Model_CiblageEnrichissementProfils();
$profilM->update(array(
'criteres' => json_encode($params['criteres'])
), "reference='default' AND idClient=".$params['idClient']);
} catch ( Zend_Db_Adapter_Exception $e) {
Zend_Registry::get('firebug')->info($e->getMessage());
}
//Set parameters
try {
$customerParamsM = new Application_Model_CiblageCustomerParams();
$customerParamsM->update($data, 'id='.$params['id']);
$this->view->assign('message', "Profil enregistré");
} catch ( Zend_Db_Adapter_Exception $e) {
Zend_Registry::get('firebug')->info($e->getMessage());
$this->view->assign('message', "Erreur lors de la sauvegarde");
}
} else {
//Set parameters
$customerParamsM = new Application_Model_CiblageCustomerParams();
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");
}
} else {
$idClient = $request->getParam('idClient', null);
$clientM = new Application_Model_Sdv1Clients();
$sql = $clientM->select()->where('actif=?',1);
$selectClient = $clientM->fetchAll($sql);
$this->view->assign('selectClient',$selectClient);
if ($idClient !== null) {
$paramsM = new Application_Model_CiblageCustomerParams();
$sql = $paramsM->select()->where('idClient = ?', $idClient);
$params = $paramsM->fetchRow($sql);
if ( $params!==null ) {
foreach ( $params as $key => $value ) {
switch ( $key ) {
case 'criteres':
$this->view->assign($key, json_decode($value,true));
break;
case 'dateContrat':
$this->view->assign($key, substr($value,0,10));
break;
default:
$this->view->assign($key, $value);
break;
}
}
}
} else {
$this->view->assign('filterRNCS', 1);
$this->view->assign('licenceINSEE', 0);
$this->view->assign('immediatExtract', 0);
$this->view->assign('limitLines', 50000);
$this->view->assign('limitFiles', 0);
}
}
}
public function consoAction()
{
$request = $this->getRequest();
$idClient= $request->getParam('idClient', null);
$this->view->assign('idClient', $idClient);
// --- Contrat
$paramsM = new Application_Model_CiblageCustomerParams();
$sql = $paramsM->select()->where('idClient = ?', $idClient);
$params = $paramsM->fetchRow($sql);
$contratDebut = new Zend_Date($params->dateContrat, 'yy-MM-dd');
$contratFin = new Zend_Date($params->dateContrat, 'yy-MM-dd');
$contratFin->addMonth($params->periodContrat)->subDay(1);
$this->view->ContratDateDebut = $contratDebut->toString('yyyy-MM-dd');
$this->view->ContratDateFin = $contratFin->toString('yyyy-MM-dd');
// --- Création du tableau pour la consomation
// --- Recherche tous les idProfil - login
// --- Recherche des fichiers pour chaque id
}
}

View File

@ -1,112 +1,72 @@
<?php
class IndexController extends Zend_Controller_Action
{
public function indexAction()
{
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
public function init(){}
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();
public function selectionAction(){}
$fields = new Scores_Fields();
public function historiqueAction(){}
$infosCriteres = array();
public function criteresAction()
{
$this->view->headScript()->appendFile('/themes/default/scripts/fields.js', 'text/javascript');
$decodeCriteres = $fields->getCriteres();
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$session = new SessionCiblage();
//Chargement de la structure des champs et des préférences utilisateurs
require_once 'Scores/Field.php';
$fields = new Fields($user->username);
$this->view->fields = $fields;
$this->view->criteres = $session->getCriteres();
}
//Construction affichage des critères
foreach ( $decodeCriteres as $key => $item ) {
public function resetAction()
{
require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage();
$session->clearCiblage();
$this->_redirect('./');
}
$inValue = $fields->getValueLabel($key, $item['in']);
$exValue = $fields->getValueLabel($key, $item['ex']);
public function saveAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$infosCriteres[$key] = array(
'label' => $fields->getLabel($key),
'in' => $inValue,
'ex' => $exValue,
);
}
$field = $this->getRequest()->getParam('name');
$fields = $this->fields->getFields();
$fields[$field]['activated'] = (($fields[$field]['activated'] == false)?true:false);
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$this->view->infos = $infosCriteres;
}
$db = Zend_Registry::get('db');
public function criterelistAction()
{
$this->_helper->layout()->disableLayout();
$prefsModel = new Application_Model_Prefs($db);
$data = array(
'login' => $user->username,
'json' => $this->fields->getNotActivated($fields),
);
$request = $this->getRequest();
$critere = $request->getParam('key');
$prefsModel->select()->where('login = "?"', $user->username);
$rows =$prefsModel->fetchRow();
$rows = $rows->toArray();
if (count($rows) > 0) {
$prefsModel->update($data, 'login = "'.$user->unsername.'"');
} else {
$prefsModel->insert($data);
}
$this->_redirect('./');
}
$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('/');
}
}

View File

@ -0,0 +1,57 @@
<?php
class PreferencesController extends Zend_Controller_Action
{
public function saveAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$fields = $this->getRequest()->getParam('fields');
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$db = Zend_Registry::get('db');
$prefsModel = new Application_Model_Prefs($db);
$data = array(
'login' => $user->username,
'json' => json_encode($this->getNotActivated(json_decode($fields))),
);
$sql = $prefsModel->select()->where('login = ?', $user->username);
$rows = $prefsModel->fetchAll($sql);
if (count($rows)>0) {
$prefsModel->update($data, 'login = '.$user->unsername);
} else {
$prefsModel->insert($data);
}
$this->_redirect('./');
}
public function getNotActivated($fields)
{
foreach($fields as $name => $field)
{
if(!$field['activated']) {
$desactivated[] = array($name => "");
}
}
return ($desactivated);
}
/**
* Place un marqueur d'activation du mode de personnalisation dans la session Utilisateur
* On retourne ensuite dans index/index pour permettre le choix des préférences d'affichage
*/
public function activeAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
//@todo : Vérifier que l'utilisateur à le droit de customiser
$user->customisation = true;
$auth->getStorage()->write($user);
$this->_redirect('./');
}
}

View File

@ -0,0 +1,16 @@
<?php
class PrefsController extends Zend_Controller_Action
{
public function indexAction()
{
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$db = Zend_Registry::get('db');
$prefs = new Application_Model_Prefs($db);
$sql = $prefs->select()->where('login = ?', $user->username);
$this->view->entries = $prefs->fetchAll($sql);
}
}

View File

@ -0,0 +1,30 @@
<?php
class RechercheController extends Zend_Controller_Action
{
/**
*
* Enter description here ...
*/
public function nafAction()
{
}
/**
*
* Enter description here ...
*/
public function geographiqueAction()
{
}
/**
*
* Enter description here ...
*/
public function juridiqueAction()
{
}
}

View File

@ -1,38 +0,0 @@
<?php
Class UploadController extends Zend_Controller_Action
{
protected $path;
protected $extensions;
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;
}*/
}
}

View File

@ -1,95 +1,91 @@
<?php
class UserController extends Zend_Controller_Action
{
public function init()
{
require_once 'Forms/Login.php';
require_once 'Scores/WebAuthAdapter.php';
require_once 'Scores/WsScores.php';
}
/**
* Gestion de l'authentification
* Gestion de l'authentification
*/
public function loginAction()
{
$this->view->headTitle()->append('Connexion');
$form = new Form_Login();
$this->view->form = $form;
$request = $this->getRequest();
if ($request->isPost()) {
$formData = $request->getPost();
if ($form->isValid($formData)) {
$login = $form->getValue('login');
$pass = $form->getValue('pass');
$auth = Zend_Auth::getInstance();
$authAdapter = new WebAuthAdapter($login, md5($login.'|'.$pass));
$result = $auth->authenticate($authAdapter);
if (!$result->isValid()){
$this->view->message = '';
Zend_Registry::get('firebug')->info($result);
foreach ($result->getMessages() as $message) {
$this->view->message.= $message."<br/>";
}
} else {
$timeout = $auth->getIdentity()->timeout;
//Ecrit un cookie persistant valide pendant le temps definit
Zend_Session::rememberMe($timeout);
$storage = new Zend_Auth_Storage_Session();
$sessionNamespace = new Zend_Session_Namespace($storage->getNamespace());
$sessionNamespace->setExpirationSeconds($timeout);
$auth->setStorage($storage);
$url = '';
if (Zend_Session::namespaceIsset('login')){
$session = new Zend_Session_Namespace('login');
if (isset($session->url)) {
$url = $session->url;
}
}
if (!empty($url) && $url!='/user/login' && $url!='/localauth'){
$this->_redirect($url);
}
$this->_redirect('/');
}
}
}
$this->_helper->layout()->disableLayout();
$this->render('login');
}
/**
* Gestion de la déconnexion
*/
public function loginAction()
{
// --- Modification du visuel pour utilisation bootstrap
$this->_helper->layout()->disableLayout();
public function logoutAction()
{
//Suppression des critères de comptage en session
require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage();
$session->clearCiblage();
$this->view->headLink()
->setStylesheet('/libs/bootstrap-3.3.4/css/bootstrap.min.css', 'all')
->appendStylesheet('/themes/default/styles/user-login.css', 'all');
//Suppression de l'identité
Zend_Auth::getInstance()->clearIdentity();
$this->view->headScript()
->appendFile('/libs/jquery/jquery-1.11.3.min.js', 'text/javascript')
->appendFile('/libs/jquery/jquery.placeholder.js', 'text/javascript');
$this->_helper->layout()->disableLayout();
$this->view->headTitle()->append('Connexion');
$form = new Application_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();
}
$url = 'http://www.scores-decisions.com/';
$refresh = 5;
/**
* 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);
$ajax = $request->getParam('ajax', 0);
$this->view->assign('ajax', $ajax);
$refresh = 5;
$url = 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].$this->view->url(array(
'controller' => 'user',
'action' => 'login',
), null, true);
$this->view->assign('url', $url);
if (!$ajax) {
$this->view->assign('refresh', $refresh);
$this->view->headMeta()->appendHttpEquiv('refresh', $refresh.'; url='.$url);
}
}
/**
* Changer la langue de l'utilisateur
*/
public function langAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$lang = $this->getRequest()->getParam('lang', null);
$auth = Zend_Auth::getInstance();
$identity = $auth->getIdentity();
$identity->langtmp = $lang;
$auth->getStorage()->write($identity);
}
if (APPLICATION_ENV != 'production'){
$url = 'http://'.$_SERVER['SERVER_NAME'].$this->view->url(array(
'controller' => 'user',
'action' => 'login',
));
}
$this->view->assign('url', $url);
$this->view->headMeta()->appendHttpEquiv('refresh', '5; url='.$url);
$this->render('logout');
}
}

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1,27 +0,0 @@
<?php
//Home
$this->translate('Accueil');
$this->translate('Préambule');
$this->translate('Ajouter un profil');
$this->translate('Désactiver');
$this->translate('Ajouter un login avec le profil du client');
$this->translate('Type d\'établissement');
$this->translate('Sièges');
$this->translate('Oui');
$this->translate('Non');
$this->translate('au');
$this->translate('Appartient à un groupe');
$this->translate('Téléphone renseigné');
$this->translate('Télécopie renseignée');
$this->translate('Site Web renseigné');
$this->translate('Email de contact renseigné');
$this->translate('Etablissement présent au RNCS');
$this->translate('Adresse de domiciliation');
$this->translate('Nom du principal dirigeant présent');
$this->translate('Date de création de l\'établissement');
$this->translate('Présence de participations');
$this->translate('Valider');
$this->translate('Réinitialiser les critères entreprises');
$this->translate('à');
$this->translate('Scores & Décisions SAS');
?>

View File

@ -1,6 +0,0 @@
<?php
class Application_Model_CiblageCodePostaux extends Zend_Db_Table_Abstract
{
protected $_name = 'fields_codepostaux';
protected $_schema = 'ciblage';
}

View File

@ -1,6 +0,0 @@
<?php
class Application_Model_CiblageComptages extends Zend_Db_Table_Abstract
{
protected $_name = 'ciblage_comptages';
protected $_schema = 'ciblage';
}

View File

@ -1,6 +0,0 @@
<?php
class Application_Model_CiblageCriteres extends Zend_Db_Table_Abstract
{
protected $_name = 'ciblage_criteres';
protected $_schema = 'ciblage';
}

View File

@ -1,6 +0,0 @@
<?php
class Application_Model_CiblageCustomerParams extends Zend_Db_Table_Abstract
{
protected $_name = 'customer_params';
protected $_schema = 'ciblage';
}

View File

@ -1,6 +0,0 @@
<?php
class Application_Model_CiblageDepartements extends Zend_Db_Table_Abstract
{
public $_name = 'fields_departements';
protected $_schema = 'ciblage';
}

View File

@ -1,6 +0,0 @@
<?php
class Application_Model_CiblageEnrichissementIdentifiants extends Zend_Db_Table_Abstract
{
protected $_name = 'enrichissement_identifiants';
protected $_schema = 'ciblage';
}

View File

@ -1,6 +0,0 @@
<?php
class Application_Model_CiblageEnrichissementProfils extends Zend_Db_Table_Abstract
{
public $_name = 'enrichissement_profils';
protected $_schema = 'ciblage';
}

View File

@ -1,7 +0,0 @@
<?php
class Application_Model_CiblageFormeJuridique extends Zend_Db_Table_Abstract
{
protected $_name = 'fields_formejuridique';
protected $_primary = 'fjCode';
protected $_schema = 'ciblage';
}

View File

@ -1,6 +0,0 @@
<?php
class Application_Model_CiblageMinMax extends Zend_Db_Table_Abstract
{
protected $_name = 'fields_minmax';
protected $_schema = 'ciblage';
}

View File

@ -1,6 +0,0 @@
<?php
class Application_Model_CiblageNaf extends Zend_Db_Table_Abstract
{
protected $_name = 'fields_naf';
protected $_schema = 'ciblage';
}

View File

@ -1,6 +0,0 @@
<?php
class Application_Model_CiblagePrefs extends Zend_Db_Table_Abstract
{
protected $_name = 'customer_prefs';
protected $_schema = 'ciblage';
}

View File

@ -1,7 +0,0 @@
<?php
class Application_Model_CiblageRegions extends Zend_Db_Table_Abstract
{
protected $_name = 'fields_regions';
protected $_schema = 'ciblage';
}

View File

@ -0,0 +1,5 @@
<?php
class Application_Model_Codepostaux extends Zend_Db_Table_Abstract
{
protected $_name = 'codepostaux';
}

View File

@ -0,0 +1,5 @@
<?php
class Application_Model_Comptages extends Zend_Db_Table_Abstract
{
protected $_name = 'comptages';
}

View File

@ -0,0 +1,5 @@
<?php
class Application_Model_Criteres extends Zend_Db_Table_Abstract
{
protected $_name = 'criteres';
}

View File

@ -0,0 +1,5 @@
<?php
class Application_Model_Departements extends Zend_Db_Table_Abstract
{
public $_name = 'departements';
}

View File

@ -0,0 +1,7 @@
<?php
class Application_Model_Formejuridique extends Zend_Db_Table_Abstract
{
protected $_name = 'formejuridique';
protected $_primary = 'fjCode';
}

View File

@ -1,6 +0,0 @@
<?php
class Application_Model_JoSpinxIdx extends Zend_Db_Table_Abstract
{
protected $_name = 'sphinx_idx';
protected $_schema = 'jo';
}

View File

@ -0,0 +1,5 @@
<?php
class Application_Model_Naf extends Zend_Db_Table_Abstract
{
protected $_name = 'naf';
}

View File

@ -0,0 +1,5 @@
<?php
class Application_Model_Prefs extends Zend_Db_Table_Abstract
{
protected $_name = 'prefs';
}

View File

@ -0,0 +1,5 @@
<?php
class Application_Model_ProfilExtraction extends Zend_Db_Table_Abstract
{
protected $_name = 'profilExtraction';
}

View File

@ -0,0 +1,5 @@
<?php
class Application_Model_RefExport extends Zend_Db_Table_Abstract
{
protected $_name = 'refexport';
}

View File

@ -0,0 +1,6 @@
<?php
class Application_Model_Regions extends Zend_Db_Table_Abstract
{
protected $_name = 'regions';
}

View File

@ -1,6 +0,0 @@
<?php
class Application_Model_Sdv1Clients extends Zend_Db_Table_Abstract
{
protected $_name = 'clients';
protected $_schema = 'sdv1';
}

View File

@ -1,13 +0,0 @@
<?php
class Application_Model_Sdv1Utilisateurs extends Zend_Db_Table_Abstract
{
protected $_name = 'utilisateurs';
protected $_schema = 'sdv1';
protected $_referenceMap = array(
'Reporter' => array(
'columns' => 'idClient',
'refTableClass' => 'Sdv1Clients',
'refColumns' => 'id'
),
);
}

View File

@ -1,6 +0,0 @@
<?php
class Application_Model_Sdv1UtilisateursService extends Zend_Db_Table_Abstract
{
protected $_name = 'utilisateurs_service';
protected $_schema = 'sdv1';
}

View File

@ -1,135 +1,65 @@
<?php
class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
{
protected $display = true;
protected $name = '';
public function Field($name)
public function Field($name, $field)
{
$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 = $this->view->translate($params['title']);
}
//How many type of fields is defined
$nbFields = count($params['fields']);
$display = true;
$out = '';
//If more than one field exist we need to make a special display
if ( $nbFields > 1) {
$out.= '<div class="fieldgrp clearfix">';
$out.= $this->structureLabel($label);
$out.= '<div class="field">';
foreach ( $params['fields'] as $type => $options )
{
switch ($type) {
case 'tree':
$href = $this->view->url(array('controller' => 'arborescence', 'action' => $options['action'], 'key' => $name));
$out.= '<a class="arborescence" title="'.$options['title'].'" href="'.$href.'">';
$out.= 'Arborescence';
$out.= '</a>';
break;
case 'text':
$out.= '<a class="text" title="'.$options['title'].'" href="#" id="'.$name.'" >';
$out.= 'Recherche';
$out.= '</a>';
break;
case 'list':
$out.= '<a class="dlist" title="'.$options['title'].'" href="#" id="'.$name.'" >';
$out.= 'Liste';
$out.= '</a>';
break;
}
$out.= '&nbsp;';
}
$out.= '</div>';
$out.= '</div>';
//Masquer les champs
$display = false;
}
//Draw fields
foreach ( $params['fields'] as $type => $options )
{
if($field != null) {
$html.= '<div class="fieldgrp">';
$type = $field['type'];
switch($type)
{
case 'select':
$html = $this->selectHTML($name, $options);
$html.= $this->structureHTML(
$field['label'],
$this->selectHTML($name, $field));
break;
case 'selectMultiple':
$html = $this->selectMultipleHTML($name, $options);
$html.= $this->structureHTML(
$field['label'],
$this->selectMultipleHTML($name, $field));
break;
case 'intervalSelect':
$html = $this->intervalSelectHTML($name, $options);
break;
case 'checkbox':
$html = $this->checkboxHTML($name, $options);
break;
case 'intervalDate':
$html = $this->intervalDateHTML($name, $options);
$html.= $this->structureHTML(
$field['label'],
$this->intervalSelectHTML($name, $field));
break;
case 'interval':
$html = $this->intervalHTML($name, $options);
$html.= $this->structureHTML(
$field['label'],
$this->intervalHTML($name, $field));
break;
case 'date':
$html = $this->dateHTML($name, $options);
$html.= $this->structureHTML(
$field['label'],
$this->dateHTML($name, $field));
break;
case 'text':
$html = $this->textHTML($name, $options);
$html.= $this->structureHTML(
$field['label'],
$this->textHTML($name, $field));
break;
case 'textarea':
$html = $this->textareaHTML($name, $options);
$html.= $this->structureHTML(
$field['label'],
$this->textareaHTML($name, $field));
break;
case 'radio':
$html = $this->radioHTML($name, $options);
break;
case 'file':
$html = $this->fileuploadHtml($name, $options);
break;
case 'tree':
//Do nothing
break;
case 'list':
$html = $this->textareaHTML($name, $options);
break;
default:
$html = $this->structureHTML($name, '');
$html.= $this->structureHTML(
$field['label'],
$this->radioHTML($name, $field));
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($this->view->translate($label));
$out.= '<div class="field">'.$html.'</div>';
$out.= '</div>';
$html.= '</div>';
}
return $html;
}
private function structureHTML($label, $html, $liens = array())
{
$out = '';
$out.= $this->structureLabel($label);
$out.= '<div class="field">'.$html.$this->structureLink($liens).'</div>';
return $out;
}
@ -139,204 +69,102 @@ class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
*/
private function structureLabel($label)
{
$return = '<label>'.$label.'</label>';
return $return;
return '<label>'.$label.'</label>';
}
protected function getMinMax($name, $valeur)
/**
* Définition des liens
*/
private function structureLink($liens = array())
{
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'];}
$html = '';
if (count($liens)>0) {
foreach($liens as $lien){
$html.= '<a href="'.$lien['url'].'">'.$lien['lib'].'</a>';
}
}
return ($valeur);
if (!empty($html)) {
return '<span>'.$html.'</span>';
}
return '';
}
private function intervalSelectHTML($name, $options)
private function intervalSelectHTML($name, $field)
{
$session = new Scores_Fields();
$sessionValeur = explode(',', $session->getCritere($name));
$minMax = $this->getMinMax($name, array(0,0));
$session = new SessionCiblage();
$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>';
foreach($field['fields'][$field['type']]['value'] as $elements) {
$return .= '<option value="'. $elements[0].'">'.number_format($elements[0], 0,'', ' ').'</option>';
}
$return .= '</select> '.$this->view->translate('à').' ';
$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>';
foreach($field['fields'][$field['type']]['value'] as $elements) {
$return .= '<option value="'. $elements[1].'">'.number_format($elements[1], 0,'', ' ').'</option>';
}
$return .= '</select>';
$return .= ' <span id="'.$name.'"><a href="" class="intervalSelect" id="'.$name.'">'.$this->view->translate('Valider').'</a></span>';
$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)
/* Select */
private function selectMultipleHTML($name, $field)
{
$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 .= '&nbsp;<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);
}
$session = new SessionCiblage();
$return = '<select class="criteres" name="'.$name.'">';
$return .= '<option '.(($sessionValeur == '-')?'selected':'').' value="-">-</option>';
foreach($options['value'] as $value => $label) {
$return .= '<option value="tous">Tous</option>';
foreach($field['fields'][$field['type']]['value'] as $value => $label) {
$selected = "";
if( $sessionValeur!==null && $sessionValeur != "-" && $sessionValeur==$value )
if(($session->getCritere($name) != null) and $session->getCritere($name) == $value)
$selected = " selected";
$return .= '<option'.$selected.' value="'.$value.'">'.$this->view->translate($label).'</option>';
$return .= '<option'.((!empty($selected))?$selected:null).' value="'.$value.'">'.$label.'</option>';
}
$return .= '</select>';
return $return;
return ($return);
}
protected function intervalDateHTML($name, $options)
/* Select Multiple */
private function selectHTML($name, $field)
{
$session = new Scores_Fields();
$session = new SessionCiblage();
$sessionValeur = $session->getCritere($name);
$return = '';
$return.= '<select name="'.$name.'1_j" style="width:45px;">';
for ($i=1;$i<=31;$i++) {
$return.= '<option>'.str_pad($i,2,'0',STR_PAD_LEFT).'</option>';
if(is_array($sessionValeur))
$sessionValeur = implode(',', $sessionValeur);
$return = '<select class="criteres '.$field['type']['class'].'" name="'.$name.'">';
$return .= '<option value="tous">Tous</option>';
foreach($field['fields'][$field['type']]['value'] as $value => $label) {
$selected = "";
if(($sessionValeur != null) and $sessionValeur == $value)
$selected = " selected";
$return .= '<option'.((!empty($selected))?$selected:null).' value="'.$value.'">'.$label.'</option>';
}
$return.= '</select>';
$return.= '<select name="'.$name.'1_m" style="width:45px;">';
for ($i=1;$i<=12;$i++) {
$return.= '<option>'.str_pad($i,2,'0',STR_PAD_LEFT).'</option>';
}
$return.= '</select>';
$return.= '<select name="'.$name.'1_a" style="width:60px;">';
for ($i=1900;$i<=date('Y');$i++) {
$return.= '<option>'.$i.'</option>';
}
$return.= '</select>';
$return.= ' '.$this->view->translate('au').' ';
$return.= '<select name="'.$name.'2_j" style="width:45px;">';
for ($i=1;$i<=31;$i++) {
$select = '';
if ($i==date('d')) {
$select = ' selected';
}
$return.= '<option'.$select.'>'.str_pad($i,2,'0',STR_PAD_LEFT).'</option>';
}
$return.= '</select>';
$return.= '<select name="'.$name.'2_m" style="width:45px;">';
for ($i=1;$i<=12;$i++) {
$select = '';
if ($i==date('m')) {
$select = ' selected';
}
$return.= '<option'.$select.'>'.str_pad($i,2,'0',STR_PAD_LEFT).'</option>';
}
$return.= '</select>';
$return.= '<select name="'.$name.'2_a" style="width:60px;">';
$lastYear = date('Y');
for ($i=1900;$i<=$lastYear;$i++) {
$select = '';
if ($i==$lastYear) {
$select = ' selected';
}
$return.= '<option'.$select.'>'.$i.'</option>';
}
$return.= '</select>';
$return .= '<br/><a href="#" id="'.$name.'" class="intervalDate">'.$this->view->translate('Valider').'</a>';
return $return;
$return .= '</select>';
return ($return);
}
/* Interval */
private function intervalHTML($name, $field)
{
$session = new Scores_Fields();
$session = new SessionCiblage();
$valeur = $session->getCritere($name);
$class = '';
if (array_key_exists('class', $field)) {
$class = $field['class'];
}
$return = '<div class="interval" >';
$return .= '<input class="'.$class.'" type="text" name="'.$name.'1" value="'.$valeur[0].'" /> '.$this->view->translate('à').' ';
$return .= '<input class="'.$class.'" type="text" name="'.$name.'2" value="'.$valeur[1].'" />';
$return .= ' <a href="" class="interval" id="'.$name.'">'.$this->view->translate('Valider').'</a>';
$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;
return ($return);
}
/* Dates */
private function dateHTML($name, $field)
{
$session = new Scores_Fields();
$session = new SessionCiblage();
$return = '<div class="date" >';
$return .= '<input value="'.$session->getCritere($name).'" type="text" class="datepicker" name="'.$name.'1" /> a ';
@ -347,27 +175,21 @@ class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
}
/* Textes */
protected function textHTML($name, $options)
private function textHTML($name, $field)
{
$return = '<input type="text" class="criteres autocomplete" name="'.$name.'" />';
$return.= '<ul id="'.$name.'" class="selectqueries"></ul>';
$return.= '<a href="#" class="autocomplete">Sélectionner</a>';
$return.= '&nbsp;<a href="#" class="autocompleteEx">Exclure</a>';
return $return;
$session = new SessionCiblage();
$return = '<input style="border:1px inset silver;width:60%" class="criteres" type="text" name="'.$name.'" value="'.$session->getCritere($name).'" />';
return ($return);
}
/* Textarea */
protected function textareaHTML($name, $field)
private function textareaHTML($name, $field)
{
$return = '<textarea class="criteres" name="'.$name.'" ></textarea>';
$return.= '<a href="#" class="list">Sélectionner</a>';
$return.= '&nbsp;<a href="#" class="listEx">Exclure</a>';
return $return;
}
private function fileuploadHtml($name, $field)
{
$return = '<input class="upload" type="file" name="fichier" id="'.$name.'" /> ';
$return = '<a class="arborescence" title="'.$field['title'].'" href="'.$this->view->url(array('controller' => 'arborescence', 'action' => $field['action'], 'key' => $name)).'">
Selection dans une arborescence
</a>';
return ($return);
}

View File

@ -0,0 +1,22 @@
<?php
Class Zend_View_Helper_Radio extends Zend_View_Helper_Abstract
{
public function Radio($name, $libelle)
{
$champ = '<div>';
$champ .= '<div style="float:left;text-align:left;">
<label>'.$libelle.'</label>
</div>';
$champ .= '<div style="text-align:right;">
<input type="radio" name="'.$name.'" value="" />
<input type="radio" name="'.$name.'" value="0" />
<input type="radio" name="'.$name.'" value="1" />
</div>';
$champ .= '<div>
<hr />
</div>';
$champ .= '</div>';
return ($champ);
}
}

View File

@ -1,9 +1 @@
<div id="help" style="padding:5px;">
<h2>A propos de</h2>
<p>Pour une demande commercial vous pouvez contacter <a href="mailto:contact@scores-decisions.com">contact@scores-decisions.com</a>.</p>
<p>Pour une demande concernant votre contrat ou l'utilisation, vous pouvez prendre contact avec
<a href="mailto:support@scores-decisions.com">support@scores-decisions.com</a>, en rappelant vos références.</p>
</div>
<?php

View File

@ -1,53 +1 @@
<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>
<?php

View File

@ -1,8 +0,0 @@
<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>

View File

@ -1,9 +1,9 @@
<div id="<?=$this->key?>" class="jstree jstree-default" style="overflow:auto;"></div>
<script>
$("div#<?=$this->key?>").jstree({
$("#<?=$this->key?>").jstree({
"themes" : {
"theme" : "default",
"url" : "/libs/tree/themes/classic/style.css",
"url" : "/themes/jstree/default/style.css",
"dots" : true,
"icons" : false,
},
@ -11,7 +11,7 @@ $("div#<?=$this->key?>").jstree({
"json_data" : {
"data" : <?=$this->regions?>,
"ajax" : {
"url" : '<?=$this->url(array('controller'=>'arborescence', 'action'=>'geographiqueajax', 'key'=> $this->key), 'default', true)?>',
"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,
}

View File

@ -1,4 +0,0 @@
<br /><br />
<div id="view-content">
<p>View script for controller <b>Arborescence</b> and script/action name <b>index</b></p>
</div>

View File

@ -1,23 +0,0 @@
<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), 'default', true)?>',
"data" : function(n)
{
return { id: n.attr ? n.attr("id") : 0 };
},
"cache" : true,
}
}
});
</script>

View File

@ -1,9 +1,9 @@
<div id="<?=$this->key?>" class="jstree jstree-default" style="overflow:auto;"></div>
<script>
$("div#<?=$this->key?>").jstree({
$("#<?=$this->key?>").jstree({
"themes" : {
"theme" : "default",
"url" : "/libs/tree/themes/classic/style.css",
"url" : "/themes/jstree/default/style.css",
"dots" : true,
"icons" : false,
},
@ -11,7 +11,7 @@ $("div#<?=$this->key?>").jstree({
"json_data" : {
"data" : <?=$this->naf?>,
"ajax" : {
"url" : '<?=$this->url(array('controller'=>'arborescence', 'action'=>'nafajax', 'key'=> $this->key), 'default', true)?>',
"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,
}

View File

@ -1 +0,0 @@
<?=json_encode($this->result)?>

View File

@ -1,29 +0,0 @@
<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;" nowrap><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>

View File

@ -1,63 +1,37 @@
<?php if ($this->typeMsg) {?>
<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/>Ou prendre contact avec votre commercial.
<?php } elseif ($this->typeMsg == 'contrat') {?>
Votre contrat est arrivé à expiration. <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/>Ou prendre contact avec votre commercial.
<?php }?>
</div>
<?php } elseif ($this->noSelection) { ?>
<?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>
<?php else:?>
<div id="result">
<form method="post" id="save" name="save" action="<?=$this->url(array('controller'=>'comptage', 'action'=>'save'))?>">
<label>Votre référence : </label><input type="text" name="ref" value="<?=$this->reference?>" />
<label>Votre référence</label>
<input type="text" name="ref" value="" />
<input type="submit" name="submit" value="Enregistrer">
</form>
<br/>
<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>
<span class="message" style="color:#ff0000;"></span>
</div>
<script type="text/javascript" src="/libs/form/jquery.form.min.js"></script>
<script type="text/javascript" src="/themes/default/scripts/jquery.form.js"></script>
<script>
$('#dialog').dialog({
buttons: [ {
text: "Enregistrer",
click: function() {
var options = {
target: '#result',
dataType: 'json',
beforeSubmit: function(){
$('#result').html('Enregistrement...');
},
success: function(data){
if (data.error == 0) {
$('#result').html(data.msg);
$(location).attr('href',data.href);
} else {
$('#result span.message').html(data.msg);
}
}
};
$('form#save').ajaxSubmit(options);
}
},
{ text: "Annuler", click: function() { $(this).dialog("close"); } }
] });
$('form#save').bind('submit', function(){
var options = {
target: '#result',
dataType: 'json',
beforeSubmit: function(){},
success: function(data){
if (data.error == 0){
$('#result').html(data.msg);
} else {
$('#result span.message').html(data.msg);
}
}
};
$(this).ajaxSubmit(options);
return false;
});
</script>
<?php }?>
<?php endif;?>
<pre>
<?php print_r($this->criteres)?>
</pre>

View File

@ -1 +0,0 @@
<?=json_encode($this->result)?>

View File

@ -0,0 +1,20 @@
<div id="economique">
<div style="display:none" class="error">
<div>Erreur :</div>
</div>
<ul id="fieldsblock">
<li><?php echo $this->Field('capital', $this->fields->get('capital'));?></li>
<li><?php echo $this->Field('ape_etab', $this->fields->get('ape_etab'));?></li>
<li><?php echo $this->Field('ape_entrep', $this->fields->get('ape_entrep'));?></li>
<li><?php echo $this->Field('age_entrep', $this->fields->get('age_entrep'));?></li>
<li><?php echo $this->Field('age_etab', $this->fields->get('age_etab'));?></li>
<li><?php echo $this->Field('teff_entrep', $this->fields->get('teff_entrep'));?></li>
<li><?php echo $this->Field('teff_etab', $this->fields->get('teff_etab'));?></li>
<li><?php echo $this->Field('eff_entrep', $this->fields->get('eff_entrep'));?></li>
<li><?php echo $this->Field('eff_etab', $this->fields->get('eff_etab'));?></li>
<li><?php echo $this->Field('nbEtab', $this->fields->get('nbEtab'));?></li>
</ul>
</div>
<div style="text-align:right;margin-top:20px;">
<a href="">Réinitialiser les critères entreprises</a>
</div>

View File

@ -0,0 +1,21 @@
<div id="entreprise">
<ul id="fieldsblock">
<li><?php echo $this->Field('siege', $this->fields->get('siege'));?></li>
<li><?php echo $this->Field('sirenGrp', $this->fields->get('sirenGrp'));?></li>
<li><?php echo $this->Field('tel', $this->fields->get('tel'));?></li>
<li><?php echo $this->Field('fax', $this->fields->get('fax'));?></li>
<li><?php echo $this->Field('web', $this->fields->get('web'));?></li>
<li><?php echo $this->Field('mail', $this->fields->get('mail'));?></li>
<li><?php echo $this->Field('presentRcs', $this->fields->get('presentRcs'));?></li>
<li><?php echo $this->Field('adrDom', $this->fields->get('adrDom'));?></li>
<li><?php echo $this->Field('dirNom', $this->fields->get('dirNom'));?></li>
<li><?php echo $this->Field('nbMPubli', $this->fields->get('nbMPubli'));?></li>
<li><?php echo $this->Field('dateCrea_ent',$this->fields->get('dateCrea_ent'));?></li>
<li><?php echo $this->Field('dateCrea_etab', $this->fields->get('dateCrea_etab'));?></li>
<li><?php echo $this->Field('nbActio', $this->fields->get('nbActio'));?></li>
<li><?php echo $this->Field('nbPart', $this->fields->get('nbPart'));?></li>
</ul>
</div>
<div id="link">
<a href="">Réinitialiser les critères entreprises</a>
</div>

View File

@ -0,0 +1,24 @@
<div id="financiere">
<ul id="fieldsblock">
<li><?php echo $this->Field('bilType', $this->fields->get('bilType'));?></li>
<li><?php echo $this->Field('avisCs', $this->fields->get('avisCs'));?></li>
<li><?php echo $this->Field('bilAnnee', $this->fields->get('bilAnnee'));?></li>
<li><?php echo $this->Field('bilCloture', $this->fields->get('bilCloture'));?></li>
<li><?php echo $this->Field('bilDuree', $this->fields->get('bilDuree'));?></li>
<li><?php echo $this->Field('bilTca', $this->fields->get('bilTca'));?></li>
<li><?php echo $this->Field('bilEE', $this->fields->get('bilEE'));?></li>
<li><?php echo $this->Field('bilFL', $this->fields->get('bilFL'));?></li>
<li><?php echo $this->Field('bilFK', $this->fields->get('bilFK'));?></li>
<li><?php echo $this->Field('bilFR', $this->fields->get('bilFR'));?></li>
<li><?php echo $this->Field('bilGF', $this->fields->get('bilGF'));?></li>
<li><?php echo $this->Field('bilGP', $this->fields->get('bilGP'));?></li>
<li><?php echo $this->Field('bilGW', $this->fields->get('bilGW'));?></li>
<li><?php echo $this->Field('bilHD', $this->fields->get('bilHD'));?></li>
<li><?php echo $this->Field('bilHH', $this->fields->get('bilHH'));?></li>
<li><?php echo $this->Field('bilHL', $this->fields->get('bilHL'));?></li>
<li><?php echo $this->Field('bilHM', $this->fields->get('bilHM'));?></li>
<li><?php echo $this->Field('bilHN', $this->fields->get('bilHN'));?></li>
<li><?php echo $this->Field('bilYP', $this->fields->get('bilYP'));?></li>
</ul>
</div>

View File

@ -0,0 +1,9 @@
<div id="geographique">
<ul id="fieldsblock">
<li><?php echo $this->Field('adr_cp', $this->fields->get('adr_cp'));?></li>
<li><?php echo $this->Field('adr_com', $this->fields->get('adr_com'));?></li>
</ul>
</div>
<div style="text-align:right;margin-top:20px;">
<a href="">Réinitialiser les critères entreprises</a>
</div>

View File

@ -0,0 +1,12 @@
<div id="juridique">
<ul id="fieldsblock">
<li><?php echo $this->Field('cj', $this->fields->get('cj'));?></li>
<li><?php echo $this->Field('actifEco', $this->fields->get('actifEco'));?></li>
<li><?php echo $this->Field('procolHisto', $this->fields->get('procolHisto'));?></li>
<li><?php echo $this->Field('tvaIntraValide', $this->fields->get('tvaIntraValide'));?></li>
<li><?php echo $this->Field('dateImmat', $this->fields->get('dateImmat'));?></li>
</ul>
</div>
<div style="text-align:right;margin-top:20px;">
<a href="">Réinitialiser les critères entreprises</a>
</div>

View File

@ -1,104 +0,0 @@
<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>Inclus :</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>Exclus :</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>

View File

@ -0,0 +1,45 @@
<div id="dashboard">
<div class="chemin">
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>''))?>">Tableau de bord</a> >
Détail du ciblage
</div>
<?php if (empty($this->criteres)){?>
<p>Aucun ciblage n'a été trouvé avec ces paramètres.</p>
<?php } else {?>
<h1>Ciblage <?=$this->criteres['reference']?> (<?=$this->criteres['dateAjout']?>)</h1>
<h2>Critères</h2>
<pre>
<?=print_r(json_decode($this->criteres['criteres'], true))?>
</pre>
<h2>Comptages</h2>
<table style="width:100%">
<thead>
<tr>
<th>Date</th>
<th>Resultat</th>
<th>Nombre d'unité Insee</th>
</tr>
</thead>
<tbody>
<?php foreach($this->comptages as $comptage):?>
<tr>
<th><?=$comptage['dateAjout']?></th>
<th><?=number_format($comptage['resultat'], 0, '', ' ')?></th>
<th><?=number_format($comptage['uniteInsee'], 0, '', ' ')?></th>
</tr>
<?php endforeach;?>
</tbody>
</table>
<?php }?>
</div>

View File

@ -1,21 +1,14 @@
<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 id="dashboard" class="clearfix">
<div class="chemin">
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>''))?>">Tableau de bord</a> >
Liste de vos ciblages
</div>
<div style="margin:5px 0;">
<h2>Liste de vos ciblages</h2>
<?php if(count($this->ciblages)>0) {?>
<?php if(count($this->ciblages)>0):?>
<table class="ciblage">
<thead>
@ -24,46 +17,30 @@
<th>Nombre d'entité</th>
<th>Unité Insee</th>
<th>Date</th>
<th colspan="4"></th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php foreach($this->ciblages as $item) {?>
<?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>
<td><?=$item['reference']?></td>
<td><?=number_format($item['resultat'], 0, ',', ' ')?></td>
<td><?=number_format($item['uniteInsee'], 0, ',', ' ')?></td>
<td><?=$item['dateComptage']?></td>
<td>
[<a href="<?=$this->url(array('controller'=> 'dashboard','action'=>'ciblagedetail', 'id'=>$item['id']))?>">Détails</a>] -
[<a href="<?=$this->url(array('controller'=> 'index','action'=>'index', 'id'=>$item['id']))?>">Recharger les critères de ciblage</a>] -
[<a href="<?=$this->url(array('controller'=> 'comptage','action'=>'update', 'id'=>$item['id']))?>">Actualiser le comptage</a>] -
[<a href="<?=$this->url(array('controller'=> 'comptage','action'=>'update', 'id'=>$item['id']))?>">Enrichissement</a>]
</td>
</tr>
<?php }?>
<?php endforeach;?>
</tbody>
</table>
<div style="margin:5px auto;width:333px;">
<div class="pagination">
<a href="#" class="first" data-action="first">&laquo;</a>
<a href="#" class="previous" data-action="previous">&lsaquo;</a>
<input type="text" readonly="readonly" data-current-page="<?=$this->page?>" data-max-page="<?=$this->nbPages?>" />
<a href="#" class="next" data-action="next">&rsaquo;</a>
<a href="#" class="last" data-action="last">&raquo;</a>
</div>
<script>
$('.pagination').jqPagination({
page_string: "Page {current_page} sur {max_page}",
paged: function(page) {
window.location.href = window.location.href + '/page/'+page;
}
});
</script>
</div>
<?php } else {?>
<?php else:?>
<p>Aucun ciblage.<p>
<?php }?>
<?php endif;?>
</div>

View File

@ -1,86 +1,47 @@
<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>Service ouvert du <?=$this->dateBegin?> au <?=$this->dateEnd?></p>
<p><?=$this->tarifText?></p>
<p>Licence INSEE :<?php if ($this->licenceINSEE) {?> Non comptabilisé (déjà licencié)<?php } else {?> Paiement à chaque extraction.<?php }?></p>
<p>Filtre RNCS :<?php if ($this->filterRNCS) {?> Filtrer au seul paramètre RNCS.<?php } else {?> Aucun filtre.<?php }?></p>
<p>Extraction de fichier : <?php if ($this->immediatExtract) {?>Immédiat<?php } else { ?>Différé<?php }?></p>
<div class="chemin">
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>''))?>">Tableau de bord</a> >
Préférences
</div>
<h2>Gestion des profils d'enrichissement</h2>
<p>
Afin de vous permettre un enrichissement de données à partir d'une liste de SIREN/SIRET,
Suivant la configuration de votre compte, vous avez la possibilité de sélectionner les données
disponible.
</p>
<br/>
<h2>Préférences d'affichage</h2>
<p>Cas profil défini pas S&D</p>
<p>- Aucun profil d'enrichissement (Contacter le support)</p>
<p>- Liste des profils avec référence, tarifs à la ligne</p>
<p>Si droits création profil d'enrichissement</p>
<p>- Aucun profil d'enrichissement (Sans profil d'enrichissement, vous ne pourrez pas extraire de données)</p>
<p>- Liste des profils avec référence, tarifs à la ligne</p>
<p> - Créer un profil d'enrichissement (avoir donc un tarifs à la colonne, pour créer le tarif à la ligne)</p>
<p>Lister les colonnes disponibles (Association SQL/Libellé) pour la configuration<p>
<h2>Gestion des préférences d'affichage</h2>
<p>
L'application permet la modification de l'affichage des critères de ciblage afin de permettre une
utilisation correspondant à vos besoins.
</p>
<br/>
<p>Vous n'avez pas les droits nécessaires pour créer/modifier les préférences d'affichage.</p>
<p>Des préférences d'affichage ont été définies pour votre profil client.</p>
<br/>
<p>Aucune préférences d'affichage définies pour votre profil utilisateur.</p>
<p>Des préférences d'affichage ont été définies pour votre profil utilisateur.</p>
<br/>
<p>
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">
<a href="<?=$this->url(array('controller'=>'preferences', 'action'=>'active'))?>"
title="Activer le mode personnalisation afin de créer/modifier les préférences d'affichage">
Activer le mode personnalisation
</a>
</p>
<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/>
<?php if ($this->filterRNCS==1) {?>
<i>Votre compte est paramétré pour ne sélectionner que les entités provenant du RNCS</i>
<?php } else {?>
<input type="checkbox" name="rncs" value="1" <?php if ($this->prefFilterRncs==1) echo ' checked="checked"';?>
<?php if ($this->filterRNCS==1) echo ' disabled="disable"';?> />
<?php }?>
</div>
<br/>
<div>
<label>Afficher le nombre d'unité INSEE</label><br/>
<?php if ($this->filterRNCS==1) {?>
<i>Votre compte est paramétré pour ne sélectionner que les entités provenant du RNCS</i>
<?php } else {?>
<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"';?>/>
<?php }?>
</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>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>

View File

@ -1,101 +0,0 @@
<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>

View File

@ -0,0 +1,17 @@
<div id="dashboard">
<div class="chemin">
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>''))?>">Tableau de bord</a> >
Enrichissement fichier
</div>
<a href="<?=$this->url(array('controller'=>'enrichissement', 'action'=>'fileform'))?>">Envoyer votre fichier pour enrichissement</a>
<h2>Fichiers en cours d'enrichissement</h2>
<h2>Fichiers enrichis</h2>
</div>

View File

@ -1,96 +1,56 @@
<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><?=$this->translate('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'))?>"><?=$this->translate('Liste de vos ciblages')?></a> -
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'enrichissements'))?>"><?=$this->translate('Liste de vos enrichissements')?></a> -
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'configuration'))?>"><?=$this->translate('Préférences de l\'application')?></a> -
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>''))?>"><?=$this->translate('Enrichissement de fichier')?></a>
<div class="chemin">
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>''))?>">Tableau de bord</a>
</div>
<div>
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'ciblages'))?>">Historique de vos ciblages</a> -
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'configuration'))?>">Préférences de l'application</a> -
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'exports'))?>">Enrichissement fichier</a>
</div>
<div id="rechercheCiblage">
<h2><?=$this->translate('Rechercher dans vos ciblages')?></h2>
<h2>Rechercher dans vos ciblages</h2>
<input type="text" name="searchCiblage" class="searchCiblage" />
<input type="submit" value="<?=$this->translate('Rechercher')?>" class="submit"/>
<input type="submit" value="Rechercher" class="submit"/>
</div>
<div id="lastCiblage">
<h2><?=$this->translate('Vos derniers ciblages')?></h2>
<?php if(count($this->comptages) > 0):?>
<table>
<thead>
<tr>
<th><?=$this->translate('Référence')?></th>
<th><?=$this->translate('Nombre d\'entité')?></th>
<th><?=$this->translate('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']))?>"><?=$this->translate('Charger les critères de ciblage dans l\'interface')?></a></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<?php else:?>
<p><?=$this->translate('Aucun ciblage')?>.<p>
<?php endif;?>
</div>
<div id="lastCiblage" style="">
<h2>Vos derniers ciblages</h2>
<?php if(count($this->comptages)>0):?>
<table class="ciblage">
<thead>
<tr>
<th>Référence</th>
<th>Nombre d'entité</th>
<th>Unité Insee</th>
<th>Date</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
<?php foreach($this->comptages as $item):?>
<tr>
<td><?=$item['reference']?></td>
<td><?=number_format($item['resultat'], 0, ',', ' ')?></td>
<td><?=number_format($item['uniteInsee'], 0, ',', ' ')?></td>
<td><?=$item['dateComptage']?></td>
<td>
[<a href="<?=$this->url(array('controller'=> 'index','action'=>'index', 'id'=>$item['id']))?>">Recharger les critères de ciblage</a>] -
[<a href="<?=$this->url(array('controller'=> 'comptage','action'=>'update', 'id'=>$item['id']))?>">Actualiser le comptage</a>] -
[<a href="<?=$this->url(array('controller'=> 'comptage','action'=>'update', 'id'=>$item['id']))?>">Enrichissement</a>]
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<?php else:?>
<p>Aucun ciblage.<p>
<?php endif;?>
<div id="lastEnrichissement">
<h2><?=$this->translate('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 foreach($this->enrichissements as $item):?>
<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><?=$this->translate('Aucun enrichissement')?>.<p>
<?php endif;?>
</div>
</div>

View File

@ -1,5 +0,0 @@
<?php if ($this->nbRow>0) { ?>
Préférence enregistrée.
<?php } else {?>
Erreur lors de l'enregistrement de la préférence.
<?php } ?>

View File

@ -1,10 +0,0 @@
Votre demande a bien été prise en compte sous la référence <?=$this->ref?>
<script>
$('#dialog').dialog({
buttons: [{ text: "Quitter",
click: function() {
$(this).dialog("close");
window.location.href= window.location.href;
} }] });
</script>

View File

@ -1,97 +0,0 @@
<?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 === true) {?>
<p>Le nombre de lignes à enrichir est trop important.
Vous pouvez prendre contact avec le service commercial.</p>
<?php } elseif ( $this->resultat == 'lines') {?>
<p>Le nombre de lignes à enrichir est supérieur au nombre de ligne maximum définies dans la contrat.
Vous pouvez prendre contact avec le service commercial.</p>
<?php } elseif ( $this->resultat == 'files') {?>
<p>Le nombre maximum de fichier enrichit a été atteint.
Vous pouvez prendre contact avec le service commercial.</p>
<?php } elseif ( $this->forfaitRemain && $this->forfaitRemain<=0 ) { ?>
<p>Le montant de votre forfait est insuffisant
Vous pouvez prendre contact avec le service commercial.
</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</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>
<?php if ($this->forfaitRemain) {?>
<tr><td colspan="2"></td></tr>
<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>
</div>
<script>
$('#dialog').dialog({ buttons: [ {
text: "Commander",
click: function() {
var action = $('form[name=commande]').attr('action');
var values = $('form[name=commande]').serialize();
$('div#update').html('Enregistrement...');
$('#dialog').dialog({ buttons: [{}] });
$.post(action, values, function(data){
$('div#update').html(data);
}).error(function(){
$('div#update').html('Erreur');
});
}
},
{
text: "Quitter", click: function() { $(this).dialog("close"); }
}
] });
</script>
<?php }?>

View File

@ -1,12 +0,0 @@
<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>

View File

@ -1 +0,0 @@
<?=json_encode($this->output)?>

View File

@ -1,123 +0,0 @@
<ul>
<li><a href="#tabs-1"><?=$this->translate('Critères Entreprise')?></a></li>
<li><a href="#tabs-2"><?=$this->translate('Situation économique')?></a></li>
<li><a href="#tabs-3"><?=$this->translate('Secteur géographique')?></a></li>
<li><a href="#tabs-4"><?=$this->translate('Situation juridique')?></a></li>
<li><a href="#tabs-5"><?=$this->translate('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('codesdepts')?></li>
<li class="advanced"><?=$this->Field('codespostaux')?></li>
<li class="advanced"><?=$this->Field('codesinsee')?></li>
<li><?=$this->Field('zus')?></li>
<li><?=$this->Field('zru')?></li>
<li><?=$this->Field('zfu')?></li>
<li><?=$this->Field('cucs')?></li>
<li><?=$this->Field('zrr')?></li>
<li><?=$this->Field('zafr')?></li>
<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>

View File

@ -1,5 +0,0 @@
<p class="info">
<a href="http://www.scores-decisions.com/">Scores & Décisions SAS</a>
<img class='flag' id='fr' src="/themes/default/images/drapeaux/fr.png"/>
<img class='flag' id='en' src="/themes/default/images/drapeaux/en.png"/>
</p>

View File

@ -1,32 +0,0 @@
<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>Inclus :</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>Exclus :</p>
<?php foreach( $criteres['ex'] as $item ) {?>
<p><?=$item?></p>
<?php }?>
</div>
<?php }?>
<?php }?>
</div>
<?php }?>
</fieldset>

View File

@ -1,71 +0,0 @@
<?php
$YearBegin = 2012;
$Years = date('Y') - $YearBegin;
?>
<div id="dashboard">
<form method="post" action="">
<select name="year">
<?php for ($i=0 ; $i<=$Years ; $i++ ) {?>
<?php $select=''; if ($YearBegin+$Years-$i==$this->year) $select = ' selected';?>
<option value="<?=$YearBegin+$Years-$i?>"<?=$select?>><?=$YearBegin+$Years-$i?></option>
<?php }?>
</select>
<select name="month">
<?php for ( $i=1 ; $i<=12 ; $i++ ) {?>
<?php $select=''; if ($i==$this->month) $select = ' selected';?>
<option value="<?=$i?>"<?=$select?>><?=str_pad($i, 2, '0', STR_PAD_LEFT)?></option>
<?php }?>
</select>
<input type="submit" name="submit" value="Ok"/>
</form>
<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 id="<?=$comptage['idDefinition']?>">
<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>
<script>
$('table tr').on('click', function(){
var href = '/gestion/ciblagecriteres/id/'+$(this).attr('id');
if (href!='#' || href!='') {
var title = $(this).attr('title');
var dialogOpts = {
bgiframe: true,
title: title,
width: 650,
height: 600,
modal: true,
open: function(event, ui) {
$(this).html('Chargement...');
$(this).load(href);
},
buttons: {
Quitter: function() { $(this).dialog('close'); }
},
close: function() { $('#dialog').remove(); }
};
$('<div id="dialog"></div>').dialog(dialogOpts);
return false;
}
});
</script>

View File

@ -1,51 +0,0 @@
<?php
$YearBegin = 2012;
$Years = date('Y') - $YearBegin;
?>
<div id="dashboard">
<div>
<form method="post" action="">
<select name="year">
<?php for ($i=0 ; $i<=$Years ; $i++ ) {?>
<?php $select=''; if ($YearBegin+$Years-$i==$this->year) $select = ' selected';?>
<option value="<?=$YearBegin+$Years-$i?>"<?=$select?>><?=$YearBegin+$Years-$i?></option>
<?php }?>
</select>
<select name="month">
<?php for ( $i=1 ; $i<=12 ; $i++ ) {?>
<?php $select=''; if ($i==$this->month) $select = ' selected';?>
<option value="<?=str_pad($i, 2, '0', STR_PAD_LEFT)?>"<?=$select?>><?=str_pad($i, 2, '0', STR_PAD_LEFT)?></option>
<?php }?>
</select>
<input type="submit" name="submit" value="Ok"/>
</form>
</div>
<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>

View File

@ -1,19 +0,0 @@
<div id="dashboard">
<div>
<p>Date de contrat : <?=$this->ContratDateDebut?> à <?=$this->ContratDateFin?></p>
</div>
<h2>Consommation</h2>
<div>
<table>
<thead>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>

View File

@ -1,59 +0,0 @@
<div id="dashboard">
<h2>Paramètres client</h2>
<table>
<tr><td>Nom</td><td><?=$this->infos['nom']?></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>
<?php foreach ( $this->infos['criteres'] as $item ) {?>
<?=$this->fields[$item]['label']?><br/>
<?php }?>
</td>
<tr><td>dataInsee</td><td><?=$this->infos['dataInsee']?></td></tr>
<tr><td>dateAdded</td><td><?=$this->infos['dateAdded']?></td></tr>
</table>
<a href="<?=$this->url(array('controller'=>'gestion','action'=>'customerparamadd','idClient'=>$this->idClient),null,true)?>">Modifier</a>
<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>

View File

@ -1,112 +0,0 @@
<div id="dashboard">
<?php if ($this->message) {?>
<?=$this->message?>
<?php } else {?>
<form name="profil" method="post" action="<?=$this->url(array('controller'=>'gestion', 'action'=>'customerparamadd'))?>">
<?php if ($this->id) {?>
<input type="hidden" name="id" value="<?=$this->id?>"/>
<?php }?>
<div>
<label>Client</label>
<select name="idClient">
<?php foreach ( $this->selectClient as $client ) {?>
<?php $select = ''; if ($this->idClient==$client->id) { $select = ' selected'; }?>
<option value="<?=$client->id?>"<?=$select?>><?=$client->nom?></option>
<?php }?>
</select>
</div>
<div>
<label>service</label>
<input type="text" name="service" value="<?=$this->service?>"/>
</div>
<div>
<label>filterRNCS</label>
<?php $select = ''; if ($this->filterRNCS==1) $select = ' checked'?>
<input type="checkbox" name="filterRNCS" value="1"<?=$select?>/>
Filtrer au RNCS
</div>
<div>
<label>licenceINSEE</label>
<?php $select = ''; if ($this->licenceInsee==1) $select = ' checked'?>
<input type="checkbox" name="licenceINSEE" value="1"<?=$select?>/>
Le client possède la licence INSEE
</div>
<div>
<label>immediatExtract</label>
<input type="text" name="immediatExtract" value="<?=$this->immediatExtract?>" />
Nombre de ligne maximum pour une extraction immédiate
</div>
<div>
<label>dateContrat</label>
<input type="text" name="dateContrat" value="<?=$this->dateContrat?>"/>
Date de début du contract (AAAA-MM-JJ)
</div>
<div>
<label>periodContrat</label>
<input type="text" name="periodContrat" value="<?=$this->periodContrat?>"/>
Durée du contrat (1,3,6,12 mois)
</div>
<div>
<label>periodPaiement</label>
<input type="text" name="periodPaiement" value="<?=$this->periodPaiement?>"/>
Emission des factures (tous les 1,3,6,12 mois)
</div>
<div>
<label>priceLine</label>
<input type="text" name="priceLine" value="<?=$this->priceLine?>"/>
Prix à la ligne (obligatoire même en forfait pour pouvoir décompter)
</div>
<div>
<label>forfait</label>
<input type="text" name="forfait" value="<?=$this->forfait?>"/>
Montant du forfait pour l'extraction de fichier
</div>
<div>
<label>limitLines</label>
<input type="text" name="limitLines" value="<?=$this->limitLines?>"/>
Nombre maximal de lignes dans un fichier
</div>
<div>
<label>limitFiles</label>
<input type="text" name="limitFiles" value="<?=$this->limitFiles?>"/>
Nombre maximal de fichier pouvant être extrait
</div>
<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 ) {?>
<?php $select = ''; if (in_array($value, $this->criteres)) $select = ' selected'; ?>
<option value="<?=$value?>"<?=$select?>><?=$item['label']?></option>
<?php }?>
<?php }?>
</select>
</div>
<?php if ($this->idClient) {?>
<input type="submit" name="submit" value="Modifier"/>
<?php } else {?>
<input type="submit" name="submit" value="Enregistrer"/>
<?php }?>
</form>
<?php }?>
</div>

View File

@ -1,38 +0,0 @@
<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>Nom</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['nom']?></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', 'idClient'=>$item['idClient']))?>">Détail</a>
<a href="<?=$this->url(array('controller'=>'gestion', 'action'=>'conso', 'idClient'=>$item['idClient']))?>">Conso</a>
</td>
</tr>
<?php }?>
</table>
</div>
</div>

View File

@ -1,50 +0,0 @@
<?php
$YearBegin = 2012;
$Years = date('Y') - $YearBegin;
?>
<div id="dashboard">
<form method="post" action="">
<select name="year">
<?php for ($i=0 ; $i<=$Years ; $i++ ) {?>
<?php $select=''; if ($YearBegin+$Years-$i==$this->year) $select = ' selected';?>
<option value="<?=$YearBegin+$Years-$i?>"<?=$select?>><?=$YearBegin+$Years-$i?></option>
<?php }?>
</select>
<select name="month">
<?php for ( $i=1 ; $i<=12 ; $i++ ) {?>
<?php $select=''; if ($i==$this->month) $select = ' selected';?>
<option value="<?=str_pad($i, 2, '0', STR_PAD_LEFT)?>"<?=$select?>><?=str_pad($i, 2, '0', STR_PAD_LEFT)?></option>
<?php }?>
</select>
<input type="submit" name="submit" value="Ok"/>
</form>
<h2>Liste des commandes</h2>
<div>
<table>
<tr>
<th><b>Date</b></th>
<th><b>login</b></th>
<th><b>Références</b></th>
<th><b>Résultat</b></th>
<th><b>Insee</b></th>
</tr>
<?php foreach($this->commandes as $item) { ?>
<tr>
<td>
<?=$item['dateAdded']?><br/>
<?=$item['dateStart']?>
</td>
<td><?=$item['login']?></td>
<td>
<?=$item['commandeReference']?><br/>
<?=$item['critereReference']?><br/>
<a href="<?=$this->url(array('controller'=>'gestion','action'=>'enrichissementdl', 'id'=> $item['id']),
'default', true)?>"><?=$item['fichier']?></a>
</td>
<td><?=$item['nbLigneTotales']?></td>
<td><?=$item['uniteInsee']?></td>
</tr>
<?php } ?>
</table>
</div>
</div>

View File

@ -1,12 +0,0 @@
<?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;
}

View File

@ -1,10 +0,0 @@
<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/>
</div>

View File

@ -1,34 +0,0 @@
<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>

View File

@ -1,45 +0,0 @@
<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>Nom</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['nom']?></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>

Some files were not shown because too many files have changed in this diff Show More