This commit is contained in:
Michael RICOIS 2011-11-29 15:53:05 +00:00
parent 44225fc4b4
commit bf4ad53075
16 changed files with 369 additions and 76 deletions

View File

@ -29,16 +29,15 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
->appendStylesheet($pathStyle.'/jquery.qtip.css', 'all')
->appendStylesheet($pathStyle.'/main.css', 'all')
->appendStylesheet('/themes/jstree/default/style.css');
$view->headScript()
->appendFile($pathScript.'/jquery.js', 'text/javascript')
->appendFile($pathScript.'/jquery.bgiframe.js', 'text/javascript')
->appendFile($pathScript.'/jquery.cookie.js', 'text/javascript')
->appendFile($pathScript.'/jquery-ui.js', 'text/javascript')
->appendFile($pathScript.'/jquery.qtip.js', 'text/javascript')
->appendFile($pathScript.'/scripts.js', 'text/javascript');
$view->headTitle()->setSeparator(' - ');
$view->headTitle('Odea');
}

View File

@ -0,0 +1,97 @@
<?php
class ArborescenceController extends Zend_Controller_Action
{
/**
*
* Enter description here ...
*/
public function nafAction()
{
$this->_helper->layout()->disableLayout();
$this->view->inlineScript()->appendFile('/themes/default/scripts/jquery.jstree.js');
$request = $this->getRequest();
$niveau = $request->getParam('niveau', 1);
$nafM = new Application_Model_Naf();
$sql = $nafM->select()->where('niveau = ?', $niveau)->order('code ASC');
$result = $nafM->fetchAll($sql)->toArray();
$tabNaf = array();
foreach($result as $item){
$tabNaf[] = array(
'data' => $item['code'].' - '.$item['lib'],
'attr' => array('id' => $item['code'], 'niveau' => $item['niveau']),
'state' => 'closed',
'children' => array(),
);
}
$this->view->assign('naf', json_encode($tabNaf));
}
public function nafajaxAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$request = $this->getRequest();
$niveau = $request->getParam('niveau', 1);
$niveau++;
$parent = $request->getParam('parent', '');
$nafM = new Application_Model_Naf();
$sql = $nafM->select();
if (!empty($parent) && $niveau==2) {
$sql->where('parent = ?', $parent);
} elseif (!empty($parent) && $niveau>2) {
$sql->where("code LIKE '".$parent."%'");
}
$sql->where('niveau = ?', $niveau)->order('code ASC');
$result = $nafM->fetchAll($sql)->toArray();
$tabNaf = array();
foreach($result as $item){
$naf = array(
'data' => $item['code'].' - '.$item['lib'],
'attr' => array('id' => $item['code'], 'niveau' => $item['niveau']),
);
if ($niveau<5){
$naf['state'] = 'closed';
$naf['children'] = array();
}
$tabNaf[] = $naf;
}
echo json_encode($tabNaf);
}
/**
*
* Enter description here ...
*/
public function geographiqueAction()
{
$this->_helper->layout()->disableLayout();
$this->view->inlineScript()->appendFile('/themes/default/scripts/jquery.jstree.js');
$regionsM = new Application_Model_Regions();
//$sql = $regionsM->select();
$this->view->assign('regions', $regionsM->fetchAll()->toArray());
}
/**
*
* Enter description here ...
*/
public function juridqueAction()
{
}
}

View File

@ -11,25 +11,7 @@ class CriteresController extends Zend_Controller_Action
public function economiqueAction()
{
$this->_helper->layout()->disableLayout();
$this->view->inlineScript()->appendFile('/themes/default/scripts/jquery.jstree.js');
$request = $this->getRequest();
$niveau = 1;
$nafM = new Application_Model_Naf();
$sql = $nafM->select()->where('niveau = ?', $niveau)->order('code ASC');
$result = $nafM->fetchAll($sql)->toArray();
$tabNaf = array();
foreach($result as $item){
$tabNaf[] = array(
'data' => $item['code'].' - '.$item['lib'],
'attr' => array('id' => $item['code'], 'niveau' => $item['niveau']),
'state' => 'closed',
'children' => array(),
);
}
$this->view->assign('naf', json_encode($tabNaf));
}
public function nafAction()

View File

@ -0,0 +1,8 @@
<?php
class DashboardController extends Zend_Controller_Action
{
}

View File

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

View File

@ -0,0 +1,23 @@
<div id="regions" class="jstree jstree-default" style="height:200px;overflow:auto;">
<ul>
<?php foreach($this->regions as $region): ?>
<li id="region<?=$region['code']?>">
<ins class="jstree-icon">&nbsp;</ins>
<a class="" href="#"><ins class="jstree-icon">&nbsp;</ins><?=$region['libelle']?></a>
</li>
<?php endforeach;?>
</ul>
</div>
<?=$this->inlineScript()?>
<script>
$("#regions").jstree({
"themes" : {
"theme" : "default",
"dots" : true,
"icons" : false,
},
"plugins" : ["themes", "html_data", "ui", "checkbox"]
});
</script>

View File

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

View File

@ -4,34 +4,16 @@
</div>
<br/>
<p>Liste des NAF</p>
<div id="naf" class="jstree jstree-default" style="height:300px;width:680px;overflow:auto;">
<div>
<label>Liste de NAF (séparés par des virgules)</label><br/>
<textarea cols="100" name="" style="width:100%;"></textarea>
<div style="text-align:right;">
<a href="">Intégrer dans les critères</a>
</div>
</div>
<br/>
<div>
<label>Liste de NAF (séparés par des virgules)</label><br/>
<textarea rows="2" cols="100" name=""></textarea>
<div style="text-align:right;">
<a href="">Réinitialiser les critères économiques</a>
</div>
<?=$this->inlineScript()?>
<script>
$("#naf").jstree({
"themes" : {
"theme" : "default",
"url" : "/themes/jstree/default/style.css",
"dots" : true,
"icons" : false,
},
"plugins" : ["themes", "json_data", "checkbox", "ui"],
"json_data" : {
"data" : <?=$this->naf?>,
"ajax" : {
"url" : '<?=$this->url(array('controller'=>'criteres', 'action'=>'naf'))?>',
"data" : function(n) { return { parent: n.attr ? n.attr("id") : '' , niveau : n.attr ? n.attr("niveau") : 1 }; },
"cache" : true,
}
}
});
</script>

View File

@ -1,3 +1,4 @@
<div>
<p>
<label>Etablissements :</label>
<select name="Entreprise[Etablissements]">
@ -39,4 +40,9 @@
<input type="" name="ChiffreCles[NbEtablissements]" value=""/>
</p>
Intervalle Effectif (Tranches ou Réel) - Entreprise, Etablissement
Intervalle Effectif (Tranches ou Réel) - Entreprise, Etablissement
</div>
<div style="text-align:right;">
<a href="">Réinitialiser les critères entreprises</a>
</div>

View File

@ -9,4 +9,8 @@ Intervalle CA - Selection (Moins de 15000 euros, de 15000 à 30000, de 30000 à
<p>Intervalle CA à l'export</p>
<p>ACTIF - PASSIF - COMPTE DE RESULTAT - ANNEXES</p>
<p>Ratios</p>
<p>Scores (Risques de défaillance)</p>
<p>Scores (Risques de défaillance)</p>
<div>
<a href="">Réinitialiser les critères financiers</a>
</div>

View File

@ -18,27 +18,6 @@
<br/>
<p>Sélection Interactive</p>
<div id="regions" class="jstree jstree-default" style="height:200px;overflow:auto;">
<ul>
<?php foreach($this->regions as $region): ?>
<li id="region<?=$region['code']?>">
<ins class="jstree-icon">&nbsp;</ins>
<a class="" href="#"><ins class="jstree-icon">&nbsp;</ins><?=$region['libelle']?></a>
</li>
<?php endforeach;?>
</ul>
</div>
<?=$this->inlineScript()?>
<script>
$("#regions").jstree({
"themes" : {
"theme" : "default",
"dots" : true,
"icons" : false,
},
"plugins" : ["themes", "html_data", "ui", "checkbox"]
});
</script>
<div style="text-align:right;">
<a href="">Réinitialiser les critères géographiques</a>
</div>

View File

@ -9,4 +9,8 @@
<input type="text" name=""/>
<br/><a href="">Consulter la liste des catégories juridiques</a>, ex: 75,78,...
<br/><br/>
</fieldset>
</fieldset>
<div>
<a href="">Réinitialiser les critères juridiques</a>
</div>

View File

@ -1,4 +1,3 @@
<div id="tabs">
<ul>
<li><a href="#tabs-1">Critères Entreprise</a></li>
@ -28,6 +27,9 @@ Rappel des critères de selection
$(function() {
$( "#tabs" ).tabs({
cache: true,
cookie: {
expires: 1
},
ajaxOptions: {
error: function( xhr, status, index, anchor ) {
$( anchor.hash ).html("Erreur lors du chargement...");

110
batch/getDataCSV.php Normal file
View File

@ -0,0 +1,110 @@
#!/usr/bin/php -q
<?php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$configuration = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini');
Zend_Registry::set('configuration', $configuration);
try {
$opts = new Zend_Console_Getopt(
//Options
array(
'help|?' => "Affiche l'aide.",
'all' => "Charge tout les éléments",
'one' => "Charge un élément",
)
);
$opts->parse();
} catch (Zend_Console_Getopt_Exception $e) {
echo $e->getUsageMessage();
exit;
}
//Usage
if(count($opts->getOptions())==0 || isset($opts->help))
{
echo "Charge les données nécessaire à l'applicatioon à partir du webservice.";
echo "\n\n";
echo $opts->getUsageMessage();
echo "\n";
exit;
}
//Utilisateur webservice
define('LOGIN', '');
define('PASSWORD', '');
$args = $opts->getRemainingArgs();
$elements = array('naf');
if ($opts->all || $opts->one){
require_once 'Scores/WsScores.php';
$ws = new WsScores(LOGIN, PASSWORD);
}
if ($opts->all)
{
foreach($elements as $element)
{
$reponse = $ws->getDataCSV($element);
}
} elseif ($opts->one) {
//Vérification
$element = $args[0];
if (!in_array($args[0], $elements)){
echo 'Element inconnu !';
}
$reponse = $ws->getDataCSV($element);
}
//Méthodes interne
function getFichier($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_COOKIEFILE,TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
function saveToDatabase($key, $filename)
{
//Vider la table
$sql = "TRUNCATE $key";
//Sauvegarder toutes les lignes
$cmd = "mysqlimport --ignore-lines=1 --fields-enclosed-by=\\\" --fields-terminated-by=, --user=USERNAME --password=PASSWORD ciblage $filename";
exec($command);
}
?>

View File

@ -0,0 +1,41 @@
/**
* jQuery Cookie plugin
*
* Copyright (c) 2010 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
jQuery.cookie = function (key, value, options) {
// key and at least value given, set cookie...
if (arguments.length > 1 && String(value) !== "[object Object]") {
options = jQuery.extend({}, options);
if (value === null || value === undefined) {
options.expires = -1;
}
if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setDate(t.getDate() + days);
}
value = String(value);
return (document.cookie = [
encodeURIComponent(key), '=',
options.raw ? value : encodeURIComponent(value),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}
// key and possibly options given, get cookie...
options = value || {};
var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
};

View File

@ -184,4 +184,6 @@ h3 {
border-top-left-radius:0;
}
#naf li { width:650px; }
#naf a { }
#naf a ins { }