Version 1.1 de ODEA

Stable
This commit is contained in:
Damien LASSERRE 2012-02-02 17:29:14 +00:00
parent 3f4e689a90
commit d0cac19a26
3067 changed files with 728355 additions and 0 deletions

5
.buildpath Normal file
View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<buildpath>
<buildpathentry kind="src" path=""/>
<buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
</buildpath>

22
.project Normal file
View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>sdciblage2</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.dltk.core.scriptbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.php.core.PHPNature</nature>
</natures>
</projectDescription>

203
.zfproject.xml Normal file
View File

@ -0,0 +1,203 @@
<?xml version="1.0"?>
<projectProfile type="default" version="1.11.11">
<projectDirectory>
<projectProfileFile filesystemName=".zfproject.xml"/>
<applicationDirectory classNamePrefix="Application_">
<apisDirectory enabled="false"/>
<configsDirectory>
<applicationConfigFile type="ini"/>
</configsDirectory>
<controllersDirectory>
<controllerFile controllerName="Index">
<actionMethod actionName="index"/>
</controllerFile>
<controllerFile controllerName="Error"/>
</controllersDirectory>
<formsDirectory enabled="false"/>
<layoutsDirectory enabled="false"/>
<modelsDirectory/>
<modulesDirectory>
<moduleDirectory moduleName="frontend">
<apisDirectory enabled="false"/>
<configsDirectory enabled="false"/>
<controllersDirectory>
<controllerFile controllerName="Index">
<actionMethod actionName="index"/>
</controllerFile>
<controllerFile controllerName="Login">
<actionMethod actionName="index"/>
</controllerFile>
<controllerFile controllerName="Entreprise">
<actionMethod actionName="index"/>
</controllerFile>
<controllerFile controllerName="Economique">
<actionMethod actionName="index"/>
</controllerFile>
<controllerFile controllerName="Financier">
<actionMethod actionName="index"/>
</controllerFile>
<controllerFile controllerName="Geographique">
<actionMethod actionName="index"/>
</controllerFile>
<controllerFile controllerName="Juridique">
<actionMethod actionName="index"/>
</controllerFile>
<controllerFile controllerName="User">
<actionMethod actionName="index"/>
</controllerFile>
<controllerFile controllerName="Comptage">
<actionMethod actionName="index"/>
</controllerFile>
<controllerFile controllerName="Arborescence">
<actionMethod actionName="index"/>
<actionMethod actionName="naf"/>
<actionMethod actionName="nafajax"/>
</controllerFile>
<controllerFile controllerName="Dashboard">
<actionMethod actionName="index"/>
<actionMethod actionName="menu"/>
<actionMethod actionName="ciblages"/>
<actionMethod actionName="ciblagedetail"/>
<actionMethod actionName="rcomptage"/>
<actionMethod actionName="configuration"/>
<actionMethod actionName="exports"/>
</controllerFile>
</controllersDirectory>
<formsDirectory enabled="false"/>
<layoutsDirectory enabled="false"/>
<modelsDirectory/>
<viewsDirectory>
<viewScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Index">
<viewScriptFile forActionName="index"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Login">
<viewScriptFile forActionName="index"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Entreprise">
<viewScriptFile forActionName="index"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Economique">
<viewScriptFile forActionName="index"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Financier">
<viewScriptFile forActionName="index"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Geographique">
<viewScriptFile forActionName="index"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Juridique">
<viewScriptFile forActionName="index"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="User">
<viewScriptFile forActionName="index"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Comptage">
<viewScriptFile forActionName="index"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Arborescence">
<viewScriptFile forActionName="index"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Dashboard">
<viewScriptFile forActionName="index"/>
</viewControllerScriptsDirectory>
</viewScriptsDirectory>
<viewHelpersDirectory/>
<viewFiltersDirectory/>
</viewsDirectory>
</moduleDirectory>
<moduleDirectory moduleName="backend">
<apisDirectory enabled="false"/>
<configsDirectory enabled="false"/>
<controllersDirectory>
<controllerFile controllerName="Index">
<actionMethod actionName="index"/>
</controllerFile>
</controllersDirectory>
<formsDirectory enabled="false"/>
<layoutsDirectory enabled="false"/>
<modelsDirectory/>
<viewsDirectory>
<viewScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Index">
<viewScriptFile forActionName="index"/>
</viewControllerScriptsDirectory>
</viewScriptsDirectory>
<viewHelpersDirectory/>
<viewFiltersDirectory/>
</viewsDirectory>
</moduleDirectory>
</modulesDirectory>
<viewsDirectory>
<viewScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Index">
<viewScriptFile forActionName="index"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Error">
<viewScriptFile forActionName="error"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Arborescence">
<viewScriptFile forActionName="naf"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Arborescence">
<viewScriptFile forActionName="nafajax"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Dashboard">
<viewScriptFile forActionName="menu"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Dashboard">
<viewScriptFile forActionName="ciblages"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Dashboard">
<viewScriptFile forActionName="ciblagedetail"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Dashboard">
<viewScriptFile forActionName="rcomptage"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Dashboard">
<viewScriptFile forActionName="configuration"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Dashboard">
<viewScriptFile forActionName="exports"/>
</viewControllerScriptsDirectory>
</viewScriptsDirectory>
<viewHelpersDirectory/>
<viewFiltersDirectory enabled="false"/>
</viewsDirectory>
<bootstrapFile filesystemName="Bootstrap.php"/>
</applicationDirectory>
<dataDirectory enabled="false">
<cacheDirectory enabled="false"/>
<searchIndexesDirectory enabled="false"/>
<localesDirectory enabled="false"/>
<logsDirectory enabled="false"/>
<sessionsDirectory enabled="false"/>
<uploadsDirectory enabled="false"/>
</dataDirectory>
<docsDirectory>
<file filesystemName="README.txt"/>
</docsDirectory>
<libraryDirectory>
<zfStandardLibraryDirectory enabled="false"/>
</libraryDirectory>
<publicDirectory>
<publicStylesheetsDirectory enabled="false"/>
<publicScriptsDirectory enabled="false"/>
<publicImagesDirectory enabled="false"/>
<publicIndexFile filesystemName="index.php"/>
<htaccessFile filesystemName=".htaccess"/>
</publicDirectory>
<projectProvidersDirectory enabled="false"/>
<temporaryDirectory enabled="false"/>
<testsDirectory>
<testPHPUnitConfigFile filesystemName="phpunit.xml"/>
<testPHPUnitBootstrapFile filesystemName="bootstrap.php"/>
<testApplicationDirectory>
<testApplicationControllerDirectory>
<testApplicationControllerFile forControllerName="Index"/>
</testApplicationControllerDirectory>
</testApplicationDirectory>
<testLibraryDirectory/>
</testsDirectory>
</projectDirectory>
</projectProfile>

90
application/Bootstrap.php Normal file
View File

@ -0,0 +1,90 @@
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initViewSettings()
{
$this->bootstrap('view');
$view = $this->getResource('view');
$pathStyle = '/styles';
$pathScript = '/scripts';
$view->setEncoding('UTF-8');
$view->doctype('XHTML1_STRICT');
$view->headMeta()
->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8')
->appendHttpEquiv('Content-Language', 'fr-FR');
$view->headLink()
->appendStylesheet($pathStyle.'/reset.css', 'all')
->appendStylesheet($pathStyle.'/jquery.qtip.css', 'all')
->appendStylesheet($pathScript.'/jstree/default/style.css')
->appendStylesheet($pathScript.'/jqueryui/jquery-ui.css', 'all')
->appendStylesheet($pathStyle.'/main.css', 'all');
$view->headScript()
->appendFile($pathScript.'/jquery.js', 'text/javascript')
->appendFile($pathScript.'/jquery.bgiframe.js', 'text/javascript')
->appendFile($pathScript.'/jquery.cookie.js', 'text/javascript')
->appendFile($pathScript.'/jquery-ui.js', 'text/javascript')
->appendFile($pathScript.'/jquery.qtip.js', 'text/javascript')
->appendFile($pathScript.'/jquery.qtip.js', 'text/javascript')
->appendFile($pathScript.'/scripts.js', 'text/javascript')
->appendFile($pathScript.'/jquery.jstree.js', 'text/javascript')
->appendFile($pathScript.'/fields.js', 'text/javascript');
$view->headTitle('Odea');
}
protected function _initLogging()
{
//Logger de développement
$writer = new Zend_Log_Writer_Firebug();
if(APPLICATION_ENV=='production') $writer->setEnabled(false);
$logger = new Zend_Log($writer);
Zend_Registry::set('firebug', $logger);
}
protected function _initDb()
{
$dbConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'databases');
try {
$db = Zend_Db::factory($dbConfig->db);
Zend_Db_Table::setDefaultAdapter ($db);
} catch ( Exception $e ) {
exit ( $e->getMessage() );
}
Zend_Registry::set('db', $db);
}
protected function _initAutoload()
{
require_once APPLICATION_PATH . '/../library/Zend/Loader/Autoloader.php';
$appPath = realpath(dirname(__FILE__));
$rootPath = dirname($appPath);
$autoload = Zend_Loader_Autoloader::getInstance();
$application = new Zend_Loader_Autoloader_Resource(array(
'basePath' => $appPath . '/modules/frontend/models/',
'namespace' => '',
'resourceTypes' => array('tables'=>array('path'=>'Tables/','namespace'=>'Table'),
'objects'=>array('path'=>'Objects/', 'namespace'=>'Object'),
'forms'=>array('path'=>'Forms/', 'namespace'=>'Form')
)));
$libs = new Zend_Loader_Autoloader_Resource(array(
'basePath' => $rootPath . '/library',
'namespace' => 'library',
'resourceTypes' => array('libs'=>array('path'=>'libs/','namespace'=>'Libs'),
)));
$loader = new Zend_Application_Module_Autoloader(array(
'namespace' => '',
'basePath' => APPLICATION_PATH));
return $loader;
}
}

View File

@ -0,0 +1,37 @@
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
phpSettings.date.timezone = "Europe/Paris"
includePaths.library = LIBRARY_PATH
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
; so auto-loading will find our classes in library/App
autoloaderNamespaces[] = "Structure_" ;Les structures de données
autoloaderNamespaces[] = "Libs_" ;Librairies de l'application
resources.view[] = ""
; initialize front controller resource
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.frontController.defaultControllerName = "index"
resources.frontController.defaultAction = "index"
resources.frontController.defaultModule = "frontend"
autoloaderNamespaces[] = "Application_"
resources.frontController.plugins.Comptage = "Application_Controller_Plugin_Comptage"
resources.frontController.plugins.Auth = "Application_Controller_Plugin_Auth"
;Resource router Backend
resources.router.routes.admin.type = Zend_Controller_Router_Route
resources.router.routes.admin.route = "/backend/*"
resources.router.routes.admin.defaults.module = backend
resources.router.routes.admin.defaults.controller = index
resources.router.routes.admin.defaults.action = index
; initialize layout resource
resources.layout.layoutPath = APPLICATION_PATH "/layouts"
[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1

View File

@ -0,0 +1,32 @@
[server]
name = sdsrvdev01
[webservice]
location = sdsrvdev01
[databases]
db.adapter=mysqli
db.params.host=127.0.0.1
db.params.username=root
db.params.password=
db.params.dbname=sdciblage
db.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
[mail]
method = smtp
smpt_port =
smtp_host = smtp.free.fr
support = mricois@scores-decisions.com
supportdev = mricois@scores-decisions.com
contact = mricois@scores-decisions.com
production = mricois@scores-decisions.com
[wkhtmltopdf]
arch = "amd64"
[path]
data = "c:\www\data"
log = "log"
pdf = "pdf"
logos = "logos"
marques = "marques"

View File

View File

@ -0,0 +1 @@
<?php

View File

@ -0,0 +1,32 @@
<div id="primaryNavigation" class="clearfix">
<ul>
<li><a href="<?=$this->url(array('controller'=>'index', 'action'=>'index'), null, true)?>">Accueil</a></li>
<li><a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'index'), null, true)?>">Tableau de bord</a></li>
<li><a href="<?=$this->url(array('controller'=>'aide', 'action'=>'index'), null, true)?>">Aide</a></li>
<li><a href="<?=$this->url(array('controller'=>'aide', 'action'=>'aproposde'), null, true)?>">A propos de</a></li>
<li><a href="<?=$this->url(array('controller'=>'user', 'action'=>'logout'), null, true)?>">Déconnexion</a></li>
</ul>
</div>
<div id="logo">
<h1>Odea</h1>
</div>
<div id="message">
<?php if ($this->msgComptage){?>
<div id="comptage" >
<?php if (!empty($this->total)) {?>
Nombre sélectionnées :
<span class="valeur"><?=$this->total?></span>
(dont <span class="valeur"><?=$this->insee?></span> unité(s) insee)
<?php } else {?>
Aucune sélection.
<?php }?>
</div>
<div id="attente" style="display:none;">
<img src="/images/ajax.gif" />
</div>
<div id="control">
[<a href="<?=$this->url(array('controller'=>'comptage', 'action'=> 'reset'))?>">Initialiser les critères</a>],
[<a id="saveciblage" href="<?=$this->url(array('controller'=>'comptage', 'action'=>'savedialog'))?>">Sauvegarder le profil du ciblage</a>]
</div>
<?php }?>
</div>

View File

@ -0,0 +1,23 @@
<?php echo $this->doctype(); ?>
<html>
<head>
<?php echo $this->headMeta(); ?>
<?php echo $this->headTitle(); ?>
<?php echo $this->headStyle(); ?>
<?php echo $this->headLink(); ?>
<?php echo $this->headScript(); ?>
</head>
<body>
<div id="global">
<div id="header" class="clearfix">
<?php echo $this->render('header.phtml') ?>
</div>
<div id="content" class="clearfix">
<?php echo $this->layout()->content; ?>
</div>
<div id="footer">
<?php echo $this->render('footer.phtml'); ?>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,24 @@
<?php
class Backend_IndexController extends Zend_Controller_Action
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
if($user->username != 'fzicaro' and $user->username != 'dlasserre')
$this->_redirect('/');
if ($user->customisation) {
$this->view->assign('preferences', $user->customisation);
}
}
}

View File

@ -0,0 +1,20 @@
<div id="tabs">
<ul>
<li><a href="#tabs-1">Gestion des utilisateurs</a></li>
<li><a href="#tabs-2">Gestion des comptages</a></li>
<li><a href="#tabs-3">Gestion des fichiers</a></li>
<li><a href="#tabs-4">Statistiques</a></li>
</ul>
<div id="tabs-1">
<?php //echo $this->action('index', 'entreprise')?>
</div>
<div id="tabs-2">
<?php //echo $this->action('index', 'economique')?>
</div>
<div id="tabs-3">
<?php //echo $this->action('index', 'geographique')?>
</div>
<div id="tabs-4">
<?php //echo $this->action('index', 'juridique')?>
</div>
</div>

View File

@ -0,0 +1,172 @@
<?php
class ArborescenceController extends Libs_Controller
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
// action body
}
public function nafAction()
{
$this->_helper->layout()->disableLayout();
$request = $this->getRequest();
$key = $request->getParam('key');
$object = new Object_Naf();
//Récupération des valeurs enregistrées en session
$this->view->key = $key;
$this->view->naf = $object->naf($request->getParam('niveau', 1), $key);
}
public function nafajaxAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$request = $this->getRequest();
$key = $request->getParam('key');
$object = new Object_Naf();
echo $object->ajax($request->getParam('parent', ''),
$request->getParam('niveau', 1),
$request->getParam('key')
);
}
public function geographiqueAction()
{
$this->_helper->layout()->disableLayout();
$object = new Object_Codepostaux();
$key = $this->getRequest()->getParam('key');
$this->view->assign('key', $key);
$this->view->regions = $object->geographique();
}
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 Table_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 Table_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 Table_Codepostauxs();
$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 Table_Departements();
$sql = $Departements->select()->from('departements', array('numdep'))->where('codeRegionInsee = ?', substr($valuesChecked, 1));
$results = $Departements->fetchAll($sql)->toArray();
foreach($results as $result) {
$table = new Table_Codepostauxs();
$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 Table_Codepostauxs();
$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);
}
}
}

View File

@ -0,0 +1,52 @@
<?php
class ComptageController extends Libs_Controller
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$request = $this->getRequest();
$object = new Object_Comptage();
echo $object->count($request->getParam('cle'), $request->getParam('valeur'));
}
public function resetAction()
{
require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage();
$session->clearCiblage();
$this->_redirect('./');
}
public function savedialogAction()
{
$this->_helper->layout()->disableLayout();
//Récupération de la session pour le profil et les valeurs du comptage
require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage();
$criteres = $session->getCriteres();
$this->view->criteres = $criteres;
if (count($criteres) == 0) {
$this->view->noSelection = true;
}
}
public function saveAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$request = $this->getRequest();
$object = new Object_Comptage();
$object->saveComptage($request->getParam('ref', ''));
}
}

View File

@ -0,0 +1,76 @@
<?php
class DashboardController extends Libs_Controller
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
$object = new Object_Dashboard();
$this->view->comptages = $object->index();
}
public function menuAction()
{
// action body
}
public function ciblagesAction()
{
$object = new Object_Dashboard();
$request = $this->getRequest();
$assigns = $object->ciblage($request->getParam('page', 1));
$this->view->ciblages = $assigns['ciblages'];
$this->view->nbCiblage = $assigns['nbCiblage'];
}
public function ciblagedetailAction()
{
$object = new Object_Dashboard();
$request = $this->getRequest();
$this->view->assign('comptages', $object->ciblagedetail($request->getParam('id')));
}
public function rcomptageAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$request = $this->getRequest();
$object = new Object_Dashboard();
echo $object->rcomptage(strtolower($this->getRequest()->getParam('q', '')));
}
public function configurationAction()
{
// action body
}
public function exportsAction()
{
// action body
}
}

View File

@ -0,0 +1,23 @@
<?php
class EconomiqueController extends Libs_Controller
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
require_once('Scores/Field.php');
$this->view->headLink()->appendStylesheet('/styles/pages/'.$this->getRequest()->getControllerName().'.css', 'all');
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$field = new Fields($user->username);
$this->view->fields = $field;
}
}

View File

@ -0,0 +1,21 @@
<?php
class EntrepriseController extends Libs_Controller
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
require_once('Scores/Field.php');
$this->view->headLink()->appendStylesheet('/styles/pages/'.$this->getRequest()->getControllerName().'.css', 'all');
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$field = new Fields($user->username);
$this->view->fields = $field;
}
}

View File

@ -0,0 +1,47 @@
<?php
class ErrorController extends Libs_Controller
{
public function errorAction()
{
$errors = $this->_getParam('error_handler');
switch ($errors->type) {
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
// 404 error -- controller or action not found
$this->getResponse()->setHttpResponseCode(404);
$this->view->message = 'Page not found';
break;
default:
// application error
$this->getResponse()->setHttpResponseCode(500);
$this->view->message = 'Application error';
break;
}
// Log exception, if logger available
if ($log = $this->getLog()) {
$log->crit($this->view->message, $errors->exception);
}
// conditionally display exceptions
if ($this->getInvokeArg('displayExceptions') == true) {
$this->view->exception = $errors->exception;
}
$this->view->request = $errors->request;
}
public function getLog()
{
$bootstrap = $this->getInvokeArg('bootstrap');
if (!$bootstrap->hasPluginResource('Log')) {
return false;
}
$log = $bootstrap->getResource('Log');
return $log;
}
}

View File

@ -0,0 +1,23 @@
<?php
class FinancierController extends Libs_Controller
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
require_once('Scores/Field.php');
$this->view->headLink()->appendStylesheet('/styles/pages/'.$this->getRequest()->getControllerName().'.css', 'all');
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$field = new Fields($user->username);
$this->view->fields = $field;
}
}

View File

@ -0,0 +1,23 @@
<?php
class GeographiqueController extends Libs_Controller
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
require_once('Scores/Field.php');
$this->view->headLink()->appendStylesheet('/styles/pages/'.$this->getRequest()->getControllerName().'.css', 'all');
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$field = new Fields($user->username);
$this->view->fields = $field;
}
}

View File

@ -0,0 +1,22 @@
<?php
Class IndexController extends Libs_Controller
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
if ($user->customisation) {
$this->view->assign('preferences', $user->customisation);
}
}
}

View File

@ -0,0 +1,23 @@
<?php
class JuridiqueController extends Libs_Controller
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
require_once('Scores/Field.php');
$this->view->headLink()->appendStylesheet('/styles/pages/'.$this->getRequest()->getControllerName().'.css', 'all');
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$field = new Fields($user->username);
$this->view->fields = $field;
}
}

View File

@ -0,0 +1,18 @@
<?php
class LoginController extends Libs_Controller
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
// action body
}
}

View File

@ -0,0 +1,91 @@
<?php
class UserController extends Libs_Controller
{
public function init()
{
require_once APPLICATION_PATH.'/modules/frontend/models/Forms/Login.php';
require_once 'Scores/WebAuthAdapter.php';
require_once 'Scores/WsScores.php';
}
public function loginAction()
{
$this->view->headTitle()->append('Connexion');
$form = new Form_Login();
$this->view->form = $form;
$request = $this->getRequest();
//print_r($request->getParams());exit;
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' && $url!='/favicon.ico'){
$this->_redirect($url);
}
$this->_redirect('/');
}
}
}
$this->_helper->layout()->disableLayout();
$this->render('login');
}
public function logoutAction()
{
//Suppression des critères de comptage en session
require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage();
$session->clearCiblage();
//Suppression de l'identité
Zend_Auth::getInstance()->clearIdentity();
$this->_helper->layout()->disableLayout();
$url = 'http://www.scores-decisions.com/';
$refresh = 5;
if (APPLICATION_ENV != 'production'){
$url = 'http://'.$_SERVER['SERVER_NAME'].$this->view->url(array(
'controller' => 'user',
'action' => 'login',
));
}
$this->view->assign('url', $url);
$this->view->headMeta()->appendHttpEquiv('refresh', '5; url='.$url);
$this->render('logout');
}
}

View File

@ -0,0 +1,28 @@
<?php
class Form_Login extends Zend_Form {
public function init()
{
$this->setName('login');
$this->setAction('/user/login');
$this->setMethod('post');
$this->addElement('text', 'login', array(
'filters' => array('StringTrim'),
'label' => 'Identifiant : ',
'required' => 'true',
)
);
$this->addElement('password', 'pass',
array(
'label' => 'Mot de passe : ',
'required' => 'true',
)
);
$this->addElement('submit', 'submit',
array(
'label' => 'Identification',
'ignore' => true,
));
}
}

View File

@ -0,0 +1,65 @@
<?php
class Object_Codepostaux extends Libs_Row
{
public function geographique()
{
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 Table_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 Table_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'];
}
}
}
}
$regionsM = new Table_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;
}
return (json_encode($tabAdrDep));
}
}

View File

@ -0,0 +1,93 @@
<?php
class Object_Comptage extends Libs_Row
{
public function saveComptage($ref)
{
if (empty($ref)) {
echo json_encode(array(
'error'=>1,
'msg'=> "Référence non définie !"));
} else {
//Session
require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage();
$criteres = $session->getCriteres();
$resultat = $session->getNb('total');
$nbInsee = $session->getNb('insee');
//Informations utilisateur
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$db = Zend_Registry::get('db');
//Enregistrement des critères
$criteresM = new Table_Criteres();
$data = array(
'idClient' => $user->idClient,
'login' => $user->username,
'reference' => $ref,
'criteres' => json_encode($criteres),
'parent' => 0,
'dateAjout' => date('Y-m-d H:i:s'),
);
$id = $criteresM->insert($data);
if ($id){
//Enregistrement des valeurs du comptage
$comptageM = new Table_Comptages();
$data = array(
'idDefinition' => $id,
'resultat' => $resultat,
'uniteInsee' => $nbInsee,
'tarif' => '',
'dateAjout' => date('Y-m-d H:i:s'),
);
if ($comptageM->insert($data)) {
echo json_encode(array(
'error'=>0,
'msg'=> "Vos critères ont été sauvegardés sous la référence $ref"));
} else {
echo json_encode(array(
'error'=>1,
'msg'=> "Erreur lors de l'enregistrement"));
}
} else {
echo json_encode(array(
'error'=>1,
'msg'=> "Erreur lors de l'enregistrement"));
}
}
}
public function count($key, $valeur)
{
require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage();
$sessionValeur = $session->getCritere($key);
$session->setCritere($key, $valeur);
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
require_once 'Scores/Field.php';
$field = new Fields($user->username);
//Comptage
require_once 'Scores/Ciblage.php';
$ciblage = new Ciblage($field->getValues());
$total = $ciblage->execute();
$insee = $ciblage->calculRedevanceInsee();
$session->setNb('total', $total);
$session->setNb('insee', $insee);
//Retour comptage, unité Insee
$result = array(
'count' => number_format($total, 0, '', ' '),
'insee' => number_format($insee, 0, '', ' ')
);
return (json_encode($result));
}
}

View File

@ -0,0 +1,5 @@
<?php
class Object_Critere extends Libs_Row
{
}

View File

@ -0,0 +1,155 @@
<?php
Class Object_Dashboard
{
public function index()
{
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$criteresM = new Table_Criteres();
$sql = $criteresM->select(true)
->columns(array('id', 'reference', 'dateAjout'))
->where("idClient = ?", $user->idClient)
->where("login = ?", $user->username)
->order('dateAjout DESC')
->limit(5);
$rows = $criteresM->fetchAll($sql);
$results = array();
$comptagesM = new Table_Comptages();
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;
}
return ($results);
}
public function menu()
{
}
public function ciblage($page)
{
$offset = 20;
//Liste des ciblages par paquet de n
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$db = Zend_Registry::get('db');
$criteresM = new Table_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 Table_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;
}
return (array('ciblages' => $results, 'nbCiblage' => $nbCiblage));
}
public function ciblagedetail($id)
{
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$criteresM = new Table_Criteres();
$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 Table_Comptages();
$sql = $comptagesM->select()
->where('idDefinition = ?', $id);
$comptages = $comptagesM->fetchAll($sql);
return ($comptages->toArray());
}
}
public function rcomptage($q)
{
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$criteresM = new Table_Criteres($db);
$sql = $criteresM->select()
->from($criteresM, array('id', 'reference', "DATE_FORMAT(dateAjout, '%d/%m/%Y') as date"))
->where("idClient = ?", $user->idClient)
->where("login = ?", $user->username)
->where("reference LIKE ?", $q.'%');
$rows = $criteresM->fetchAll($sql);
if (count($rows)>0){
$separator = " , ";
foreach ($rows as $item) {
$output[] = array(
'label' => $item->reference . $separator . $item->date,
'value' => $item->reference,
'url' => $this->view->url(array('controller'=>'dashboard', 'action'=>'ciblagedetail', 'id'=>$item->id)),
);
}
}
return (json_encode($output));
}
}

View File

@ -0,0 +1,5 @@
<?php
class Object_Departement extends Libs_Row
{
}

View File

@ -0,0 +1,5 @@
<?php
class Object_Formejuridique extends Libs_Row
{
}

View File

@ -0,0 +1,107 @@
<?php
class Object_Naf extends Libs_Row
{
public function naf($niveau, $key)
{
require_once 'Scores/SessionCiblage.php';
$sessionCiblage = new SessionCiblage();
$val = $sessionCiblage->getCritere($key);
$valuesChecked = array();
$valuesUndetermined = array();
if ($val != null){
$valuesChecked = explode(',',$val);
foreach($valuesChecked as $value){
$valuesUndetermined = array_merge($valuesUndetermined, $this->getNafParent($value, true));
}
}
$nafM = new Table_Nafs();
$sql = $nafM->select()->where('niveau = ?', $niveau)->order('code ASC');
$result = $nafM->fetchAll($sql)->toArray();
$tabNaf = array();
foreach($result as $item)
{
$structure = array(
'data' => $item['code'].' - '.$item['lib'],
'attr' => array('id' => $item['code'], 'niveau' => $item['niveau']),
'state' => 'closed',
'children' => array(),
);
if (in_array($item['code'], $valuesChecked)){
$structure['attr']['class'] = 'jstree-checked';
}
if (in_array($item['code'], $valuesUndetermined)){
$structure['attr']['class'] = 'jstree-undetermined';
}
$tabNaf[] = $structure;
}
return (json_encode($tabNaf));
}
protected function getNafParent($value, $niveau1 = false)
{
$out = array();
if (strlen($value)>2) {
$niveau = strlen($value)-1;
$new = substr($value,0,$niveau);
$out = array_merge($out, array($new), $this->getNafParent($new, $niveau1));
} elseif (strlen($value)==2 && $niveau1 === true) {
$nafM = new Application_Model_Naf();
$sql = $nafM->select()
->from($nafM, array('parent'))
->where('code = ?', $value);
$result = $nafM->fetchRow($sql);
$out[] = $result->parent;
}
return $out;
}
public function ajax($parent, $niveau, $key)
{
//Récupération des valeurs enregistrées en session
require_once 'Scores/SessionCiblage.php';
$sessionCiblage = new SessionCiblage();
$val = $sessionCiblage->getCritere($key);
$valuesChecked = array();
$valuesUndetermined = array();
if ($val != null){
$valuesChecked = explode(',',$val);
foreach($valuesChecked as $value){
$valuesUndetermined = array_merge($valuesUndetermined, $this->getNafParent($value));
}
}
$niveau++;
$nafM = new Table_Nafs();
$sql = $nafM->select();
if (!empty($parent) && $niveau==2) {
$sql->where('parent = ?', $parent);
} elseif (!empty($parent) && $niveau>2) {
$sql->where("code LIKE '".$parent."%'");
}
$sql->where('niveau = ?', $niveau)->order('code ASC');
$result = $nafM->fetchAll($sql)->toArray();
$tabNaf = array();
foreach($result as $item){
$structure = array(
'data' => $item['code'].' - '.$item['lib'],
'attr' => array('id' => $item['code'], 'niveau' => $item['niveau']),
);
if (in_array($item['code'], $valuesChecked)){
$structure['attr']['class'] = 'jstree-checked';
}
if (in_array($item['code'], $valuesUndetermined)){
$structure['attr']['class'] = 'jstree-undetermined';
}
if ($niveau<5){
$structure['state'] = 'closed';
$structure['children'] = array();
}
$tabNaf[] = $structure;
}
echo 'cool';exit;
return (json_encode($tabNaf));
}
}

View File

@ -0,0 +1,5 @@
<?php
class Object_Prefs extends Libs_Row
{
}

View File

@ -0,0 +1,5 @@
<?php
class Object_ProfilExtraction extends Libs_Row
{
}

View File

@ -0,0 +1,5 @@
<?php
class Object_RefExport extends Libs_Row
{
}

View File

@ -0,0 +1,6 @@
<?php
class Object_Region extends Libs_Row
{
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,202 @@
<?php
Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
{
public function Field($name, $field)
{
$html = '';
if($field != null) {
$html.= '<div class="fieldgrp">';
$type = $field['type'];
switch($type)
{
case 'select':
$html.= $this->structureHTML(
$field['label'],
$this->selectHTML($name, $field));
break;
case 'selectMultiple':
$html.= $this->structureHTML(
$field['label'],
$this->selectMultipleHTML($name, $field));
break;
case 'intervalSelect':
$html.= $this->structureHTML(
$field['label'],
$this->intervalSelectHTML($name, $field));
break;
case 'interval':
$html.= $this->structureHTML(
$field['label'],
$this->intervalHTML($name, $field));
break;
case 'date':
$html.= $this->structureHTML(
$field['label'],
$this->dateHTML($name, $field));
break;
case 'text':
$html.= $this->structureHTML(
$field['label'],
$this->textHTML($name, $field));
break;
case 'textarea':
$html.= $this->structureHTML(
$field['label'],
$this->textareaHTML($name, $field));
break;
case 'radio':
$html.= $this->structureHTML(
$field['label'],
$this->radioHTML($name, $field));
break;
}
$html.= '</div>';
}
return $html;
}
private function structureHTML($label, $html, $liens = array())
{
$out = '';
$out.= $this->structureLabel($label);
$out.= '<div class="field">'.$html.$this->structureLink($liens).'</div>';
return $out;
}
/**
* Définition du label
* @param unknown_type $label
*/
private function structureLabel($label)
{
return '<label>'.$label.'</label>';
}
/**
* Définition des liens
*/
private function structureLink($liens = array())
{
$html = '';
if (count($liens)>0) {
foreach($liens as $lien){
$html.= '<a href="'.$lien['url'].'">'.$lien['lib'].'</a>';
}
}
if (!empty($html)) {
return '<span>'.$html.'</span>';
}
return '';
}
private function intervalSelectHTML($name, $field)
{
$session = new SessionCiblage();
$return = '<select class="intervalSelect" name="'.$name.'1" id="'.$name.'" number="1">';
foreach($field['fields'][$field['type']]['value'] as $elements) {
$return .= '<option value="'. $elements[0].'">'.number_format($elements[0], 0,'', ' ').'</option>';
}
$return .= '</select> à ';
$return .= '<select class="intervalSelect" name="'.$name.'2" id="'.$name.'" number="2">';
foreach($field['fields'][$field['type']]['value'] as $elements) {
$return .= '<option value="'. $elements[1].'">'.number_format($elements[1], 0,'', ' ').'</option>';
}
$return .= '</select>';
$return .= ' <span id="'.$name.'"><a href="" class="intervalSelect" id="'.$name.'">Valider</a></span>';
return ($return);
}
/* Select */
private function selectMultipleHTML($name, $field)
{
$session = new SessionCiblage();
$return = '<select class="criteres" name="'.$name.'">';
$return .= '<option value="tous">Tous</option>';
foreach($field['fields'][$field['type']]['value'] as $value => $label) {
$selected = "";
if(($session->getCritere($name) != null) and $session->getCritere($name) == $value)
$selected = " selected";
$return .= '<option'.((!empty($selected))?$selected:null).' value="'.$value.'">'.$label.'</option>';
}
$return .= '</select>';
return ($return);
}
/* Select Multiple */
private function selectHTML($name, $field)
{
$session = new SessionCiblage();
$sessionValeur = $session->getCritere($name);
if(is_array($sessionValeur))
$sessionValeur = implode(',', $sessionValeur);
$return = '<select class="criteres '.$field['type']['class'].'" name="'.$name.'">';
$return .= '<option value="tous">Tous</option>';
foreach($field['fields'][$field['type']]['value'] as $value => $label) {
$selected = "";
if(($sessionValeur != null) and $sessionValeur == $value)
$selected = " selected";
$return .= '<option'.((!empty($selected))?$selected:null).' value="'.$value.'">'.$label.'</option>';
}
$return .= '</select>';
return ($return);
}
/* Interval */
private function intervalHTML($name, $field)
{
$session = new SessionCiblage();
$valeur = $session->getCritere($name);
$return = '<div class="interval" >';
$return .= '<input class="'.$field['class'].'" type="text" name="'.$name.'1" value="'.$valeur[0].'" /> à ';
$return .= '<input class="'.$field['class'].'" type="text" name="'.$name.'2" value="'.$valeur[1].'" />';
$return .= ' <a href="" class="interval" id="'.$name.'">Valider</a>';
$return .= '</div>';
return ($return);
}
/* Dates */
private function dateHTML($name, $field)
{
$session = new SessionCiblage();
$return = '<div class="date" >';
$return .= '<input value="'.$session->getCritere($name).'" type="text" class="datepicker" name="'.$name.'1" /> a ';
$return .= '<input type="text" class="datepicker" name="'.$name.'2" />';
$return .= '</div>';
return ($return);
}
/* Textes */
private function textHTML($name, $field)
{
$session = new SessionCiblage();
$return = '<input style="border:1px inset silver;width:60%" class="criteres" type="text" name="'.$name.'" value="'.$session->getCritere($name).'" />';
return ($return);
}
/* Textarea */
private function textareaHTML($name, $field)
{
$return = '<a class="arborescence" title="'.$field['title'].'" href="'.$this->view->url(array('controller' => 'arborescence', 'action' => $field['action'], 'key' => $name)).'">
Selection dans une arborescence
</a>';
return ($return);
}
/* Radios */
private function radioHTML($name, $field, $item)
{
$return = '<input type="radio" name="'.$name.'" />';
return ($return);
}
}

View File

@ -0,0 +1,20 @@
<div id="<?=$this->key?>" class="jstree jstree-default" style="overflow:auto;"></div>
<script>
$("#<?=$this->key?>").jstree({
"themes" : {
"theme" : "default",
"url" : "/style.css",
"dots" : true,
"icons" : false,
},
"plugins" : ["themes", "json_data", "checkbox"],
"json_data" : {
"data" : <?=$this->regions?>,
"ajax" : {
"url" : '<?=$this->url(array('controller'=>'arborescence', 'action'=>'geographiqueajax', 'key'=> $this->key))?>',
"data" : function(n) { return { id: n.attr ? n.attr("id") : '' , niveau : n.attr ? n.attr("niveau") : 1 }; },
"cache" : true,
}
}
});
</script>

View File

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

View File

@ -0,0 +1,20 @@
<div id="<?=$this->key?>" class="jstree jstree-default" style="overflow:auto;"></div>
<script>
$("#<?=$this->key?>").jstree({
"themes" : {
"theme" : "default",
"url" : "/style.css",
"dots" : true,
"icons" : false,
},
"plugins" : ["themes", "json_data", "checkbox"],
"json_data" : {
"data" : <?=$this->naf?>,
"ajax" : {
"url" : '<?=$this->url(array('controller'=>'arborescence', 'action'=>'nafajax', 'key'=> $this->key))?>',
"data" : function(n) { return { parent: n.attr ? n.attr("id") : '' , niveau : n.attr ? n.attr("niveau") : 1 }; },
"cache" : true,
}
}
});
</script>

View File

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

View File

@ -0,0 +1,37 @@
<?php if ($this->noSelection): ?>
Vous n'avez pas sélectionné de critères !
<?php else:?>
<div id="result">
<form method="post" id="save" name="save" action="<?=$this->url(array('controller'=>'comptage', 'action'=>'save'))?>">
<label>Votre référence</label>
<input type="text" name="ref" value="" />
<input type="submit" name="submit" value="Enregistrer">
</form>
<span class="message" style="color:#ff0000;"></span>
</div>
<script type="text/javascript" src="/scripts/jquery.form.js"></script>
<script>
$('form#save').bind('submit', function(){
var options = {
target: '#result',
dataType: 'json',
beforeSubmit: function(){},
success: function(data){
if (data.error == 0){
$('#result').html(data.msg);
} else {
$('#result span.message').html(data.msg);
}
}
};
$(this).ajaxSubmit(options);
return false;
});
</script>
<?php endif;?>
<pre>
<?php print_r($this->criteres)?>
</pre>

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

@ -0,0 +1,47 @@
<div id="dashboard">
<div class="chemin">
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>''))?>">Tableau de bord</a> >
Liste de vos ciblages
</div>
<div style="margin:5px 0;">
<h2>Liste de vos ciblages</h2>
<?php if(count($this->ciblages)>0):?>
<table class="ciblage">
<thead>
<tr>
<th>Référence</th>
<th>Nombre d'entité</th>
<th>Unité Insee</th>
<th>Date</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php foreach($this->ciblages as $item):?>
<tr>
<td><?=$item['reference']?></td>
<td><?=number_format($item['resultat'], 0, ',', ' ')?></td>
<td><?=number_format($item['uniteInsee'], 0, ',', ' ')?></td>
<td><?=$item['dateComptage']?></td>
<td>
[<a href="<?=$this->url(array('controller'=> 'dashboard','action'=>'ciblagedetail', 'id'=>$item['id']))?>">Détails</a>] -
[<a href="<?=$this->url(array('controller'=> 'index','action'=>'index', 'id'=>$item['id']))?>">Recharger les critères de ciblage</a>] -
[<a href="<?=$this->url(array('controller'=> 'comptage','action'=>'update', 'id'=>$item['id']))?>">Actualiser le comptage</a>] -
[<a href="<?=$this->url(array('controller'=> 'comptage','action'=>'update', 'id'=>$item['id']))?>">Enrichissement</a>]
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<?php else:?>
<p>Aucun ciblage.<p>
<?php endif;?>
</div>
</div>

View File

@ -0,0 +1,47 @@
<div id="dashboard">
<div class="chemin">
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>''))?>">Tableau de bord</a> >
Préférences
</div>
<h2>Gestion des profils d'enrichissement</h2>
<p>
Afin de vous permettre un enrichissement de données à partir d'une liste de SIREN/SIRET,
Suivant la configuration de votre compte, vous avez la possibilité de sélectionner les données
disponible.
</p>
<br/>
<p>Cas profil défini pas S&D</p>
<p>- Aucun profil d'enrichissement (Contacter le support)</p>
<p>- Liste des profils avec référence, tarifs à la ligne</p>
<p>Si droits création profil d'enrichissement</p>
<p>- Aucun profil d'enrichissement (Sans profil d'enrichissement, vous ne pourrez pas extraire de données)</p>
<p>- Liste des profils avec référence, tarifs à la ligne</p>
<p> - Créer un profil d'enrichissement (avoir donc un tarifs à la colonne, pour créer le tarif à la ligne)</p>
<p>Lister les colonnes disponibles (Association SQL/Libellé) pour la configuration<p>
<h2>Gestion des préférences d'affichage</h2>
<p>
L'application permet la modification de l'affichage des critères de ciblage afin de permettre une
utilisation correspondant à vos besoins.
</p>
<br/>
<p>Vous n'avez pas les droits nécessaires pour créer/modifier les préférences d'affichage.</p>
<p>Des préférences d'affichage ont été définies pour votre profil client.</p>
<br/>
<p>Aucune préférences d'affichage définies pour votre profil utilisateur.</p>
<p>Des préférences d'affichage ont été définies pour votre profil utilisateur.</p>
<br/>
<p>
<a href="<?=$this->url(array('controller'=>'preferences', 'action'=>'active'))?>"
title="Activer le mode personnalisation afin de créer/modifier les préférences d'affichage">
Activer le mode personnalisation
</a>
</p>
</div>

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

@ -0,0 +1,56 @@
<div id="dashboard">
<div class="chemin">
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>''))?>">Tableau de bord</a>
</div>
<div>
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'ciblages'))?>">Historique de vos ciblages</a> -
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'configuration'))?>">Préférences de l'application</a> -
<a href="<?=$this->url(array('controller'=>'dashboard', 'action'=>'exports'))?>">Enrichissement fichier</a>
</div>
<div id="rechercheCiblage">
<h2>Rechercher dans vos ciblages</h2>
<input type="text" name="searchCiblage" class="searchCiblage" />
<input type="submit" value="Rechercher" class="submit"/>
</div>
<div id="lastCiblage" style="">
<h2>Vos derniers ciblages</h2>
<?php if(count($this->comptages)>0):?>
<table class="ciblage">
<thead>
<tr>
<th>Référence</th>
<th>Nombre d'entité</th>
<th>Unité Insee</th>
<th>Date</th>
<th>&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>
</div>

View File

@ -0,0 +1 @@
<?php

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,28 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Zend Framework Default Application</title>
</head>
<body>
<h1>An error occurred</h1>
<h2><?php echo $this->message ?></h2>
<?php if (isset($this->exception)): ?>
<h3>Exception information:</h3>
<p>
<b>Message:</b> <?php echo $this->exception->getMessage() ?>
</p>
<h3>Stack trace:</h3>
<pre><?php echo $this->exception->getTraceAsString() ?>
</pre>
<h3>Request Parameters:</h3>
<pre><?php echo var_export($this->request->getParams(), true) ?>
</pre>
<?php endif ?>
</body>
</html>

View File

@ -0,0 +1,23 @@
<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,27 @@
<div id="panel">
<?php //echo $this->action('index', 'comptage', 'frontend');?>
</div>
<div id="tabs">
<ul>
<li><a href="#tabs-1">Critères Entreprise</a></li>
<li><a href="#tabs-2">Situation économique</a></li>
<li><a href="#tabs-3">Secteur géographique</a></li>
<li><a href="#tabs-4">Situation juridique</a></li>
<li><a href="#tabs-5">Situation financière</a></li>
</ul>
<div id="tabs-1">
<?php echo $this->action('index', 'entreprise')?>
</div>
<div id="tabs-2">
<?php echo $this->action('index', 'economique')?>
</div>
<div id="tabs-3">
<?php echo $this->action('index', 'geographique')?>
</div>
<div id="tabs-4">
<?php echo $this->action('index', 'juridique')?>
</div>
<div id="tabs-5">
<?php echo $this->action('index', 'financier')?>
</div>
</div>

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

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

View File

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

View File

@ -0,0 +1,3 @@
<?php
echo $this->form;
?>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

30
docs/README.txt Normal file
View File

@ -0,0 +1,30 @@
README
======
This directory should be used to place project specfic documentation including
but not limited to project notes, generated API/phpdoc documentation, or
manual files generated or hand written. Ideally, this directory would remain
in your development environment only and should not be deployed with your
application to it's final production location.
Setting Up Your VHOST
=====================
The following is a sample VHOST you might want to consider for your project.
<VirtualHost *:80>
DocumentRoot "C:/workspace/sdciblage2/public"
ServerName .local
# This should be omitted in the production environment
SetEnv APPLICATION_ENV development
<Directory "C:/workspace/sdciblage2/public">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

View File

@ -0,0 +1,84 @@
<?php
class Application_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
{
/**
* Vérifie les autorisations
* Utilise _request et _response hérités et injectés par le FC
*
* @param Zend_Controller_Request_Abstract $request : non utilisé, mais demandé par l'héritage
*/
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$checkAuth = true;
if ($request->getControllerName()=='user' && $request->getActionName()=='login'){
$checkAuth = false;
}
if ($checkAuth)
{
$login = $request->getParam('login');
$pass = $request->getParam('pass', '');
$hach = $request->getParam('hach');
$checkIp = $request->getParam('checkIp');
$auth = Zend_Auth::getInstance();
//Est ce que l'on a checkIp=only lors de la requête
$iponly = false;
if ($checkIp=='only') {
$hach = 'iponly:'.$_SERVER['REMOTE_ADDR'];
$iponly = true;
}
//On vérifie le tout lors d'une connexion par url
if ( !empty($login) && !empty($hach) ) {
require_once 'Scores/WebAuthAdapter.php';
$authAdapter = new WebAuthAdapter($login, $hach, $iponly);
$result = $auth->authenticate($authAdapter);
if (!$result->isValid()) {
$request->setModuleName('default')
->setControllerName('user')
->setActionName('logout');
} else {
$timeout = $auth->getIdentity()->timeout;
Zend_Session::rememberMe($timeout);
$storage = new Zend_Auth_Storage_Session();
$sessionNamespace = new Zend_Session_Namespace($storage->getNamespace());
$sessionNamespace->setExpirationSeconds($timeout);
$auth->setStorage($storage);
}
//Sinon on reste sur le standard
} else {
//Pas authentifié
if (!$auth->hasIdentity()) {
$auth->clearIdentity();
$session = new Zend_Session_Namespace('login');
$session->url = $_SERVER['REQUEST_URI'];
$layout = Zend_Layout::getMVCInstance();
if (!$layout->isEnabled()){
$this->_response->setRedirect('/user/logout')->sendResponse();
}
$this->_response->setRedirect('/user/login')->sendResponse();
//Authentifié => on met à jour la session
} else {
$timeout = $auth->getIdentity()->timeout;
$storage = new Zend_Auth_Storage_Session();
$sessionNamespace = new Zend_Session_Namespace($storage->getNamespace());
$sessionNamespace->setExpirationSeconds($timeout);
$auth->setStorage($storage);
if (Zend_Session::namespaceIsset('login')){
Zend_Session::namespaceUnset('login');
}
}
}
}
}
}

View File

@ -0,0 +1,47 @@
<?php
class Application_Controller_Plugin_Comptage extends Zend_Controller_Plugin_Abstract
{
public function preDispatch($request)
{
$layout = Zend_Layout::getMVCInstance();
if ($layout->isEnabled()) {
$controller = $request->getControllerName();
$action = $request->getActionName();
if ($controller == 'index' && $action == 'index') {
require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage();
$view = $layout->getView();
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
// Chargement des critères de ciblage à partir de l'enregistrement en bdd
$id = $request->getParam('id', 0);
if (!empty($id)) {
$db = Zend_Registry::get('db');
$criteresM = new Table_Criteres();
$sql = $criteresM->select()
->from($criteresM, array('criteres'))
->where('login = ?', $user->username)
->where('id = ?', $id);
$row = $criteresM->fetchRow($sql);
if ($row != null) {
//On charge les critères
$session->setCriteres(json_decode($row->criteres, 'true'));
//Réalise le comptage
require_once 'Scores/Ciblage.php';
$ciblage = new Ciblage($session->getCriteres());
$total = $ciblage->execute();
$insee = $ciblage->calculRedevanceInsee();
$session->setNb('total', $total);
$session->setNb('insee', $insee);
}
}
$view->total = number_format($session->getNb('total'), 0, '', ' ');
$view->insee = number_format($session->getNb('insee'), 0, '', ' ');
$view->msgComptage = true;
}
}
}
}

View File

@ -0,0 +1,33 @@
<?php
abstract class Libs_Controller extends Zend_Controller_Action
{
protected static $_loadedTables = array();
public function __get($prop)
{
$class = false;
if (substr($prop, 0, 5) == 'table') {
$class = 'Table_' . substr($prop, 5);
}else if (substr($prop, 0, 6) == 'object') {
$class = 'Object_' . substr($prop, 6);
}
if (!$class) {
trigger_error("Access to undefined property $prop", E_USER_WARNING);
return;
}
return self::loadTable($class);
}
public static function loadTable($class)
{
if (array_key_exists($class, self::$_loadedTables)) {
return self::$_loadedTables[$class];
}
if (!class_exists($class)) {
throw new Libs_Exception("Class $class not found");
}
self::$_loadedTables[$class] = new $class;
return self::$_loadedTables[$class];
}
}

View File

@ -0,0 +1,5 @@
<?php
Class Libs_Exception extends Zend_Exception
{
}

33
library/Libs/Row.php Normal file
View File

@ -0,0 +1,33 @@
<?php
abstract class Libs_Row extends Zend_Db_Table_Row_Abstract
{
public function __construct(array $input = array())
{
$class = explode('_', get_class($this));
$this->_tableClass = 'Table_' . array_pop($class) . 's'; // le 's' final
parent::__construct($input);
$cols = $this->_table->info(Zend_Db_Table_Abstract::COLS);
if (!isset($input['data'])) {
$input['data'] = array_combine($cols, array_pad(array(),count($cols),null));
}
$this->_data = $input['data'];
}
public function getForm($form = null)
{
$formObject = $this->getTable()->getForm($form);
if ($this->_data[$this->_primary[1]] != null && $form == null) {
$formObject->populate($this->_data);
}
return $formObject;
}
public function save()
{
$form = $this->getForm();
if (!$form->isValid($this->_data)) {
return false;
}
return parent::save();
}
}

48
library/Libs/Table.php Normal file
View File

@ -0,0 +1,48 @@
<?php
abstract class Libs_Table extends Zend_Db_Table_Abstract
{
protected static $_loadedForms = array();
const DEFAULT_FORM = 'Default';
public function __construct($config = array())
{
$class = explode('_', get_class($this));
$rowClass = 'Object_' . substr(array_pop($class), 0, -1);
if (!class_exists($rowClass)) {
throw new Libs_Exception("Class $rowClass not found");
}
$config = array_merge($config, array(self::ROW_CLASS => $rowClass));
parent::__construct($config);
}
public function getForm($form = null)
{
$form = ucfirst(strtolower($form));
if ($form == null) {
$form = self::DEFAULT_FORM;
}
$className = "Form_" . ucfirst($this->_name) . '_' . $form;
if (array_key_exists($className, self::$_loadedForms)) {
return self::$_loadedForms[$className];
}
if (class_exists($className, true)) {
self::$_loadedForms[$className] = new $className;
return self::$_loadedForms[$className];
} else {
throw new Libs_Exception("Class $className not found");
}
}
public function __call($meth, $args)
{
if (preg_match('|get(\w+)Form|', $meth, $matches)) {
return $this->getForm($matches[1]);
}
}
}
?>

414
library/Scores/Ciblage.php Normal file
View File

@ -0,0 +1,414 @@
<?php
require_once 'sphinxapi/sphinxapi-2.0.2.php';
Class Ciblage
{
private $sphinx;
private $alpha = '';
private $presentRcs = 0;
public $index = 'ciblage';
public $nb_results = 5000;
public $max_results = 500000;
public $mysql_host = '192.168.78.230';
public $mysql_user = 'sphinx';
public $mysql_password = 'indexer';
public $mysql_database = 'jo';
public $sphinx_host = '192.168.78.252';
public $sphinx_port = 3312;
public $sphinx_match = SPH_MATCH_EXTENDED2;
public $sphinx_sort = SPH_SORT_EXTENDED;
public function __construct($structure, $need = false)
{
$this->sphinx = new SphinxClient();
$this->sphinx->SetServer($this->sphinx_host, $this->sphinx_port);
$this->sphinx->SetMatchMode(SPH_MATCH_EXTENDED2);
$this->sphinx->ResetFilters();
foreach($structure as $key => $valeur)
{
if (method_exists($this, $key)) {
if(is_array($valeur)) {
if($valeur[0] != "" and $valeur[0] != 'tous'){
$this->$key($valeur);
}
} else {
if($valeur != 'tous' and $valeur != "")
$this->$key($valeur);
}
}
}
}
public function calculRedevanceInsee()
{
$this->sphinx->SetFilter('presentrcs', array(0));
$resSphinx = $this->sphinx->Query($this->alpha, $this->index);
return ($resSphinx['total_found']);
}
public function execute($need = false)
{
if($need) {
$i = 0;
$siret = array();
do {
$this->sphinx->SetLimits($i, $this->nb_results, $this->max_results);
$resSphinx = $this->sphinx->Query($this->alpha, $this->index);
if($resSphinx['total'] > 0) {
foreach($resSphinx['matches'] as $matches) {
if($matches['attrs']['presentrcs'] == 0)
$siret[] = $matches['attrs']['siren'];
}
$i += $this->nb_results;
}else
break;
} while($i < $resSphinx['total_found']);
return ($resSphinx['total_found']);
} else {
$resSphinx = $this->sphinx->Query($this->alpha, $this->index);
}
return ($resSphinx['total_found']);
}
protected function setFilter($name, $valeur) {
if(!is_array($valeur)) {
$this->sphinx->SetFilter($name, array(intval($valeur)));
}else {
$this->sphinx->SetFilter($name, $this->transformIntval($valeur));
}
}
protected function setFilterRange($name, $valeur) {
$this->sphinx->SetFilterRange($name, intval($valeur[0]), intval($valeur[1]));
}
protected function writeRequest($name, $valeur, $or = false) {
if(!is_array($valeur)) {
if($or and !empty($this->alpha))
$this->alpha .= ' | ';
$this->alpha .= '@'.$name.' '.$valeur.' ';
} else {
$i = 0;
if($or and !empty($this->alpha))
$this->alpha .= ' | ';
foreach($valeur as $item) {
if($i != 0)
$this->alpha .= ' | ';
$this->alpha .= '@'.$name.' '.$item.' ';
$i++;
}
}
}
protected function setAlpha($name, $valeur)
{
$or = array('bilType');
$and = array('ape_entrep', 'ape_etab', 'age_entrep', 'age_etab', 'NaceEntrep', 'NaceEtab');
if(in_array($name, $or)) {
if(!empty($valeur))
$this->writeRequest($name, $valeur, true);
} else if (in_array($name, $and)) {
if(!empty($valeur))
$this->writeRequest($name, $valeur);
}
}
protected function transformIntval($array) {
$copy = array();
foreach($array as $item => $valeur) {
$copy[$item] = intval($valeur);
}
return ($copy);
}
protected function dirNom($valeur) {
$this->setFilter('dirNom', $valeur);
}
protected function siege($valeur) {
$this->setFilter('siege', $valeur);
}
protected function adr_cp($valeur) {
$this->setFilter('adr_cp', $valeur);
}
protected function adr_dep($valeur) {
$this->setAlpha('adr_dep', $valeur);
}
protected function adr_com($valeur) {
$this->setFilter('adr_com', $valeur);
}
protected function tel($valeur) {
$this->setFilter('tel', $valeur);
}
protected function fax($valeur) {
$this->setFilter('fax', $valeur);
}
protected function cj($valeur) {
$this->setFilter('cj', $valeur);
}
protected function capital($valeur) {
if($valeur[0] != 0 or $valeur[1] != 0)
$this->setFilterRange('capital', $valeur);
}
protected function ape_etab($valeur) {
$this->setAlpha('ape_etab', $valeur);
}
protected function ape_entrep($valeur) {
$this->setAlpha('ape_entrep', $valeur);
}
protected function age_entrep($valeur) {
$this->setAlpha('age_entrep', $valeur);
}
protected function age_etab($valeur) {
$this->setAlpha('age_etab', $valeur);
}
protected function tcaexp($valeur) {
$this->setFilterRange('tcaexp', $valeur);
}
protected function teff_entrep($valeur) {
if($valeur[0] != 0 or $valeur[1] != 0)
$this->setFilterRange('teff_entrep', $valeur);
}
protected function teff_etab($valeur) {
if($valeur[0] != 0 or $valeur[1] != 0)
$this->setFilterRange('teff_etab', $valeur);
}
protected function rang($valeur) {
$this->setFilterRange('rang', $valeur);
}
protected function actifEco($valeur) {
$this->setFilter('actifEco', $valeur);
}
protected function presentRcs($valeur) {
$this->setFilter('presentRcs', $valeur);
}
protected function procolHisto($valeur) {
$this->setFilter('procolHisto', $valeur);
}
protected function tvaIntraValide($valeur) {
$this->setFilter('tvaIntraValide', $valeur);
}
protected function NaceEtab($valeur) {
$this->setAlpha('NaceEtab', $valeur);
}
protected function NaceEntrep($valeur) {
$this->setAlpha('NaceEntrep', $valeur);
}
protected function dateCrea_etab($valeur) {
if(!is_array($valeur)) {
$format = explode('/', $valeur);
$valeur = $format[2].$format[1].$format[0];
} else {
$format1 = explode('/', $valeur[0]);
$format2 = explode('/', $valeur[0]);
$valeur[0] = $format1[2].$format1[1].$format1[0];
$valeur[1] = $format2[2].$format2[1].$format2[0];
}
$this->setFilterRange('dateCrea_etab', $valeur);
}
protected function dateCrea_ent($valeur) {
if(!is_array($valeur)) {
$format = explode('/', $valeur);
$valeur = $format[2].$format[1].$format[0];
} else {
$format1 = explode('/', $valeur[0]);
$format2 = explode('/', $valeur[0]);
$valeur[0] = $format1[2].$format1[1].$format1[0];
$valeur[1] = $format2[2].$format2[1].$format2[0];
}
$this->setFilterRange('dateCrea_etab', $valeur);
}
protected function dateImmat($valeur) {
if(!is_array($valeur)) {
$format = explode('/', $valeur);
$valeur = $format[2].$format[1].$format[0];
} else {
$format1 = explode('/', $valeur[0]);
$format2 = explode('/', $valeur[0]);
$valeur[0] = $format1[2].$format1[1].$format1[0];
$valeur[1] = $format2[2].$format2[1].$format2[0];
}
$this->setFilterRange('dateImmat', $valeur);
}
protected function eff_entrep($valeur) {
$this->setFilter('eff_entrep', $valeur);
}
protected function eff_etab($valeur) {
$this->setFilter('eff_etab', $valeur);
}
protected function rivoli($valeur) {
$this->setFilter('rivoli', $valeur);
}
protected function nbEtab($valeur) {
$this->setFilterRange('nbEtab', $valeur);
}
protected function sirenGrp($valeur) {
$this->setFilter('sirenGrp', $valeur);
}
protected function nbActio($valeur) {
$this->setFilterRange('nbActio', $valeur);
}
protected function nbMPubli($valeur) {
$this->setFilterRange('nbMPubli', $valeur);
}
protected function nbPart($valeur) {
$this->setFilterRange('nbPart', $valeur);
}
protected function bilType($valeur) {
$this->setAlpha('bilType', $valeur);
}
protected function bilAnnee($valeur) {
$this->setFilter('bilAnnee', $valeur);
}
protected function bilTca($valeur) {
$this->setFilterRange('bilTca', $valeur);
}
protected function bilEE($valeur) {
$this->setFilterRange('bilEE', $valeur);
}
protected function bilFL($valeur) {
$this->setFilterRange('bilFL', $valeur);
}
protected function bilFK($valeur) {
$this->setFilterRange('bilFK', $valeur);
}
protected function bilFR($valeur) {
$this->setFilterRange('bilFR', $valeur);
}
protected function bilGF($valeur) {
$this->setFilterRange('bilGF', $valeur);
}
protected function bilGP($valeur) {
$this->setFilterRange('bilGP', $valeur);
}
protected function bilGU($valeur) {
$this->setFilterRange('bilGU', $valeur);
}
protected function bilGW($valeur) {
$this->setFilterRange('bilGW', $valeur);
}
protected function bilHD($valeur) {
$this->setFilterRange('bilHD', $valeur);
}
protected function bilHL($valeur) {
$this->setFilterRange('bilHL', $valeur);
}
protected function bilHM($valeur) {
$this->setFilterRange('bilHM', $valeur);
}
protected function bilHN($valeur) {
$this->setFilterRange('bilHN', $valeur);
}
protected function bilYP($valeur) {
$this->setFilterRange('bilYP', $valeur);
}
protected function avisCs($valeur) {
$this->setFilte('avisCs', $valeur);
}
protected function bilFS($valeur) {
$this->setFilterRange('bilFS', $valeur);
}
protected function lieuAct($valeur) {
$this->setFilter('lieuAct', $valeur);
}
protected function bilGG($valeur) {
$this->setFilterRange('bilGG', $valeur);
}
protected function bilGV($valeur) {
$this->setFilterRange('bilGV', $valeur);
}
protected function bilHI($valeur) {
$this->setFilterRange('bilHI', $valeur);
}
protected function adrDom($valeur) {
$this->setFilter('adrDom', $valeur);
}
protected function web($valeur) {
$this->setFilter('web', $valeur);
}
protected function mail($valeur) {
$this->setFilter('mail', $valeur);
}
protected function bilCloture($valeur) {
if(!is_array($valeur)) {
$format = explode('/', $valeur);
$valeur = $format[2].$format[1].$format[0];
} else {
$format1 = explode('/', $valeur[0]);
$format2 = explode('/', $valeur[0]);
$valeur[0] = $format1[2].$format1[1].$format1[0];
$valeur[1] = $format2[2].$format2[1].$format2[0];
}
//print_r($valeur);
$this->setFilterRange('bilCloture', $valeur);
}
}

View File

@ -0,0 +1,7 @@
<?php
class Enrichissement
{
}

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

@ -0,0 +1,784 @@
<?php
Class Fields
{
protected $fields = array
(
'siege' => array(
'label' => 'Sociétés Sieges',
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
),
'famille' => 'entreprise',
'activated' => true,
'type' => 'select'
),
'sirenGrp' => array(
'label' => 'Société appartenant à un groupe',
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
),
'famille' => 'entreprise',
'activated' => true,
'type' => 'select'
),
'tel' => array(
'label' => 'Contenant un Telephone',
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
),
'famille' => 'entreprise',
'activated' => true,
'type' => 'select'
),
'fax' => array(
'label' => 'Contenant un Fax',
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
),
'famille' => 'entreprise',
'activated' => true,
'type' => 'select',
'class' => null
),
'web' => array(
'label' => 'Contenant un site internet',
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
),
'famille' => 'entreprise',
'activated' => true,
'type' => 'select',
'class' => null
),
'mail' => array(
'label' => 'Contenant une adresse email',
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
),
'famille' => 'entreprise',
'activated' => true,
'type' => 'select',
'class' => null
),
'presentRcs' => array(
'label' => 'Société présente au RNCS',
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
),
'famille' => 'entreprise',
'activated' => true,
'type' => 'select',
'class' => null
),
'adrDom' => array(
'label' => 'A une adresse de domiciliation',
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
),
'famille' => 'entreprise',
'activated' => true,
'type' => 'select',
'class' => null
),
'dirNom' => array(
'label' => 'Contenant le nom du principal dirigeant',
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non'))
),
'famille' => 'entreprise',
'activated' => true,
'type' => 'select',
'class' => null
),
'lieuAct' => array(
'label' => 'Lieu d\'activté',
'fields' => array(
'interval' => array('value' => array('0', '1000')),
'textarea' => array('value' => null)
),
'famille' => 'entreprise',
'activated' => true,
'type' => 'textarea',
'class' => null
),
'nbMPubli' => array(
'label' => 'Nombre de marches publiques remportes',
'fields' => array(
'interval' => array('value' => array('0', '1000'))
),
'famille' => 'entreprise',
'activated' => true,
'type' => 'interval',
'class' => null
),
'dateCrea_ent' => array(
'label' => 'Date de création de l\'entreprise',
'fields' => array(
'interval' => array('value' => array('0', '1000'))
),
'famille' => 'entreprise',
'activated' => true,
'type' => 'interval',
'class' => 'datepicker'
),
'dateCrea_etab' => array(
'label' => 'Date de création de l\'etablissement',
'fields' => array(
'interval' => array('value' => array('0', '1000'))
),
'famille' => 'entreprise',
'activated' => true,
'type' => 'interval',
'class' => 'datepicker'
),
'nbActio' => array(
'label' => 'Nombre d\'actionnaires connus',
'fields' => array(
'interval' => array('value' => array('0', '1000'))
),
'famille' => 'entreprise',
'activated' => true,
'type' => 'interval',
'class' => null
),
'nbPart' => array(
'label' => 'Nombre de participations connues',
'fields' => array(
'interval' => array('value' => array('0', '1000'))
),
'famille' => 'entreprise',
'activated' => true,
'type' => 'interval',
'class' => null
),
// economique
'ape_etab' => array(
'label' => 'Codes NAF Etablissement',
'fields' => array(
'text' => array('value' => null),
'textarea' => array('value' => null)
),
'famille' => 'economique',
'activated' => true,
'type' => 'textarea',
'class' => null,
'action' => 'naf',
'title' => 'Selection des codes NAF etablissement'
),
'ape_entrep' => array(
'label' => 'Codes NAF Entreprise',
'fields' => array(
'text' => array('value' => null),
'textarea' => array('value' => null)
),
'famille' => 'economique',
'activated' => true,
'type' => 'textarea',
'class' => null,
'action' => 'naf',
'title' => 'Selection des codes NAF entreprise'
),
'NaceEtab' => array(
'label' => 'Code NACE de l\'établissement',
'fields' => array(
'text' => array('value' => null),
'textarea' => array('value' => null)
),
'famille' => 'economique',
'activated' => true,
'type' => 'textarea',
'class' => null
),
'NaceEntrep' => array(
'label' => 'Code NACE de l\'entreprise',
'fields' => array(
'text' => array('value' => null),
'textarea' => array('value' => null)
),
'famille' => 'economique',
'activated' => true,
'type' => 'textarea',
'class' => null
),
'age_etab' => array(
'label' => 'L\'age de l\'etablissement',
'fields' => array(
'interval' => array('value' => null)
),
'famille' => 'economique',
'activated' => true,
'type' => 'interval',
'class' => null
),
'age_entrep' => array(
'label' => 'L\'age de l\'entreprise',
'fields' => array(
'interval' => array('value' => null)
),
'famille' => 'economique',
'activated' => true,
'type' => 'interval',
'class' => null
),
'teff_entrep' => array(
'label' => 'Tranche d\'effectif de l\'Entreprise',
'fields' => array(
'intervalSelect' => array('value' => array(
array('0', '0'),
array('0', '1'),
array('1', '2'),
array('2', '3'),
array('3', '11'),
array('11', '12'),
array('12', '21'),
array('21', '22'),
array('22', '31'),
array('31', '32'),
array('32', '41'),
array('41', '42'),
array('42', '51'),
array('51', '52'),
array('52', '53')
))
),
'famille' => 'economique',
'activated' => true,
'type' => 'intervalSelect',
'class' => null,
),
'teff_etab' => array(
'label' => 'Tranche d\'effectif de l\'etablissement',
'fields' => array(
'intervalSelect' => array(
'value' => array(
array('0', '0'),
array('0', '1'),
array('1', '2'),
array('2', '3'),
array('3', '11'),
array('11', '12'),
array('12', '21'),
array('21', '22'),
array('22', '31'),
array('31', '32'),
array('32', '41'),
array('41', '42'),
array('42', '51'),
array('51', '52'),
array('52', '53')
)
)
),
'famille' => 'economique',
'activated' => true,
'type' => 'intervalSelect',
'class' => null
),
'nbEtab' => array(
'label' => 'Nombre d\'établassiment',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'economique',
'activated' => true,
'type' => 'interval',
'class' => null
),
'eff_entrep' => array(
'label' => 'Effectif réel de l\'entreprise',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'economique',
'activated' => true,
'type' => 'interval',
'class' => null
),
'eff_etab' => array(
'label' => 'Effectif réel de l\'établissement',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'economique',
'activated' => true,
'type' => 'interval',
'class' => null
),
'capital' => array(
'label' => 'Capital de l\'entreprise',
'fields' => array(
'intervalSelect' => array(
'value' => array(
array(0, 15000),
array(15000, 30000),
array(30000, 75000),
array(75000, 150000),
array(150000, 750000),
array(750000, 0),
)
)
),
'famille' => 'economique',
'activated' => true,
'type' => 'intervalSelect',
'class' => null
),
//geographique
'adr_cp' => array(
'label' => 'Codes postaux',
'fields' => array(
'text' => array('value' => null),
'textarea' => array('value' => null)
),
'famille' => 'geographique',
'activated' => true,
'type' => 'textarea',
'class' => null,
'action' => 'geographique',
'title' => 'Localisation'
),
'adr_com' => array(
'label' => 'Code commune Insee',
'fields' => array(
'text' => array('value' => null),
'textarea' => array('value' => null)
),
'famille' => 'geographique',
'activated' => true,
'type' => 'textarea',
'class' => null
),
//juridique
'cj' => array(
'label' => 'Forme Juridique',
'fields' => array(
'select' => array('value' => array('1' => '1', '2' => '2', '3' => '3')),
),
'famille' => 'juridique',
'activated' => true,
'type' => 'select',
'class' => null
),
'actifEco' => array(
'label' => 'Établissement économiquement actif',
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
),
'famille' => 'juridique',
'activated' => true,
'type' => 'select',
'class' => null
),
'procolHisto' => array(
'label' => 'Procédure collective dans l\'historique.',
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
),
'famille' => 'juridique',
'activated' => true,
'type' => 'select',
'class' => null
),
'tvaIntraValide' => array(
'label' => 'Numéro de TVA Valide',
'fields' => array(
'select' => array('value' => array('1' => 'Oui', '0' => 'Non')),
),
'famille' => 'juridique',
'activated' => true,
'type' => 'select',
'class' => null
),
'dateImmat' => array(
'label' => 'Date d\'immatriculation',
'fields' => array(
'interval' => array('value' => array('0', '1000'))
),
'famille' => 'juridique',
'activated' => true,
'type' => 'interval',
'class' => 'datepicker'
),
//financier
'bilType' => array(
'label' => 'Type du dernier bilan',
'fields' => array(
'select' => array('value' => array('I' => 'Inconnue', 'E' => 'Estimé', 'R' => 'Réel')),
),
'famille' => 'financier',
'activated' => true,
'type' => 'select',
'class' => null
),
'avisCs' => array(
'label' => 'Informations de paiements',
'fields' => array(
'interval' => array('value' => null),
),
'famille' => 'financier',
'activated' => true,
'type' => 'interval',
'class' => null
),
'bilDuree' => array(
'label' => 'Durée du dernier bilan en mois',
'fields' => array(
'interval' => array('value'=> null),
),
'famille' => 'financier',
'activated' => true,
'type' => 'interval',
'class' => null
),
'bilTca' => array(
'label' => 'Tranche de CA issue du bilan',
'fields' => array(
'interval' => array('value' => null),
),
'famille' => 'financier',
'activated' => true,
'type' => 'interval',
'class' => null
),
'bilAnnee' => array(
'label' => 'Dernière année de bilan',
'fields' => array(
'interval' => array('value' => array('0', '1000'))
),
'famille' => 'financier',
'activated' => true,
'type' => 'interval',
'class' => null
),
'bilCloture' => array(
'label' => 'Dernière date de clôture du bilan',
'fields' => array(
'interval' => array('value' => array('0', '1000'))
),
'famille' => 'financier',
'activated' => true,
'type' => 'interval',
'class' => 'datepicker'
),
'bilEE' => array(
'label' => 'Total bilan',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'financier',
'activated' => true,
'type' => 'interval',
'class' => null
),
'bilFL' => array(
'label' => 'CA total',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'financier',
'activated' => true,
'type' => 'interval',
'class' => null
),
'bilFK' => array(
'label' => 'Chiffre d\'affaires Export',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'financier',
'activated' => true,
'type' => 'interval',
'class' => null
),
'bilFR' => array(
'label' => 'Produits d\'Exploitation',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'financier',
'activated' => true,
'type' => 'interval',
'class' => null
),
'bilGF' => array(
'label' => 'Charges d\'Exploitation',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'financier',
'activated' => true,
'type' => 'interval',
'class' => null
),
'bilGP' => array(
'label' => 'Produits Financiers',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'financier',
'activated' => true,
'type' => 'interval',
'class' => null
),
'bilGP' => array(
'label' => 'Charges Financières',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'financier',
'activated' => true,
'type' => 'interval',
'class' => null
),
'bilGW' => array(
'label' => 'RCAI (résultat courant avant impôt)',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'financier',
'activated' => true,
'type' => 'interval',
'class' => null
),
'bilHD' => array(
'label' => 'Produits Exceptionnels',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'financier',
'activated' => true,
'type' => 'interval',
'class' => null
),
'bilHH' => array(
'label' => 'Charges Exceptionnels',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'financier',
'activated' => true,
'type' => 'interval',
'class' => null
),
'bilHL' => array(
'label' => 'Total des Produits',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'financier',
'activated' => true,
'type' => 'interval',
'class' => null
),
'bilHM' => array(
'label' => 'Total des Charges',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'financier',
'activated' => true,
'type' => 'interval',
'class' => null
),
'bilHN' => array(
'label' => 'Résultat',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'financier',
'activated' => true,
'type' => 'interval',
'class' => null
),
'bilYP' => array(
'label' => 'Effectif de l\'entreprise au dernier bilan (poste YP)',
'fields' => array(
'interval' => array('value' => array('0', '10000000'))
),
'famille' => 'financier',
'activated' => true,
'type' => 'interval',
'class' => null
)
);
protected $requeteSql = array('cj');
public function getValues()
{
require_once 'Scores/SessionCiblage.php';
$session = new SessionCiblage();
$values = array();
foreach($session->getCriteres() as $key => $item)
{
if($this->fields[$key]['type'] == 'interval' or
$this->fields[$key]['type'] == 'intervalSelect' or
$this->fields[$key]['type'] == 'textarea' and
empty($this->fields[$key]['action']))
{
$values[$key] = explode(',', $item);
} else if (!empty($this->fields[$key]['action'])) {
$values[$key] = $this->selectArbo($key, $item);
} else {
$values[$key] = $item;
}
}
return ($values);
}
public function selectArbo($name, $valeur)
{
$values = array();
switch($name)
{
case 'ape_etab' :
case 'ape_entrep' :
$nafs = explode(',', $valeur);
foreach($nafs as $naf)
$values = array_merge($values, $this->nafArbo($name, $naf));
break;
case 'adr_cp':
$valeurs = explode(',', $valeur);
foreach($valeurs as $element) {
$array = $this->deptArbo($name, $element);
if(!empty($array))
$values = array_merge($values, $array);
}
break;
}
return ($values);
}
protected function deptArbo($name, $valeur)
{
if(strlen($valeur) < 5){
if($valeur[0] == 'D') {
$codepostaux = new Table_Codepostauxs();
$sql = $codepostaux->select()->where('Codepos LIKE "'.substr($valeur, 1).'%"');
$codes = $codepostaux->fetchAll($sql)->toArray();
foreach($codes as $code) {
$values[] = $code['Codepos'];
}
} else if($valeur[0] == 'R') {
$departements = new Table_Departements();
$codepostaux = new Table_Codepostauxs();
$sql = $departements->select()->from('departements', array('numdep'))->where('codeRegionInsee = ?', substr($valeur, 1));
$results = $departements->fetchAll($sql)->toArray();
foreach($results as $result) {
$sql = $codepostaux->select()->from('codepostaux', array('Codepos'))->where('Codepos LIKE "'.$result['numdep'].'%"');
$codes = $codepostaux->fetchAll($sql)->toArray();
foreach($codes as $code) {
$values[] = $code['Codepos'];
}
}
}
return ($values);
}
return (array($valeur));
}
protected function nafArbo($key, $valeur)
{
$value = array();
$table = new Table_Nafs();
if(strlen($valeur) == 1)
{
$sql = $table->select()->where('parent = ?', $valeur);
$result =$table->fetchAll($sql)->toArray();
foreach($result as $code) $where .= " code LIKE '".$code['code']."%' and niveau = 5 or ";
$where = substr($where, 0, (strlen($where)) - 3);
$sql = $table->select()->where($where);
$result = $table->fetchAll($sql)->toArray();
foreach($result as $code) $value[] = $code['code'];
} else if(strlen($valeur) < 5){
$sql = $table->select()->where("code LIKE '".$valeur."%' and niveau = 5");
$result = $table->fetchAll($sql)->toArray();
foreach($result as $code) $value[] = $code['code'];
} else if(strlen($valeur) == 5) {
$value[] = $valeur;
}
return ($value);
}
public function __construct($login)
{
require_once('Scores/SessionCiblage.php');
$session = new SessionCiblage();
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$db = Zend_Registry::get('db');
/*$prefsModel = new Application_Model_Prefs($db);
$prefs = $prefsModel->find($login);
$json = $prefs->json;*/
foreach($this->fields as $name => $valeur) {
/*if(!empty($json))
{
$prefs = json_decode($json);
if(!empty($prefs)) {
if(array_key_exists($name, $prefs)) {
$this->fields[$name]['activated'] = false;
if(is_array($this->fields[$name]['type'])) {
$this->fields[$name]['type'] = $prefs[$name];
}
}
}
}*/
/*if(in_array($name, $this->requeteSql)) {
$formeJuridiques = new Application_Model_Formejuridique();
$sql = $formeJuridiques->select()->where('fjCode > 1000');
$formeJuridiques = $formeJuridiques->fetchAll($sql)->toArray();
$value = array();
foreach($formeJuridiques as $form) {
$value[$form['fjCode']] = $form['fjLibelle'].' ['.$form['fjCode'].']';
}
asort($value);
$this->fields[$name]['fields']['select']['value'] = $value;
}*/
}
}
public function getFields() {
return ($this->fields);
}
public function get($name) {
if($this->fields[$name]['activated'] == true)
return ($this->fields[$name]);
return (null);
}
public function getByFamille($famille)
{
$section = array();
foreach($this->fields as $name => $item) {
if($item['famille'] == $famille) {
$section[$name] = $item;
}
}
return ($section);
}
public function getNotActivated($fields)
{
foreach($fields as $name => $field)
{
if(!$field['activated']) {
$desactivated[$name] = "";
} else if ($field['activated']){
}
}
return (json_encode($desactivated));
}
public function getLibelle($name)
{
return ($this->fields[$name]['label']);
}
}

View File

@ -0,0 +1,107 @@
<?php
class SessionCiblage
{
protected $valeur;
protected $total = null;
protected $insee = null;
public function __construct()
{
$session = new Zend_Session_Namespace('ciblage');
$this->valeur = empty($session->ciblage) ? array() : $session->ciblage;
if (isset($this->valeur['NB']['total'])){ $this->total = $this->valeur['NB']['total']; }
if (isset($this->valeur['NB']['insee'])){ $this->insee = $this->valeur['NB']['insee']; }
if (isset($this->valeur['NB'])){ unset($this->valeur['NB']); }
}
/**
* Enregistre les informations dans la session
*/
protected function setSession()
{
$session = new Zend_Session_Namespace('ciblage');
$this->valeur['NB']['total'] = $this->total;
$this->valeur['NB']['insee'] = $this->insee;
$session->ciblage = $this->valeur;
}
/**
* Enregistre un critère et sa valeur
* @param unknown_type $key
* @param unknown_type $value
*/
public function setCritere($key, $value)
{
$this->valeur[$key] = $value;
$this->setSession();
}
/**
* Définir les critères en une fois
* @param array $criteres
*/
public function setCriteres($criteres)
{
$this->valeur = $criteres;
$this->setSession();
}
/**
* Désactivation d'un critère
* @param unknown_type $key
*/
public function unsetCritere($key)
{
if(key_exists($key, $this->valeur)) {
unset($this->valeur[$key]);
$this->setSession();
}
}
/**
* Récupération de la valeur d'un critère
* @param unknown_type $key
*/
public function getCritere($key)
{
if(array_key_exists($key, $this->valeur)) {
return $this->valeur[$key];
}
return null;
}
/**
* Récupération des critères et de leurs valeurs
*/
public function getCriteres()
{
return $this->valeur;
}
/**
* Définit un élément de comptage
* @param unknown_type $element
* @param unknown_type $nb
*/
public function setNb($element, $nb)
{
$this->{$element} = $nb;
$this->setSession();
}
/**
* Récupére la valeur d'un élément de comptage
* @param unknown_type $element
*/
public function getNb($element)
{
return $this->{$element};
}
public function clearCiblage()
{
Zend_Session::namespaceUnset('ciblage');
}
}

View File

@ -0,0 +1,62 @@
<?php
class WebAuthAdapter implements Zend_Auth_Adapter_Interface
{
protected $_username;
protected $_password;
protected $_timeout = 1800;
protected $_checkIp = false;
public function __construct($username, $password, $iponly = false)
{
$this->_username = $username;
$this->_password = $password;
if ($iponly){
$this->_password = 'iponly:'.$_SERVER['REMOTE_ADDR'];
}
$this->_checkIp = $iponly;
}
public function authenticate()
{
$adressIp = $_SERVER['REMOTE_ADDR'];
require_once 'Scores/WsScores.php';
$ws = new WsScores($this->_username, $this->_password);
$InfosLogin = $ws->getInfosLogin($this->_username, $adressIp);
$identity = new stdClass();
$identity->username = $this->_username;
$identity->password = $this->_password;
$identity->email = $InfosLogin->result->email;
$identity->profil = $InfosLogin->result->profil;
$identity->pref = $InfosLogin->result->pref;
$identity->droits = $InfosLogin->result->droits;
$identity->droitsClients = $InfosLogin->result->droitsClients;
$identity->nom = $InfosLogin->result->nom;
$identity->prenom = $InfosLogin->result->prenom;
$identity->tel = $InfosLogin->result->tel;
$identity->fax = $InfosLogin->result->fax;
$identity->mobile = $InfosLogin->result->mobile;
$identity->id = $InfosLogin->result->id;
$identity->idClient = $InfosLogin->result->idClient;
$identity->reference = $InfosLogin->result->reference;
$identity->nbReponses = $InfosLogin->result->nbReponses;
$identity->typeScore = $InfosLogin->result->typeScore;
$identity->timeout = (!empty($InfosLogin->result->timeout)) ?
$InfosLogin->result->timeout : $this->_timeout;
$identity->ip = $adressIp;
$identity->modeEdition = false;
if ( (is_string($InfosLogin) && !empty($InfosLogin)) || $InfosLogin->error->errnum!=0){
if (is_string($InfosLogin)){
$message = $InfosLogin;
} else {
$message = 'Erreur lors de la connexion';
}
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $identity, array($message));
} elseif ($this->_username == $InfosLogin->result->login) {
return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $identity);
} else {
return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_UNCATEGORIZED, $identity);
}
}
}

146
library/Scores/WsScores.php Normal file
View File

@ -0,0 +1,146 @@
<?php
class WsScores
{
protected $webservices = array();
protected $login = '';
protected $password = '';
protected $nbReponses = 20;
protected $toNotCache = false;
public function __construct($login = '', $password = '')
{
$configuration = Zend_Registry::get('configuration');
$config = new Zend_Config_Ini(realpath(dirname(__FILE__)) . '/webservices.ini', $configuration->webservice->location);
$this->webservices = $config->webservices->toArray();
if ( !empty($login) && !empty($password) ){
$this->login = $login;
$this->password = $password;
} else {
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$this->login = $user->getLogin();
$this->password = $user->getPassword();
$this->nbReponses = $user->getNbRep();
if ( $user->checkModeEdition() ) {
$this->toNotCache = true;
}
}
}
/**
* setLog
* @param string $page
* @param string $siret
* @param string $id
* @param string $ref
*/
public function setLog ($page, $siret, $id=0, $ref = '')
{
$params = new stdClass();
$params->page = $idClient;
$params->siret = $siret;
$params->id = $id;
$params->ref = $ref;
$client = $this->loadClient('interne');
try {
$reponse = $client->setLog($params);
return true;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getDataCSV
* @param string $key
*/
public function getDataCSV($key)
{
$params = new stdClass();
$params->key = $key;
try {
$client = $this->loadClient('exporter');
$reponse = $client->getDataCSV($params);
return $reponse->getDataCSVResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getInfosLogin
* @param string $login
* @param string $ipUtilisateur
*/
public function getInfosLogin($login, $ipUtilisateur = '')
{
$params = new stdClass();
$params->login = $login;
$params->ipUtilisateur = $ipUtilisateur;
try {
$client = $this->loadClient('gestion');
$reponse = $client->getInfosLogin($params);
return $reponse->getInfosLoginResult;
} catch (SoapFault $fault) {
if ($fault->faultcode=='0900'){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
/**
* soaperror
* @param string $method
* @param soapfault $fault
* @param string $requete
* @param string $reponse
*/
protected function soaperror($method, $fault, $requete, $reponse)
{
$message = '';
$message.= 'Erreur SOAP - Code : '.$fault->faultcode.' - Message : '.$fault->faultstring;
$message.= ' - Utilisateur : '.$this->login;
$message.= "\n";
$message.= "Method : ".$method.", File :".$fault->getFile().", Ligne : ".$fault->getLine();
$message.= "\n";
$message.= "Detail :\n".$fault->getTraceAsString();
$message.= "\n\n";
$message.= "Requete :\n ".$requete."\n";
$message.= "Reponse :\n ".$reponse."\n";
$configuration = Zend_Registry::get('configuration');
require_once 'Scores/Mail.php';
$mail = new Mail();
$mail->setSubject('[ERREUR SOAP] - '.$configuration->server->name.' -'.date('Ymd'));
$mail->setBodyTexte($message);
$mail->setFrom('supportdev');
$mail->addToKey('supportdev');
$mail->send();
}
/**
* loadClient
* @param unknown_type $webservice
*/
protected function loadClient($webservice)
{
$wsdl = $this->webservices[$webservice]['wsdl'];
$options = $this->webservices[$webservice]['options'];
$options['features'] = SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS;
$options['compression'] = SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | SOAP_COMPRESSION_DEFLATE;
$options['login'] = $this->login;
$options['password'] = $this->password;
if (APPLICATION_ENV != 'production'){
$options['cache_wsdl'] = WSDL_CACHE_NONE;
}
$options['trace'] = true;
$options['encoding'] = 'utf-8';
$client = new SoapClient($wsdl, $options);
return $client;
}
}

View File

@ -0,0 +1,33 @@
<?php
define('MYSQL_HOST', '192.168.78.230');
define('MYSQL_USER', 'sphinx');
define('MYSQL_PASS', 'indexer');
define('MYSQL_DEFAULT_DB', 'jo');
Class ConfigurationGenerique
{
public static $debug = true;
public static $redevance_insee = 3.295;
public static $api = '2.0.2';
public function __construct(){set_limit(0);}
}
Class ConfigurationCiblage extends ConfigurationGenerique
{
public static $index = 'ciblage';
public static $nb_results = 5000;
public static $max_results = 500000;
public static $mysql_host = MYSQL_HOST;
public static $mysql_user = MYSQL_USER;
public static $mysql_password = MYSQL_PASS;
public static $mysql_database = MYSQL_DEFAULT_DB;
public static $sphinx_host = '192.168.78.252';
public static $sphinx_port = 3312;
public static $sphinx_match = SPH_MATCH_EXTENDED2;
public static $sphinx_sort = SPH_SORT_EXTENDED;
}

View File

@ -0,0 +1,16 @@
<?php
function Connexion_base()
{
$db = @mysql_connect('localhost','root','') or die('Erreur de connexion au MYSQL local');
$select_base=@mysql_selectdb('geo', $db);
}
function Deconnexion_base()
{
@mysql_close;
}
?>

View File

@ -0,0 +1,39 @@
[local]
webservices.interne.wsdl = "http://webservice-2.1.sd.dev/interne/v0.3?wsdl-auto"
webservices.interne.options.soap_version = SOAP_1_2
webservices.entreprise.wsdl = "http://webservice-2.1.sd.dev/entreprise/v0.4?wsdl-auto"
webservices.entreprise.options.soap_version = SOAP_1_2
webservices.gestion.wsdl = "http://webservice-2.1.sd.dev/gestion/v0.1?wsdl-auto"
webservices.gestion.options.soap_version = SOAP_1_2
webservices.exporter.wsdl = "http://webservice-2.1.sd.dev/exporter/v0.1?wsdl-auto"
webservices.exporter.options.soap_version = SOAP_1_2
[sdsrvdev01]
webservices.interne.wsdl = "http://webservice-2.1.sd.lan/interne/v0.3?wsdl-auto"
webservices.interne.options.soap_version = SOAP_1_2
webservices.entreprise.wsdl = "http://webservice-2.1.sd.lan/entreprise/v0.4?wsdl-auto"
webservices.entreprise.options.soap_version = SOAP_1_2
webservices.gestion.wsdl = "http://webservice-2.1.sd.lan/gestion/v0.1?wsdl-auto"
webservices.gestion.options.soap_version = SOAP_1_2
webservices.exporter.wsdl = "http://webservice-2.1.sd.lan/exporter/v0.1?wsdl-auto"
webservices.exporter.options.soap_version = SOAP_1_2
[sd-25137]
webservices.interne.wsdl = "http://wse.scores-decisions.com:8081/interne/v0.3?wsdl"
webservices.interne.options.soap_version = SOAP_1_2
webservices.entreprise.wsdl = "http://wse.scores-decisions.com:8081/entreprise/v0.4?wsdl"
webservices.entreprise.options.soap_version = SOAP_1_2
webservices.gestion.wsdl = "http://wse.scores-decisions.com:8081/gestion/v0.1?wsdl"
webservices.gestion.options.soap_version = SOAP_1_2
webservices.exporter.wsdl = "http://wse.scores-decisions.com:8081/exporter/v0.1?wsdl"
webservices.exporter.options.soap_version = SOAP_1_2
[celeste]
webservices.interne.wsdl = "http://wse.scores-decisions.com:8081/interne/v0.3?wsdl"
webservices.interne.options.soap_version = SOAP_1_2
webservices.entreprise.wsdl = "http://wse.scores-decisions.com:8081/entreprise/v0.4?wsdl"
webservices.entreprise.options.soap_version = SOAP_1_2
webservices.gestion.wsdl = "http://wse.scores-decisions.com:8081/gestion/v0.1?wsdl"
webservices.gestion.options.soap_version = SOAP_1_2
webservices.exporter.wsdl = "http://wse.scores-decisions.com:8081/exporter/v0.1?wsdl"
webservices.exporter.options.soap_version = SOAP_1_2

1242
library/Zend/Acl.php Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,64 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Acl
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Interface.php 23775 2011-03-01 17:25:24Z ralph $
*/
/**
* @see Zend_Acl
*/
require_once 'Zend/Acl.php';
/**
* @see Zend_Acl_Role_Interface
*/
require_once 'Zend/Acl/Role/Interface.php';
/**
* @see Zend_Acl_Resource_Interface
*/
require_once 'Zend/Acl/Resource/Interface.php';
/**
* @category Zend
* @package Zend_Acl
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Zend_Acl_Assert_Interface
{
/**
* Returns true if and only if the assertion conditions are met
*
* This method is passed the ACL, Role, Resource, and privilege to which the authorization query applies. If the
* $role, $resource, or $privilege parameters are null, it means that the query applies to all Roles, Resources, or
* privileges, respectively.
*
* @param Zend_Acl $acl
* @param Zend_Acl_Role_Interface $role
* @param Zend_Acl_Resource_Interface $resource
* @param string $privilege
* @return boolean
*/
public function assert(Zend_Acl $acl, Zend_Acl_Role_Interface $role = null, Zend_Acl_Resource_Interface $resource = null,
$privilege = null);
}

View File

@ -0,0 +1,36 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Acl
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Exception.php 23775 2011-03-01 17:25:24Z ralph $
*/
/**
* @see Zend_Exception
*/
require_once 'Zend/Exception.php';
/**
* @category Zend
* @package Zend_Acl
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Acl_Exception extends Zend_Exception
{}

View File

@ -0,0 +1,75 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Acl
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Resource.php 23775 2011-03-01 17:25:24Z ralph $
*/
/**
* @see Zend_Acl_Resource_Interface
*/
require_once 'Zend/Acl/Resource/Interface.php';
/**
* @category Zend
* @package Zend_Acl
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Acl_Resource implements Zend_Acl_Resource_Interface
{
/**
* Unique id of Resource
*
* @var string
*/
protected $_resourceId;
/**
* Sets the Resource identifier
*
* @param string $resourceId
* @return void
*/
public function __construct($resourceId)
{
$this->_resourceId = (string) $resourceId;
}
/**
* Defined by Zend_Acl_Resource_Interface; returns the Resource identifier
*
* @return string
*/
public function getResourceId()
{
return $this->_resourceId;
}
/**
* Defined by Zend_Acl_Resource_Interface; returns the Resource identifier
* Proxies to getResourceId()
*
* @return string
*/
public function __toString()
{
return $this->getResourceId();
}
}

View File

@ -0,0 +1,37 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Acl
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Interface.php 23775 2011-03-01 17:25:24Z ralph $
*/
/**
* @category Zend
* @package Zend_Acl
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Zend_Acl_Resource_Interface
{
/**
* Returns the string identifier of the Resource
*
* @return string
*/
public function getResourceId();
}

75
library/Zend/Acl/Role.php Normal file
View File

@ -0,0 +1,75 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Acl
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Role.php 23775 2011-03-01 17:25:24Z ralph $
*/
/**
* @see Zend_Acl_Role_Interface
*/
require_once 'Zend/Acl/Role/Interface.php';
/**
* @category Zend
* @package Zend_Acl
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Acl_Role implements Zend_Acl_Role_Interface
{
/**
* Unique id of Role
*
* @var string
*/
protected $_roleId;
/**
* Sets the Role identifier
*
* @param string $roleId
* @return void
*/
public function __construct($roleId)
{
$this->_roleId = (string) $roleId;
}
/**
* Defined by Zend_Acl_Role_Interface; returns the Role identifier
*
* @return string
*/
public function getRoleId()
{
return $this->_roleId;
}
/**
* Defined by Zend_Acl_Role_Interface; returns the Role identifier
* Proxies to getRoleId()
*
* @return string
*/
public function __toString()
{
return $this->getRoleId();
}
}

View File

@ -0,0 +1,37 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Acl
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Interface.php 23775 2011-03-01 17:25:24Z ralph $
*/
/**
* @category Zend
* @package Zend_Acl
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Zend_Acl_Role_Interface
{
/**
* Returns the string identifier of the Role
*
* @return string
*/
public function getRoleId();
}

View File

@ -0,0 +1,271 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Acl
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Registry.php 23775 2011-03-01 17:25:24Z ralph $
*/
/**
* @see Zend_Acl_Role_Interface
*/
require_once 'Zend/Acl/Role/Interface.php';
/**
* @category Zend
* @package Zend_Acl
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Acl_Role_Registry
{
/**
* Internal Role registry data storage
*
* @var array
*/
protected $_roles = array();
/**
* Adds a Role having an identifier unique to the registry
*
* The $parents parameter may be a reference to, or the string identifier for,
* a Role existing in the registry, or $parents may be passed as an array of
* these - mixing string identifiers and objects is ok - to indicate the Roles
* from which the newly added Role will directly inherit.
*
* In order to resolve potential ambiguities with conflicting rules inherited
* from different parents, the most recently added parent takes precedence over
* parents that were previously added. In other words, the first parent added
* will have the least priority, and the last parent added will have the
* highest priority.
*
* @param Zend_Acl_Role_Interface $role
* @param Zend_Acl_Role_Interface|string|array $parents
* @throws Zend_Acl_Role_Registry_Exception
* @return Zend_Acl_Role_Registry Provides a fluent interface
*/
public function add(Zend_Acl_Role_Interface $role, $parents = null)
{
$roleId = $role->getRoleId();
if ($this->has($roleId)) {
/**
* @see Zend_Acl_Role_Registry_Exception
*/
require_once 'Zend/Acl/Role/Registry/Exception.php';
throw new Zend_Acl_Role_Registry_Exception("Role id '$roleId' already exists in the registry");
}
$roleParents = array();
if (null !== $parents) {
if (!is_array($parents)) {
$parents = array($parents);
}
/**
* @see Zend_Acl_Role_Registry_Exception
*/
require_once 'Zend/Acl/Role/Registry/Exception.php';
foreach ($parents as $parent) {
try {
if ($parent instanceof Zend_Acl_Role_Interface) {
$roleParentId = $parent->getRoleId();
} else {
$roleParentId = $parent;
}
$roleParent = $this->get($roleParentId);
} catch (Zend_Acl_Role_Registry_Exception $e) {
throw new Zend_Acl_Role_Registry_Exception("Parent Role id '$roleParentId' does not exist", 0, $e);
}
$roleParents[$roleParentId] = $roleParent;
$this->_roles[$roleParentId]['children'][$roleId] = $role;
}
}
$this->_roles[$roleId] = array(
'instance' => $role,
'parents' => $roleParents,
'children' => array()
);
return $this;
}
/**
* Returns the identified Role
*
* The $role parameter can either be a Role or a Role identifier.
*
* @param Zend_Acl_Role_Interface|string $role
* @throws Zend_Acl_Role_Registry_Exception
* @return Zend_Acl_Role_Interface
*/
public function get($role)
{
if ($role instanceof Zend_Acl_Role_Interface) {
$roleId = $role->getRoleId();
} else {
$roleId = (string) $role;
}
if (!$this->has($role)) {
/**
* @see Zend_Acl_Role_Registry_Exception
*/
require_once 'Zend/Acl/Role/Registry/Exception.php';
throw new Zend_Acl_Role_Registry_Exception("Role '$roleId' not found");
}
return $this->_roles[$roleId]['instance'];
}
/**
* Returns true if and only if the Role exists in the registry
*
* The $role parameter can either be a Role or a Role identifier.
*
* @param Zend_Acl_Role_Interface|string $role
* @return boolean
*/
public function has($role)
{
if ($role instanceof Zend_Acl_Role_Interface) {
$roleId = $role->getRoleId();
} else {
$roleId = (string) $role;
}
return isset($this->_roles[$roleId]);
}
/**
* Returns an array of an existing Role's parents
*
* The array keys are the identifiers of the parent Roles, and the values are
* the parent Role instances. The parent Roles are ordered in this array by
* ascending priority. The highest priority parent Role, last in the array,
* corresponds with the parent Role most recently added.
*
* If the Role does not have any parents, then an empty array is returned.
*
* @param Zend_Acl_Role_Interface|string $role
* @uses Zend_Acl_Role_Registry::get()
* @return array
*/
public function getParents($role)
{
$roleId = $this->get($role)->getRoleId();
return $this->_roles[$roleId]['parents'];
}
/**
* Returns true if and only if $role inherits from $inherit
*
* Both parameters may be either a Role or a Role identifier. If
* $onlyParents is true, then $role must inherit directly from
* $inherit in order to return true. By default, this method looks
* through the entire inheritance DAG to determine whether $role
* inherits from $inherit through its ancestor Roles.
*
* @param Zend_Acl_Role_Interface|string $role
* @param Zend_Acl_Role_Interface|string $inherit
* @param boolean $onlyParents
* @throws Zend_Acl_Role_Registry_Exception
* @return boolean
*/
public function inherits($role, $inherit, $onlyParents = false)
{
/**
* @see Zend_Acl_Role_Registry_Exception
*/
require_once 'Zend/Acl/Role/Registry/Exception.php';
try {
$roleId = $this->get($role)->getRoleId();
$inheritId = $this->get($inherit)->getRoleId();
} catch (Zend_Acl_Role_Registry_Exception $e) {
throw new Zend_Acl_Role_Registry_Exception($e->getMessage(), $e->getCode(), $e);
}
$inherits = isset($this->_roles[$roleId]['parents'][$inheritId]);
if ($inherits || $onlyParents) {
return $inherits;
}
foreach ($this->_roles[$roleId]['parents'] as $parentId => $parent) {
if ($this->inherits($parentId, $inheritId)) {
return true;
}
}
return false;
}
/**
* Removes the Role from the registry
*
* The $role parameter can either be a Role or a Role identifier.
*
* @param Zend_Acl_Role_Interface|string $role
* @throws Zend_Acl_Role_Registry_Exception
* @return Zend_Acl_Role_Registry Provides a fluent interface
*/
public function remove($role)
{
/**
* @see Zend_Acl_Role_Registry_Exception
*/
require_once 'Zend/Acl/Role/Registry/Exception.php';
try {
$roleId = $this->get($role)->getRoleId();
} catch (Zend_Acl_Role_Registry_Exception $e) {
throw new Zend_Acl_Role_Registry_Exception($e->getMessage(), $e->getCode(), $e);
}
foreach ($this->_roles[$roleId]['children'] as $childId => $child) {
unset($this->_roles[$childId]['parents'][$roleId]);
}
foreach ($this->_roles[$roleId]['parents'] as $parentId => $parent) {
unset($this->_roles[$parentId]['children'][$roleId]);
}
unset($this->_roles[$roleId]);
return $this;
}
/**
* Removes all Roles from the registry
*
* @return Zend_Acl_Role_Registry Provides a fluent interface
*/
public function removeAll()
{
$this->_roles = array();
return $this;
}
public function getRoles()
{
return $this->_roles;
}
}

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